:root { color-scheme: dark; --bg:#14181E; --bg2:#1C2129; --card:#222933; --line:rgba(255,255,255,.12); --text:#F2F4F6; --weak:#B0B8C1; --faint:#8B95A1; --blue:#2579EF; --blue2:#7DB0FF; --green:#22C55E; --red:#EF4444; --paper:#F6EFE3; --ink:#2B2520; --r:16px; }
* { box-sizing:border-box; } html { -webkit-text-size-adjust:100%; }
body { margin:0; background:var(--bg); color:var(--text); font-family:"Pretendard Variable",Pretendard,-apple-system,"Apple SD Gothic Neo","Noto Sans KR",sans-serif; font-size:16px; line-height:1.55; word-break:keep-all; overflow-wrap:anywhere; padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom); }
/* keep-all suits Korean (wrap at spaces) but blocks wrapping in Japanese/Chinese, which have no spaces */
body:lang(ja), body:lang(zh), body:lang(zh-Hant), :lang(ja) *, :lang(zh) *, :lang(zh-Hant) * { word-break:normal; line-break:strict; }
.app { max-width:520px; margin:0 auto; min-height:100vh; display:flex; flex-direction:column; }
h1,h2,h3,p,ul,ol { margin:0; } h1,h2,h3 { line-height:1.25; letter-spacing:-.01em; }
a { color:var(--blue2); }
.hidden { display:none !important; } .muted { color:var(--weak); font-size:14px; } .src { color:var(--faint); font-size:12px; margin-top:8px; } .date { color:var(--blue2); font-weight:700; font-size:14px; }
.big { font-size:28px; font-weight:800; text-align:center; letter-spacing:-.02em; margin:12px 0; }

/* top bar */
.top { display:flex; align-items:center; justify-content:space-between; padding:14px 20px; border-bottom:1px solid var(--line); position:sticky; top:0; background:rgba(20,24,30,.9); backdrop-filter:blur(8px); z-index:5; }
.top .t { font-size:13px; color:var(--weak); } .top .t b { color:var(--text); }
.top .stat { font-size:12px; color:var(--faint); display:flex; gap:10px; }
.content { padding:20px; flex:1; display:flex; flex-direction:column; gap:16px; }
.bottom { padding:12px 20px calc(64px + env(safe-area-inset-bottom)); /* 64px: Netlify 무료 플랜 'Powered by Netlify' 배지(우하단 고정)가 버튼을 가리지 않게 */ display:grid; gap:10px; position:sticky; bottom:0; background:linear-gradient(180deg, rgba(20,24,30,0), var(--bg) 30%); }

