:root {
  --bg: #0c0f1d; --ink: #efe8d8; --muted: #a39c8d; --card: #171b2e; --line: #2a3050;
  --fire: #ffb347; --good: #6fcf8e; --bad: #ef6b5b; --fig: clamp(44px, 10vw, 74px);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; }
button { font: inherit; color: inherit; cursor: pointer; }
.top { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: rgba(12,15,29,.92); backdrop-filter: blur(6px); z-index: 20; }
.brand { font-weight: 700; letter-spacing: .04em; color: var(--fire); font-size: 18px; }
.brand span { color: var(--muted); font-weight: 400; font-size: 13px; margin-left: 4px; }
.tools { display: flex; gap: 8px; align-items: center; }
#timer { font-variant-numeric: tabular-nums; color: var(--muted); min-width: 40px; text-align: right; }
.ghost { background: none; border: 1px solid var(--line); border-radius: 8px; padding: 5px 10px; }
.ghost:hover { border-color: var(--fire); }

.layout { max-width: 1180px; margin: 0 auto; padding: 12px 16px 40px; display: grid; gap: 16px; }
@media (min-width: 900px) { .layout { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; } .panel { position: sticky; top: 64px; } }
.intro { margin: 0 0 10px; color: var(--muted); font-size: 13px; }
@media (min-width: 600px) { .intro { font-size: 14px; } }
#bg { position: absolute; inset: 0; }
.intro b { color: var(--ink); }

.scene { position: relative; width: 100%; aspect-ratio: 1 / 1; max-height: 640px; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); background: #10162a; }
@media (min-width: 600px) { .scene { aspect-ratio: 16 / 11; } }
.scene-bg { position: absolute; inset: 0; width: 100%; height: 100%; }
.scene .glow { animation: glow 2.2s ease-in-out infinite alternate; transform-origin: 300px 300px; }
.flame { transform-origin: 0 -4px; animation: flick .35s ease-in-out infinite alternate; }
.f2 { animation-duration: .27s; }
@keyframes glow { from { opacity: .75; transform: scale(.97); } to { opacity: 1; transform: scale(1.03); } }
@keyframes flick { from { transform: scaleY(.9) skewX(-3deg); } to { transform: scaleY(1.08) skewX(3deg); } }
.place { position: absolute; top: 8px; transform: translateX(-50%); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: #cfc6ae; opacity: .8; text-shadow: 0 1px 3px #000; pointer-events: none; }
.rowtag { position: absolute; left: 3px; transform: translateY(-50%); font-size: 9px; letter-spacing: .1em; text-transform: uppercase; color: #cfc6ae; opacity: .45; pointer-events: none; writing-mode: vertical-rl; rotate: 180deg; }

.cam { position: absolute; transform: translate(-50%, -100%); background: none; border: 0; padding: 0; display: flex; flex-direction: column; align-items: center; width: calc(var(--fig) * 1.35); -webkit-tap-highlight-color: transparent; }
.cam .fig { width: var(--fig); height: calc(var(--fig) * 1.4); display: block; transition: transform .15s; filter: drop-shadow(0 0 0 transparent); animation: bob 3.2s ease-in-out infinite; }
.cam:nth-child(3n) .fig { animation-delay: -1.1s; } .cam:nth-child(3n+1) .fig { animation-delay: -2.3s; }
@keyframes bob { 50% { transform: translateY(-2px); } }
.cam.r0 { scale: .84; } .cam.r1 { scale: .92; }
.cam:hover .fig { transform: translateY(-3px); }
.plate { display: flex; flex-direction: column; align-items: center; line-height: 1.1; margin-top: -2px; padding: 2px 7px 3px; border-radius: 7px; background: rgba(10,12,24,.78); border: 1px solid rgba(255,255,255,.08); }
.plate b { font-size: 13px; } .plate i { font-style: normal; font-size: 10px; color: var(--muted); }
.plate em { font-style: normal; color: var(--bad); font-size: 10px; }
.cam.sel .plate { border-color: var(--fire); box-shadow: 0 0 0 2px rgba(255,179,71,.35); }
.cam.hl .fig { filter: drop-shadow(0 0 6px #ffd166) drop-shadow(0 0 2px #ffd166); }
.cam.is-innocent .plate { border-color: rgba(111,207,142,.6); }
.cam.is-guilty .plate { border-color: rgba(239,107,91,.7); background: rgba(60,14,14,.85); }
.cam.is-guilty .fig { filter: grayscale(.5) brightness(.8); animation: none; }
.cam.rev-guilty .plate { border-color: var(--bad); border-style: dashed; }
.cam.dbg-forced .plate { outline: 2px dashed #7cc4ff; }
.badge { position: absolute; top: 2px; right: 6px; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; color: #0c0f1d; }
.is-innocent .badge { background: var(--good); } .is-guilty .badge { background: var(--bad); }
.bubble { position: absolute; top: -6px; left: 8px; background: #fff7e6; color: #2a1d14; border-radius: 10px 10px 10px 2px; padding: 0 6px; font-weight: 700; font-size: 13px; line-height: 16px; animation: pop 1.6s ease-in-out infinite; }
@keyframes pop { 50% { transform: translateY(-2px); } }
.toast { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); background: rgba(255,179,71,.95); color: #1d1408; padding: 6px 12px; border-radius: 10px; font-size: 13px; font-weight: 600; white-space: nowrap; z-index: 5; }

.notebook { margin-top: 14px; }
.notebook h2 { font-size: 14px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 0 0 6px; }
.notebook h2 small { text-transform: none; letter-spacing: 0; font-weight: 400; opacity: .7; margin-left: 6px; }
#notes { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.note { display: flex; gap: 8px; align-items: baseline; padding: 6px 10px; border-radius: 8px; background: var(--card); cursor: pointer; }
.note.dim { opacity: .35; }
.note .who { flex: none; min-width: 52px; text-align: left; color: var(--fire); }
.note.lv3 { border-left: 3px solid #ffd166; } .note.lvcaught { border-left: 3px solid var(--bad); }
.empty { color: var(--muted); padding: 6px 0; }
.nm { background: none; border: 0; padding: 0; font-weight: 700; color: #ffd9a0; text-decoration: underline dotted rgba(255,217,160,.5); text-underline-offset: 3px; }
q { quotes: "“" "”"; }

.panel { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; position: relative; }
.panel .close { position: absolute; top: 8px; right: 10px; background: none; border: 0; font-size: 24px; color: var(--muted); }
.who { display: flex; gap: 12px; align-items: center; }
.portrait { width: 76px; height: 92px; border-radius: 12px; background: radial-gradient(circle at 50% 30%, #3a2b22, #171b2e); display: grid; place-items: end center; overflow: hidden; flex: none; }
.portrait .fig { width: 72px; height: 100px; margin-bottom: -6px; }
.who h3 { margin: 0; font-size: 20px; } .muted { color: var(--muted); margin: 2px 0; font-size: 13px; }
.verdict { margin: 4px 0 0; font-weight: 700; font-size: 13px; } .verdict.i { color: var(--good); } .verdict.g { color: var(--bad); }
.lines { list-style: none; margin: 12px 0; padding: 0; display: grid; gap: 8px; }
.lines li { display: flex; gap: 10px; align-items: flex-start; padding: 9px 10px; border-radius: 10px; background: #1f2440; }
.lvl { flex: none; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 11px; background: #2c3358; color: var(--muted); font-size: 11px; display: grid; place-items: center; font-weight: 700; }
.lv3 .lvl { background: #ffd166; color: #2a1d14; } .lvcaught .lvl { background: var(--bad); color: #fff; }
.locked { color: var(--muted); font-style: italic; }
.bonus { border: 1px dashed #4a5280; background: transparent !important; } .bonus.done { border-color: #ffd166; }
.bonus .prog { color: var(--fire); margin-left: 4px; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.actions button { padding: 12px; border-radius: 10px; border: 2px solid; font-weight: 700; background: none; }
.inn { border-color: var(--good) !important; color: var(--good); } .gui { border-color: var(--bad) !important; color: var(--bad); }
.inn.arm { background: var(--good); color: #0c1d12; } .gui.arm { background: var(--bad); color: #250a06; }

@media (max-width: 899px) {
  .panel { position: fixed; left: 8px; right: 8px; bottom: 8px; max-height: 48vh; overflow: auto; z-index: 30; box-shadow: 0 -10px 40px rgba(0,0,0,.6); }
  body.sheet-open .layout { padding-bottom: 48vh; }
}

.overlay { position: fixed; inset: 0; background: rgba(5,6,12,.7); display: grid; place-items: center; z-index: 50; padding: 16px; }
.overlay[hidden], .panel[hidden], .toast[hidden] { display: none; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 20px; max-width: 440px; width: 100%; }
.card h2 { margin: 0 0 8px; color: var(--fire); }
.card .big { font-size: 20px; font-weight: 700; }
.card .row { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.card .row button { flex: 1; padding: 11px; border-radius: 10px; border: 0; background: var(--fire); color: #1d1408; font-weight: 700; }
.card .row button + button { background: #2c3358; color: var(--ink); }
.share { background: #0e1122; padding: 10px; border-radius: 8px; white-space: pre-wrap; }
.help ul { padding-left: 18px; margin: 0; display: grid; gap: 6px; }
#dbg { position: fixed; left: 0; right: 0; bottom: 0; background: #002b; color: #9cf; font: 11px/1.3 ui-monospace, monospace; padding: 4px 8px; z-index: 60; pointer-events: none; }
