/* Pull-to-refresh prevention for player pages only */
html, body {
  height: 100%;
  margin: 0;
  overscroll-behavior: none;
  overscroll-behavior-y: none;   /* block pull-to-refresh */
}

body.player-root {
  position: fixed;
  inset: 0;
  overflow: hidden;              /* page itself never scrolls */
  touch-action: pan-x pan-y;     /* keep normal touch interactions */
}

.player-scroll {
  height: 100%;
  overflow-y: auto;              /* only this scrolls */
  overscroll-behavior-y: contain; /* no PTR glow/bounce */
  -webkit-overflow-scrolling: touch;
  padding: 1rem 1rem 30px 1rem;  /* Less bottom padding to avoid covering timer */
  background: transparent;       /* prevent iOS GPU layer from rendering white behind scroll container */
}

/* KIOSK MODE: while a question is on screen, nothing scrolls. The answer tiles live in a
   fixed, self-fitting region (see .answer-tiles-container) and long question text opens the
   tap-to-expand popup — so there is never anything to scroll to. This kills the residual
   page scroll players reported during the live event. */
body.question-active .player-scroll {
  overflow: hidden !important;
}
body.question-active {
  overflow: hidden;
  touch-action: none;            /* no rubber-band / drag-scroll on the body during a question */
}

/* Question image popup styles - FULLSCREEN */
.question-image-card {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.97);
  padding: 0;
  border-radius: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: none;
  border: none;
  animation: none;
  z-index: 9999;
}

.question-image-title {
  color: #fff;
  font-size: 1.2rem;
  font-weight: bold;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
  position: absolute;
  top: 10px;
  left: 0;
  right: 0;
  text-align: center;
  opacity: 0.7;
}

.question-image {
  max-width: 98vw;
  max-height: 90vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 0;
  box-shadow: none;
}

.question-image-dismiss {
  color: #fff;
  font-size: 1rem;
  margin-top: 0;
  opacity: 0.6;
  position: absolute;
  bottom: 15px;
  left: 0;
  right: 0;
  text-align: center;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
}

/* Question audio popup styles - FULLSCREEN green theme */
.question-audio-card {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: linear-gradient(135deg, rgba(34, 139, 34, 0.95) 0%, rgba(0, 128, 0, 0.95) 50%, rgba(46, 184, 92, 0.95) 100%);
  padding: 0;
  border-radius: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: none;
  border: none;
  animation: audioPulse 1.5s ease-in-out infinite;
  z-index: 9999;
}

.question-audio-title {
  color: #fff;
  font-size: 2.5rem;
  font-weight: bold;
  margin-bottom: 30px;
  text-shadow: 3px 3px 6px rgba(0,0,0,0.8);
}

.question-audio-filename {
  color: #fff;
  font-size: 1.5rem;
  font-weight: 600;
  margin: 20px 0;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.6);
  background: rgba(0,0,0,0.3);
  padding: 20px 30px;
  border-radius: 15px;
}

.question-audio-dismiss {
  color: #fff;
  font-size: 1.2rem;
  margin-top: 30px;
  opacity: 0.9;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.6);
}

/* Animation keyframes */
@keyframes audioPulse {
  0%, 100% { 
    box-shadow: 0 0 50px rgba(34, 139, 34, 0.6), inset 0 0 100px rgba(255, 255, 255, 0.1);
  }
  50% { 
    box-shadow: 0 0 80px rgba(46, 184, 92, 0.8), inset 0 0 120px rgba(255, 255, 255, 0.15);
  }
}

/* Going Wide styles */
.go-wide-remove-mode {
  animation: pulseRemove 0.8s infinite;
  cursor: pointer !important;
}

@keyframes pulseRemove {
  0%, 100% { 
    box-shadow: 0 0 10px rgba(255, 193, 7, 0.5);
    transform: scale(1);
  }
  50% { 
    box-shadow: 0 0 20px rgba(255, 193, 7, 0.8);
    transform: scale(1.02);
  }
}