/* cards */
.card { background:var(--card); border:1px solid var(--line); border-radius:var(--r); padding:18px; }
.card h2 { font-size:20px; } .card h3 { font-size:16px; } .card p + p { margin-top:10px; } .card ol, .card ul { padding-left:20px; margin-top:8px; display:grid; gap:6px; }
.diary { background:var(--paper); color:var(--ink); border-radius:var(--r); padding:20px 18px; position:relative; font-size:17px; line-height:1.7; box-shadow:inset 0 0 0 1px rgba(0,0,0,.06); }
.diary::before { content:""; position:absolute; left:40px; top:0; bottom:0; width:1px; background:rgba(214,69,69,.35); }
.diary .d { font-size:13px; color:#8A6D3B; font-weight:700; margin-bottom:8px; letter-spacing:.04em; }
.diary .q { white-space:pre-wrap; }
.hero { background:var(--bg2); border-radius:var(--r); padding:28px 20px; text-align:center; border:1px solid var(--line); }
.hero .k { font-size:13px; color:var(--blue2); font-weight:700; letter-spacing:.06em; } .hero h1 { font-size:34px; margin-top:8px; letter-spacing:-.03em; } .hero p { color:var(--weak); margin-top:10px; }
.steps { display:flex; gap:6px; } .steps i { flex:1; height:4px; border-radius:2px; background:var(--line); } .steps i.on { background:var(--blue); } .steps i.done { background:var(--green); }
.stars { color:#E0B23A; letter-spacing:2px; font-size:14px; }

/* buttons & inputs */
.btn { display:flex; align-items:center; justify-content:center; gap:8px; min-height:52px; padding:0 20px; border-radius:14px; font:inherit; font-weight:700; font-size:16px; border:1px solid transparent; cursor:pointer; width:100%; text-decoration:none; color:var(--text); background:var(--card); border-color:var(--line); }
.btn.primary { background:var(--blue); color:#fff; } .btn.ghost { background:transparent; } .btn.small { min-height:40px; font-size:14px; width:auto; padding:0 14px; } .btn:disabled { opacity:.5; cursor:default; }
.row { display:flex; gap:10px; flex-wrap:wrap; } .row .btn { flex:1; }
.input { width:100%; min-height:52px; padding:0 16px; border-radius:14px; border:1px solid var(--line); background:var(--bg2); color:var(--text); font:inherit; font-size:18px; }
.input:focus { outline:2px solid var(--blue); border-color:transparent; }
.choices { display:grid; gap:10px; } .choices .btn { justify-content:flex-start; text-align:left; }
.choices .btn.ok { border-color:var(--green); } .choices .btn.no { border-color:var(--red); }
.hint { background:rgba(37,121,239,.12); border:1px solid rgba(125,176,255,.3); border-radius:12px; padding:12px 14px; font-size:14px; } .hint b { color:var(--blue2); }
.aid { display:grid; grid-template-columns:repeat(5,1fr); gap:6px; } .aid span { background:var(--bg2); border:1px solid var(--line); border-radius:10px; padding:8px 4px; text-align:center; font-size:13px; } .aid span b { display:block; font-size:18px; }
.colors { display:grid; grid-template-columns:repeat(5,1fr); gap:6px; } .colors span { border-radius:10px; padding:10px 4px; text-align:center; font-size:12px; font-weight:700; border:1px solid var(--line); }
.feedback { font-weight:700; } .feedback.ok { color:var(--green); } .feedback.no { color:var(--red); }

/* compass */
.compass { width:220px; height:220px; margin:8px auto; border-radius:50%; border:2px solid var(--line); position:relative; background:radial-gradient(circle at 50% 50%, var(--bg2), var(--bg)); }
.compass .needle { position:absolute; left:50%; top:50%; width:6px; height:96px; margin:-96px 0 0 -3px; border-radius:3px; background:var(--red); transform-origin:50% 100%; transition:transform .15s, background .2s; }
.compass.on .needle { background:var(--green); } .compass .target { position:absolute; left:50%; top:8px; width:14px; height:14px; margin-left:-7px; border-radius:50%; background:var(--blue); transform-origin:50% 102px; }
.compass .deg { position:absolute; inset:auto 0 14px; text-align:center; font-size:14px; color:var(--weak); }

/* grid, threads, result */
.grid { display:grid; grid-template-columns:repeat(5,1fr); gap:6px; } .grid span { aspect-ratio:1; display:grid; place-items:center; background:var(--paper); color:var(--ink); border-radius:8px; font-weight:800; font-size:18px; }
.threads { display:flex; gap:8px; justify-content:center; } .threads i { width:14px; height:60px; border-radius:7px; border:1px solid var(--line); }
.blank { display:grid; grid-template-columns:28px 1fr; gap:10px; align-items:center; } .blank i { width:20px; height:20px; border-radius:50%; border:1px solid var(--line); }
.badge { width:120px; height:120px; margin:0 auto; border-radius:50%; display:grid; place-items:center; background:var(--blue); color:#fff; font-size:22px; font-weight:800; box-shadow:0 20px 50px rgba(37,121,239,.35); }
.kv { display:grid; grid-template-columns:1fr 1fr; gap:10px; } .kv div { background:var(--bg2); border-radius:12px; padding:12px; } .kv b { display:block; font-size:22px; } .kv span { font-size:12px; color:var(--weak); }
table.facts { width:100%; border-collapse:collapse; font-size:13px; } table.facts th, table.facts td { border-top:1px solid var(--line); padding:8px 6px; text-align:left; vertical-align:top; } table.facts th { color:var(--weak); font-weight:600; }
.devbar { position:fixed; left:8px; right:auto; bottom:10px; max-width:52%; flex-wrap:wrap; z-index:9; display:flex; gap:6px; } .devbar button { font-size:11px; padding:6px 8px; border-radius:8px; border:1px solid var(--line); background:#000; color:#9f9; }
.toast { position:fixed; left:50%; bottom:90px; transform:translateX(-50%); background:#333D4B; color:#fff; padding:12px 16px; border-radius:12px; font-size:14px; z-index:40; max-width:calc(100% - 32px); }
@keyframes pop { from { transform:scale(.9); opacity:0; } to { transform:none; opacity:1; } } .card, .diary, .hero { animation:pop .25s ease both; }
@media (prefers-reduced-motion: reduce) { .card, .diary, .hero { animation:none; } .compass .needle { transition:none; } }

/* ---------- 사진 카드 / 증거판 (v0.2.1) ---------- */
.fig { position:relative; border-radius:var(--r); overflow:hidden; background:#000; border:1px solid var(--line); }
.fig img { display:block; width:100%; height:auto; aspect-ratio:16/10; object-fit:cover; filter:saturate(.9) contrast(1.05); }
.fig.bw img { filter:grayscale(1) contrast(1.1) sepia(.12); }
.fig .cap { position:absolute; left:0; right:0; bottom:0; padding:28px 14px 10px; background:linear-gradient(180deg, rgba(0,0,0,0), rgba(0,0,0,.78)); font-size:13px; color:#fff; line-height:1.4; }
.fig .cap small { display:block; color:rgba(255,255,255,.65); font-size:11px; margin-top:2px; }
.fig .tag { position:absolute; left:12px; top:12px; background:rgba(0,0,0,.6); border:1px solid rgba(255,255,255,.25); color:#fff; font-size:11px; font-weight:700; padding:3px 8px; border-radius:999px; letter-spacing:.04em; }
.fig.tall img { aspect-ratio:4/3; }
.hero.photo { padding:0; overflow:hidden; text-align:left; } .hero.photo .fig { border:0; border-radius:0; } .hero.photo .fig img { aspect-ratio:4/5; }
.hero.photo .over { position:absolute; left:0; right:0; bottom:0; padding:60px 20px 22px; background:linear-gradient(180deg, rgba(20,24,30,0), rgba(20,24,30,.92) 55%); }
.hero.photo .over h1 { font-size:34px; letter-spacing:-.03em; } .hero.photo .over p { color:var(--weak); margin-top:8px; font-size:15px; }
.stamp { position:absolute; right:14px; top:14px; transform:rotate(-8deg); border:2px solid rgba(214,69,69,.85); color:rgba(214,69,69,.95); font-weight:900; font-size:12px; padding:4px 8px; border-radius:4px; letter-spacing:.08em; background:rgba(0,0,0,.25); }
/* 용의자 보드(미션2 논리) */
.board { display:grid; grid-template-columns:1.4fr repeat(3,1fr); gap:4px; font-size:12px; }
.board div { background:var(--bg2); border:1px solid var(--line); border-radius:8px; padding:8px 6px; text-align:center; min-height:40px; display:grid; place-items:center; }
.board .h { font-weight:700; color:var(--weak); } .board .c { text-align:left; color:var(--text); font-size:12px; }
.board button { font:inherit; background:var(--bg2); border:1px solid var(--line); border-radius:8px; color:var(--text); min-height:40px; cursor:pointer; }
.board button.x { background:rgba(239,68,68,.18); border-color:var(--red); color:#fecaca; } .board button.o { background:rgba(34,197,94,.18); border-color:var(--green); color:#bbf7d0; }
/* 계단 도식(미션2 공식) */
.stairs { display:flex; align-items:flex-end; gap:3px; height:84px; padding:8px 4px 0; }
.stairs i { flex:1; background:linear-gradient(180deg, #3a4452, #2a313b); border-radius:3px 3px 0 0; position:relative; }
.stairs i.mark::after { content:""; position:absolute; left:50%; top:-10px; width:8px; height:8px; margin-left:-4px; border-radius:50%; background:var(--blue2); }
.stairs i.rest::after { background:#E0B23A; }
.legend { display:flex; gap:14px; font-size:12px; color:var(--weak); margin-top:6px; } .legend i { display:inline-block; width:8px; height:8px; border-radius:50%; margin-right:4px; vertical-align:middle; }
/* 격자 하이라이트 */
.grid span.hl { background:var(--blue); color:#fff; }

/* ---------- 언어 선택 (v0.3) ---------- */
.langpick { position:fixed; inset:0; z-index:50; background:radial-gradient(80% 60% at 50% 0%, #2a3140, var(--bg) 70%); display:grid; place-items:center; padding:24px; }
.lp-box { width:100%; max-width:420px; text-align:center; }
.lp-k { font-size:12px; letter-spacing:.18em; color:var(--blue2); font-weight:700; }
.lp-box h1 { font-size:30px; margin-top:10px; letter-spacing:-.02em; } .lp-box h1 small { display:block; font-size:15px; color:var(--weak); font-weight:600; margin-top:4px; }
.lp-box p { color:var(--faint); font-size:13px; margin-top:12px; }
.lp-grid { display:grid; grid-template-columns:1fr 1fr; gap:12px; margin-top:22px; }
.lp-grid button { font:inherit; background:var(--card); border:1px solid var(--line); border-radius:16px; color:var(--text); padding:18px 10px; cursor:pointer; display:grid; gap:8px; place-items:center; }
.lp-grid button:active { background:var(--bg2); } .lp-grid .flag { font-size:40px; line-height:1; } .lp-grid b { font-size:16px; }
.top .lang { font-size:14px; background:transparent; border:1px solid var(--line); border-radius:999px; color:var(--weak); padding:3px 9px; cursor:pointer; font-family:inherit; }

/* ---- v0.4 시간 사진기(frame) ---- */
.frame { position:relative; width:100%; aspect-ratio:3/4; background:#000; border-radius:var(--r); overflow:hidden; border:1px solid var(--line); }
.frame.wide { aspect-ratio:4/3; }
.frame video, .frame img.shot, .frame img.ghost { position:absolute; inset:0; width:100%; height:100%; object-fit:cover; }
.frame img.ghost { opacity:.62; pointer-events:none; transition:opacity .3s; } .frame.faint img.ghost { opacity:.3; } .frame.shot-on img.ghost { opacity:0; }
.frame .marks i { position:absolute; width:22px; height:22px; border:3px solid rgba(255,255,255,.85); }
.frame .marks i:nth-child(1) { left:10px; top:10px; border-right:0; border-bottom:0; } .frame .marks i:nth-child(2) { right:10px; top:10px; border-left:0; border-bottom:0; }
.frame .marks i:nth-child(3) { left:10px; bottom:10px; border-right:0; border-top:0; } .frame .marks i:nth-child(4) { right:10px; bottom:10px; border-left:0; border-top:0; }
.frame .msg { position:absolute; left:0; right:0; bottom:0; padding:28px 12px 10px; text-align:center; font-size:13px; color:#fff; background:linear-gradient(180deg, rgba(0,0,0,0), rgba(0,0,0,.65)); pointer-events:none; }
.frame .idle { position:absolute; inset:0; display:grid; place-items:center; color:var(--weak); font-size:14px; text-align:center; padding:20px; }
.frame img.shot { transition:filter 2.4s ease; }
.frame.sepia img.shot { filter:sepia(.85) contrast(1.15) brightness(.82) saturate(.75); }
.frame.mono img.shot { filter:grayscale(1) contrast(1.22) brightness(.86); }
.frame.burn img.shot { filter:sepia(1) contrast(1.5) brightness(.42) saturate(1.7) hue-rotate(-18deg); }
.frame.reborn img.shot { filter:none; transition:filter 1.6s ease; }
.frame .veil { position:absolute; inset:0; opacity:0; transition:opacity 2.4s ease; pointer-events:none; background:radial-gradient(ellipse at 50% 50%, rgba(0,0,0,0) 40%, rgba(0,0,0,.72) 100%), url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.5 0 0 0 0 0.45 0 0 0 0 0.4 0 0 0 .35 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>"); mix-blend-mode:multiply; }
.frame.sepia .veil, .frame.mono .veil, .frame.burn .veil { opacity:1; } .frame.reborn .veil { opacity:0; transition:opacity 1.2s; }
.frame .era { position:absolute; right:14px; bottom:14px; font-size:30px; font-weight:900; color:#fff; opacity:0; transform:translateY(8px); transition:opacity .8s ease 1.3s, transform .8s ease 1.3s; text-shadow:0 2px 14px rgba(0,0,0,.7); letter-spacing:.04em; font-variant-numeric:tabular-nums; }
.frame .era small { display:block; font-size:11px; font-weight:700; letter-spacing:.12em; opacity:.8; text-align:right; }
.frame.sepia .era, .frame.mono .era, .frame.burn .era, .frame.reborn .era { opacity:1; transform:none; }
.frame.reborn .era { transition-delay:.2s; }
.frame.flash::after { content:""; position:absolute; inset:0; background:#fff; animation:flash .5s ease-out both; }
@keyframes flash { from { opacity:1; } to { opacity:0; } }
.where { display:flex; gap:10px; align-items:flex-start; margin-top:10px; font-size:13px; color:var(--weak); } .where b { color:var(--blue2); flex:none; }
.film { display:grid; grid-template-columns:repeat(5,1fr); gap:6px; } .film figure { position:relative; border-radius:8px; overflow:hidden; background:var(--bg2); aspect-ratio:3/4; }
.film img { display:block; width:100%; height:100%; object-fit:cover; } .film span { position:absolute; left:4px; bottom:4px; font-size:10px; font-weight:800; color:#fff; background:rgba(0,0,0,.55); padding:1px 5px; border-radius:4px; }
.film .empty { display:grid; place-items:center; color:var(--faint); font-size:11px; height:100%; }
.film.big { grid-template-columns:1fr; } .film.big figure { aspect-ratio:auto; }
@media (prefers-reduced-motion: reduce) { .frame img.shot, .frame .veil, .frame .era { transition:none; } }
