* {
  box-sizing: border-box;
  letter-spacing: 0;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  color: #f6ead0;
  background:
    linear-gradient(90deg, rgba(216, 194, 140, 0.08) 1px, transparent 1px) 0 0 / 46px 46px,
    linear-gradient(180deg, #050806 0%, #10100b 52%, #060706 100%);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", sans-serif;
}

button {
  border: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

#app {
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
  display: flex;
  justify-content: center;
}

.game-shell {
  position: relative;
  width: 100%;
  max-width: 430px;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
  padding: calc(12px + env(safe-area-inset-top)) 14px calc(12px + env(safe-area-inset-bottom));
  background:
    linear-gradient(90deg, rgba(20, 58, 47, 0.16), transparent 16%, transparent 84%, rgba(20, 58, 47, 0.16)),
    linear-gradient(180deg, rgba(12, 18, 14, 0.96), rgba(13, 13, 9, 0.98));
  box-shadow: 0 0 42px rgba(0, 0, 0, 0.72);
}

.game-shell::before {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  content: "";
  opacity: 0.42;
  background:
    linear-gradient(90deg, transparent 0 8%, rgba(213, 184, 111, 0.1) 8% 8.4%, transparent 8.4% 91.6%, rgba(213, 184, 111, 0.1) 91.6% 92%, transparent 92%),
    repeating-linear-gradient(0deg, transparent 0 34px, rgba(233, 215, 164, 0.05) 35px 36px);
}

.game-shell > * {
  position: relative;
  z-index: 1;
}

@keyframes shellEnter {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.992);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes panelRise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes modalFade {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes modalPop {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.96);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes noticeIn {
  from {
    opacity: 0;
    transform: translate(-50%, 8px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
  }
}

@keyframes selectedPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(141, 232, 193, 0), inset 0 0 0 2px rgba(255, 248, 220, 0.46);
  }

  62% {
    box-shadow: 0 0 0 4px rgba(141, 232, 193, 0.34), inset 0 0 0 2px rgba(255, 248, 220, 0.46);
  }

  100% {
    box-shadow: 0 0 0 2px rgba(42, 102, 83, 0.72), 0 0 18px rgba(141, 232, 193, 0.34);
  }
}

.game-shell.is-page-enter {
  animation: shellEnter 180ms ease-out both;
}

.game-shell.is-page-enter .hero-block,
.game-shell.is-page-enter .event-header,
.game-shell.is-page-enter .event-card,
.game-shell.is-page-enter .resource-grid,
.game-shell.is-page-enter .ending-hero,
.game-shell.is-page-enter .ending-actions {
  animation: panelRise 190ms ease-out both;
}

.game-shell.is-page-enter .choice-item {
  animation: panelRise 170ms ease-out both;
}

.game-shell.is-page-enter .choice-item:nth-child(2) {
  animation-delay: 24ms;
}

.game-shell.is-page-enter .choice-item:nth-child(3) {
  animation-delay: 48ms;
}

.game-shell.is-page-enter .choice-item:nth-child(4) {
  animation-delay: 72ms;
}

.game-shell.is-page-enter .choice-item:nth-child(n + 5) {
  animation-delay: 88ms;
}

button,
.resource-card,
.choice-item,
.permission-chip,
.stat-chip,
.event-card {
  transition: transform 120ms ease, box-shadow 160ms ease, border-color 160ms ease, background 160ms ease, opacity 160ms ease, filter 160ms ease;
}

button:not(:disabled):active {
  transform: translateY(2px) scale(0.99);
}

.audio-toggle {
  position: absolute;
  top: calc(10px + env(safe-area-inset-top));
  right: 12px;
  z-index: 6;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(222, 190, 112, 0.58);
  border-radius: 50%;
  color: #c7a24e;
  background: rgba(8, 10, 8, 0.72);
  box-shadow: inset 0 0 0 1px rgba(255, 238, 177, 0.16), 0 6px 14px rgba(0, 0, 0, 0.34);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.28rem;
  line-height: 1;
}

.audio-toggle.is-on {
  color: #f1d98d;
  border-color: rgba(241, 217, 141, 0.78);
  box-shadow: inset 0 0 0 1px rgba(255, 238, 177, 0.22), 0 0 14px rgba(207, 164, 75, 0.24);
}

.audio-toggle:disabled {
  opacity: 0.36;
}

.brand-small,
.screen-subtitle,
.intro-copy,
.bottom-action p,
.event-card p,
.ending-hero p,
.picked-line,
.result-text,
.book-item span,
.book-item p {
  font-family: "STKaiti", "KaiTi", "SimSun", serif;
}

.brand-small {
  color: #d6c08a;
  font-size: 1rem;
  text-align: center;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.8);
}

.hero-block h1,
.event-header h1,
.ending-hero h1 {
  margin: 6px 0 8px;
  color: #ead494;
  font-family: "STKaiti", "KaiTi", "SimSun", serif;
  font-size: 3rem;
  line-height: 1.04;
  text-align: center;
  text-shadow: 0 3px 0 rgba(57, 34, 14, 0.75), 0 10px 24px rgba(0, 0, 0, 0.8);
}