.ordering-tile.removed {
  opacity: 0.3 !important;
  text-decoration: line-through;
  pointer-events: none !important;
}

.go-wide-available {
  border-color: var(--warn) !important;
  animation: pulseAvailable 1s infinite;
}

@keyframes pulseAvailable {
  0%, 100% { box-shadow: 0 0 5px rgba(255, 193, 7, 0.4); }
  50% { box-shadow: 0 0 15px rgba(255, 193, 7, 0.7); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-10px); }
  40% { transform: translateX(10px); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(6px); }
}

/* ===== PALETTE-AWARE ACCENTS ===== */
/* Player info bar uses brand gradient instead of hardcoded indigo */
.player-info-bar {
  background: linear-gradient(135deg, var(--brand), var(--brand-700, var(--brand))) !important;
}

/* Question counter pill uses brand tint */
#questionCounterDisplay {
  background: rgba(255, 255, 255, 0.2) !important;
}

/* Score display emphasis */
#playerScoreDisplay {
  font-weight: 700;
}

/* Answer reveal badge uses brand */
.answer-reveal .badge.bg-success {
  background: var(--ok) !important;
}
.answer-reveal .badge.bg-danger {
  background: var(--err) !important;
}

/* Question expand icon — shown when question text is long (is-expandable) */
.question-expand-icon {
  display: none;
  font-size: 0.65rem;
  opacity: 0.45;
  cursor: pointer;
  user-select: none;
  padding: 0 3px;
  vertical-align: middle;
}
.question-header-container.is-expandable .question-expand-icon {
  display: inline;
}

/* Question metadata badges */
.question-meta-badge {
  border-color: var(--border-light) !important;
}
.question-image-card {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.97);
  padding: 0;
  border-radius: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: none;
  border: none;
  animation: none;
  z-index: 9999;
}

.question-image-title {
  color: #fff;
  font-size: 1.2rem;
  font-weight: bold;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
  position: absolute;
  top: 10px;
  left: 0;
  right: 0;
  text-align: center;
  opacity: 0.7;
}

.question-image {
  max-width: 98vw;
  max-height: 90vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 0;
  box-shadow: none;
}

.question-image-dismiss {
  color: #fff;
  font-size: 1rem;
  margin-top: 0;
  opacity: 0.6;
  position: absolute;
  bottom: 15px;
  left: 0;
  right: 0;
  text-align: center;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
}

/* Question audio popup styles - FULLSCREEN green theme */
.question-audio-card {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: linear-gradient(135deg, rgba(34, 139, 34, 0.95) 0%, rgba(0, 128, 0, 0.95) 50%, rgba(46, 184, 92, 0.95) 100%);
  padding: 0;
  border-radius: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: none;
  border: none;
  animation: audioPulse 1.5s ease-in-out infinite;
  z-index: 9999;
}

.question-audio-title {
  color: #fff;
  font-size: 2.5rem;
  font-weight: bold;
  margin-bottom: 30px;
  text-shadow: 3px 3px 6px rgba(0,0,0,0.8);
}

.question-audio-filename {
  color: #fff;
  font-size: 1.5rem;
  font-weight: 600;
  margin: 20px 0;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.6);
  background: rgba(0,0,0,0.3);
  padding: 20px 30px;
  border-radius: 15px;
}

.question-audio-dismiss {
  color: #fff;
  font-size: 1.2rem;
  margin-top: 30px;
  opacity: 0.9;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.6);
}

/* Animation keyframes */
@keyframes audioPulse {
  0%, 100% { 
    box-shadow: 0 0 50px rgba(34, 139, 34, 0.6), inset 0 0 100px rgba(255, 255, 255, 0.1);
  }
  50% { 
    box-shadow: 0 0 80px rgba(46, 184, 92, 0.8), inset 0 0 120px rgba(255, 255, 255, 0.15);
  }
}

