:root {
  color-scheme: dark;
  --ink: #04070d;
  --blue-deep: #071129;
  --blue-raw: #10224a;
  --blue-mist: #9eb9d4;
  --jade: #b8c8c3;
  --gold: #c0a061;
  --gold-soft: rgba(214, 184, 112, 0.62);
  --paper: #e9dfc5;
  --white: #f6f0df;
  --danger: #d5c18a;
  --rot: -18deg;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  background: var(--ink);
  color: var(--white);
  font-family: "Songti SC", "STSong", "KaiTi", "Kaiti SC", serif;
}

button {
  font: inherit;
}

.app {
  position: relative;
  width: 100%;
  min-height: 100svh;
  overflow: hidden;
  background:
    radial-gradient(circle at 52% 44%, rgba(78, 109, 135, 0.22), transparent 24rem),
    linear-gradient(180deg, #071126 0%, #02040a 100%);
}

.screen {
  position: absolute;
  inset: 0;
  min-height: 100svh;
  display: grid;
  place-items: center;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 800ms ease;
}

.screen.is-active {
  opacity: 1;
  pointer-events: auto;
}

.ink-backdrop,
.result-texture,
.final-ink,
.source-ink {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: #050914;
}

.backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  user-select: none;
  pointer-events: none;
}

.palace {
  opacity: 0.58;
  filter: saturate(0.8) brightness(0.58) contrast(1.12);
}


.ink-backdrop::before,
.ink-backdrop::after,
.result-texture::before,
.final-ink::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.ink-backdrop::before {
  background:
    linear-gradient(180deg, rgba(2, 5, 10, 0.18), rgba(2, 5, 10, 0.64)),
    radial-gradient(circle at 50% 48%, transparent 0 17rem, rgba(0, 0, 0, 0.32) 31rem);
}

.ink-backdrop::after {
  opacity: 0.34;
  background-image:
    radial-gradient(ellipse at 12% 76%, rgba(218, 226, 205, 0.1), transparent 13rem),
    radial-gradient(ellipse at 86% 22%, rgba(178, 138, 79, 0.12), transparent 10rem),
    linear-gradient(126deg, transparent 0 52%, rgba(221, 199, 142, 0.12) 52.2%, transparent 52.7%),
    repeating-linear-gradient(96deg, transparent 0 19px, rgba(194, 160, 95, 0.09) 20px, transparent 21px),
    repeating-linear-gradient(2deg, transparent 0 42px, rgba(231, 216, 178, 0.035) 43px, transparent 44px);
}

.stage {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  perspective: 980px;
  perspective-origin: 50% 44%;
  touch-action: none;
  cursor: grab;
}

.horse-shadow {
  position: absolute;
  z-index: 1;
  width: min(62vw, 650px);
  height: auto;
  transform: translate(11vw, -8svh) scale(1.02);
  transform-origin: center;
  opacity: 0.72;
  filter: blur(1.6px) drop-shadow(0 0 24px rgba(0, 20, 35, 0.52));
  pointer-events: none;
}

.deer-3d {
  position: absolute;
  z-index: 2;
  width: min(74vw, 560px);
  height: min(74svh, 700px);
  opacity: 1;
  transform: translateX(-8vw);
  filter:
    drop-shadow(0 0 12px rgba(217, 151, 64, 0.25))
    drop-shadow(0 28px 38px rgba(0, 0, 0, 0.58));
  pointer-events: none;
}

.stage:active {
  cursor: grabbing;
}

.deer-orbit {
  position: relative;
  width: min(86vw, 440px);
  height: min(72svh, 680px);
  transform-style: preserve-3d;
  transform: rotateX(2deg) rotateY(var(--rot));
  transition: transform 160ms ease-out;
  opacity: 0.32;
}

.view-panel {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: end center;
  margin: 0;
  transform-style: preserve-3d;
  opacity: 0.93;
  filter: drop-shadow(0 26px 26px rgba(0, 0, 0, 0.54));
}

.view-panel::before {
  content: "";
  position: absolute;
  inset: 11% 6% 7%;
  border: 1px solid rgba(213, 176, 102, 0.22);
  box-shadow: inset 0 0 34px rgba(178, 150, 92, 0.16);
  opacity: 0.72;
  transform: translateZ(-6px);
}

