/* PROJECT: HER — dark cinematic interface */
:root {
  color-scheme: dark;
  --bg: #05030a;
  --bg2: #0c0717;
  --panel: rgba(18, 10, 34, 0.78);
  --panel-solid: #120a22;
  --line: rgba(166, 120, 255, 0.24);
  --line-strong: rgba(166, 120, 255, 0.5);
  --violet: #a678ff;
  --violet-deep: #6a3df0;
  --cyan: #5ef2ff;
  --text: #eee8ff;
  --muted: #a49bc4;
  --dim: #6f6790;
  --red: #ff4d7a;
  --gold: #ffd68a;
  --good: #6dffc2;
  --font: 'Space Grotesk', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  --serif: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  --hud-h: 58px;
  --dlg-h: 0px;
  --r: 14px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(1200px 800px at 50% -10%, #1a0d33 0%, var(--bg) 60%) fixed, var(--bg);
  color: var(--text);
  font: 400 16px/1.5 var(--font);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  user-select: none; -webkit-user-select: none;
}
input, textarea { user-select: text; -webkit-user-select: text; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }
em { font-style: normal; color: var(--cyan); }
[hidden] { display: none !important; }

#bg { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
#vignette { position: fixed; inset: 0; z-index: 1; pointer-events: none; background: radial-gradient(ellipse at center, transparent 45%, rgba(0,0,0,.75) 100%); }
#scanlines { position: fixed; inset: 0; z-index: 60; pointer-events: none; opacity: .05; background: repeating-linear-gradient(0deg, #fff 0 1px, transparent 1px 3px); }

/* ---------------- HUD ---------------- */
#hud {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20;
  height: calc(var(--hud-h) + var(--safe-t)); padding: var(--safe-t) 12px 0;
  display: flex; align-items: center; gap: 10px;
  background: linear-gradient(180deg, rgba(5,3,10,.98) 0%, rgba(5,3,10,.96) 82%, rgba(5,3,10,0) 100%);
}
.hud-brand { background: none; border: 0; padding: 4px 2px; text-align: left; display: flex; flex-direction: column; min-width: 0; flex: 0 1 auto; }
.hb-top { font: 600 13px/1.1 var(--mono); letter-spacing: .14em; color: var(--text); }
.hb-sub { font: 400 10px/1.4 var(--mono); letter-spacing: .12em; color: var(--violet); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 42vw; }
.hud-progress { flex: 1; display: flex; align-items: center; gap: 8px; min-width: 40px; }
.hud-progress .bar { flex: 1; height: 3px; background: rgba(255,255,255,.08); border-radius: 3px; overflow: hidden; }
.hud-progress .bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--violet), var(--cyan)); box-shadow: 0 0 10px var(--cyan); transition: width 1s ease; }
#hudPct { font: 500 11px var(--mono); color: var(--muted); }
.hud-actions { display: flex; align-items: center; gap: 4px; }
.frag-count { font: 500 12px var(--mono); color: var(--cyan); margin-right: 4px; white-space: nowrap; }
.ic { width: 36px; height: 36px; border-radius: 10px; border: 1px solid transparent; background: none; display: grid; place-items: center; color: var(--muted); }
.ic:hover { color: var(--text); border-color: var(--line); }
.ic svg { width: 20px; height: 20px; }
#btnMute .off { display: none; }
#btnMute.off .on { display: none; }
#btnMute.off .off { display: block; color: var(--red); }
@media (max-width: 420px) { .hud-progress { display: none; } .hb-sub { max-width: 46vw; } }

/* ---------------- STAGE ---------------- */
#stage {
  position: fixed; inset: 0; z-index: 5;
  overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch;
  padding: calc(16px + var(--safe-t)) 16px calc(24px + var(--safe-b));
  transition: padding .3s ease;
}
body.hud-on #stage { padding-top: calc(var(--hud-h) + 12px + var(--safe-t)); }
body.dlg-open #stage { padding-bottom: calc(190px + var(--safe-b)); }
.scene { max-width: 560px; margin: 0 auto; min-height: 100%; display: flex; flex-direction: column; justify-content: center; gap: 16px; animation: sceneIn .55s cubic-bezier(.2,.8,.2,1) both; }
@keyframes sceneIn { from { opacity: 0; transform: translateY(14px) scale(.985); filter: blur(4px); } to { opacity: 1; transform: none; filter: none; } }

/* ---------------- common ---------------- */
.panel { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 20px 18px; box-shadow: 0 20px 60px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.04); }
.panel::before { content: ''; position: absolute; inset: -1px; border-radius: inherit; pointer-events: none; background: linear-gradient(135deg, rgba(166,120,255,.35), transparent 30%, transparent 70%, rgba(94,242,255,.25)); -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; padding: 1px; }
.kicker { display: inline-block; font: 600 11px/1.3 var(--mono); letter-spacing: .16em; color: var(--violet); text-transform: uppercase; }
.kicker.red { color: var(--red); } .kicker.gold { color: var(--gold); }
h1, h2, h3 { margin: 6px 0 0; font-weight: 600; letter-spacing: -.01em; }
h2 { font-size: clamp(22px, 6vw, 28px); line-height: 1.15; }
h3 { font-size: 20px; }
.muted { color: var(--muted); margin: 4px 0 0; font-size: 14px; }
.center { text-align: center; }
.cy { color: var(--cyan); }

