:root {
  --bg: #07080d;
  --ink: #e9e6f2;
  --muted: #9a96ad;
  --accent: #7cf3c4;
  --blood: #ff4d6d;
  --panel: rgba(14, 14, 24, 0.92);
  --line: rgba(124, 243, 196, 0.25);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--ink);
  font-family: Inter, system-ui, sans-serif; }
#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }

.screen { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 24px 16px; text-align: center;
  background: radial-gradient(ellipse at center, rgba(7,8,13,.55), rgba(7,8,13,.95)); z-index: 5; overflow-y: auto; }
h1 { font-family: Creepster, cursive; font-size: clamp(48px, 10vw, 112px); margin: 0; letter-spacing: 3px;
  color: var(--ink); text-shadow: 0 0 30px rgba(124,243,196,.35); }
h1 span { color: var(--accent); }
.tag { color: var(--muted); max-width: 560px; margin: 8px 0 16px; }
.pill { font-size: 12px; padding: 4px 12px; border: 1px solid var(--line); border-radius: 99px; color: var(--accent); margin-bottom: 20px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; width: min(960px, 100%); }
.card { text-align: left; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px;
  cursor: pointer; transition: transform .15s, border-color .15s; color: var(--ink); font: inherit; }
.card:hover { transform: translateY(-3px); border-color: var(--accent); }
.card h3 { margin: 0 0 6px; font-size: 18px; }
.card .meta { color: var(--muted); font-size: 13px; line-height: 1.5; }
.card .type { display: inline-block; margin-top: 10px; font-size: 11px; letter-spacing: 1px; text-transform: uppercase; color: var(--accent); }

.spinner { width: 54px; height: 54px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
#loading-line { color: var(--muted); margin-top: 18px; }

.case { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 28px; max-width: 620px; text-align: left; }
.case-label { font-size: 11px; letter-spacing: 2px; color: var(--accent); }
.case h2 { font-family: Creepster, cursive; font-size: 40px; margin: 8px 0; font-weight: 400; letter-spacing: 1px; }
.goal { color: var(--accent); font-weight: 600; }
.controls-help { font-size: 13px; color: var(--muted); margin: 16px 0; }
button { font: inherit; cursor: pointer; border-radius: 10px; border: 1px solid var(--line); background: transparent; color: var(--ink); padding: 8px 14px; }
button.big { background: var(--accent); color: #06110c; font-weight: 800; border: 0; padding: 12px 22px; font-size: 16px; }
button.ghost:hover, button:hover { border-color: var(--accent); }
button.x { border: 0; padding: 4px 8px; color: var(--muted); }

#hud { position: fixed; inset: 0; pointer-events: none; z-index: 3; }
#hud-top { position: absolute; top: 14px; left: 16px; display: flex; gap: 10px; flex-wrap: wrap; }
#hud-top span { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; font-size: 13px; }
#minimap { position: absolute; top: 14px; right: 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
#crosshair { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); color: rgba(255,255,255,.5); }
#prompt { position: absolute; left: 50%; top: 58%; transform: translateX(-50%); background: var(--panel);
  border: 1px solid var(--accent); border-radius: 8px; padding: 8px 14px; font-weight: 600; }
#log { position: absolute; left: 16px; bottom: 16px; width: min(460px, calc(100% - 32px)); display: flex; flex-direction: column; gap: 6px; }
#log .entry { background: var(--panel); border-left: 3px solid var(--accent); padding: 8px 12px; border-radius: 6px; font-size: 14px; animation: fade 8s forwards; }
#log .entry.say { border-left-color: var(--blood); }
@keyframes fade { 0%, 80% { opacity: 1; } 100% { opacity: 0; } }

.panel { position: fixed; right: 16px; top: 170px; width: min(400px, calc(100% - 32px)); max-height: calc(100% - 190px);
  overflow-y: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px; z-index: 6; }
.panel-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.panel-head .x { margin-left: auto; }
#dlg-role { color: var(--muted); font-size: 13px; }
#dlg-lines { display: flex; flex-direction: column; gap: 8px; max-height: 300px; overflow-y: auto; margin-bottom: 10px; }
#dlg-lines .me { align-self: flex-end; background: rgba(124,243,196,.12); }
#dlg-lines div { padding: 8px 10px; border-radius: 8px; background: rgba(255,255,255,.05); font-size: 14px; }
#dlg-form { display: flex; gap: 8px; }
#dlg-input { flex: 1; background: rgba(255,255,255,.06); border: 1px solid var(--line); border-radius: 8px; color: var(--ink); padding: 8px; font: inherit; }
#journal h3 { font-size: 12px; letter-spacing: 2px; color: var(--accent); margin: 14px 0 6px; }
#journal ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
#journal li { background: rgba(255,255,255,.04); border-radius: 8px; padding: 8px; }
#journal li.unknown { color: var(--muted); font-style: italic; }
#journal li button { margin-top: 6px; border-color: var(--blood); color: var(--blood); font-size: 12px; padding: 4px 10px; }
#hint-btn { margin-top: 14px; width: 100%; }

#busy { position: fixed; top: 60px; left: 50%; transform: translateX(-50%); z-index: 7; background: var(--panel);
  border: 1px solid var(--accent); border-radius: 99px; padding: 6px 16px; font-size: 13px; color: var(--accent); }