.start-screen .hero-block h1 {
  margin: 2px 44px 6px;
  font-size: 2.2rem;
  line-height: 1.05;
  white-space: nowrap;
}

.start-screen,
.event-screen {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.start-screen {
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
}

.event-screen {
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
}

.event-header {
  display: grid;
  flex: 0 0 auto;
  gap: 6px;
}

.hero-block {
  flex: 0 0 auto;
}

.screen-subtitle {
  margin: 0 0 12px;
  color: #e3cf9c;
  font-size: 1.22rem;
  text-align: center;
}

.identity-bar,
.state-ribbon {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 44px;
  margin: 0 auto 12px;
  padding: 8px 14px;
  border: 1px solid rgba(220, 195, 136, 0.42);
  color: #ead9b4;
  background: rgba(9, 12, 9, 0.72);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.38);
}

.identity-bar {
  max-width: 230px;
  border-radius: 6px;
}

.identity-bar strong {
  min-width: 92px;
  padding: 5px 18px;
  border: 1px solid rgba(174, 219, 194, 0.55);
  border-radius: 5px;
  color: #f2e8cc;
  background: #2d594d;
  text-align: center;
}

.intro-copy {
  margin: 0 4px 6px;
  color: #dccba6;
  font-size: 0.92rem;
  line-height: 1.45;
  text-align: center;
}

.resource-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(3, minmax(0, 1fr));
  flex: 1 1 auto;
  min-height: 0;
  gap: 8px;
}

.resource-card {
  position: relative;
  display: flex;
  width: 100%;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 7px 8px 6px;
  border: 2px solid rgba(91, 66, 39, 0.76);
  border-radius: 8px;
  color: #271f18;
  background:
    linear-gradient(180deg, rgba(255, 250, 232, 0.88), rgba(228, 211, 171, 0.94)),
    repeating-linear-gradient(0deg, rgba(98, 72, 38, 0.06) 0 1px, transparent 1px 6px);
  box-shadow: 0 7px 0 rgba(0, 0, 0, 0.18), inset 0 0 0 2px rgba(255, 246, 214, 0.45);
}

.resource-card.is-selected {
  border-color: rgba(176, 230, 203, 0.95);
  box-shadow: 0 0 0 2px rgba(48, 116, 93, 0.78), 0 0 22px rgba(141, 232, 193, 0.42);
  animation: selectedPulse 180ms ease-out both;
}

.card-index {
  position: absolute;
  top: 7px;
  left: 7px;
  width: 28px;
  height: 28px;
  border: 2px solid rgba(239, 219, 171, 0.7);
  border-radius: 50%;
  color: #f1dfb6;
  background: #5a4a35;
  font-family: Georgia, serif;
  font-size: 1rem;
  line-height: 24px;
}

.selected-check {
  position: absolute;
  top: 7px;
  right: 7px;
  display: none;
  width: 36px;
  height: 36px;
  border: 2px solid rgba(240, 220, 163, 0.78);
  border-radius: 50%;
  color: #f6e9be;
  background: #2d594d;
  font-size: 1.5rem;
  line-height: 31px;
}

.resource-card.is-selected .selected-check {
  display: block;
}

.resource-name {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-width: 0;
  min-height: 22px;
  padding: 0 28px;
  font-family: "STKaiti", "KaiTi", "SimSun", serif;
  font-size: 1.08rem;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  overflow: hidden;
  text-overflow: clip;
  white-space: nowrap;
  word-break: keep-all;
}

.resource-name.is-long-name {
  font-size: 0.92rem;
}

.resource-name.is-extra-long-name {
  padding: 0 24px;
  font-size: 0.8rem;
  line-height: 1.1;
  white-space: normal;
}

