:root { --gb-ad-bottom: 0px; --gb-safe-bottom: max(var(--gb-ad-bottom), env(safe-area-inset-bottom, 0px)); --gb-kb-inset: 0px; --gb-view-h: 100dvh; }
/* Keep the provider's real consent action and click handler, without adding a
   footer below a viewport-height game. This does not style the consent dialog. */
#consumer-privacy-footer-wrapper.consumer-privacy {
  position: fixed !important;
  inset: auto 6px calc(6px + var(--gb-safe-bottom)) auto !important;
  width: auto !important; max-width: calc(100vw - 80px) !important;
  height: auto !important; min-height: 0 !important;
  margin: 0 !important; padding: 0 !important;
  z-index: 150;
}
#consumer-privacy-footer-wrapper .consumer-privacy-footer-btn {
  display: block; max-width: 100%; min-height: 28px;
  margin: 0 !important; padding: 4px 8px !important;
  font: 11px/1.3 system-ui, sans-serif !important;
  border: 1px solid var(--border, #75899d); border-radius: 5px;
  background: var(--surface, #fff); color: var(--text, #172638);
}
/* The entire play surface ends above an actual bottom overlay, at every width. */
#game-screen, #flag-screen, #outline-screen { height: calc(100dvh - var(--gb-safe-bottom)); min-height: 0; }
/* The typing screens also end above a phone keyboard (measured by
   keyboard-viewport.js), which otherwise covers the flag and outline lists. */
#flag-screen, #outline-screen { height: calc(100dvh - max(var(--gb-safe-bottom), var(--gb-kb-inset))); }
#menu-screen { padding-bottom: calc(36px + var(--gb-safe-bottom)); scroll-padding-bottom: calc(36px + var(--gb-safe-bottom)); }
.flag-area { min-height: 0; }
.flag-progress { min-height: 90px; padding-bottom: 48px; scroll-padding-bottom: 48px; }
#end-screen { bottom: var(--gb-safe-bottom); padding: 20px; overflow-y: auto; justify-content: safe center; }
#end-screen.map-reveal { justify-content: flex-start; align-items: center; padding: 10px 12px; }
#end-chip { border-radius: 12px; flex-wrap: wrap; justify-content: center; max-width: 100%; }
#chip-again-btn { background: var(--accent); color: white; font-weight: 700; min-height: 40px; }
body.gb-review .flag-area { padding-top: 64px; }
body.gb-review #game-screen .hud { visibility: hidden; }
body.gb-review #flag-screen .hud, body.gb-review #outline-screen .hud { visibility: hidden; }
.flag-container.wrong .flag-pip { opacity: 1; filter: grayscale(.6); }
.flag-container.revealed .flag-pip { opacity: 1; border-color: var(--red); }
.flag-container.revealed .flag-name { color: var(--red); }
.flag-container.correct .flag-name::before { content: '✓ '; }
.flag-container.wrong .flag-name::before, .flag-container.revealed .flag-name::before { content: '✗ '; }
/* Chromium outlines a focused SVG's bounding box even after a pointer click.
   Suppress that rectangle for map shapes only; keyboard focus follows the shape. */
.country-path:focus, .microstate-dot:focus { outline: none; }
.country-path:focus-visible, .microstate-dot:focus-visible { stroke: #f28b18; stroke-width: 3px; filter: drop-shadow(0 0 3px #fff); }
.keyboard-help { font-size: .75rem; color: var(--text-muted); margin: 4px 12px; }
.outline-note { font-size: .72rem; color: var(--text-muted); max-width: 360px; text-align: center; margin: 0; }
#outline-svg { max-height: min(calc(var(--gb-view-h) * .34), 280px); max-width: 100%; }
/* Flag SVGs have a viewBox but no width or height, so an automatic width
   collapses them to 0×0. Size the image explicitly from its 4:3 frame. */
.flag-img { aspect-ratio: 4 / 3; height: auto; width: min(clamp(140px, 28vw, 280px), calc(var(--gb-view-h) * .3 * 4 / 3)); }
.flag-container.current .flag-pip { opacity: 1; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }
body.gb-keyboard-open .flag-area { gap: 6px; padding-top: 6px; }
body.gb-keyboard-open .flag-display { gap: 2px; }
body.gb-keyboard-open .flag-feedback { min-height: 1.35rem; font-size: 1.05rem; }
body.gb-keyboard-open .outline-note { display: none; }
body.gb-keyboard-open #outline-svg { max-height: min(calc(var(--gb-view-h) * .26), 280px); }
body.gb-keyboard-open .flag-progress { padding-bottom: 12px; scroll-padding-bottom: 12px; }
body.gb-review #flag-screen .flag-display, body.gb-review #outline-screen .flag-display { display: none; }
/* Daily and practice layouts also reserve the same measured space. */
body.gb-deduction .app-layout { height: calc(100dvh - var(--gb-safe-bottom)); }
body.gb-deduction .modal-overlay { bottom: var(--gb-safe-bottom); padding-bottom: 24px; overflow-y: auto; }
body.gb-deduction .post-reveal-bar { bottom: calc(18px + var(--gb-safe-bottom)); }
@media (max-width: 900px) {
  /* Stats/actions, the full question and the answer field each get room. */
  #game-screen .hud-title, #flag-screen .hud-title, #outline-screen .hud-title { display: none; }
  #game-screen .hud, #flag-screen .hud, #outline-screen .hud {
    flex-wrap: wrap; height: auto; min-height: 52px; max-height: none;
    padding: 8px; gap: 6px; overflow: visible;
  }
  .hud .hud-divider { display: none; }
  .hud .hud-input-wrap { flex: 1 1 100%; order: 2; min-width: 0; }
  .hud .hud-input { flex: 1 1 auto; width: 100%; min-width: 0; max-width: none; }
  .hud .streak-badge { flex-shrink: 0; }
  .hud .btn-small { flex-shrink: 0; min-height: 32px; font-size: .75rem; }
  #hud-prompt:not(.hidden) {
    flex: 1 0 100%; order: 1; max-width: none; min-width: 0;
    white-space: normal; overflow: visible; overflow-wrap: anywhere;
  }
}
@media (max-width: 600px) {
  .flag-progress { padding-bottom: 48px; }
  #end-screen, #end-screen.map-reveal { padding-bottom: 20px; }
  #menu-screen { padding-bottom: calc(36px + var(--gb-safe-bottom)); }
  #end-chip { gap: 6px; padding: 6px 10px; }
  #end-chip-score { font-size: .78rem; }
  .flag-area { gap: 8px; padding-top: 10px; }
  .flag-img { width: min(70vw, calc(var(--gb-view-h) * .2 * 4 / 3)); }
}

