/* 서리워 — 1인칭 잠입 프로토타입 */
:root {
  --ink: #eceaf5;
  --ink-2: #a9adc8;
  --paper: rgba(20, 24, 44, .92);
  --line: #3a4166;
  --accent: #e8873a;
  --night: #2c3566;
  --ok: #7dbb6f;
  --bad: #ef6b5a;
  --warn: #e8b358;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0b1020; color: var(--ink); font-family: "Noto Sans KR", "Malgun Gothic", system-ui, sans-serif; }
h1, h2, .display { font-family: "Do Hyeon", "Noto Sans KR", sans-serif; font-weight: 400; margin: 0; letter-spacing: .01em; }
h1 { font-size: clamp(2rem, 5vw, 3rem); line-height: 1.1; }
h2 { font-size: 1.6rem; line-height: 1.2; }
p { margin: 0; }
kbd { display: inline-block; min-width: 1.6em; padding: 1px 6px; border-radius: 5px; border: 1px solid var(--line); background: #0b1020; font: 600 .8em "Noto Sans KR", sans-serif; text-align: center; margin-right: 2px; }
button { font: inherit; cursor: pointer; }
[hidden] { display: none !important; }

#gl { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

/* HUD */
.hud { position: fixed; inset: 0; pointer-events: none; }
.crosshair { position: absolute; left: 50%; top: 50%; width: 6px; height: 6px; margin: -3px; border-radius: 50%; background: rgba(255,255,255,.85); box-shadow: 0 0 0 1px rgba(0,0,0,.5); }
.quota { position: absolute; left: 16px; top: 16px; background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: .9rem; display: grid; gap: 4px; min-width: 160px; }
.quota .row { display: flex; align-items: center; gap: 8px; }
.quota .row.done { color: var(--ok); }
.quota .row .n { margin-left: auto; font-variant-numeric: tabular-nums; }
.quota .goal { color: var(--warn); font-weight: 700; margin-top: 4px; }
.meters { position: absolute; right: 16px; top: 16px; display: grid; gap: 6px; width: 170px; }
.meter { display: grid; grid-template-columns: 34px 1fr; align-items: center; gap: 8px; font-size: .78rem; color: var(--ink-2); }
.bar { height: 8px; background: rgba(255,255,255,.12); border-radius: 4px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; border-radius: 4px; transition: width .1s linear; }
.bar.sus i { background: var(--bad); }
.bar.noise i { background: var(--warn); }
.state { justify-self: end; font-size: .78rem; padding: 2px 8px; border-radius: 999px; background: var(--paper); border: 1px solid var(--line); }
.hint { position: absolute; left: 50%; bottom: 18%; transform: translateX(-50%); background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 10px 16px; font-size: .95rem; text-align: center; max-width: min(520px, 90vw); }
.hint small { display: block; color: var(--ink-2); font-size: .8rem; margin-top: 2px; }
.alert { position: absolute; left: 50%; top: 14%; transform: translateX(-50%); font-family: "Do Hyeon", sans-serif; font-size: 1.6rem; color: var(--bad); text-shadow: 0 0 18px rgba(239,107,90,.7); animation: pulse .6s ease-in-out infinite alternate; }
@keyframes pulse { from { opacity: .6; } to { opacity: 1; } }
.hud.seen::after { content: ""; position: absolute; inset: 0; box-shadow: inset 0 0 120px rgba(239,107,90,.35); pointer-events: none; }

/* 오버레이 */
.overlay { position: fixed; inset: 0; z-index: 10; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(6, 8, 18, .72); backdrop-filter: blur(3px); }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 26px; width: min(560px, 100%); max-height: 92vh; overflow: auto; }
.eyebrow { font-size: .78rem; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); font-weight: 700; margin-bottom: 8px; }
.lead { color: var(--ink-2); margin-top: 12px; line-height: 1.65; }
.controls { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; margin: 18px 0; font-size: .88rem; color: var(--ink-2); }
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 12px 18px; border-radius: 10px; border: 1px solid var(--line); background: #0b1020; color: var(--ink); font-weight: 500; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #1a0f05; font-weight: 700; }
.btn:focus-visible { outline: 2px solid var(--warn); outline-offset: 2px; }
.note { margin-top: 10px; color: var(--warn); font-size: .85rem; }
.row-start { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.mode-toggle { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.mode-toggle button { background: #0b1020; color: var(--ink-2); border: 0; padding: 10px 12px; font-size: .84rem; }
.mode-toggle button + button { border-left: 1px solid var(--line); }
.mode-toggle button.on { background: var(--night); color: #fff; }

.panel.card h2 { margin: 4px 0 12px; }
.panel.card ol { margin: 0; padding-left: 22px; display: grid; gap: 6px; line-height: 1.5; }
.panel.card .why { margin: 14px 0 18px; padding: 12px 14px; border-left: 3px solid var(--accent); background: rgba(232,135,58,.08); color: var(--ink-2); font-size: .92rem; line-height: 1.6; }

.panel.result .bag { display: grid; gap: 6px; margin: 16px 0; }
.panel.result .bag .row { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 8px; background: rgba(255,255,255,.05); font-size: .92rem; }
.panel.result .bag .row .v { margin-left: auto; font-variant-numeric: tabular-nums; }
.panel.result .bag .row.bruised { color: var(--ink-2); }
.panel.result .bag .total { display: flex; justify-content: space-between; padding: 8px 12px; font-weight: 700; border-top: 1px solid var(--line); }
.panel.result .learned { display: grid; gap: 6px; margin-bottom: 18px; font-size: .88rem; color: var(--ink-2); }
.panel.result .learned b { color: var(--ink); }

/* 미니게임 */
.mini { position: fixed; left: 50%; bottom: 10%; transform: translateX(-50%); z-index: 5; width: min(440px, 92vw); background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; text-align: center; }
.mini-title { font-family: "Do Hyeon", sans-serif; font-size: 1.3rem; }
.mini-hint { color: var(--ink-2); font-size: .86rem; margin: 4px 0 12px; }
.mini-foot { color: var(--ink-2); font-size: .74rem; margin-top: 10px; }
.gauge { height: 14px; background: rgba(255,255,255,.1); border-radius: 7px; overflow: hidden; position: relative; }
.gauge i { display: block; height: 100%; width: 0; background: var(--ok); border-radius: 7px; }
.gauge i.warn { background: var(--warn); }
.gauge i.bad { background: var(--bad); }
.gauge .zone { position: absolute; top: 0; bottom: 0; background: rgba(125,187,111,.35); border-left: 1px solid var(--ok); border-right: 1px solid var(--ok); }
.gauge .marker { position: absolute; top: -3px; width: 4px; height: 20px; background: #fff; border-radius: 2px; margin-left: -2px; }
.gauge + .gauge { margin-top: 8px; }
.mini .msg { margin-top: 10px; font-size: .9rem; min-height: 1.4em; }
.mini .msg.ok { color: var(--ok); }
.mini .msg.bad { color: var(--bad); }
.mini .phase { display: flex; gap: 6px; justify-content: center; margin-bottom: 8px; font-size: .8rem; color: var(--ink-2); }
.mini .phase span { padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); }
.mini .phase span.on { color: var(--ink); border-color: var(--accent); }
.mini .phase span.done { color: var(--ok); border-color: var(--ok); }
.mini .dots { display: flex; gap: 8px; justify-content: center; margin: 8px 0; }
.mini .dots i { width: 14px; height: 14px; border-radius: 50%; background: rgba(255,255,255,.15); }
.mini .dots i.on { background: var(--ok); }

/* 모바일 터치 조작 */
#touch { position: fixed; inset: 0; z-index: 4; pointer-events: none; touch-action: none; user-select: none; -webkit-user-select: none; }
#touch .stick-zone { position: absolute; left: 0; top: 30%; width: 45%; height: 70%; pointer-events: auto; touch-action: none; }
#touch .look-zone { position: absolute; right: 0; top: 0; width: 55%; height: 100%; pointer-events: auto; touch-action: none; }
#touch .stick { position: absolute; width: 110px; height: 110px; margin: -55px; border-radius: 50%; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.25); pointer-events: none; }
#touch .stick i { position: absolute; left: 50%; top: 50%; width: 48px; height: 48px; margin: -24px; border-radius: 50%; background: rgba(255,255,255,.55); }
#touch .tbtns { position: absolute; right: max(14px, env(safe-area-inset-right, 0px)); bottom: max(16px, env(safe-area-inset-bottom, 0px)); display: grid; grid-template-columns: auto auto; gap: 10px; align-items: end; pointer-events: auto; }
#touch .tbtns button { width: 64px; height: 64px; border-radius: 50%; border: 1px solid rgba(255,255,255,.3); background: rgba(20,24,44,.75); color: #fff; font: 600 .74rem "Noto Sans KR", sans-serif; touch-action: none; }
#touch .tbtns button.on { background: rgba(232,135,58,.85); border-color: var(--accent); color: #1a0f05; }
#touch .tbtns button.big { width: 86px; height: 86px; font-size: 1.5rem; font-family: "Do Hyeon", sans-serif; display: grid; place-items: center; line-height: 1; background: rgba(232,135,58,.9); color: #1a0f05; border-color: var(--accent); }
#touch .tbtns button.big small { font: 600 .62rem "Noto Sans KR", sans-serif; }
html.mobile .crosshair { width: 10px; height: 10px; margin: -5px; }
html.mobile .quota { font-size: .78rem; padding: 8px 10px; min-width: 130px; gap: 2px; }
html.mobile .meters { width: 130px; }
html.mobile .hint { bottom: auto; top: 26%; font-size: .86rem; }
html.mobile .mini { bottom: auto; top: 12%; width: min(360px, 60vw); left: 42%; padding: 12px 14px; }
html.mobile .mini-foot { display: none; }
html.mobile .panel { padding: 18px; }
html.mobile .controls { display: none; }
html.mobile h1 { font-size: 1.7rem; }
@media (max-height: 460px) { html.mobile .panel h1 { font-size: 1.4rem; } html.mobile .panel .lead { font-size: .84rem; margin-top: 6px; } }
