:root {
  color-scheme: dark;
  font-family: "Noto Sans KR", Pretendard, system-ui, sans-serif;
  font-size: 16px;
  --bg: #090b0c;
  --panel: rgba(13, 16, 17, .94);
  --panel-soft: rgba(20, 24, 25, .86);
  --line: rgba(255,255,255,.14);
  --muted: #a8afb0;
  --text: #f3f5f4;
  --red: #e14e4e;
  --amber: #e5ad4f;
  --green: #71b998;
  --app-height: 100vh;
  --app-top: 0px;
}
* { box-sizing: border-box; }
html, body, #app { width: 100%; height: 100%; margin: 0; overflow: hidden; background: var(--bg); color: var(--text); }
body { overscroll-behavior: none; -webkit-tap-highlight-color: transparent; }
h1, h2, h3, p, label, button, small { word-break: keep-all; overflow-wrap: break-word; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; }
.privacy-link { display: block; margin-top: 16px; color: var(--muted); font-size: .75rem; text-align: center; text-underline-offset: 3px; }
button, input, textarea { font: inherit; letter-spacing: 0; }
button, input, textarea { touch-action: manipulation; }
button { color: inherit; cursor: pointer; }
[hidden] { display: none !important; }
.screen { position: fixed; top: var(--app-top); right: 0; left: 0; width: 100%; height: var(--app-height); min-width: 0; min-height: 0; }
.eyebrow { margin: 0 0 6px; color: #c3c9c8; font-size: .72rem; font-weight: 800; letter-spacing: .16em; }
.primary, .secondary, .quiet { min-height: 44px; border: 1px solid transparent; border-radius: 4px; padding: 0 18px; font-weight: 800; }
.primary { background: var(--text); color: #0b0d0e; }
.primary:hover { background: #fff; }
.secondary { background: transparent; border-color: rgba(255,255,255,.45); }
.quiet { background: transparent; border-color: var(--line); color: #ccd0cf; }
.wide { width: 100%; }
.icon-button { width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 4px; background: rgba(0,0,0,.35); font-size: 1.2rem; }
label { display: grid; gap: 7px; color: #c9cecd; font-size: .8rem; font-weight: 700; }
input, textarea { width: 100%; border: 1px solid rgba(255,255,255,.22); border-radius: 4px; background: rgba(0,0,0,.5); color: var(--text); outline: none; }
input { height: 46px; padding: 0 13px; }
textarea { min-height: 76px; resize: none; padding: 11px 13px; line-height: 1.45; }
input:focus, textarea:focus { border-color: #e1e6e4; box-shadow: 0 0 0 2px rgba(255,255,255,.08); }
.form-error, .floating-error { min-height: 20px; margin: 0; color: #ff8b84; font-size: .78rem; }

.auth-screen { display: grid; grid-template-columns: minmax(0, 1fr) minmax(330px, 440px); align-items: end; gap: 48px; padding: clamp(28px, 6vw, 86px); background: linear-gradient(90deg, rgba(3,5,6,.88), rgba(3,5,6,.28) 58%, rgba(3,5,6,.72)), url('/static/assets/control-core.png') center/cover; }
.brand-lockup { align-self: end; padding-bottom: 18px; text-shadow: 0 2px 16px #000; }
.brand-lockup h1 { margin: 0; max-width: 760px; font-size: clamp(3rem, 7vw, 7rem); line-height: .94; font-weight: 900; letter-spacing: 0; word-break: keep-all; }
.brand-lockup > p:last-child { margin: 14px 0 0; color: #d2d5d4; font-size: 1.2rem; }
.auth-panel { align-self: center; width: 100%; padding: 28px; border: 1px solid rgba(255,255,255,.2); border-radius: 6px; background: rgba(7,9,10,.9); box-shadow: 0 24px 80px rgba(0,0,0,.55); backdrop-filter: blur(14px); }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; margin-bottom: 24px; border-bottom: 1px solid var(--line); }
.auth-tabs button { height: 42px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); font-weight: 800; }
.auth-tabs button.active { border-color: var(--red); color: #fff; }
#authForm { display: grid; gap: 15px; }
.field-action { display: grid; grid-template-columns: minmax(0, 1fr) 96px; gap: 8px; }
.field-action .secondary { min-width: 0; height: 46px; padding: 0 10px; font-size: .78rem; }
.field-status { min-height: 16px; color: var(--muted); font-size: .7rem; font-weight: 700; }
.field-status.available { color: var(--green); }
.field-status.error { color: #ff8b84; }
.auth-status { position: absolute; top: 24px; right: 28px; margin: 0; color: #c4cac8; font-size: .75rem; }
.auth-status span { display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 10px var(--green); }

.guide-screen { display: grid; place-items: center; padding: 24px; background: url('/static/assets/control-core.png') center/cover; }
.guide-shade { position: absolute; inset: 0; background: rgba(4,6,7,.7); }
.guide-dialog { position: relative; width: min(680px, 100%); min-height: 420px; display: flex; flex-direction: column; padding: clamp(24px, 4vw, 44px); border: 1px solid rgba(255,255,255,.24); border-radius: 6px; background: rgba(9,12,13,.94); box-shadow: 0 30px 100px #000; }
.guide-dialog.dying { animation: glitch .18s 4; border-color: var(--red); }
@keyframes glitch { 33% { transform: translateX(3px); filter: saturate(.2); } 66% { transform: translateX(-3px); filter: contrast(1.5); } }
.guide-identity { display: flex; align-items: center; gap: 13px; }
.guide-identity strong, .guide-identity small { display: block; }
.guide-identity small { margin-top: 3px; color: var(--muted); }
.ai-eye { width: 43px; height: 43px; border: 2px solid #d9dddc; border-radius: 50%; box-shadow: inset 0 0 0 8px #1b1e1e; background: var(--red); }
.guide-progress { height: 2px; margin: 20px 0 28px; background: #292e2e; }
.guide-progress span { display: block; height: 100%; background: var(--red); transition: width .25s; }
.guide-text { margin: 0 0 24px; font-size: clamp(1.12rem, 2.3vw, 1.48rem); line-height: 1.65; word-break: keep-all; }
.guide-choices button, .guide-reply, .action-note, .machine-hint p, .starter-prompt p, .toast { word-break: keep-all; overflow-wrap: break-word; }
.guide-choices { display: grid; gap: 9px; }
.guide-choices button { min-height: 48px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 4px; background: #151919; text-align: left; }
.guide-choices button:hover { border-color: #fff; }
.guide-reply { min-height: 26px; margin: auto 0 14px; color: #d7ddd9; line-height: 1.55; }
.guide-dialog > .primary { align-self: end; }

.cinematic-screen { isolation: isolate; overflow: hidden; background: #050708; }
.cinematic-backdrop { position: absolute; inset: -5%; background-position: center; background-size: cover; animation: cinematic-camera 4.2s ease-out both; }
.cinematic-backdrop::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(2,4,5,.88), rgba(2,4,5,.28) 70%), linear-gradient(0deg, rgba(2,4,5,.88), transparent 55%); }
.cinematic-shade { position: absolute; inset: 0; z-index: 1; background: repeating-linear-gradient(0deg, rgba(255,255,255,.025) 0 1px, transparent 1px 4px); pointer-events: none; }
@keyframes cinematic-camera { from { transform: scale(1.08) translate3d(1.5%, 1%, 0); } to { transform: scale(1) translate3d(0, 0, 0); } }
.cinematic-header { position: absolute; top: 0; right: 0; left: 0; z-index: 2; display: flex; justify-content: space-between; align-items: center; padding: max(24px, env(safe-area-inset-top)) clamp(22px, 5vw, 70px); color: #d4d9d7; font-size: .76rem; font-weight: 900; }
.cinematic-copy { position: absolute; z-index: 2; left: clamp(22px, 8vw, 120px); bottom: clamp(90px, 16vh, 160px); width: min(720px, calc(100% - 44px)); text-shadow: 0 3px 20px #000; animation: cinematic-copy .55s ease-out both; }
@keyframes cinematic-copy { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: translateY(0); } }
.cinematic-copy h2 { margin: 0; max-width: 700px; font-size: clamp(2rem, 5vw, 4.8rem); line-height: 1.08; word-break: keep-all; }
.cinematic-copy > p:last-child { max-width: 620px; margin: 18px 0 0; color: #d7dcda; font-size: clamp(.95rem, 1.6vw, 1.22rem); line-height: 1.7; word-break: keep-all; }
.cinematic-footer { position: absolute; right: clamp(22px, 5vw, 70px); bottom: max(24px, env(safe-area-inset-bottom)); left: clamp(22px, 5vw, 70px); z-index: 2; display: flex; justify-content: space-between; align-items: center; }
.cinematic-footer button { min-height: 44px; padding: 0; border: 0; background: transparent; color: #dce1df; font-weight: 800; }
.cinematic-dots { display: flex; gap: 8px; }
.cinematic-dots span { width: 28px; height: 3px; background: rgba(255,255,255,.28); }
.cinematic-dots span.active { background: var(--red); }

.lobby-screen { display: grid; grid-template-rows: auto 1fr; background: #0c0f10; }
.lobby-header { display: flex; justify-content: space-between; align-items: center; min-height: 86px; padding: 18px clamp(22px, 4vw, 58px); border-bottom: 1px solid var(--line); }
.lobby-header h2, .section-title h3 { margin: 0; }
.header-actions { display: flex; align-items: center; gap: 12px; color: var(--muted); }
.lobby-body { min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; }
.scenario-section { min-width: 0; display: flex; flex-direction: column; padding: clamp(22px, 3vw, 44px); overflow: hidden; }
.section-title { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.section-title p { margin: 0; color: var(--muted); }
.resume-banner { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin: 0 0 14px; padding: 13px 16px; border: 1px solid rgba(229,173,79,.5); border-radius: 6px; background: rgba(229,173,79,.08); }
.resume-banner strong { display: block; font-size: .92rem; }
.resume-banner span { display: block; margin-top: 3px; color: var(--muted); font-size: .76rem; }
.resume-banner .primary { flex: 0 0 auto; }
.scenario-grid { min-height: 0; flex: 1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.scenario-card { position: relative; min-width: 0; overflow: hidden; display: flex; flex-direction: column; justify-content: end; border: 1px solid var(--line); border-radius: 6px; background-position: center; background-size: cover; }
.scenario-card::before { content: ''; position: absolute; inset: 0; background: linear-gradient(0deg, rgba(4,6,7,.98), rgba(4,6,7,.12) 75%); }
.scenario-content { position: relative; padding: 22px; }
.scenario-content h3 { margin: 0 0 7px; font-size: 1.28rem; }
.scenario-content p { min-height: 42px; margin: 0 0 18px; color: #c1c7c5; font-size: .88rem; line-height: 1.45; }
.scenario-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.scenario-actions button { min-width: 0; min-height: 42px; border: 1px solid rgba(255,255,255,.34); border-radius: 4px; background: rgba(0,0,0,.6); font-weight: 800; }
.scenario-actions button:first-child { background: #ecefed; color: #0a0c0d; }
.resume-actions { display: flex; gap: 8px; flex: 0 0 auto; }
.duo-section { padding: 14px 0; border-top: 1px solid var(--line); }
.duo-section > strong { display: block; font-size: .8rem; }
.duo-create { display: flex; gap: 8px; margin-top: 9px; }
.duo-create .primary { flex: 0 0 auto; }
.help-dot { width: 22px; height: 22px; flex: 0 0 auto; display: inline-grid; place-items: center; margin-left: 9px; padding: 0; border: 1px solid rgba(255,255,255,.42); border-radius: 50%; background: rgba(0,0,0,.45); color: #cfd5d2; font-size: .72rem; font-weight: 800; line-height: 1; vertical-align: 3px; }
.help-dot:hover { border-color: var(--amber); color: var(--amber); }
.title-with-help { display: flex; align-items: center; }
.info-card { width: min(560px, 100%); }
.info-lead { margin: 0 0 4px; color: #c4cac8; font-size: .85rem; line-height: 1.55; word-break: keep-all; }
.info-body { margin-bottom: 16px; }
.info-scene { padding: 12px 0; border-top: 1px solid var(--line); }
.info-scene small { display: block; margin-bottom: 3px; color: var(--muted); font-size: .68rem; letter-spacing: .08em; }
.info-scene strong { display: block; font-size: .88rem; }
.info-scene p { margin: 5px 0 0; color: #c9cfcc; font-size: .82rem; line-height: 1.6; word-break: keep-all; overflow-wrap: break-word; }
.info-prose { margin-top: 10px; padding-top: 4px; border-top: 1px solid var(--line); }
.info-prose p { margin: 0 0 13px; color: #c9cfcc; font-size: .84rem; line-height: 1.75; word-break: keep-all; overflow-wrap: break-word; }
.info-prose p:first-child { margin-top: 8px; }
.duo-check { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: .78rem; color: #c4cac8; cursor: pointer; }
.duo-check input { width: 15px; height: 15px; accent-color: var(--amber); }
.duo-join { display: flex; gap: 8px; margin-top: 9px; }
.duo-join .secondary { flex: 0 0 auto; }
.open-title { display: flex; justify-content: space-between; align-items: center; }
#roomList { max-height: 200px; overflow: auto; display: grid; gap: 7px; margin-top: 9px; }
.exit-actions { display: grid; gap: 10px; margin-top: 4px; }
.room-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; padding: 11px; border: 1px solid var(--line); border-radius: 4px; background: #0c0f10; }
.room-row small { display: block; margin-top: 3px; color: var(--muted); }
.floating-error { position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%); }

.ranking-screen { display: grid; grid-template-rows: auto 1fr; background: #0a0d0e; }
.ranking-header { min-height: 82px; display: flex; align-items: center; gap: 16px; padding: 14px clamp(18px, 4vw, 54px); border-bottom: 1px solid var(--line); }
.ranking-header h2 { margin: 0; }
.profile-nickname { margin: 5px 0 0; color: var(--amber); font-size: .85rem; overflow-wrap: anywhere; }
.history-summary { margin-left: auto; display: flex; gap: 22px; }
.history-stat strong, .history-stat small { display: block; text-align: right; }
.history-stat strong { font-size: 1.05rem; }
.history-stat small { margin-top: 3px; color: var(--muted); font-size: .68rem; }
.ranking-layout { min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 310px; }
.ranking-board { min-width: 0; min-height: 0; display: flex; flex-direction: column; padding: clamp(18px, 3vw, 42px); }
.records-note { margin: 0 0 14px; color: var(--muted); font-size: .78rem; line-height: 1.6; }
.ranking-filters { display: flex; gap: 7px; margin-bottom: 18px; overflow-x: auto; }
.ranking-filter { flex: 0 0 auto; min-height: 40px; padding: 0 14px; border: 1px solid var(--line); border-radius: 4px; background: transparent; font-weight: 800; }
.ranking-filter.active { background: #ecefed; color: #090b0c; }
.ranking-head, .ranking-row { display: grid; grid-template-columns: 58px minmax(100px, 1fr) minmax(130px, 1.2fr) 100px; gap: 12px; align-items: center; }
.ranking-head { padding: 0 14px 10px; color: var(--muted); font-size: .7rem; font-weight: 900; }
.ranking-list { min-height: 0; overflow-y: auto; }
.ranking-row { min-height: 58px; padding: 9px 14px; border-top: 1px solid var(--line); }
.ranking-row.you { border-left: 2px solid var(--amber); background: rgba(229,173,79,.06); }
.ranking-position { font-size: 1.05rem; font-weight: 900; }
.ranking-player strong, .ranking-player small, .ranking-record strong, .ranking-record small { display: block; }
.ranking-player small, .ranking-record small { margin-top: 3px; color: var(--muted); font-size: .7rem; }
.ranking-score { text-align: right; font-size: 1rem; font-weight: 900; font-variant-numeric: tabular-nums; }
.ranking-empty { padding: 60px 14px; color: var(--muted); text-align: center; }
.score-rules { min-height: 0; overflow-y: auto; padding: 32px 24px; border-left: 1px solid var(--line); background: #111516; }
.score-rules h3 { margin: 0 0 20px; }
.score-rule { display: grid; grid-template-columns: 1fr auto; gap: 5px 10px; padding: 12px 0; border-top: 1px solid var(--line); }
.score-rule strong { color: var(--amber); }
.score-rule small { grid-column: 1 / 3; color: var(--muted); line-height: 1.4; }

.waiting-screen { display: grid; place-items: center; padding: 24px; background: linear-gradient(rgba(5,7,8,.72), rgba(5,7,8,.88)), url('/static/assets/control-core.png') center/cover; }
.waiting-panel { width: min(590px, 100%); padding: 34px; border: 1px solid var(--line); border-radius: 6px; background: rgba(10,13,14,.95); }
.waiting-panel h2 { margin: 4px 0 8px; }
.room-code { border: 0; background: transparent; color: var(--amber); font: inherit; font-weight: 900; }
.waiting-roster { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 24px 0; }
.waiting-unit { min-height: 64px; display: grid; place-items: center; padding: 0 10px; border: 1px solid var(--line); border-radius: 4px; background: #111516; font-weight: 800; text-align: center; word-break: keep-all; }
.waiting-unit.me { border-color: rgba(229,173,79,.55); }
.waiting-actions { display: flex; justify-content: space-between; margin-top: 24px; }

.game-screen { --game-header-height: 68px; background: #080a0b; }
.game-backdrop { position: absolute; inset: 0; background-position: center; background-size: cover; filter: saturate(.72); }
.game-backdrop::after { content: ''; position: absolute; inset: 0; background: rgba(4,6,7,.7); }
.game-header { position: relative; height: var(--game-header-height); display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 0 20px; border-bottom: 1px solid var(--line); background: rgba(7,9,10,.93); }
.day-mark span, .day-mark strong { display: block; }
.day-mark span { color: var(--red); font-size: .72rem; font-weight: 900; }
.day-mark strong { margin-top: 2px; }
.phase-label { min-width: 108px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 4px; text-align: center; font-weight: 900; }
.timer { justify-self: end; display: flex; align-items: center; gap: 12px; font-variant-numeric: tabular-nums; font-weight: 900; }
.exit-button { font-size: 1rem; line-height: 1; }
.game-layout { position: relative; height: calc(100% - var(--game-header-height)); min-height: 0; display: grid; grid-template-columns: minmax(230px, 280px) minmax(0, 1fr) minmax(190px, 230px); }
.task-panel, .roster-panel { min-height: 0; overflow-y: auto; padding: 22px 18px; background: rgba(10,13,14,.9); backdrop-filter: blur(10px); }
.task-panel { border-right: 1px solid var(--line); }
.task-panel h2 { margin: 0 0 11px; font-size: 1rem; font-weight: 700; line-height: 1.6; word-break: keep-all; overflow-wrap: break-word; }
.task-panel > p:not(.eyebrow) { color: #c2c8c6; font-size: .88rem; line-height: 1.6; word-break: keep-all; overflow-wrap: break-word; }
.machine-hint { margin-top: 22px; padding: 13px; border-left: 2px solid var(--amber); background: rgba(229,173,79,.08); }
.machine-hint span, .starter-prompt span, .risk-meter span { color: var(--muted); font-size: .72rem; font-weight: 800; }
.machine-hint p { margin: 7px 0 0; font-size: .84rem; line-height: 1.45; }
.starter-prompt { margin-top: 10px; padding: 13px; border: 1px solid rgba(113,185,152,.26); background: rgba(113,185,152,.06); }
.starter-prompt p { margin: 7px 0 0; color: #d5ddd9; font-size: .82rem; line-height: 1.45; }
.task-status { display: grid; grid-template-columns: minmax(0, 1fr); margin-top: 16px; }
.risk-meter { display: flex; justify-content: space-between; align-items: center; min-width: 0; padding: 10px 9px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.risk-meter strong[data-risk="위험"] { color: #ff766e; }
.risk-meter strong[data-risk="주의"] { color: var(--amber); }
.discussion-panel { min-width: 0; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; background: rgba(8,10,11,.72); }
.system-banner { min-height: 38px; display: grid; place-items: center; padding: 8px 16px; border-bottom: 1px solid var(--line); background: rgba(225,78,78,.08); color: #e5e9e7; font-size: .9rem; text-align: center; word-break: keep-all; overflow-wrap: break-word; }
.chat-log { min-width: 0; min-height: 0; overflow-x: hidden; overflow-y: auto; padding: 18px clamp(16px, 3vw, 38px); scrollbar-color: #59605e transparent; }
.message { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 12px; max-width: 900px; margin: 0 auto 12px; }
.message-name { align-self: start; min-width: 0; padding: 2px 0 4px; border: 0; background: transparent; color: #9fa6a4; font-size: .75rem; font-weight: 900; text-align: left; overflow: hidden; text-overflow: ellipsis; }
.message-name:not(:disabled):hover, .message-name:not(:disabled):focus-visible { color: #fff; text-decoration: underline; }
.message.you .message-name { color: var(--amber); }
.message.pending { opacity: .68; }
.message.pending .message-text small { display: block; margin-top: 3px; color: var(--muted); font-size: .65rem; }
.message-text { margin: 0; line-height: 1.55; word-break: keep-all; overflow-wrap: break-word; }
.mention-token { color: var(--amber); font-weight: 800; }
.message.system-message { display: block; padding: 9px 12px; border-left: 2px solid #777f7d; background: rgba(255,255,255,.045); color: #c4cac8; font-size: .82rem; line-height: 1.55; word-break: keep-all; overflow-wrap: break-word; }
.message.system-message.night { border-color: var(--red); color: #fff; }
.message.system-message.story { border-color: rgba(229,173,79,.55); background: rgba(229,173,79,.05); color: #d9d2b4; }
.message.system-message.warning { border-color: var(--amber); background: rgba(229,173,79,.09); color: #efe6c8; }
.action-dock { min-width: 0; min-height: 92px; padding: 12px clamp(14px, 2.5vw, 30px); border-top: 1px solid var(--line); background: rgba(8,10,11,.96); }
.chat-compose { max-width: 900px; height: 66px; display: grid; grid-template-columns: 1fr 92px; gap: 9px; margin: auto; }
.chat-compose textarea { height: 66px; min-height: 66px; }
.action-note { display: grid; place-items: center; min-height: 64px; color: #c4cac8; text-align: center; }
.verdict-result { align-content: center; gap: 3px; }
.verdict-result small { color: var(--muted); font-size: .7rem; }
.ending-modal { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 18px; background: rgba(4,6,7,.78); backdrop-filter: blur(4px); }
.ending-card { width: min(480px, 100%); max-height: 100%; overflow-y: auto; padding: 26px; border: 1px solid rgba(255,255,255,.24); border-radius: 6px; background: rgba(9,12,13,.97); box-shadow: 0 30px 100px #000; }
.ending-card h2 { margin: 0 0 6px; }
.ending-card > p:not(.eyebrow) { margin: 0 0 16px; color: #c4cac8; font-size: .84rem; line-height: 1.55; word-break: keep-all; overflow-wrap: break-word; }
.ending-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.ending-row small { display: block; margin-top: 2px; color: var(--muted); font-size: .7rem; }
.ending-row > span { flex: 0 0 auto; color: var(--amber); font-weight: 900; font-variant-numeric: tabular-nums; }
.ending-total { display: flex; justify-content: space-between; align-items: center; padding: 12px 0 16px; border-top: 1px solid var(--line); font-weight: 900; }
.ending-total strong { color: var(--amber); font-size: 1.3rem; }
.ending-report { margin: 0 0 16px; padding: 12px; border-left: 2px solid var(--red); background: rgba(225,78,78,.06); }
.report-title { margin: 0 0 8px; font-size: .72rem; font-weight: 900; letter-spacing: .12em; color: #e0a9a4; }
.report-death { margin: 0 0 8px; font-weight: 800; word-break: keep-all; }
.report-label { margin: 8px 0 4px; color: var(--muted); font-size: .7rem; font-weight: 800; }
.report-line { margin: 0 0 5px; color: #d5dbd8; font-size: .78rem; line-height: 1.5; word-break: keep-all; overflow-wrap: break-word; }
.report-line small { color: var(--muted); }
.target-grid { max-width: 900px; display: flex; gap: 8px; margin: auto; overflow-x: auto; }
.target-button { flex: 1 0 112px; min-height: 62px; border: 1px solid var(--line); border-radius: 4px; background: #151919; font-weight: 800; }
.target-button:hover { border-color: var(--red); }
.defense-compose { max-width: 900px; display: grid; grid-template-columns: 1fr 110px; gap: 9px; margin: auto; }
.verdict-actions { max-width: 500px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 8px auto 0; }
.verdict-actions button { min-height: 52px; border: 1px solid var(--line); border-radius: 4px; background: #131718; font-weight: 900; }
.verdict-actions .approve { border-color: rgba(225,78,78,.6); }
.decision-block { max-width: 640px; margin: auto; }
.decision-question { margin: 0 0 8px; color: #c4cac8; font-size: .78rem; text-align: center; word-break: keep-all; }
.decision-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.decision-actions button { min-height: 52px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 4px; background: #131718; font-weight: 900; line-height: 1.35; word-break: keep-all; }
.decision-actions button:hover { border-color: var(--amber); }
.decision-actions button.chosen { border-color: var(--amber); background: rgba(229,173,79,.12); color: #fff; }
.roster-panel { border-left: 1px solid var(--line); }
.roster-title { display: flex; justify-content: space-between; padding-bottom: 12px; border-bottom: 1px solid var(--line); font-size: .8rem; font-weight: 900; }
.roster-title small { color: var(--muted); }
.game-roster { display: grid; gap: 7px; margin-top: 12px; }
.unit-row { min-width: 0; display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 9px; align-items: center; min-height: 48px; padding: 7px; border: 1px solid transparent; border-radius: 4px; }
.unit-row.you { border-color: rgba(229,173,79,.5); background: rgba(229,173,79,.06); }
.unit-row.dead { opacity: .44; filter: grayscale(1); }
.unit-orb { width: 30px; height: 30px; display: grid; place-items: center; border: 1px solid #6e7774; border-radius: 50%; color: #abb2b0; font-size: .65rem; }
.roster-mention { min-width: 0; padding: 0; border: 0; background: transparent; text-align: left; }
.roster-mention:not(:disabled):hover strong, .roster-mention:not(:disabled):focus-visible strong { color: #fff; text-decoration: underline; }
.unit-row strong, .unit-row small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.unit-row strong { font-size: .8rem; }
.unit-row small { margin-top: 3px; color: var(--muted); font-size: .67rem; }
.toast { position: fixed; left: 50%; bottom: 18px; z-index: 20; max-width: min(90vw, 460px); padding: 11px 16px; border: 1px solid var(--line); border-radius: 4px; background: #151919; box-shadow: 0 8px 32px #000; opacity: 0; transform: translate(-50%, 16px); pointer-events: none; transition: .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 900px) {
  .auth-screen { grid-template-columns: 1fr; align-content: end; padding: 28px; }
  .brand-lockup { align-self: auto; }
  .brand-lockup h1 { font-size: clamp(2.8rem, 12vw, 5rem); }
  .auth-panel { align-self: auto; max-width: 460px; }
  .lobby-body { grid-template-columns: 1fr; }
  .scenario-grid { grid-template-columns: 1fr; overflow-y: auto; }
  .scenario-card { min-height: 210px; }
  .game-layout { grid-template-columns: 220px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) 74px; }
  .task-panel { grid-row: 1; }
  .discussion-panel { grid-column: 2; grid-row: 1 / 3; }
  .roster-panel { grid-column: 1; grid-row: 2; padding: 9px; border-top: 1px solid var(--line); border-left: 0; }
  .roster-title { display: none; }
  .game-roster { min-width: 440px; grid-template-columns: repeat(8, minmax(48px, 1fr)); gap: 3px; margin: 0; }
  .unit-row { display: block; padding: 3px; text-align: center; }
  .roster-mention { width: 100%; text-align: center; }
  .unit-orb { width: 26px; height: 26px; margin: auto; }
  .unit-row strong { margin-top: 3px; font-size: .6rem; }
  .unit-row small { display: none; }
}

@media (max-width: 640px) {
  .auth-screen { overflow-y: auto; padding: max(20px, env(safe-area-inset-top)) 18px max(20px, env(safe-area-inset-bottom)); background-position: 57% center; }
  .auth-status { top: max(12px, env(safe-area-inset-top)); right: 16px; }
  .brand-lockup { margin-bottom: 12px; }
  .brand-lockup h1 { font-size: clamp(2.55rem, 13vw, 4rem); }
  .brand-lockup > p:last-child { margin-top: 6px; font-size: .9rem; }
  .auth-panel { padding: 18px; }
  .auth-tabs { margin-bottom: 16px; }
  #authForm { gap: 10px; }
  input { height: 42px; }
  .field-action .secondary { height: 42px; }
  .guide-screen { padding: 12px; }
  .guide-dialog { min-height: min(540px, calc(100% - 24px)); max-height: 100%; overflow-y: auto; padding: 22px 18px; }
  .guide-text { font-size: 1.05rem; line-height: 1.55; }
  .lobby-header { min-height: 58px; gap: 5px; padding: 8px 9px; white-space: nowrap; }
  .lobby-header .eyebrow, .header-actions > span { display: none; }
  .lobby-header h2 { font-size: .82rem; }
  .header-actions { min-width: 0; gap: 3px; }
  .header-actions .quiet { min-height: 34px; padding: 0 5px; font-size: .64rem; }
  .lobby-body { display: block; overflow-y: auto; }
  .scenario-section { overflow: visible; padding: 18px 14px; }
  .section-title p { display: none; }
  .scenario-grid { display: grid; overflow: visible; }
  .scenario-card { min-height: 230px; }
  .waiting-screen { place-items: start center; overflow-y: auto; }
  .waiting-panel { margin: auto 0; padding: 24px 18px; }
  .waiting-roster { grid-template-columns: repeat(2, 1fr); }
  .game-screen { --game-header-height: 58px; }
  .game-header { grid-template-columns: minmax(0, 1fr) auto auto; padding: 0 9px; }
  .day-mark strong { max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .78rem; }
  .phase-label { min-width: 78px; padding: 6px; font-size: .76rem; }
  .timer { gap: 6px; font-size: .76rem; }
  .exit-button { width: 32px; height: 32px; font-size: .88rem; }
  .game-layout { display: grid; grid-template-columns: 1fr; grid-template-rows: 142px minmax(0, 1fr) 66px; }
  .task-panel { grid-column: 1; grid-row: 1; padding: 11px 14px; overflow: hidden; border-right: 0; border-bottom: 1px solid var(--line); cursor: pointer; }
  .task-panel .eyebrow, .task-panel > p:not(.eyebrow), .machine-hint, .starter-prompt span, .risk-meter span { display: none; }
  .task-panel h2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin: 0 0 6px; padding-right: 52px; font-size: .84rem; line-height: 1.5; }
  .task-panel::after { content: '▾ 전문'; position: absolute; top: 8px; right: 10px; z-index: 1; padding: 2px 7px; border: 1px solid var(--line); border-radius: 3px; background: rgba(0,0,0,.45); color: var(--muted); font-size: .64rem; font-weight: 800; }
  .task-panel.expanded { position: absolute; top: 0; right: 0; left: 0; z-index: 6; max-height: 74%; overflow-y: auto; background: rgba(8,10,11,.97); }
  .task-panel.expanded h2 { display: block; overflow: visible; }
  .task-panel.expanded::after { content: '▴ 접기'; }
  .task-panel.expanded > p:not(.eyebrow) { display: block; }
  .task-panel.expanded .machine-hint { display: block; margin-top: 10px; padding: 10px; }
  .starter-prompt { margin: 0; padding: 7px 9px; }
  .starter-prompt p { margin: 0; font-size: .72rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .task-status { height: 30px; margin-top: 6px; }
  .risk-meter { justify-content: flex-start; padding: 0 8px; border: 1px solid var(--line); font-size: .7rem; }
  .risk-meter::before { content: '검사 압력'; margin-right: 7px; color: var(--muted); font-size: .64rem; }
  .discussion-panel { grid-column: 1; grid-row: 2; }
  .system-banner { min-height: 34px; padding: 6px 10px; font-size: .76rem; line-height: 1.4; }
  .chat-log { padding: 10px 12px; }
  .message { grid-template-columns: 66px minmax(0,1fr); gap: 7px; margin-bottom: 9px; }
  .message-name { font-size: .66rem; }
  .message-text { font-size: .84rem; }
  .action-dock { min-height: 82px; padding: 8px; }
  .chat-compose { height: 64px; grid-template-columns: 1fr 68px; gap: 6px; }
  .chat-compose textarea { height: 64px; min-height: 64px; font-size: .82rem; }
  .defense-compose { grid-template-columns: 1fr 76px; }
  .decision-question { margin-bottom: 5px; font-size: .68rem; }
  .decision-actions { gap: 6px; }
  .decision-actions button { min-height: 46px; font-size: .8rem; }
  .target-grid { gap: 6px; }
  .target-button { flex-basis: 98px; min-height: 58px; font-size: .76rem; }
  .roster-panel { grid-column: 1; grid-row: 3; padding: 6px 8px; overflow-x: auto; }
  .game-roster { min-width: 440px; }
  .icon-button:not(.exit-button) { width: 44px; height: 44px; }
  .scenario-actions button { min-height: 44px; }

  .cinematic-header { padding: max(16px, env(safe-area-inset-top)) 16px; }
  .cinematic-copy { left: 18px; bottom: 126px; width: calc(100% - 36px); }
  .cinematic-copy h2 { font-size: clamp(1.8rem, 9vw, 2.8rem); }
  .cinematic-copy > p:last-child { margin-top: 12px; font-size: .92rem; line-height: 1.6; }
  .cinematic-footer { right: 18px; bottom: max(18px, env(safe-area-inset-bottom)); left: 18px; }
  .cinematic-dots span { width: 20px; }

  .ranking-header { min-height: 68px; padding: 10px 14px; display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 8px 12px; }
  .ranking-header > .icon-button { grid-column: 1; grid-row: 1 / 3; }
  .ranking-header h2 { font-size: 1.15rem; line-height: 1.4; }
  .ranking-header .eyebrow { font-size: .6rem; letter-spacing: .08em; }
  .history-summary { grid-column: 1 / -1; margin-left: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; padding-top: 8px; }
  .history-stat strong, .history-stat small { text-align: left; }
  .history-stat strong { font-size: .82rem; }
  .history-stat small { font-size: .58rem; }
  .ranking-layout { display: block; overflow-y: auto; }
  .ranking-board { min-height: 420px; padding: 16px 10px; }
  .ranking-head, .ranking-row { grid-template-columns: 28px minmax(65px, .85fr) minmax(90px, 1.25fr) 58px; gap: 6px; }
  .ranking-head { padding-right: 8px; padding-left: 8px; }
  .ranking-row { padding-right: 8px; padding-left: 8px; }
  .ranking-record strong { font-size: .72rem; }
  .ranking-player strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .78rem; }
  .ranking-score { font-size: .86rem; }
  .score-rules { border-top: 1px solid var(--line); border-left: 0; }

  html.keyboard-open .auth-screen { align-content: start; }
  html.keyboard-open .auth-screen .brand-lockup,
  html.keyboard-open .auth-screen .auth-status { display: none; }
  html.keyboard-open .auth-panel { margin: auto 0; }
  html.keyboard-open .game-screen { --game-header-height: 48px; }
  html.keyboard-open .game-layout { grid-template-rows: minmax(0, 1fr); }
  html.keyboard-open .task-panel,
  html.keyboard-open .roster-panel { display: none; }
  html.keyboard-open .discussion-panel { grid-row: 1; }
  html.keyboard-open .system-banner { min-height: 30px; padding: 4px 8px; }
  html.keyboard-open .action-dock { padding-bottom: max(6px, env(safe-area-inset-bottom)); }
}

@media (prefers-reduced-motion: reduce) {
  .cinematic-backdrop, .cinematic-copy, .guide-dialog.dying { animation: none; }
}

@media (max-height: 690px) and (max-width: 640px) {
  .brand-lockup .eyebrow, .brand-lockup > p:last-child { display: none; }
  .auth-panel { padding: 14px 16px; }
  .guide-dialog { min-height: calc(100% - 20px); }
  .game-layout { grid-template-rows: 128px minmax(0, 1fr) 58px; }
  .task-panel { padding: 8px 12px; }
  .action-dock { min-height: 72px; padding: 5px 7px; }
}

@media (orientation: landscape) and (max-height: 500px) {
  .auth-screen { grid-template-columns: minmax(0, 1fr) minmax(300px, 380px); align-content: center; gap: 20px; overflow-y: auto; padding: 12px 18px; }
  .brand-lockup { margin: 0; padding: 0; }
  .brand-lockup .eyebrow, .brand-lockup > p:last-child { display: none; }
  .brand-lockup h1 { font-size: 2.4rem; line-height: 1.05; }
  .auth-panel { padding: 12px 16px; }
  .auth-tabs { margin-bottom: 10px; }
  #authForm { gap: 7px; }
  .auth-status { display: none; }
  .guide-screen, .waiting-screen { overflow-y: auto; place-items: start center; padding: 10px; }
  .guide-dialog, .waiting-panel { min-height: 0; margin: auto 0; }
}
