@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=Noto+Sans+KR:wght@400;500;600;700;800;900&display=swap');

:root {
  font-family: 'Noto Sans KR', 'Malgun Gothic', sans-serif;
  color: #f3f1e9;
  background: #101a1e;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --bg: #101a1e;
  --surface: #19272c;
  --surface-hi: #203238;
  --edge: rgba(213, 230, 220, .13);
  --text: #f3f1e9;
  --muted: #a7b8b4;
  --signal: #eaa071;
  --lime: #d8e8a8;
  --teal: #83bfb5;
  --paper: #f0ede4;
  --ink: #263438;
}

* { box-sizing: border-box; }
html, body, #app { min-height: 100%; margin: 0; }
body { overflow-x: hidden; }
button { font: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; }
button:focus-visible { outline: 3px solid var(--signal); outline-offset: 3px; }
kbd { display: inline-grid; place-items: center; min-width: 21px; height: 21px; padding: 0 5px; border: 1px solid currentColor; border-radius: 5px; font: 500 10px 'DM Mono', monospace; }
.eyebrow, .serial, .hero-kicker, .hero-facts span, .hero-bottom span, .title-bottom, .title-top-actions, .assignment-top, .assignment-intro > span, .profession-heading, .profession-index, .assignment-foot, .brand small, .header-center, .header-actions, .case-progress, .panel-heading small, .panel-heading b, .map-footer, .stats-heading small, .stat-head, .story-top, .speaker, .mission-preview span, .game-footer, .archive-number, .archive-meta, .archive-note { font-family: 'DM Mono', 'Malgun Gothic', monospace; letter-spacing: .035em; }
.ghost { border: 1px solid var(--edge); color: var(--text); background: transparent; padding: 10px 14px; border-radius: 8px; }
.ghost:hover { border-color: var(--signal); background: rgba(234,160,113,.1); }
.ghost b { color: var(--signal); }