/* Going Wide styles */
.go-wide-remove-mode {
  animation: pulseRemove 0.8s infinite;
  cursor: pointer !important;
}

@keyframes pulseRemove {
  0%, 100% { 
    box-shadow: 0 0 10px rgba(255, 193, 7, 0.5);
    transform: scale(1);
  }
  50% { 
    box-shadow: 0 0 20px rgba(255, 193, 7, 0.8);
    transform: scale(1.02);
  }
}

.ordering-tile.removed {
  opacity: 0.3 !important;
  text-decoration: line-through;
  pointer-events: none !important;
}

.go-wide-available {
  border-color: var(--warn) !important;
  animation: pulseAvailable 1s infinite;
}

@keyframes pulseAvailable {
  0%, 100% { box-shadow: 0 0 5px rgba(255, 193, 7, 0.4); }
  50% { box-shadow: 0 0 15px rgba(255, 193, 7, 0.7); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-10px); }
  40% { transform: translateX(10px); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(6px); }
}

/* ===== PALETTE-AWARE ACCENTS ===== */
/* Player info bar uses brand gradient instead of hardcoded indigo */
.player-info-bar {
  background: linear-gradient(135deg, var(--brand), var(--brand-700, var(--brand))) !important;
}

/* Question counter pill uses brand tint */
#questionCounterDisplay {
  background: rgba(255, 255, 255, 0.2) !important;
}

/* Score display emphasis */
#playerScoreDisplay {
  font-weight: 700;
}

/* Answer reveal badge uses brand */
.answer-reveal .badge.bg-success {
  background: var(--ok) !important;
}
.answer-reveal .badge.bg-danger {
  background: var(--err) !important;
}

/* Question expand icon — shown when question text is long (is-expandable) */
.question-expand-icon {
  display: none;
  font-size: 0.65rem;
  opacity: 0.45;
  cursor: pointer;
  user-select: none;
  padding: 0 3px;
  vertical-align: middle;
}
.question-header-container.is-expandable .question-expand-icon {
  display: inline;
}

/* Question metadata badges */
.question-meta-badge {
  border-color: var(--border-light) !important;
}

/* ── Pinpoint question type ── */
/* Pinpoint: give the image as much room as possible — hide the set/category line, shrink the
   prompt to a compact line, and drop the on-image hint. Scoped to pinpoint questions only. */
body.pinpoint-active #qn-number { display: none !important; }
body.pinpoint-active #q-text {
  font-size: 1.25rem !important;
  font-weight: 600 !important;
  line-height: 1.3 !important;
  margin: 4px 0 6px !important;
}
body.pinpoint-active .pinpoint-hint { display: block !important; font-size: 1.1rem; }