.resource-tagline {
  width: 100%;
  min-width: 0;
  padding-top: 3px;
  border-top: 1px solid rgba(82, 58, 32, 0.22);
  font-family: "STKaiti", "KaiTi", "SimSun", serif;
  display: -webkit-box;
  overflow: hidden;
  font-size: 0.72rem;
  line-height: 1.1;
  text-align: center;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.resource-visual {
  position: relative;
  display: block;
  width: 100%;
  height: clamp(84px, 13dvh, 108px);
  margin: 3px 0 4px;
  border-radius: 4px;
  overflow: hidden;
  background: linear-gradient(180deg, #eee0c3, #cfbb8b);
}

.resource-visual::before,
.resource-visual::after,
.resource-visual i,
.resource-visual b {
  position: absolute;
  display: block;
  content: "";
}

.resource-rice::before {
  left: 28%;
  bottom: 18px;
  width: 72px;
  height: 30px;
  border: 5px solid #7a4f26;
  border-top: 0;
  border-radius: 0 0 40px 40px;
  background: #ad6d32;
}

.resource-rice::after {
  left: 30%;
  bottom: 36px;
  width: 68px;
  height: 24px;
  border-radius: 50%;
  background: #f7f1db;
  box-shadow: 0 0 0 5px rgba(255, 255, 255, 0.28);
}

.resource-firearms::before {
  left: 20%;
  top: 30px;
  width: 108px;
  height: 15px;
  border-radius: 10px;
  background: #40382d;
  transform: rotate(-8deg);
}

.resource-firearms::after {
  right: 18%;
  top: 20px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #6f6048;
  box-shadow: -55px 34px 0 -8px #5c4931, -18px 33px 0 -8px #5c4931;
}

.resource-deathsworn {
  background: linear-gradient(180deg, #d9d2c3, #a99a7a);
}

.resource-deathsworn::before {
  left: 22%;
  bottom: 14px;
  width: 24px;
  height: 54px;
  background: #1c1a17;
  box-shadow: 36px 0 0 #25211b, 72px 0 0 #1a1713;
  clip-path: polygon(50% 0, 72% 18%, 72% 100%, 28% 100%, 28% 18%);
}

.resource-deathsworn::after {
  left: 16%;
  bottom: 13px;
  width: 128px;
  height: 3px;
  background: #8f2525;
  transform: rotate(9deg);
}

.resource-map::before {
  left: 18%;
  top: 18px;
  width: 112px;
  height: 46px;
  border: 3px solid #8a6a3a;
  background:
    linear-gradient(45deg, transparent 30%, rgba(49, 96, 77, 0.24) 31% 41%, transparent 42%),
    linear-gradient(135deg, transparent 36%, rgba(143, 84, 55, 0.22) 37% 48%, transparent 49%),
    #e7d5a9;
  transform: rotate(-6deg);
}

.resource-map::after {
  right: 18%;
  bottom: 16px;
  width: 28px;
  height: 28px;
  border: 3px solid #4f6f65;
  border-radius: 50%;
}

.resource-harem {
  background: linear-gradient(180deg, #ead8c4, #c8aa9b);
}

.resource-harem::before {
  left: 34%;
  top: 15px;
  width: 46px;
  height: 58px;
  border-radius: 46% 46% 18% 18%;
  background: #e8c7b4;
  box-shadow: -20px 18px 0 -8px rgba(163, 74, 82, 0.72), 25px 16px 0 -8px rgba(45, 89, 77, 0.72);
}

.resource-harem::after {
  left: 38%;
  top: 10px;
  width: 38px;
  height: 23px;
  border-radius: 50% 50% 30% 30%;
  background: #2b211b;
}

.resource-money::before {
  left: 18%;
  bottom: 14px;
  width: 116px;
  height: 40px;
  border-radius: 10px;
  background: #37291b;
}

.resource-money::after {
  left: 24%;
  bottom: 30px;
  width: 28px;
  height: 16px;
  border-radius: 50%;
  background: #d6ad45;
  box-shadow: 28px -6px 0 #e3c66a, 58px 1px 0 #b9913c, 84px -8px 0 #e8cf73, 20px 14px 0 #c9a14f, 54px 16px 0 #e4bd59;
}

.resource-visual.is-image {
  background: #211912;
}

.resource-visual.is-image::before,
.resource-visual.is-image::after {
  display: none;
  content: none;
}

.resource-visual img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  user-select: none;
}

.bottom-action {
  flex: 0 0 auto;
  margin-top: 2px;
  text-align: center;
}

.bottom-action p {
  min-height: 20px;
  margin: 0 0 5px;
  color: #e8d39e;
  font-size: 0.95rem;
  line-height: 1.15;
}

.gold-button,
.jade-button {
  width: 100%;
  min-height: 50px;
  border: 2px solid rgba(242, 220, 153, 0.68);
  border-radius: 7px;
  font-family: "STKaiti", "KaiTi", "SimSun", serif;
  font-size: 1.58rem;
  font-weight: 700;
  line-height: 1.1;
  box-shadow: inset 0 0 0 2px rgba(95, 63, 22, 0.25), 0 6px 0 rgba(0, 0, 0, 0.24);
}

.gold-button {
  color: #332817;
  background: linear-gradient(180deg, #f0d996, #c19a43);
}

.jade-button {
  color: #f7ead0;
  background: linear-gradient(180deg, #4d7e6d, #2d594d);
}

.gold-button:disabled {
  opacity: 0.42;
}

@media (hover: hover) and (pointer: fine) {
  .gold-button:not(:disabled):hover,
  .jade-button:not(:disabled):hover,
  .audio-toggle:not(:disabled):hover,
  .resource-card:not(:disabled):hover,
  .choice-item:not(.is-disabled):not(:disabled):hover {
    filter: brightness(1.045);
    transform: translateY(-1px);
  }
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  flex: 0 0 auto;
  gap: 6px;
  margin: 0;
}

.stat-chip {
  display: grid;
  grid-template-columns: 24px 1fr;
  align-items: center;
  min-height: 34px;
  gap: 5px;
  padding: 5px 7px;
  border: 1px solid rgba(195, 158, 93, 0.52);
  border-radius: 5px;
  color: #ead8af;
  background: rgba(9, 9, 7, 0.76);
}

.stat-mark {
  display: inline-flex;
  width: 22px;
  height: 22px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(233, 207, 143, 0.45);
  border-radius: 50%;
  color: #16120d;
  background: #d7c28b;
  font-size: 0.78rem;
  font-weight: 700;
}

.stat-chip strong {
  min-width: 0;
  overflow: hidden;
  font-size: 1.02rem;
  text-align: right;
  text-overflow: ellipsis;
}

.state-ribbon {
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 14px;
  flex: 0 0 auto;
  min-height: 34px;
  margin: 0;
  padding: 5px 10px;
  color: #dfcea8;
  font-family: "STKaiti", "KaiTi", "SimSun", serif;
  font-size: 0.98rem;
}

.permission-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  flex: 0 0 auto;
  gap: 6px;
  margin: 0;
}

.permission-chip {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 8px;
  min-height: 38px;
  padding: 5px 7px;
  border: 1px solid rgba(195, 158, 93, 0.42);
  border-radius: 5px;
  color: #e9d7a8;
  background: rgba(9, 9, 7, 0.66);
}

.permission-chip span {
  min-width: 0;
  overflow: hidden;
  font-size: 0.8rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.permission-chip strong {
  color: #d7c28b;
  font-size: 0.82rem;
}

.permission-chip em {
  grid-column: 1 / -1;
  color: rgba(233, 215, 164, 0.72);
  font-size: 0.74rem;
  font-style: normal;
}

.permission-chip.is-awake {
  border-color: rgba(164, 219, 190, 0.72);
  background: rgba(45, 89, 77, 0.42);
}

.permission-chip.is-backlash {
  border-color: rgba(183, 75, 67, 0.72);
  background: rgba(87, 30, 25, 0.48);
}

.event-card {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
  padding: 10px 10px 12px;
  border: 2px solid rgba(166, 136, 81, 0.72);
  border-radius: 8px;
  color: #211912;
  background:
    linear-gradient(180deg, rgba(250, 240, 212, 0.96), rgba(225, 207, 164, 0.98)),
    repeating-linear-gradient(90deg, rgba(107, 77, 42, 0.05) 0 1px, transparent 1px 7px);
  box-shadow: 0 0 0 2px rgba(50, 95, 78, 0.36), 0 8px 24px rgba(0, 0, 0, 0.38);
}

.event-card h2 {
  flex: 0 0 auto;
  margin: 0 0 8px;
  color: #16100c;
  font-family: "STKaiti", "KaiTi", "SimSun", serif;
  display: -webkit-box;
  overflow: hidden;
  font-size: clamp(1.5rem, 5.6dvh, 2rem);
  line-height: 1.08;
  text-align: center;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.event-card p {
  flex: 0 0 auto;
  display: -webkit-box;
  overflow: hidden;
  margin: 8px 4px 0;
  font-size: 0.98rem;
  line-height: 1.42;
  text-align: center;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.scene {
  position: relative;
  flex: 1 1 auto;
  height: clamp(92px, 20dvh, 156px);
  min-height: 86px;
  overflow: hidden;
  border: 1px solid rgba(95, 67, 32, 0.46);
  border-radius: 6px;
  background:
    linear-gradient(180deg, rgba(242, 228, 193, 0.88), rgba(176, 157, 118, 0.9)),
    linear-gradient(90deg, rgba(42, 85, 70, 0.18), transparent 35%, rgba(127, 47, 47, 0.12));
}

.scene::before,
.scene::after,
.scene span {
  position: absolute;
  display: block;
  content: "";
}

.scene::before {
  left: 0;
  right: 0;
  bottom: 0;
  height: 52px;
  background: linear-gradient(180deg, rgba(99, 76, 49, 0.15), rgba(65, 44, 25, 0.5));
}

.scene::after {
  left: 10%;
  right: 10%;
  bottom: 44px;
  height: 38px;
  background:
    linear-gradient(90deg, transparent, rgba(50, 35, 22, 0.56) 16% 18%, transparent 20% 32%, rgba(50, 35, 22, 0.5) 34% 36%, transparent 38%),
    linear-gradient(180deg, rgba(101, 80, 53, 0.36), rgba(54, 38, 24, 0.44));
  clip-path: polygon(0 100%, 8% 28%, 18% 100%, 27% 35%, 38% 100%, 48% 28%, 61% 100%, 72% 36%, 82% 100%, 92% 30%, 100% 100%);
}

.scene-sun {
  top: 20px;
  right: 44px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(224, 185, 93, 0.28);
}

.scene-wall {
  left: 48%;
  bottom: 52px;
  width: 128px;
  height: 56px;
  background: rgba(74, 54, 35, 0.44);
  clip-path: polygon(0 100%, 0 34%, 12% 34%, 12% 18%, 28% 18%, 28% 34%, 45% 34%, 45% 10%, 60% 10%, 60% 34%, 78% 34%, 78% 18%, 92% 18%, 92% 34%, 100% 34%, 100% 100%);
}

.scene-road {
  left: 35%;
  bottom: -8px;
  width: 112px;
  height: 78px;
  background: rgba(120, 95, 64, 0.32);
  clip-path: polygon(36% 0, 62% 0, 100% 100%, 0 100%);
}

.scene-figure {
  bottom: 34px;
  width: 18px;
  height: 42px;
  background: #2f251b;
  clip-path: polygon(50% 0, 72% 22%, 72% 100%, 28% 100%, 28% 22%);
}

.scene-figure-one {
  left: 27%;
}

.scene-figure-two {
  left: 37%;
  transform: scale(0.78);
  opacity: 0.72;
}

.scene-standard {
  left: 19%;
  bottom: 40px;
  width: 4px;
  height: 70px;
  background: #3a2b1e;
}

.scene-standard::after {
  position: absolute;
  left: 4px;
  top: 3px;
  width: 48px;
  height: 20px;
  content: "";
  background: #7b2f2f;
  clip-path: polygon(0 0, 100% 16%, 76% 52%, 100% 88%, 0 100%);
}

.scene-army,
.scene-banner,
.scene-palace,
.scene-ironDynasty,
.scene-purgeCourt {
  background:
    linear-gradient(180deg, rgba(212, 198, 171, 0.9), rgba(104, 101, 85, 0.96)),
    linear-gradient(90deg, rgba(123, 47, 47, 0.34), transparent 70%);
}

.scene-granary,
.scene-registry,
.scene-moneyCrash {
  background:
    linear-gradient(180deg, rgba(229, 215, 179, 0.92), rgba(145, 113, 71, 0.9)),
    linear-gradient(90deg, rgba(216, 173, 69, 0.18), transparent);
}

.scene-court,
.scene-capital,
.scene-edict,
.scene-regent,
.scene-shadowEmperor,
.scene-saviorKing,
.scene-loyalKing {
  background:
    linear-gradient(180deg, rgba(234, 217, 180, 0.92), rgba(95, 77, 52, 0.9)),
    linear-gradient(90deg, rgba(45, 89, 77, 0.18), transparent 76%);
}

.scene-shrine,
.scene-mansion,
.scene-innerChaos {
  background:
    linear-gradient(180deg, rgba(232, 213, 194, 0.94), rgba(129, 85, 78, 0.85)),
    linear-gradient(90deg, rgba(123, 47, 47, 0.18), transparent);
}

.scene-border,
.scene-watchtower,
.scene-chains,
.scene-separatist,
.scene-lonelyKing {
  background:
    linear-gradient(180deg, rgba(224, 215, 190, 0.9), rgba(78, 99, 91, 0.88)),
    linear-gradient(90deg, rgba(45, 89, 77, 0.26), transparent);
}

.scene-throne,
.scene-newDynasty {
  background:
    linear-gradient(180deg, rgba(239, 217, 154, 0.92), rgba(74, 51, 32, 0.96)),
    linear-gradient(90deg, rgba(184, 44, 44, 0.22), transparent 72%);
}

.scene-execution,
.scene-tooPopular {
  background:
    linear-gradient(180deg, rgba(211, 200, 179, 0.9), rgba(55, 49, 43, 0.96)),
    linear-gradient(90deg, rgba(123, 47, 47, 0.28), transparent);
}

figure.scene {
  display: block;
  margin: 0;
  background: #211912;
}

figure.scene::before,
figure.scene::after {
  display: none;
  content: none;
}

.scene img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.choice-list {
  display: grid;
  flex: 0 0 auto;
  gap: 7px;
  margin-top: 0;
}

.choice-list.is-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.choice-item {
  display: grid;
  grid-template-columns: 42px 1fr;
  align-items: center;
  min-height: 58px;
  padding: 7px 10px;
  border: 2px solid rgba(151, 119, 67, 0.72);
  border-radius: 8px;
  color: #211912;
  background: linear-gradient(180deg, #f1e6c8, #dbc699);
  box-shadow: inset 0 0 0 2px rgba(255, 248, 220, 0.46), 0 5px 0 rgba(0, 0, 0, 0.18);
  text-align: left;
  overflow: hidden;
}

.choice-item.is-selected {
  border-color: rgba(165, 224, 195, 0.96);
  box-shadow: 0 0 0 2px rgba(42, 102, 83, 0.72), 0 0 18px rgba(141, 232, 193, 0.34);
  animation: selectedPulse 180ms ease-out both;
}

.choice-item.is-disabled {
  opacity: 0.56;
  filter: grayscale(0.35);
  box-shadow: none;
  cursor: help;
}

.choice-seal {
  width: 34px;
  height: 34px;
  border: 2px solid #2f695a;
  border-radius: 50%;
  background:
    linear-gradient(180deg, rgba(247, 232, 191, 0.92), rgba(196, 169, 113, 0.88)),
    linear-gradient(45deg, transparent 45%, rgba(47, 105, 90, 0.3) 46% 54%, transparent 55%);
}

.choice-content {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.choice-content strong {
  font-family: "STKaiti", "KaiTi", "SimSun", serif;
  overflow: hidden;
  font-size: 1.35rem;
  line-height: 1.08;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.choice-content em {
  color: #6e5133;
  overflow: hidden;
  font-size: 0.76rem;
  font-style: normal;
  line-height: 1.12;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.choice-content .choice-cost {
  color: #744423;
  font-weight: 700;
}

.choice-content .choice-cost.is-free {
  color: #4f6d4e;
  font-weight: 500;
}

.choice-content .choice-cost.is-lacking {
  color: #9b2d2d;
}

.decision-button {
  flex: 0 0 auto;
  margin-top: 0;
}

.choice-notice {
  position: absolute;
  right: 14px;
  bottom: calc(64px + env(safe-area-inset-bottom));
  left: 50%;
  z-index: 7;
  width: calc(100% - 28px);
  max-width: 402px;
  padding: 8px 12px;
  border: 1px solid rgba(238, 201, 119, 0.72);
  border-radius: 7px;
  color: #fff0c4;
  background: rgba(55, 29, 18, 0.94);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.42), inset 0 0 0 1px rgba(255, 244, 196, 0.18);
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.35;
  text-align: center;
  pointer-events: none;
  animation: noticeIn 150ms ease-out both;
}

.choice-list.is-grid .choice-item {
  grid-template-columns: 1fr;
  min-height: 50px;
  padding: 7px 8px;
}

.choice-list.is-grid .choice-seal {
  display: none;
}

.choice-list.is-grid .choice-content strong {
  font-size: 1.05rem;
}

.choice-list.is-grid .choice-content em {
  font-size: 0.68rem;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.72);
  animation: modalFade 140ms ease-out both;
}

.result-modal,
.book-modal {
  width: min(100%, 390px);
  max-height: calc(100svh - 36px);
  overflow: auto;
  border: 2px solid rgba(180, 139, 76, 0.9);
  border-radius: 8px;
  color: #241b13;
  background:
    linear-gradient(180deg, rgba(251, 241, 213, 0.98), rgba(224, 204, 160, 0.98)),
    repeating-linear-gradient(0deg, rgba(121, 89, 49, 0.04) 0 1px, transparent 1px 6px);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.68), inset 0 0 0 3px rgba(255, 246, 219, 0.48);
  transform-origin: center;
  animation: modalPop 180ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.result-modal {
  padding: 22px 24px 20px;
}

.result-modal.is-failure {
  border-color: rgba(151, 45, 41, 0.92);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.72), inset 0 0 0 3px rgba(255, 230, 205, 0.5);
}

.result-modal h2,
.book-modal h2 {
  margin: 0 0 10px;
  font-family: "STKaiti", "KaiTi", "SimSun", serif;
  font-size: 2.35rem;
  line-height: 1.1;
  text-align: center;
}

.picked-line {
  margin: 6px 0 12px;
  color: #2b241d;
  font-size: 1.18rem;
  line-height: 1.4;
  text-align: center;
}

.picked-line strong {
  color: #2d594d;
}

.failure-preview {
  display: grid;
  gap: 4px;
  margin: 8px 0 12px;
  padding: 10px 12px;
  border: 1px solid rgba(151, 45, 41, 0.38);
  border-radius: 6px;
  color: #3a211b;
  background:
    linear-gradient(180deg, rgba(151, 45, 41, 0.12), rgba(151, 45, 41, 0.06)),
    rgba(255, 238, 210, 0.72);
  text-align: center;
}

.failure-preview span {
  color: #8f2525;
  font-size: 0.9rem;
  font-weight: 700;
}

.failure-preview strong {
  color: #7c1f1f;
  font-family: "STKaiti", "KaiTi", "SimSun", serif;
  font-size: 1.24rem;
  line-height: 1.22;
}

.failure-preview p {
  margin: 0;
  color: #5b3429;
  font-size: 0.94rem;
  line-height: 1.38;
}

.result-text p {
  margin: 0 0 8px;
  font-size: 1.08rem;
  line-height: 1.58;
  text-align: center;
}

.cost-summary {
  margin: 8px 0 12px;
  padding: 8px 10px;
  border: 1px solid rgba(115, 68, 35, 0.22);
  border-radius: 6px;
  color: #6e3f22;
  background: rgba(145, 94, 39, 0.08);
  font-size: 0.96rem;
  line-height: 1.35;
  text-align: center;
}

.identity-change {
  display: grid;
  gap: 4px;
  margin: 12px 0 8px;
  padding: 10px 12px;
  border: 1px solid rgba(45, 89, 77, 0.28);
  border-radius: 6px;
  color: #2b241d;
  background: rgba(45, 89, 77, 0.08);
  text-align: center;
}

.identity-change span {
  color: #6e5133;
  font-size: 0.92rem;
}

.identity-change strong {
  color: #2d594d;
  font-family: "STKaiti", "KaiTi", "SimSun", serif;
  font-size: 1.3rem;
}

.identity-change p {
  margin: 2px 0 0;
  color: #493a2a;
  font-size: 0.94rem;
  line-height: 1.42;
}

.permission-events {
  display: grid;
  gap: 8px;
  margin: 12px 0 8px;
}

.permission-event {
  padding: 10px 12px;
  border: 1px solid rgba(45, 89, 77, 0.26);
  border-radius: 6px;
  background: rgba(45, 89, 77, 0.08);
}

.permission-event.is-backlash {
  border-color: rgba(155, 45, 45, 0.32);
  background: rgba(155, 45, 45, 0.08);
}

.permission-event.is-warning {
  border-color: rgba(183, 123, 36, 0.36);
  background: rgba(183, 123, 36, 0.09);
}

.permission-event.is-crisis {
  border-color: rgba(155, 45, 45, 0.46);
  background: rgba(155, 45, 45, 0.12);
}

.permission-event span,
.permission-event strong,
.permission-event p {
  display: block;
}

.permission-event span {
  color: #6e5133;
  font-size: 0.84rem;
}

.permission-event strong {
  margin-top: 3px;
  color: #2d594d;
  font-size: 1.06rem;
}

.permission-event.is-backlash strong {
  color: #9b2d2d;
}

.permission-event.is-warning strong {
  color: #9a6c20;
}

.permission-event.is-crisis strong {
  color: #8f2525;
}

.permission-event p {
  margin: 4px 0 0;
  color: #493a2a;
  font-size: 0.94rem;
  line-height: 1.42;
}

.delta-list {
  margin: 14px 0 16px;
  border-top: 1px solid rgba(91, 65, 33, 0.24);
}

.delta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 38px;
  border-bottom: 1px solid rgba(91, 65, 33, 0.16);
  font-size: 1.08rem;
}

.delta-row strong {
  font-size: 1.24rem;
}

.delta-row.positive strong {
  color: #1d6b41;
}

.delta-row.negative strong {
  color: #9b2d2d;
}

.modal-button {
  min-height: 48px;
  font-size: 1.55rem;
}

.ending-screen {
  overflow-y: auto;
  padding-top: 32px;
  -webkit-overflow-scrolling: touch;
}

.ending-hero {
  text-align: center;
}

.ending-hero h1 {
  margin-top: 4px;
  font-size: 3.55rem;
}

.ending-hero h2 {
  margin: 4px 0 10px;
  color: #ead7a4;
  font-family: "STKaiti", "KaiTi", "SimSun", serif;
  font-size: 2rem;
}

.ending-hero p:last-child {
  margin: 0 4px 16px;
  color: #e6d4aa;
  font-size: 1.08rem;
  line-height: 1.6;
}

.ending-ledger {
  margin-top: 14px;
  padding: 10px 18px;
  border: 2px solid rgba(164, 219, 190, 0.58);
  border-radius: 8px;
  color: #281f16;
  background: linear-gradient(180deg, #f3e6c9, #dec99d);
}

.journey-panel {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid rgba(195, 158, 93, 0.5);
  border-radius: 8px;
  color: #ead9b4;
  background: rgba(9, 9, 7, 0.7);
}

.journey-panel h3 {
  margin: 0 0 8px;
  color: #ead494;
  font-family: "STKaiti", "KaiTi", "SimSun", serif;
  font-size: 1.45rem;
  line-height: 1.2;
  text-align: center;
}

.journey-line,
.journey-list {
  padding: 8px 0;
  border-top: 1px solid rgba(220, 195, 136, 0.18);
}

.journey-line {
  display: grid;
  grid-template-columns: 86px 1fr;
  gap: 10px;
}

.journey-line span,
.journey-list span {
  color: #cdb783;
  font-size: 0.9rem;
}

.journey-line strong,
.journey-list p {
  margin: 0;
  min-width: 0;
  color: #f3e6c8;
  font-size: 0.96rem;
  line-height: 1.42;
  word-break: break-word;
}

.journey-list {
  display: grid;
  gap: 5px;
}

.ledger-row {
  display: grid;
  grid-template-columns: 104px 1fr;
  gap: 12px;
  align-items: start;
  min-height: 38px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(88, 63, 34, 0.18);
}

.ledger-row:last-child {
  border-bottom: 0;
}

.ledger-row span {
  color: #44372a;
}

.ledger-row strong {
  min-width: 0;
  font-weight: 700;
  word-break: break-word;
}

.ending-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 16px;
}

.ending-actions .gold-button,
.ending-actions .jade-button {
  min-height: 50px;
  font-size: 1.45rem;
}

.book-modal {
  padding: 16px;
}

.book-modal header {
  display: grid;
  grid-template-columns: 1fr 38px;
  align-items: center;
  gap: 8px;
}

.book-modal h2 {
  margin-left: 38px;
}

.icon-button {
  width: 36px;
  height: 36px;
  border: 1px solid rgba(89, 62, 29, 0.28);
  border-radius: 50%;
  color: #2c2118;
  background: rgba(255, 248, 224, 0.5);
  font-size: 1.45rem;
  line-height: 1;
}

.book-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.book-item {
  padding: 10px 12px;
  border: 1px solid rgba(104, 76, 42, 0.24);
  border-radius: 6px;
  background: rgba(255, 250, 231, 0.48);
}

.book-item strong,
.book-item span,
.book-item p {
  display: block;
}

.book-item strong {
  font-size: 1.05rem;
}

.book-item span {
  margin-top: 3px;
  color: #5c4a36;
}

.book-item p {
  margin: 4px 0 0;
  color: #2d594d;
  font-size: 0.98rem;
}

.book-item.is-locked {
  opacity: 0.55;
}

@media (max-width: 520px) {
  #app {
    justify-content: center;
  }

  .game-shell {
    max-width: none;
    padding-right: 12px;
    padding-left: 12px;
  }

  .hero-block h1,
  .ending-hero h1 {
    font-size: 2.1rem;
  }

  .screen-subtitle {
    font-size: 1.12rem;
  }

  .identity-bar {
    min-height: 40px;
    margin-bottom: 9px;
  }

  .intro-copy {
    font-size: 0.88rem;
    line-height: 1.36;
  }

  .resource-grid {
    gap: 7px;
  }

  .resource-card {
    padding: 9px 7px 7px;
  }

  .card-index {
    width: 30px;
    height: 30px;
    font-size: 1.05rem;
    line-height: 26px;
  }

  .resource-name {
    min-height: 24px;
    font-size: 1rem;
  }

  .resource-name.is-long-name {
    font-size: 0.86rem;
  }

  .resource-name.is-extra-long-name {
    font-size: 0.76rem;
  }

  .resource-visual {
    margin: 3px 0;
  }

  .resource-tagline {
    font-size: 0.76rem;
  }

  .bottom-action {
    margin-top: 1px;
  }

  .gold-button,
  .jade-button {
    min-height: 48px;
  }
}

@media (max-width: 380px) {
  .game-shell {
    padding-right: 10px;
    padding-left: 10px;
  }

  .hero-block h1,
  .ending-hero h1 {
    font-size: 1.9rem;
  }

  .resource-card {
    padding-left: 6px;
    padding-right: 6px;
  }

  .resource-name {
    font-size: 0.94rem;
  }

  .resource-name.is-long-name {
    font-size: 0.8rem;
  }

  .resource-name.is-extra-long-name {
    font-size: 0.72rem;
  }

  .resource-tagline {
    font-size: 0.72rem;
  }

  .choice-content strong {
    font-size: 1.18rem;
  }

  .choice-content em {
    font-size: 0.68rem;
  }
}

@media (max-height: 760px) {
  .game-shell {
    gap: 6px;
    padding-top: calc(8px + env(safe-area-inset-top));
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
  }

  .audio-toggle {
    width: 32px;
    height: 32px;
    font-size: 1.04rem;
  }

  .start-screen .hero-block h1 {
    margin-bottom: 3px;
    font-size: 1.88rem;
  }

  .intro-copy {
    display: -webkit-box;
    overflow: hidden;
    font-size: 0.78rem;
    line-height: 1.28;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .resource-grid {
    gap: 6px;
  }

  .resource-card {
    padding-top: 6px;
    padding-bottom: 5px;
  }

  .card-index {
    width: 24px;
    height: 24px;
    font-size: 0.86rem;
    line-height: 20px;
  }

  .selected-check {
    width: 28px;
    height: 28px;
    font-size: 1.12rem;
    line-height: 23px;
  }

  .resource-name {
    min-height: 18px;
    font-size: 0.92rem;
  }

  .resource-name.is-long-name {
    font-size: 0.78rem;
  }

  .resource-name.is-extra-long-name {
    font-size: 0.7rem;
  }

  .resource-visual {
    height: clamp(70px, 12dvh, 92px);
  }

  .resource-tagline {
    font-size: 0.6rem;
    line-height: 1.05;
  }

  .bottom-action p {
    min-height: 16px;
    margin-bottom: 3px;
    font-size: 0.82rem;
  }

  .gold-button,
  .jade-button {
    min-height: 42px;
    font-size: 1.34rem;
  }

  .event-header {
    gap: 4px;
  }

  .stats-grid {
    gap: 4px;
  }

  .stat-chip {
    min-height: 28px;
    grid-template-columns: 20px 1fr;
    padding: 3px 5px;
  }

  .stat-mark {
    width: 18px;
    height: 18px;
    font-size: 0.68rem;
  }

  .stat-chip strong {
    font-size: 0.86rem;
  }

  .state-ribbon {
    min-height: 28px;
    padding: 3px 8px;
    font-size: 0.86rem;
  }

  .permission-strip {
    gap: 4px;
  }

  .permission-chip {
    min-height: 32px;
    padding: 3px 5px;
  }

  .permission-chip span,
  .permission-chip strong {
    font-size: 0.72rem;
  }

  .permission-chip em {
    font-size: 0.66rem;
  }

  .event-card {
    padding: 8px 8px 9px;
  }

  .event-card h2 {
    margin-bottom: 6px;
    font-size: 1.42rem;
  }

  .scene {
    height: clamp(76px, 16dvh, 118px);
    min-height: 72px;
  }

  .event-card p {
    margin-top: 6px;
    font-size: 0.84rem;
    line-height: 1.28;
    -webkit-line-clamp: 2;
  }

  .choice-list {
    gap: 5px;
  }

  .choice-item {
    min-height: 46px;
    grid-template-columns: 32px 1fr;
    padding: 5px 8px;
  }

  .choice-seal {
    width: 26px;
    height: 26px;
  }

  .choice-content strong {
    font-size: 1.08rem;
  }

  .choice-content em {
    font-size: 0.66rem;
  }

  .choice-list.is-grid .choice-item {
    min-height: 42px;
    padding: 5px 6px;
  }

  .choice-list.is-grid .choice-content strong {
    font-size: 0.92rem;
  }

  .choice-list.is-grid .choice-content em {
    font-size: 0.6rem;
  }

  .choice-notice {
    bottom: calc(54px + env(safe-area-inset-bottom));
    padding: 6px 10px;
    font-size: 0.74rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
  }
}