/* Assignment screen */
.title-screen { position: relative; isolation: isolate; min-height: 100dvh; display: flex; flex-direction: column; background: linear-gradient(90deg, rgba(10,20,24,.9) 0%, rgba(10,20,24,.67) 43%, rgba(10,20,24,.33) 100%), linear-gradient(0deg, rgba(10,20,24,.75), transparent 45%), url('/assets/scenes/title.png') center / cover no-repeat, #101a1e; overflow: hidden; }
.title-screen::before { content: ''; position: absolute; z-index: -1; inset: 0; background: linear-gradient(90deg, transparent 49.95%, rgba(215,235,220,.07) 50%, transparent 50.05%), linear-gradient(0deg, transparent 49.95%, rgba(215,235,220,.04) 50%, transparent 50.05%); background-size: 96px 96px; opacity: .22; pointer-events: none; }
.title-grain { position: absolute; inset: 0; z-index: -1; background: repeating-linear-gradient(125deg, transparent 0 3px, rgba(255,255,255,.009) 3px 4px); pointer-events: none; }
.title-top { display: flex; justify-content: space-between; align-items: center; gap: 20px; width: min(1500px, 100%); margin: 0 auto; padding: 21px clamp(22px, 4vw, 64px); border-bottom: 1px solid var(--edge); }
.title-brand { display: flex; align-items: center; gap: 12px; font-size: 14px; font-weight: 800; letter-spacing: -.04em; }
.title-brand small { display: block; margin-top: 3px; color: #8da5a0; font: 500 9px 'DM Mono', monospace; letter-spacing: .09em; }
.title-brand-mark { display: block; width: 34px; height: 34px; overflow: hidden; border: 1px solid var(--signal); border-radius: 9px; }
.title-brand-mark img, .profession-symbol img, .brand-cross img { display: block; width: 100%; height: 100%; object-fit: cover; }
.title-top-actions { display: flex; align-items: center; gap: 24px; color: #91a8a2; font-size: 10px; }
.title-top-actions button { font-family: 'Noto Sans KR', sans-serif; font-size: 11px; font-weight: 700; }
.title-main { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(480px, .92fr); align-items: center; gap: clamp(36px, 6vw, 108px); width: min(1500px, 100%); min-height: calc(100dvh - 132px); margin: 0 auto; padding: 28px clamp(22px, 4vw, 64px); }
.title-hero { align-self: stretch; display: flex; flex-direction: column; justify-content: center; min-width: 0; padding-bottom: 10px; }
.hero-kicker { display: flex; align-items: center; gap: 9px; color: var(--signal); font-size: 11px; font-weight: 600; }
.hero-kicker i { width: 7px; height: 7px; border-radius: 50%; background: var(--signal); box-shadow: 0 0 0 5px rgba(234,160,113,.13); }
.title-hero h1 { margin: 22px 0 23px; font-size: clamp(58px, 5.6vw, 94px); line-height: 1.12; letter-spacing: -.095em; font-weight: 900; white-space: nowrap; }
.title-hero h1 span, .title-hero h1 em { display: block; }
.title-hero h1 em { color: var(--lime); font-style: normal; }
.title-hero h1 .title-period { display: inline; color: var(--signal); }
.title-lead { margin: 0; color: #c6d3c9; font-size: clamp(16px, 1.35vw, 19px); line-height: 1.75; letter-spacing: -.025em; }
.hero-rule { width: min(500px, 100%); height: 1px; margin: 36px 0 22px; background: linear-gradient(90deg, var(--signal), var(--edge) 30%, transparent); }
.hero-facts { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; max-width: 460px; }
.hero-facts div { display: flex; flex-direction: column; gap: 3px; }
.hero-facts strong { color: var(--text); font: 500 clamp(28px, 3vw, 42px) 'DM Mono', monospace; letter-spacing: -.08em; }
.hero-facts span { color: #9fb1a9; font-size: 10px; }
.hero-bottom { display: flex; flex-direction: column; gap: 6px; margin-top: auto; padding-top: 35px; }
.hero-bottom span { color: var(--signal); font-size: 10px; }
.hero-bottom strong { color: #aebfb4; font-size: 12px; font-weight: 500; }
.assignment-panel { position: relative; width: 100%; max-width: 600px; justify-self: end; overflow: hidden; border: 1px solid rgba(255,255,255,.35); border-radius: 15px; background: var(--paper); color: var(--ink); box-shadow: 0 30px 90px rgba(0,0,0,.31), 10px 10px 0 rgba(238,234,216,.035); }
.assignment-panel::before { content: ''; position: absolute; top: 0; bottom: 0; left: 29px; width: 1px; background: rgba(199,108,87,.13); pointer-events: none; }
.assignment-top { display: flex; justify-content: space-between; align-items: center; padding: 13px 30px 13px 45px; border-bottom: 1px solid #d7d4c9; background: #e7e4d9; color: #6b7977; font-size: 10px; }
.assignment-top b { color: #a2543f; font: 800 11px 'Noto Sans KR', sans-serif; }
.assignment-intro { padding: 26px 32px 18px 45px; }
.assignment-intro > span { color: #a25d43; font-size: 10px; font-weight: 600; }
.assignment-intro h2 { margin: 5px 0 7px; font-size: clamp(25px, 2.3vw, 34px); letter-spacing: -.07em; line-height: 1.3; }
.assignment-intro p { max-width: 450px; margin: 0; color: #65726e; font-size: 12px; line-height: 1.6; word-break: keep-all; }
.profession-heading { display: flex; justify-content: space-between; margin: 0 30px 9px 45px; padding-bottom: 8px; border-bottom: 1px solid #cfcfc3; color: #6e7772; font-size: 10px; }
.profession-heading strong { color: #314345; font: 800 12px 'Noto Sans KR', sans-serif; }
.profession-list { display: grid; gap: 7px; margin: 0 30px 0 45px; }
.profession-card { display: grid; grid-template-columns: 25px 43px minmax(0,1fr) 20px; align-items: center; gap: 10px; width: 100%; min-height: 69px; padding: 8px 13px; border: 1px solid #cbd0c6; border-radius: 9px; background: rgba(255,255,255,.58); color: var(--ink); text-align: left; transition: border-color .17s, background .17s, transform .17s, box-shadow .17s; }
.profession-card:hover { transform: translateX(4px); border-color: #bd815c; background: #fffdf5; box-shadow: 0 5px 15px rgba(44,64,61,.08); }
.profession-index { align-self: start; padding-top: 8px; color: #a1a69e; font-size: 9px; }
.profession-symbol { display: block; width: 39px; height: 39px; overflow: hidden; border-radius: 7px; background: #223d41; }
.profession-copy { min-width: 0; }
.profession-copy strong { display: block; font-size: 15px; letter-spacing: -.035em; }
.profession-copy small { display: block; margin-top: 2px; color: #737f79; font-size: 10px; line-height: 1.35; word-break: keep-all; }
.profession-card > b { color: #a46343; font-size: 19px; font-weight: 500; }
.continue-button { display: flex; align-items: center; justify-content: space-between; width: calc(100% - 75px); min-height: 58px; margin: 16px 30px 0 45px; padding: 10px 16px; border: 0; border-radius: 9px; background: #d16f51; color: #fff9ee; text-align: left; transition: background .17s, transform .17s; }
.continue-button:hover { transform: translateY(-2px); background: #b95c42; }
.continue-button span { font-size: 13px; font-weight: 800; }
.continue-button small { display: block; margin-top: 2px; color: #f7dbc9; font-size: 10px; font-weight: 500; }
.continue-button b { font-size: 23px; font-weight: 400; }
.assignment-foot { display: flex; justify-content: space-between; margin-top: 18px; padding: 12px 30px 13px 45px; border-top: 1px solid #d7d4c9; color: #7d8780; font-size: 9px; }
.title-bottom { display: flex; justify-content: space-between; width: min(1500px,100%); margin: 0 auto; padding: 10px clamp(22px,4vw,64px); border-top: 1px solid var(--edge); color: #708782; font-size: 9px; }

/* Game frame */
.game-shell { display: flex; flex-direction: column; min-height: 100dvh; background: radial-gradient(circle at 100% 0, rgba(43,82,79,.2), transparent 42%), var(--bg); }
.game-header { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 15px; min-height: 66px; padding: 8px clamp(16px, 2vw, 34px); border-bottom: 1px solid var(--edge); background: rgba(17,28,32,.92); }
.brand { display: flex; align-items: center; gap: 11px; white-space: nowrap; }
.brand-cross { display: block; width: 36px; height: 36px; overflow: hidden; border-radius: 10px; background: #d57558; }
.brand strong { display: block; font-size: 16px; font-weight: 800; letter-spacing: -.05em; }
.brand small { display: block; margin-top: 2px; color: #839b96; font-size: 9px; }
.header-center { display: flex; gap: 7px; align-items: center; }
.header-center span { padding: 7px 10px; border: 1px solid var(--edge); border-radius: 7px; color: #c3d0c9; font-size: 10px; white-space: nowrap; }
.header-center .season { border-color: rgba(234,160,113,.38); color: var(--signal); background: rgba(234,160,113,.08); }
.header-actions { display: flex; gap: 6px; justify-self: end; }
.header-actions button, .game-footer button { padding: 8px 11px; border: 1px solid var(--edge); border-radius: 7px; background: transparent; color: #b8c7c0; font-size: 10px; white-space: nowrap; }
.header-actions button:hover, .game-footer button:hover { border-color: var(--signal); color: var(--text); }
.game-main { display: flex; flex: 1; flex-direction: column; gap: 10px; width: min(1540px, 100%); min-width: 0; margin: 0 auto; padding: 12px clamp(13px, 1.5vw, 25px); }
.case-progress { display: flex; justify-content: space-between; align-items: center; gap: 25px; min-height: 32px; }
.case-progress-copy { display: flex; align-items: baseline; gap: 15px; min-width: 0; }
.case-progress-copy > span { color: var(--signal); font-size: 12px; white-space: nowrap; }
.case-progress-copy > span i { color: #718a83; font-size: 10px; font-style: normal; }
.case-progress-copy strong { overflow: hidden; color: #dfebe0; font: 600 12px 'Noto Sans KR', sans-serif; text-overflow: ellipsis; white-space: nowrap; }
.case-progress-copy strong b { color: #718a83; }
.progress-steps { display: grid; grid-template-columns: repeat(12,minmax(8px,1fr)); gap: 4px; width: min(360px,32vw); height: 8px; flex: none; }
.progress-steps i { border-radius: 3px; background: #344950; }
.progress-steps i.done { background: #70aea3; }
.progress-steps i.current { background: var(--signal); box-shadow: 0 0 0 3px rgba(234,160,113,.15); }
.map-panel, .stats-panel, .story-panel { min-width: 0; overflow: hidden; border: 1px solid var(--edge); border-radius: 13px; box-shadow: 0 16px 45px rgba(2,12,14,.16); }
.game-workspace { display: grid; grid-template-columns: minmax(0,1.13fr) minmax(390px,.87fr); gap: 12px; height: clamp(425px,calc(100dvh - 235px),720px); min-width: 0; }
.map-panel { display: flex; flex-direction: column; background: #203337; }
.panel-heading { display: flex; justify-content: space-between; align-items: center; min-height: 55px; padding: 8px 18px; border-bottom: 1px solid var(--edge); background: #1b2b30; }
.panel-heading > div { display: flex; flex-direction: column; gap: 1px; }
.panel-heading small { color: #7faaa1; font-size: 9px; }
.panel-heading span { color: var(--text); font-size: 15px; font-weight: 800; letter-spacing: -.05em; }
.panel-heading b { color: #6f8e89; font-size: 9px; font-weight: 500; }

/* Field map */
.map-stage { position: relative; flex: 1; min-height: 0; overflow: hidden; background: #19393b; cursor: crosshair; user-select: none; }
.map-stage::after { content: ''; position: absolute; inset: 0; z-index: 1; background: linear-gradient(180deg, rgba(6,28,30,.1), rgba(6,28,30,.24)); pointer-events: none; }
.map-art { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; pointer-events: none; }
.map-boundary { position: absolute; z-index: 1; inset: 10px; border: 1px solid rgba(214,235,219,.13); border-radius: 5px; pointer-events: none; }
.poi { position: absolute; z-index: 3; display: grid; justify-items: center; gap: 3px; width: 100px; padding: 0; border: 0; color: #dcead9; background: transparent; transform: translate(-50%,-50%); }
.poi-icon { display: block; width: 46px; height: 42px; overflow: hidden; border: 2px solid #e4ebd8; border-radius: 8px; background: #203b3b; box-shadow: 0 5px 10px rgba(4,18,19,.6), 0 0 0 3px rgba(19,43,40,.46); transition: transform .16s, border-color .16s, box-shadow .16s; }
.poi-icon img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center; }
.poi:hover .poi-icon, .poi.near .poi-icon { transform: translateY(-4px); border-color: #f0ddad; box-shadow: 0 7px 13px rgba(4,18,19,.7), 0 0 0 4px rgba(240,221,173,.28); }
.poi-label { max-width: 100px; padding: 2px 7px; border: 1px solid rgba(171,208,185,.25); border-radius: 4px; background: rgba(15,35,37,.85); color: #eaf0db; font-size: 10px; font-weight: 700; white-space: nowrap; box-shadow: 0 3px 8px rgba(0,0,0,.16); }
.poi.active .poi-icon { border-color: #ffba8b; background: #c4634c; animation: poi-pulse 2s infinite; }
.poi.active .poi-label { border-color: #e99b72; color: #ffd9b7; }
.poi-alert { position: absolute; top: -11px; right: 22px; display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: #ffe0a0; color: #603c34; font-size: 11px; font-style: normal; font-weight: 900; }
.map-footer { display: flex; justify-content: space-between; gap: 8px; align-items: center; min-height: 35px; padding: 6px 16px; color: #a5bdb4; font-size: 10px; }
.map-footer kbd { min-width: 17px; height: 17px; margin-right: 2px; font-size: 9px; }
.mission-dot { display: inline-block; width: 8px; height: 8px; margin-right: 5px; border-radius: 50%; background: #e08768; }
@keyframes poi-pulse { 50% { box-shadow: 0 5px 10px rgba(4,18,19,.6), 0 0 0 10px rgba(234,139,100,.22); } }

/* Character */
.player { position: absolute; z-index: 6; width: 64px; height: 92px; transform: translate(-50%,-43%); pointer-events: none; }
.player.at-place { transform: translate(calc(-50% + 32px),-43%); }
.player-label { position: absolute; z-index: 8; top: -13px; left: 50%; padding: 2px 7px; border: 2px solid #253e43; border-radius: 12px; background: #ffd47d; color: #22373d; font-size: 10px; line-height: 1.2; font-weight: 900; box-shadow: 0 2px 0 rgba(13,29,32,.55); transform: translateX(-50%); }
.player-ring { position: absolute; z-index: 1; left: 10px; bottom: 3px; width: 44px; height: 14px; border: 2px solid #e78c51; border-radius: 50%; background: rgba(255,214,133,.28); box-shadow: 0 0 0 3px rgba(255,255,255,.72); }
.player-shadow { position: absolute; z-index: 1; bottom: 6px; left: 15px; width: 34px; height: 9px; border-radius: 50%; background: rgba(1,19,22,.62); }
.player-sprite { position: absolute; z-index: 2; inset: 0; display: block; width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 3px 3px rgba(0,0,0,.8)); }
.sprite-side, .sprite-back { display: none; }
.player[data-facing="up"] .sprite-front, .player[data-facing="left"] .sprite-front, .player[data-facing="right"] .sprite-front { display: none; }
.player[data-facing="up"] .sprite-back, .player[data-facing="left"] .sprite-side, .player[data-facing="right"] .sprite-side { display: block; }
.player[data-facing="left"] .sprite-side { scale: -1 1; }
.player.walking .player-sprite { animation: walk-bob .22s ease-in-out infinite alternate; }
@keyframes walk-bob { to { translate: 0 -3px; } }

/* Status rail */
.stats-panel { display: grid; grid-template-columns: 120px minmax(0,1fr); align-items: center; min-height: 76px; background: #1a2b30; }
.stats-heading { display: flex; flex-direction: column; justify-content: center; gap: 3px; height: 100%; padding: 9px 15px; border-right: 1px solid var(--edge); }
.stats-heading strong { color: #e5efdc; font-size: 12px; }
.stats-heading small { color: #78918a; font-size: 9px; line-height: 1.3; }
.stats-quick, .stats-toggle { display: none; }
.stats-grid { display: grid; grid-template-columns: repeat(8,minmax(0,1fr)); gap: 13px; padding: 10px 17px; }
.stat-head { display: flex; justify-content: space-between; align-items: baseline; gap: 4px; margin-bottom: 8px; color: #b8ccc2; font-size: 10px; white-space: nowrap; }
.stat-head b { color: #f5f1e5; font-size: 12px; font-weight: 500; }
.stat-track { width: 100%; height: 4px; overflow: hidden; border-radius: 4px; background: #3b5052; }
.stat-track i { display: block; height: 100%; border-radius: 4px; background: var(--teal); transition: width .25s ease; }
.stat.threat .stat-track i { background: #e59a71; }
.stat.danger .stat-head b { color: #f7a38f; }
.stat.danger .stat-track i { background: #e06f62; }

/* Case dossier */
.story-panel { display: flex; flex-direction: column; min-height: 0; background: var(--paper); color: var(--ink); }
.story-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 55px; padding: 12px 20px; border-bottom: 1px solid #c7c9be; background: #e7e4d8; font-size: 10px; }
.story-index { color: #9c553f; font-weight: 600; }
.story-id { color: #89948d; }
.story-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 21px 25px 14px; background: linear-gradient(90deg, transparent 25px, rgba(187,102,79,.11) 25px 26px, transparent 26px), repeating-linear-gradient(0deg, transparent 0 38px, rgba(112,129,109,.055) 38px 39px); }
.scene-art { height: clamp(128px, 19vh, 180px); overflow: hidden; margin: -21px -25px 18px; border-bottom: 1px solid #bdc2b7; background: #22383b; }
.scene-art img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center 44%; }
.speaker { display: inline-block; margin-bottom: 12px; color: #a75c44; font-size: 10px; font-weight: 600; }
.story-body h2 { margin: 0 0 15px; color: #203236; font-size: clamp(25px,2.2vw,34px); line-height: 1.32; letter-spacing: -.07em; font-weight: 900; word-break: keep-all; }
.story-body p { margin: 0; color: #52615f; font-size: 13px; line-height: 1.76; word-break: keep-all; }
.story-body p strong { color: #aa5e43; }
.story-body .minor { color: #818c84; font-size: 11px; }
.divider { height: 1px; margin: 20px 0; background: #cacdc1; }
.mission-preview { margin-top: 25px; padding: 12px 15px; border-left: 3px solid #ce7758; background: #e3dfd1; }
.mission-preview.muted { border-color: #6e9b8e; }
.mission-preview span { display: block; margin-bottom: 4px; color: #967567; font-size: 10px; }
.mission-preview strong { font-size: 17px; letter-spacing: -.04em; }
.choice-list { display: grid; gap: 7px; flex: 0 1 auto; max-height: 64%; overflow-y: auto; padding: 10px 16px; border-top: 1px solid #d5d5ca; background: #e4e2d8; }
.choice-list.four { grid-template-columns: repeat(2,minmax(0,1fr)); }
.choice-list.six { max-height: 48%; }
.choice { display: block; width: 100%; padding: 10px 12px; border: 1px solid #cdd1c8; border-radius: 8px; background: #faf9f4; color: #263438; text-align: left; transition: border-color .15s, background .15s, transform .15s, box-shadow .15s; }
.choice:hover:not(:disabled) { transform: translateY(-2px); border-color: #c0785a; background: #fffdf6; box-shadow: 0 6px 12px rgba(72,76,62,.09); }
.choice.primary { border-color: #253d42; background: #263f44; color: #fbf6e9; }
.choice.primary:hover { background: #335258; }
.choice > span { display: block; font-size: 13px; font-weight: 800; line-height: 1.42; word-break: keep-all; }
.choice > span b { margin-right: 7px; color: #b36e51; font: 500 10px 'DM Mono',monospace; }
.choice small { display: block; margin-top: 5px; color: #75827b; font-size: 10px; line-height: 1.4; }
.choice.primary small { color: #cad9cf; }
.choice.locked { opacity: .55; background: #ecebe4; }
.effect-list { display: flex !important; flex-wrap: wrap; gap: 4px; margin-top: 7px; }
.effect-chip { display: inline-block; padding: 2px 6px; border-radius: 4px; font-size: 10px; font-weight: 600; line-height: 1.35; }
.effect-chip.gain { color: #236455; background: #dcebe1; }
.effect-chip.cost { color: #a35240; background: #f2e0d9; }
.subtle-button { padding: 9px 18px 11px; border: 0; border-top: 1px solid #d5d5ca; background: #e4e2d8; color: #69786f; text-align: left; font-size: 11px; }
.subtle-button:hover { color: #a85a43; }
.ending-seal { display: inline-block; margin: 16px 0; padding: 7px 13px; border: 3px double #b3664d; color: #b3664d; font-size: 16px; font-weight: 900; transform: rotate(-5deg); }
.summary-list { margin: 7px 0 17px; border-top: 1px solid #cbcec3; }
.summary-list div { display: grid; grid-template-columns: 105px 1fr; gap: 10px; padding: 8px 0; border-bottom: 1px solid #cbcec3; font-size: 11px; }
.summary-list span { color: #7e8a80; }
.summary-list b { font-weight: 700; }
.game-footer { display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 34px; padding: 5px clamp(16px,2vw,34px); border-top: 1px solid var(--edge); color: #708882; font-size: 9px; }

/* Year breaks and final ending */
.milestone-screen, .finale-screen { min-height: 100dvh; background: radial-gradient(circle at 75% 10%, #28433f, transparent 42%), #101a1e; }
.milestone-header { display: flex; align-items: center; justify-content: space-between; gap: 18px; max-width: 1320px; margin: 0 auto; padding: 20px clamp(20px,4vw,54px); color: #cfddd2; font-size: 12px; font-weight: 800; }
.milestone-layout, .finale-layout { display: grid; grid-template-columns: minmax(0,1.05fr) minmax(390px,.95fr); max-width: 1320px; min-height: min(720px,calc(100dvh - 95px)); margin: 0 auto; padding: 18px clamp(20px,4vw,54px) 42px; }
.milestone-art, .finale-art { overflow: hidden; background: #22383b; }
.milestone-art { min-height: 530px; border-radius: 15px 0 0 15px; }
.milestone-art img, .finale-art img { display: block; width: 100%; height: 100%; object-fit: cover; }
.milestone-body { display: flex; flex-direction: column; align-items: flex-start; padding: clamp(28px,4vw,58px); border-radius: 0 15px 15px 0; background: var(--paper); color: var(--ink); }
.milestone-kicker, .finale-id { margin: 0; color: #ad5f47; font: 600 11px 'DM Mono','Malgun Gothic',monospace; letter-spacing: .045em; }
.milestone-body h1 { margin: 15px 0 15px; font-size: clamp(38px,4vw,60px); letter-spacing: -.08em; }
.milestone-lead { margin: 0 0 28px; color: #566561; font-size: 15px; line-height: 1.7; word-break: keep-all; }
.milestone-badge { width: 100%; margin-bottom: 24px; padding: 18px 20px; border-left: 4px solid #c97557; background: #e3dfd1; }
.milestone-badge span, .milestone-badge strong { display: block; }
.milestone-badge span { margin-bottom: 6px; color: #9e654e; font-size: 10px; }
.milestone-badge strong { font-size: 23px; letter-spacing: -.05em; }
.milestone-badge p { margin: 6px 0 0; color: #66726a; font-size: 12px; }
.milestone-list { width: 100%; margin-bottom: 25px; border-top: 1px solid #c9cec3; }
.milestone-list div { display: grid; grid-template-columns: 105px 1fr; gap: 14px; padding: 12px 0; border-bottom: 1px solid #c9cec3; }
.milestone-list span { color: #867e71; font-size: 11px; }
.milestone-list strong { font-size: 12px; font-weight: 700; line-height: 1.55; word-break: keep-all; }
.milestone-next { width: 100%; margin-top: auto; padding: 15px 20px; border: 0; border-radius: 8px; background: #253e42; color: #fff8e9; text-align: left; font-weight: 800; }
.milestone-next:hover { background: #34585a; }
.finale-layout { grid-template-columns: minmax(0,1.12fr) minmax(370px,.88fr); gap: 14px; align-items: start; }
.finale-result { overflow: hidden; border: 1px solid rgba(234,160,113,.34); border-radius: 14px; background: #1b2c30; }
.finale-art { height: clamp(230px,33vh,380px); }
.finale-copy { padding: clamp(22px,3vw,39px); }
.finale-verdict { display: inline-block; margin: 18px 0 0; padding: 6px 10px; border: 1px solid rgba(234,160,113,.58); border-radius: 4px; color: #f3b587; font-size: 11px; font-weight: 800; }
.finale-copy h1 { margin: 14px 0 22px; font-size: clamp(36px,4.2vw,62px); line-height: 1.15; letter-spacing: -.085em; word-break: keep-all; }
.finale-scene { margin: 0 0 16px; color: #f3efe4; font-size: 19px; line-height: 1.65; word-break: keep-all; }
.finale-after { margin: 0; color: #b6c8be; font-size: 13px; line-height: 1.75; word-break: keep-all; }
.finale-last-choice { margin-top: 24px; padding: 13px 15px; border-left: 3px solid #eaa071; background: #243b3d; }
.finale-last-choice span { display: block; margin-bottom: 6px; color: #e6ac82; font-size: 10px; }
.finale-last-choice strong { font-size: 14px; }
.finale-last-choice p { margin: 5px 0 0; color: #afc6b8; font-size: 11px; line-height: 1.5; }
.finale-tags { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 25px; }
.finale-tags span { padding: 5px 8px; border: 1px solid #46615c; border-radius: 5px; color: #a9c8b8; font-size: 10px; }
.handover-sheet { overflow: hidden; border-radius: 13px; background: var(--paper); color: var(--ink); }
.handover-top { display: flex; justify-content: space-between; padding: 20px 24px; border-bottom: 1px solid #c9c9bb; background: #e3e0d3; font-size: 16px; font-weight: 900; }
.handover-top b { color: #b2664e; font: 500 12px 'DM Mono',monospace; }
.handover-rows { padding: 11px 24px; }
.handover-rows div { display: grid; grid-template-columns: 75px 1fr; gap: 10px; padding: 14px 0; border-bottom: 1px solid #d4d5c9; }
.handover-rows span { color: #8d8273; font-size: 11px; }
.handover-rows strong { font-size: 12px; font-weight: 700; line-height: 1.6; word-break: keep-all; }
.ending-path { padding: 12px 24px; border-top: 1px solid #d4d5c9; }
.ending-path h2 { margin: 0 0 8px; color: #a55941; font-size: 12px; }
.ending-path div { display: grid; grid-template-columns: 125px 1fr; gap: 8px; padding: 7px 0; border-bottom: 1px solid #d9d9ce; }
.ending-path span { color: #867e71; font-size: 10px; line-height: 1.5; }
.ending-path strong { font-size: 11px; line-height: 1.5; }
.handover-postscript { padding: 14px 24px 21px; }
.handover-postscript span { color: #a55941; font-size: 11px; font-weight: 800; }
.handover-postscript p { margin: 7px 0 0; color: #53625c; font-size: 12px; line-height: 1.7; }
.finale-actions { display: flex; gap: 8px; padding: 15px 24px 22px; border-top: 1px solid #d4d5c9; }
.finale-actions button { flex: 1; padding: 12px; border: 1px solid #2b4447; border-radius: 7px; background: #2b4447; color: #fff8ed; font-size: 12px; font-weight: 800; }
.finale-actions button + button { background: transparent; color: #2b4447; }
.archive-section { max-width: 1280px; margin: 0 auto 35px; }
.archive-section > h2 { margin: 0 0 13px; padding-bottom: 8px; border-bottom: 1px solid var(--edge); color: #d9e4d7; font-size: 17px; }

/* Archive and case log */
.archive-screen, .journal-screen { min-height: 100dvh; padding: clamp(24px,4vw,62px); background: radial-gradient(circle at 85% 0, #263e3b, transparent 35%), var(--bg); }
.archive-header { display: flex; justify-content: space-between; align-items: start; gap: 20px; max-width: 1280px; margin: 0 auto 31px; padding-bottom: 23px; border-bottom: 1px solid var(--edge); }
.archive-header .eyebrow { color: var(--signal); font: 500 10px 'DM Mono',monospace; letter-spacing: .09em; }
.archive-header h1 { margin: 5px 0 5px; font-size: clamp(38px,5vw,65px); letter-spacing: -.08em; }
.archive-header p { margin: 0; color: #a2b7ae; font-size: 12px; }
.archive-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; max-width: 1280px; margin: 0 auto; }
.archive-card { position: relative; display: flex; flex-direction: column; min-height: 233px; overflow: hidden; padding: 21px; border: 1px solid var(--edge); border-radius: 12px; background: #1b2c30; }
.archive-card.unlocked { border-color: rgba(234,160,113,.55); background: linear-gradient(145deg,#30433d,#1b2c30); }
.archive-art { height: 116px; flex: none; overflow: hidden; margin: -21px -21px 15px; background: #233b3d; }
.archive-art img { display: block; width: 100%; height: 100%; object-fit: cover; }
.archive-card.locked .archive-art img { filter: grayscale(1) brightness(.48); }
.archive-number { position: absolute; top: 14px; left: 15px; padding: 4px 7px; border-radius: 5px; background: rgba(16,26,30,.85); color: var(--signal); font-size: 10px; }
.archive-card.locked .archive-number { color: #b4c5bd; }
.archive-card h2 { margin: 0 0 10px; font-size: 21px; letter-spacing: -.05em; }
.archive-card.locked h2 { color: #a1b3a9; }
.archive-card p { margin: 0 0 20px; color: #bdcbc0; font-size: 12px; line-height: 1.7; }
.archive-card.locked p { color: #94a99e; }
.archive-meta { margin-top: auto; padding-top: 10px; border-top: 1px solid var(--edge); color: #94a99d; font-size: 10px; line-height: 1.6; }
.archive-note { max-width: 1280px; margin: 19px auto 0; color: #8fa99d; font-size: 10px; }
.journal-list { max-width: 1060px; margin: 0 auto; border-top: 1px solid var(--edge); }
.journal-row { display: grid; grid-template-columns: 160px 1fr; gap: 18px; padding: 20px 7px; border-bottom: 1px solid var(--edge); }
.journal-row > span { padding-top: 5px; color: var(--signal); font: 500 10px 'DM Mono',monospace; }
.journal-row h2 { margin: 0 0 5px; font-size: 18px; }
.journal-row strong { color: #e0ad8b; font-size: 12px; }
.journal-row p { margin: 5px 0 0; color: #afc3b7; font-size: 12px; line-height: 1.7; }
.journal-empty { margin: 25px 7px; color: #afc3b7; font-size: 12px; }
.toast { position: fixed; z-index: 20; bottom: 23px; left: 50%; max-width: min(620px,calc(100vw - 30px)); padding: 12px 17px; border-left: 4px solid var(--signal); border-radius: 8px; background: #f5eddb; color: #24383a; box-shadow: 0 15px 35px rgba(0,0,0,.3); font-size: 12px; line-height: 1.5; opacity: 0; pointer-events: none; transform: translate(-50%,14px); transition: opacity .18s, transform .18s; }
.toast.show { opacity: 1; transform: translate(-50%,0); }

@media (max-width: 1180px) {
  .title-main { grid-template-columns: minmax(0,1fr) minmax(440px,.95fr); gap: 35px; }
  .title-hero h1 { font-size: clamp(54px,5.2vw,70px); }
  .game-header { grid-template-columns: 1fr auto; }
  .header-center { grid-column: 1 / -1; grid-row: 2; }
  .game-workspace { grid-template-columns: minmax(0,1fr) minmax(340px,.87fr); height: clamp(440px,calc(100dvh - 271px),720px); }
  .stats-grid { grid-template-columns: repeat(4,minmax(0,1fr)); gap: 8px 18px; }
}
@media (max-width: 900px) {
  .milestone-layout, .finale-layout { grid-template-columns: 1fr; }
  .milestone-art { min-height: 280px; max-height: 360px; border-radius: 15px 15px 0 0; }
  .milestone-body { border-radius: 0 0 15px 15px; }
  .title-main { grid-template-columns: 1fr; gap: 26px; }
  .title-hero { padding-top: 30px; }
  .title-hero h1 { font-size: clamp(54px,8vw,78px); }
  .hero-bottom { display: none; }
  .assignment-panel { justify-self: stretch; max-width: none; }
  .game-workspace { grid-template-columns: 1fr; height: auto; }
  .map-stage { flex: none; height: 390px; }
  .story-body { flex: none; overflow: visible; }
  .scene-art { height: clamp(170px, 32vw, 255px); }
  .choice-list, .choice-list.six { max-height: none; }
  .stats-panel { display: block; min-height: 0; }
  .stats-heading { flex-direction: row; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 7px; min-height: 48px; border-right: 0; padding: 9px 13px; }
  .stats-heading small { display: none; }
  .stats-quick { display: flex; order: 3; justify-content: space-between; gap: 7px; width: 100%; color: #b7c9bd; font-size: 10px; }
  .stats-quick b { color: #f2efe5; }
  .stats-toggle { display: block; padding: 2px 0; border: 0; background: none; color: var(--signal); font-size: 10px; white-space: nowrap; }
  .stats-grid { display: none; grid-template-columns: repeat(4,minmax(0,1fr)); border-top: 1px solid var(--edge); }
  .stats-panel.expanded .stats-grid { display: grid; }
  .archive-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .game-footer span:nth-child(2) { display: none; }
}
@media (max-width: 620px) {
  .milestone-layout, .finale-layout { padding: 8px 15px 30px; }
  .milestone-body, .finale-copy { padding: 24px; }
  .milestone-list div { grid-template-columns: 85px 1fr; }
  .ending-path div { grid-template-columns: 1fr; gap: 1px; }
  .finale-art { height: 210px; }
  .title-top { padding: 17px 20px; }
  .title-top-actions > span { display: none; }
  .title-brand { font-size: 12px; }
  .title-main { padding: 21px 18px 30px; }
  .title-hero { padding-top: 4px; }
  .title-hero h1 { margin: 16px 0 14px; font-size: clamp(44px,10vw,60px); white-space: normal; }
  .title-lead { font-size: 15px; }
  .hero-rule { margin: 23px 0 14px; }
  .hero-facts strong { font-size: 27px; }
  .assignment-top { padding-left: 24px; }
  .assignment-intro { padding: 21px 22px 17px 24px; }
  .assignment-panel::before { display: none; }
  .profession-heading { margin-left: 24px; margin-right: 22px; }
  .profession-list { margin-left: 24px; margin-right: 22px; }
  .profession-card { grid-template-columns: 17px 37px minmax(0,1fr) 16px; gap: 6px; padding: 8px; }
  .profession-symbol { width: 34px; height: 34px; font-size: 17px; }
  .continue-button { width: calc(100% - 46px); margin-left: 24px; margin-right: 22px; }
  .assignment-foot { padding-left: 24px; padding-right: 22px; }
  .game-header { grid-template-columns: 1fr; gap: 8px; }
  .header-actions { justify-self: start; }
  .header-center { grid-column: 1; grid-row: auto; flex-wrap: wrap; }
  .case-progress { align-items: stretch; flex-direction: column; gap: 7px; }
  .case-progress-copy { justify-content: space-between; gap: 8px; }
  .case-progress-copy strong { font-size: 11px; }
  .progress-steps { width: 100%; }
  .map-stage { height: 340px; }
  .poi { width: 73px; }
  .poi-icon { width: 29px; height: 29px; font-size: 16px; }
  .poi-label { max-width: 76px; padding: 2px 4px; font-size: 8px; }
  .poi-alert { right: 12px; }
  .map-footer { flex-wrap: wrap; }
  .choice-list.four { grid-template-columns: 1fr; }
  .scene-art { height: 185px; }
  .stats-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .archive-grid { grid-template-columns: 1fr; }
  .journal-row { grid-template-columns: 1fr; gap: 3px; }
}
@media (min-width: 901px) and (max-height: 800px) {
  .title-main { min-height: calc(100dvh - 125px); padding-top: 15px; padding-bottom: 15px; }
  .title-hero h1 { margin: 14px 0; font-size: clamp(54px,5vw,77px); }
  .hero-rule { margin: 21px 0 15px; }
  .assignment-intro { padding-top: 17px; padding-bottom: 13px; }
  .profession-card { min-height: 62px; }
  .assignment-foot { margin-top: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