/* Sound and voice controls (game-sound.js, voice-input.js). */
.gb-icon-btn {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 34px; height: 34px; padding: 0; border: 1.5px solid var(--border); border-radius: var(--r-sm, 8px);
  background: var(--surface); color: var(--text); font: 1rem/1 system-ui, sans-serif; cursor: pointer;
  touch-action: manipulation; transition: border-color .15s, background .15s;
}
.gb-icon-btn:hover { border-color: var(--accent); }
.gb-icon-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.gb-icon-btn[hidden] { display: none; }
.gb-sound-btn.is-on { border-color: var(--accent); background: var(--accent-light); }
.gb-voice-btn.is-listening { border-color: var(--red); background: var(--red); color: #fff; animation: gbListening 1.4s ease-in-out infinite; }
@keyframes gbListening { 0%, 100% { box-shadow: 0 0 0 0 rgba(224, 92, 92, .45); } 50% { box-shadow: 0 0 0 6px rgba(224, 92, 92, 0); } }
@media (prefers-reduced-motion: reduce) { .gb-voice-btn.is-listening { animation: none; } }
.input-wrap .gb-voice-btn { width: 48px; height: auto; align-self: stretch; font-size: 1.15rem; }
.hud .gb-icon-btn { min-height: 32px; }
.voice-help-btn { padding: 7px 13px; border: 1.5px solid var(--border); border-radius: var(--r-sm, 8px); background: var(--surface); color: var(--text); font: 500 .8rem 'DM Sans', sans-serif; cursor: pointer; }
.voice-help-btn:hover { border-color: var(--accent); color: var(--accent); }
.voice-help-btn[hidden] { display: none; }
.toast.long { white-space: normal; width: max-content; max-width: min(92vw, 460px); text-align: center; line-height: 1.4; }
.toast.info { border-color: var(--accent); color: var(--text); }

/* Deduction games need their own header and answer sizing. */
body.gb-deduction .main-input { min-width: 0; width: 100%; }
body.gb-deduction .sidebar { min-height: 0; min-width: 0; }
body.gb-deduction .post-reveal-bar { width: max-content; max-width: calc(100% - 24px); flex-wrap: wrap; justify-content: center; border-radius: 16px; }
body.gb-deduction .post-reveal-bar > span { overflow-wrap: anywhere; max-width: 100%; }
body.gb-deduction .hud { flex-wrap: wrap; gap: 8px; }
@media (max-width: 900px) {
  body.gb-deduction .hud-title { flex: 1 0 100%; font-size: 1.15rem; }
  body.gb-deduction .hud .gb-language-switcher { margin-left: 0; }
  body.gb-deduction .hud-nav { margin-inline-start: auto; }
}
/* Position the menu language picker inside its scrolling screen. */
#menu-screen { position: relative; }
@media (max-height: 550px) and (max-width: 800px) {
  body.gb-deduction .map-wrapper { height: 30dvh; }
}

.deduction-intro{padding:10px 18px;margin:0;font-size:.83rem;line-height:1.5;color:var(--text-muted);border-bottom:1px solid var(--border)}

.first-play{width:min(920px,100%);display:flex;align-items:center;justify-content:center;flex-wrap:wrap;gap:8px 14px;padding:12px 16px;margin:0 auto 12px;border:1px solid var(--border);border-radius:12px;background:var(--surface);font-size:.88rem;line-height:1.5}.first-play button{min-height:44px;padding:8px 14px;border:1px solid var(--accent);border-radius:8px;background:var(--accent-light);color:var(--text);font:inherit;font-weight:700;cursor:pointer}.mode-learning-links{font-size:.82rem;text-align:center;margin:0 0 20px}.mode-learning-links a{color:var(--text-muted);display:inline-block;padding:6px}
