/* Dagens jullucka. Colours per calendar come from theme.css (generated from client/brand.ts). */
@font-face { font-family: Fraunces; src: url(/fonts/fraunces.woff2) format('woff2'); font-weight: 100 900; font-display: swap; }

:root {
  --muted: color-mix(in srgb, var(--fg) 74%, var(--bg));
  --line: color-mix(in srgb, var(--fg) 16%, var(--bg));
  --surface: color-mix(in srgb, var(--fg) 5%, var(--bg));
  /* The front of a card: paper for the kids, the card colour for the dark themes. */
  --paper: var(--card); --ink: var(--fg); --rule: var(--frame);
  --right: #2f7d46; --wrong: #b3261e;
  --serif: Fraunces, Georgia, 'Times New Roman', serif;
  --flip: .7s;
}
/* The kids' green is darkened a little in the UI so cream text on it passes WCAG AA (4.5:1). */
[data-cal='barn'] { --card: #37704a; --paper: #fffaf0; --ink: #2b2420; --rule: #37704a; --right: #2f6e3f; --wrong: #a52a21; }
[data-cal='klurigt'], [data-cal='mord'] { --right: #7fd19a; --wrong: #ff9b8f; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--fg);
  font: 17px/1.55 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  padding: max(12px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(32px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}
[data-cal='barn'] body { font-size: 18px; }
/* A faint snowfall pattern behind the kids' calendar. */
[data-cal='barn'] body {
  background-image: radial-gradient(circle at 20% 30%, #fff 0 2px, transparent 3px), radial-gradient(circle at 70% 80%, #fff 0 1.5px, transparent 2.5px);
  background-size: 90px 90px, 140px 140px;
}
main { max-width: 34rem; margin: 0 auto; }
h1, h2, .num { font-family: var(--serif); font-weight: 640; letter-spacing: -.01em; line-height: 1.15; }
a { color: var(--accent-text); text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--accent-text); outline-offset: 3px; border-radius: 6px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.muted { color: var(--muted); }
.notice { padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }

/* ---------- header and footer ---------- */
.top { display: flex; align-items: center; gap: 8px; min-height: 56px; margin-bottom: 8px; }
.top h1 { flex: 1; display: flex; align-items: center; gap: 10px; margin: 0; font-size: 1.45rem; }
.top h1 img { flex: none; }
.site { font-size: 1.7rem !important; }
.back-link, .icon-btn {
  flex: none; display: grid; place-items: center; min-width: 48px; min-height: 48px; border-radius: 50%;
  color: var(--fg); text-decoration: none; font-size: 1.4rem; background: none; border: 0; cursor: pointer; padding: 0;
}
.icon-btn svg { width: 26px; height: 26px; }
.icon-btn[aria-pressed='false'] { color: var(--muted); }
nav.top .back-link { width: auto; border-radius: 12px; font-size: 1rem; padding: 0 8px; }
.lead { font-size: 1.1rem; margin: 0 0 20px; color: var(--muted); }
.foot { display: flex; flex-wrap: wrap; gap: 4px 20px; justify-content: center; margin-top: 40px; }
.foot a { display: inline-flex; align-items: center; min-height: 48px; color: var(--muted); }
.page h1 { font-size: 1.8rem; }
.page li { margin-bottom: 8px; }

/* ---------- start page ---------- */
.calendars { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.cal-card {
  display: flex; align-items: center; gap: 16px; padding: 14px 18px 14px 12px; border-radius: 22px; text-decoration: none;
  background: var(--bg); color: var(--fg); border: 1px solid var(--line); box-shadow: 0 1px 0 var(--line), 0 10px 24px -18px #0006;
  transition: transform .2s ease;
}
.cal-card:hover { transform: translateY(-2px); }
.cal-card b { display: block; font-family: var(--serif); font-size: 1.3rem; font-weight: 640; }
.cal-card .status { display: block; font-size: .95rem; }
/* Each card wears its calendar's colours (theme.css sets them per data-cal). */
.cal-card[data-cal] { background: var(--bg); color: var(--fg); }
.cal-card[data-cal] .status { color: var(--accent-text); }

/* ---------- score, countdown, sections ---------- */
.score { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: baseline; margin: 0 0 12px; }
.score span { color: var(--muted); font-size: .95rem; }
.countdown { text-align: center; color: var(--muted); margin: 18px 0 8px; min-height: 1.5em; }
.section { font-size: 1.2rem; margin: 32px 0 12px; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.section .stars { font: 500 .9rem/1.2 system-ui, sans-serif; color: var(--muted); white-space: nowrap; }

/* ---------- the card ---------- */
.card { position: relative; display: block; width: 100%; border-radius: 24px; color: var(--ink); }
.card-back {
  position: relative; background: var(--card); color: var(--frame); border: 0; font: inherit; padding: 0; cursor: pointer; text-decoration: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center; aspect-ratio: 4 / 5;
  box-shadow: 0 18px 40px -24px #000a, inset 0 0 0 1px #ffffff10;
}
.card-back::before { content: ''; position: absolute; inset: 5.5%; border: 3px solid var(--frame); border-radius: 14px; pointer-events: none; }
.pip { position: absolute; width: 10px; height: 10px; border-radius: 50%; background: var(--frame); }
.pip.tl { top: 10%; left: 10%; } .pip.tr { top: 10%; right: 10%; } .pip.bl { bottom: 10%; left: 10%; } .pip.br { bottom: 10%; right: 10%; }
.card-back .motif { width: 26%; color: var(--accent); margin-bottom: 4%; }
.card-back .kicker { font: 600 .85rem/1 system-ui, sans-serif; letter-spacing: .14em; text-transform: uppercase; }
.card-back .num { font-size: clamp(5rem, 30vw, 9.5rem); line-height: .95; font-weight: 700; }
.card-back .label { font-size: 1rem; margin-top: 2%; }
.card-back .meta { position: absolute; top: 13%; right: 15%; color: var(--accent); font-size: 1.3rem; }
.card-back .check { position: absolute; bottom: 11%; right: 13%; width: 1.6em; height: 1.6em; display: grid; place-items: center; border-radius: 50%; background: var(--frame); color: var(--card); font-weight: 700; }
[data-cal='barn'] .card-back .motif { color: #f2c14e; }
.open-cta {
  margin-top: 6%; min-height: 48px; padding: 0 26px; display: inline-grid; place-items: center; border-radius: 999px;
  background: var(--frame); color: var(--card); font-weight: 700; font-size: 1.2rem; box-shadow: 0 6px 16px -8px #000a;
}
.card-back:hover .open-cta { filter: brightness(1.08); }
.big { max-width: 26rem; margin: 0 auto; }
.locked { cursor: default; opacity: .9; }

/* Flip: both faces share one grid cell; the back may stretch to the height of the front. */
.flip { perspective: 1800px; max-width: 30rem; margin: 0 auto; }
.flip > .card { grid-area: 1 / 1; }
.flip { display: grid; }
.flip > .card { backface-visibility: hidden; -webkit-backface-visibility: hidden; transition: transform var(--flip) cubic-bezier(.3,.7,.2,1), opacity .3s; }
.flip .card-back { max-width: none; align-self: start; }
.flip .front { transform: rotateY(-180deg); }
.flip.open .card-back { transform: rotateY(180deg); }
.flip.open .front { transform: rotateY(0); }
.flip:not(.open) .front { max-height: 0; overflow: hidden; visibility: hidden; }
.flip.open .card-back { pointer-events: none; aspect-ratio: auto; align-self: stretch; }

.front { background: var(--paper); padding: 30px 26px 26px; box-shadow: 0 18px 40px -24px #000a; }
.front::before { content: ''; position: absolute; inset: 10px; border: 1.5px solid var(--rule); border-radius: 16px; pointer-events: none; opacity: .7; }
.corner { position: absolute; width: 38px; height: 38px; color: var(--rule); pointer-events: none; }
.corner svg { width: 100%; height: 100%; display: block; }
.corner.tl { top: 8px; left: 8px; } .corner.tr { top: 8px; right: 8px; transform: scaleX(-1); }
.corner.br { bottom: 8px; right: 8px; transform: scale(-1); } .corner.bl { bottom: 8px; left: 8px; transform: scaleY(-1); }
.glyphs { position: absolute; inset: 10px; pointer-events: none; }
.glyphs span { position: absolute; transform: translate(-50%, -50%); background: var(--paper); padding: 0 3px; font: 600 .8rem/1 var(--serif); color: var(--rule); opacity: .45; }

.door-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 2px 12px; margin-bottom: 14px; }
.door-head h2 { margin: 0; font-size: 1.5rem; outline: none; }
.door-head .type { font-weight: 450; }
.door-head .date { color: color-mix(in srgb, var(--ink) 75%, var(--paper)); font-size: .95rem; }
.door-head .meta { color: var(--accent); }
.door-img { display: block; width: 100%; height: auto; border-radius: 12px; margin: 0 0 16px; background: color-mix(in srgb, var(--ink) 8%, var(--paper)); }
.story { position: relative; margin: 0 0 14px; padding: 12px 14px 12px 52px; border-radius: 14px; background: color-mix(in srgb, var(--rule) 10%, var(--paper)); font-style: italic; }
.story::before { content: ''; position: absolute; left: 12px; top: 12px; width: 30px; height: 30px; background: url(/brand/barn.svg) center / 150% no-repeat; border-radius: 8px; }
.question { font-size: 1.15em; font-weight: 600; margin: 0 0 16px; overflow-wrap: anywhere; }
[data-cal='klurigt'] .question, [data-cal='mord'] .question { font-weight: 500; }

/* ---------- answer, hint, actions ---------- */
button, input, select { font: inherit; }
.answer { display: flex; gap: 8px; flex-wrap: wrap; }
.answer input, select {
  flex: 1 1 11rem; min-width: 0; min-height: 52px; padding: 0 14px; font-size: max(16px, 1em); border-radius: 14px;
  border: 2px solid color-mix(in srgb, var(--ink) 28%, var(--paper)); background: var(--paper); color: var(--ink);
}
.answer input:focus { border-color: var(--rule); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--rule) 30%, transparent); }
.answer input:disabled { opacity: .7; }
.primary, .ghost { min-height: 52px; padding: 0 20px; border-radius: 14px; cursor: pointer; font-weight: 650; }
.primary { border: 0; background: var(--rule); color: var(--paper); }
[data-cal='klurigt'] .primary, [data-cal='mord'] .primary { color: var(--card); }
.primary:disabled { cursor: default; opacity: .85; }
.ghost { background: transparent; color: var(--ink); border: 1.5px solid color-mix(in srgb, var(--ink) 30%, var(--paper)); font-weight: 550; min-height: 48px; }
.ghost:disabled { opacity: .7; cursor: default; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.actions:empty { display: none; }
.feedback { min-height: 1.6em; margin: 10px 0 0; font-weight: 600; position: relative; }
.feedback.right { color: var(--right); }
.feedback.wrong { color: var(--wrong); }
.reveal-text { margin: 12px 0 0; padding: 12px 14px; border-radius: 12px; background: color-mix(in srgb, var(--accent) 16%, var(--paper)); }
.mission { margin-top: 18px; padding-top: 14px; border-top: 1.5px dashed color-mix(in srgb, var(--rule) 50%, var(--paper)); }
.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.fly-star { position: absolute; left: 0; top: -4px; font-size: 1.8rem; pointer-events: none; z-index: 5; }

/* ---------- earlier doors ---------- */
.doors { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 10px; }
.mini { border-radius: 14px; }
.mini::before { inset: 7%; border-width: 2px; border-radius: 8px; }
.mini .pip { width: 5px; height: 5px; }
.mini .motif { width: 30%; margin-bottom: 2%; }
.mini .kicker, .mini .label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.mini .num { font-size: 2.2rem; }
.mini .meta { font-size: .8rem; top: 11%; right: 14%; }
.mini .check { width: 1.4em; height: 1.4em; font-size: .75rem; bottom: 9%; right: 11%; }
.mini.current { outline: 3px solid var(--accent-text); outline-offset: 3px; }

/* ---------- the kids' puzzle ---------- */
.pieces { max-width: 22rem; margin: 0 auto; display: grid; grid-template-columns: repeat(4, 1fr); aspect-ratio: 4 / 5; border-radius: 18px; overflow: hidden; background: color-mix(in srgb, var(--card) 14%, var(--bg)); gap: 2px; padding: 2px; }
.piece { background: color-mix(in srgb, var(--card) 20%, var(--bg)); border-radius: 4px; }
.piece.on { background-image: var(--img); background-size: 400% 600%; background-position: calc(var(--x) * 100% / 3) calc(var(--y) * 100% / 5); }
.piece.pop { animation: pop .6s; }
@keyframes pop { 50% { transform: scale(1.12); } }

/* ---------- murder guess ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 18px; margin: 24px 0 0; }
.panel h2 { margin: 0 0 8px; font-size: 1.25rem; }
.panel label { display: block; margin-top: 12px; }
.panel select { width: 100%; margin-top: 4px; --paper: var(--bg); --ink: var(--fg); }

@media (min-width: 700px) {
  body { padding-top: max(24px, env(safe-area-inset-top)); }
  .front { padding: 38px 36px 32px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  /* No 3D turn: the front simply replaces the back. */
  .flip .front, .flip.open .card-back, .flip.open .front { transform: none; }
  .flip.open .card-back { opacity: 0; }
}

/* ---------- murder: tabs, evidence, notes, guess ---------- */
.tabs { display: flex; gap: 4px; padding: 4px; margin: 0 0 16px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); }
.tabs a { flex: 1; display: grid; place-items: center; min-height: 48px; border-radius: 12px; text-decoration: none; color: var(--muted); font-weight: 600; }
.tabs a[aria-current] { background: var(--card); color: var(--fg); box-shadow: inset 0 0 0 1.5px var(--frame); }
.open-static { margin: 0 0 24px; }

.evidence { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; margin: 0 0 8px; }
.evidence h3 { font-family: var(--serif); font-weight: 640; margin: 0; font-size: 1.15rem; }
.evidence p { margin: 0 0 .7em; }
.evidence p:last-child { margin-bottom: 0; }
.ev-text { line-height: 1.6; }
.zoomable { display: block; position: relative; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; border-radius: 10px; overflow: hidden; }
.zoomable img { display: block; width: 100%; height: auto; }
.zoomable time { position: absolute; right: 8px; bottom: 8px; padding: 2px 8px; border-radius: 6px; background: #000b; color: #ffb25e; font: 700 .9rem/1.4 ui-monospace, 'Courier New', monospace; }

/* Newspaper page: masthead, dateline, headline, ingress, byline, photo, body with drop cap, pull quote, fact box, notices. */
.news { background: #f1ece0; color: #1b1916; padding: 16px 16px 20px; border-radius: 2px; transform: rotate(-.4deg); box-shadow: 0 12px 26px -18px #000;
  font-family: Georgia, 'Times New Roman', serif; background-image: linear-gradient(#0000 0 0), radial-gradient(#0000000a 1px, #0000 1px); background-size: auto, 4px 4px; }
.news .masthead { display: grid; justify-items: center; gap: 2px; padding-bottom: 6px; border-bottom: 1px solid #1b1916; }
.news .paper { font: 900 clamp(1.6rem, 7vw, 2.3rem)/1 'Times New Roman', Georgia, serif; letter-spacing: -.02em; }
.news .edition { font: 600 .68rem/1.3 system-ui, sans-serif; letter-spacing: .06em; text-transform: uppercase; color: #4a453d; text-align: center; }
.news .dateline { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 12px; margin: 0 0 12px !important; padding: 4px 0; border-bottom: 3px double #1b1916;
  font: 700 .72rem/1.3 system-ui, sans-serif; letter-spacing: .08em; text-transform: uppercase; }
.news .dateline span { white-space: nowrap; }
.news .section { color: #8d1c1c; }
.news h3 { font: 800 clamp(1.5rem, 6.4vw, 2rem)/1.08 Georgia, serif; letter-spacing: -.015em; margin-bottom: 10px; }
.news .lead { font: 700 1.02rem/1.45 Georgia, serif; color: inherit; margin: 0 0 .6em; }
.news .byline { font: 600 .78rem/1.3 system-ui, sans-serif; color: #4a453d; border-top: 1px solid #b8ae9a; padding-top: 6px; }
.news-fig { margin: 10px 0 12px; }
.news .news-img { border-radius: 0; filter: grayscale(.85) contrast(1.05); }
.news-fig figcaption { margin-top: 4px; font: .8rem/1.35 system-ui, sans-serif; color: #3d3831; }
.news .credit { color: #6a6358; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; }
.news .cols p { font-size: .98rem; line-height: 1.5; hyphens: auto; -webkit-hyphens: auto; }
.news .cols > p:first-child::first-letter { float: left; font: 800 3.1rem/.85 Georgia, serif; margin: 4px 6px 0 0; }
.news .pull { margin: 12px 0; padding: 8px 0; border-block: 2px solid #1b1916; font: italic 700 1.2rem/1.3 Georgia, serif; text-align: center; }
.news .pull p { text-align: center !important; }
.news .facts { margin-top: 14px; padding: 12px 14px; background: #e3dccb; border-top: 4px solid #8d1c1c; font: .9rem/1.45 system-ui, sans-serif; }
.news h4 { font: 800 .78rem/1.2 system-ui, sans-serif; letter-spacing: .1em; text-transform: uppercase; margin: 0 0 6px; }
.news .briefs { margin-top: 16px; padding-top: 8px; border-top: 3px double #1b1916; display: grid; gap: 10px; }
.news .briefs h5 { font: 800 .98rem/1.2 Georgia, serif; margin: 0 0 2px; }
.news .briefs p { font-size: .9rem; line-height: 1.45; }
@media (min-width: 640px) {
  .news .cols { columns: 2; column-gap: 22px; column-rule: 1px solid #c9bfa9; }
  .news .cols p { text-align: justify; }
  .news .pull { break-inside: avoid; }
  .news .briefs { grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); column-gap: 18px; }
  .news .briefs h4 { grid-column: 1 / -1; }
}

/* Official document (crime scene report, autopsy): letterhead, title and reference, metadata, sections, signature. */
.report { background: #fbfaf7; color: #1d1c1a; padding: 20px 18px 16px; border-radius: 3px; box-shadow: 0 12px 26px -18px #000, 0 0 0 1px #0000000f;
  font: .95rem/1.5 Arial, 'Helvetica Neue', system-ui, sans-serif; }
.report .letterhead { display: flex; align-items: center; gap: 10px; padding-bottom: 10px; margin-bottom: 14px; border-bottom: 2px solid #1f3a5f; }
.report .crest { flex: none; width: 34px; height: 34px; border-radius: 50%; border: 3px double #1f3a5f; background: radial-gradient(circle, #1f3a5f 0 4px, #0000 5px); }
.report .auth { display: grid; font-size: .78rem; line-height: 1.3; color: #3a3a3a; }
.report .auth b { font-size: .9rem; letter-spacing: .06em; text-transform: uppercase; color: #1f3a5f; }
.report .doc-title { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 12px; margin-bottom: 12px; }
.report h3 { font: 700 1.1rem/1.3 Arial, system-ui, sans-serif; text-transform: uppercase; letter-spacing: .04em; }
.report .ref { color: #555; font: .82rem/1.3 ui-monospace, 'Courier New', monospace; }
.report dl { display: grid; grid-template-columns: minmax(6.5rem, min(38%, 11rem)) 1fr; gap: 0; margin: 0; border: 1px solid #c9c6bf; font-size: .88rem; }
.report dt, .report dd { padding: 5px 8px; border-bottom: 1px solid #e0ddd6; }
.report dt { color: #555; background: #f1efe9; font-weight: 600; overflow-wrap: anywhere; hyphens: auto; -webkit-hyphens: auto; }
.report dd { margin: 0; }
.report .notes { margin-top: 12px; }
.report section { margin-top: 16px; }
.report h4 { font: 700 .82rem/1.3 Arial, system-ui, sans-serif; letter-spacing: .06em; text-transform: uppercase; color: #1f3a5f; margin: 0 0 6px; padding-bottom: 3px; border-bottom: 1px solid #c9c6bf; }
.report .signed { margin-top: 20px; display: grid; justify-items: start; gap: 0; }
.report .signed p { margin: 0 !important; font-size: .85rem; }
.report .signed .sig { font: italic 1.5rem/1.2 'Segoe Script', 'Bradley Hand', 'Brush Script MT', cursive; color: #1f3a5f; margin: 6px 0 2px !important; transform: rotate(-2deg); }
.report .doc-foot { margin-top: 16px !important; padding-top: 6px; border-top: 1px solid #c9c6bf; font-size: .72rem; color: #666; }
.stamp { display: inline-block; margin: 0 0 12px; padding: 2px 10px; border: 3px solid #a3262a; color: #a3262a; font: 800 1rem/1.3 system-ui, sans-serif; text-transform: uppercase; letter-spacing: .1em; transform: rotate(-3deg); opacity: .85; border-radius: 4px; }

/* Interrogation transcript. */
.interrogation { background: color-mix(in srgb, var(--fg) 6%, var(--paper)); padding: 16px; border-radius: 10px; border-left: 4px solid var(--frame); }
.interrogation .meta { color: var(--muted); font-size: .9rem; margin: 2px 0 10px; }
.interrogation dl { display: grid; grid-template-columns: auto 1fr; gap: 8px 10px; margin: 0; }
.interrogation dt { font-weight: 700; color: var(--accent-text); }
.interrogation dd { margin: 0; }
.ev audio { width: 100%; margin: 4px 0 10px; }

/* Phone: sms thread. */
.phone { max-width: 24rem; margin: 0 auto; width: 100%; background: #0f0f12; color: #f2f2f5; border-radius: 26px; padding: 12px 12px 16px; border: 6px solid #2b2b30; font-family: system-ui, -apple-system, sans-serif; }
.phone header { display: grid; justify-items: center; gap: 2px; padding-bottom: 10px; border-bottom: 1px solid #2b2b30; margin-bottom: 10px; font-size: .8rem; color: #9b9ba3; }
.phone .contact { display: grid; justify-items: center; gap: 4px; color: #f2f2f5; font-weight: 600; font-size: .95rem; }
.avatar { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: #6e6e78; color: #fff; font-weight: 700; }
.sms ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.sms li { display: grid; max-width: 80%; }
.sms li.me { justify-self: end; justify-items: end; }
.sms .bubble { padding: 8px 12px; border-radius: 18px; background: #2c2c33; line-height: 1.35; }
.sms li.me .bubble { background: #0866d6; color: #fff; }
.sms time { font-size: .72rem; color: #9b9ba3; margin: 2px 6px 0; }
.sms .name { font-size: .75rem; color: #9b9ba3; margin: 0 12px 2px; }

/* Lock screen with notifications. */
.lock { background: linear-gradient(160deg, #1b2433, #0d0f14 70%); padding-bottom: 14px; }
.lock header { border: 0; color: #c9cdd6; }
.lock .clock { font: 300 3.4rem/1 system-ui, -apple-system, sans-serif; color: #fff; letter-spacing: -.02em; }
.lock ul { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 8px; }
.lock li { display: grid; gap: 1px; padding: 9px 12px; border-radius: 16px; background: #ffffff1f; font-size: .9rem; line-height: 1.35; }
.lock .app { display: flex; justify-content: space-between; margin: 0 !important; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: #b9bec9; }
.lock-note { margin: 10px 4px 0 !important; font-size: .8rem; color: #9b9ba3; }

/* Local online group: posts, reactions and comments. */
.forum { background: #fff; color: #1c1e21; border-radius: 12px; overflow: hidden; border: 1px solid #dadde1; font: 15px/1.4 system-ui, -apple-system, sans-serif; }
.forum > header { display: grid; padding: 10px 14px; background: #2d4f73; color: #fff; }
.forum > header span { font-size: .78rem; opacity: .85; }
.forum .post { padding: 12px 14px; border-top: 1px solid #e4e6eb; }
.forum .post header { display: grid; grid-template-columns: 36px 1fr; column-gap: 8px; align-items: center; margin-bottom: 6px; }
.forum .post .avatar { grid-row: span 2; width: 36px; height: 36px; background: #8a97a8; }
.forum .post time, .forum .comments time { color: #65676b; font-size: .8rem; }
.forum .reactions { color: #65676b; font-size: .85rem; margin-top: 6px !important; }
.forum .comments { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.forum .comments li { background: #f0f2f5; border-radius: 14px; padding: 6px 10px; font-size: .92rem; }

/* Instagram post. */
.insta { max-width: 26rem; margin: 0 auto; width: 100%; background: #fff; color: #111; border-radius: 12px; overflow: hidden; border: 1px solid #ddd; font: 15px/1.4 system-ui, -apple-system, sans-serif; }
.insta header { display: flex; align-items: center; gap: 10px; padding: 10px 12px; }
.insta header .avatar { width: 32px; height: 32px; background: conic-gradient(#f58529, #dd2a7b, #8134af, #515bd4, #f58529); }
.insta .zoomable { border-radius: 0; }
.insta .body { padding: 10px 12px 12px; }
.insta .likes { font-weight: 700; }
.insta .comments { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 4px; }
.insta time { color: #737373; font-size: .8rem; }

/* Swish history. */
.swish { background: #fff; color: #111; border-radius: 14px; overflow: hidden; font: 15px/1.35 system-ui, -apple-system, sans-serif; }
.swish header { display: flex; flex-wrap: wrap; gap: 2px 12px; justify-content: space-between; align-items: baseline; padding: 12px 14px; background: linear-gradient(90deg, #00a4e4, #ee1c8e); color: #fff; }
.swish h3 { font: 800 1.1rem/1 system-ui, sans-serif; }
.swish ul { list-style: none; margin: 0; padding: 0; }
.swish li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 14px; border-top: 1px solid #eee; }
.swish .who, .swish .amt { display: grid; }
.swish .who { flex: 1 1 auto; min-width: 0; }
.swish .amt { text-align: right; flex: 0 1 auto; max-width: 50%; }
.swish .amt b { white-space: nowrap; }
.swish li span span, .swish .who span, .swish .amt span { color: #666; font-size: .85rem; }
.swish b.in { color: #1a7f37; }

/* Receipt: narrow thermal paper. */
.receipt { max-width: 19rem; margin: 0 auto; width: 100%; background: #fbfaf6; color: #222; padding: 18px 16px 22px; font: 14px/1.45 ui-monospace, 'Courier New', monospace;
  -webkit-mask: radial-gradient(circle 6px at 50% 100%, #0000 98%, #000) 0 0 / 14px 100%; mask: radial-gradient(circle 6px at 50% 100%, #0000 98%, #000) 0 0 / 14px 100%; padding-bottom: 28px; }
.receipt header, .receipt footer { display: grid; text-align: center; }
.receipt header { margin-bottom: 10px; }
.receipt table { width: 100%; border-collapse: collapse; }
.receipt td:last-child, .receipt tfoot td { text-align: right; }
.receipt tfoot th, .receipt tfoot td { border-top: 1px dashed #888; padding-top: 6px; font-weight: 700; text-align: left; }
.receipt tfoot td { text-align: right; }
.receipt footer { margin-top: 12px; color: #555; }

/* Ledger / cash book. */
.ledger { background: #f3efe2; color: #222; padding: 14px; border-radius: 6px; font-family: Georgia, serif; }
.ledger h3 { font: 700 1.1rem/1.3 Georgia, serif; margin-bottom: 8px; }
.ledger .scroll { overflow-x: auto; }
.ledger table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.ledger th, .ledger td { padding: 6px 8px; border-bottom: 1px solid #c9bfa6; text-align: left; vertical-align: top; }
.ledger :is(td, th):first-child, .ledger .num { white-space: nowrap; }
.ledger th { font: 700 .8rem/1.2 system-ui, sans-serif; text-transform: uppercase; letter-spacing: .05em; color: #5b5240; }
.ledger :is(td, th).num { text-align: right; font-variant-numeric: tabular-nums; }
.ledger .note-line { margin-top: 8px; font-style: italic; }

/* Handwritten note. */
.handnote { margin: 0 auto; max-width: 20rem; width: 100%; background: #fff6a8; color: #2a2a2a; padding: 18px 18px 14px; transform: rotate(1.2deg); box-shadow: 0 10px 18px -12px #000; }
.handnote blockquote { margin: 0; font: italic 600 1.25rem/1.35 'Segoe Print', 'Bradley Hand', 'Comic Sans MS', cursive; }
.handnote figcaption { margin-top: 8px; font-size: .85rem; color: #555; }
.handnote.pink { background: #ffc9de; transform: rotate(-1.4deg); }
.handnote.blue { background: #c8e6ff; transform: rotate(.6deg); }
.handnote.white { background: #fbfaf6; transform: rotate(-.6deg); background-image: repeating-linear-gradient(#0000 0 calc(1.7rem - 1px), #9ab7d6 calc(1.7rem - 1px) 1.7rem); background-position: 0 18px; }
.handnote.white blockquote { line-height: 1.7rem; }
.handnote.white figcaption { line-height: 1.7rem; margin-top: 0; }

/* Evidence bags: clear plastic with a red seal strip and a label. */
.items > header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 12px; margin-bottom: 8px; }
.items .ref { color: var(--muted); font: .82rem/1.3 ui-monospace, 'Courier New', monospace; }
.items ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 12px; }
.bag { position: relative; padding: 0 12px 12px; border-radius: 6px; color: #1d1c1a; font-size: .92rem;
  background: linear-gradient(135deg, #ffffffd9, #e9eef2cc 60%, #ffffffe6); border: 1px solid #b9c3cc; box-shadow: inset 0 0 0 4px #ffffff80, 0 8px 18px -14px #000; }
.bag .tag { display: flex; justify-content: space-between; margin: 0 -12px 10px !important; padding: 6px 12px; background: #b3262b; color: #fff;
  font: 700 .78rem/1.2 ui-monospace, 'Courier New', monospace; letter-spacing: .08em; text-transform: uppercase; border-radius: 6px 6px 0 0; }
.bag .zoomable { margin-bottom: 8px; border-radius: 4px; max-width: 11rem; }
.bag .what { font-weight: 700; }
.bag dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 8px; margin: 6px 0 0; font-size: .85rem; }
.bag dt { color: #555; }
.bag dd { margin: 0; }
.bag-note { margin-top: 8px !important; padding: 6px 8px; background: #fff6a8; font: italic .88rem/1.35 'Segoe Print', 'Bradley Hand', cursive; transform: rotate(-.5deg); }

.photo { margin: 0; }
.photo figcaption { margin-top: 6px; color: var(--muted); font-size: .9rem; }
.photos h3 { margin-bottom: 8px; }
.photos ol { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.audio details { margin-top: 4px; }
.audio summary { min-height: 48px; display: flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 600; list-style: none; }
.audio summary::-webkit-details-marker { display: none; }
.audio summary::before { content: '▸'; transition: transform .2s; }
.audio details[open] summary::before { transform: rotate(90deg); }

/* Letter. */
.letter { background: #f6f1e7; color: #2a2520; padding: 22px 20px; border-radius: 4px; font: 1.05rem/1.65 Georgia, 'Times New Roman', serif; box-shadow: 0 12px 24px -18px #000; }
.letter .to { font-style: italic; }
.letter .sig { margin-top: 1em; font: italic 1.3rem/1.3 'Segoe Print', 'Bradley Hand', cursive; text-align: right; }

/* Timeline. */
.timeline ol { list-style: none; margin: 8px 0 0; padding: 0 0 0 4px; border-left: 2px solid var(--frame); }
.timeline li { position: relative; display: grid; grid-template-columns: 4.2rem 1fr; gap: 10px; padding: 6px 0 6px 14px; }
.timeline li::before { content: ''; position: absolute; left: -8px; top: 13px; width: 12px; height: 12px; border-radius: 50%; background: var(--frame); }
.timeline time { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--accent-text); }

/* Detective question and notes. */
.detective { margin-top: 18px; padding: 14px; border-radius: 12px; border: 1.5px dashed color-mix(in srgb, var(--frame) 70%, transparent); }
.detective h3 { margin: 0 0 4px; font: 700 .8rem/1.2 system-ui, sans-serif; letter-spacing: .1em; text-transform: uppercase; color: var(--accent-text); }
.detective p { margin: 0 0 10px; font-weight: 600; }
.note-field { width: 100%; min-height: 80px; padding: 10px 12px; font: inherit; font-size: max(16px, 1em); border-radius: 10px; resize: vertical;
  border: 1.5px solid color-mix(in srgb, var(--fg) 25%, var(--bg)); background: color-mix(in srgb, var(--fg) 4%, var(--bg)); color: var(--fg); }
.suspects ul { list-style: none; margin: 10px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.suspect { width: 100%; min-height: 56px; display: grid; text-align: left; padding: 8px 12px; border-radius: 12px; cursor: pointer; font: inherit;
  background: var(--bg); color: var(--fg); border: 1.5px solid var(--line); }
.suspect .mark { font-size: .85rem; color: var(--muted); }
.suspect[data-mark='suspect'] { border-color: var(--wrong); }
.suspect[data-mark='suspect'] .mark { color: var(--wrong); font-weight: 700; }
.suspect[data-mark='cleared'] span:first-child { text-decoration: line-through; color: var(--muted); }
.casefile { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.casefile .panel { margin: 0; }
.casefile > li > h3 { margin: 0; font-family: var(--serif); font-size: 1.1rem; }
.casefile > li > h3 a { color: var(--fg); }
.casefile .detective { margin-top: 10px; }

/* The guess. */
.guess fieldset { border: 0; padding: 0; margin: 16px 0 0; }
.guess fieldset:disabled { opacity: .6; }
.guess legend { font-weight: 700; margin-bottom: 6px; }
.choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.choice { position: relative; display: block; margin: 0 !important; }
.choice input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.choice span { display: flex; align-items: center; min-height: 52px; padding: 8px 12px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--bg); }
.choice input:checked + span { border-color: var(--frame); background: color-mix(in srgb, var(--frame) 18%, var(--bg)); font-weight: 700; }
.choice input:focus-visible + span { outline: 3px solid var(--accent-text); outline-offset: 2px; }
.bonus { color: var(--accent-text); font-weight: 600; }
.confirm { margin-top: 16px; padding: 14px; border-radius: 12px; background: color-mix(in srgb, var(--frame) 12%, var(--bg)); }
.guess-list { list-style: none; margin: 8px 0; padding: 0; display: grid; gap: 6px; }
.guess-list .ok { color: var(--right); font-weight: 700; }
.guess-list .no { color: var(--wrong); }
.result { font-size: 1.15rem; }

/* Full-screen image viewer. */
.viewer { width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: #000; color: #fff; }
.viewer::backdrop { background: #000; }
.viewer .stage { position: absolute; inset: 0 0 112px; display: grid; place-items: center; overflow: hidden; touch-action: none; }
.viewer img { max-width: 100%; max-height: 100%; object-fit: contain; transform-origin: center; user-select: none; -webkit-user-drag: none; }
.viewer .caption { position: absolute; left: 16px; right: 16px; bottom: calc(64px + env(safe-area-inset-bottom)); margin: 0; text-align: center; font-size: .9rem; color: #ddd; }
.viewer .bar { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; gap: 8px; padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); }
.viewer .bar button { min-width: 48px; min-height: 48px; border-radius: 50%; border: 1px solid #555; background: #1a1a1a; color: #fff; font-size: 1.3rem; cursor: pointer; }

/* Locks: a phone, padlock, locker, safe or laptop that opens with a code found in the evidence. */
.lockbox { --lock-bg: #2b2b30; --lock-fg: #f2f2f5; --lock-muted: #b9bec9; padding: 16px; border-radius: 18px; background: var(--lock-bg); color: var(--lock-fg); box-shadow: 0 12px 26px -18px #000; }
.lockbox[data-device='phone'] { max-width: 24rem; margin: 0 auto; width: 100%; border-radius: 30px; border: 6px solid #3a3a40; background: linear-gradient(160deg, #1b2433, #0d0f14 70%); }
.lockbox[data-device='padlock'] { --lock-bg: linear-gradient(160deg, #d9b45a, #a8832e); --lock-fg: #2a1f08; --lock-muted: #4a3a14; }
.lockbox[data-device='locker'] { --lock-bg: repeating-linear-gradient(180deg, #8d98a3 0 3px, #9aa5b0 3px 22px); --lock-fg: #14181c; --lock-muted: #2c333a; border-radius: 6px; }
.lockbox[data-device='safe'] { --lock-bg: radial-gradient(circle at 30% 20%, #4a4f57, #22252a); border-radius: 10px; border: 4px solid #15171a; }
.lockbox[data-device='laptop'] { border-radius: 12px 12px 4px 4px; border: 10px solid #3a3a40; border-bottom-width: 22px; background: #10141c; }
.lockbox > header { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.lockbox h3 { font: 700 1.05rem/1.3 system-ui, sans-serif !important; color: inherit; }
.lock-icon { font-size: 1.6rem; }
.lock-prompt { color: var(--lock-muted); }
.lockbox label { display: block; margin-bottom: 6px; font-size: .85rem; font-weight: 600; color: var(--lock-muted); }
.unlock-row { display: flex; gap: 8px; }
.unlock-row input { flex: 1; min-width: 0; min-height: 48px; padding: 8px 12px; border-radius: 12px; border: 2px solid #0000004d; background: #ffffffe6; color: #111;
  font: 700 max(16px, 1.3rem)/1 ui-monospace, 'Courier New', monospace; letter-spacing: .3em; text-align: center; }
.unlock-row .primary { flex: none; }
.keyring { margin: 0; padding: 0; border: 0; display: grid; gap: 8px; }
.keyring legend { padding: 0; margin-bottom: 6px; font-size: .85rem; font-weight: 600; color: var(--lock-muted); }
.keyring .key { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 8px 14px; border-radius: 12px; border: 2px solid #0000004d;
  background: #ffffffe6; color: #111; font: inherit; text-align: left; cursor: pointer; }
.keyring .key:disabled { opacity: .45; text-decoration: line-through; cursor: default; }
.lockbox .feedback { margin: 8px 0 0 !important; min-height: 1.2em; font-weight: 600; }
.lockbox.open .lock-icon::after { content: ' ✓'; font-size: 1rem; }
.lockbox .unlocked { margin-top: 12px; color: var(--fg); }
.lockbox[data-device='phone'] .unlocked .phone { border: 0; padding: 0; background: none; }
.lockbox .unlocked .owner { display: none; }
@media (prefers-reduced-motion: no-preference) {
  .lockbox.shake { animation: shake .4s; }
  @keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
}
.lockbox:is([data-device='padlock'], [data-device='locker']) .primary { background: #1d1c1a; color: #fff; }