.view-panel img {
  width: min(78vw, 410px);
  max-height: 66svh;
  object-fit: contain;
  mix-blend-mode: screen;
  filter:
    saturate(0.7)
    contrast(1.08)
    brightness(0.72)
    blur(0.3px)
    drop-shadow(0 0 18px rgba(185, 157, 96, 0.28));
  user-select: none;
  pointer-events: none;
}

.view-front {
  transform: rotateY(0deg) translateZ(112px);
}

.view-side {
  transform: rotateY(120deg) translateZ(112px);
}

.view-back {
  transform: rotateY(240deg) translateZ(112px);
}

.gold-orbit {
  position: absolute;
  width: min(78vw, 380px);
  aspect-ratio: 1 / 0.28;
  border: 1px solid rgba(207, 170, 96, 0.28);
  border-radius: 50%;
  transform: translateY(24svh) rotateX(72deg);
  box-shadow: 0 0 28px rgba(212, 184, 121, 0.13);
}

.orbit-a {
  animation: slowSpin 16s linear infinite;
}

.orbit-b {
  width: min(54vw, 270px);
  opacity: 0.55;
  animation: slowSpin 22s linear infinite reverse;
}

.floor-seal {
  position: absolute;
  width: min(68vw, 340px);
  aspect-ratio: 1 / 0.24;
  border-radius: 50%;
  transform: translateY(28svh);
  background:
    radial-gradient(ellipse at center, rgba(212, 180, 115, 0.18), transparent 64%),
    repeating-radial-gradient(ellipse at center, transparent 0 11px, rgba(216, 183, 107, 0.12) 12px, transparent 13px);
  filter: blur(0.2px);
}

.question-block {
  position: absolute;
  left: max(22px, env(safe-area-inset-left));
  right: max(22px, env(safe-area-inset-right));
  bottom: calc(28px + env(safe-area-inset-bottom));
  display: grid;
  gap: 18px;
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 900ms ease, transform 900ms ease;
}

.question-block.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.question {
  margin: 0;
  text-align: center;
  font-size: clamp(26px, 8vw, 42px);
  line-height: 1.15;
  letter-spacing: 0;
  text-shadow: 0 0 18px rgba(209, 181, 121, 0.28);
}

.choice-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
}

.choice {
  min-height: 58px;
  border: 1px solid rgba(209, 177, 105, 0.44);
  border-radius: 6px;
  background: rgba(5, 12, 27, 0.58);
  color: var(--paper);
  font-size: 25px;
  line-height: 1;
  box-shadow:
    inset 0 0 18px rgba(207, 170, 98, 0.12),
    0 12px 22px rgba(0, 0, 0, 0.22);
  transition:
    border-color 500ms ease,
    background 500ms ease,
    color 500ms ease,
    opacity 500ms ease,
    transform 500ms ease,
    box-shadow 500ms ease;
}

.choice:disabled {
  opacity: 0.68;
}

.choice-row.is-biased .choice-deer {
  color: rgba(233, 223, 197, 0.58);
  border-color: rgba(167, 146, 98, 0.24);
  background: rgba(4, 9, 18, 0.48);
}

.choice-row.is-biased .choice-horse {
  color: #fff7db;
  border-color: rgba(236, 201, 126, 0.82);
  background:
    linear-gradient(180deg, rgba(181, 145, 74, 0.22), rgba(10, 26, 51, 0.74));
  box-shadow:
    inset 0 0 26px rgba(237, 200, 124, 0.23),
    0 0 28px rgba(226, 189, 118, 0.24),
    0 18px 28px rgba(0, 0, 0, 0.28);
  transform: translateY(-2px);
}

.system-panel {
  position: absolute;
  left: max(18px, env(safe-area-inset-left));
  right: max(18px, env(safe-area-inset-right));
  top: calc(32px + env(safe-area-inset-top));
  padding: 16px 16px 15px;
  border: 1px solid rgba(211, 179, 107, 0.43);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(6, 13, 30, 0.86), rgba(5, 9, 18, 0.72)),
    radial-gradient(circle at 80% 0%, rgba(195, 166, 96, 0.18), transparent 42%);
  box-shadow:
    inset 0 0 0 1px rgba(244, 229, 184, 0.04),
    0 24px 70px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(10px);
  opacity: 0;
  transform: translateY(-14px);
  pointer-events: none;
  transition: opacity 700ms ease, transform 700ms ease;
}