.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 12px 18px; border-radius: 12px;
  border: 1px solid var(--line-strong); background: linear-gradient(180deg, rgba(166,120,255,.18), rgba(106,61,240,.12));
  font-weight: 600; font-size: 15px; letter-spacing: .01em; color: var(--text);
  transition: transform .15s ease, background .2s ease, border-color .2s ease, box-shadow .2s ease, opacity .2s;
}
.btn:hover:not(:disabled) { border-color: var(--violet); box-shadow: 0 0 24px rgba(166,120,255,.25); }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn:disabled { opacity: .45; }
.btn.primary { background: linear-gradient(135deg, var(--violet-deep), #8f5bff 60%, #3fc6e0); border-color: transparent; box-shadow: 0 8px 30px rgba(106,61,240,.4); }
.btn.ghost { background: rgba(255,255,255,.03); border-color: var(--line); color: var(--muted); }
.btn.ghost:hover:not(:disabled) { color: var(--text); }
.btn.sm { min-height: 38px; padding: 8px 14px; font-size: 13px; }
.btn.danger { border-color: var(--red); color: var(--red); }
.btn.proceed { display: flex; width: fit-content; align-self: center; margin: 8px auto 0; min-width: 200px; background: linear-gradient(135deg, var(--violet-deep), #8f5bff); border-color: transparent; animation: proceedIn .5s ease both; }
@keyframes proceedIn { from { opacity: 0; transform: translateY(8px); } }

.choices { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.choice { justify-content: flex-start; text-align: left; font-weight: 500; }
.choice .ci { flex: 0 0 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; font: 600 12px var(--mono); color: var(--violet); border: 1px solid var(--line); }
.choice.picked { border-color: var(--cyan); background: rgba(94,242,255,.1); opacity: 1; }
.choice.right { border-color: var(--good); background: rgba(109,255,194,.12); opacity: 1; }
.choice.right .ci { color: var(--good); border-color: var(--good); }
.choice.wrong { border-color: rgba(255,77,122,.6); background: rgba(255,77,122,.08); text-decoration: line-through; text-decoration-color: rgba(255,77,122,.6); }
.choice-panel h2 { margin-bottom: 2px; }

.shake { animation: shake .45s cubic-bezier(.36,.07,.19,.97); }
@keyframes shake { 10%,90% { transform: translateX(-2px); } 20%,80% { transform: translateX(4px); } 30%,50%,70% { transform: translateX(-7px); } 40%,60% { transform: translateX(7px); } }

.stamp { display: inline-block; font: 700 11px var(--mono); letter-spacing: .18em; color: var(--red); border: 2px solid var(--red); padding: 3px 8px; border-radius: 4px; transform: rotate(-4deg); opacity: .9; }
.stamp.big { font-size: 22px; padding: 6px 14px; border-width: 3px; }

/* photos */
img { display: block; max-width: 100%; }
.ph-missing { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 160px; width: 100%; height: 100%; background: repeating-linear-gradient(45deg, rgba(166,120,255,.07) 0 10px, rgba(166,120,255,.02) 10px 20px), #0d0819; color: var(--muted); font: 500 11px var(--mono); letter-spacing: .14em; text-align: center; padding: 10px; }
.ph-missing span { font-size: 26px; color: var(--violet); }
.ph-missing small { color: var(--dim); letter-spacing: .05em; }

/* ---------------- Architect core (avatar) ---------------- */
.core { position: relative; display: block; width: 46px; height: 46px; perspective: 200px; }
.core i { position: absolute; inset: 0; border-radius: 50%; border: 1.5px solid var(--violet); opacity: .8; animation: spin 6s linear infinite; }
.core i:nth-child(1) { transform: rotateX(70deg); }
.core i:nth-child(2) { border-color: var(--cyan); inset: 4px; animation-duration: 4s; animation-direction: reverse; }
.core i:nth-child(3) { inset: 10px; border-style: dashed; animation-duration: 9s; }
.core b { position: absolute; inset: 15px; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #fff, var(--cyan) 30%, var(--violet-deep) 75%); box-shadow: 0 0 18px var(--cyan), 0 0 40px rgba(166,120,255,.6); animation: breathe 3s ease-in-out infinite; }
.core.big { width: 96px; height: 96px; }
.core.big b { inset: 30px; }
.core.big i:nth-child(2) { inset: 9px; } .core.big i:nth-child(3) { inset: 20px; }
@keyframes spin { to { rotate: 360deg; } }
@keyframes breathe { 50% { transform: scale(.82); filter: brightness(1.3); } }
button.core { background: none; border: 0; padding: 0; border-radius: 50%; }
.core.pulse b { animation: pulseCore .4s ease; }
@keyframes pulseCore { 40% { transform: scale(1.35); box-shadow: 0 0 40px var(--cyan), 0 0 80px var(--violet); } }

/* ---------------- dialogue ---------------- */
#dialogue {
  position: fixed; z-index: 30; left: 50%; bottom: calc(12px + var(--safe-b)); transform: translateX(-50%);
  width: min(640px, calc(100% - 24px)); min-height: 120px;
  display: flex; gap: 12px; align-items: flex-start;
  padding: 16px 16px 30px; border-radius: 16px; cursor: pointer;
  background: linear-gradient(180deg, rgba(22,12,42,.94), rgba(10,6,20,.96));
  border: 1px solid var(--line-strong);
  box-shadow: 0 -10px 60px rgba(0,0,0,.6), 0 0 40px rgba(106,61,240,.18);
  animation: dlgIn .35s cubic-bezier(.2,.8,.2,1);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
@keyframes dlgIn { from { opacity: 0; transform: translate(-50%, 16px); } }
.dlg-avatar { flex: 0 0 46px; background: none; border: 0; padding: 0; margin-top: 2px; }
.dlg-body { flex: 1; min-width: 0; }
.dlg-name { font: 600 11px var(--mono); letter-spacing: .18em; color: var(--violet); margin-bottom: 6px; }
.dlg-text { font-size: 17px; line-height: 1.5; min-height: 2.6em; }
.dlg-text .c { opacity: 0; }
.dlg-text .c.on { opacity: 1; }
.dlg-next { position: absolute; right: 16px; bottom: 8px; font: 500 11px var(--mono); letter-spacing: .1em; color: var(--muted); opacity: 0; transition: opacity .2s; }
.dlg.ready .dlg-next { opacity: 1; animation: nudge 1.2s ease-in-out infinite; }
@keyframes nudge { 50% { transform: translateX(3px); color: var(--cyan); } }
.dlg.sys .dlg-name { color: var(--cyan); }
.dlg.sys .dlg-text { font-family: var(--mono); font-size: 14px; color: var(--cyan); letter-spacing: .03em; }
.dlg.sys .dlg-avatar .core i { border-color: var(--cyan); }
.dlg.unk { border-color: rgba(255,77,122,.6); box-shadow: 0 0 40px rgba(255,77,122,.25); }
.dlg.unk .dlg-name { color: var(--red); }
.dlg.unk .dlg-text { font-family: var(--mono); color: #ffb3c6; }
.dlg.unk .dlg-avatar .core b { background: radial-gradient(circle, #fff, var(--red) 40%, #5a0020); box-shadow: 0 0 20px var(--red); }
.dlg.unk .dlg-avatar .core i { border-color: var(--red); }
.dlg.accused .dlg-name { color: var(--gold); }
.dlg.accused .dlg-text { font-style: italic; }
.dlg.accused .dlg-avatar .core b { background: radial-gradient(circle, #fff, var(--gold) 40%, #5a3b00); box-shadow: 0 0 20px var(--gold); }

/* ---------------- overlay: cinematic / chapter / signature ---------------- */
#overlay { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; background: #000; animation: fadeIn .6s ease both; padding: 24px; }
#overlay.out { animation: fadeOut .7s ease both; }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes fadeOut { to { opacity: 0; } }
.cine { text-align: center; max-width: 560px; }
.cine-l { font: 400 clamp(20px, 5.4vw, 30px)/1.4 var(--serif); font-style: italic; color: #e9e1ff; animation: cineLine 2.4s ease both; margin: 0; }
.cine-l em { color: var(--cyan); font-style: italic; }
@keyframes cineLine { 0% { opacity: 0; letter-spacing: .08em; filter: blur(6px); } 25%,75% { opacity: 1; letter-spacing: .01em; filter: none; } 100% { opacity: 0; filter: blur(4px); } }
.cine-title, .glitch-text { position: relative; font: 700 clamp(38px, 12vw, 76px)/1 var(--font); letter-spacing: .06em; margin: 0; color: #fff; text-shadow: 0 0 30px rgba(166,120,255,.7); }
.cine-title { animation: titleIn 1.4s cubic-bezier(.2,.8,.2,1) both; }
@keyframes titleIn { from { opacity: 0; transform: scale(1.25); filter: blur(12px); letter-spacing: .4em; } }
.cine-title::before, .cine-title::after, .glitch-text::before, .glitch-text::after { content: attr(data-t); position: absolute; inset: 0; pointer-events: none; }
.cine-title::before, .glitch-text::before { color: var(--cyan); transform: translate(2px, 0); clip-path: inset(0 0 60% 0); opacity: .7; animation: gl1 2.6s steps(1) infinite; }
.cine-title::after, .glitch-text::after { color: var(--red); transform: translate(-2px, 0); clip-path: inset(55% 0 0 0); opacity: .6; animation: gl2 3.1s steps(1) infinite; }
@keyframes gl1 { 0%,92%,100% { transform: translate(0); } 93% { transform: translate(4px,-1px); } 96% { transform: translate(-3px,1px); } }
@keyframes gl2 { 0%,88%,100% { transform: translate(0); } 89% { transform: translate(-5px,1px); } 94% { transform: translate(3px,0); } }
.cine-skip { position: fixed; right: 16px; bottom: calc(16px + var(--safe-b)); background: none; border: 1px solid var(--line); color: var(--muted); border-radius: 20px; padding: 8px 16px; font: 500 12px var(--mono); letter-spacing: .1em; }

#overlay.chapter { background: radial-gradient(ellipse at center, #160b2b, #000 70%); cursor: pointer; }
.cc { text-align: center; }
.cc-num { font: 600 13px var(--mono); letter-spacing: .5em; color: var(--violet); animation: ccIn .8s .1s ease both; }
.cc-title { font: 700 clamp(34px, 10vw, 64px)/1.05 var(--font); margin: 14px 0; letter-spacing: -.01em; background: linear-gradient(180deg, #fff, #c9b4ff); -webkit-background-clip: text; background-clip: text; color: transparent; animation: ccTitle 1.2s .25s cubic-bezier(.2,.8,.2,1) both; }
.cc-line { width: 0; height: 1px; margin: 0 auto; background: linear-gradient(90deg, transparent, var(--cyan), transparent); animation: ccLine 1.2s .7s ease both; }
.cc-sub { font: italic 400 clamp(18px, 4.6vw, 22px) var(--serif); color: var(--muted); margin: 16px 0 0; animation: ccIn 1s 1.1s ease both; }
.cc-skip { position: fixed; left: 0; right: 0; bottom: calc(22px + var(--safe-b)); font: 500 11px var(--mono); letter-spacing: .2em; color: var(--dim); animation: ccIn 1s 1.8s ease both; }
@keyframes ccIn { from { opacity: 0; transform: translateY(10px); } }
@keyframes ccTitle { from { opacity: 0; transform: perspective(600px) rotateX(70deg) translateY(30px); filter: blur(8px); } }
@keyframes ccLine { to { width: min(320px, 70vw); } }

#flash { position: fixed; inset: 0; z-index: 55; pointer-events: none; opacity: 0; }
#flash.go { animation: flash .9s ease-out; }
#flash.white { background: #fff; } #flash.violet { background: radial-gradient(circle, rgba(200,170,255,.9), rgba(106,61,240,.5)); }
@keyframes flash { 0% { opacity: .85; } 100% { opacity: 0; } }

body.glitch #stage, body.glitch #dialogue { animation: glitchShake .25s steps(2) infinite; }
body.glitch #stage { filter: hue-rotate(50deg) saturate(1.6); }
@keyframes glitchShake { 0% { transform: translate(0); } 25% { transform: translate(-4px, 1px) skewX(2deg); } 50% { transform: translate(3px, -2px); } 75% { transform: translate(-2px, 2px) skewX(-2deg); } }
body.glitch #dialogue { animation-name: glitchShakeD; }
@keyframes glitchShakeD { 0% { transform: translateX(-50%); } 50% { transform: translateX(calc(-50% + 4px)) skewX(-2deg); } }
body.red-alert #vignette { background: radial-gradient(ellipse at center, transparent 40%, rgba(120,0,30,.55) 100%); animation: alert 2s ease-in-out infinite; }
@keyframes alert { 50% { opacity: .55; } }

/* ---------------- toasts / modal ---------------- */
#toasts { position: fixed; z-index: 50; top: calc(var(--hud-h) + 8px + var(--safe-t)); left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; width: min(360px, calc(100% - 24px)); pointer-events: none; }
.toast { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 12px; background: rgba(16,9,30,.95); border: 1px solid var(--line-strong); box-shadow: 0 10px 40px rgba(0,0,0,.6), 0 0 20px rgba(94,242,255,.12); animation: toastIn .5s cubic-bezier(.2,.9,.3,1.2) both; }
.toast.out { animation: toastOut .5s ease both; }
.toast-ic { flex: 0 0 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-size: 17px; color: var(--cyan); background: rgba(94,242,255,.08); border: 1px solid rgba(94,242,255,.3); }
.toast small { display: block; font: 600 10px var(--mono); letter-spacing: .14em; color: var(--violet); text-transform: uppercase; }
.toast b { font-size: 14px; font-weight: 600; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-14px) scale(.96); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-10px); } }

#modal { position: fixed; inset: 0; z-index: 45; background: rgba(3,1,8,.82); display: grid; place-items: center; padding: 16px; animation: fadeIn .25s ease; backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.modal-card { position: relative; width: min(520px, 100%); max-height: calc(100dvh - 32px); overflow: auto; background: var(--panel-solid); border: 1px solid var(--line-strong); border-radius: 16px; padding: 22px 18px 18px; animation: sceneIn .35s ease both; }
.modal-card.sm { width: min(400px, 100%); }
.modal-x { position: absolute; right: 10px; top: 10px; width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: rgba(0,0,0,.3); color: var(--muted); z-index: 2; }
.modal-card.lb { width: min(900px, 100%); padding: 10px; background: #000; }
.lightbox img { width: 100%; max-height: calc(100dvh - 120px); object-fit: contain; border-radius: 10px; }
.lightbox p { margin: 10px 4px 2px; color: var(--muted); font-size: 14px; }
.mini-confirm p { color: var(--muted); font-size: 14px; }
.mini-confirm .row { display: flex; gap: 10px; flex-wrap: wrap; }
.mini-confirm .row .btn { flex: 1; }

.ach-list { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 8px; }
.ach-list li { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255,255,255,.02); opacity: .55; }
.ach-list li.on { opacity: 1; border-color: rgba(94,242,255,.35); background: rgba(94,242,255,.05); }
.a-ic { flex: 0 0 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; color: var(--cyan); border: 1px solid var(--line); font-size: 16px; }
.ach-list b { display: block; font-size: 14px; } .ach-list small { color: var(--muted); font-size: 12.5px; }

.set { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid rgba(255,255,255,.06); font-size: 15px; }
.set input[type=range] { flex: 1; max-width: 220px; accent-color: var(--violet); }
.set input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--violet); }
.set-danger { margin-top: 18px; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.set-danger small { color: var(--dim); font-size: 12px; }

/* terminal */
.modal-card.terminal { background: #030206; border-color: rgba(94,242,255,.4); font-family: var(--mono); }
.term-out { height: min(52vh, 380px); overflow-y: auto; font-size: 13px; line-height: 1.6; color: #b9fbff; padding-right: 30px; }
.term-out p { margin: 0 0 6px; white-space: pre-wrap; word-break: break-word; }
.term-out .dim { color: #7aa3a8; } .term-out .cmd { color: var(--violet); } .term-out .ok { color: var(--good); } .term-out .err { color: var(--red); }
.term-out em { color: var(--gold); }
.term-in { display: flex; gap: 8px; align-items: center; border-top: 1px solid rgba(94,242,255,.2); padding-top: 10px; margin-top: 6px; }
.term-in label { font-size: 12px; color: var(--cyan); white-space: nowrap; }
.term-in input { flex: 1; min-width: 0; background: none; border: 0; outline: none; color: #fff; font: 15px var(--mono); caret-color: var(--cyan); padding: 6px 0; }

/* ---------------- fragments ---------------- */
.frag { position: absolute; z-index: 4; width: 30px; height: 30px; padding: 0; border: 0; background: none; display: grid; place-items: center; }
.frag i { width: 11px; height: 11px; transform: rotate(45deg); background: linear-gradient(135deg, #fff, var(--cyan)); box-shadow: 0 0 10px var(--cyan), 0 0 22px rgba(94,242,255,.6); animation: fragPulse 2.4s ease-in-out infinite; opacity: .75; }
.frag:hover i { opacity: 1; }
.frag.got i { animation: fragGot .7s ease forwards; }
@keyframes fragPulse { 0%,100% { opacity: .35; transform: rotate(45deg) scale(.8); } 50% { opacity: .95; transform: rotate(45deg) scale(1.1); } }
@keyframes fragGot { to { transform: rotate(405deg) scale(3); opacity: 0; } }

/* ---------------- ACCESS ---------------- */
.scene.center { justify-content: center; }
.access { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.acc-emblem { margin-bottom: 4px; }
.acc-title { font-size: clamp(36px, 11vw, 60px); }
.acc-meta { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; }
.acc-meta span { font: 500 11px var(--mono); letter-spacing: .24em; color: var(--muted); }
.acc-meta b { font: 600 20px var(--mono); letter-spacing: .3em; color: var(--cyan); text-shadow: 0 0 14px rgba(94,242,255,.5); }
.acc-req { display: inline-flex; align-items: center; gap: 8px; font: 600 12px var(--mono); letter-spacing: .28em; color: var(--red); margin: 6px 0 4px; }
.blink { width: 8px; height: 8px; border-radius: 50%; background: var(--red); box-shadow: 0 0 10px var(--red); animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.acc-foot { font: 500 10px var(--mono); letter-spacing: .2em; color: var(--dim); margin-top: 8px; }

/* keypad lock */
.lock { width: 100%; max-width: 320px; margin: 0 auto; }
.slots { display: flex; justify-content: center; gap: 10px; }
.slots i { width: 52px; height: 62px; border-radius: 12px; border: 1px solid var(--line-strong); background: rgba(10,5,22,.7); display: grid; place-items: center; font: 600 26px var(--mono); font-style: normal; color: var(--cyan); transition: border-color .2s, box-shadow .2s; }
.slots i.on { border-color: var(--cyan); box-shadow: 0 0 16px rgba(94,242,255,.25), inset 0 0 12px rgba(94,242,255,.1); }
.lock .slots:has(i:nth-child(6)) i { width: 42px; height: 54px; font-size: 22px; }
.lock.ok .slots i { border-color: var(--good); color: var(--good); box-shadow: 0 0 20px rgba(109,255,194,.4); }
.lock.bad .slots i { border-color: var(--red); color: var(--red); }
.lock-msg { min-height: 22px; margin: 10px 0 8px; font: 600 12px var(--mono); letter-spacing: .12em; text-align: center; color: var(--muted); }
.lock-msg.bad { color: var(--red); } .lock-msg.good { color: var(--good); }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.keypad button { height: 58px; border-radius: 14px; border: 1px solid var(--line); background: rgba(166,120,255,.07); font: 500 22px var(--mono); transition: background .12s, transform .1s, border-color .12s; }
.keypad button:active { background: rgba(94,242,255,.2); transform: scale(.95); border-color: var(--cyan); }
.keypad button.fn { font-size: 14px; color: var(--muted); }

/* granted overlay */
#overlay.granted-ov { background: radial-gradient(circle, #0f0820, #000 70%); }
.granted { text-align: center; position: relative; }
.granted h1 { font: 700 clamp(28px, 8vw, 46px) var(--font); letter-spacing: .14em; color: var(--good); text-shadow: 0 0 30px rgba(109,255,194,.6); animation: titleIn 1s ease both; margin: 0; }
.g-ring { width: 140px; height: 140px; margin: 0 auto 24px; border-radius: 50%; border: 2px solid var(--good); box-shadow: 0 0 40px rgba(109,255,194,.4), inset 0 0 30px rgba(109,255,194,.3); animation: ringIn 1s cubic-bezier(.2,.8,.2,1) both; }
@keyframes ringIn { from { transform: scale(.2) rotateX(70deg); opacity: 0; } }
.boot { list-style: none; padding: 0; margin: 22px 0 0; font: 13px var(--mono); color: var(--muted); text-align: left; display: inline-block; }
.boot li { animation: ccIn .4s ease both; margin: 4px 0; }
.boot b { color: var(--good); }

/* ---------------- MISSION MAP ---------------- */
.map { display: flex; flex-direction: column; gap: 18px; }
.map-core { display: flex; align-items: center; gap: 16px; }
.map-core .core { flex: 0 0 96px; }
.map-greet { margin: 4px 0 0; font-size: 16px; color: var(--text); }
.map-frags { display: flex; align-items: center; gap: 8px; font-size: 18px; color: rgba(255,255,255,.12); }
.map-frags span.on { color: var(--cyan); text-shadow: 0 0 10px var(--cyan); }
.map-frags small { font: 500 11px var(--mono); letter-spacing: .14em; color: var(--muted); margin-left: 6px; text-transform: uppercase; }
.chapters { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; position: relative; }
.chapters::before { content: ''; position: absolute; left: 27px; top: 20px; bottom: 20px; width: 1px; background: linear-gradient(var(--violet), var(--cyan)); opacity: .35; }
.chap { position: relative; width: 100%; display: flex; align-items: center; gap: 14px; padding: 12px 14px 12px 10px; border-radius: 14px; border: 1px solid var(--line); background: var(--panel); text-align: left; transition: border-color .2s, transform .15s, box-shadow .2s; }
.chap:hover:not(:disabled) { border-color: var(--violet); box-shadow: 0 0 26px rgba(166,120,255,.2); }
.chap:active:not(:disabled) { transform: scale(.98); }
.ch-n { flex: 0 0 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font: 600 13px var(--mono); border: 1px solid var(--line-strong); background: var(--bg2); position: relative; z-index: 1; }
.ch-t { flex: 1; display: flex; flex-direction: column; }
.ch-t b { font-size: 16px; font-weight: 600; } .ch-t small { font: 500 11px var(--mono); letter-spacing: .08em; color: var(--muted); }
.ch-go { color: var(--muted); font-size: 18px; }
.chap.ready { border-color: var(--violet); box-shadow: 0 0 30px rgba(106,61,240,.25); }
.chap.ready .ch-n { border-color: var(--cyan); color: var(--cyan); box-shadow: 0 0 14px rgba(94,242,255,.4); animation: breathe2 2.4s ease-in-out infinite; }
@keyframes breathe2 { 50% { box-shadow: 0 0 2px rgba(94,242,255,.2); } }
.chap.cleared .ch-n { background: linear-gradient(135deg, var(--violet-deep), #3fc6e0); border-color: transparent; }
.chap.cleared small { color: var(--good); }
.chap.locked { opacity: .45; }
.map-foot { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ---------------- puzzles ---------------- */
.pz-head { margin-bottom: 10px; }
.pz-prompt { color: var(--muted); margin: 6px 0 14px; font-size: 15px; }
.pz-prompt p { margin: 0; }
.pz-fb { min-height: 22px; margin: 12px 0 0; font-size: 14.5px; }
.pz-fb.bad { color: #ff9ab4; } .pz-fb.good { color: var(--good); }
.pz.solved { border-color: rgba(109,255,194,.5); box-shadow: 0 0 40px rgba(109,255,194,.15); }
.hints { margin-top: 16px; padding-top: 12px; border-top: 1px dashed var(--line); }
.hint { font-size: 14px; color: var(--text); margin: 0 0 10px; padding: 8px 10px; border-radius: 10px; background: rgba(94,242,255,.05); border-left: 2px solid var(--cyan); animation: ccIn .4s ease both; }
.hint b { font: 600 10px var(--mono); letter-spacing: .14em; color: var(--cyan); margin-right: 6px; }

/* oath */
.oath { font: italic 500 19px/1.45 var(--serif); color: var(--text); margin: 0 0 6px; padding: 12px 14px; border-left: 2px solid var(--violet); background: rgba(166,120,255,.06); border-radius: 0 10px 10px 0; }

/* hold */
.holdpz { text-align: center; }
.hold { position: relative; width: 132px; height: 132px; margin: 14px auto 0; border-radius: 50%; border: 0; background: radial-gradient(circle, rgba(166,120,255,.15), rgba(10,5,20,.8) 70%); display: grid; place-items: center; touch-action: none; -webkit-touch-callout: none; }
.ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 4; }
.r-bg { stroke: rgba(166,120,255,.2); }
.r-fg { stroke: var(--cyan); stroke-linecap: round; filter: drop-shadow(0 0 6px var(--cyan)); transition: stroke-dashoffset .25s ease; }
.holding .r-fg { transition: none; }
.hold-ic { width: 58px; height: 58px; color: var(--violet); transition: color .2s, transform .2s; }
.hold-ic svg { width: 100%; height: 100%; }
.holding .hold-ic { color: var(--cyan); transform: scale(.92); }
.holding .hold { box-shadow: 0 0 40px rgba(94,242,255,.35); }
.solved .hold-ic { color: var(--good); }
.hold-lbl { font: 500 12px var(--mono); letter-spacing: .1em; color: var(--muted); margin: 12px 0 0; min-height: 18px; }
.solved .hold-lbl { color: var(--good); }
.scan-eye { position: relative; border-radius: 14px; overflow: hidden; aspect-ratio: 4 / 3; border: 1px solid var(--line-strong); background: #000; }
.scan-eye img, .scan-eye .ph-missing { width: 100%; height: 100%; object-fit: cover; filter: grayscale(.85) brightness(.55) contrast(1.1); transition: filter 1.2s ease; }
.holding .scan-eye img { filter: grayscale(.3) brightness(.8); }
.solved .scan-eye img { filter: none; }
.scan-line { position: absolute; left: 0; right: 0; height: 2px; top: 10%; background: var(--cyan); box-shadow: 0 0 16px var(--cyan); opacity: 0; }
.holding .scan-line { opacity: 1; animation: scanY 1.1s ease-in-out infinite alternate; }
@keyframes scanY { to { top: 90%; } }
.reticle i { position: absolute; width: 26px; height: 26px; border: 2px solid var(--cyan); opacity: .7; }
.reticle i:nth-child(1) { left: 12px; top: 12px; border-right: 0; border-bottom: 0; }
.reticle i:nth-child(2) { right: 12px; top: 12px; border-left: 0; border-bottom: 0; }
.reticle i:nth-child(3) { left: 12px; bottom: 12px; border-right: 0; border-top: 0; }
.reticle i:nth-child(4) { right: 12px; bottom: 12px; border-left: 0; border-top: 0; }
.solved .reticle i { border-color: var(--good); }

/* cipher */
.cipher { display: grid; gap: 12px; }
.cipher small { display: block; font: 600 10px var(--mono); letter-spacing: .18em; color: var(--dim); margin-bottom: 4px; }
.cipher code { display: block; font: 600 clamp(14px, 4.2vw, 18px)/1.5 var(--mono); letter-spacing: .08em; word-break: break-word; padding: 12px; border-radius: 10px; background: rgba(0,0,0,.35); border: 1px solid var(--line); }
.cipher-in code { color: var(--muted); }
.cipher-out code { color: var(--cyan); min-height: 52px; }
.solved .cipher-out code { color: var(--good); border-color: var(--good); text-shadow: 0 0 12px rgba(109,255,194,.5); }
.dial { display: flex; align-items: center; justify-content: center; gap: 16px; }
.dial-b { width: 56px; height: 56px; padding: 0; font-size: 26px; border-radius: 50%; }
.dial-v { min-width: 80px; text-align: center; }
.dial-v b { font: 600 32px var(--mono); color: var(--violet); }

/* tiles */
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; width: min(100%, 360px); aspect-ratio: 1; margin: 0 auto; transition: gap .6s ease; }
.tile { position: relative; padding: 0; border: 0; border-radius: 6px; overflow: hidden; background: #0d0819; aspect-ratio: 1; }
.tile-rot { position: absolute; inset: 0; overflow: hidden; transition: transform .28s cubic-bezier(.3,1.4,.5,1); }
.tile-img { position: absolute; width: 300%; height: 300%; background-size: cover; background-position: center; }
.tile-ar { position: absolute; left: 50%; top: 8%; transform: translateX(-50%); font-size: 18px; color: var(--cyan); display: none; }
.tiles.fallback .tile-img { background: repeating-linear-gradient(45deg, rgba(166,120,255,.18) 0 8px, rgba(166,120,255,.05) 8px 16px); }
.tiles.fallback .tile-ar { display: block; }
.tiles.solved { gap: 0; }
.tiles.solved .tile { border-radius: 0; }
.tiles.solved { box-shadow: 0 0 40px rgba(109,255,194,.3); border-radius: 8px; overflow: hidden; }

/* memory match */
.moves { display: block; font: 500 12px var(--mono); color: var(--violet); margin-top: 4px; }
.mgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
@media (min-width: 520px) { .mgrid { grid-template-columns: repeat(4, 1fr); } }
.mcard { aspect-ratio: 3 / 4; padding: 0; border: 0; background: none; perspective: 700px; }
.mc-in { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform .5s cubic-bezier(.3,1.2,.5,1); }
.mcard.flip .mc-in, .mcard.done .mc-in { transform: rotateY(180deg); }
.mc-face { position: absolute; inset: 0; border-radius: 10px; overflow: hidden; backface-visibility: hidden; -webkit-backface-visibility: hidden; border: 1px solid var(--line-strong); }
.mc-back { display: grid; place-items: center; background: radial-gradient(circle at 30% 20%, rgba(94,242,255,.25), transparent 50%), linear-gradient(135deg, #2a1556, #0d0720); }
.mc-back span { font: 600 11px var(--mono); letter-spacing: .14em; color: rgba(255,255,255,.55); border: 1px solid rgba(255,255,255,.2); padding: 4px 6px; border-radius: 4px; }
.mc-front { transform: rotateY(180deg); background: #000; }
.mc-front img, .mc-front .ph-missing { width: 100%; height: 100%; object-fit: cover; min-height: 0; }
.mcard.done .mc-front { border-color: var(--good); box-shadow: 0 0 16px rgba(109,255,194,.35); }

/* text decode */
.nwords { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; margin: 4px 0 12px; }
.nword { display: flex; gap: 5px; }
.nword span { min-width: 34px; height: 40px; display: grid; place-items: center; border-radius: 8px; font: 600 15px var(--mono); color: var(--cyan); background: rgba(94,242,255,.06); border: 1px solid rgba(94,242,255,.3); }
.key-toggle { display: flex; margin: 0 auto 10px; }
.a1z26 { display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); gap: 4px; margin-bottom: 12px; }
.a1z26 span { display: flex; flex-direction: column; align-items: center; padding: 4px 0; border-radius: 6px; background: rgba(255,255,255,.03); font: 11px var(--mono); color: var(--muted); }
.a1z26 b { font-size: 14px; color: var(--text); }
.txt-form { display: flex; gap: 8px; }
.txt-in { flex: 1; min-width: 0; height: 50px; border-radius: 12px; border: 1px solid var(--line-strong); background: rgba(0,0,0,.4); color: #fff; font: 600 16px var(--mono); letter-spacing: .06em; padding: 0 14px; outline: none; text-transform: uppercase; }
.txt-in:focus { border-color: var(--cyan); box-shadow: 0 0 16px rgba(94,242,255,.2); }
.solved .txt-in { border-color: var(--good); color: var(--good); }

/* pom pom */
.pom-pic { position: relative; border-radius: 12px; overflow: hidden; border: 1px solid var(--line-strong); margin-bottom: 14px; }
.pom-pic img { width: 100%; max-height: 300px; object-fit: cover; }
.pom-pic.sealed { min-height: 170px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 6px; padding: 20px; background: radial-gradient(circle at 50% 40%, rgba(255,150,200,.18), transparent 60%), repeating-linear-gradient(45deg, rgba(255,77,122,.06) 0 10px, transparent 10px 20px), #12081c; animation: hotPulse 1.2s ease-in-out infinite; }
.pom .cool-ok .pom-pic.sealed, .pom.cool-ok .pom-pic.sealed { animation: none; }
.pom-pic.sealed span { font: 600 12px var(--mono); letter-spacing: .14em; color: var(--muted); }
.pom-pic.sealed b { font: 700 24px var(--mono); letter-spacing: .3em; color: var(--red); }
.pom-pic.sealed small { color: var(--muted); font-size: 13px; }
@keyframes hotPulse { 50% { box-shadow: inset 0 0 40px rgba(255,77,122,.35); } }
.meter { margin-bottom: 14px; }
.meter-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.meter-top small { font: 600 10px var(--mono); letter-spacing: .16em; color: var(--muted); }
.meter-top b { font: 600 16px var(--mono); color: var(--red); }
.pom.warm .meter-top b { color: var(--gold); } .pom.cool-ok .meter-top b { color: var(--cyan); }
.meter-bar { height: 10px; border-radius: 6px; background: rgba(255,255,255,.06); overflow: hidden; }
.meter-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--red)); transition: width .25s ease, background .3s; box-shadow: 0 0 12px rgba(255,77,122,.5); }
.pom.cool-ok .meter-bar i { background: linear-gradient(90deg, var(--violet), var(--cyan)); }
.meter-bar.big { height: 6px; margin: 14px 0; }
.meter-bar.big i { background: linear-gradient(90deg, var(--violet), var(--cyan)); transition: width 1.1s ease; }
.cool { width: 100%; font-size: 17px; }

/* signature order */
.sig-slots { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-bottom: 16px; }
.sig-slot { min-width: 64px; min-height: 40px; padding: 8px 10px; border-radius: 10px; border: 1px dashed var(--line-strong); font: italic 500 19px var(--serif); color: var(--gold); display: grid; place-items: center; }
.sig-slot.on { border-style: solid; border-color: rgba(255,214,138,.5); background: rgba(255,214,138,.06); animation: ccIn .3s ease; }
.sig-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.chip { padding: 10px 16px; border-radius: 999px; border: 1px solid var(--line-strong); background: rgba(166,120,255,.1); font: italic 500 19px var(--serif); }
.chip:active { transform: scale(.95); }
.solved .sig-slots { filter: drop-shadow(0 0 12px rgba(255,214,138,.4)); }

/* ---------------- dossier ---------------- */
.dossier-wrap { perspective: 1000px; display: flex; flex-direction: column; }
.dossier { position: relative; padding: 18px; border-radius: 16px; background: linear-gradient(160deg, rgba(30,16,58,.95), rgba(10,6,22,.95)); border: 1px solid var(--line-strong); box-shadow: 0 30px 80px rgba(0,0,0,.6), 0 0 50px rgba(106,61,240,.18); transition: transform .3s ease; transform-style: preserve-3d; animation: dossierIn 1s cubic-bezier(.2,.8,.2,1) both; }
@keyframes dossierIn { from { transform: rotateX(25deg) translateY(30px); opacity: 0; } }
.d-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.d-main { display: flex; gap: 14px; align-items: flex-start; }
.d-photo { position: relative; flex: 0 0 34%; aspect-ratio: 3 / 4; border-radius: 10px; overflow: hidden; border: 1px solid var(--line-strong); }
.d-photo img, .d-photo .ph-missing { width: 100%; height: 100%; object-fit: cover; min-height: 0; filter: saturate(.85) contrast(1.05); }
.d-scan { position: absolute; left: 0; right: 0; height: 30%; top: -30%; background: linear-gradient(transparent, rgba(94,242,255,.25), transparent); animation: dscan 3.5s linear infinite; }
@keyframes dscan { to { top: 100%; } }
.dossier dl { margin: 0; display: grid; grid-template-columns: 1fr; gap: 2px; flex: 1; min-width: 0; }
.dossier dt { font: 600 10px var(--mono); letter-spacing: .16em; color: var(--dim); margin-top: 6px; }
.dossier dt:first-child { margin-top: 0; }
.dossier dd { margin: 0; font-size: 15px; font-weight: 500; }
.dossier dd small { display: block; font: italic 13px var(--serif); color: var(--muted); }
.redact { background: #000; color: #000; border-radius: 2px; letter-spacing: -1px; }
.d-sec { margin-top: 14px; }
.d-sec > small { font: 600 10px var(--mono); letter-spacing: .16em; color: var(--dim); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.tags span { font-size: 12.5px; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line); color: var(--text); background: rgba(166,120,255,.06); }
.tags span.hot { border-color: rgba(255,77,122,.5); color: #ffb3c6; background: rgba(255,77,122,.08); }
.threat { margin: 4px 0 0; font: italic 600 20px var(--serif); color: var(--gold); }

/* ---------------- case board / vault ---------------- */
.board, .vault, .lineup { position: relative; }
.board-head { margin-bottom: 14px; }
.board-grid { display: grid; gap: 14px; }
@media (min-width: 560px) { .board-grid { grid-template-columns: repeat(3, 1fr); } }
.clue { position: relative; text-align: left; padding: 22px 16px 16px; border-radius: 6px; border: 0; background: linear-gradient(170deg, #eae2cf, #d6cbb0); color: #241a10; transform: rotate(var(--r)); box-shadow: 0 14px 30px rgba(0,0,0,.5); display: flex; flex-direction: column; gap: 4px; transition: transform .2s ease; }
.clue:hover:not(:disabled) { transform: rotate(0) scale(1.02); }
.clue small { font: 700 10px var(--mono); letter-spacing: .18em; color: #8a2a2a; }
.clue b { font-size: 19px; }
.clue span:not(.pin) { font-size: 13px; color: #5a4a35; }
.clue em { margin-top: 8px; font: 700 11px var(--mono); letter-spacing: .14em; color: #6a3df0; font-style: normal; }
.clue.done { opacity: .75; }
.clue.done em { color: #1f7a4f; }
.pin { position: absolute; top: 8px; left: 50%; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #ff8aa5, #b5002e); box-shadow: 0 2px 4px rgba(0,0,0,.5); }
.board-note { font: italic 15px var(--serif); color: var(--muted); text-align: center; margin: 16px 0 0; }

.folders { display: grid; gap: 12px; }
.folder { position: relative; padding: 26px 18px 18px; border-radius: 4px 14px 14px 14px; border: 1px solid var(--line-strong); background: linear-gradient(160deg, rgba(40,22,76,.9), rgba(14,8,28,.95)); text-align: left; display: flex; flex-direction: column; gap: 4px; transition: transform .2s, box-shadow .2s; }
.folder .tab { position: absolute; top: -1px; left: -1px; padding: 3px 12px; border-radius: 4px 10px 0 0; background: var(--violet-deep); font: 600 10px var(--mono); letter-spacing: .16em; transform: translateY(-100%); }
.folder { margin-top: 14px; }
.folder b { font: 600 24px var(--mono); letter-spacing: .08em; }
.folder small { font: 600 11px var(--mono); letter-spacing: .14em; color: var(--muted); }
.folder.ready { border-color: var(--cyan); box-shadow: 0 0 30px rgba(94,242,255,.2); animation: breathe2 2.4s ease-in-out infinite; }
.folder.ready small { color: var(--cyan); }
.folder.open small { color: var(--good); }
.folder.locked { opacity: .45; }
.folder.ready:active { transform: scale(.98); }

/* memory gallery */
.mem-head { text-align: center; }
.gallery { display: grid; gap: 18px; }
.evid { position: relative; margin: 0; padding: 10px 10px 12px; border-radius: 6px; background: #f2ecdf; box-shadow: 0 16px 40px rgba(0,0,0,.55); transform: rotate(var(--tilt, 0deg)); }
.gallery .evid:nth-child(odd) { --tilt: -1.2deg; } .gallery .evid:nth-child(even) { --tilt: 1deg; }
.evid img, .evid video { width: 100%; max-height: 70vh; object-fit: cover; border-radius: 2px; background: #000; cursor: zoom-in; }
.evid video { cursor: default; object-fit: contain; }
.evid figcaption { margin-top: 10px; font: italic 500 17px/1.35 var(--serif); color: #2a2018; padding: 0 4px; }
.evid figcaption b { font: 700 11px var(--mono); letter-spacing: .12em; color: #6a3df0; font-style: normal; display: block; margin-bottom: 2px; }
.evid .ph-missing { min-height: 220px; }
.zoomable img { cursor: zoom-in; }
.one-photo { border-radius: 10px; overflow: hidden; margin-top: 10px; }
.one-photo img { width: 100%; max-height: 62vh; object-fit: contain; background: #000; }

/* incident */
.incident { border-color: rgba(255,77,122,.5); box-shadow: 0 0 50px rgba(255,77,122,.15); }
.inc-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.inc-dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 14px 0; }
.inc-dl dt { font: 600 10px var(--mono); letter-spacing: .14em; color: var(--dim); padding-top: 3px; }
.inc-dl dd { margin: 0; font-size: 15px; }
.inc-dl b { color: var(--red); }
.exhibits { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.exh { position: relative; margin: 0; aspect-ratio: 3 / 4; border-radius: 8px; overflow: hidden; border: 1px solid rgba(255,77,122,.4); }
.exh img, .exh .ph-missing { width: 100%; height: 100%; object-fit: cover; min-height: 0; }
.exh span { position: absolute; left: 6px; top: 6px; font: 700 10px var(--mono); letter-spacing: .12em; background: var(--red); color: #fff; padding: 3px 6px; border-radius: 3px; }
.exh .circle { position: absolute; left: 30%; bottom: 8%; width: 46%; height: 30%; border: 3px solid var(--red); border-radius: 50%; transform: rotate(-8deg); opacity: .85; pointer-events: none; animation: circleDraw 1s .4s ease both; }
@keyframes circleDraw { from { opacity: 0; transform: rotate(-8deg) scale(1.4); } }

/* transmission */
.tx { text-align: center; border-color: rgba(255,77,122,.45); }
.tx-head { display: flex; align-items: center; justify-content: center; gap: 8px; }
.rec { width: 10px; height: 10px; border-radius: 50%; background: var(--red); box-shadow: 0 0 12px var(--red); animation: blink 1s steps(1) infinite; }
.tx h2 { font-size: 20px; margin-bottom: 12px; }
.wave { display: flex; align-items: center; justify-content: center; gap: 3px; height: 70px; }
.wave i { width: 4px; height: 8px; border-radius: 2px; background: linear-gradient(var(--cyan), var(--violet)); opacity: .5; }
.tx.playing .wave i { animation: wave .9s ease-in-out infinite alternate; opacity: 1; }
@keyframes wave { 0% { height: 6px; } 30% { height: 46px; } 60% { height: 18px; } 100% { height: 60px; } }
.tx.lost .wave i { background: var(--dim); height: 2px; }
.tx-bar { height: 3px; border-radius: 3px; background: rgba(255,255,255,.08); overflow: hidden; margin-top: 10px; }
.tx-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--violet), var(--cyan)); transition: width .25s linear; }
.tx-time { font: 500 11px var(--mono); color: var(--muted); margin-top: 6px; }
.tx-ctrl { display: flex; gap: 10px; justify-content: center; margin-top: 14px; flex-wrap: wrap; }
.tx-ctrl .btn { min-width: 130px; }
.tx-note { min-height: 20px; color: var(--muted); font-size: 14px; margin: 12px 0 0; }

/* identification / lineup / reveal */
.ident-log { list-style: none; margin: 0; padding: 0; font: 13px/1.6 var(--mono); color: var(--cyan); }
.ident-log li { animation: ccIn .35s ease both; }
.ident-log li::before { content: '> '; color: var(--violet); }
.suspects { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.suspect { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 12px 8px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); position: relative; }
.suspect:hover:not(:disabled) { border-color: var(--violet); }
.suspect small { font: 600 10px var(--mono); letter-spacing: .14em; color: var(--violet); }
.suspect b { font-size: 13px; font-weight: 500; line-height: 1.3; }
.suspect.out { opacity: .4; }
.suspect em { position: absolute; top: 40%; left: 50%; transform: translate(-50%, -50%) rotate(-14deg); font: 700 13px var(--mono); color: var(--red); border: 2px solid var(--red); padding: 2px 6px; font-style: normal; }
.sil { width: 64px; height: 80px; position: relative; }
.sil::before { content: ''; position: absolute; left: 50%; top: 4px; width: 30px; height: 30px; margin-left: -15px; border-radius: 50%; background: #2a1d45; box-shadow: inset 0 0 0 1px var(--line); }
.sil::after { content: '?'; position: absolute; left: 0; right: 0; bottom: 0; height: 42px; border-radius: 30px 30px 6px 6px; background: #2a1d45; box-shadow: inset 0 0 0 1px var(--line); display: grid; place-items: center; font: 700 18px var(--mono); color: var(--violet); }
.sil.s0::after { content: '\2605'; } .sil.s1::before { border-radius: 50% 50% 45% 45%; width: 36px; margin-left: -18px; } .sil.s1::after { content: '\2726'; color: var(--good); }
.sil.s2::before { width: 24px; height: 24px; margin-left: -12px; top: 18px; } .sil.s2::after { height: 32px; background: #000; content: '1'; color: var(--cyan); }
.reveal { display: flex; flex-direction: column; gap: 16px; }
.rev-photo { position: relative; border-radius: 14px; overflow: hidden; border: 1px solid var(--line-strong); animation: revealIn 1.2s cubic-bezier(.2,.8,.2,1) both; }
.rev-photo img { width: 100%; max-height: 58vh; object-fit: cover; }
.rev-photo .stamp { position: absolute; right: 12px; bottom: 16px; background: rgba(0,0,0,.4); animation: stampIn .5s 1s cubic-bezier(.2,1.6,.4,1) both; }
@keyframes revealIn { from { opacity: 0; transform: scale(1.12); filter: blur(14px) brightness(2); } }
@keyframes stampIn { from { opacity: 0; transform: rotate(-4deg) scale(2.4); } }
.rev-card { display: flex; flex-direction: column; }

/* letter */
.scene.paper { justify-content: flex-start; }
.letter { position: relative; padding: 28px 22px 26px; border-radius: 6px; background: linear-gradient(180deg, #f7f1e4, #efe5d0); color: #2b2118; box-shadow: 0 30px 90px rgba(0,0,0,.6), 0 0 0 1px rgba(255,255,255,.1); }
.letter .kicker { color: #7a4fd9; }
.letter p { font: 500 20px/1.55 var(--serif); margin: 14px 0 0; opacity: 0; animation: ink 1.2s ease forwards; }
.letter p em { color: #6a3df0; font-style: italic; }
.letter .greet { font-size: 26px; font-style: italic; }
.letter .signoff { text-align: right; font-style: italic; font-size: 24px; }
.letter .ps { font-size: 17px; color: #6b5a48; font-style: italic; }
.letter-next { display: flex; justify-content: center; opacity: 0; animation: ink .8s ease forwards; margin-top: 10px; }
@keyframes ink { from { opacity: 0; transform: translateY(6px); filter: blur(3px); } to { opacity: 1; transform: none; filter: none; } }

/* future */
.future { display: flex; flex-direction: column; gap: 10px; }
.disclaimer { font: italic 16px var(--serif); color: var(--muted); margin: 0; }
.timeline { list-style: none; margin: 8px 0 0; padding: 0 0 0 22px; position: relative; display: grid; gap: 18px; }
.timeline::before { content: ''; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 1px; background: linear-gradient(var(--gold), var(--violet)); opacity: .6; }
.timeline li { position: relative; padding: 14px 16px; border-radius: 12px; background: rgba(255,214,138,.05); border: 1px solid rgba(255,214,138,.22); opacity: 0; animation: ink 1s ease forwards; }
.timeline li::before { content: ''; position: absolute; left: -21px; top: 18px; width: 10px; height: 10px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 12px var(--gold); }
.timeline small { font: 600 10px var(--mono); letter-spacing: .16em; color: var(--gold); }
.timeline p { margin: 6px 0 0; font: 500 19px/1.45 var(--serif); }
.future .closing { font: italic 500 21px/1.5 var(--serif); color: #f3e8ff; text-align: center; margin: 14px 0 0; opacity: 0; animation: ink 1.2s ease forwards; }

/* signature overlay */
#overlay.signature { background: radial-gradient(ellipse at center, #120826, #000 70%); overflow: hidden; }
.sig { width: 100%; max-width: 640px; text-align: center; position: relative; height: 100%; display: grid; place-items: center; }
.sig-line { font: italic 500 clamp(26px, 7vw, 44px)/1.35 var(--serif); color: #fff; margin: 0; text-shadow: 0 0 30px rgba(166,120,255,.5); transition: transform 1.6s ease, opacity 1.6s ease; }
.sig-line span { display: inline; animation: ink 1.2s ease both; }
.credits-wrap { position: absolute; inset: 0; overflow: hidden; pointer-events: none; -webkit-mask: linear-gradient(transparent, #000 15%, #000 85%, transparent); mask: linear-gradient(transparent, #000 15%, #000 85%, transparent); }
.credits { position: absolute; left: 0; right: 0; top: 100%; display: flex; flex-direction: column; gap: 30px; }
.signature.roll .sig-line { transform: translateY(-30vh) scale(.7); opacity: .25; }
.signature.roll .credits { animation: roll 24s linear forwards; }
@keyframes roll { to { transform: translateY(calc(-100% - 100vh)); } }
.cr small { display: block; font: 600 11px var(--mono); letter-spacing: .22em; color: var(--violet); }
.cr b { font: 500 22px var(--serif); font-style: italic; }
.cr.end b { font: 700 28px var(--font); font-style: normal; letter-spacing: .1em; }
.sig-skip { position: fixed; right: 16px; bottom: calc(16px + var(--safe-b)); opacity: 0; transition: opacity .6s; pointer-events: none; }
.sig-skip.show { opacity: 1; pointer-events: auto; }

/* clear card / ending */
.clear-card, .ending { text-align: center; }
.clear-stats { display: flex; justify-content: center; gap: 12px; margin: 16px 0 4px; }
.clear-stats div { flex: 1; max-width: 120px; padding: 10px 6px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255,255,255,.02); }
.clear-stats b { display: block; font: 600 20px var(--mono); color: var(--cyan); }
.clear-stats small { font: 500 10px var(--mono); letter-spacing: .1em; color: var(--muted); text-transform: uppercase; }
.sig-mini { font: italic 500 20px/1.4 var(--serif); color: var(--gold); margin: 12px 0 0; }
.ending .choices .muted { font-size: 13.5px; }

/* night shift */
.night { display: flex; flex-direction: column; gap: 14px; }
.nlog { list-style: none; margin: 0; padding: 0; display: grid; gap: 22px; }
.nlog li { display: flex; flex-direction: column; gap: 6px; }
.nl-time { font: 600 28px var(--mono); color: var(--cyan); text-shadow: 0 0 14px rgba(94,242,255,.4); }
.nlog .evid img { max-height: 60vh; object-fit: contain; background: #000; }
.night .closing { font: italic 500 22px/1.5 var(--serif); text-align: center; color: #f3e8ff; margin: 8px 0 0; }

.evidence-one { text-align: center; }

@media (min-width: 720px) {
  .panel { padding: 26px 26px; }
  .dlg-text { font-size: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .letter p, .letter-next, .timeline li, .future .closing { opacity: 1; }
}
