:root {
  --bg: #0b0907;
  --bg2: #15110d;
  --line: rgba(242, 165, 74, .22);
  --ink: #f4ede3;
  --muted: #a99d8f;
  --gold: #f2a54a;
  --gold2: #ffcf8a;
  --blood: #b3261e;
  --r: 14px;
  --head: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif;
  --body: "Barlow", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); }
body {
  font-family: var(--body);
  background: radial-gradient(120% 70% at 50% 0%, #2a1c10 0%, var(--bg) 60%) fixed, var(--bg);
  overscroll-behavior: none;
}
button { font: inherit; color: inherit; }
a { color: inherit; }

.app {
  position: relative;
  width: 100%; max-width: 460px; min-height: 100dvh; margin: 0 auto;
  display: flex; flex-direction: column;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
  background: var(--bg);
  box-shadow: 0 0 80px rgba(0, 0, 0, .6);
}

/* top bar */
.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px 10px;
  font-family: var(--head); letter-spacing: .18em; text-transform: uppercase;
}
.brand { font-weight: 800; font-size: 17px; color: var(--gold); text-decoration: none; letter-spacing: .28em; }
.crumb { font-size: 13px; color: var(--muted); font-weight: 600; }
.right { display: flex; align-items: center; gap: 12px; }
.snd { width: 34px; height: 34px; border-radius: 50%; border: 1px solid rgba(242, 165, 74, .45); background: transparent; cursor: pointer; display: grid; place-items: center; padding: 0; }
.snd i { position: relative; width: 8px; height: 10px; background: var(--gold); clip-path: polygon(0 25%, 45% 25%, 100% 0, 100% 100%, 45% 75%, 0 75%); margin-left: -6px; }
.snd i::after { content: ''; position: absolute; left: 11px; top: -1px; width: 6px; height: 10px; border: 2px solid var(--gold); border-left: 0; border-radius: 0 10px 10px 0; }
.snd[aria-pressed="false"] i::after { border: 0; width: 12px; height: 2px; top: 4px; left: 10px; background: var(--gold); transform: rotate(45deg); border-radius: 0; box-shadow: none; }
.snd[aria-pressed="false"] i::before { content: ''; position: absolute; left: 10px; top: 4px; width: 12px; height: 2px; background: var(--gold); transform: rotate(-45deg); }
.app[data-state="intro"] .snd { display: none; }

/* picture */
.stage {
  position: relative; width: 100%; aspect-ratio: 720 / 780; overflow: hidden; background: #000;
}
.stage video, .stage .still {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block;
  opacity: 0; transition: opacity .35s ease;
}
.stage .on { opacity: 1; }
.shade {
  position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(180deg, rgba(11, 9, 7, .55) 0%, rgba(11, 9, 7, 0) 18%),
    linear-gradient(0deg, var(--bg) 0%, rgba(11, 9, 7, 0) 22%),
    radial-gradient(130% 90% at 50% 45%, rgba(0, 0, 0, 0) 60%, rgba(0, 0, 0, .45) 100%);
}
.app[data-state="intro"] .shade { background: linear-gradient(0deg, var(--bg) 2%, rgba(11, 9, 7, .25) 45%, rgba(11, 9, 7, .55) 100%); }
.app[data-state="end"] .stage .on { filter: saturate(.75) brightness(.7); transition: filter .8s ease, opacity .35s; }
.loading { position: absolute; inset: 0; display: grid; place-items: center; }
.loading[hidden] { display: none; }
.loading span {
  width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, .2); border-top-color: var(--gold);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* lower panel */
.panel { position: relative; flex: 1; padding: 6px 20px 18px; display: flex; flex-direction: column; }
.panel > [hidden] { display: none !important; }