.system-panel.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.system-title {
  margin: 0 0 11px;
  color: var(--gold);
  font-size: 14px;
  line-height: 1.2;
  letter-spacing: 0;
}

.system-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.system-list li {
  min-height: 32px;
  padding: 8px 10px;
  border: 1px solid rgba(208, 180, 116, 0.18);
  border-radius: 4px;
  background: rgba(7, 16, 35, 0.48);
  color: rgba(241, 232, 206, 0.44);
  font-size: 14px;
  line-height: 1.35;
  transform: translateX(-6px);
  opacity: 0;
  transition: opacity 520ms ease, transform 520ms ease, color 520ms ease, border-color 520ms ease;
}

.system-list li.is-lit {
  opacity: 1;
  transform: translateX(0);
  color: rgba(247, 238, 210, 0.92);
  border-color: rgba(218, 186, 112, 0.34);
}

.system-list li:last-child.is-lit {
  color: #fff2c8;
  border-color: rgba(234, 197, 116, 0.72);
  background: rgba(146, 111, 50, 0.2);
  box-shadow: inset 0 0 18px rgba(226, 188, 108, 0.12);
}

.result-texture {
  background:
    linear-gradient(180deg, rgba(4, 7, 13, 0.16), rgba(4, 7, 13, 0.9)),
    url("./assets/palace.png") center / cover no-repeat,
    #060b18;
  filter: saturate(0.68) brightness(0.82);
}

.result-texture::before {
  background:
    radial-gradient(circle at center 28%, rgba(215, 188, 120, 0.2), transparent 18rem),
    rgba(3, 6, 12, 0.55);
}

.result-card {
  position: relative;
  width: min(88vw, 430px);
  padding: 28px 22px;
  border: 1px solid rgba(213, 182, 110, 0.46);
  border-radius: 8px;
  background: rgba(4, 10, 22, 0.72);
  box-shadow:
    inset 0 0 28px rgba(213, 179, 103, 0.1),
    0 28px 80px rgba(0, 0, 0, 0.44);
  text-align: center;
  backdrop-filter: blur(8px);
}

.small-label {
  margin: 0 0 9px;
  color: var(--gold);
  font-size: 14px;
}

.stat-line {
  margin: 0 0 24px;
  font-size: clamp(27px, 7vw, 38px);
  line-height: 1.25;
}

.choice-verdict {
  display: grid;
  gap: 10px;
  margin: 0 auto 24px;
  max-width: 24rem;
  color: rgba(246, 240, 223, 0.88);
  font-size: 17px;
  line-height: 1.72;
}

.choice-verdict p {
  margin: 0;
}

.plain-action {
  width: 100%;
  min-height: 52px;
  border: 1px solid rgba(213, 182, 110, 0.52);
  border-radius: 6px;
  background: rgba(13, 28, 54, 0.68);
  color: var(--paper);
  font-size: 20px;
}

.plain-action:active {
  transform: translateY(1px);
}

.final-ink,
.source-ink {
  background:
    linear-gradient(180deg, rgba(1, 2, 5, 0.28), rgba(1, 2, 5, 0.96)),
    url("./assets/palace.png") center / cover no-repeat,
    #020308;
  filter: saturate(0.66) brightness(0.62);
}

.final-ink::before,
.source-ink::before {
  background:
    radial-gradient(circle at 50% 36%, rgba(229, 215, 177, 0.16), transparent 14rem),
    rgba(0, 0, 0, 0.44);
}

.final-copy {
  position: relative;
  display: grid;
  gap: 10px;
  width: min(82vw, 390px);
  text-align: center;
  opacity: 0;
  transform: translateY(12px);
}

.screen-final.is-active .final-copy {
  animation: finalRise 2200ms ease forwards 450ms;
}

.final-copy p {
  margin: 0;
  color: rgba(247, 241, 222, 0.92);
  font-size: clamp(24px, 7vw, 36px);
  line-height: 1.35;
  text-shadow: 0 0 18px rgba(213, 183, 111, 0.16);
}

.final-footnote {
  display: block;
  margin-top: 20px;
  color: rgba(214, 191, 135, 0.78);
  font-size: 15px;
  line-height: 1.75;
}

