/* Cold Trail — film-noir detective desk */

:root {
  --bg: #101014;
  --bg-raise: #17171d;
  --bg-panel: #1d1d25;
  --line: #2d2d38;
  --ink: #d8d3c8;
  --ink-dim: #8f8a80;
  --amber: #d9a441;
  --amber-dim: #8a6a2f;
  --red: #c0453e;
  --green: #5f9e6e;
  --paper: #ece4cf;
  --paper-ink: #26221a;
  --paper-dim: #6b6350;
  --mono: "Courier New", ui-monospace, monospace;
  --serif: Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.5;
}
#app { height: 100%; display: flex; flex-direction: column; }

h1, h2, h3 { font-family: var(--mono); letter-spacing: .06em; }
a { color: var(--amber); }
button {
  font-family: var(--mono); font-size: 13px; letter-spacing: .05em;
  background: var(--bg-panel); color: var(--ink);
  border: 1px solid var(--line); border-radius: 3px;
  padding: 8px 14px; cursor: pointer;
}
button:hover { border-color: var(--amber-dim); color: var(--amber); }
button.primary { background: var(--amber); color: #1a1408; border-color: var(--amber); font-weight: bold; }
button.primary:hover { background: #e8b44e; color: #1a1408; }
button:disabled { opacity: .45; cursor: not-allowed; }
input, select, textarea {
  font-family: var(--mono); font-size: 14px;
  background: var(--bg); color: var(--ink);
  border: 1px solid var(--line); border-radius: 3px; padding: 8px 10px;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--amber-dim); }
label { display: block; color: var(--ink-dim); font-size: 12px; margin: 10px 0 4px; text-transform: uppercase; letter-spacing: .1em; }

.err { color: var(--red); margin-top: 10px; min-height: 1.2em; }
.muted { color: var(--ink-dim); }
.tag { display: inline-block; border: 1px solid var(--line); border-radius: 3px; padding: 1px 7px; font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-dim); }
.tag.amber { color: var(--amber); border-color: var(--amber-dim); }
.tag.red { color: var(--red); border-color: var(--red); }
.tag.green { color: var(--green); border-color: var(--green); }

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 10px 18px; border-bottom: 1px solid var(--line); background: var(--bg-raise);
}
.brand { font-size: 17px; font-weight: bold; letter-spacing: .28em; color: var(--amber); text-decoration: none; }
.brand small { color: var(--ink-dim); letter-spacing: .1em; font-size: 10px; display: block; }
.topbar .spacer { flex: 1; }

