:root {
  --bg: #e9e1d2;
  --paper: #fbf7ef;
  --manila: #e6cf9c;
  --manila-dark: #c9ad6f;
  --ink: #252220;
  --muted: #6d655b;
  --red: #c4302b;
  --blue: #1f5fa8;
  --green: #2f7d4a;
  --line: #d9cfbd;
  --shadow: 0 1px 0 rgba(0,0,0,.04), 0 8px 24px rgba(60,40,10,.12);
  --title: 'Black Han Sans', 'Gowun Dodum', sans-serif;
  --body: 'Gowun Dodum', system-ui, -apple-system, 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  --hand: 'Nanum Pen Script', cursive;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg) radial-gradient(circle at 20% 0%, #f3ecdf 0, transparent 60%);
  color: var(--ink);
  font-family: var(--body);
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2, h3 { margin: 0; font-weight: 400; }
.screen { max-width: 1180px; margin: 0 auto; padding: 56px 16px 48px; }
.screen[hidden] { display: none; }
.home-link { position: absolute; top: 14px; left: 16px; color: var(--muted); text-decoration: none; font-size: 14px; z-index: 5; }
.home-link:hover { color: var(--ink); }

.btn { border: 2px solid var(--ink); border-radius: 10px; padding: 12px 20px; background: var(--paper); font-weight: 700; transition: transform .1s, box-shadow .1s; box-shadow: 3px 3px 0 var(--ink); }
.btn:hover { transform: translate(-1px,-1px); box-shadow: 4px 4px 0 var(--ink); }
.btn:active { transform: translate(2px,2px); box-shadow: 1px 1px 0 var(--ink); }
.btn.primary { background: var(--red); color: #fff; border-color: var(--ink); }
.btn.ghost { background: var(--paper); }
.btn:focus-visible, .stmt:focus-visible, .opt:focus-visible, .tab:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.linkish { background: none; border: 0; color: var(--muted); text-decoration: underline; margin-top: 16px; }
.eyebrow { margin: 0 0 6px; color: var(--muted); font-size: 14px; letter-spacing: .04em; }
.section-title { font-family: var(--title); font-size: 20px; margin: 24px 0 10px; }

/* ---------- 인트로 ---------- */
.folder { position: relative; background: var(--manila); border-radius: 4px 14px 14px 14px; padding: 40px 36px; box-shadow: var(--shadow); margin-top: 24px; }
.folder-tab { position: absolute; top: -30px; left: 0; background: var(--manila); padding: 6px 22px 4px; border-radius: 10px 10px 0 0; font-family: var(--title); color: var(--red); letter-spacing: .1em; }
.intro-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 32px; align-items: center; }
.intro h1 { font-family: var(--title); font-size: clamp(56px, 10vw, 104px); line-height: .95; letter-spacing: -.01em; }
.lead { font-size: 20px; margin: 18px 0 20px; }
.howto { padding-left: 0; list-style: none; counter-reset: s; margin: 0 0 28px; display: grid; gap: 10px; }
.howto li { counter-increment: s; background: rgba(255,255,255,.45); border-radius: 10px; padding: 10px 14px 10px 48px; position: relative; }
.howto li::before { content: counter(s); position: absolute; left: 12px; top: 10px; width: 26px; height: 26px; border-radius: 50%; background: var(--ink); color: var(--manila); display: grid; place-items: center; font-weight: 700; font-size: 14px; }
.howto b { display: block; }
.stats { color: #5a4a26; font-size: 14px; margin-top: 16px; }
.intro-face { background: var(--paper); padding: 16px; transform: rotate(2deg); box-shadow: var(--shadow); position: relative; }
.intro-face::after { content: '수배'; position: absolute; top: 10px; right: 12px; font-family: var(--title); color: var(--red); border: 3px solid var(--red); padding: 2px 10px; transform: rotate(8deg); font-size: 22px; opacity: .85; }
.intro-face svg { width: 100%; display: block; }

/* ---------- 수사 화면 ---------- */
.case-head { display: flex; gap: 16px; align-items: center; background: var(--paper); border: 1px solid var(--line); border-left: 6px solid var(--red); padding: 16px 20px; border-radius: 6px; box-shadow: var(--shadow); }
.case-icon { font-size: 42px; }
.case-no { margin: 0; color: var(--red); font-size: 13px; font-weight: 700; letter-spacing: .06em; }
.case-head h2 { font-family: var(--title); font-size: clamp(20px, 3vw, 28px); line-height: 1.25; }
.case-place { margin: 4px 0 0; color: var(--muted); font-size: 14px; }

.board { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 24px; margin-top: 20px; align-items: start; }
.desk { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; position: sticky; top: 12px; }
.paper { background: var(--paper); border: 1px solid var(--line); border-radius: 4px; box-shadow: var(--shadow); padding: 18px; position: relative;
  background-image: linear-gradient(rgba(0,0,0,.03) 1px, transparent 1px); background-size: 100% 26px; }
.paper-label { position: absolute; top: 10px; left: 14px; font-family: var(--hand); font-size: 26px; color: var(--muted); }
.montage { max-width: 340px; margin: 0 auto; }
.montage svg { width: 100%; display: block; }

.picker { background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 12px; box-shadow: var(--shadow); }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; padding-bottom: 8px; }
.tab { flex: 0 0 auto; border: 1.5px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 12px; font-size: 14px; }
.tab.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.options { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; margin-top: 6px; }
.opt { border: 2px solid var(--line); background: #fff; border-radius: 10px; padding: 6px 4px 6px; display: grid; gap: 4px; justify-items: center; font-size: 13px; transition: border-color .1s; }
.opt svg { width: 100%; height: 72px; display: block; }
.opt:hover { border-color: #b9ab92; }
.opt.on { border-color: var(--red); background: #fff6f4; box-shadow: inset 0 0 0 1px var(--red); }
.actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 14px; flex-wrap: wrap; }

.testimony .hint { font-size: 13px; color: var(--muted); margin: 0 0 12px; }
.chip { display: inline-block; padding: 0 8px; border-radius: 6px; font-size: 12px; }
.chip.trust { background: #dcefe2; color: var(--green); }
.chip.doubt { background: #f6dcda; color: var(--red); text-decoration: line-through; }
.witness { background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 16px; margin-bottom: 14px; box-shadow: var(--shadow); }
.witness header { display: flex; gap: 12px; align-items: center; }
.avatar { font-size: 30px; width: 52px; height: 52px; display: grid; place-items: center; background: var(--manila); border-radius: 50%; flex: 0 0 auto; }
.witness h3 { font-size: 18px; font-weight: 700; }
.witness h3 small { font-weight: 400; color: var(--muted); font-size: 14px; }
.job { margin: 0; color: var(--muted); font-size: 14px; }
.bio { font-size: 14px; background: #f3ecdd; border-radius: 6px; padding: 8px 10px; margin: 12px 0 8px; }
.open { font-family: var(--hand); font-size: 24px; margin: 0 0 6px; line-height: 1.2; }
.statements { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.stmt { width: 100%; text-align: left; display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; border: 1.5px solid var(--line); background: #fff; border-radius: 8px; padding: 8px 10px; }
.stmt .tag { font-size: 12px; background: #eee6d6; border-radius: 4px; padding: 1px 6px; color: var(--muted); white-space: nowrap; }
.stmt .txt { font-size: 15px; }
.stmt .mk { font-size: 16px; width: 20px; text-align: center; }
.stmt.trust { border-color: var(--green); background: #f0f8f2; }
.stmt.trust .mk::after { content: '✔'; color: var(--green); }
.stmt.doubt { border-color: var(--red); background: #fdf1f0; }
.stmt.doubt .txt { text-decoration: line-through; text-decoration-color: var(--red); text-decoration-thickness: 2px; color: var(--muted); }
.stmt.doubt .mk::after { content: '?'; color: var(--red); font-weight: 700; }

/* ---------- 라인업 ---------- */
.lineup-screen { text-align: center; }
.lineup-top { display: flex; align-items: center; justify-content: center; gap: 16px; margin-bottom: 18px; }
.lineup-mini { width: 76px; background: var(--paper); padding: 4px; box-shadow: var(--shadow); transform: rotate(-3deg); }
.lineup-mini svg { width: 100%; display: block; }
.lineup-status { font-family: var(--title); font-size: clamp(20px, 3.4vw, 30px); margin: 0; min-height: 1.3em; }
.wall { background: #3a3d42; border-radius: 10px; padding: 24px 16px 18px; position: relative; overflow: hidden;
  background-image: repeating-linear-gradient(to bottom, transparent 0 39px, rgba(255,255,255,.16) 39px 41px); }
.lineup { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.suspect { position: relative; background: rgba(255,255,255,.88); border-radius: 6px; padding: 8px 4px 34px; transition: transform .15s, box-shadow .15s, opacity .3s; }
.suspect svg { width: 100%; display: block; }
.placard { position: absolute; bottom: 6px; left: 50%; transform: translateX(-50%); background: #111; color: #fff; font-family: var(--title); padding: 0 14px; border-radius: 3px; font-size: 18px; }
.suspect.scan { box-shadow: 0 0 0 4px #ffd23f; transform: translateY(-4px); }
.suspect.picked { box-shadow: 0 0 0 5px var(--red); transform: translateY(-6px) scale(1.03); }
.suspect.picked::before { content: '체포'; position: absolute; top: 8px; left: 50%; transform: translateX(-50%) rotate(-10deg); z-index: 2; color: var(--red); border: 3px solid var(--red); font-family: var(--title); padding: 0 8px; background: rgba(255,255,255,.85); }
.suspect.real::after { content: '진범'; position: absolute; bottom: 36px; left: 50%; transform: translateX(-50%) rotate(6deg); z-index: 2; color: #fff; background: var(--green); font-family: var(--title); padding: 0 10px; border-radius: 4px; }
#lineup-next { margin-top: 22px; }

/* ---------- 결과 ---------- */
.report { max-width: 760px; margin: 0 auto; background: var(--paper); border: 1px solid var(--line); border-radius: 6px; padding: 32px 28px; position: relative; box-shadow: var(--shadow); }
.stamp { position: absolute; top: 22px; right: 22px; font-family: var(--title); font-size: 28px; padding: 4px 14px; border: 4px solid; border-radius: 6px; transform: rotate(9deg); opacity: .9; }
.stamp.ok { color: var(--green); }
.stamp.fail { color: var(--red); }
.score-row { display: flex; gap: 20px; align-items: center; margin: 6px 0 20px; flex-wrap: wrap; }
.score { font-family: var(--title); font-size: 72px; line-height: 1; }
.rank-title { font-family: var(--title); font-size: 26px; margin: 0; }
.rank-note { margin: 2px 0 0; color: var(--muted); }
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.compare figure { margin: 0; background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 10px; text-align: center; }
.compare svg { width: 100%; max-width: 240px; display: block; margin: 0 auto; }
.compare figcaption { font-family: var(--hand); font-size: 26px; }
.breakdown { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.breakdown li { display: grid; grid-template-columns: 56px 1fr auto; gap: 8px; padding: 6px 10px; border-radius: 6px; font-size: 14px; }
.breakdown li span:first-child { color: var(--muted); }
.breakdown li.ok { background: #eef7f0; }
.breakdown li.ok span:last-child { color: var(--green); }
.breakdown li.no { background: #fcefee; }
.breakdown li.no span:last-child { color: var(--red); }
.lies { padding-left: 18px; margin: 0; display: grid; gap: 6px; font-size: 15px; }
.lies em { color: var(--red); font-style: normal; font-size: 14px; }

/* ---------- 반응형 ---------- */
@media (max-width: 900px) {
  .board { grid-template-columns: minmax(0, 1fr); }
  .paper, .picker, .testimony { min-width: 0; }
  .desk { position: static; }
  .intro-grid { grid-template-columns: 1fr; }
  .intro-face { max-width: 280px; margin: 0 auto; order: -1; }
}
@media (max-width: 640px) {
  .screen { padding-top: 44px; }
  .folder { padding: 28px 18px; }
  .desk { display: contents; }
  .paper { position: sticky; top: 0; z-index: 4; padding: 8px; }
  .montage { max-width: 170px; }
  .paper-label { font-size: 20px; }
  .options { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .opt svg { height: 60px; }
  .lineup { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
  .wall { padding: 14px 6px; }
  .placard { font-size: 14px; padding: 0 8px; }
  .suspect { padding-bottom: 28px; }
  .suspect.picked::before, .suspect.real::after { font-size: 12px; }
  .report { padding: 24px 16px; }
  .stamp { font-size: 20px; top: 14px; right: 14px; }
  .score { font-size: 56px; }
  .breakdown { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