#scan { position: fixed; inset: 0; z-index: 8; background: #000; }
#scan iframe { width: 100%; height: 100%; border: 0; }
#scan .x { position: absolute; top: 12px; left: 12px; background: var(--panel); color: var(--ink); }
#paused h2 { font-family: Creepster, cursive; font-size: 56px; font-weight: 400; margin: 0; }
#paused { cursor: pointer; }

#sponsors { list-style: none; padding: 0; margin: 0 0 20px; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; max-width: 760px; }
#sponsors li { font-size: 12px; padding: 5px 10px; border-radius: 8px; background: var(--panel); border: 1px solid rgba(255,255,255,.08); color: var(--muted); }
#sponsors li.on { border-color: var(--accent); color: var(--ink); }
#sponsors li b { color: var(--accent); margin-right: 4px; }
#sponsors li.off b { color: var(--muted); }
.sub { color: var(--muted); font-size: 12px; }
#bank { width: min(520px, calc(100% - 32px)); }
#bank h4 { margin: 12px 0 4px; font-size: 14px; }
#bank h4 span { color: var(--muted); font-weight: 400; }
#bank table { width: 100%; border-collapse: collapse; font-size: 13px; }
#bank td { padding: 4px 6px; border-bottom: 1px solid rgba(255,255,255,.06); vertical-align: top; }
#bank td.amt { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
#bank td.out { color: var(--blood); }
#bank td.in { color: var(--accent); }
#bank .empty { color: var(--muted); font-size: 13px; }

/* ---------- Night Shift ---------- */
.subtitle { letter-spacing: 12px; color: var(--blood); font-weight: 800; margin-top: -6px; }
#bars { position: absolute; top: 14px; left: 16px; display: flex; flex-direction: column; gap: 8px; width: 220px; }
.bar label { font-size: 10px; letter-spacing: 2px; color: var(--muted); }
.bar div { height: 10px; background: rgba(255,255,255,.08); border-radius: 6px; overflow: hidden; border: 1px solid rgba(255,255,255,.1); }
.bar i { display: block; height: 100%; width: 100%; background: var(--blood); transition: width .15s; }
.bar.uv i { background: #b18cff; }
#center-top { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); display: flex; gap: 10px; }
#center-top span { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px; font-size: 14px; font-weight: 600; white-space: nowrap; }
#timer { color: var(--accent); font-variant-numeric: tabular-nums; }
#timer.low { color: var(--blood); }
#wallet { position: absolute; top: 166px; right: 16px; width: 180px; background: var(--panel); border: 1px solid #1f6fff; border-radius: 10px; padding: 8px 10px; }
.w-head { font-size: 12px; }
.w-head b { color: #9cc3ff; }
#w-balance { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
#w-tx { font-size: 10px; word-break: break-all; }
#director { position: absolute; right: 16px; bottom: 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 99px; padding: 6px 14px; font-size: 12px; max-width: 360px; display: flex; gap: 8px; align-items: center; }
#director .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; }
#director.busy .dot { background: var(--blood); animation: pulse .6s infinite alternate; }
@keyframes pulse { to { opacity: .2; } }
#taunt { position: absolute; top: 26%; left: 50%; transform: translateX(-50%); font-family: Creepster, cursive; font-size: clamp(28px, 4vw, 48px); color: #ffd0d8; text-shadow: 0 0 18px #ff2050; opacity: 0; transition: opacity .4s; text-align: center; width: 90%; }
#taunt.on { opacity: 1; }
#hurt { position: absolute; inset: 0; box-shadow: inset 0 0 160px 40px rgba(255, 0, 40, .55); opacity: 0; transition: opacity .2s; }
#atm { border-color: #1f6fff; top: 120px; }
#atm-balance { font-size: 26px; font-weight: 800; margin: 4px 0 10px; }
.shop-item { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 8px; background: rgba(255,255,255,.04); margin-bottom: 8px; }
.shop-item div { flex: 1; font-size: 13px; }
.shop-item button { border-color: #1f6fff; color: #9cc3ff; white-space: nowrap; }
.shop-item button:disabled { opacity: .4; cursor: default; }
@media (max-width: 700px) { #center-top { top: 90px; } #wallet { display: none; } }

#end-bank { margin: 14px 0; }
.bank-title { font-size: 14px; color: #9cc3ff; margin: 0 0 6px; }
#end-bank-table { width: 100%; border-collapse: collapse; font-size: 12px; }
#end-bank-table td { padding: 4px 6px; border-bottom: 1px solid rgba(255,255,255,.07); }
#end-bank-table td.amt { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
#end-bank-table td.in { color: var(--accent); } #end-bank-table td.out { color: var(--blood); }
#end-bank-table td.id { color: var(--muted); font-family: ui-monospace, monospace; font-size: 10px; }

/* Tall screens (e.g. 20 building cards): start at the top and scroll, instead of
   centering and pushing the heading off-screen. */
.screen { justify-content: flex-start; }
.screen > :first-child { margin-top: auto; }
.screen > :last-child { margin-bottom: auto; }
#title { padding-top: 48px; }