.pinpoint-container {
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.pinpoint-img-wrap {
  position: relative;
  width: 100%;
  max-height: 75vh;            /* Taller map for practice mode */
  max-height: 75dvh;           /* Dynamic viewport height for address bar support */
  overflow: hidden;
  touch-action: none;          /* we handle gestures ourselves */
  transform-origin: center center;
  border-radius: 8px;
  background: #000;
}
.pinpoint-img {
  width: 100%;
  max-height: 75vh;
  max-height: 75dvh;
  object-fit: contain;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}
/* When inside a question form, leave room for the question text and submit buttons */
#answer-form .pinpoint-img-wrap,
#answer-form .pinpoint-img {
  max-height: 70vh;
  max-height: 70dvh;
}
.pinpoint-crosshair {
  position: absolute;
  width: 8px; height: 8px;
  margin-left: -4px; margin-top: -4px;
  border-radius: 50%;
  background: rgba(255,60,60,0.85);
  border: 1px solid #fff;
  box-shadow: 0 0 6px rgba(0,0,0,0.5);
  pointer-events: none;
  z-index: 10;
  transition: background 0.2s;
  transform: scale(var(--inv-scale, 1));
}
.pinpoint-crosshair-locked {
  background: rgba(0,200,80,0.9) !important;
  box-shadow: 0 0 10px rgba(0,200,80,0.6);
}
.pinpoint-confirm {
  margin-top: 12px;
  padding: 10px 40px;
  font-size: 1.2rem;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  background: var(--brand, #28a745);
  color: #fff;
  cursor: pointer;
  z-index: 10;
}
.pinpoint-confirm:disabled {
  opacity: 0.6;
  background: var(--text-muted, #6c757d);
}
.pinpoint-hint {
  margin-top: 8px;
  font-size: 1.1rem;
  color: var(--text-muted, #888);
  text-align: center;
}

.geo-pin-actions {
  width: min(100%, 520px);
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
  padding: 10px;
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 8px;
  background: rgba(17,24,39,0.9);
  color: #f8fafc;
  box-shadow: 0 8px 18px rgba(0,0,0,0.24);
}
.geo-pin-status {
  min-height: 1.2em;
  font-size: 0.9rem;
  line-height: 1.25;
  text-align: center;
  color: #e5e7eb;
}
.geo-pin-buttons {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
  gap: 8px;
}
.geo-pin-btn {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.1;
  touch-action: manipulation;
}
.geo-pin-btn-reset {
  background: #f8fafc;
  color: #111827;
}
.geo-pin-btn-submit {
  background: #0f766e;
  color: #fff;
}
.geo-pin-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.geo-pin-crosshair-pending {
  background: rgba(242,169,0,0.94);
  box-shadow: 0 0 10px rgba(242,169,0,0.65);
}

.geo-pin-reveal-card {
  width: min(100%, 640px);
  margin: 10px auto;
  padding: 10px;
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 8px;
  background: #101820;
  color: #f8fafc;
  box-shadow: 0 10px 24px rgba(0,0,0,0.32);
}
.geo-pin-reveal-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 4px;
  margin-bottom: 10px;
  text-align: center;
}
.geo-pin-reveal-summary strong {
  font-size: 1.08rem;
  line-height: 1.2;
}
.geo-pin-reveal-summary span {
  font-size: 0.88rem;
  color: #d1d5db;
}
.geo-pin-reveal-wrap {
  position: relative;
  display: inline-block;
  max-width: 100%;
  max-height: 75vh;
  overflow: hidden;
  border-radius: 8px;
  background: #05070a;
}
.geo-pin-reveal-img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 75vh;
  object-fit: contain;
}
.geo-pin-dot,
.geo-pin-target {
  position: absolute;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 3;
}
.geo-pin-dot {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.86);
  border-radius: 50%;
  background: #38bdf8;
  box-shadow: 0 0 6px rgba(0,0,0,0.75);
}
.geo-pin-dot.is-me {
  width: 20px;
  height: 20px;
  border-color: #fff;
  background: #f2a900;
  box-shadow: 0 0 0 3px rgba(242,169,0,0.35), 0 0 8px rgba(0,0,0,0.85);
  z-index: 5;
}
.geo-pin-dot-label,
.geo-pin-target-label {
  position: absolute;
  left: 16px;
  top: -8px;
  max-width: 160px;
  padding: 2px 6px;
  border-radius: 5px;
  background: rgba(0,0,0,0.78);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.geo-pin-dot.is-me .geo-pin-dot-label {
  top: -9px;
  background: rgba(15,23,42,0.92);
}
.geo-pin-target {
  width: 22px;
  height: 22px;
  border: 2px solid #111827;
  border-radius: 50%;
  background: #ffd166;
  box-shadow: 0 0 0 3px rgba(255,255,255,0.85), 0 0 8px rgba(0,0,0,0.72);
  z-index: 4;
}
.geo-pin-target::before,
.geo-pin-target::after {
  content: "";
  position: absolute;
  background: #111827;
}
.geo-pin-target::before {
  left: 50%;
  top: -7px;
  width: 2px;
  height: 32px;
  transform: translateX(-50%);
}
.geo-pin-target::after {
  top: 50%;
  left: -7px;
  width: 32px;
  height: 2px;
  transform: translateY(-50%);
}
.geo-pin-target-label {
  left: 20px;
  top: -9px;
}
.geo-pin-rank-list {
  display: grid;
  gap: 4px;
  margin-top: 10px;
}
.geo-pin-rank-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 5px 8px;
  border-radius: 7px;
  background: rgba(255,255,255,0.08);
  font-size: 0.83rem;
}
.geo-pin-rank-row.is-me {
  background: rgba(242,169,0,0.18);
  outline: 1px solid rgba(242,169,0,0.5);
}
.geo-pin-rank-team {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Pinpoint in landscape ────────────────────────────────────────────────
   In landscape the viewport HEIGHT is short (~360px on most phones).
   `.pinpoint-img-wrap` and `.pinpoint-img` both cap at max-height: 86vh,
   but with the question text above + the Confirm button below, the button
   easily slides below the fold. Tighten the image's height budget so the
   image + button + hint all fit without scrolling. Also compress the
   Confirm button slightly so it doesn't dominate. */
@media (orientation: landscape) and (max-height: 500px) {
  .pinpoint-img-wrap {
    height: 68vh;              /* force shorter height in landscape */
    max-height: 68vh;          /* leaves ~32vh for question text + confirm + hint */
    max-width: 92vw;
    margin-left: auto; margin-right: auto;
  }
  .pinpoint-img {
    height: 100%;
    max-height: 68vh;
  }
  .pinpoint-confirm {
    margin-top: 6px;
    padding: 6px 28px;
    font-size: 1rem;
  }
  .geo-pin-actions {
    margin-top: 6px;
    padding: 6px;
    gap: 5px;
  }
  .geo-pin-status {
    font-size: 0.78rem;
  }
  .geo-pin-btn {
    min-height: 34px;
    font-size: 0.84rem;
  }
  .geo-pin-reveal-card {
    margin-top: 4px;
    padding: 7px;
  }
  .geo-pin-reveal-summary {
    margin-bottom: 6px;
  }
  .geo-pin-reveal-wrap,
  .geo-pin-reveal-img {
    max-height: 45vh;
  }
  .geo-pin-rank-list {
    display: none;
  }
  .pinpoint-hint {
    margin-top: 4px;
    font-size: 1rem;
  }
  /* Pinpoint also hides #qn-number + tightens #q-text via .pinpoint-active.
     In landscape, push that a bit further so the question prompt is a
     single compact line. */
  body.pinpoint-active.pinpoint-active #q-text {
    font-size: 1.15rem !important;
    line-height: 1.2 !important;
    margin: 0 0 4px 0 !important;
    padding: 0 6px !important;
  }
}

