/* Murderdle: a case file on old paper, typewriter testimony, oxblood ink */
@font-face { font-family: "Special Elite"; font-display: swap; src: url(fonts/special-elite-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Playfair Display"; font-weight: 700; font-display: swap; src: url(fonts/playfair-display-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: "Playfair Display"; font-weight: 900; font-display: swap; src: url(fonts/playfair-display-latin-900-normal.woff2) format("woff2"); }
@font-face { font-family: "Playfair Display"; font-style: italic; font-weight: 400; font-display: swap; src: url(fonts/playfair-display-latin-400-italic.woff2) format("woff2"); }

:root {
  --bg: #F1E6D0;
  --paper: #FBF5E8;
  --paper2: #EADDC3;
  --ink: #231A16;
  --muted: #6E5E52;
  --line: #D9C9AA;
  --blood: #8E1B1B;
  --brass: #A87A1E;
  --teal: #1F5E66;
  --good: #2E7D4F;
  --bad: #B3261E;
  --display: "Playfair Display", Georgia, serif;
  --type: "Special Elite", "Courier New", monospace;
  --ui: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
    --bg: #15110F; --paper: #211A16; --paper2: #2C231D; --ink: #EFE3CF; --muted: #B3A28F; --line: #3D3129;
    --blood: #E0605A; --brass: #D9A845; --teal: #6FBAC2; --good: #6CC48E; --bad: #FF7B72; color-scheme: dark;
  }
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--ui); line-height: 1.45; min-height: 100vh; min-height: 100dvh; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--brass); outline-offset: 2px; }
[hidden] { display: none !important; }

.wrap { max-width: 620px; margin: 0 auto; padding: 0 14px; }
.top { display: flex; justify-content: space-between; align-items: center; padding: 10px 0 0; }
.back { text-decoration: none; color: var(--muted); font-size: 0.95rem; }
.top-actions { display: flex; gap: 4px; }
.icon-btn { width: 40px; height: 40px; border-radius: 10px; border: 0; background: transparent; cursor: pointer; display: grid; place-items: center; font-weight: 700; font-size: 1.1rem; }
.icon-btn:hover { background: var(--paper); }
.icon-btn svg .fill { fill: currentColor; stroke: none; }
.icon-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.title-row { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; column-gap: 10px; padding: 4px 0 8px; }
h1 { font-family: var(--display); font-weight: 900; font-size: 2.3rem; margin: 0; line-height: 1; letter-spacing: -0.01em; }
h1::after { content: "."; color: var(--blood); }
.sub { margin: 0; color: var(--muted); font-size: 0.95rem; }

.card { background: var(--paper); border-radius: 6px; padding: 18px 16px; border: 1px solid var(--line); box-shadow: 0 1px 0 var(--line), 0 18px 30px -26px rgba(35, 26, 22, .6); }
.kicker { margin: 0; color: var(--blood); font-weight: 700; font-size: 0.78rem; letter-spacing: 0.12em; text-transform: uppercase; }
.go { display: block; width: 100%; border: 0; border-radius: 8px; padding: 14px; background: var(--ink); color: var(--paper); font-weight: 800; font-size: 1.08rem; cursor: pointer; }
.go.ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink); }
.go:disabled { opacity: .5; cursor: default; }
.fine { color: var(--muted); font-size: 0.85rem; text-align: center; margin: 10px 0 0; }
.hint { color: var(--muted); font-size: 0.9rem; margin: 2px 0 12px; }
.sec { font-family: var(--display); font-weight: 700; font-size: 1.2rem; margin: 18px 0 8px; }
.link-btn { border: 0; background: none; color: var(--muted); padding: 6px 0; cursor: pointer; font-size: 0.95rem; }

/* highlighted names, rooms and times inside text */
.k-r { color: var(--teal); font-weight: 700; }
.k-t { color: var(--brass); font-weight: 700; white-space: nowrap; }
.k-p { color: var(--blood); font-weight: 700; }