.intro { margin-top: -86px; position: relative; z-index: 2; }
.eyebrow {
  margin: 0 0 6px; font-family: var(--head); font-weight: 700; font-size: 13px;
  letter-spacing: .22em; text-transform: uppercase; color: var(--gold);
}
.intro h1 {
  margin: 0; font-family: var(--head); font-weight: 800; font-size: clamp(32px, 9vw, 42px);
  line-height: .98; letter-spacing: .01em; text-transform: uppercase; text-wrap: balance;
}
.intro .hi { margin: 8px 0 22px; font-size: 18px; color: var(--muted); }
.play {
  display: inline-flex; align-items: center; justify-content: center; gap: 12px;
  width: 100%; height: 58px; border: 0; border-radius: var(--r); cursor: pointer;
  font-family: var(--head); font-weight: 800; font-size: 24px; letter-spacing: .14em; text-transform: uppercase;
  color: #1a1006; background: linear-gradient(180deg, var(--gold2), var(--gold));
  box-shadow: 0 10px 30px rgba(242, 165, 74, .28), inset 0 -2px 0 rgba(0, 0, 0, .18);
}
.play:active { transform: translateY(1px) scale(.99); }
.tri { width: 0; height: 0; border-left: 15px solid #1a1006; border-top: 10px solid transparent; border-bottom: 10px solid transparent; }
.meta { margin: 12px 0 0; text-align: center; font-size: 13px; color: var(--muted); letter-spacing: .04em; }

/* dialogue */
.talk {
  margin-top: 6px; padding: 16px 18px 18px; min-height: 118px;
  border: 1px solid var(--line); border-radius: var(--r);
  background: linear-gradient(180deg, rgba(36, 26, 17, .92), rgba(20, 15, 11, .92));
}
.sp {
  display: inline-block; margin-bottom: 8px; padding: 3px 10px 2px; border-radius: 6px;
  font-family: var(--head); font-weight: 800; font-size: 14px; letter-spacing: .16em; text-transform: uppercase;
  color: #1a1006; background: var(--gold);
}
.sp:empty { display: none; }
.line { margin: 0; font-size: 21px; line-height: 1.32; font-weight: 500; }
.line.narr { font-style: italic; color: #e6dccd; font-weight: 400; }
.line.dir { font-style: italic; color: var(--muted); }
.talk.fresh .line, .talk.fresh .sp { animation: rise .32s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* choice */
.choose { margin-top: 2px; animation: rise .35s ease both; }
.prompt { margin: 0; font-family: var(--head); font-weight: 700; font-size: 26px; line-height: 1.05; text-transform: uppercase; letter-spacing: .02em; }
.prompt-en { margin: 4px 0 14px; color: var(--muted); font-size: 14px; }
.opts { display: grid; gap: 12px; }
.opt {
  position: relative; display: grid; grid-template-columns: 40px 1fr; align-items: center; gap: 14px;
  width: 100%; padding: 14px 16px; text-align: left; cursor: pointer;
  border: 1px solid rgba(242, 165, 74, .45); border-radius: var(--r);
  background: linear-gradient(180deg, rgba(48, 34, 20, .95), rgba(28, 20, 13, .95));
  box-shadow: 0 6px 18px rgba(0, 0, 0, .35);
  animation: rise .4s ease both;
}
.opt:nth-child(2) { animation-delay: .08s; }
.opt .k {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px;
  font-family: var(--head); font-weight: 800; font-size: 22px; color: #1a1006; background: var(--gold);
}
.opt .t { display: block; font-family: var(--head); font-weight: 800; font-size: 26px; line-height: 1; text-transform: uppercase; letter-spacing: .02em; }
.opt .e { display: block; margin-top: 5px; font-size: 14px; color: #cdbfad; }
.opt:active, .opt.picked { border-color: var(--gold2); background: linear-gradient(180deg, #5a3c1c, #3a2612); }
.opt.picked { box-shadow: 0 0 0 2px var(--gold), 0 10px 30px rgba(242, 165, 74, .3); }
.opt.dim { opacity: .35; }
.choose.waiting .opt:not(.picked) { pointer-events: none; }

/* end */
.end { margin-top: -40px; position: relative; z-index: 2; animation: rise .45s ease both; }
.picked { margin: 0 0 16px; font-size: 17px; color: var(--muted); }
.picked b { color: var(--ink); font-weight: 600; }
.end-actions { display: grid; gap: 10px; }
.btn {
  display: flex; align-items: center; justify-content: center; height: 52px; border-radius: var(--r);
  font-family: var(--head); font-weight: 800; font-size: 19px; letter-spacing: .12em; text-transform: uppercase;
  text-decoration: none; cursor: pointer; border: 1px solid rgba(242, 165, 74, .5); background: transparent; color: var(--ink);
}
.btn.primary { border: 0; color: #1a1006; background: linear-gradient(180deg, var(--gold2), var(--gold)); }
.end-links { display: flex; justify-content: center; gap: 28px; margin-top: 16px; }
.link {
  background: none; border: 0; padding: 6px 2px; cursor: pointer; color: var(--muted);
  font-family: var(--head); font-weight: 600; font-size: 15px; letter-spacing: .14em; text-transform: uppercase; text-decoration: none;
}

/* progress */
.steps { display: flex; gap: 6px; justify-content: center; padding: 6px 0 14px; }
.steps i { width: 26px; height: 3px; border-radius: 2px; background: rgba(255, 255, 255, .14); transition: background .3s; }
.steps i.done { background: var(--gold); }
.app[data-state="intro"] .steps { visibility: hidden; }

/* scene list */
.list-head { padding: 26px 20px 8px; }
.list-head h1 { margin: 0; font-family: var(--head); font-weight: 800; font-size: 44px; line-height: .95; letter-spacing: .02em; text-transform: uppercase; }
.list-head h1 em { font-style: normal; color: var(--gold); }
.list-head p { margin: 10px 0 0; color: var(--muted); font-size: 15px; }
.list-head .tag { margin-top: 12px; font-family: var(--head); font-weight: 700; font-size: 20px; letter-spacing: .06em; text-transform: uppercase; color: var(--gold2); }
.cards { display: grid; gap: 14px; padding: 14px 16px 28px; }
.card {
  position: relative; display: grid; grid-template-columns: 112px 1fr; gap: 14px; align-items: center;
  padding: 10px; border-radius: var(--r); text-decoration: none;
  border: 1px solid var(--line); background: linear-gradient(180deg, rgba(36, 26, 17, .9), rgba(20, 15, 11, .9));
}
.card img { width: 112px; aspect-ratio: 720 / 780; object-fit: cover; border-radius: 10px; display: block; }
.card .n { font-family: var(--head); font-weight: 700; font-size: 12px; letter-spacing: .22em; color: var(--gold); text-transform: uppercase; }
.card h2 { margin: 3px 0 4px; font-family: var(--head); font-weight: 800; font-size: 22px; line-height: 1; text-transform: uppercase; }
.card .hi { font-size: 14px; color: var(--muted); }
.card .ch { margin-top: 8px; font-size: 13px; color: #d9cbb8; line-height: 1.35; }
.card .ch span { color: var(--gold); font-family: var(--head); font-weight: 800; margin-right: 4px; }
.card::after {
  content: ""; position: absolute; right: 14px; top: 14px; width: 0; height: 0;
  border-left: 9px solid var(--gold); border-top: 6px solid transparent; border-bottom: 6px solid transparent;
}
.foot { padding: 0 20px 26px; color: var(--muted); font-size: 12px; text-align: center; letter-spacing: .04em; }

@media (min-width: 700px) {
  body { padding: 24px 0; }
  .app { min-height: calc(100dvh - 48px); border-radius: 22px; overflow: hidden; border: 1px solid rgba(255, 255, 255, .06); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
