:root {
  --bg-0: #0c0f1e;
  --bg-1: #141a35;
  --glass: rgba(255, 255, 255, 0.05);
  --glass-2: rgba(255, 255, 255, 0.09);
  --panel: #141a2b;
  --line: rgba(255, 255, 255, 0.1);
  --text: #f2f4fb;
  --muted: #9aa5c4;
  --grad-primary: linear-gradient(135deg, #ff9f43, #ff4d7d);
  --grad-cool: linear-gradient(135deg, #5b7cfa, #38d9f5);
  --accent: #ffd166;
  --danger: #ff5c6c;
  --success: #55e08a;
  --radius: 18px;
  --font-display: 'Baloo 2', 'Segoe UI', system-ui, sans-serif;
  --font-body: 'Nunito', 'Segoe UI', system-ui, sans-serif;
}

/* Admin editorial planner */
.planner-panel {
  margin: 16px 0; padding: 18px; border: 1px solid rgba(255,203,87,.32);
  border-radius: 18px; background: linear-gradient(135deg, rgba(255,203,87,.09), rgba(102,215,196,.06));
  display: grid; grid-template-columns: minmax(260px,1fr); gap: 12px 24px; align-items: center;
}
.planner-panel h3 { margin: 2px 0 4px; font-family: var(--font-display); }
.planner-panel p { margin: 0; color: var(--muted); max-width: 720px; }
.planner-days { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit,minmax(160px,1fr)); gap: 8px; }
.planner-day { padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: rgba(10,14,27,.5); }
.planner-day b, .planner-day span { display: block; }
.planner-day b { font-size: .83rem; }
.planner-day span { font-size: .72rem; color: var(--muted); margin-top: 3px; }
.planner-day.sponsored { border-color: rgba(255,203,87,.65); }
.advanced-calendar-tools { margin: 14px 0 24px; border: 1px solid var(--line); border-radius: 14px; background: rgba(10,14,27,.35); }
.advanced-calendar-tools > summary { padding: 13px 15px; display: flex; justify-content: space-between; align-items: center; gap: 12px; cursor: pointer; }
.advanced-calendar-tools > .cal, .advanced-calendar-tools > #editor { margin-left: 14px; margin-right: 14px; width: calc(100% - 28px); }
.advanced-create-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 2px 14px 14px; }
.pilot-review-warning { margin-top: 7px; padding: 7px 8px; border-radius: 8px; background: rgba(255,209,102,.10); color: var(--accent); font-size: .7rem; line-height: 1.3; }
@media (max-width: 720px) {
  .planner-panel { grid-template-columns: 1fr; }
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font-body);
  color: var(--text);
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(1100px 500px at 85% -10%, rgba(91, 124, 250, 0.22), transparent 60%),
    radial-gradient(900px 500px at -10% 20%, rgba(255, 77, 125, 0.14), transparent 55%),
    radial-gradient(700px 400px at 50% 110%, rgba(56, 217, 245, 0.10), transparent 60%),
    linear-gradient(180deg, var(--bg-0), var(--bg-1));
  background-attachment: fixed;
  line-height: 1.45;
}

body > main,
body > footer,
body > .ad-rail {
  transition: opacity .16s ease;
}

@view-transition {
  navigation: auto;
}

::view-transition-old(root) {
  animation: shelf-page-out .12s ease-out both;
}

::view-transition-new(root) {
  animation: shelf-page-in .16s ease-out both;
}

@keyframes shelf-page-out {
  to { opacity: .82; }
}

@keyframes shelf-page-in {
  from { opacity: .72; }
}

