/* NOIR — «ملف تحقيق حقيقي» (approved 2026-11-14).
   A detective's desk at night: a green blotter for the shell, manila folders and paper
   sheets for content, red stamps for states, and a yellow numbered evidence marker for
   "do this next". Loaded after style.css / tutorial.css / scene.css and wins over them. */

:root {
  --desk: #10221d; --desk-2: #16302a; --desk-3: #1d3b33;
  --manila: #e5cd98; --manila-2: #d6b97c; --manila-edge: #b2924f; --manila-ink: #3d3220;
  --marker: #f5c518; --marker-ink: #15130f;
  --stamp: #c3352a; --carbon: #2e4b8a;

  --ink: #0c1b17; --ink-2: #16302a; --ink-3: #1e3c34;
  --line: #2a473e; --line-2: #3b5e52;
  --fog: #a9bdb3; --smoke: #dcd8ca; --title: #f3ecd8;
  --paper: #f7f0de; --paper-2: #efe5cb; --paper-ink: #1e1a14; --paper-soft: #574e3f; --paper-line: #ddd0ae;
  --blood: #e0574b; --blood-2: #b5362c;
  --amber: #f5c518; --neon: #93b4f4; --ok: #6fcf8f;
  --radius: 12px;
  --shadow: 0 14px 30px -14px rgba(0, 0, 0, .7);
  --f-body: "Almarai", system-ui, "Segoe UI", Tahoma, sans-serif;
  --f-head: "Noto Kufi Arabic", "Almarai", sans-serif;
  --f-quote: "Almarai", system-ui, sans-serif;
  --f-hand: "Aref Ruqaa", "Almarai", serif;
  --f-type: "Special Elite", "Courier New", monospace;
  --bar-h: 66px;
  --primary: #f5c518; --primary-ink: #15130f;
  --page-bg: radial-gradient(1200px 700px at 75% -10%, #1f4137 0%, #10221d 55%) fixed, #10221d;
  --bar-bg: rgba(10, 23, 20, .97);
  --card-grad: #16302a;
  --mine-bg: #2c3a1a; --mine-line: #66702c;
  --tl-text: #f3ecd8; --tl-grid: #2f4d43; --tl-grid-2: #213c34;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --desk: #e6e0cf; --desk-2: #fbf7ec; --desk-3: #f1ead8;
  --ink: #efe9da; --ink-2: #fbf7ec; --ink-3: #f2ebd9;
  --line: #ddd3bc; --line-2: #c9bc9f;
  --fog: #5e5646; --smoke: #2f2a22; --title: #1b1712;
  --paper: #fffaf0; --paper-2: #f5ecd6;
  --blood: #b3261e; --blood-2: #9c2a20;
  --amber: #8a6400; --neon: #2e4b8a; --ok: #2f7a4a;
  --primary: #f5c518; --primary-ink: #15130f;
  --page-bg: #e6e0cf;
  --bar-bg: rgba(251, 247, 236, .97);
  --card-grad: #fbf7ec;
  --mine-bg: #fbf0c8; --mine-line: #e2c96a;
  --shadow: 0 10px 24px -14px rgba(60, 45, 20, .45);
  --tl-text: #1b1712; --tl-grid: #d9d0bc; --tl-grid-2: #ebe4d4;
  color-scheme: light;
}

/* ------------------------------------------------------------ base */
body { font-size: 16px; line-height: 1.65; -webkit-tap-highlight-color: transparent; }
::selection { background: var(--marker); color: var(--marker-ink); }
:focus-visible { outline: 2px solid var(--marker); outline-offset: 2px; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--marker); outline-offset: 1px; }
* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
h1, h2, h3 { font-weight: 700; letter-spacing: 0; }
.hint { color: var(--fog); }
a { color: var(--neon); text-underline-offset: 3px; }
input, textarea, select { border-radius: 10px; border-color: var(--line-2); background: var(--ink); min-height: 44px; }
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--fog) 85%, transparent); }
.mono { font-family: var(--f-type); }

