:root {
  --brand: #b1161a;
  --brand-soft: #fbe6d6;
  --brand-deep: #8a1216;
  --drop: #f0a431;
  --fox: #e8591a;
  --coat: #b57042;
  --bg: #fffaf3;
  --fg: #1d1114;
  --muted: #6e5a52;
  --line: #eedccb;
  --card: #fbf0e3;
  --on-brand: #ffffff;
  --on-brand-soft: #fdd69c;
  --shadow-brand: rgba(177, 22, 26, .32);
  --floor: #f3ecdf;
  --wall: #c9bda8;
  --fixture: #ddd0b8;
  --crimson: #a62c3c;
  --moss: #4f7a3a;
  --amber: #c8892a;
  --indigo: #3e4c8a;
  --teal: #2c7a76;
  --rust: #b54a2a;
  --plum: #7a3a6a;
  --slate: #5a6572;
}
@media (prefers-color-scheme: dark) {
  :root {
    --brand: #d8342c;
    --brand-soft: #3a1a15;
    --brand-deep: #ffb08a;
    --drop: #fecc6f;
    --fox: #ff7a3d;
    --coat: #d39a6a;
    --bg: #140a0b;
    --fg: #f8ece2;
    --muted: #bca59a;
    --line: #3a2421;
    --card: #1f1213;
    --shadow-brand: rgba(0, 0, 0, .45);
    --floor: #2a2724;
    --wall: #423c34;
    --fixture: #554c40;
    --crimson: #e06a79;
    --moss: #8fbf6a;
    --amber: #e0b05a;
    --indigo: #8a96d0;
    --teal: #5ec4be;
    --rust: #e07a52;
    --plum: #c07aaa;
    --slate: #9aa3ae;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
.wrap { max-width: 980px; margin: 0 auto; padding: 0 20px 48px; }
header { display: flex; align-items: center; justify-content: space-between; padding: 22px 0 8px; gap: 12px; }
.brand { display: flex; align-items: center; gap: 12px; font-weight: 800; font-size: 19px; letter-spacing: -0.02em; text-decoration: none; }
.brand .mark { width: 40px; height: 40px; border-radius: 12px; display: block; object-fit: cover; box-shadow: 0 4px 14px var(--shadow-brand); }
.lang-toggle { display: inline-flex; align-items: center; gap: 2px; padding: 4px; background: var(--card); border: 1px solid var(--line); border-radius: 999px; }
.lang-toggle button { appearance: none; border: 0; background: transparent; color: var(--muted); font: inherit; font-weight: 700; font-size: 14px; padding: 7px 14px; border-radius: 999px; cursor: pointer; }
.lang-toggle button[aria-pressed="true"] { background: var(--fg); color: var(--bg); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.hero-mini {
  margin: 16px 0 20px;
  padding: 22px 20px;
  background: radial-gradient(120% 80% at 50% 0%, #c81d22 0%, #b1161a 38%, #5a1416 78%, #2a0c0d 100%);
  border-radius: 28px;
  color: var(--on-brand);
  text-align: center;
}
.hero-mini h1 { margin: 0 0 8px; font-size: clamp(26px, 6vw, 36px); letter-spacing: -0.03em; }
.hero-mini p { margin: 0; color: var(--on-brand-soft); font-weight: 500; }

.card, .board-card, .clue-card, .brief-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 18px;
}
.kicker { margin: 0 0 8px; font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
h2 { margin: 0 0 8px; font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
.brief { color: var(--muted); margin: 0 0 14px; }
.stamp {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
  color: var(--fox); background: color-mix(in srgb, var(--fox) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--fox) 35%, transparent);
  padding: 4px 8px; border-radius: 999px;
}

.case-switch { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.case-switch button {
  appearance: none; border: 1px solid var(--line); background: var(--bg); color: var(--fg);
  font: inherit; font-weight: 700; font-size: 14px; padding: 8px 12px; border-radius: 999px; cursor: pointer;
}
.case-switch button[aria-pressed="true"] { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.case-switch button:disabled { opacity: .55; cursor: wait; }

.cast { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0; }
.suspect-chip {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  min-width: 72px; padding: 8px 6px; border-radius: 16px; border: 2px solid transparent;
  background: var(--bg); cursor: pointer; font: inherit; color: inherit;
}
.suspect-chip[aria-pressed="true"] { border-color: var(--chip); box-shadow: 0 0 0 3px color-mix(in srgb, var(--chip) 25%, transparent); }
.suspect-chip .name { font-size: 12px; font-weight: 800; max-width: 88px; text-align: center; line-height: 1.2; }
.suspect-chip .role { font-size: 11px; color: var(--muted); text-align: center; max-width: 88px; }
.portrait {
  width: 52px; height: 52px; border-radius: 13px; display: grid; place-items: center;
  font-size: 28px; background: color-mix(in srgb, var(--chip) 18%, var(--bg));
  border: 3px solid var(--chip); line-height: 1;
}
.portrait.sm { width: 36px; height: 36px; font-size: 20px; border-width: 2px; border-radius: 9px; }
.portrait.lg { width: 72px; height: 72px; font-size: 40px; border-radius: 18px; }

.house-rule { margin: 14px 0 0; padding: 12px 14px; border-radius: 16px; background: var(--bg); color: var(--muted); font-size: 14.5px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.btn {
  appearance: none; border: 0; cursor: pointer; font: inherit; font-weight: 800;
  padding: 14px 22px; border-radius: 40px; background: var(--brand); color: #fff;
  box-shadow: 0 10px 26px var(--shadow-brand); text-decoration: none; display: inline-flex; align-items: center; gap: 8px; justify-content: center;
}
.btn.secondary { background: var(--bg); color: var(--fg); border: 1px solid var(--line); box-shadow: none; }
.btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.btn:focus-visible, .suspect-chip:focus-visible, .cell:focus-visible, .clue:focus-visible, .tool:focus-visible, .lang-toggle button:focus-visible, .case-switch button:focus-visible {
  outline: 3px solid var(--drop); outline-offset: 2px;
}

.play-layout { display: grid; gap: 16px; }
@media (min-width: 840px) {
  .play-layout { grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); align-items: start; }
  .sticky-col { position: sticky; top: 12px; }
}

.toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.tool {
  appearance: none; border: 1px solid var(--line); background: var(--bg); color: var(--fg);
  font: inherit; font-weight: 700; font-size: 14px; padding: 10px 12px; border-radius: 14px; cursor: pointer;
  min-height: 44px;
}
.tool[aria-pressed="true"] { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.toolbar .spacer { flex: 1; }

.map {
  display: grid;
  gap: 3px;
  background: var(--wall);
  padding: 6px;
  border-radius: 14px;
  width: 100%;
  max-width: 360px;
  margin: 12px auto 0;
}
.cell {
  position: relative; aspect-ratio: 1; border-radius: 8px; border: 0;
  background: var(--floor); cursor: pointer; padding: 0; font: inherit; color: inherit;
  min-width: 0; display: grid; place-items: center;
}
.cell.wall { background: var(--wall); cursor: default; }
.cell.furniture { background: var(--fixture); cursor: default; }
.cell .mark { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 800; font-size: clamp(14px, 4vw, 22px); pointer-events: none; }
.cell .mark.out { color: var(--coat); }
.cell .mark.maybe { color: var(--drop); }
.cell.hl { box-shadow: inset 0 0 0 3px var(--fox); }
.cell .room-label {
  position: absolute; left: 4px; top: 3px; font-size: 9px; font-weight: 800; letter-spacing: .04em;
  text-transform: uppercase; color: var(--muted); pointer-events: none; max-width: calc(100% - 8px);
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.cell .fix { font-size: clamp(14px, 3.6vw, 20px); pointer-events: none; }
.cell .count {
  position: absolute; right: 3px; bottom: 2px; font-size: 10px; font-weight: 800; color: var(--muted);
}

.clues { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.clue {
  display: grid; grid-template-columns: 28px 1fr auto; gap: 10px; align-items: start;
  width: 100%; text-align: left; background: var(--bg); border: 1px solid var(--line);
  border-radius: 14px; padding: 10px 12px; font: inherit; color: inherit; cursor: pointer;
}
.clue .n { width: 22px; height: 22px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-deep); font-size: 12px; font-weight: 800; display: grid; place-items: center; margin-top: 2px; }
.clue.struck { opacity: .55; }
.clue.struck .body { text-decoration: line-through; }
.clue[aria-pressed="true"] { border-color: var(--fox); box-shadow: 0 0 0 2px color-mix(in srgb, var(--fox) 30%, transparent); }
.clue .who { font-weight: 800; }
.strike {
  appearance: none; border: 1px solid var(--line); background: var(--card); color: var(--muted);
  font: inherit; font-size: 12px; font-weight: 700; padding: 6px 8px; border-radius: 999px; cursor: pointer;
}

.check-bar { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 8px; }
.status { font-size: 13px; color: var(--muted); margin: 8px 0 0; }

.overlay {
  position: fixed; inset: 0; background: color-mix(in srgb, #1d1114 55%, transparent);
  display: grid; place-items: center; padding: 20px; z-index: 20;
}
.overlay[hidden] { display: none; }
.overlay .sheet { background: var(--bg); color: var(--fg); border-radius: 28px; padding: 24px; max-width: 440px; width: 100%; max-height: 90vh; overflow: auto; }
.overlay .cele { width: 120px; height: 120px; object-fit: contain; display: block; margin: 0 auto 12px; }
.overlay .badge-row { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.store-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  text-decoration: none; font-weight: 800; padding: 14px 18px; border-radius: 40px;
  background: var(--brand); color: #fff;
}
.store-btn.soon, .store-btn[aria-disabled="true"] {
  background: var(--card); color: var(--muted); border: 1px dashed var(--line); pointer-events: none;
}
.apple { width: 18px; height: 22px; fill: currentColor; }
.play-icon { width: 18px; height: 20px; fill: currentColor; }

footer { border-top: 1px solid var(--line); margin-top: 40px; padding: 22px 0 8px; color: var(--muted); font-size: 13px; display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: space-between; }
footer a { text-decoration: none; }

.hidden { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