h1, h2, h3, .brand, button { font-family: var(--font-display); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.error { color: var(--danger); }
.sr-only {
  position:absolute !important; width:1px !important; height:1px !important; padding:0 !important;
  margin:-1px !important; overflow:hidden !important; clip:rect(0,0,0,0) !important;
  white-space:nowrap !important; border:0 !important;
}
.skip-link {
  position:fixed; left:12px; top:8px; z-index:1000; transform:translateY(-150%);
  padding:10px 14px; border-radius:10px; background:#fff; color:#111; font-weight:900;
}
.skip-link:focus { transform:translateY(0); }
:where(a,button,input,select,textarea,[tabindex]):focus-visible {
  outline:3px solid #fff0a8; outline-offset:3px;
}

/* ---- Top bar ---- */
#topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 18px;
  background: rgba(12, 15, 30, 0.65);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  position: relative; z-index: 100;
  flex-wrap: wrap;
}
.brand {
  display:inline-flex; align-items:center; gap:7px; white-space:nowrap;
  font-weight: 800; font-size: 1.25rem; letter-spacing: .2px;
  background: var(--grad-primary);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  text-decoration:none;
}
.tagline {
  font-family: var(--font-body); font-weight: 600;
  font-size: .78rem; color: var(--muted);
  -webkit-text-fill-color: var(--muted); margin-left: 8px;
}
.mode-label {
  padding-left:14px; border-left:1px solid var(--line); color: var(--muted);
  font-size: .78rem; font-weight: 800; letter-spacing: .09em; text-transform: uppercase;
}
.user-area { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.game-switcher { display:flex; align-items:center; gap:4px; padding:4px; border:1px solid var(--line); border-radius:13px; background:#11172a; }
.game-switcher a { display:flex; align-items:center; gap:7px; min-height:34px; padding:6px 10px; border-radius:9px; color:#aeb8d2; font-size:.73rem; font-weight:900; text-decoration:none; white-space:nowrap; }
.game-switcher a:hover,.game-switcher a.active { color:#fff; background:rgba(255,255,255,.09); }
.suite-dot { width:9px; height:9px; display:grid; place-items:center; border:1px solid #5d6885; border-radius:50%; color:#07130c; font-size:.52rem; line-height:1; }
.game-switcher a.is-complete .suite-dot { width:15px; height:15px; border-color:#55e08a; background:#55e08a; }
.mobile-game-menu { display:none; position:relative; margin-left:auto; }
.mobile-game-menu summary { display:flex; min-width:42px; height:42px; align-items:center; justify-content:center; gap:9px; padding:0 11px; border:1px solid var(--line); border-radius:12px; background:#171e32; color:#fff; font-size:.76rem; font-weight:900; cursor:pointer; list-style:none; white-space:nowrap; }
.mobile-game-menu summary span[aria-hidden] { font-size:1.1rem; line-height:1; }
.mobile-game-menu summary::-webkit-details-marker { display:none; }
.mobile-game-menu[open] summary { border-color:#ff789c; background:#352039; }
.mobile-game-menu nav { position:absolute; z-index:120; top:48px; right:0; display:grid; min-width:210px; gap:4px; padding:7px; border:1px solid #4a5673; border-radius:14px; background:#11172a; box-shadow:0 18px 45px #000c; }
.mobile-game-menu a { display:flex; min-height:42px; align-items:center; justify-content:space-between; gap:12px; padding:8px 11px; border-radius:9px; color:#cbd3e7; font-size:.78rem; font-weight:900; text-decoration:none; }
.mobile-game-menu a:hover,.mobile-game-menu a.active { background:#ffffff12; color:#fff; }
.mobile-game-menu a.is-complete .suite-dot { width:15px; height:15px; border-color:#55e08a; background:#55e08a; }
.perfect-shelf { margin:10px 0; padding:9px 12px; border:1px solid #ffd16688; border-radius:11px; background:#ffd16616; color:#ffe49a; font-weight:900; text-align:center; }
.top-link { color:#dbe2f5; text-decoration:none; font-size:.84rem; font-weight:800; padding:9px 4px; }
.top-link:hover { color:var(--accent); }
.icon-button { width:44px; height:44px; padding:0; display:grid; place-items:center; }
.replay-button { min-height:44px; padding:8px 13px; white-space:nowrap; }

/* ---- Buttons & inputs ---- */
button {
  font: inherit; font-weight: 700; cursor: pointer;
  border-radius: 14px; border: 1px solid transparent;
  padding: 11px 18px; color: var(--text);
  transition: transform .12s, box-shadow .12s, filter .12s;
}
button:hover { transform: translateY(-1px); }
button:active { transform: translateY(0) scale(.97); }
button:disabled { cursor:not-allowed; }
.button-link, a.ghost {
  display:inline-flex; align-items:center; justify-content:center; border-radius:14px;
  padding:11px 18px; color:var(--text); text-decoration:none; font-family:var(--font-display); font-weight:700;
}
.primary {
  background: var(--grad-primary); color: #fff;
  box-shadow: 0 6px 18px rgba(255, 77, 125, 0.35);
}
.primary:hover { box-shadow: 0 8px 24px rgba(255, 77, 125, 0.5); }
.ghost {
  background: var(--glass-2); border: 1px solid var(--line);
}
.ghost:hover { background: rgba(255, 255, 255, 0.14); }
.ghost.used { opacity: .45; }
input, select, textarea {
  font: inherit; font-weight: 600; color: var(--text);
  background: rgba(10, 13, 26, 0.6);
  border: 1px solid var(--line); border-radius: 14px; padding: 12px 15px;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: #ff7d9d;
  box-shadow: 0 0 0 3px rgba(255, 77, 125, 0.22);
}
input::placeholder { color: #6b7595; font-weight: 500; }

/* ---- Layout ---- */
main { flex: 1; }
.screen { display: none; padding: 16px 18px 40px; max-width: 1080px; margin: 0 auto; width: 100%; }
.screen.active { display: block; animation: rise .3s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

#challengeBar {
  display: flex; justify-content: space-between; align-items: flex-end;
  gap: 12px; margin-bottom: 12px; flex-wrap: wrap;
}
#challengeBar h1 {
  margin: 0; font-size: clamp(1.55rem, 4vw, 2.2rem); font-weight: 700; letter-spacing: .2px;
}
#challengeBar p { margin: 3px 0 0; color: var(--muted); font-size: .9rem; }
.challenge-pills { display:flex; gap:8px; align-items:center; flex-wrap:wrap; }

/* ---- Shelf Hunt: progressive clues, five physical guesses, one reveal ---- */
.hunt-board {
  position: relative; overflow: hidden; margin: 0 0 14px; padding: clamp(15px, 2.5vw, 24px);
  border-radius: 24px; border: 1px solid #343e59;
  background:
    radial-gradient(circle at 8% 0%, rgba(255, 176, 76, .13), transparent 29%),
    radial-gradient(circle at 100% 100%, rgba(91, 124, 250, .12), transparent 35%),
    #0b1020;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .35);
}
.hunt-topline { display:flex; justify-content:flex-end; align-items:flex-start; gap:14px; margin-bottom:18px; }
.hunt-kicker { color:var(--accent); font-size:.7rem; font-weight:900; letter-spacing:.14em; }
.text-button { border:0; background:transparent; color:#b9c7ee; padding:8px 4px; min-height:44px; font:inherit; font-size:.78rem; font-weight:800; text-decoration:underline; text-decoration-color:#66789f; text-underline-offset:3px; }
.text-button:hover { color:var(--accent); text-decoration-color:currentColor; }
.hunt-progress { flex:none; padding:7px 12px; border:1px solid var(--line); border-radius:999px; background:var(--glass-2); font-size:.78rem; font-weight:900; }
.hunt-layout { display:grid; grid-template-columns:minmax(180px, .72fr) minmax(0, 1.55fr); gap:18px; align-items:stretch; }
.hunt-board.hunt-no-art .hunt-layout { grid-template-columns:minmax(0,1fr); }
.hunt-board.hunt-no-art .hunt-mystery { display:none; }
.hunt-board.hunt-complete .hunt-feedback,
.hunt-board.hunt-complete .hunt-guesses { display:none; }
.hunt-board.hunt-complete .dock-stack { margin-top:14px; }
.hunt-mystery {
  position:relative; min-height:290px; display:grid; place-items:center; align-content:center; gap:12px;
  overflow:hidden; border:1px solid #38435e; border-radius:20px;
  background:linear-gradient(145deg,#1d263c,#101629); color:#8e9ab8;
}
.hunt-mystery::before { content:""; position:absolute; inset:12px; border:1px dashed #46516c; border-radius:15px; }
.hunt-hint-art { position:absolute; inset:0; width:100%; height:100%; object-fit:cover; opacity:var(--hunt-art-opacity,.32); filter:blur(var(--hunt-art-blur,14px)) saturate(.82); transform:scale(1.08); transition:filter .45s ease,opacity .45s ease; }
.hunt-mystery.has-hint-art::after { content:""; position:absolute; inset:0; background:rgba(10,15,30,.22); pointer-events:none; }
.hunt-question { position:relative; z-index:1; font-family:"Baloo 2",sans-serif; font-size:7rem; line-height:.8; font-weight:900; color:#e3e8f6; text-shadow:0 4px 22px #000; }
#huntRevealLabel { position:relative; z-index:1; color:#aeb8d2; font-size:.73rem; font-weight:900; letter-spacing:.12em; text-align:center; }
.hunt-mystery.revealed { border-color:#54d896; animation:hunt-reveal .7s cubic-bezier(.2,.9,.2,1); background:radial-gradient(circle,#263b3d,#10182a 68%); }
.hunt-mystery.revealed::after { content:""; position:absolute; width:250px; height:250px; border:2px solid #64e7a7; border-radius:50%; opacity:.16; box-shadow:0 0 0 30px #64e7a712,0 0 0 60px #64e7a708; }
.hunt-mystery.revealed #huntRevealLabel { color:#75e6aa; font-size:1.05rem; letter-spacing:.04em; }
@keyframes hunt-reveal { 0%{transform:scale(.94);filter:brightness(1.7)} 65%{transform:scale(1.025)} 100%{transform:scale(1)} }
.hunt-clues { list-style:none; display:grid; gap:9px; padding:0; margin:0; }
.hunt-clue { display:grid; grid-template-columns:34px 1fr; align-items:center; gap:10px; min-height:48px; padding:9px 12px; border:1px solid var(--line); border-radius:13px; font-size:.86rem; font-weight:750; }
.hunt-clue .clue-number { width:30px; height:30px; display:grid; place-items:center; border-radius:9px; background:#29334d; color:#c9d2ea; font-size:.75rem; font-weight:900; }
.hunt-clue.unlocked { color:#f5f7ff; background:rgba(255,255,255,.055); animation:clue-in .45s ease-out both; }
.hunt-clue.unlocked:last-of-type .clue-number { background:#a56e1d; color:#fff0bb; }
.hunt-clue.locked { color:#8490ad; background:rgba(255,255,255,.018); }
.hunt-clue.not-needed { color:#9aa5bd; background:rgba(255,255,255,.025); border-style:dashed; }
.unused-clue-toggle { display:block; width:100%; min-height:44px; padding:3px 0; border:0; background:transparent; color:inherit; text-align:left; font:inherit; cursor:pointer; }
.unused-clue-toggle .clue-state { color:#9aa5bd; }
.unused-clue-text { display:block; filter:blur(5px); opacity:.42; user-select:none; transition:filter .22s ease,opacity .22s ease; }
.unused-clue-toggle.revealed .unused-clue-text { filter:none; opacity:.72; user-select:text; }
.unused-clue-toggle:focus-visible { outline:2px solid var(--accent); outline-offset:4px; border-radius:5px; }
.hunt-clue.solve-clue { color:#f5fff9; border-color:#55e08a; background:#153328; box-shadow:0 0 0 2px rgba(85,224,138,.12),0 10px 26px rgba(0,0,0,.18); }
.hunt-clue.solve-clue .clue-number { background:#2f9e62; color:#fff; }
.clue-state { display:block; color:#79e9aa; font-size:.66rem; letter-spacing:.08em; text-transform:uppercase; line-height:1.15; }
@keyframes clue-in { from{opacity:0;transform:translateX(12px)} }
.hunt-feedback { margin:14px 0 10px; min-height:44px; display:flex; align-items:center; justify-content:center; padding:9px 14px; border:1px solid transparent; border-radius:12px; background:#151c2f; color:#d8deef; text-align:center; font-size:.85rem; font-weight:800; transition:border-color .18s ease,background .18s ease; }
.hunt-feedback.is-wrong { border-color:#ff657e; background:#351721; color:#ffe7eb; }
.hunt-feedback.is-correct { border-color:#54d896; background:#173428; color:#ecfff5; }
.hunt-guesses { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:8px; margin-bottom:14px; }
.hunt-guess { position:relative; min-width:0; min-height:108px; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:5px; padding:7px; border:1px solid #37415a; border-radius:13px; background:#141a2a; color:#dce2f4; overflow:hidden; }
button.hunt-guess { cursor:pointer; }
.hunt-guess img { width:64px; height:64px; object-fit:contain; filter:drop-shadow(0 5px 6px #0007); }
.hunt-guess span { width:100%; display:-webkit-box; overflow:hidden; font-size:.65rem; line-height:1.05; font-weight:800; text-align:center; -webkit-box-orient:vertical; -webkit-line-clamp:2; }
.hunt-guess.failure { border-color:#ff657e; background:#321721; color:#fff0f3; box-shadow:0 0 0 2px rgba(255,101,126,.13); }
.hunt-guess.success { border-color:#54d896; background:#173428; box-shadow:0 0 24px #43c78322; }
.guess-result-mark { position:absolute; z-index:2; top:5px; right:6px; width:20px; height:20px; display:grid; place-items:center; border-radius:50%; background:#bc2748; color:#fff; font-size:.92rem; line-height:1; }
.hunt-guess.success .guess-result-mark { background:#2f9e62; }
.hunt-guess.empty { color:#5f6a86; border-style:dashed; }
.hunt-guess.empty b { font-size:1.1rem; }.hunt-guess.empty span { text-transform:uppercase; letter-spacing:.08em; }
.pill {
  background: var(--glass-2); border: 1px solid var(--line);
  padding: 8px 15px; border-radius: 999px; font-size: .88rem;
  font-weight: 700; white-space: nowrap;
  backdrop-filter: blur(8px);
}
.pill b { color: var(--accent); }

/* The stage IS the app: canvas dominates, controls sit BELOW the play area
 * (never over it) so buttons don't cover gameplay */
.stage-wrap { display: flex; flex-direction: column; gap: 12px; }
#gameHost {
  width: 100%;
  height: min(36dvh, 330px);
  min-height: 240px;
  border-radius: var(--radius); overflow: hidden;
  background: #0a0d1a;
  border: 1px solid var(--line);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 0 6px rgba(255, 255, 255, 0.02);
}
#gameHost canvas { border-radius: var(--radius); }

.dock {
  display: flex; gap: 10px; align-items: center; justify-content: center;
}
.dock-stack { display:grid; justify-items:center; gap:5px; }
.scan-alternatives { display:flex; justify-content:center; align-items:center; gap:18px; min-height:44px; }
.dock-main {
  background: var(--grad-primary); color: #fff;
  font-size: 1.05rem; font-weight: 800; padding: 14px 26px; border-radius: 999px;
  box-shadow: 0 10px 30px rgba(255, 77, 125, 0.45), 0 2px 0 rgba(255,255,255,.15) inset;
}
.dock-main:hover { box-shadow: 0 14px 36px rgba(255, 77, 125, 0.6); }
/* breathing glow: the scan button is the game's heartbeat */
.dock-main { animation: scan-breathe 2.6s ease-in-out infinite; }
.dock-main:disabled {
  animation: none;
  cursor: default;
  opacity: .68;
  box-shadow: none;
}
@keyframes scan-breathe {
  0%, 100% { box-shadow: 0 10px 30px rgba(255, 77, 125, 0.45), 0 2px 0 rgba(255,255,255,.15) inset; }
  50% { box-shadow: 0 10px 44px rgba(255, 159, 67, 0.75), 0 2px 0 rgba(255,255,255,.15) inset; }
}
/* home-screen CTA: THE button that starts the day */
#gameHost { position: relative; }
.cta-start {
  position: absolute; left: 50%; bottom: 26px; transform: translateX(-50%);
  z-index: 15; border: none; cursor: pointer;
  background: var(--grad-primary); color: #fff;
  font-family: var(--font-display); font-weight: 800; font-size: 1.15rem;
  padding: 16px 30px; border-radius: 999px; max-width: 90%;
  box-shadow: 0 12px 36px rgba(255, 77, 125, 0.55), 0 2px 0 rgba(255,255,255,.18) inset;
  animation: scan-breathe 2.6s ease-in-out infinite;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cta-start:hover { transform: translateX(-50%) scale(1.04); }
.cta-start.hidden { display: none; }

.next-countdown {
  text-align: center; font-weight: 700; color: var(--muted);
  background: var(--glass); border: 1px solid var(--line);
  border-radius: 12px; padding: 9px 14px; margin: 10px 0 0;
}
.next-countdown b { color: var(--accent); font-variant-numeric: tabular-nums; }
#streakPill { border-color: rgba(255, 159, 67, .5); }
.dock-side {
  width: 52px; height: 52px; padding: 0; border-radius: 50%;
  font-size: 1.35rem; display: grid; place-items: center;
  background: rgba(14, 18, 36, 0.75); border: 1px solid var(--line);
  backdrop-filter: blur(12px);
}
.icon-link {
  display: grid; place-items: center; width: 40px; height: 40px; padding: 0;
  border-radius: 12px; text-decoration: none; font-size: 1.05rem;
  background: var(--glass-2); border: 1px solid var(--line);
}

/* brand logo, footer, ad slot */
.brand-logo { width: 26px; height: 26px; vertical-align: -6px; border-radius: 7px; }
#siteFooter { border-top: 1px solid var(--line); margin-top: 26px; padding: 18px 16px 26px; }
.foot-inner {
  max-width: 1100px; margin: 0 auto; display: flex; align-items: center;
  justify-content: space-between; flex-wrap: wrap; gap: 12px;
}
.foot-brand { font-family: var(--font-display); font-weight: 800; font-size: 1.05rem; }
.foot-links { display: flex; flex-wrap:wrap; gap: 18px; }
.foot-links a { color: var(--muted); text-decoration: none; font-size: .88rem; font-weight: 700; }
.foot-links a:hover { color: var(--text); }
.foot-note { max-width:430px; font-size: .8rem; line-height:1.4; }
.foot-note a { color:#ffd166; }
.ad-slot { max-width: 1100px; margin: 18px auto 0; padding: 0 16px; min-height: 0; }
.ad-disclosure { display:block; margin:0 0 5px 4px; color:#929db9; font-size:.62rem; font-weight:800; letter-spacing:.1em; text-transform:uppercase; }
.house-ad {
  display: flex; align-items: center; gap: 14px; justify-content: center;
  border: 1px dashed var(--line); border-radius: var(--radius);
  padding: 14px 18px; background: var(--glass);
  color: var(--muted); font-size: .92rem; text-decoration: none;
}
.house-ad b { color: var(--text); }
.house-ad:hover { background: var(--glass-2); }
.sponsor-ad {
  display:flex; align-items:center; gap:14px; padding:13px 16px; border-radius:18px;
  border:1px solid rgba(255,203,87,.55); background:linear-gradient(135deg,rgba(255,203,87,.14),rgba(102,215,196,.10));
  color:var(--text); text-decoration:none; box-shadow:0 12px 35px #05081555;
}
.sponsor-ad img, .sponsor-ad-mark { width:58px; height:58px; flex:none; object-fit:contain; border-radius:13px; background:#fff; padding:6px; }
.sponsor-ad-mark { display:grid; place-items:center; background:var(--accent); color:#111; font-size:1.5rem; }
.sponsor-ad-copy { min-width:0; display:grid; flex:1; }
.sponsor-ad-copy small { color:var(--accent); font-size:.65rem; letter-spacing:.1em; text-transform:uppercase; font-weight:900; }
.sponsor-ad-copy b { font-family:var(--font-display); font-size:1.02rem; }
.sponsor-ad-copy span { color:var(--muted); font-size:.8rem; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.sponsor-ad > strong { flex:none; font-size:.78rem; color:var(--accent); }
.sponsor-ad:hover { transform:translateY(-1px); border-color:var(--accent); }
/* Desktop gutter inventory. Rails are hidden by default and are not mounted by
 * JS while hidden, so tablet/mobile never request invisible ads. Their width is
 * calculated from real free space instead of overlapping the game. */
body { --ad-content-max:1080px; }
body.sleuth-page { --ad-content-max:1440px; }
.ad-rail { display:none; }
@media (min-width:1540px) {
  body:not(.sleuth-page) .ad-rail {
    display:block; position:fixed; top:118px; z-index:5;
    width:clamp(120px,calc((100vw - var(--ad-content-max))/2 - 118px),300px);
    min-height:250px;
  }
}
@media (min-width:1900px) {
  body.sleuth-page .ad-rail {
    display:block; position:fixed; top:118px; z-index:5;
    width:clamp(120px,calc((100vw - var(--ad-content-max))/2 - 118px),300px);
    min-height:250px;
  }
}
.ad-rail-left { left:16px; }
.ad-rail-right { right:16px; }
.ad-rail .house-ad,.ad-rail .sponsor-ad { min-height:250px; flex-direction:column; align-items:stretch; text-align:center; justify-content:center; padding:14px 10px; }
.ad-rail .sponsor-ad img,.ad-rail .sponsor-ad-mark { margin:0 auto; width:76px; height:76px; }
.ad-rail .sponsor-ad-copy span { white-space:normal; }
.ad-rail .sponsor-ad > strong { margin-top:8px; }
.ad-slot .direct-display-ad img { width:min(68%,970px); height:auto; max-height:250px; aspect-ratio:970/250; object-fit:contain; padding:0; border-radius:9px; }
.ad-rail .direct-display-ad img { width:100%; height:auto; aspect-ratio:1/2; max-height:none; object-fit:contain; padding:0; border-radius:9px; }
.ad-rail .direct-display-ad { justify-content:flex-start; }
.replay-sponsor-dialog { width:min(540px,calc(100vw - 24px)); }
.replay-sponsor-dialog h2 { margin:4px 0 12px; }
.replay-sponsor-dialog .replay-sponsor-placement { margin:8px 0 12px; }
.replay-sponsor-dialog .replay-sponsor-placement .sponsor-ad { box-shadow:none; }
.replay-sponsor-dialog > .muted { font-size:.78rem; }
@media (max-width: 620px) {
  .sponsor-ad { align-items:flex-start; }
  .sponsor-ad > strong { display:none; }
  .sponsor-ad-copy span { white-space:normal; }
}

/* scan sheet */
.sheet-btn { width: 100%; padding: 14px; font-size: 1rem; }
.sheet-divider {
  display: flex; align-items: center; gap: 10px; color: var(--muted);
  font-size: .78rem; font-weight: 700; margin: 4px 0;
}
.sheet-divider::before, .sheet-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--line);
}
#scanSheet { display: none; }
#scanSheet[open] { display: flex; flex-direction: column; gap: 10px; }

.quiet-play-button { color: #ffd166; font-weight: 900; }
.product-picker-modal { width:min(820px,calc(100vw - 22px)); max-height:calc(100dvh - 28px); overflow:auto; }
.product-picker-filters { display:grid; grid-template-columns:minmax(230px,1fr) minmax(145px,.34fr) minmax(165px,.4fr); gap:9px; position:sticky; top:-1px; z-index:2; padding:8px 0 10px; background:var(--bg,#0e1224); }
.product-picker-status { min-height:1.4em; margin:2px 0 9px; font-size:.78rem; }
.product-picker-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:9px; }
.product-picker-card { min-width:0; display:grid; grid-template-rows:92px auto; gap:7px; padding:9px; border:1px solid var(--line); border-radius:14px; background:rgba(255,255,255,.045); color:var(--text); text-align:left; cursor:pointer; transition:transform .16s ease,border-color .16s ease,background .16s ease; }
.product-picker-card:hover,.product-picker-card:focus-visible { transform:translateY(-2px); border-color:#ffd166; background:rgba(255,209,102,.08); }
.product-picker-card:active { transform:scale(.98); }
.product-picker-card img { width:100%; height:92px; object-fit:contain; border-radius:9px; padding:4px; background:#fff; }
.product-picker-card b,.product-picker-card small { display:block; }
.product-picker-card b { display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; font-size:.8rem; line-height:1.18; }
.product-picker-card small { margin-top:4px; color:var(--muted); font-size:.66rem; text-transform:capitalize; }

@media (max-width:700px) {
  .product-picker-grid { grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
  .product-picker-filters { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .product-picker-filters input { grid-column:1 / -1; }
  .product-picker-card { grid-template-rows:88px auto; }
  .product-picker-card img { height:88px; }
  .scan-alternatives { gap:10px 14px; }
  .quiet-play-button { flex-basis:100%; }
}

/* ---- Toasts ---- */
.toast {
  position: fixed; top: 72px; left: 50%; transform: translateX(-50%);
  background: rgba(14, 18, 36, 0.92);
  border: 1px solid var(--line); backdrop-filter: blur(12px);
  padding: 12px 22px; border-radius: 999px; font-weight: 700; z-index: 300;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  animation: toast-in .28s cubic-bezier(.34,1.56,.64,1), toast-out .4s ease-in 3.2s forwards;
  max-width: 92vw; text-align: center;
}
.toast .pts { color: var(--accent); }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, -16px) scale(.92); } }
@keyframes toast-out { to { opacity: 0; transform: translate(-50%, -16px); } }

/* persistent busy indicator (removed in code, not by timer) */
.busy-toast { animation: toast-in .28s cubic-bezier(.34,1.56,.64,1); display: flex; align-items: center; gap: 10px; }
.spinner {
  width: 16px; height: 16px; border-radius: 50%; flex: none;
  border: 3px solid var(--line); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Dialogs ---- */
dialog {
  background: rgba(19, 24, 46, 0.92);
  color: var(--text); border: 1px solid var(--line);
  border-radius: 22px; padding: 26px; width: min(440px, 92vw);
  backdrop-filter: blur(20px);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  max-height:min(92dvh,760px); overflow:auto;
}
dialog[open] { animation: pop .28s cubic-bezier(.34,1.56,.64,1); }
@keyframes pop { from { opacity: 0; transform: scale(.92) translateY(12px); } }
dialog::backdrop { background: rgba(5, 7, 16, 0.7); backdrop-filter: blur(4px); }
dialog h2 { margin-top: 0; font-weight: 800; }
dialog form { display: flex; flex-direction: column; gap: 10px; }
dialog .row { display: flex; gap: 10px; margin-top: 14px; }
dialog .row button { flex: 1; }
.barcode-entry-help {
  margin:14px 0; border:1px solid #44516d; border-radius:14px;
  background:#10182b; overflow:hidden;
}
.barcode-entry-help summary {
  display:flex; align-items:center; gap:9px; min-height:45px; padding:9px 12px;
  color:#fff; font-size:.8rem; font-weight:900; cursor:pointer; list-style:none;
}
.barcode-entry-help summary::-webkit-details-marker { display:none; }
.barcode-entry-help summary > span {
  display:grid; place-items:center; width:24px; height:24px; flex:none;
  border-radius:50%; background:#ffd166; color:#15100a; font-family:var(--font-display); font-weight:900;
}
.barcode-entry-help[open] summary { border-bottom:1px solid #36415b; background:#17213a; }
.barcode-entry-guide { padding:12px; }
.barcode-entry-guide > p { margin:0 0 10px; color:#c5cee2; font-size:.76rem; line-height:1.45; }
.barcode-entry-guide b { color:#fff; }
.barcode-number-example {
  padding:10px 8px 8px; border-radius:11px; background:#fff; color:#101525;
  box-shadow:inset 0 0 0 1px #d8dce6;
}
.barcode-example-bars {
  height:58px; margin:0 25px 5px;
  background:repeating-linear-gradient(90deg,#111827 0 3px,transparent 3px 6px,#111827 6px 8px,transparent 8px 13px,#111827 13px 18px,transparent 18px 21px);
  border-inline:5px solid #111827;
}
.barcode-example-digits {
  display:grid; grid-template-columns:25px 1fr 1fr 25px; align-items:start;
  font:800 .88rem/1.1 ui-monospace,SFMono-Regular,Consolas,monospace; text-align:center; letter-spacing:.13em;
}
.barcode-example-digits b { position:relative; color:#e73368; letter-spacing:0; }
.barcode-example-digits small {
  position:absolute; top:18px; left:50%; transform:translateX(-50%);
  color:#a51d48; font:900 .42rem/1 var(--font-body); letter-spacing:.04em;
}
.barcode-type-example { margin:17px 0 0!important; color:#d8def0!important; text-align:center; }
.barcode-type-example code { padding:3px 6px; border-radius:6px; background:#252e45; color:#ffd166; font-size:.8rem; }
.barcode-entry-meta { display:flex; justify-content:space-between; gap:12px; margin:7px 2px 0; color:#9da9c4; font-size:.7rem; line-height:1.3; }
.barcode-entry-meta p { margin:0; }
.barcode-entry-meta output { flex:none; color:#ffd166; font-weight:900; }
.game-result-panel {
  position:relative;
  width:min(900px,calc(100% - 28px));
  margin:22px auto 30px;
  padding:24px;
  overflow:hidden;
  border:1px solid #3d4c69;
  border-radius:20px;
  background:linear-gradient(145deg,#171f34,#11182a);
  color:var(--text);
  box-shadow:0 18px 48px rgba(3,7,18,.3);
  text-align:center;
}
.game-result-panel::before {
  content:'';
  position:absolute;
  inset:0 0 auto;
  height:4px;
  background:linear-gradient(90deg,#ff9346,#ff5c80 40%,#65efd6);
}
.game-result-panel.is-visible { animation:result-panel-enter .62s cubic-bezier(.18,.82,.24,1) both; }
.game-result-panel h2 { margin-top:0; font-weight:800; }
.game-result-panel .row { display:flex; gap:10px; margin-top:14px; }
.game-result-panel .row > * { flex:1; }
@keyframes result-panel-enter {
  from { opacity:0; transform:translateY(20px); clip-path:inset(0 0 28% 0 round 20px); }
  to { opacity:1; transform:translateY(0); clip-path:inset(0 0 0 0 round 20px); }
}
.dialog-close {
  position:absolute; z-index:2; top:10px; right:10px; width:44px; height:44px;
  display:grid; place-items:center; padding:0; border:1px solid var(--line);
  border-radius:50%; background:rgba(255,255,255,.07); color:var(--text);
  font-family:var(--font-display); font-size:1.55rem; line-height:1;
}
.dialog-close:hover { background:rgba(255,255,255,.15); }
.dialog-close:focus-visible { outline:3px solid var(--accent); outline-offset:2px; }

/* Shared game instructions: every game uses the same button and modal. */
.how-to-button {
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  width:fit-content; flex:none; justify-self:end;
  min-height:42px; padding:9px 14px; border:1px solid #4a5673;
  border-radius:999px; background:#171f33; color:#f4f6ff;
  font-family:var(--font-body); font-size:.78rem; font-weight:900;
  white-space:nowrap; box-shadow:0 8px 22px rgba(0,0,0,.2);
  transition:transform .16s ease,border-color .16s ease,background .16s ease;
}
.how-to-button span {
  width:21px; height:21px; display:grid; place-items:center; border-radius:50%;
  background:#ffd166; color:#17120a; font-family:var(--font-display);
  font-size:.78rem; line-height:1;
}
.how-to-button:hover { transform:translateY(-1px); border-color:#ffd166; background:#202a42; }
.how-to-button:focus-visible { outline:3px solid #ffd166; outline-offset:3px; }
.how-to-dialog { width:min(600px,calc(100vw - 24px)); padding:28px; text-align:left; }
.how-to-dialog .how-to-kicker {
  margin:0 50px 3px 0; color:#ffd166; font-size:.66rem; font-weight:1000;
  letter-spacing:.13em; text-transform:uppercase;
}
.how-to-dialog h2 { margin:0 48px 5px 0; font-family:var(--font-display); font-size:clamp(1.65rem,5vw,2.15rem); line-height:1; }
.how-to-dialog .how-to-lead { margin:0 0 18px; color:#c4cce1; font-size:.9rem; line-height:1.5; }
.how-to-steps { display:grid; gap:10px; margin:0; padding:0; list-style:none; counter-reset:how-step; }
.how-to-steps li {
  display:grid; grid-template-columns:36px minmax(0,1fr); gap:11px; align-items:start;
  padding:11px 12px; border:1px solid #38435e; border-radius:13px; background:#11182a;
  counter-increment:how-step;
}
.how-to-steps li::before {
  content:counter(how-step); width:32px; height:32px; display:grid; place-items:center;
  border-radius:10px; background:#29344f; color:#ffd166; font-family:var(--font-display);
  font-size:.9rem; font-weight:900;
}
.how-to-steps b { display:block; color:#fff; font-size:.86rem; }
.how-to-steps p { margin:2px 0 0; color:#b8c2d9; font-size:.77rem; line-height:1.42; }
.how-to-note {
  margin-top:12px; padding:11px 13px; border:1px solid #ffd16655;
  border-radius:12px; background:#ffd1660d; color:#f4dfa7; font-size:.76rem; line-height:1.45;
}
.how-to-note b { color:#ffd166; }
.how-to-dialog .row { margin-top:16px; }
.how-to-dialog .row .primary { min-height:46px; }

@media (max-width:560px) {
  .how-to-button { min-height:38px; padding:7px 11px; font-size:.7rem; }
  .how-to-button span { width:19px; height:19px; font-size:.7rem; }
  .how-to-dialog { padding:22px 16px 16px; border-radius:18px; }
  .how-to-dialog .how-to-lead { margin-bottom:12px; font-size:.8rem; }
  .how-to-steps { gap:7px; }
  .how-to-steps li { grid-template-columns:31px minmax(0,1fr); gap:9px; padding:9px; }
  .how-to-steps li::before { width:28px; height:28px; border-radius:8px; font-size:.78rem; }
  .how-to-steps b { font-size:.79rem; }
  .how-to-steps p,.how-to-note { font-size:.7rem; }
  .barcode-entry-guide { padding:10px; }
  .barcode-example-bars { height:50px; }
  .barcode-entry-meta { font-size:.64rem; }
}
#pairQr { width: 100%; max-width: 300px; border-radius: 16px; display: block; margin: 12px auto; background: #fff; padding: 10px; }
.pair-link-row { display:grid; grid-template-columns:1fr 1fr; gap:8px; }
#scanVideo { width: 100%; border-radius: 16px; background: #000; aspect-ratio: 4/3; object-fit: cover; }
.scanner-viewport { position:relative; overflow:hidden; border-radius:16px; background:#000; }
.scanner-viewport #scanVideo { display:block; border-radius:0; }
.scanner-guide { position:absolute; z-index:2; left:9%; right:9%; top:37%; height:26%; border:3px solid rgba(255,209,102,.95); border-radius:14px; box-shadow:0 0 0 999px rgba(3,5,12,.27),0 0 20px rgba(255,209,102,.3); pointer-events:none; }
.scanner-guide::before,.scanner-guide::after { content:''; position:absolute; left:8%; right:8%; height:2px; background:#ff5c6c; box-shadow:0 0 9px #ff5c6c; }
.scanner-guide::before { top:34%; }.scanner-guide::after { bottom:34%; opacity:.5; }
.privacy-note { font-size: .75rem; color: var(--muted); }
.info-badge { width:38px; height:38px; display:grid; place-items:center; border-radius:50%; background:#26395d; color:#dce7ff; font-family:var(--font-display); font-weight:900; font-size:1.25rem; }
.external-learn-link { color:var(--accent); font-weight:900; }
.fine-print { color:var(--muted); font-size:.72rem; }

/* result card */
#resultModal { position:relative; text-align:center; }
#resultBadge { font-size:38px; filter:drop-shadow(0 5px 12px rgba(255,209,102,.22)); }
.result-details {
  display: flex; flex-direction: column; gap: 7px; margin: 16px 0; text-align: left;
  background: var(--glass); border: 1px solid var(--line);
  border-radius: 14px; padding: 14px 17px;
}
.chip {
  display: inline-block; background: rgba(255, 209, 102, 0.14);
  border: 1px solid rgba(255, 209, 102, 0.3);
  border-radius: 999px; padding: 2px 11px; font-size: .78rem;
  font-weight: 700; color: var(--accent); margin: 2px 1px;
}
.compare { color: var(--success); font-size: .9rem; min-height: 1.2em; font-weight: 600; }
#resultModal .row { display:grid; grid-template-columns:1fr; }

/* Earned sponsor rewards shown only after a game is complete. */
.shelf-drop { margin:14px 0; padding:16px; border:1px solid rgba(79,224,200,.62); border-radius:16px; background:linear-gradient(145deg,rgba(23,75,78,.72),rgba(27,31,62,.96)); box-shadow:inset 4px 0 #4fe0c8,0 12px 34px rgba(7,12,30,.22); color:#f5fbff; text-align:left; }
.shelf-drop-kicker { color:#65efd6; font-size:.68rem; font-weight:950; letter-spacing:.11em; text-transform:uppercase; }
.shelf-drop-disclosure { margin-bottom:5px; color:#b8c3d8; font-size:.61rem; font-weight:900; letter-spacing:.1em; text-transform:uppercase; }
.shelf-drop h3 { margin:5px 0 3px; font-family:var(--font-display); font-size:1.15rem; }
.shelf-drop > p { margin:5px 0 10px; color:#d9e6ee; font-size:.84rem; }
.shelf-drop-code { display:flex; align-items:center; justify-content:space-between; gap:12px; margin:12px 0; padding:10px 11px; border:1px dashed rgba(255,255,255,.38); border-radius:12px; background:rgba(6,12,28,.46); }
.shelf-drop-code span,.shelf-drop-code small,.shelf-drop-code b { display:block; }
.shelf-drop-code small { color:#9fb1c5; font-size:.62rem; font-weight:900; letter-spacing:.08em; text-transform:uppercase; }
.shelf-drop-code b { margin-top:2px; color:#fff; font:900 1.08rem ui-monospace,SFMono-Regular,Consolas,monospace; letter-spacing:.08em; }
.shelf-drop-code button,.sponsor-buy-links button { min-height:38px; padding:7px 12px; border:1px solid rgba(101,239,214,.62); border-radius:10px; background:#173e43; color:#ecfffb; font-weight:900; cursor:pointer; }
.shelf-drop-actions { display:flex; gap:8px; flex-wrap:wrap; }
.shelf-drop-actions .primary { min-height:42px; }
.shelf-drop-validity { margin-top:9px; color:#b9cbd7; font-size:.7rem; font-weight:800; }
.shelf-drop-terms { margin-top:8px; color:#b9cbd7; font-size:.72rem; }
.shelf-drop-terms summary { width:max-content; color:#dce8ef; cursor:pointer; font-weight:850; text-decoration:underline; text-underline-offset:3px; }
.shelf-drop-terms p { margin:6px 0 0; }
.shelf-drop-parent { margin:9px 0 0!important; color:#aebfce!important; font-size:.68rem!important; }
.shelf-drop-mini { margin-top:8px; padding:7px 9px; border-radius:9px; background:rgba(79,224,200,.12); color:#72ead7; font-size:.72rem; font-weight:850; }
.commerce-gate { position:relative; width:min(440px,calc(100vw - 28px)); text-align:center; }
.commerce-gate-icon { font-size:2.6rem; }
.commerce-gate h2 { margin:6px 0; }
.commerce-gate .row { display:grid; grid-template-columns:1fr 1fr; gap:9px; margin-top:16px; }
.commerce-gate .row a { display:flex; align-items:center; justify-content:center; text-decoration:none; }

/* ---- Pantry picker ---- */
#pantryGrid { max-height: 58vh; overflow-y: auto; margin: 8px 0; padding-right: 4px; }
.pantry-group {
  font-family: var(--font-display); font-weight: 700; color: var(--muted);
  font-size: .82rem; text-transform: uppercase; letter-spacing: 1px; margin: 14px 2px 8px;
}
.pantry-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); gap: 9px; }
.pantry-item {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: var(--glass-2); border: 1px solid var(--line); border-radius: 16px;
  padding: 12px 6px; cursor: pointer;
}
.pantry-item:hover { transform: translateY(-3px); border-color: #ff7d9d; box-shadow: 0 8px 20px rgba(255, 77, 125, .2); }
.pantry-item .pe { font-size: 32px; line-height: 1; }
.pantry-item .pn { font-size: .72rem; font-weight: 700; text-transform: capitalize; }

/* ---- Cards / grids (admin inventory, item info) ---- */
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); margin: 14px 0; }
.card {
  background: var(--glass); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; display: flex; flex-direction: column; gap: 6px; align-items: center; text-align: center;
  transition: transform .15s, border-color .15s;
}
.card:hover { transform: translateY(-2px); }
.sprite-frame {
  width: 144px; height: 144px; display: grid; place-items: center;
  overflow: hidden; border: 1px solid var(--line); border-radius: 16px;
  background-color: #f1f3f7;
  background-image: linear-gradient(45deg, #dfe3ea 25%, transparent 25%),
    linear-gradient(-45deg, #dfe3ea 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #dfe3ea 75%),
    linear-gradient(-45deg, transparent 75%, #dfe3ea 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
}
.card .sprite-frame img.sprite { width: 132px; height: 132px; object-fit: contain; }
.card .name { font-weight: 800; font-size: .9rem; line-height: 1.25; }
.card .sub { font-size: .72rem; color: var(--muted); word-break: break-word; }
.card select, .card button { width: 100%; padding: 7px; font-size: .8rem; border-radius: 10px; }
.card.rejected { opacity: .45; border-color: rgba(255, 92, 108, .4); }
.pipeline-note {
  margin-top: 12px; padding: 11px 14px; border-radius: 12px;
  background: rgba(91, 124, 250, .10); border: 1px solid rgba(91, 124, 250, .25);
  color: #cbd4ee; font-size: .82rem; line-height: 1.45;
}
.art-source { color: var(--muted); }
.art-source.needs-cleanup { color: #ff9f43; font-weight: 800; }

/* ---- Admin ---- */
.admin-wrap { max-width: 1120px; margin: 0 auto; padding: 18px; }
table.cal { width: 100%; border-collapse: collapse; margin: 14px 0; }
table.cal th, table.cal td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: .9rem; }
.status-badge { padding: 3px 12px; border-radius: 999px; font-size: .74rem; font-weight: 800; }
.status-live { background: rgba(85, 224, 138, .16); color: var(--success); }
.status-scheduled { background: rgba(91, 124, 250, .18); color: #9db1ff; }
.status-draft { background: rgba(255,255,255,.1); color: #ccc; }
.status-archived { background: rgba(255,255,255,.05); color: #778; }
.admin-form {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px;
  background: var(--glass); padding: 18px; border-radius: var(--radius); border: 1px solid var(--line);
}
.admin-form label { display: flex; flex-direction: column; gap: 4px; font-size: .78rem; color: var(--muted); font-weight: 700; }
.admin-form .full { grid-column: 1 / -1; }
.admin-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; align-items: center; }
.bg-thumb { width: 190px; border-radius: 12px; display: block; border: 1px solid var(--line); }

/* ---- Mobile: the game fills the screen like an app ---- */
@media (max-width: 680px) {
  body { background-attachment: scroll; }
  .tagline { display: none; }
  #topbar { padding: 10px 12px; gap: 8px; }
  .screen { padding: 10px 8px 16px; }
  #challengeBar { margin-bottom: 8px; }
  #challengeBar p { font-size: .82rem; }
  /* canvas takes the rest of the viewport below header + title, dock below */
  #gameHost {
    height: min(28dvh, 240px);
    min-height: 190px; max-height: 240px;
    border-radius: 16px;
  }
  .stage-wrap { gap: 10px; }
  .dock-stack { width:100%; }
  .dock { width: 100%; }
  .dock-main { flex: 1; max-width: 300px; padding: 15px 18px; }
  .dock-side { width: 54px; height: 54px; }
  .hunt-board { padding:12px 9px; border-radius:17px; }
  .hunt-topline { margin-bottom:10px; }
  .text-button { font-size:.74rem; }
  .hunt-progress { padding:6px 9px; font-size:.68rem; }
  .hunt-layout { grid-template-columns:92px minmax(0,1fr); gap:8px; }
  .hunt-mystery { min-height:100%; border-radius:14px; }
  .hunt-question { font-size:4rem; }
  #huntRevealLabel { font-size:.55rem; padding:0 4px; }
  .hunt-mystery.revealed #huntRevealLabel { font-size:.7rem; }
  .hunt-clues { gap:5px; }
  .hunt-clue { grid-template-columns:27px 1fr; min-height:44px; padding:7px 8px; gap:7px; border-radius:10px; font-size:.82rem; line-height:1.24; }
  .hunt-clue .clue-number { width:24px; height:24px; border-radius:7px; font-size:.64rem; }
  .hunt-feedback { margin:9px 0 7px; min-height:38px; font-size:.73rem; }
  .hunt-guesses { gap:5px; margin-bottom:10px; }
  .hunt-guess { min-height:67px; padding:4px; border-radius:10px; }
  .hunt-guess img { width:36px; height:36px; }
  .hunt-guess span { font-size:.52rem; }
  .challenge-pills { width:100%; }
  .foot-links { gap:12px; flex-wrap:wrap; }
}

@media (max-width:900px) {
  #topbar { flex-wrap:nowrap; }
  #topbar > .user-area { display:none; }
  .mobile-game-menu { display:block; }
  .mode-label { display:none; }
}

/* Phones need the horizontal space for readable clues. The mystery artwork
 * remains part of tablet/desktop play while a hunt is active. */
@media (max-width: 560px) {
  #challengePrompt,
  .sleuth-hero > div > p,
  .sense-heading > div > p,
  .breaker-heading > div > p,
  .trail-heading > div > p { display:none; }
  #challengeBar { display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:center; gap:7px; }
  #challengeBar > div:first-child { min-width:0; }
  #challengeBar h1 { margin:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
  /* Keep every game's instructions beside its title. Individual game sheets
   * previously switched some headings to block/grid layouts after this shared
   * stylesheet loaded, which pushed the button onto a second row. */
  body .game-page-heading {
    display:flex; flex-flow:row nowrap; align-items:center; justify-content:space-between;
    gap:7px; width:100%;
  }
  body .game-page-heading > :first-child { min-width:0; }
  body .game-page-heading h1 {
    min-width:0; margin:0; overflow:hidden; font-size:clamp(1.2rem,5.8vw,1.48rem);
    line-height:1.06; text-overflow:ellipsis; white-space:nowrap;
  }
  body .game-page-heading .how-to-button {
    min-height:36px; padding:6px 9px; gap:6px; font-size:.67rem;
  }
  body .game-page-heading .how-to-button span { width:18px; height:18px; font-size:.66rem; }
  .challenge-pills { width:auto; flex-wrap:nowrap; gap:5px; }
  .challenge-pills .pill { padding:6px 9px; font-size:.72rem; }
  .hunt-layout { grid-template-columns:minmax(0,1fr); gap:7px; }
  .hunt-mystery { display:none; }
  .scan-alternatives { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:5px; width:100%; }
  .scan-alternatives .text-button { min-width:0; min-height:42px; padding:5px 3px; font-size:.65rem; line-height:1.15; text-align:center; }
  .quiet-play-button { flex-basis:auto; }
  dialog { width:min(400px,calc(100vw - 20px)); max-height:calc(100dvh - 20px); padding:20px 16px; }
  .game-result-panel { width:calc(100% - 16px); margin:14px auto 22px; padding:18px 14px; border-radius:16px; }
  .game-result-panel .row { display:grid; grid-template-columns:1fr; }
  #resultBadge { font-size:32px; line-height:1; }
  #resultModal h2 { margin:7px 0 4px; }
  #resultModal > .muted { margin:5px 0; }
  .result-details { gap:5px; margin:10px 0; padding:10px 12px; }
  .result-reveal-image { width:82px; height:82px; }
  .compare { margin:7px 0; font-size:.78rem; }
  .shelf-drop { margin:9px 0; padding:12px; }
  .shelf-drop h3 { font-size:1rem; }
  .shelf-drop-code { margin:9px 0; }
  .commerce-gate .row { grid-template-columns:1fr; }
}

@media (max-width: 360px) {
  /* Preserve the full game title on very narrow phones while retaining an
   * accessible How to play control. Its text remains the accessible name. */
  body .game-page-heading .how-to-button { width:36px; padding:0; gap:0; font-size:0; }
}

@media (max-width: 480px) {
  .brand { font-size:1.08rem; }
  .brand-logo { width:24px; height:24px; }
  .user-area { gap:6px; }
  .top-link { font-size:.75rem; }
  .replay-button { width:44px; padding:0; }
  .replay-button span { display:none; }
  .hunt-layout { grid-template-columns:minmax(0,1fr); gap:7px; }
  .hunt-reveal-gallery { width:70px; }
  .hunt-guess span { display:none; }
  .hunt-guess { min-height:58px; }
  #resultModal .row { grid-template-columns:1fr; }
  .pair-link-row { grid-template-columns:1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior:auto !important; animation-duration:.01ms !important; animation-iteration-count:1 !important; transition-duration:.01ms !important; }
  ::view-transition-old(root), ::view-transition-new(root) { animation:none !important; }
}

@media (forced-colors: active) {
  .hunt-clue.solve-clue, .hunt-guess.success, .hunt-guess.failure { border-width:3px; }
  .primary, .dock-main { border:2px solid ButtonText; }
}

@media (max-width:680px) {
  .hunt-guess { min-height:82px; padding:4px; }
  .hunt-guess img { width:46px; height:46px; }
  .hunt-guess span { display:-webkit-box; font-size:.55rem; }
}
@media (max-width:480px) {
  .hunt-guess { min-height:74px; }
  .hunt-guess img { width:40px; height:40px; }
  .hunt-guess span { display:-webkit-box; font-size:.48rem; }
}