/* ---------- auth ---------- */
.center-wrap { flex: 1; display: flex; align-items: center; justify-content: center; padding: 24px; }
.case-card {
  width: 100%; max-width: 420px; background: var(--bg-raise);
  border: 1px solid var(--line); border-radius: 4px; padding: 28px;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
.case-card h1 { margin: 0 0 2px; font-size: 26px; letter-spacing: .3em; color: var(--amber); }
.case-card .sub { color: var(--ink-dim); font-size: 12px; margin-bottom: 22px; }
.case-card input { width: 100%; }
.case-card button.primary { width: 100%; margin-top: 18px; padding: 11px; }
.tabs { display: flex; gap: 0; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.tabs button { border: none; background: none; padding: 8px 14px; color: var(--ink-dim); border-bottom: 2px solid transparent; border-radius: 0; }
.tabs button.active { color: var(--amber); border-bottom-color: var(--amber); }

/* ---------- home ---------- */
.home-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; padding: 24px; max-width: 1100px; margin: 0 auto; width: 100%; }
.panel { background: var(--bg-raise); border: 1px solid var(--line); border-radius: 4px; padding: 20px; }
.panel h2 { margin: 0 0 4px; font-size: 15px; color: var(--amber); }
.panel .sub { color: var(--ink-dim); font-size: 12px; margin-bottom: 14px; }
.panel select, .panel input { width: 100%; }
.panel button.primary { margin-top: 14px; width: 100%; }
table.lb { width: 100%; border-collapse: collapse; margin-top: 10px; }
table.lb td, table.lb th { border-bottom: 1px solid var(--line); padding: 5px 8px; text-align: left; font-size: 13px; }
table.lb th { color: var(--ink-dim); text-transform: uppercase; font-size: 11px; }

/* ---------- lobby ---------- */
.lobby { max-width: 560px; margin: 40px auto; padding: 0 20px; }
.join-code { font-size: 42px; letter-spacing: .35em; color: var(--amber); text-align: center; margin: 18px 0 4px; }
.player-row { display: flex; align-items: center; gap: 10px; padding: 9px 4px; border-bottom: 1px dashed var(--line); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: #555; flex: none; }
.dot.on { background: var(--green); }

/* ---------- game desk ---------- */
.desk { flex: 1; display: grid; grid-template-columns: 250px 1fr 330px; min-height: 0; }
.desk-col { min-height: 0; overflow-y: auto; }
.doc-list { border-right: 1px solid var(--line); background: var(--bg-raise); padding: 10px 0; }
.doc-group { padding: 10px 14px 2px; color: var(--ink-dim); font-size: 11px; text-transform: uppercase; letter-spacing: .15em; }
.doc-item {
  display: flex; gap: 8px; align-items: baseline; width: 100%; text-align: left;
  background: none; border: none; border-radius: 0; padding: 7px 14px; color: var(--ink);
  font-size: 13px; cursor: pointer;
}
.doc-item:hover { background: var(--bg-panel); color: var(--amber); border: none; }
.doc-item.active { background: var(--bg-panel); color: var(--amber); box-shadow: inset 3px 0 0 var(--amber); }
.doc-item .read { color: var(--green); font-size: 11px; flex: none; }
.doc-item .who { margin-left: auto; color: var(--ink-dim); font-size: 10px; flex: none; }

/* the document itself reads like paper */
.doc-view { padding: 26px; }
.paper {
  background: var(--paper); color: var(--paper-ink);
  font-family: var(--serif); font-size: 15px; line-height: 1.65;
  max-width: 760px; margin: 0 auto; padding: 34px 40px; border-radius: 2px;
  box-shadow: 0 14px 40px rgba(0,0,0,.55);
}
.paper h2 { font-family: var(--mono); font-size: 16px; letter-spacing: .08em; border-bottom: 2px solid var(--paper-ink); padding-bottom: 8px; margin-top: 0; }
.paper .stamp { font-family: var(--mono); font-size: 11px; color: var(--paper-dim); text-transform: uppercase; letter-spacing: .18em; margin-bottom: 14px; }
.paper table { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 12.5px; }
.paper td, .paper th { border-bottom: 1px solid #cfc5aa; padding: 5px 7px; text-align: left; vertical-align: top; }
.paper th { font-size: 11px; text-transform: uppercase; color: var(--paper-dim); }
.paper tr.hl td { background: #f7d98c; }
.paper .marker { margin: 12px 0; }
.paper .marker b { font-family: var(--mono); }
.paper .toolrow { font-family: var(--mono); font-size: 12px; margin: 0 0 12px; display: flex; gap: 10px; align-items: center; }
.paper .toolrow select { background: #fff9ea; color: var(--paper-ink); border-color: #cfc5aa; padding: 4px 6px; font-size: 12px; }
.paper .subidx { font-family: var(--mono); font-size: 11.5px; color: var(--paper-dim); margin-top: 12px; }
#mapcanvas { width: 100%; height: auto; background: #e6dcc2; border: 1px solid #cfc5aa; border-radius: 2px; cursor: crosshair; }

/* avatars (case photos) — portrait booking-photo aspect */
.avatar { width: 46px; height: 54px; border-radius: 3px; border: 1px solid var(--line); flex: none; display: block; object-fit: cover; }
.avatar.lg { width: 58px; height: 68px; }
.stmt-head { display: flex; align-items: center; gap: 12px; }
.stmt-head h2 { margin: 0; }
.bg-row { display: flex; gap: 12px; align-items: flex-start; margin: 12px 0; }
.bg-row .avatar { border-color: #cfc5aa; }
.bg-row .tag { vertical-align: middle; }
.sus-head { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; }
.sus-head h4 { margin: 0; }

/* interactive crime-scene diagram */
#scenecanvas { width: 100%; height: auto; background: #d8ceb4; border: 1px solid #cfc5aa; border-radius: 2px; cursor: pointer; margin-top: 6px; }
.scene-detail { font-family: var(--serif); font-size: 15px; line-height: 1.6; margin-top: 12px; min-height: 3em; padding: 12px 14px; background: #f4ecd8; border-left: 3px solid var(--red); border-radius: 2px; }
.scene-detail b { font-family: var(--mono); }
.paper .muted-ink { color: var(--paper-dim); font-family: var(--mono); font-size: 12px; }

/* visual case timeline (canvas) */
#tlcanvas { width: 100%; height: auto; background: #ece4cf; border: 1px solid #cfc5aa; border-radius: 2px; margin-top: 4px; }
.tl-legend { margin-top: 12px; font-size: 10.5px; color: var(--paper-dim); display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.tl-legend span { display: inline-block; width: 12px; height: 10px; border-radius: 2px; margin-left: 8px; }
.map-readout { font-family: var(--mono); font-size: 12.5px; margin-top: 8px; min-height: 1.4em; }

/* right rail */
.rail { border-left: 1px solid var(--line); background: var(--bg-raise); display: flex; flex-direction: column; min-height: 0; }
.rail-tabs { display: flex; border-bottom: 1px solid var(--line); flex: none; }
.rail-tabs button { flex: 1; background: none; border: none; border-radius: 0; padding: 10px 4px; color: var(--ink-dim); border-bottom: 2px solid transparent; font-size: 12px; }
.rail-tabs button.active { color: var(--amber); border-bottom-color: var(--amber); }
.rail-body { flex: 1; overflow-y: auto; padding: 12px; min-height: 0; }

.suspect-card { border: 1px solid var(--line); border-radius: 4px; padding: 10px 12px; margin-bottom: 10px; background: var(--bg-panel); }
.suspect-card.prime { border-color: var(--red); }
.suspect-card.cleared { opacity: .55; }
.suspect-card h4 { margin: 0; font-size: 13px; }
.suspect-card .rel { color: var(--ink-dim); font-size: 11.5px; margin: 2px 0 8px; }
.mmo { display: flex; gap: 10px; font-size: 11px; margin-bottom: 8px; }
.mmo label { display: flex; gap: 4px; margin: 0; align-items: center; text-transform: uppercase; cursor: pointer; }
.statusrow { display: flex; gap: 6px; margin-bottom: 8px; }
.statusrow button { flex: 1; padding: 3px 4px; font-size: 10.5px; }
.statusrow button.sel-cleared { color: var(--green); border-color: var(--green); }
.statusrow button.sel-prime { color: var(--red); border-color: var(--red); }
.suspect-card textarea { width: 100%; min-height: 40px; font-size: 12px; resize: vertical; }

.chat-log { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.chat-msg { font-size: 13px; }
.chat-msg .by { color: var(--amber); }
.chat-msg .at { color: var(--ink-dim); font-size: 10px; margin-left: 6px; }
.chat-form { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); flex: none; }
.chat-form input { flex: 1; }

.accuse-form select { width: 100%; margin-bottom: 4px; }
.giveup { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 12px; }
.giveup > button { width: 100%; border-color: var(--red); color: var(--red); }
.giveup > button:hover { background: rgba(192, 69, 62, .08); border-color: var(--red); }
.giveup p.muted { font-size: 11.5px; margin: 0 0 8px; }
.verdict { margin-top: 14px; padding: 12px; border-radius: 4px; border: 1px solid var(--line); font-size: 13px; }
.verdict.bad { border-color: var(--red); color: var(--red); }
.verdict.good { border-color: var(--green); color: var(--green); }

.banner { padding: 8px 18px; font-size: 13px; border-bottom: 1px solid var(--line); background: var(--bg-panel); }
.banner.win { color: var(--green); }
.banner.warn { color: var(--amber); }

/* actions panel */
.actions .act-h { color: var(--amber); font-size: 12px; letter-spacing: .12em; margin: 20px 0 4px; border-top: 1px solid var(--line); padding-top: 14px; }
.actions .act-h:first-of-type { border-top: none; padding-top: 0; }
.actions select { width: 100%; }
.actions button.primary { width: 100%; margin-top: 10px; }
.actions .act-out { margin-top: 8px; }
.actions p.muted { font-size: 11.5px; margin: 2px 0 6px; }
.lab-credits { font-size: 13px; letter-spacing: .08em; color: var(--amber); border: 1px dashed var(--amber-dim); border-radius: 4px; padding: 8px 10px; text-align: center; }

/* interrogation room */
.interrogation .muted-ink { color: var(--paper-dim); font-family: var(--mono); font-size: 12px; }
.qa { margin: 14px 0; }
.qa-q { font-family: var(--mono); font-size: 12.5px; color: var(--paper-dim); margin-bottom: 4px; }
.qa-a { font-size: 15px; }
.qa-a .tag { margin-left: 8px; }
.iq-controls { margin-top: 22px; border-top: 2px solid var(--paper-ink); padding-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.iq-controls button { background: #fff9ea; color: var(--paper-ink); border-color: #cfc5aa; font-family: var(--mono); }
.iq-controls button:hover { border-color: var(--paper-ink); color: var(--paper-ink); }
.iq-confront { display: flex; gap: 8px; }
.iq-confront select { flex: 1; background: #fff9ea; color: var(--paper-ink); border-color: #cfc5aa; }
.iq-confront button.primary { background: var(--paper-ink); color: var(--paper); border-color: var(--paper-ink); }

/* debrief */
.debrief { max-width: 760px; margin: 0 auto; }
.debrief .paper h2 { color: var(--red); border-color: var(--red); }
.timeline-row { display: grid; grid-template-columns: 200px 1fr; gap: 10px; font-family: var(--mono); font-size: 12.5px; padding: 4px 0; border-bottom: 1px dashed #cfc5aa; }

/* header help button */
button.ghost { background: none; border-color: var(--amber-dim); color: var(--amber); }
button.ghost:hover { background: var(--bg-panel); }

/* tutorial overlay */
.tut-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(6, 6, 9, .78); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.tut-card {
  position: relative; width: 100%; max-width: 460px; max-height: 88vh; overflow-y: auto;
  background: var(--bg-raise); border: 1px solid var(--line); border-radius: 8px;
  padding: 30px 28px 22px; box-shadow: 0 24px 70px rgba(0, 0, 0, .6);
  text-align: center;
}
.tut-x { position: absolute; top: 10px; right: 10px; background: none; border: none; color: var(--ink-dim); font-size: 15px; padding: 6px 8px; }
.tut-icon { font-size: 44px; line-height: 1; margin-bottom: 10px; }
.tut-step { color: var(--amber); font-size: 11px; letter-spacing: .18em; text-transform: uppercase; }
.tut-card h2 { font-size: 20px; letter-spacing: .06em; margin: 6px 0 12px; color: var(--ink); }
.tut-card p { font-size: 15px; line-height: 1.65; color: var(--ink); font-family: var(--serif); text-align: left; margin: 0 0 18px; }
.tut-card p b { color: var(--amber); font-family: var(--mono); font-size: 13.5px; }
.tut-dots { display: flex; gap: 7px; justify-content: center; margin-bottom: 18px; }
.tut-dots span { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.tut-dots span.on { background: var(--amber); }
.tut-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tut-actions .tut-skip { background: none; border: none; color: var(--ink-dim); }
.tut-nav { display: flex; gap: 8px; margin-left: auto; }

/* mobile bottom nav (phones only) */
.mobile-nav { display: none; }
.mobile-nav button {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: none; border: none; border-radius: 0; color: var(--ink-dim);
  font-size: 10.5px; letter-spacing: .06em; padding: 8px 2px; height: 100%;
}
.mobile-nav button.active { color: var(--amber); box-shadow: inset 0 2px 0 var(--amber); }
.mobile-nav .mn-ico { font-size: 19px; line-height: 1; }

/* ---- tablet ---- */
@media (max-width: 980px) and (min-width: 821px) {
  .desk { grid-template-columns: 200px 1fr 300px; }
}

/* ---- phones: one panel at a time + bottom nav ---- */
@media (max-width: 820px) {
  .topbar { padding: 9px 12px; gap: 10px; }
  .brand { font-size: 15px; letter-spacing: .18em; }
  .whoami { display: none; }
  button.ghost, #logout { padding: 7px 10px; font-size: 12px; }

  .desk { grid-template-columns: 1fr; }
  .desk-col, .rail { display: none; }
  .desk.m-files .doc-list { display: block; }
  .desk.m-doc .doc-view { display: block; }
  .desk.m-tools .rail { display: flex; }

  .doc-list { flex-direction: column; overflow-x: hidden; overflow-y: auto; border-right: none; }
  .doc-group { display: block; }
  .doc-item { padding: 12px 16px; font-size: 15px; }
  .doc-item .read { font-size: 14px; }

  .doc-view { padding: 14px 12px; }
  .paper { padding: 22px 16px; font-size: 15.5px; }
  .paper table { display: block; overflow-x: auto; white-space: nowrap; }

  .rail { border-left: none; }
  .rail-tabs button { padding: 12px 4px; font-size: 12px; }

  /* keep content clear of the fixed bottom nav */
  .doc-list, .doc-view, .rail-body { padding-bottom: 72px; }

  .mobile-nav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; height: 58px;
    background: var(--bg-raise); border-top: 1px solid var(--line); z-index: 60;
    padding-bottom: env(safe-area-inset-bottom, 0);
  }
  .banner { font-size: 12px; padding: 7px 12px; }

  /* bigger tap targets for the investigation controls */
  .suspect-card button, .actions button, .accuse-form button,
  .actions select, .accuse-form select, .iq-controls button, .chat-form input { min-height: 42px; }
  .tut-card { padding: 26px 20px 18px; }
  .tut-card h2 { font-size: 18px; }
}
