/* style.css: night-time mansion look. Phone first, then wider screens. */
:root {
  --bg: #0d1626;
  --bg-2: #13203a;
  --panel: #16243f;
  --line: #263a5e;
  --text: #e8eef6;
  --muted: #9fb0c6;
  --brass: #d4ad3f;
  --brass-2: #f2d06b;
  --danger: #e06a6a;
  --good: #6cc59a;
  --paper: #f3ecdc;
  --ink: #1c2535;
  /* Safe areas keep things clear of the iPhone notch and home bar (0 elsewhere). */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --topbar-h: calc(56px + var(--safe-top));
  --radius: 12px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(ellipse at top, #1a2a4a 0%, var(--bg) 60%) fixed, var(--bg);
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}
button, select, input { font: inherit; color: inherit; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--brass-2); outline-offset: 2px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; flex: none; box-shadow: 0 0 0 1px rgba(0,0,0,.4); }

/* ---- Top bar ---------------------------------------------------------- */
#app { min-height: 100dvh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 12px;
  height: var(--topbar-h); padding: var(--safe-top) max(12px, var(--safe-right)) 0 max(12px, var(--safe-left));
  background: rgba(13, 22, 38, .92); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}
.topbar h1 {
  margin: 0; font: 600 18px/1.1 Georgia, "Times New Roman", serif; color: var(--brass-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40%;
}
.players-bar { display: flex; gap: 6px; overflow-x: auto; flex: 1; min-width: 0; scrollbar-width: none; }
.players-bar::-webkit-scrollbar { display: none; }
.pchip {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  padding: 4px 10px; border-radius: 999px; font-size: 13px;
  background: var(--bg-2); border: 1px solid var(--line);
}
.pchip.current { border-color: var(--brass-2); box-shadow: 0 0 0 1px var(--brass-2); }
.pchip.you { font-weight: 600; }
.pchip.out { opacity: .5; text-decoration: line-through; }
.icon-btn {
  margin-left: auto; width: 44px; height: 44px; flex: none; border-radius: 10px;
  background: transparent; border: 1px solid var(--line); cursor: pointer; display: grid; place-items: center;
}
.icon-btn svg { width: 22px; height: 22px; stroke: var(--text); stroke-width: 2; stroke-linecap: round; fill: none; }
.icon-btn + .icon-btn { margin-left: 0; }
.help-btn { font: 700 20px/1 Georgia, serif; color: var(--brass-2); }

/* ---- Start screen ---------------------------------------------------- */
.start { padding: 16px max(16px, var(--safe-right)) max(16px, var(--safe-bottom)) max(16px, var(--safe-left)); }
.start-card {
  max-width: 820px; margin: 8px auto 32px; padding: 20px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
}
.start-title { margin: 0; font: 600 30px/1.15 Georgia, serif; color: var(--brass-2); }
.resume-card { border-color: var(--brass); margin-bottom: 12px; }
.resume-title { margin: 0; font: 600 21px/1.2 Georgia, serif; color: var(--brass-2); }
.resume-card p { margin: 10px 0 0; }
.resume-card .start-actions { margin-top: 14px; }
.subtitle { margin: 4px 0 0; color: var(--muted); font-style: italic; }
.intro { margin: 14px 0 6px; }
.start-card h3 { margin: 20px 0 8px; font-size: 15px; color: var(--brass-2); letter-spacing: .02em; }
.start-row { display: flex; flex-wrap: wrap; gap: 8px 32px; }
.start-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.hint { display: block; margin-top: 6px; color: var(--muted); }
.level-col { max-width: 330px; }
.mix-check { margin-top: 10px; }
.seat-levels { display: grid; gap: 6px; margin-top: 6px; }
.seat-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.seat-label { min-width: 104px; font-size: 13px; color: var(--muted); }
.errors { color: #ffd2d2; padding-left: 20px; }
.errors li { margin: 6px 0; }
.check { display: flex; align-items: center; gap: 10px; margin-top: 18px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--brass); }
.field { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.field select { min-height: 40px; padding: 0 10px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px; }

.opt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.opt-grid.compact { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.opt {
  display: flex; align-items: flex-start; gap: 10px; text-align: left; min-height: 44px;
  padding: 10px 12px; border-radius: 10px; cursor: pointer;
  background: var(--bg-2); border: 1px solid var(--line);
}
.opt .dot { margin-top: 4px; }
.opt-text { display: flex; flex-direction: column; gap: 2px; }
.opt-text small { color: var(--muted); }
.opt[aria-checked="true"] { border-color: var(--brass-2); background: #2a3555; box-shadow: inset 0 0 0 1px var(--brass-2); }
.opt.known:not([aria-checked="true"]) { opacity: .6; }
.opt-marks { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.opt-mark { display: inline-flex; align-items: center; gap: 4px; padding: 0 6px; border-radius: 6px; font-size: 12px; font-weight: 700; background: var(--bg); border: 1px solid var(--line); }
.opt-mark .dot { width: 8px; height: 8px; }
.opt-mark.m1 { color: var(--danger); }
.opt-mark.m2 { color: var(--good); }
.opt-mark.m3 { color: var(--brass-2); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { min-width: 52px; min-height: 44px; padding: 0 14px; background: var(--bg-2); border: 0; border-right: 1px solid var(--line); cursor: pointer; }
.seg button:last-child { border-right: 0; }
.seg button[aria-checked="true"] { background: var(--brass); color: var(--ink); font-weight: 600; }

/* ---- Buttons ----------------------------------------------------------- */
.btn {
  min-height: 44px; padding: 0 16px; border-radius: 10px; cursor: pointer;
  background: var(--bg-2); border: 1px solid #3a5482; font-weight: 500;
}
@media (hover: hover) { .btn:hover:not(:disabled) { border-color: var(--brass); } }
.btn.primary { background: var(--brass); border-color: var(--brass); color: var(--ink); font-weight: 650; }
@media (hover: hover) { .btn.primary:hover:not(:disabled) { background: var(--brass-2); } }
.btn.danger { border-color: var(--danger); color: #ffc4c4; }
.btn.danger.primary, .dlg .btn.danger { background: transparent; }
.btn:disabled { opacity: .45; cursor: default; }
.btn.big { min-height: 52px; padding: 0 24px; font-size: 17px; }

/* ---- Main layout (phone: one column) ----------------------------------- */
.layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; padding: 10px max(10px, var(--safe-right)) max(10px, var(--safe-bottom)) max(10px, var(--safe-left)); }
.board-area { width: 100%; aspect-ratio: 1; }
#board { display: block; width: 100%; height: 100%; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.controls { display: flex; flex-direction: column; gap: 10px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); min-height: 280px; display: flex; flex-direction: column; }

/* Desktop and tablets in landscape: board left, panel right. */
@media (min-width: 960px) {
  .layout {
    grid-template-columns: minmax(0, 1fr) minmax(320px, 400px);
    grid-template-rows: minmax(0, 1fr) auto;
    grid-template-areas: "board panel" "controls panel";
    height: calc(100dvh - var(--topbar-h));
    padding: 12px max(16px, var(--safe-right)) max(12px, var(--safe-bottom)) max(16px, var(--safe-left)); gap: 12px 16px;
  }
  .board-area { grid-area: board; aspect-ratio: auto; min-height: 0; }
  .controls { grid-area: controls; }
  .panel { grid-area: panel; min-height: 0; }
  .movelist { max-height: 26vh; overflow: auto; }
}
/* Phones held sideways: board left, everything else scrolls on the right. */
@media (orientation: landscape) and (max-height: 560px) and (max-width: 959px) {
  .layout { grid-template-columns: auto minmax(0, 1fr); align-items: start; }
  .board-area { height: calc(100dvh - var(--topbar-h) - 20px - var(--safe-bottom)); width: auto; position: sticky; top: calc(var(--topbar-h) + 10px); }
  .controls, .panel { grid-column: 2; }
  .board-area { grid-row: 1 / span 2; }
}

/* ---- Board (SVG) ------------------------------------------------------- */
.board-bg { fill: #0a1220; stroke: #3b4f73; stroke-width: .06; }
.tile { fill: #1b2a44; stroke: #2a4068; stroke-width: .03; }
.tile.door { fill: #243759; }
.tile.start { stroke-width: .12; fill: #1f3150; }
.room-cell { fill: #2a3d5e; }
.room.slot-2 .room-cell, .room.slot-4 .room-cell, .room.slot-6 .room-cell, .room.slot-8 .room-cell { fill: #283a59; }
.room.slot-5 .room-cell { fill: #34466e; }
.room-wall { fill: none; stroke: var(--brass); stroke-width: .08; stroke-linecap: square; }
.room-door { stroke: var(--brass-2); stroke-width: .16; stroke-linecap: round; }
.room-name { fill: #eef3fa; font-family: Georgia, "Times New Roman", serif; font-weight: 600; text-anchor: middle; dominant-baseline: middle; pointer-events: none; }
.room-shortcut { fill: var(--brass-2); text-anchor: middle; dominant-baseline: middle; pointer-events: none; font-family: system-ui, sans-serif; }
.room.flash .room-cell { animation: flash 1.1s ease-out; }
@keyframes flash { 0% { fill: #6b5a24; } 100% { } }
.reach { fill: rgba(242, 208, 107, .32); stroke: rgba(242, 208, 107, .9); stroke-width: .05; }
.reach.sel { fill: rgba(242, 208, 107, .85); }
.reach-room { fill: rgba(242, 208, 107, .14); }
.reach-room.sel { fill: rgba(242, 208, 107, .34); }
.path-dot { fill: var(--brass-2); pointer-events: none; }
.weapon rect { fill: #0f1a2c; stroke: #7f96b8; stroke-width: .04; }
.weapon text { fill: #dbe5f2; text-anchor: middle; dominant-baseline: middle; font-family: system-ui, sans-serif; }
#weapons, #pieces { pointer-events: none; }
.piece { transition: transform var(--step, 120ms) linear; }
.piece-ring { fill: rgba(0, 0, 0, .35); stroke: rgba(0, 0, 0, .6); stroke-width: .06; }
.piece-body { stroke: rgba(0, 0, 0, .45); stroke-width: .04; }
.piece-label { text-anchor: middle; font-weight: 700; font-family: system-ui, sans-serif; }
.piece.you .piece-ring { stroke: var(--brass-2); stroke-width: .09; }
.piece.npc { opacity: .72; }
.piece.out { opacity: .4; }
.piece.current .piece-ring { stroke: #ffffff; stroke-width: .09; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { stroke-opacity: .25; } }

/* ---- Controls ------------------------------------------------------------ */
.you-line { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 13.5px; color: var(--muted); }
.you-line strong { color: var(--text); }
.practice-tag { margin-left: auto; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--brass); color: var(--brass-2); font-size: 12px; font-weight: 600; }
.tip { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border-radius: var(--radius);
  background: rgba(212, 173, 63, .12); border: 1px solid var(--brass); }
.tip-text { flex: 1; }
.tip-ok { flex: none; }
.tip-icon { flex: none; display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%;
  background: var(--brass); color: var(--ink); font: 700 13px/1 Georgia, serif; margin-top: 1px; }
.tip-inline { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border-radius: 8px; background: rgba(212, 173, 63, .12); border: 1px solid rgba(212, 173, 63, .6); }
.status-row { display: flex; align-items: center; gap: 12px; min-height: 44px; }
.status { margin: 0; padding: 6px 0 6px 12px; border-left: 4px solid var(--who, transparent); flex: 1; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.playback { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.playback-note { color: var(--brass-2); font-weight: 600; }
.actions:empty { display: none; }
.dice { display: flex; gap: 6px; flex: none; }
.die {
  width: 36px; height: 36px; border-radius: 8px; background: var(--paper);
  display: grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr); padding: 5px; gap: 1px;
  box-shadow: 0 0 0 2px var(--who, transparent), 0 2px 4px rgba(0,0,0,.4);
}
.die i { width: 7px; height: 7px; border-radius: 50%; background: var(--ink); place-self: center; }
.die[data-v="1"] i:nth-child(1) { grid-area: 2 / 2; }
.die[data-v="2"] i:nth-child(1) { grid-area: 1 / 1; } .die[data-v="2"] i:nth-child(2) { grid-area: 3 / 3; }
.die[data-v="3"] i:nth-child(1) { grid-area: 1 / 1; } .die[data-v="3"] i:nth-child(2) { grid-area: 2 / 2; } .die[data-v="3"] i:nth-child(3) { grid-area: 3 / 3; }
.die[data-v="4"] i:nth-child(1) { grid-area: 1 / 1; } .die[data-v="4"] i:nth-child(2) { grid-area: 1 / 3; } .die[data-v="4"] i:nth-child(3) { grid-area: 3 / 1; } .die[data-v="4"] i:nth-child(4) { grid-area: 3 / 3; }
.die[data-v="5"] i:nth-child(1) { grid-area: 1 / 1; } .die[data-v="5"] i:nth-child(2) { grid-area: 1 / 3; } .die[data-v="5"] i:nth-child(3) { grid-area: 2 / 2; } .die[data-v="5"] i:nth-child(4) { grid-area: 3 / 1; } .die[data-v="5"] i:nth-child(5) { grid-area: 3 / 3; }
.die[data-v="6"] i:nth-child(1) { grid-area: 1 / 1; } .die[data-v="6"] i:nth-child(2) { grid-area: 1 / 3; } .die[data-v="6"] i:nth-child(3) { grid-area: 2 / 1; } .die[data-v="6"] i:nth-child(4) { grid-area: 2 / 3; } .die[data-v="6"] i:nth-child(5) { grid-area: 3 / 1; } .die[data-v="6"] i:nth-child(6) { grid-area: 3 / 3; }
.die.rolling { animation: roll .45s ease-out; }
@keyframes roll { 0% { transform: rotate(-200deg) scale(.6); } 70% { transform: rotate(12deg) scale(1.05); } 100% { transform: none; } }

.movelist { display: grid; gap: 6px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; }
.movelist h4 { margin: 6px 2px 2px; font-size: 13px; color: var(--muted); font-weight: 600; }
.move-item {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  min-height: 44px; padding: 0 12px; border-radius: 8px; text-align: left; cursor: pointer;
  background: var(--bg-2); border: 1px solid var(--line);
}
.move-item small { color: var(--muted); white-space: nowrap; }
.move-item.reach { border-color: rgba(242, 208, 107, .7); }
.move-item[aria-pressed="true"] { background: #2a3555; border-color: var(--brass-2); box-shadow: inset 0 0 0 1px var(--brass-2); }
.h4-note { font-weight: 400; }
.move-item:disabled { opacity: .45; cursor: default; }

/* ---- Suggestions at a glance (top of the panel) --------------------------- */
.clues { flex: none; max-height: 38vh; overflow: auto; padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.clue + .clue { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); }
.clue-q { display: flex; align-items: baseline; gap: 8px; }
.clue-q .dot { position: relative; top: 1px; }
.clue-cards { color: var(--brass-2); }
.clue-a { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0 0 20px; }
.clue-chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 12.5px; background: var(--bg-2); border: 1px solid var(--line); }
.clue-chip .dot { width: 9px; height: 9px; }
.clue-chip.pass { border-color: rgba(224, 106, 106, .55); }
.clue-chip.showed { border-color: var(--brass); }
.clue-chip.none { border-color: var(--brass-2); color: var(--brass-2); font-weight: 600; }
.clue-chip.wait { color: var(--muted); font-style: italic; }
.clue-since summary { cursor: pointer; font-weight: 600; color: var(--brass-2); min-height: 28px; }
.clue-since .clue-list { margin-top: 6px; }

/* ---- Case review (after the game) --------------------------------------- */
.record-line { margin-top: 10px; }
.hindsight { margin-top: 14px; padding: 8px 12px; border-left: 3px solid var(--brass); background: rgba(212, 173, 63, .1); border-radius: 0 8px 8px 0; }
.review-list { display: grid; gap: 8px; font-size: 13.5px; }
.review-item { display: grid; grid-template-columns: 64px 1fr; gap: 8px; align-items: start; padding-top: 8px; border-top: 1px dashed var(--line); }
.review-turn { color: var(--muted); font-size: 12.5px; padding-top: 1px; }
.review-acc { padding-left: 20px; margin: 0; }
.review-hands p { margin: 6px 0; }
@media (max-width: 600px) { .review-item { grid-template-columns: 1fr; gap: 2px; } }

/* ---- Panel: tabs, cards, notebook, log ----------------------------------- */
.tabs { display: flex; border-bottom: 1px solid var(--line); flex: none; }
.tab { flex: 1; min-height: 46px; background: transparent; border: 0; border-bottom: 3px solid transparent; cursor: pointer; color: var(--muted); font-weight: 600; position: relative; }
.tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--brass); }
.tab[data-count]::after {
  content: attr(data-count); position: absolute; top: 6px; margin-left: 4px;
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--brass); color: var(--ink); font-size: 11px; line-height: 18px;
}
.tabpanel { padding: 12px; overflow: auto; flex: 1; min-height: 0; }
.you-are { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; }
.notice { background: rgba(224, 106, 106, .15); border: 1px solid rgba(224, 106, 106, .5); padding: 8px 10px; border-radius: 8px; }
.notice ul { margin: 6px 0 0; padding-left: 20px; }
.accuse-sentence { font-size: 17px; }

.card-row { display: flex; gap: 8px; flex-wrap: wrap; }
.card {
  display: flex; flex-direction: column; gap: 3px; width: 150px; min-height: 92px; padding: 10px;
  background: var(--paper); color: var(--ink); border-radius: 10px; box-shadow: 0 2px 6px rgba(0,0,0,.35);
}
.card.big { width: 180px; min-height: 110px; }
.card-type { display: flex; align-items: center; gap: 6px; text-transform: uppercase; letter-spacing: .06em; font-size: 10.5px; color: #6a5b33; font-weight: 700; }
.card strong { font-family: Georgia, serif; font-size: 15px; line-height: 1.2; }
.card-blurb { font-size: 12px; color: #4a5568; }
.card.suspect { border-top: 4px solid #7a5ea8; }
.card.weapon { border-top: 4px solid #a8743a; }
.card.room { border-top: 4px solid #3a7aa8; }
.card-btn { padding: 0; border: 0; background: none; cursor: pointer; border-radius: 10px; }
.card-choice { display: flex; flex-direction: column; gap: 6px; width: 150px; }
.shown-before { color: var(--muted); font-size: 12.5px; line-height: 1.3; }
.shown-before.same { color: var(--brass-2); }
@media (hover: hover) { .card-btn:hover .card { box-shadow: 0 0 0 3px var(--brass-2); } }
.card-btn:focus-visible .card { box-shadow: 0 0 0 3px var(--brass-2); }

.nb-wrap { overflow-x: auto; }
.notebook { border-collapse: collapse; width: 100%; font-size: 13.5px; }
.notebook thead th { position: sticky; top: -12px; background: var(--panel); z-index: 1; padding: 4px 2px 6px; font-weight: 600; }
.notebook thead th .dot { display: block; margin: 0 auto 2px; }
.nb-who { display: block; text-align: center; font-size: 11px; color: var(--muted); }
.notebook .nb-card { text-align: left; font-weight: 500; padding: 2px 6px 2px 0; }
.notebook tbody .nb-card { max-width: 150px; }
.nb-group th { text-align: left; padding: 10px 0 4px; color: var(--brass-2); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.notebook td { padding: 2px; text-align: center; }
.nb-cell { width: 36px; height: 34px; border-radius: 6px; background: var(--bg-2); border: 1px solid var(--line); cursor: pointer; font-weight: 700; }
.nb-cell.m1 { color: var(--danger); }
.nb-cell.m2 { color: var(--good); }
.nb-cell.m3 { color: var(--brass-2); }
.nb-cell.auto { color: var(--good); border-color: var(--good); background: rgba(108, 197, 154, .12); opacity: 1; cursor: default; }
.nb-cell.auto:focus-visible { outline-offset: 1px; }
.nb-cell.auto.m1 { color: var(--danger); border-color: rgba(224, 106, 106, .7); background: rgba(224, 106, 106, .1); }
.notebook tr.known .nb-card { text-decoration: line-through; color: var(--muted); }
.nb-key { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0 0 8px; font-size: 12.5px; color: var(--muted); }
.nb-key-item { display: inline-flex; align-items: center; gap: 5px; }
.nb-key-item strong { color: var(--text); }
.nb-tools { display: flex; justify-content: flex-end; margin-top: 8px; }
.nb-notes { display: block; margin: 14px 0 4px; font-weight: 600; color: var(--brass-2); font-size: 13px; }
#nb-notes { display: block; width: 100%; resize: vertical; min-height: 72px; padding: 8px 10px; border-radius: 8px;
  background: var(--bg-2); border: 1px solid var(--line); color: var(--text); font: inherit; font-size: 16px; }

.log { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 13.5px; }
.log li { padding: 3px 8px; border-radius: 6px; }
.log-turn { margin-top: 8px; font-weight: 700; color: var(--brass-2); }
.log-turn[data-turn]::before { content: "Turn " attr(data-turn) " · "; color: var(--muted); font-weight: 600; }
.log-sub { margin-left: 16px; border-left: 2px solid rgba(122, 94, 168, .45); border-radius: 0 6px 6px 0; }
.log.f-suggest li:not(.in-suggest) { display: none; }
.log.f-mine li:not(.log-private) { display: none; }
.log.f-suggest .log-sub, .log.f-mine li { margin-top: 0; }
.log-filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.log-filter { min-height: 36px; padding: 0 12px; border-radius: 999px; background: var(--bg-2); border: 1px solid var(--line); cursor: pointer; font-size: 13px; }
.log-filter[aria-pressed="true"] { background: var(--brass); color: var(--ink); border-color: var(--brass); font-weight: 600; }
.log-jump { position: sticky; bottom: 4px; display: block; margin: 8px 0 0 auto; box-shadow: 0 4px 12px rgba(0, 0, 0, .45); }
.log-minor { color: var(--muted); }
.log-suggest { background: rgba(122, 94, 168, .18); }
.log-private { background: rgba(212, 173, 63, .18); border-left: 3px solid var(--brass); }
.log-notice { color: var(--brass-2); }
.log-accuse { background: rgba(224, 106, 106, .16); }
.log-win { background: rgba(108, 197, 154, .2); font-weight: 700; }
.log-system { color: var(--muted); font-style: italic; }

/* ---- Dialogs ---------------------------------------------------------------- */
.dlg {
  width: min(520px, calc(100vw - 24px)); max-height: calc(100dvh - 24px);
  padding: 0; border: 1px solid var(--brass); border-radius: 14px;
  background: var(--bg-2); color: var(--text);
  display: flex; flex-direction: column;
}
.dlg:not([open]) { display: none; }
.dlg.wide { width: min(780px, calc(100vw - 24px)); }
.dlg::backdrop { background: rgba(3, 8, 16, .65); }
.dlg h2 { margin: 0; padding: 16px 18px 6px; font: 600 21px/1.2 Georgia, serif; color: var(--brass-2); }
.dlg-head { display: flex; align-items: flex-start; gap: 8px; }
.dlg-head h2 { flex: 1; }
.dlg-help { margin: 10px 12px 0 0; width: 40px; height: 40px; flex: none; border-radius: 50%; cursor: pointer;
  background: transparent; border: 1px solid var(--line); color: var(--brass-2); font: 700 18px/1 Georgia, serif; }
@media (hover: hover) { .dlg-help:hover { border-color: var(--brass); } }
.help .dlg-body { font-size: 14.5px; }
.help .dlg-body h3 { margin-top: 18px; }
.help .dlg-body p, .help .dlg-body li { margin: 4px 0; }
.help .dlg-body ul, .help .dlg-body ol { padding-left: 20px; }
.help-legend { display: grid; grid-template-columns: 34px 1fr; gap: 6px 10px; align-items: center; }
.help-legend svg { width: 30px; height: 30px; }
.help kbd { padding: 1px 6px; border: 1px solid var(--line); border-radius: 4px; background: var(--bg); font-size: 12px; }
.dlg h3 { margin: 16px 0 8px; font-size: 14px; color: var(--brass-2); }
.dlg-body { padding: 4px 18px 8px; overflow: auto; }
.dlg-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding: 12px 18px 16px; border-top: 1px solid var(--line); }
.dlg-actions:empty { display: none; }
@media (max-width: 600px) {
  .dlg, .dlg.wide { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border-radius: 0; border: 0; }
  .dlg-actions { margin-top: auto; padding-bottom: max(16px, var(--safe-bottom)); }
  .dlg h2 { padding-top: max(16px, var(--safe-top)); }
  .dlg-help { margin-top: max(10px, var(--safe-top)); }
  .dlg-actions .btn { flex: 1; }
  .start { padding: 10px max(10px, var(--safe-right)) max(10px, var(--safe-bottom)) max(10px, var(--safe-left)); }
  .start-card { padding: 16px; }
  .start-title { font-size: 25px; }
  .topbar h1 { font-size: 16px; }
}

.noscript { padding: 24px; text-align: center; }

/* ---- Easier reading (Menu): larger text where there is text, stronger contrast everywhere ---- */
html.easy-read { --muted: #d2dcea; --line: #4a6694; }
html.easy-read .tabpanel, html.easy-read .clues, html.easy-read .status, html.easy-read .playback, html.easy-read .you-line, html.easy-read .tip,
html.easy-read .dlg-body, html.easy-read .movelist, html.easy-read .start-card { zoom: 1.15; }
html.easy-read .log-minor, html.easy-read .log-system { color: var(--text); }
html.easy-read .tile { stroke: #5a78a8; }
html.easy-read .room-door { stroke: #fff2b3; }
html.easy-read .room-shortcut { fill: #ffe9a3; }
html.easy-read .weapon rect { stroke: #b8c8de; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
