:root {
  color-scheme: dark;
  --ink: #0b0d0c;
  --ink-2: #121613;
  --paper: #e8e0cd;
  --muted: #9d9b91;
  --line: rgba(232, 224, 205, .16);
  --red: #b64a3c;
  --red-bright: #e05b48;
  --gold: #bc9f68;
  --green: #879d7e;
  --safe-bottom: max(18px, env(safe-area-inset-bottom));
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: #070908; }
body { color: var(--paper); font-family: "Songti SC", "STSong", "Noto Serif SC", serif; font-size: 16px; }
button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
.hidden { display: none !important; }
.app-shell { width: 100%; min-height: 100svh; background: radial-gradient(circle at 50% -20%, #263028 0, var(--ink) 45%, #070908 100%); overflow: hidden; }
.screen { position: relative; min-height: 100svh; max-width: 720px; margin: 0 auto; }
.loading-screen { min-height: 100svh; display: grid; place-content: center; justify-items: center; color: var(--muted); letter-spacing: .12em; }
.signal-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--red-bright); box-shadow: 0 0 22px var(--red); animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { opacity: .25; transform: scale(.7); } }

.start-screen { display: flex; flex-direction: column; justify-content: center; padding: 60px 26px calc(36px + var(--safe-bottom)); background: linear-gradient(180deg, rgba(9,11,10,.1), #0b0d0c 75%), url("assets/images/cover.jpg") center top / cover no-repeat; isolation: isolate; }
.start-screen::before { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, rgba(2,4,3,.4) 0%, rgba(5,7,6,.78) 45%, #0b0d0c 78%); }
.film-grain { position: absolute; inset: 0; opacity: .08; pointer-events: none; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.55'/%3E%3C/svg%3E"); }
.eyebrow { margin: 0 0 20px; color: #c6b995; font-family: ui-monospace, SFMono-Regular, monospace; font-size: .72rem; letter-spacing: .18em; }
.record-stamp { align-self: flex-start; padding: 6px 11px; border: 1px solid rgba(224,91,72,.72); color: #e77a68; font: 700 .75rem/1 ui-monospace, monospace; letter-spacing: .12em; transform: rotate(-2deg); }
h1 { margin: 18px 0 4px; font-size: clamp(3rem, 15vw, 5.5rem); font-weight: 500; line-height: .95; letter-spacing: .08em; text-shadow: 0 4px 24px #000; }
.opening-time { margin: 18px 0 5px; color: var(--gold); font: .78rem/1.5 ui-monospace, monospace; letter-spacing: .08em; }
.opening-copy { max-width: 30rem; margin: 0 0 30px; line-height: 1.8; color: #d2ccbd; }
.identity-card { padding-top: 22px; border-top: 1px solid var(--line); }
.identity-card label { display: block; margin-bottom: 10px; color: #c7c0ae; }
.identity-card input { display: block; width: 100%; height: 58px; padding: 0 2px; border: 0; border-bottom: 1px solid #887c62; outline: none; border-radius: 0; background: transparent; color: #fff8e8; font-size: 1.45rem; caret-color: var(--red-bright); }
.identity-card input:focus { border-color: var(--red-bright); box-shadow: 0 1px 0 var(--red-bright); }
.identity-card input::placeholder { color: #5f625c; }
.form-error { min-height: 20px; margin: 7px 0 0; color: #ee8271; font-size: .85rem; }
.identity-meta { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 12px 0 22px; color: #777b74; font: .75rem/1.5 ui-monospace, monospace; }
.primary-button, .secondary-button { width: 100%; min-height: 54px; padding: 14px 20px; border: 1px solid var(--red); border-radius: 2px; background: var(--red); color: #fff7ea; font-weight: 700; letter-spacing: .08em; cursor: pointer; }
.primary-button:active { transform: translateY(1px); background: #9e3e33; }
.secondary-button { background: transparent; border-color: #726b5c; color: var(--paper); }
.text-button { align-self: center; padding: 13px; border: 0; background: transparent; color: #8c8d85; text-decoration: underline; text-underline-offset: 5px; cursor: pointer; }
.safety-note { margin: 24px 0 0; color: #696d66; font-size: .76rem; line-height: 1.6; }

.game-screen { background: var(--ink); }
.game-header { height: 70px; display: grid; grid-template-columns: 48px 1fr 48px; align-items: center; padding: env(safe-area-inset-top) 14px 0; border-bottom: 1px solid var(--line); background: rgba(11,13,12,.93); backdrop-filter: blur(16px); }
.icon-button { width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 50%; background: transparent; color: var(--paper); font: 700 .82rem/1 ui-monospace, monospace; cursor: pointer; }
.icon-button.is-off { color: #6f726c; text-decoration: line-through; }
.header-location { text-align: center; min-width: 0; }
.header-location span { display: block; color: var(--red-bright); font: .68rem/1.4 ui-monospace, monospace; letter-spacing: .14em; }
.header-location strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .9rem; letter-spacing: .08em; }
.progress-track { height: 2px; background: #212520; }
.progress-track i { display: block; height: 100%; width: 0; background: var(--red-bright); box-shadow: 0 0 10px var(--red); transition: width .5s ease; }
.game-content { min-height: calc(100svh - 124px); padding: 22px 20px 105px; display: flex; flex-direction: column; }
.scene-photo { position: relative; aspect-ratio: 16/9; margin: -22px -20px 24px; overflow: hidden; background: #181b18; }
.scene-photo img { width: 100%; height: 100%; object-fit: cover; filter: saturate(.65) contrast(1.06) brightness(.72); }
.scene-photo::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 50%, var(--ink)); }
.chapter-kicker { margin: 0 0 7px; color: var(--gold); font: .72rem/1.5 ui-monospace, monospace; letter-spacing: .12em; }
.chapter-title { margin: 0; font-size: clamp(1.8rem, 8vw, 2.55rem); font-weight: 500; line-height: 1.25; }
.chapter-story { margin: 14px 0 24px; color: #aaa99f; line-height: 1.8; }
.arrival-box { margin-top: auto; padding-top: 22px; border-top: 1px solid var(--line); }
.arrival-box h3, .task-card h3 { margin: 0 0 10px; font-size: 1rem; font-weight: 600; }
.arrival-box p { margin: 0 0 18px; color: #aaa99f; line-height: 1.75; }
.button-stack { display: grid; gap: 10px; }
.status-message { min-height: 24px; margin: 12px 0 0; color: #c1ab7c; font-size: .85rem; line-height: 1.55; }

.comms { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 15px 0 28px; }
.comms-head { display: flex; align-items: center; gap: 14px; margin-bottom: 28px; }
.portrait { width: 64px; height: 64px; border-radius: 50%; overflow: hidden; border: 1px solid rgba(188,159,104,.5); background: #171a17; box-shadow: 0 0 0 6px rgba(188,159,104,.04); }
.portrait img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(.18) sepia(.12); }
.system-sigil { display: grid; place-items: center; color: var(--red-bright); font-size: 1.35rem; }
.comms-from small { display: block; color: #777b74; font: .68rem/1.6 ui-monospace, monospace; letter-spacing: .12em; }
.comms-from strong { font-size: 1.12rem; }
.comms-copy { min-height: 8.4em; margin: 0; font-size: clamp(1.22rem, 5.5vw, 1.6rem); line-height: 1.75; letter-spacing: .035em; }
.comms-direction { margin: 20px 0 0; color: #7b7d76; font-size: .82rem; line-height: 1.6; }
.scene-actions { margin-top: 34px; }
.page-count { display: block; margin: 0 0 10px; color: #686c65; font: .68rem/1 ui-monospace, monospace; text-align: center; }
.waveform { height: 28px; margin: 18px 0; background: repeating-linear-gradient(90deg, transparent 0 5px, rgba(224,91,72,.55) 5px 7px); mask: linear-gradient(180deg, transparent, #000 42%, #000 58%, transparent); animation: signal 1.2s linear infinite; }
@keyframes signal { to { transform: translateX(7px); } }

.task-card { animation: rise .35s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.task-number { color: var(--red-bright); font: .72rem/1.5 ui-monospace, monospace; letter-spacing: .12em; }
.task-card h2 { margin: 9px 0 10px; font-size: 1.4rem; line-height: 1.55; font-weight: 500; }
.task-context { margin: 0 0 22px; color: #7d817a; font-size: .83rem; line-height: 1.6; }
.puzzle-area { margin-top: 12px; }
.answer-input { width: 100%; min-height: 58px; border: 1px solid #45493f; border-radius: 2px; outline: 0; padding: 15px; background: #101310; color: #f0eadc; font-size: 1.05rem; }
.answer-input:focus { border-color: var(--gold); }
.field-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.field-grid label { color: #9b9b92; font-size: .85rem; }
.field-grid input { margin-top: 8px; }
.options { display: grid; gap: 9px; }
.option-button, .card-button { min-height: 50px; padding: 13px 15px; border: 1px solid #3f433c; border-radius: 2px; background: #111411; color: #d5d0c3; text-align: left; cursor: pointer; }
.option-button.selected, .card-button.selected { border-color: var(--red-bright); background: rgba(182,74,60,.12); color: #fff6e6; }
.sequence-slots { display: grid; gap: 8px; margin-bottom: 14px; }
.sequence-slot { min-height: 48px; display: grid; grid-template-columns: 1fr 1.3fr; align-items: center; gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--line); }
.sequence-slot small { color: #777b74; }
.sequence-slot strong { color: #d8c89f; font-weight: 500; text-align: right; }
.card-pool { display: flex; flex-wrap: wrap; gap: 8px; }
.card-button { width: auto; min-height: 42px; }
.card-button:disabled { opacity: .27; }
.task-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 22px; }
.task-actions .primary-button { grid-column: 1/-1; }
.mini-button { min-height: 44px; border: 1px solid #3d413a; background: transparent; color: #989a92; cursor: pointer; }
.feedback { min-height: 25px; margin: 13px 0 0; color: #dda693; line-height: 1.6; }
.archive { margin-top: 14px; border: 1px solid var(--line); background: #0e110f; overflow: hidden; }
.archive img { display: block; width: 100%; max-height: 50vh; object-fit: contain; background: #050605; }
.archive p { margin: 0; padding: 13px; color: #aaa99f; font-size: .85rem; line-height: 1.7; }
.shake { animation: shake .32s linear; }
@keyframes shake { 25% { transform: translateX(-5px); } 50% { transform: translateX(5px); } 75% { transform: translateX(-3px); } }

.unlock { flex: 1; display: flex; flex-direction: column; justify-content: center; text-align: center; }
.unlock-mark { width: 105px; height: 105px; margin: 0 auto 28px; display: grid; place-items: center; border: 1px solid var(--red); border-radius: 50%; color: var(--red-bright); font-size: 3.4rem; box-shadow: inset 0 0 30px rgba(182,74,60,.08), 0 0 40px rgba(182,74,60,.08); }
.unlock h2 { margin: 0 0 12px; font-size: 1.8rem; font-weight: 500; }
.unlock p { margin: 0 0 30px; color: #a09f96; line-height: 1.8; }
.branch-options { display: grid; gap: 10px; text-align: left; }
.evidence-dock { position: fixed; z-index: 10; bottom: 0; left: 50%; transform: translateX(-50%); width: min(720px,100%); min-height: 63px; padding: 10px 20px var(--safe-bottom); display: flex; align-items: center; justify-content: space-between; gap: 18px; border-top: 1px solid var(--line); background: rgba(10,12,11,.96); backdrop-filter: blur(16px); }
.evidence-dock > span { color: #777b74; font: .68rem/1.4 ui-monospace, monospace; letter-spacing: .1em; }
.evidence-marks { display: flex; gap: 7px; }
.evidence-marks i { width: 29px; height: 29px; display: grid; place-items: center; border: 1px solid #333830; color: #4e534c; border-radius: 50%; font-style: normal; }
.evidence-marks i.recovered { border-color: #85734f; color: #d7bd87; background: rgba(188,159,104,.08); }

.result-screen { padding: 40px 20px calc(32px + var(--safe-bottom)); background: radial-gradient(circle at 50% 15%, #242a24, var(--ink) 48%); }
.ending-stage { min-height: calc(100svh - 80px); display: flex; flex-direction: column; justify-content: center; }
.ending-stage .record { white-space: pre-line; color: #a09f96; font: .86rem/2 ui-monospace, monospace; }
.ending-stage h2 { margin: 30px 0 10px; font-size: clamp(2.1rem, 10vw, 4rem); font-weight: 500; line-height: 1.3; }
.ending-stage .truth { margin: 18px 0 30px; color: #b8b3a8; line-height: 1.9; }
.poster-panel { animation: rise .6s ease both; }
#poster-canvas { display: block; width: 100%; height: auto; border: 1px solid var(--line); background: #111; box-shadow: 0 20px 70px #000; }
.poster-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.history-panel { margin-top: 14px; }
.history-item { padding: 18px 0; border-top: 1px solid var(--line); }
.history-item h3 { margin: 0 0 8px; font-size: 1rem; }
.history-item p { margin: 0; color: #92958e; font-size: .86rem; line-height: 1.75; }
.history-item a { display: inline-block; margin-top: 9px; color: #c8aa71; }
@media (min-width: 760px) {
  body { padding: 24px 0; }
  .app-shell { width: 430px; min-height: calc(100svh - 48px); margin: 0 auto; border: 1px solid #282c27; box-shadow: 0 30px 100px #000; }
  .screen, .loading-screen { min-height: calc(100svh - 50px); }
  .game-content { min-height: calc(100svh - 174px); }
  .evidence-dock { width: 428px; bottom: 25px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