/* case card */
.case { position: relative; overflow: hidden; }
.case .kicker { padding-right: 84px; }
.case::before { content: "CONFIDENTIAL"; position: absolute; right: -44px; top: 16px; transform: rotate(18deg); font: 700 0.7rem var(--ui); letter-spacing: .2em; color: var(--blood); border: 2px solid var(--blood); padding: 3px 40px; opacity: .55; }
.case-title { font-family: var(--display); font-weight: 900; font-size: 1.7rem; line-height: 1.1; margin: 4px 0 8px; }
.blurb { margin: 0 0 12px; font-family: var(--display); font-style: italic; font-size: 1.02rem; }
.victim { display: flex; gap: 12px; align-items: center; background: var(--paper2); border-radius: 6px; padding: 10px; }
.victim-pic { flex: 0 0 64px; }
.victim-text { margin: 0; font-size: 0.93rem; }
.portrait { display: block; width: 100%; height: auto; border-radius: 6px; }

/* tabs */
.tabs { position: sticky; top: 0; z-index: 5; display: flex; gap: 2px; margin: 14px -14px 12px; padding: 8px 14px; background: var(--bg); border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { flex: 1 0 auto; border: 0; background: transparent; padding: 9px 10px; border-radius: 6px; font-weight: 700; font-size: 0.92rem; color: var(--muted); cursor: pointer; white-space: nowrap; }
.tabs button[aria-selected="true"] { background: var(--ink); color: var(--paper); }
.tabs .count { font-weight: 600; opacity: .8; }

/* clues: an icon, the fact as a tag, a short line under it */
.clues { display: grid; gap: 6px; }
.clue { display: flex; gap: 8px; align-items: flex-start; background: var(--paper); border: 1px solid var(--line); border-left: 4px solid var(--blood); border-radius: 4px; padding: 7px 10px; }
.clue .ci { flex: 0 0 auto; font-size: 1.05rem; line-height: 1.3; }
.clue .cb { display: grid; min-width: 0; }
.clue .cg { font-size: 0.92rem; }
.clue .ct { font-family: var(--type); font-size: 0.82rem; color: var(--muted); }
.clue-tod { border-left-color: var(--brass); }
.clue-photo, .clue-herring, .clue-locked { border-left-color: var(--teal); }

/* rooms */
.rooms { display: grid; gap: 8px; }
.room { background: var(--paper); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; display: grid; gap: 6px; }
.room-head { display: flex; align-items: center; gap: 8px; min-height: 36px; }
.room .rn { font-family: var(--display); font-weight: 700; font-size: 1.08rem; }
.room .tag { font: 700 0.7rem var(--ui); letter-spacing: .08em; text-transform: uppercase; color: var(--paper); background: var(--blood); border-radius: 4px; padding: 3px 6px; }
.room .search { margin-left: auto; border: 1px dashed var(--muted); background: var(--bg); border-radius: 6px; padding: 7px 14px; cursor: pointer; font-weight: 700; font-size: 0.9rem; }
.room .search:hover:not(:disabled) { border-style: solid; border-color: var(--ink); }
.room .search:disabled { cursor: default; opacity: .6; }
.room .nothing { margin: 0; color: var(--muted); font-family: var(--type); font-size: 0.85rem; }
.room .clue { background: var(--bg); }
.body-box { border: 2px solid var(--blood); border-radius: 6px; padding: 8px 10px 10px; margin-bottom: 12px; background: color-mix(in srgb, var(--blood) 6%, var(--paper)); }
.body-box .bb-h { margin: 0 0 6px; font-family: var(--display); font-size: 1rem; color: var(--blood); }

/* suspects: one card each; their story shows under them once asked */
.people { display: grid; gap: 8px; }
.pcard { display: grid; gap: 6px; border: 1px solid var(--line); background: var(--paper); border-radius: 6px; padding: 8px 10px; }
.ptop { display: flex; gap: 10px; align-items: center; }
.ppic { flex: 0 0 56px; }
.ppic .portrait.talk { animation: bob .5s ease-in-out 2; }
@keyframes bob { 50% { transform: translateY(-2px); } }
.pwho { display: grid; gap: 1px; min-width: 0; }
.pcard .pn { font-weight: 800; font-size: 0.95rem; line-height: 1.2; }
.pcard .po { font-size: 0.8rem; color: var(--muted); line-height: 1.25; }
.pcard.struck .pn { text-decoration: line-through; text-decoration-color: var(--blood); text-decoration-thickness: 2px; }
.chips { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 3px; }
.chip { font-size: 0.72rem; border: 1px solid var(--line); border-radius: 10px; padding: 1px 7px; background: var(--bg); color: var(--muted); }
.chip.match { border-color: var(--blood); color: var(--blood); font-weight: 700; }
.pcard .say { margin: 0; font-family: var(--type); font-size: 0.88rem; }
.tl { display: grid; gap: 2px; font-size: 0.86rem; background: var(--bg); border-radius: 6px; padding: 6px 8px; }
.tl-row { display: grid; grid-template-columns: 3.2em 1fr 1fr; gap: 6px; }
.tl-w { color: var(--muted); }
.tl-saw { margin: 3px 0 0; }
.qbtn { border: 1px solid var(--ink); background: var(--bg); border-radius: 8px; padding: 9px 12px; cursor: pointer; font-weight: 700; font-size: 0.92rem; }
.qbtn:hover:not(:disabled) { background: var(--ink); color: var(--paper); }
.qbtn:disabled { cursor: default; opacity: .6; border-color: var(--line); }
.iv-occ { margin: 4px 0 0; color: var(--muted); font-size: 0.92rem; }
.dossier { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; margin: 0 0 12px; padding: 10px 12px; background: var(--paper); border: 1px solid var(--line); border-radius: 6px; font-size: 0.88rem; }
.dossier dt { color: var(--muted); font-weight: 700; }
.dossier dd { margin: 0; }
.transcript { display: grid; gap: 8px; margin-bottom: 12px; }
.qa { display: grid; gap: 4px; }
.qa .q { justify-self: end; background: var(--ink); color: var(--paper); border-radius: 12px 12px 2px 12px; padding: 7px 11px; font-size: 0.9rem; max-width: 85%; }
.qa .a { justify-self: start; background: var(--paper); border: 1px solid var(--line); border-radius: 12px 12px 12px 2px; padding: 9px 12px; font-family: var(--type); font-size: 0.97rem; max-width: 92%; }
.empty-note { color: var(--muted); font-size: 0.9rem; font-style: italic; }
.rules { margin: 0; padding-left: 20px; display: grid; gap: 6px; font-size: 0.93rem; }

/* notes grid: everyone's story, filled in as you question them */
.grid-wrap { overflow-x: auto; margin: 0 -14px; padding: 0 14px; }
.grid { border-collapse: collapse; width: 100%; table-layout: fixed; font-size: 0.72rem; line-height: 1.2; }
.grid th, .grid td { border: 1px solid var(--line); padding: 3px 2px; text-align: center; vertical-align: top; hyphens: auto; -webkit-hyphens: auto; }
.grid th { background: var(--paper2); font-weight: 700; }
.grid thead th button { border: 0; background: none; cursor: pointer; font-weight: 700; padding: 4px 0; width: 100%; }
.grid th.who { text-align: left; width: 22%; }
.grid th.who button { border: 0; background: none; cursor: pointer; font-weight: 700; text-align: left; padding: 0; overflow-wrap: anywhere; }
.grid tr.struck th.who button { text-decoration: line-through; color: var(--muted); }
.grid .hot { background: color-mix(in srgb, var(--brass) 22%, var(--paper)); }
.grid td span { display: block; overflow-wrap: anywhere; }   /* a long room name ("Commissary") ran into the next cell on a phone */
.grid .cr { font-weight: 700; color: var(--teal); }
.grid .cw, .grid .cq { color: var(--muted); }
.grid .cf { font-weight: 700; }
.grid td.fact { box-shadow: inset 0 0 0 2px var(--teal); }
.grid .empty-row th, .grid .empty-row td { background: var(--paper2); }
.legend { margin: 6px 0 0; color: var(--muted); font-size: 0.8rem; }
.t-sofar { list-style: none; margin: 0 0 10px; padding: 8px 12px; background: var(--paper); border: 1px solid var(--line); border-radius: 6px; display: grid; gap: 2px; font-size: 0.9rem; }
.t-sofar li.ahead { color: var(--muted); }
.notes-label { display: block; font-weight: 700; margin: 14px 0 6px; }
textarea { width: 100%; border: 1px solid var(--line); background: var(--paper); border-radius: 6px; padding: 10px; font-family: var(--type); resize: vertical; }

/* trial */
#trial-intro p { margin: 0 0 10px; }
.hearts { display: flex; gap: 4px; justify-content: center; font-size: 1.5rem; margin-bottom: 10px; }
.hearts span { transition: transform .3s, opacity .3s; }
.hearts span.lost { opacity: .25; transform: scale(.8); filter: grayscale(1); }
.stage { display: flex; gap: 12px; align-items: flex-end; background: var(--paper); border: 1px solid var(--line); border-radius: 6px; padding: 12px; margin-bottom: 12px; min-height: 92px; }
.stage .s-pic { flex: 0 0 80px; }
.stage .s-say { font-family: var(--type); font-size: 0.98rem; margin: 0; }
.stage .s-who { display: block; font: 800 0.8rem var(--ui); color: var(--blood); margin-bottom: 2px; }
.stage.shake { animation: shake .45s; }
@keyframes shake { 20% { transform: translateX(-8px); } 40% { transform: translateX(7px); } 60% { transform: translateX(-5px); } 80% { transform: translateX(3px); } }
.t-q { font-family: var(--display); font-weight: 700; font-size: 1.3rem; text-align: center; margin: 4px 0 12px; }
.t-opts { display: grid; gap: 8px; }
.t-opts.cols { grid-template-columns: 1fr 1fr; }
.opt { border: 2px solid var(--line); background: var(--paper); border-radius: 8px; padding: 11px 12px; cursor: pointer; font-weight: 700; text-align: left; }
.opt:hover:not(:disabled) { border-color: var(--ink); }
.opt.wrong { border-color: var(--bad); color: var(--bad); text-decoration: line-through; cursor: default; }
.opt.right { border-color: var(--good); background: color-mix(in srgb, var(--good) 14%, var(--paper)); }
.opt .ol { display: block; font-weight: 500; font-size: 0.83rem; color: var(--muted); }
.opt.pers { display: flex; gap: 10px; align-items: center; padding: 8px; }
.opt.pers .op { flex: 0 0 48px; }
.opt.unfound { opacity: .55; font-weight: 600; }
.objection { position: fixed; inset: 0; display: grid; place-items: center; pointer-events: none; z-index: 60; }
.objection span { font: 900 clamp(2.6rem, 13vw, 5rem) var(--display); color: #fff; background: var(--blood); padding: 6px 22px; transform: rotate(-8deg) scale(.4); opacity: 0; border: 4px solid #fff; box-shadow: 0 10px 0 rgba(0,0,0,.25); }
.objection.show span { animation: pop 1s ease-out forwards; }
@keyframes pop { 0% { opacity: 0; transform: rotate(-8deg) scale(.4); } 15% { opacity: 1; transform: rotate(-8deg) scale(1.08); } 25% { transform: rotate(-8deg) scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: rotate(-8deg) scale(1); } }

/* results */
.done { margin-top: 12px; }
.big { font-family: var(--display); font-weight: 900; font-size: 2.1rem; line-height: 1.1; margin: 6px 0; }
.res-line { margin: 0 0 12px; }
.marks { display: grid; gap: 4px; margin-bottom: 14px; font-size: 0.92rem; }
.marks div { display: flex; justify-content: space-between; border-bottom: 1px dotted var(--line); padding: 3px 0; }
.explain { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 10px; }
.explain summary { cursor: pointer; font-weight: 700; }
.explain p, .explain li { font-size: 0.92rem; }
.explain ul { padding-left: 18px; margin: 6px 0; }

/* ads */
.ad-inline { margin-top: 26px; }
.ad-slot { display: block; margin: 0 auto; overflow: hidden; }
.ad-banner { width: 100%; max-width: 728px; min-height: 100px; }
.ad-slot.placeholder { border: 1.5px dashed var(--line); border-radius: 12px; display: grid; place-items: center; color: var(--muted); font-size: 0.85rem; }
.ad-slot.placeholder::before { content: "Ad space " attr(data-size); }
.ad-slot.collapsed { min-height: 0; }
.ad-slot ins[data-ad-status="unfilled"] { display: none !important; }
.ad-label { font-size: 11px; color: var(--muted); text-align: center; margin: 0 0 4px; }

.foot { display: flex; justify-content: center; flex-wrap: wrap; gap: 22px; padding: 26px 0 40px; color: var(--muted); font-size: 0.9rem; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 8px; opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none; z-index: 50; max-width: 90vw; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.dlg { border: 0; border-radius: 10px; padding: 22px; width: min(440px, calc(100vw - 32px)); background: var(--paper); color: var(--ink); }
.dlg::backdrop { background: rgba(20, 12, 8, .55); }
.dlg h2 { font-family: var(--display); font-weight: 900; margin: 0 0 10px; font-size: 1.6rem; }
.dlg p { color: var(--muted); }
.dlg .rules { margin-bottom: 12px; }
.dlg .x { position: absolute; right: 10px; top: 8px; border: 0; background: transparent; font-size: 26px; cursor: pointer; color: var(--muted); width: 40px; height: 40px; }
/* the close button is 44px and rides along when a tall help sheet scrolls on a phone (as on the other games) */
.dlg > form:first-child { position: sticky; top: 22px; height: 0; margin: 0; z-index: 3; background: inherit; }
.dlg .x { top: -16px; right: -14px; width: 44px; height: 44px; border-radius: 50%; background: inherit; touch-action: manipulation; }
.dlg .row { display: flex; gap: 10px; }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin: 0; }
.stats div { display: flex; flex-direction: column-reverse; background: var(--bg); border-radius: 8px; padding: 10px; }
.stats dt { color: var(--muted); font-size: 0.85rem; }
.stats dd { margin: 0; font-size: 1.4rem; font-weight: 800; font-variant-numeric: tabular-nums; }

/* casting room */
.creator { display: grid; gap: 12px; min-width: 0; }
.creator > * { min-width: 0; }
.cr-top { display: flex; gap: 14px; align-items: center; }
.cr-pic { flex: 0 0 140px; }
.cr-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cr-controls label { min-width: 0; display: grid; gap: 2px; font-size: 0.78rem; font-weight: 700; color: var(--muted); }
.cr-controls select, .cr-controls input { width: 100%; min-width: 0; border: 1px solid var(--line); background: var(--paper); border-radius: 6px; padding: 7px 8px; font-size: 0.9rem; color: var(--ink); font-weight: 500; }
.cr-lines { display: grid; gap: 8px; }
.cr-lines .qa .a { max-width: 100%; }
.cr-row { display: flex; gap: 8px; }
.cr-row .go { flex: 1; }
.lineup { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.lineup button { border: 1px solid var(--line); background: var(--paper); border-radius: 6px; padding: 4px; cursor: pointer; }

@media (prefers-reduced-motion: reduce) { .stage.shake, .ppic .portrait.talk, .objection.show span { animation: none; } .toast, .hearts span { transition: none; } }
/* the site's theme, archive and leaderboard buttons join the header: keep it on one line on phones */
.back { white-space: nowrap; }
.top-actions { flex-wrap: nowrap; }
@media (max-width: 430px) { .top-actions { gap: 0; } .icon-btn { width: 34px; height: 38px; } .icon-btn svg { width: 20px; height: 20px; } }
/* all five tabs fit a phone, also once the case file shows its count, so Trial never hides off the edge */
@media (max-width: 430px) { .tabs { gap: 0; padding-left: 8px; padding-right: 8px; } .tabs button { padding: 9px 5px; font-size: 0.84rem; } }
