/* Seek & Find — warm paper, big friendly targets; adults go sepia-noir. */

* { box-sizing: border-box; }
:root {
  --paper: #fbf5e8; --ink: #2b2118; --muted: #7b6a58; --accent: #e8562a;
  --panel: #fffaf0; --line: #e4d6bd; --good: #1fa35c; --bad: #d23a2a;
}
/* the shared board + fun-stats modules default to a dark game; we are paper */
:root {
  --lb-accent: #c2461d; --lb-text: #2b2118; --lb-dim: rgba(43, 33, 24, .6);
  --lb-edge: rgba(43, 33, 24, .16); --lb-panel: rgba(255, 255, 255, .7);
  --fs-accent: #c2461d; --fs-text: #2b2118; --fs-dim: rgba(43, 33, 24, .6);
  --fs-edge: rgba(43, 33, 24, .16); --fs-panel: rgba(255, 255, 255, .7);
}
body.adults { --paper: #efe6d6; --ink: #1f1a14; --accent: #8a3b1c; --panel: #f7f0e2; --line: #d4c4a6; }
html, body {
  margin: 0; padding: 0; height: 100%; overflow: hidden;
  background: #3a2e22; color: var(--ink);
  font-family: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  -webkit-user-select: none; user-select: none;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; cursor: pointer; }
.muted { color: var(--muted); }

/* ── game screen ─────────────────────────────────────────────────── */
#game { position: fixed; inset: 0; display: flex; flex-direction: column; background: #2b231b; }
#topbar {
  display: flex; align-items: center; gap: 10px;
  padding: calc(6px + env(safe-area-inset-top)) 10px 6px;
  background: var(--panel); border-bottom: 2px solid var(--line); z-index: 4;
}
.tb-left { flex: 1 1 0; min-width: 0; }
.tb-round { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-title { font-weight: 800; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-mid { flex: 0 0 auto; }
.tb-timer { font-size: 26px; font-weight: 900; font-variant-numeric: tabular-nums; min-width: 70px; text-align: center; }
.tb-timer.low { color: var(--bad); animation: pulse 1s infinite; }
.tb-right { flex: 1 1 0; display: flex; justify-content: flex-end; align-items: center; gap: 6px; }
.tb-score { font-size: 15px; margin-right: 4px; white-space: nowrap; }
.tb-score b { font-size: 20px; }
.tb-label { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .1em; }
.tb-btn {
  display: inline-flex; align-items: center; gap: 4px; padding: 7px 11px;
  border-radius: 12px; border: 2px solid var(--line); background: #fff; color: var(--ink);
  font-weight: 700; font-size: 14px; white-space: nowrap;
}
.tb-btn:disabled { opacity: .5; cursor: default; }
.tb-btn:not(:disabled):hover { border-color: var(--accent); }

#main { flex: 1 1 auto; display: flex; min-height: 0; }
#stage {
  position: relative; flex: 1 1 auto; overflow: hidden; touch-action: none;
  background: #2b231b; cursor: crosshair;
}
#stage.panning { cursor: grabbing; }
#board { position: absolute; left: 0; top: 0; transform-origin: 0 0; will-change: transform; }
#sceneImg { display: block; pointer-events: none; image-rendering: auto; }
#marks { position: absolute; left: 0; top: 0; pointer-events: none; overflow: visible; }
.mark-found ellipse {
  fill: none; stroke-width: 4; vector-effect: non-scaling-stroke;
  filter: drop-shadow(0 0 2px #fff);
}
.mark-found.pop ellipse { animation: pop .45s ease-out; transform-box: fill-box; transform-origin: center; }
.mark-miss path { stroke: var(--bad); stroke-width: 4; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.mark-miss { animation: fade .9s forwards; }
.mark-hint {
  fill: rgba(255, 230, 80, .18); stroke: #ffd400; stroke-width: 4; stroke-dasharray: 10 8;
  vector-effect: non-scaling-stroke; animation: hint 1.2s ease-in-out infinite;
}
.mark-missed { fill: none; stroke: var(--bad); stroke-width: 3; stroke-dasharray: 6 5; vector-effect: non-scaling-stroke; }
@keyframes pop { from { transform: scale(2.2); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes fade { 0% { opacity: 1; } 100% { opacity: 0; } }
@keyframes hint { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }
@keyframes pulse { 50% { opacity: .5; } }

#zoomBtns { position: absolute; right: 10px; bottom: 10px; display: flex; flex-direction: column; gap: 6px; z-index: 3; }
#zoomBtns button {
  width: 42px; height: 42px; border-radius: 50%; border: 2px solid var(--line);
  background: rgba(255, 250, 240, .92); font-size: 22px; font-weight: 900; color: var(--ink);
}
#specBadge {
  position: absolute; left: 10px; top: 10px; z-index: 3; padding: 5px 12px;
  border-radius: 999px; background: rgba(0, 0, 0, .6); color: #fff; font-weight: 700;
}
#toast {
  position: absolute; left: 50%; top: 14px; transform: translate(-50%, -20px);
  padding: 8px 18px; border-radius: 999px; background: rgba(30, 24, 18, .88); color: #fff;
  font-weight: 800; font-size: 16px; opacity: 0; transition: opacity .15s, transform .15s;
  pointer-events: none; z-index: 5; white-space: nowrap; max-width: 92%; overflow: hidden; text-overflow: ellipsis;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.good { background: var(--good); }
#toast.bad { background: var(--bad); }
#toast.rival { background: var(--by, #555); }
#toast.hint { background: #c79a00; }
#lockVeil { position: absolute; inset: 0; pointer-events: none; box-shadow: inset 0 0 0 0 rgba(210, 58, 42, 0); transition: box-shadow .15s; z-index: 2; }
#lockVeil.on { box-shadow: inset 0 0 0 6px rgba(210, 58, 42, .55); }
.note-pop {
  position: absolute; left: 12px; bottom: 12px; max-width: min(380px, 80%); z-index: 4;
  background: #fffdf6; color: #1f1a14; border-left: 5px solid var(--accent);
  padding: 10px 14px; border-radius: 10px; box-shadow: 0 6px 24px rgba(0, 0, 0, .35);
  font-size: 14px; line-height: 1.35; transition: opacity .6s, transform .6s;
}
.note-pop.out { opacity: 0; transform: translateY(10px); }

/* side panel: item list + duel board + audio */
#side {
  flex: 0 0 250px; display: flex; flex-direction: column; gap: 8px; padding: 10px;
  background: var(--panel); border-left: 2px solid var(--line); overflow-y: auto; z-index: 3;
}
.side-title { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.items { display: flex; flex-direction: column; gap: 6px; }
.items.kids { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.item {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 12px;
  background: #fff; border: 2px solid var(--line); position: relative; font-weight: 700;
}
.items.kids .item { flex-direction: column; text-align: center; padding: 6px 4px; font-size: 14px; }
/* German compounds (Geburtstagstorte, Feuerwehrhelm) are longer than the tile:
   hyphenate by the page language, and break anywhere before overflowing */
.item-name { min-width: 0; max-width: 100%; hyphens: auto; -webkit-hyphens: auto; overflow-wrap: anywhere; }
.items.kids .item img { width: 64px; height: 64px; object-fit: contain; }
.items.adults .item { font-size: 15px; }
.item.found { border-color: var(--by, var(--good)); background: color-mix(in srgb, var(--by, #1fa35c) 12%, #fff); }
.item.found .item-name { text-decoration: line-through; text-decoration-thickness: 2px; color: var(--muted); }
.items.kids .item.found img { opacity: .4; }
.item.found::after {
  content: "✓"; position: absolute; right: 6px; top: 4px; color: var(--by, var(--good)); font-weight: 900; font-size: 18px;
}
#scoreBoard { display: flex; flex-direction: column; gap: 4px; }
.sb-row { display: flex; align-items: center; gap: 8px; padding: 4px 8px; border-radius: 10px; background: #fff; font-size: 14px; }
.sb-row.me { outline: 2px solid var(--accent); }
.sb-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* duel board: the name, and the player's store title as a muted line under it */
.sb-who { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.sb-who .mg-name-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot { width: 12px; height: 12px; border-radius: 50%; flex: 0 0 12px; display: inline-block; }
/* shared/site_audio.css pins #hudAudio fixed, bottom:12px, left:50% +
   translateX(-50%): restate ALL of it, or a partial override leaves it half-pinned */
#hudAudio {
  position: static; left: auto; bottom: auto; transform: none; z-index: auto;
  margin-top: auto; display: flex; justify-content: center;
}
#hudAudio .mps-audio { flex-wrap: wrap; justify-content: center; row-gap: 6px; }
#hudAudio .mps-audio-slider { width: 64px; }
/* the shared slider is pinned by web/style.css on some pages: reset it here */
#side .volume-slider, .lobby-audio .volume-slider { position: static; top: auto; }

/* floating cards & modals */
.float-card {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 20;
  width: min(420px, 92vw); max-width: 92vw; background: var(--panel); border: 3px solid var(--line);
  border-radius: 18px; padding: 18px 20px; box-shadow: 0 16px 50px rgba(0, 0, 0, .45); text-align: center;
}
.float-card h2 { margin: 0 0 8px; }
.float-card .sb-row { text-align: left; margin-top: 4px; }
.modal {
  position: fixed; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center;
  background: rgba(20, 14, 8, .6); padding: 12px;
}
.modal-card {
  position: relative;
  width: min(720px, 96vw); max-width: 96vw; max-height: 92vh; overflow-y: auto;
  background: #fbf6ea; color: #1f1a14; border-radius: 16px; padding: 20px 22px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .5); border: 2px solid #d4c4a6;
}
.case-card h2 { margin: 2px 0 8px; font-family: Georgia, "Times New Roman", serif; font-size: 28px; }
.case-card h3 { margin: 16px 0 6px; font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: #7b6a58; }
.case-genre { font-size: 12px; letter-spacing: .2em; text-transform: uppercase; color: #8a3b1c; font-weight: 800; }
.case-intro { font-family: Georgia, serif; font-size: 17px; line-height: 1.45; }
.suspects { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.suspect {
  display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center;
  padding: 12px 10px; border-radius: 14px; border: 2px solid #d4c4a6; background: #fff; color: #1f1a14;
}
.suspect:disabled { cursor: default; }
.suspects.pick .suspect:not(:disabled):hover { border-color: #8a3b1c; transform: translateY(-2px); }
.suspect.chosen { border-color: #8a3b1c; background: #f6e3d6; }
img.s-face { width: 84px; height: 84px; border-radius: 12px; object-fit: cover; border: 2px solid #d4c4a6; }
.s-face {
  width: 48px; height: 48px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: #3a2e22; color: #f3e6cc; font-family: Georgia, serif; font-size: 24px; font-weight: 700;
}
.s-name { font-weight: 800; }
.s-desc { font-size: 13px; color: #6b5a48; line-height: 1.3; }
.notes { margin: 0; padding-left: 22px; font-size: 14px; line-height: 1.4; }
.notes li { margin-bottom: 4px; }
.modal-card .primary { margin-top: 14px; }

/* ── lobby overlay ───────────────────────────────────────────────── */
#lobbyOverlay {
  position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 30% 20%, #6b4f33 0%, #2b2118 70%); padding: 12px; overflow-y: auto;
}
.card {
  position: relative; width: min(520px, 96vw); max-width: 96vw; max-height: 96vh; overflow-y: auto;
  background: var(--paper); border-radius: 22px; padding: 22px 22px 18px; text-align: center;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .5); border: 3px solid var(--line);
}
.card.results-wide { width: min(820px, 96vw); }
.title { margin: 6px 0 4px; font-size: 44px; font-weight: 900; letter-spacing: -.02em; color: var(--ink); }
.title.small { font-size: 30px; }
.title .amp { color: var(--accent); font-family: Georgia, serif; font-style: italic; }
.tagline { margin: 0 0 14px; color: var(--muted); }
#nameInput {
  width: 100%; padding: 12px 14px; border-radius: 12px; border: 2px solid var(--line);
  font-size: 18px; margin-bottom: 10px; background: #fff; color: var(--ink);
}
.primary {
  display: inline-block; padding: 12px 28px; border-radius: 14px; border: none;
  background: var(--accent); color: #fff; font-weight: 900; font-size: 18px;
  box-shadow: 0 4px 0 rgba(0, 0, 0, .2);
}
.primary:active { transform: translateY(2px); box-shadow: 0 2px 0 rgba(0, 0, 0, .2); }
.ghost-btn {
  display: inline-block; margin: 8px 4px 0; padding: 8px 16px; border-radius: 12px;
  border: 2px solid var(--line); background: #fff; color: var(--ink); font-weight: 700;
}
.instructions { margin-top: 14px; font-size: 13px; color: var(--muted); line-height: 1.6; }
.back-link { display: block; margin-top: 14px; color: var(--muted); font-size: 14px; }
.squad-count { font-weight: 800; margin-bottom: 8px; }
.player-list { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-bottom: 10px; }
.player-row { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; background: #fff; border: 2px solid var(--line); font-weight: 700; }
.set-row { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 8px 0; flex-wrap: wrap; }
.set-label { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 800; min-width: 64px; text-align: right; }
.seg { display: inline-flex; border-radius: 12px; overflow: hidden; border: 2px solid var(--line); }
.sbtn { padding: 8px 16px; border: none; background: #fff; color: var(--ink); font-weight: 800; }
.sbtn + .sbtn { border-left: 2px solid var(--line); }
.sbtn.active { background: var(--accent); color: #fff; }
.sbtn:disabled:not(.active) { opacity: .6; cursor: default; }
#setCase { padding: 8px 10px; border-radius: 10px; border: 2px solid var(--line); font-size: 15px; max-width: min(100%, 420px); min-width: 0; text-overflow: ellipsis; background: #fff; color: var(--ink); }
.blurb { font-size: 14px; margin: 6px 0 12px; }
#startBtn { margin-top: 4px; }
.leaderboard { margin-top: 12px; text-align: left; }
.lobby-audio { display: flex; justify-content: center; margin-bottom: 6px; }
.load-bar { height: 12px; border-radius: 8px; background: #e9dcc4; overflow: hidden; margin: 14px 0; }
#loadBar { height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.countdown { font-size: 96px; font-weight: 900; color: var(--accent); line-height: 1; }
.count-case { text-align: left; margin-bottom: 12px; }
.count-case h2 { font-family: Georgia, serif; margin: 4px 0; }
.count-case p { font-family: Georgia, serif; font-size: 16px; line-height: 1.45; }
.solution { text-align: left; background: #fff; border: 2px solid var(--line); border-radius: 14px; padding: 12px 16px; margin: 8px 0 12px; }
.solution h3 { margin: 4px 0; font-family: Georgia, serif; }

/* ── language toggle (EN | DE): lobby card, over the picture, case modals ── */
.lang-toggle {
  display: inline-flex; border-radius: 999px; overflow: hidden; border: 2px solid var(--line);
  background: rgba(255, 250, 240, .94); line-height: 1; flex: 0 0 auto;
}
.lang-toggle button {
  border: none; background: transparent; color: var(--muted); font-weight: 800; font-size: 13px;
  padding: 7px 11px; min-width: 40px; min-height: 32px; letter-spacing: .04em;
}
.lang-toggle button + button { border-left: 2px solid var(--line); }
.lang-toggle button.active { background: var(--accent); color: #fff; }
.card-top { display: flex; justify-content: flex-end; margin: -10px -8px 6px 0; }
.side-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex: 0 0 auto; }
.side-head .lang-toggle button { padding: 5px 9px; min-height: 28px; min-width: 36px; font-size: 12px; }
.modal-card .lang-toggle { float: right; margin: -4px -4px 6px 10px; }
.lobby-note {
  margin: 0 0 10px; padding: 8px 12px; border-radius: 10px; background: #fff3d6;
  border: 2px solid #e8c97a; font-weight: 700; font-size: 14px;
}

/* ── narrow / portrait: list becomes a strip under the picture ──── */
@media (max-width: 760px), (max-aspect-ratio: 1/1) {
  #main { flex-direction: column; }
  #side {
    flex: 0 0 auto; flex-direction: row; align-items: stretch; overflow-x: auto; overflow-y: hidden;
    border-left: none; border-top: 2px solid var(--line); padding: 6px 8px; gap: 8px; max-height: 128px;
  }
  .side-title#findTitle { display: none; }
  /* the toggle is the first thing in the strip, stacked so it costs 44 px */
  .side-head { align-self: center; }
  .side-head .lang-toggle { flex-direction: column; border-radius: 14px; }
  .side-head .lang-toggle button { min-width: 44px; min-height: 40px; font-size: 13px; }
  .side-head .lang-toggle button + button { border-left: none; border-top: 2px solid var(--line); }
  .items, .items.kids { display: flex; flex-direction: row; gap: 6px; }
  /* as wide as its word, so "Konzertflügel" is not broken to fit a tile that
     could simply be wider — the strip scrolls sideways anyway */
  .items.kids .item { flex: 0 0 auto; width: max-content; min-width: 78px; max-width: 124px; font-size: 12px; }
  #caseRow { flex-wrap: nowrap; }
  #caseRow .set-label { min-width: 44px; flex: 0 0 auto; }
  .items.kids .item img { width: 48px; height: 48px; }
  .items.adults .item { white-space: nowrap; font-size: 13px; }
  #scoreBoard { min-width: 130px; }
  #scoreBoard .side-title { display: none; }
  #hudAudio { margin-top: 0; min-width: 190px; align-items: center; }
  .tb-title { font-size: 14px; }
  .tb-timer { font-size: 20px; min-width: 54px; }
  .tb-btn { padding: 6px 8px; font-size: 13px; }
  .tb-btn span { display: none; }
  .tb-score .tb-label { display: none; }
  .title { font-size: 34px; }
}
/* the board's overlay card is hard-coded dark in rankings.css */
.lb-card { background: #fbf5e8; color: #2b2118; border: 2px solid #e4d6bd; }

/* the story: chapters + the cast */
.chapter { text-align: left; background: #fffdf6; border-left: 4px solid var(--accent); border-radius: 8px;
  padding: 8px 12px; margin: 10px 0; font-family: Georgia, serif; font-size: 15px; line-height: 1.45; color: #1f1a14; }
.chapter p { margin: 4px 0 0; }
.cast-row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin: 8px 0; }
.cast-row figure { margin: 0; width: 92px; text-align: center; font-size: 12px; }
.cast-row img { width: 84px; height: 84px; border-radius: 12px; object-fit: cover; border: 2px solid var(--line); display: block; margin: 0 auto 3px; }
.float-card.wide { width: min(620px, 94vw); max-width: 94vw; }
.chapter.told ul { margin: 4px 0 0; padding-left: 18px; font-size: 14px; }
.notes li.missed { color: #6b5a48; font-style: italic; }