.final-copy .film-title {
  margin-top: 24px;
  color: var(--gold);
  font-size: 18px;
}

.final-continue {
  margin-top: 28px;
}

.source-card,
.action-card {
  position: relative;
  display: grid;
  gap: 16px;
  width: min(88vw, 430px);
  max-height: calc(100svh - 48px);
  overflow: auto;
  padding: 26px 22px;
  border: 1px solid rgba(213, 182, 110, 0.45);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(6, 13, 29, 0.82), rgba(3, 7, 15, 0.78)),
    radial-gradient(circle at 50% 0%, rgba(206, 175, 106, 0.13), transparent 18rem);
  box-shadow:
    inset 0 0 28px rgba(213, 179, 103, 0.1),
    0 28px 80px rgba(0, 0, 0, 0.44);
  backdrop-filter: blur(8px);
}

.source-card h1 {
  margin: 0 0 2px;
  color: rgba(247, 241, 222, 0.96);
  font-size: clamp(30px, 8vw, 42px);
  line-height: 1.22;
  font-weight: 400;
  text-align: center;
}

.source-original {
  display: grid;
  gap: 10px;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-4px);
  transition: max-height 900ms ease, opacity 700ms ease, transform 700ms ease;
}

.source-original.is-open {
  max-height: 340px;
  opacity: 1;
  transform: translateY(0);
}

.source-original p {
  margin: 0;
  color: rgba(246, 240, 223, 0.82);
  font-size: 16px;
  line-height: 1.72;
}

.source-original .quote-line {
  padding: 14px 14px;
  border: 1px solid rgba(211, 180, 109, 0.32);
  border-radius: 6px;
  color: rgba(255, 247, 219, 0.96);
  background: rgba(4, 10, 21, 0.48);
  text-align: center;
}

.source-original .source-truth {
  color: rgba(255, 239, 195, 0.96);
}

.source-after {
  margin: 2px 0 0;
  color: var(--gold);
  font-size: 18px;
  line-height: 1.5;
  text-align: center;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 700ms ease, transform 700ms ease;
}

.source-after.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.source-next {
  display: none;
}

.source-next.is-visible {
  display: block;
}

.action-list {
  display: grid;
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.action-list li {
  display: grid;
  gap: 5px;
  padding: 15px 14px;
  border: 1px solid rgba(211, 180, 109, 0.25);
  border-radius: 6px;
  background: rgba(4, 10, 21, 0.46);
}

.action-list span {
  color: rgba(255, 247, 219, 0.96);
  font-size: 20px;
  line-height: 1.32;
}

.action-list small {
  color: rgba(246, 240, 223, 0.68);
  font-size: 14px;
  line-height: 1.55;
}

.closing-line {
  margin: 6px 0 0;
  color: rgba(246, 240, 223, 0.88);
  font-size: 18px;
  line-height: 1.7;
  text-align: center;
}

.film-title {
  margin: 8px 0 0;
  color: var(--gold);
  font-size: 18px;
  text-align: center;
}

.film-credit {
  margin: -8px 0 0;
  color: rgba(233, 221, 192, 0.5);
  font-size: 12px;
  text-align: center;
}

@keyframes slowSpin {
  from {
    rotate: 0deg;
  }
  to {
    rotate: 360deg;
  }
}

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

@media (min-width: 760px) {
  .question-block {
    left: calc(50% - 250px);
    right: calc(50% - 250px);
  }

  .system-panel {
    left: calc(50% - 260px);
    right: calc(50% - 260px);
  }

  .deer-orbit {
    height: min(75svh, 720px);
  }

  .deer-3d {
    height: min(75svh, 720px);
  }
}

@media (max-height: 700px) {
  .view-panel img {
    max-height: 60svh;
  }

  .deer-3d {
    height: 58svh;
  }

  .question-block {
    gap: 12px;
  }

  .choice {
    min-height: 50px;
  }

  .system-panel {
    padding: 12px;
  }

  .system-list {
    gap: 6px;
  }

  .system-list li {
    min-height: 28px;
    padding: 6px 8px;
    font-size: 13px;
  }

  .source-card,
  .action-card {
    gap: 12px;
    padding: 20px 18px;
  }
}