/* String Cheese (snake) D-pad — big, square, thumb-friendly buttons with a pressed feel. */
.snake-dpad-btn {
  aspect-ratio: 1;
  width: 100%;
  height: 100%;
  font-size: 2.6rem;
  line-height: 1;
  padding: 0;
  border-radius: 16px;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.25);
}
.snake-dpad-btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.25);
}

/* Falling Catch slider — a big, easy-to-grab thumb on a tall track (the default thumb was
   tiny and needed pixel-perfect tapping). */
.falling-slider { -webkit-appearance: none; appearance: none; background: transparent; height: 64px; width: 100%; cursor: pointer; }
.falling-slider:focus { outline: none; }
.falling-slider::-webkit-slider-runnable-track { height: 34px; border-radius: 17px; background: #334155; }
.falling-slider::-moz-range-track { height: 34px; border-radius: 17px; background: #334155; }
.falling-slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 64px; height: 64px; margin-top: -15px;
  border-radius: 50%; background: #16a34a; border: 3px solid #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.45); cursor: pointer;
}
.falling-slider::-moz-range-thumb {
  width: 64px; height: 64px;
  border-radius: 50%; background: #16a34a; border: 3px solid #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.45); cursor: pointer;
}

/* PWA meta tag for iOS home screen install */
