/* AFTERMATH — evidence playback terminal */

:root {
	--bg: #0a0d12;
	--bg-2: #0f141b;
	--panel: #121922;
	--panel-2: #0d131b;
	--line: #20313f;
	--line-soft: #18242f;
	--ink: #d8e6ef;
	--ink-dim: #8aa0b0;
	--ink-faint: #5b7081;
	--cyan: #36d6e7;
	--cyan-dim: #1c8c97;
	--amber: #ffb84d;
	--amber-dim: #c98a2e;
	--good: #5ce08a;
	--bad: #ff6b6b;
	--focus: #ffe07a;
	--radius: 10px;
	--mono: ui-monospace, "Cascadia Mono", "Consolas", "SFMono-Regular", Menlo, monospace;
	--sans: ui-sans-serif, system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
	margin: 0;
	height: 100%;
	background:
		radial-gradient(1200px 600px at 70% -10%, #10202b 0%, transparent 60%),
		var(--bg);
	color: var(--ink);
	font-family: var(--sans);
	font-size: 16px;
	line-height: 1.5;
}

#app {
	height: 100vh;
	display: flex;
	flex-direction: column;
}

/* ---------- Top bar ---------- */
.topbar {
	display: flex;
	align-items: center;
	gap: 16px;
	padding: 10px 18px;
	border-bottom: 1px solid var(--line);
	background: linear-gradient(180deg, #0d141c, #0a0f15);
}
.brand { display: flex; flex-direction: column; line-height: 1.1; }
.logo {
	font-family: var(--mono);
	font-weight: 700;
	letter-spacing: 0.34em;
	color: var(--cyan);
	font-size: 20px;
	text-shadow: 0 0 18px rgba(54,214,231,0.25);
}
.tagline { font-size: 11px; color: var(--ink-faint); letter-spacing: 0.18em; text-transform: uppercase; }
.case-id {
	margin-left: auto;
	font-family: var(--mono);
	font-size: 13px;
	color: var(--ink-dim);
	border: 1px solid var(--line);
	padding: 5px 12px;
	border-radius: 999px;
	background: var(--panel-2);
}
.top-actions { display: flex; gap: 8px; }

button {
	font-family: var(--sans);
	font-size: 14px;
	cursor: pointer;
	border-radius: 8px;
	border: 1px solid var(--line);
	background: var(--panel);
	color: var(--ink);
	padding: 7px 12px;
	transition: border-color .15s, background .15s, color .15s, transform .05s;
}
button:hover { border-color: var(--cyan-dim); color: #fff; }
button:active { transform: translateY(1px); }
button:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.ghost { background: transparent; }
.primary {
	background: linear-gradient(180deg, #16323b, #102730);
	border-color: var(--cyan-dim);
	color: #d8fbff;
	font-weight: 600;
}
.primary:hover { border-color: var(--cyan); box-shadow: 0 0 16px rgba(54,214,231,0.18); }
.big { padding: 12px 22px; font-size: 16px; }

/* ---------- Game layout ---------- */
#game {
	flex: 1;
	display: grid;
	grid-template-columns: 1fr 360px;
	min-height: 0;
}
.stage {
	display: flex;
	flex-direction: column;
	min-width: 0;
	border-right: 1px solid var(--line);
}
.scene-wrap {
	position: relative;
	flex: 1;
	min-height: 0;
	background:
		linear-gradient(transparent 95%, rgba(54,214,231,0.04) 96%) 0 0 / 100% 28px,
		var(--bg-2);
	overflow: hidden;
}
#scene { width: 100%; height: 100%; display: block; }

.float-msg {
	position: absolute;
	top: 14px; left: 50%;
	transform: translateX(-50%);
	background: rgba(10,15,20,0.9);
	border: 1px solid var(--amber-dim);
	color: var(--amber);
	font-family: var(--mono);
	font-size: 13px;
	padding: 6px 14px;
	border-radius: 999px;
	pointer-events: none;
}

.nowline {
	font-family: var(--mono);
	font-size: 13px;
	color: var(--ink-dim);
	padding: 8px 16px;
	border-top: 1px solid var(--line-soft);
	background: var(--panel-2);
	min-height: 38px;
	display: flex;
	align-items: center;
}
.nowline b { color: var(--cyan); font-weight: 600; }
.nowline .ev { color: var(--amber); }

/* ---------- Transport ---------- */
.transport {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 12px 16px;
	border-top: 1px solid var(--line);
	background: var(--panel);
}
.tbtn {
	font-family: var(--mono);
	min-width: 40px;
	padding: 8px 10px;
	background: var(--panel-2);
}
.tbtn.play { color: var(--cyan); min-width: 48px; font-size: 16px; }
.scrub-area { position: relative; flex: 1; display: flex; flex-direction: column; gap: 4px; }
.ticks { position: relative; height: 10px; }
.tick {
	position: absolute;
	top: 0;
	width: 2px; height: 10px;
	background: var(--amber);
	transform: translateX(-1px);
	opacity: 0.8;
	border-radius: 2px;
}
.tick.bookmark { background: var(--cyan); height: 12px; top: -1px; }

input[type=range] {
	-webkit-appearance: none;
	appearance: none;
	width: 100%;
	height: 8px;
	background: linear-gradient(90deg, var(--cyan-dim), #143038);
	border: 1px solid var(--line);
	border-radius: 999px;
	outline: none;
}
input[type=range]:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
input[type=range]::-webkit-slider-thumb {
	-webkit-appearance: none;
	appearance: none;
	width: 16px; height: 22px;
	border-radius: 5px;
	background: var(--cyan);
	border: 1px solid #0a0f15;
	box-shadow: 0 0 10px rgba(54,214,231,0.5);
	cursor: pointer;
}
input[type=range]::-moz-range-thumb {
	width: 16px; height: 22px;
	border-radius: 5px;
	background: var(--cyan);
	border: 1px solid #0a0f15;
	cursor: pointer;
}
.clock {
	font-family: var(--mono);
	font-size: 13px;
	color: var(--ink-dim);
	min-width: 110px;
	text-align: right;
}

/* ---------- Side panel ---------- */
.panel {
	display: flex;
	flex-direction: column;
	min-height: 0;
	background: var(--panel);
	overflow: hidden;
}
.panel-block {
	padding: 14px 16px;
	border-bottom: 1px solid var(--line);
	min-height: 0;
}
.panel-block.grow { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.panel h2 {
	margin: 0 0 8px;
	font-size: 12px;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: var(--cyan);
	font-weight: 700;
}
.panel h2 .hint { color: var(--ink-faint); font-weight: 400; text-transform: none; letter-spacing: 0; font-size: 11px; }
.brief { font-size: 14px; color: var(--ink-dim); }
.brief strong { color: var(--ink); }

.notebook {
	list-style: none;
	margin: 0; padding: 0;
	overflow-y: auto;
	font-family: var(--mono);
	font-size: 12.5px;
	color: var(--ink-dim);
}
.notebook li {
	padding: 4px 6px;
	border-left: 2px solid var(--line);
	margin-bottom: 3px;
	animation: fadein .25s ease;
}
.notebook li .tt { color: var(--cyan); }
.notebook li.ev-state { border-left-color: var(--amber); }
.notebook li.ev-fall { border-left-color: var(--bad); }
.notebook .empty { color: var(--ink-faint); border: none; font-style: italic; }

/* ---------- Accusation ---------- */
.questions { display: flex; flex-direction: column; gap: 12px; }
.q { }
.q .qp { font-size: 13.5px; margin-bottom: 6px; color: var(--ink); }
.opts { display: flex; flex-wrap: wrap; gap: 6px; }
.opt {
	font-size: 13px;
	padding: 6px 10px;
	border-radius: 7px;
	border: 1px solid var(--line);
	background: var(--panel-2);
	color: var(--ink-dim);
	display: inline-flex;
	align-items: center;
	gap: 6px;
}
.opt .swatch { width: 11px; height: 11px; border-radius: 2px; display: inline-block; border: 1px solid rgba(255,255,255,0.3); }
.opt:hover { color: #fff; }
.opt.sel {
	border-color: var(--cyan);
	color: #eafdff;
	background: #133038;
	box-shadow: inset 0 0 0 1px var(--cyan-dim);
}
.submit-row { margin-top: 12px; }
.submit-row .primary { width: 100%; }
.verdict {
	margin-top: 10px;
	font-family: var(--mono);
	font-size: 13px;
	min-height: 20px;
}
.verdict.good { color: var(--good); }
.verdict.bad { color: var(--amber); }

/* ---------- Overlays ---------- */
.overlay {
	position: fixed;
	inset: 0;
	display: none;
	align-items: center;
	justify-content: center;
	padding: 24px;
	background: rgba(5,8,11,0.82);
	backdrop-filter: blur(3px);
	z-index: 50;
}
.overlay.show { display: flex; }
.card {
	max-width: 640px;
	width: 100%;
	background: linear-gradient(180deg, #111923, #0c121a);
	border: 1px solid var(--line);
	border-radius: 16px;
	padding: 30px 32px;
	box-shadow: 0 20px 60px rgba(0,0,0,0.55);
	max-height: 90vh;
	overflow-y: auto;
}
.card h1 {
	margin: 0 0 14px;
	font-family: var(--mono);
	letter-spacing: 0.14em;
	color: var(--cyan);
	font-size: 26px;
}
.card .lede { font-size: 18px; color: var(--ink); }
.card p { color: var(--ink-dim); }
.card strong { color: var(--ink); }
.card em { color: var(--amber); font-style: normal; }
.card-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 22px; }
.micro { font-size: 12px; color: var(--ink-faint); margin-top: 14px; }
.how { padding-left: 18px; color: var(--ink-dim); }
.how li { margin-bottom: 10px; }
.how strong { color: var(--cyan); }
kbd {
	font-family: var(--mono);
	font-size: 12px;
	background: var(--panel-2);
	border: 1px solid var(--line);
	border-bottom-width: 2px;
	border-radius: 5px;
	padding: 1px 6px;
	color: var(--ink);
}
.truth { font-size: 15px; color: var(--ink-dim); line-height: 1.6; }
.truth p { margin: 0 0 12px; }
.truth strong { color: var(--ink); }
.stamp {
	display: inline-block;
	font-family: var(--mono);
	letter-spacing: 0.2em;
	color: var(--good);
	border: 2px solid var(--good);
	border-radius: 8px;
	padding: 6px 14px;
	margin-bottom: 16px;
	transform: rotate(-2deg);
	box-shadow: 0 0 22px rgba(92,224,138,0.25);
}

/* ---------- Case list ---------- */
.case-list { display: flex; flex-direction: column; gap: 10px; }
.case-row {
	display: flex;
	align-items: center;
	gap: 12px;
	width: 100%;
	text-align: left;
	padding: 14px 16px;
	font-size: 15px;
}
.case-row .num { font-family: var(--mono); color: var(--cyan); }
.case-row .st { margin-left: auto; font-family: var(--mono); font-size: 12px; }
.case-row .st.solved { color: var(--good); }
.case-row .st.locked { color: var(--ink-faint); }
.case-row[disabled] { opacity: 0.5; cursor: not-allowed; }

/* ---------- SVG entity styles ---------- */
/* Dark halo behind every SVG label so overlapping text stays readable: */
.room-label, .feature-label,
.actor .name, .actor .role,
.prop .plabel, .prop .pstate {
	paint-order: stroke;
	stroke: #06090d;
	stroke-width: 0.65;
	stroke-linejoin: round;
}

.room { fill: rgba(20,32,42,0.35); stroke: var(--line); stroke-width: 0.5; }
.room-label { fill: var(--ink-faint); font-family: var(--mono); font-size: 3px; letter-spacing: 0.12em; text-transform: uppercase; }
.feature-label { fill: var(--ink-faint); font-family: var(--mono); font-size: 2.6px; }

.actor { cursor: pointer; }
.actor .body { stroke-width: 0.5; stroke: rgba(255,255,255,0.5); }
.actor .name { font-family: var(--mono); font-size: 3px; text-anchor: middle; fill: var(--ink); }
.actor .role { font-family: var(--mono); font-size: 2.3px; text-anchor: middle; fill: var(--ink-faint); }
.actor.dim { opacity: 0.28; }
.actor.focused .name { fill: #fff; }
.actor:focus-visible { outline: none; }
.actor:focus-visible .focusring { opacity: 1; }
.focusring { fill: none; stroke: var(--focus); stroke-width: 0.6; opacity: 0; }
.actor.focused .focusring { opacity: 0.9; }
.fallen .body { opacity: 0.5; }

.prop { cursor: pointer; }
.prop .glyph { fill: none; stroke: var(--ink-dim); stroke-width: 0.5; }
.prop .plabel { font-family: var(--mono); font-size: 2.5px; text-anchor: middle; fill: var(--ink-faint); }
.prop .pstate { font-family: var(--mono); font-size: 2.3px; text-anchor: middle; }
.prop.changed .glyph { stroke: var(--amber); }
.prop.removed .glyph { stroke-dasharray: 1 1; opacity: 0.4; }
.prop.dim { opacity: 0.3; }

.contact-link { stroke: var(--amber); stroke-width: 0.45; stroke-dasharray: 1.4 1.0; opacity: 0.9; }
.contact-link.aa { stroke: var(--cyan); }
.contact-pulse { fill: none; stroke: var(--amber); stroke-width: 0.4; opacity: 0.7; animation: pulse 1.4s ease-out infinite; }
.contact-pulse.aa { stroke: var(--cyan); }

.trail { fill: none; stroke: var(--cyan); stroke-width: 0.5; stroke-dasharray: 1.2 1.2; opacity: 0.85; }
.trail-future { fill: none; stroke: var(--ink-faint); stroke-width: 0.4; stroke-dasharray: 0.6 1.4; opacity: 0.5; }
.trail-dot { fill: var(--cyan); }

@keyframes pulse {
	0% { r: 3; opacity: 0.8; }
	100% { r: 9; opacity: 0; }
}
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
	/* Let the whole page scroll instead of clipping a stacked panel: */
	#app { height: auto; min-height: 100vh; }
	#game { grid-template-columns: 1fr; }
	.stage { border-right: none; border-bottom: 1px solid var(--line); }
	.scene-wrap { height: 56vh; min-height: 280px; }
	.panel { max-height: none; overflow: visible; }
	.panel-block.grow { flex: none; }
	.notebook { max-height: 220px; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
	.contact-pulse { animation: none; opacity: 0; }
	.notebook li { animation: none; }
	* { scroll-behavior: auto; }
}
.reduce-motion .contact-pulse { animation: none; opacity: 0; }
.reduce-motion .notebook li { animation: none; }