/* ------------------------------------------------------------ buttons */
.btn { border-radius: 10px; min-height: 42px; font-weight: 700; border-color: var(--line-2); background: var(--ink-3); }
.btn.primary { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); font-weight: 800; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { background: var(--stamp); border-color: var(--stamp); color: #fff6ec; }
.btn.danger:hover { background: #d43c30; }
.btn.small { min-height: 32px; border-radius: 8px; }
.btn.big { border-radius: 12px; padding: .85em 1.4em; }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-color: var(--line-2); color: var(--title); flex: none; }
.icon-btn svg { width: 18px; height: 18px; }
.chip-btn { color: var(--marker); border-color: color-mix(in srgb, var(--marker) 60%, transparent); background: transparent; }
:root[data-theme="light"] .chip-btn { color: var(--amber); }

/* the yellow numbered evidence marker */
.marker { flex: none; width: 34px; height: 34px; display: grid; place-items: center; padding-top: 6px;
  background: var(--marker); color: var(--marker-ink); font: 800 1.05rem/1 var(--f-head);
  clip-path: polygon(22% 0, 78% 0, 100% 100%, 0 100%); }
.marker.sm { width: 28px; height: 28px; font-size: .9rem; padding-top: 5px; }

/* stamps: states are stamped, never just coloured text */
.stamp { display: inline-block; font: 700 .74rem/1.3 var(--f-head); padding: 2px 8px; border: 2px solid currentColor; border-radius: 4px;
  transform: rotate(-4deg); white-space: nowrap; }
.stamp.red { color: var(--blood); } .stamp.green { color: var(--ok); } .stamp.blue { color: var(--neon); }

/* ------------------------------------------------------------ shell */
.appbar { padding: 10px 16px; background: var(--bar-bg); border-bottom-color: var(--line); }
.logo { width: 40px; height: 40px; border-radius: 10px; box-shadow: none; border-color: var(--line-2); }
.online-pill { border: 0; padding: 0; color: var(--fog); font-size: .85rem; }
.online-pill i { box-shadow: none; background: #4fc27a; }
.me-chip { border-radius: 999px; background: var(--ink-3); border-color: var(--line-2); min-height: 40px; }
.page { max-width: 760px; padding: 18px 16px calc(var(--bar-h) + 40px); }
#page-leaders, #page-profile, #page-player { max-width: 900px; }

.bottombar { height: auto; padding: 8px 4px calc(10px + env(safe-area-inset-bottom)); background: var(--bar-bg); border-top-color: var(--line); }
.bottombar button { font-size: .72rem; min-height: 48px; color: var(--fog); }
.bottombar svg { width: 24px; height: 24px; }
.bottombar button.active { color: var(--marker); }
.bottombar button.active::before { top: -8px; width: 30px; background: var(--marker); }
:root[data-theme="light"] .bottombar button.active { color: var(--title); }

/* ------------------------------------------------------------ home */
.hero-folder { position: relative; margin: 30px 0 16px; padding: 22px 18px 16px; border-radius: 4px 4px 14px 14px;
  background: var(--manila); color: var(--paper-ink); box-shadow: var(--shadow); }
.folder-tab { position: absolute; bottom: 100%; inset-inline-start: 0; padding: 4px 18px 2px; border-radius: 10px 10px 0 0;
  background: var(--manila); font: .8rem/1.6 var(--f-type); color: var(--manila-ink); }
.hero-folder h1 { color: var(--paper-ink); font-size: clamp(1.5rem, 5.4vw, 2.1rem); line-height: 1.35; margin: 0 0 6px; text-wrap: balance; }
.hero-folder > p { margin: 0; color: var(--manila-ink); font-size: .95rem; max-width: 52ch; }
.hero-folder .mode-pills { margin: 16px 0 12px; gap: 4px; padding: 4px; border-radius: 12px; background: var(--manila-2); }
.hero-folder .pill { background: transparent; border: 0; color: var(--paper-ink); border-radius: 9px; padding: .55em .2em .45em; font-weight: 800; min-height: 48px; }
.hero-folder .pill small { color: var(--manila-ink); font-weight: 400; }
.hero-folder .pill.active { background: var(--paper); box-shadow: 0 2px 8px rgba(70, 45, 10, .28); color: var(--paper-ink); }
.cta { display: flex; align-items: center; gap: 12px; width: 100%; border: 0; border-radius: 12px; padding: 14px 16px; cursor: pointer;
  background: var(--paper-ink); color: var(--paper); font: 800 1.15rem/1.25 var(--f-body); text-align: start; transition: transform .12s, filter .15s; }
.cta:hover { filter: brightness(1.25); }
.cta:active { transform: translateY(1px); }
.cta-text { flex: 1; }
.cta-text small { display: block; font-weight: 400; font-size: .8rem; color: #d3c9b1; margin-top: 3px; }
.cta-arrow { width: 22px; height: 22px; flex: none; }
[dir="ltr"] .cta-arrow { transform: scaleX(-1); }
.hero-folder .seed-box { margin-top: 10px; }
.hero-folder .seed-box summary { color: var(--manila-ink); font-size: .85rem; }
.hero-folder .seed-box input { background: var(--paper); color: var(--paper-ink); border-color: var(--manila-edge); }

/* daily case: an index card taped to the desk */
.daily-teaser { position: relative; margin: 0 0 8px; padding: 14px 16px; border: 0; border-radius: 6px; gap: 14px;
  background: repeating-linear-gradient(to bottom, transparent 0 25px, var(--paper-line) 25px 26px) 0 40px / 100% no-repeat, var(--paper);
  color: var(--paper-ink); box-shadow: var(--shadow); }
.daily-teaser::after { content: ""; position: absolute; top: -9px; inset-inline-end: 30px; width: 74px; height: 20px; background: rgba(214, 200, 150, .75); transform: rotate(-4deg); }
.daily-teaser b { color: var(--paper-ink); font-family: var(--f-head); font-size: 1.05rem; }
.daily-teaser .hint { color: var(--paper-soft); }
.daily-teaser .daily-num { color: var(--stamp); font-family: var(--f-head); font-weight: 700; letter-spacing: 0; }
.daily-teaser .btn { background: var(--stamp); color: #fff6ec; border-color: var(--stamp); }

.sec-head { margin: 26px 0 10px; }
.sec-head h2, .block-head h2 { font-size: 1.1rem; margin: 0; }
.actions { grid-template-columns: 1fr 1fr; gap: 12px; }
.action { background: var(--ink-2); border-color: var(--line); border-radius: 16px; padding: 16px; box-shadow: none; gap: 10px; }
.action.accent { border-color: var(--line); }
.action-head { flex-direction: column; gap: 8px; }
.action-head h2 { font-size: 1.1rem; }
.action-head p { font-size: .85rem; line-height: 1.55; }
.ic { width: 26px; height: 26px; padding: 0; background: none; border: 0; color: var(--marker); }
.accent .ic { color: var(--marker); }
:root[data-theme="light"] .ic { color: var(--carbon); }
.online-mini { font-size: .82rem; color: var(--fog); }
.online-mini b { color: var(--title); }
.join-row { grid-template-columns: minmax(0, 1fr) auto; }

.block { margin-top: 26px; }
.block-head { border-bottom: 0; margin-bottom: 10px; }
.recent { gap: 8px; }
.recent-item { gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--ink-2); }
.recent-item::before { content: ""; align-self: stretch; width: 7px; flex: none; border-radius: 3px; background: var(--manila-2); }
.recent-item > div:first-of-type { flex: 1; min-width: 0; }
.recent-item .r-title { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag { font-family: var(--f-head); font-weight: 700; border-radius: 4px; border-width: 1.5px; }
.tag.closed { color: var(--ok); border-color: var(--ok); transform: rotate(-4deg); }
.tag.quick { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 60%, transparent); }
.tag.standard { color: var(--marker); border-color: color-mix(in srgb, var(--marker) 60%, transparent); }
:root[data-theme="light"] .tag.standard { color: var(--amber); }
.tag.detective { color: var(--blood); border-color: color-mix(in srgb, var(--blood) 60%, transparent); }
.mode-info { grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mode-info div { background: var(--ink-2); border-radius: 12px; padding: 12px; font-size: .88rem; }
.mode-info .mono, .mode-card .mono { color: var(--marker); }
:root[data-theme="light"] .mode-info .mono, :root[data-theme="light"] .mode-card .mono { color: var(--amber); }
.social-row { margin-top: 26px; gap: 8px; }
.social-row .social-btn { flex: 1 1 160px; background: transparent; font-size: .9rem; padding: .7em 1em; }
.social-btn .ic { width: 1.2em; height: 1.2em; color: var(--title); }
.guide-links { border-top-color: var(--line); font-size: .88rem; }

.guest-save { border: 1px dashed color-mix(in srgb, var(--marker) 55%, transparent); background: transparent; border-radius: 12px; padding: 10px 14px; margin: 4px 0 6px; }
.guest-save b { color: var(--title); font-size: .95rem; }
.guest-save .hint { font-size: .82rem; }
.guest-save .btn { min-height: 36px; padding: .3em 1em; }

/* online, leaderboard, daily pages */
.welcome h1 { font-size: clamp(1.5rem, 5vw, 2rem); }
.mode-cards { grid-template-columns: repeat(3, 1fr); }
.mode-card { background: var(--ink-2); border-color: var(--line); border-radius: 14px; }
.mode-card.active { border-color: var(--marker); box-shadow: inset 0 0 0 1px var(--marker); }
.stat-box, .player-stats > div { background: var(--ink-2); }
.stat-box b, .player-stats b { font-variant-numeric: tabular-nums; }
.lb { border-radius: 14px; background: var(--ink-2); font-variant-numeric: tabular-nums; }
.lb th { background: var(--ink-3); font-weight: 700; }
.lb tr.me td { background: color-mix(in srgb, var(--marker) 10%, transparent); }
.daily-hero { background: var(--paper); color: var(--paper-ink); border: 0; box-shadow: var(--shadow); }
.daily-hero h2, .daily-hero .daily-stats b, .daily-hero .daily-countdown { color: var(--paper-ink); }
.daily-hero .hint, .daily-hero .daily-stats span { color: var(--paper-soft); }
.daily-hero .daily-num { color: var(--stamp); font-family: var(--f-head); font-weight: 700; }
.daily-hero .daily-streak { color: var(--stamp); }
.daily-hero .btn:not(.primary) { background: var(--paper-2); color: var(--paper-ink); border-color: var(--paper-line); }

/* ------------------------------------------------------------ profile: the detective's ID card */
.player-hero { background: var(--paper); color: var(--paper-ink); border: 0; border-radius: 16px; box-shadow: var(--shadow); position: relative; overflow: hidden; padding-top: 52px; }
.player-hero::before { content: "بطاقة محقق · شرطة ڤالمورا"; position: absolute; top: 0; inset-inline: 0; padding: 8px 18px; background: var(--carbon); color: #fff;
  font: 700 .8rem/1.6 var(--f-head); text-align: start; }
[lang="en"] .player-hero::before { content: "Detective ID · Valmora Police"; }
.player-id h1, .player-rank b { color: var(--paper-ink); }
.player-sub, .player-rank span { color: var(--paper-soft); }
.player-rank { border-color: var(--paper-line); }
.title-chip { color: var(--carbon); border-color: color-mix(in srgb, var(--carbon) 45%, transparent); background: color-mix(in srgb, var(--carbon) 8%, transparent); }
.avatar.xl { box-shadow: 0 0 0 4px var(--paper), 0 0 0 6px var(--manila-edge); border-radius: 12px; }
.player-stats { border-radius: 14px; }
.profile-head { position: relative; overflow: hidden; background: var(--paper); color: var(--paper-ink); border-radius: 16px; padding: 50px 16px 16px; box-shadow: var(--shadow); }
.profile-head::before { content: "بطاقة محقق · شرطة ڤالمورا"; position: absolute; top: 0; inset-inline: 0; padding: 7px 16px; background: var(--carbon); color: #fff; font: 700 .8rem/1.6 var(--f-head); }
[lang="en"] .profile-head::before { content: "Detective ID · Valmora Police"; }
.profile-head h1, .profile-head h2 { color: var(--paper-ink); }
.profile-head .hint, .profile-head .career-title { color: var(--paper-soft); }
.profile-head .btn:not(.primary) { background: var(--paper-2); color: var(--paper-ink); border-color: var(--paper-line); }
.friend { background: var(--ink-2); border-radius: 12px; padding: 10px 12px; }
.friend .f-acts .btn { min-height: 34px; }
.dot-online { background: #4fc27a; }
.avatar-grid .pick { background: var(--ink-2); }
.avatar-grid .pick.on { border-color: var(--marker); box-shadow: inset 0 0 0 1px var(--marker); }
.career-bar i { background: var(--marker); }

/* ------------------------------------------------------------ room lobby */
.room-code .code { border-color: var(--marker); background: var(--ink); }
.room-kind { color: var(--marker); }
.member { background: var(--ink); border-radius: 12px; }
.member .host { color: var(--marker); border-color: var(--marker); }
.bubble .who { color: var(--marker); }
:root[data-theme="light"] .room-kind, :root[data-theme="light"] .bubble .who, :root[data-theme="light"] .member .host { color: var(--amber); border-color: var(--amber); }
.card { background: var(--ink-2); border-color: var(--line); border-radius: var(--radius); }

/* ------------------------------------------------------------ game */
.topbar { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto auto; align-items: center; gap: 10px 14px; padding: 10px 16px; background: var(--bar-bg); }
.case-crime { color: var(--fog); font-size: .74rem; letter-spacing: .04em; }
.topbar h1 { font-size: 1.15rem; line-height: 1.4; }
.tb-stats { gap: 6px; }
.stat { flex-direction: row; gap: 8px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--ink-2); }
.stat-k { font-size: .68rem; max-width: 5.5em; line-height: 1.2; }
.stat-v { font-family: var(--f-body); font-weight: 800; font-variant-numeric: tabular-nums; }
.tb-actions { gap: 6px; }
.tb-actions .btn { min-height: 40px; padding: .35em .8em; }
#btn-accuse { font-family: var(--f-head); }

.next-step { display: flex; align-items: center; gap: 12px; max-width: 1600px; margin: 12px auto 0; width: calc(100% - 32px); padding: 10px 12px;
  border-radius: 12px; background: color-mix(in srgb, var(--marker) 10%, var(--ink-2)); border: 1px solid color-mix(in srgb, var(--marker) 45%, transparent);
  animation: ns-in .4s cubic-bezier(.2, .9, .3, 1) both; }
@keyframes ns-in { from { opacity: 0; transform: translateY(-6px); } }
.next-step p { margin: 0; flex: 1; min-width: 0; font-size: .85rem; line-height: 1.45; color: var(--smoke); }
.next-step p b { display: block; color: var(--title); font-size: .98rem; }
.next-step .btn { background: var(--marker); color: var(--marker-ink); border-color: var(--marker); flex: none; }

.layout { gap: 16px; }
.tabs .tab { border-radius: 10px; min-height: 42px; }
.tabs .tab.active { background: var(--ink-3); border-color: var(--line-2); color: var(--title); box-shadow: inset -3px 0 0 var(--marker); }
[dir="ltr"] .tabs .tab.active { box-shadow: inset 3px 0 0 var(--marker); }
.tab .badge { background: var(--stamp); font-family: var(--f-body); font-weight: 700; }
.feed { background: var(--ink-2); border-radius: var(--radius); }
.feed-item.director { color: var(--marker); }
:root[data-theme="light"] .feed-item.director { color: var(--amber); }
.feed-modal { max-height: 60vh; overflow: auto; }

.gnav, .more-sheet { display: none; }

/* the case file */
.file { background: var(--paper); border-radius: 4px; font-family: var(--f-body); font-size: 1.02rem; line-height: 1.8; padding: 24px 22px 20px; }
.file::before { font-family: var(--f-head); color: var(--stamp); border-color: var(--stamp); font-size: 1.05rem; }
.file h2 { font-size: 1.5rem; line-height: 1.35; margin-top: 6px; }
.file .stamp-line { color: var(--paper-soft); border-bottom: 2px solid var(--paper-ink); padding-bottom: 8px; margin-bottom: 10px; }
.file .narr { border-color: var(--stamp); font-style: normal; font-family: var(--f-hand); font-size: 1.15rem; color: var(--carbon); }
.objectives span { border-radius: 4px; font-weight: 700; }
.incident { border-right: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--ink-2); }
.incident b { color: var(--blood); }
.incident.linked b { color: var(--marker); }

/* places */
.plan { background: var(--ink-2); border-radius: 14px; }
.plan-room { background: var(--ink); border-radius: 10px; }
.plan-room:hover { border-color: var(--marker); }
.plan-room.here { box-shadow: 0 0 0 3px color-mix(in srgb, var(--marker) 55%, transparent); }
.plan-name { color: var(--title); }
.spot-progress i { background: var(--marker); }
.spot { border-radius: 12px; }
.spot:hover { border-color: var(--marker); }
.spot-name { color: var(--title); }
.spot-state { color: var(--marker); }
:root[data-theme="light"] .spot-state, :root[data-theme="light"] .plan-room.here { color: var(--amber); }

/* interrogation: a typed transcript */
.chat { background: var(--paper); border: 0; color: var(--paper-ink);
  background-image: repeating-linear-gradient(to bottom, transparent 0 31px, var(--paper-line) 31px 32px); }
.chat-log { gap: 12px; }
.chat .q { background: var(--paper-ink); color: var(--paper); border: 0; border-radius: 14px 14px 14px 4px; }
.chat .a { background: #fff; color: var(--paper-ink); border: 1px solid var(--paper-line); border-radius: 14px 14px 4px 14px; font-family: var(--f-body); font-size: 1rem; line-height: 1.7; }
[dir="ltr"] .chat .q { border-radius: 14px 14px 4px 14px; }
[dir="ltr"] .chat .a { border-radius: 14px 14px 14px 4px; }
.chat .a.nervous { background: #fff6d6; border-color: #e8cf6c; box-shadow: none; }
.chat .a.angry, .chat .a.hostile { border-color: color-mix(in srgb, var(--stamp) 55%, transparent); box-shadow: none; }
.chat .a.broken { background: #fbe1dc; }
.chat .a .a-meta { color: var(--paper-soft); }
.chat .typing { color: var(--paper-soft); }
.chat-empty { color: var(--paper-soft); font-family: var(--f-hand); font-size: 1.25rem; }
.chat .chips { padding: 10px 12px 0; border-top: 1px solid var(--paper-line); background: var(--paper-2); }
.chat .chip { background: var(--paper); color: var(--paper-ink); border-color: var(--paper-line); border-radius: 999px; min-height: 34px; }
.chat .chip:hover { border-color: var(--paper-ink); }
.chat .composer, .chat .present-row { background: var(--paper-2); border-top-color: var(--paper-line); }
.chat .composer input, .chat .present-row select, .chat .chips select { background: #fff; color: var(--paper-ink); border-color: var(--paper-line); }
.chat .present-row .btn, .chat .composer .btn:not(.primary) { background: var(--paper); color: var(--paper-ink); border-color: var(--paper-line); }
.dossier { background: var(--ink-2); border-radius: 14px; }
.pillar.on { color: var(--blood); border-color: var(--blood); }
.meter > i { background: var(--marker); }
.meter.trust > i { background: var(--neon); }
.gave { color: var(--ok); }
.chat .gave { color: #2d6a3f; }
.event-pill { background: var(--stamp); }
.i-stage { border-radius: 14px; }
.i-bubble { font-family: var(--f-body); }

/* evidence: pinned paper with a red pin */
.evidence { border-radius: 4px; box-shadow: var(--shadow); }
.evidence .e-desc { font-family: var(--f-body); font-size: .98rem; line-height: 1.75; }
.evidence::after { background: var(--stamp); }
.choice.on { border-color: var(--marker); background: color-mix(in srgb, var(--marker) 12%, transparent); color: var(--title); }
.contra { border-right: 0; border: 1px solid color-mix(in srgb, var(--marker) 45%, transparent); }
.contra.high { border-color: color-mix(in srgb, var(--blood) 55%, transparent); }
.contra .c-head { font-family: var(--f-head); letter-spacing: 0; color: var(--marker); }
:root[data-theme="light"] .contra .c-head { color: var(--amber); }
.notes-area { font-family: var(--f-body); background: repeating-linear-gradient(to bottom, var(--paper) 0 31px, var(--paper-line) 31px 32px); line-height: 32px; padding-top: 6px; }
.debrief { font-family: var(--f-body); border-radius: 4px; line-height: 1.85; }

/* verdict: the stamp is the headline */
.verdict-sheet { position: relative; text-align: center; background: var(--paper); color: var(--paper-ink); border-radius: 4px; padding: 26px 18px 18px; box-shadow: var(--shadow); }
.big-stamp { display: inline-block; font: 800 clamp(1.6rem, 6vw, 2.2rem)/1.15 var(--f-head); color: var(--stamp); border: 4px solid var(--stamp); border-radius: 8px;
  padding: 10px 20px 8px; transform: rotate(-7deg); margin: 4px 0 18px; opacity: .92;
  animation: stamp-in .45s cubic-bezier(.16, 1, .3, 1) both .1s; }
.big-stamp.fail { color: #5b5242; border-color: #5b5242; }
@keyframes stamp-in { from { opacity: 0; transform: rotate(-7deg) scale(1.8); } }
.verdict-sheet .verdict-row { display: grid; grid-template-columns: repeat(2, 1fr); border-top: 2px solid var(--paper-ink); border-bottom: 2px solid var(--paper-ink); margin: 6px 0 14px; }
.verdict-sheet .verdict-row > div { padding: 10px 0; }
.verdict-sheet .verdict-row > div + div { border-inline-start: 1px solid var(--paper-line); }
.verdict-sheet .verdict-row b { display: block; font: 800 1.9rem/1.2 var(--f-head); font-variant-numeric: tabular-nums; }
.verdict-sheet .verdict-row span { font-size: .78rem; color: var(--paper-soft); }
.verdict-sheet .consequence { font-size: 1.05rem; line-height: 1.75; margin: 0; }
.verdict-sheet .by { margin-top: 12px; font-size: .8rem; color: var(--paper-soft); text-align: start; }
.verdict-sheet .by span { font-family: var(--f-hand); color: var(--carbon); font-size: 1.25rem; margin-inline-start: 6px; }
.part .ok { color: var(--ok); } .part .no { color: var(--blood); }
@media (prefers-reduced-motion: reduce) { .big-stamp, .next-step { animation: none; } }

/* modal, toasts, invites */
.modal { background: rgba(4, 10, 8, .74); }
.modal-card { background: var(--ink-2); border-color: var(--line-2); border-radius: 18px; }
.toast { border-right: 0; border: 1px solid color-mix(in srgb, var(--marker) 55%, transparent); border-radius: 12px; background: var(--ink-3); color: var(--title); }
.toast.bad { border-color: color-mix(in srgb, var(--blood) 65%, transparent); }
.toast.good { border-color: color-mix(in srgb, var(--ok) 60%, transparent); }
.invite-card { border-color: var(--marker); background: var(--ink-3); }
.gen-status { background: rgba(8, 18, 15, .92); }
.gen-line { color: var(--marker); }
.spinner { border-top-color: var(--marker); }
.drawer { background: var(--ink-2); }
.dev-name { color: #f2c14e !important; }

/* ------------------------------------------------------------ phones */
@media (max-width: 860px) {
  .actions { grid-template-columns: 1fr 1fr; }
  .mode-info, .mode-cards { grid-template-columns: 1fr; }

  /* game top bar: [exit][title][accuse] then a row of meters and small actions */
  .topbar { grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "exit title accuse" "stats stats stats"; padding: 8px 12px 10px; gap: 8px 10px; flex-wrap: nowrap; }
  #btn-exit { grid-area: exit; }
  .case-id { grid-area: title; }
  #btn-accuse { grid-area: accuse; padding: .4em .9em; min-height: 40px; font-size: .9rem; }
  .tb-stats { grid-area: stats; order: 0; width: auto; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; justify-content: flex-start; }
  .tb-stats::-webkit-scrollbar { display: none; }
  .stat { flex: none; padding: 3px 9px; }
  .stat-k { max-width: none; white-space: nowrap; }
  .topbar { backdrop-filter: none; }
  .tb-actions #btn-lang, .tb-actions #btn-dialect, .tb-actions #btn-sound { display: none; }
  .more-list .more-set { font-weight: 400; color: var(--fog); grid-column: 1 / -1; min-height: 46px; }
  body:has(#more-sheet:not([hidden])) .phone-btn, body:has(#more-sheet:not([hidden])) .phone { display: none; }
  .more-list .more-set b { color: var(--title); font-weight: 700; font-size: .85rem; }
  .tb-actions { position: fixed; top: auto; bottom: calc(var(--bar-h) + 14px + env(safe-area-inset-bottom)); inset-inline-end: 12px; z-index: 17; flex-direction: column; gap: 8px; }
  .tb-actions .btn, .tb-actions .icon-btn { width: 44px; height: 44px; min-height: 44px; padding: 0; border-radius: 50%; display: grid; place-items: center;
    background: var(--ink-3); border-color: var(--line-2); box-shadow: 0 6px 16px rgba(0, 0, 0, .4); font-size: .8rem; }
  .tb-actions #btn-chat > span:not(.badge), .tb-actions #btn-dialect span { display: none; }
  .tb-actions #btn-chat .badge { position: absolute; top: -4px; inset-inline-end: -4px; }
  .tb-actions #btn-chat { position: relative; }
  .topbar h1 { font-size: 1.02rem; }
  .case-crime { font-size: .68rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .next-step { width: calc(100% - 24px); margin-top: 10px; }

  .layout { padding: 12px 12px calc(var(--bar-h) + 24px + env(safe-area-inset-bottom)); }
  .tabs { display: none; }
  .feed { display: none; }
  .gnav { display: grid; position: fixed; bottom: 0; left: 0; right: 0; z-index: 16; grid-template-columns: repeat(5, 1fr);
    padding: 8px 4px calc(10px + env(safe-area-inset-bottom)); background: var(--bar-bg); border-top: 1px solid var(--line); }
  .gnav button { font: inherit; background: none; border: 0; color: var(--fog); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    font-size: .7rem; font-weight: 700; min-height: 48px; position: relative; cursor: pointer; }
  .gnav button span:not(.dot) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .gnav svg { width: 23px; height: 23px; }
  .gnav button.on { color: var(--marker); }
  :root[data-theme="light"] .gnav button.on { color: var(--title); }
  .gnav button.on::before { content: ""; position: absolute; top: -8px; width: 30px; height: 3px; border-radius: 0 0 3px 3px; background: var(--marker); }
  .gnav .dot { position: absolute; top: 0; inset-inline-end: calc(50% - 22px); min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--stamp); color: #fff; font-size: .62rem; line-height: 16px; text-align: center; }
  .more-sheet:not([hidden]) { display: flex; position: fixed; inset: 0; z-index: 21; align-items: flex-end; background: rgba(4, 10, 8, .6); }
  .more-card { width: 100%; background: var(--ink-2); border-radius: 20px 20px 0 0; padding: 14px 16px calc(18px + env(safe-area-inset-bottom)); animation: sheet-up .22s ease-out; }
  @keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } }
  .more-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
  .more-head h2 { margin: 0; font-size: 1.1rem; }
  .more-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .more-list button { font: inherit; font-weight: 700; display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: 52px; padding: 10px 14px;
    background: var(--ink-3); color: var(--title); border: 1px solid var(--line); border-radius: 12px; cursor: pointer; text-align: start; }
  .more-list button.on { border-color: var(--marker); }

  /* keep the detective's phone and toasts above the bottom menu */
  .phone-btn { bottom: calc(var(--bar-h) + 14px + env(safe-area-inset-bottom)); left: 12px; }
  .phone { bottom: calc(var(--bar-h) + 80px); }
  body:has(#gnav:not(:empty)) .toasts, body:has(#phone-btn:not([hidden])) .toasts { bottom: calc(var(--bar-h) + 74px); }

  .file { padding: 20px 16px 16px; }
  .file::before { top: 12px; left: 12px; font-size: .9rem; }
  .chat { min-height: 0; }
  .interro > *, .chat, .view { min-width: 0; }
  .interro .chat { order: -1; }
  .interro .dossier .hint:first-of-type, .interro .dossier .rel { font-size: .82rem; }
  .chat-log { max-height: 52vh; }
  .chat .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 8px; }
  .chat .chip { flex: none; }
  .i-stage { grid-template-columns: 110px minmax(0, 1fr); min-height: 0; padding: 12px 12px 0; gap: 0 10px; }
  .i-bubble { font-size: .95rem; padding: 10px 12px; margin-bottom: 20px; }
}
@media (max-width: 420px) {
  .actions { grid-template-columns: 1fr 1fr; gap: 10px; }
  .action { padding: 14px 12px; }
  .action .btn.big { font-size: .92rem; padding: .7em .6em; }
  .join-row { grid-template-columns: 1fr; }
}

/* badges on the profile and the result screen (store.badges, app.js BADGE_ART) */
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.badge-tile { position: relative; overflow: hidden; display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center;
  padding: 12px 8px 14px; border-radius: 12px; background: var(--ink-2); border: 1px solid var(--line); opacity: .55; filter: grayscale(1); }
.badge-tile.have { opacity: 1; filter: none; border-color: color-mix(in srgb, var(--marker) 55%, transparent);
  background: color-mix(in srgb, var(--marker) 9%, var(--ink-2)); }
.badge-tile .badge-icon { font-size: 30px; line-height: 1; }
.badge-tile b { font-size: 13px; color: var(--title); }
.badge-tile .hint { font-size: 11px; }
.badge-tile i { position: absolute; inset-inline-start: 0; bottom: 0; height: 3px; background: var(--marker); }
.badge-tile.new { animation: badge-pop .6s cubic-bezier(.2, 1.6, .4, 1) both; }
@keyframes badge-pop { from { transform: scale(.6); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .badge-tile.new { animation: none; } }
