:root {
  color-scheme: dark;
  --bg-space: #090D16;
  --bg-card: rgba(17, 24, 39, 0.92);
  --bg-card-elevated: #161F33;
  --ink-black: #0F141C;

  /* Official Google & DevFest CDO 2026 Brand Palette */
  --g-blue: #4285F4;
  --cdo-royal-blue: #1A73E8;
  --g-red: #EA4335;
  --g-yellow: #F9AB00;
  --g-yellow-bright: #FBBC05;
  --g-green: #34A853;

  --player-accent: #4285F4;
  --text-main: #F8FAFC;
  --text-muted: #94A3B8;
  --font-sans: 'Plus Jakarta Sans', 'Google Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

/* Vibrant CDO Poster Blue Theme Variant */
body[data-theme="poster-blue"] {
  --bg-space: #1A73E8;
  --bg-card: rgba(13, 30, 66, 0.92);
  --bg-card-elevated: #142E66;
  background-color: #1A73E8;
  background-image:
    radial-gradient(rgba(255, 255, 255, 0.2) 1.25px, transparent 1.25px),
    linear-gradient(180deg, #1E7BF6 0%, #155EC4 100%);
  background-size: 16px 16px, 100% 100%;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

button,
input {
  touch-action: manipulation;
  font-family: inherit;
}

html,
body {
  width: 100%;
  min-height: 100dvh;
  background-color: var(--bg-space);
  color: var(--text-main);
  font-family: var(--font-sans);
  overflow-x: hidden;
  user-select: none;
  -webkit-font-smoothing: antialiased;
}

body {
  display: flex;
  flex-direction: column;
  /* Subtle architectural dot matrix + warm CDO ambient light */
  background-image:
    radial-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    radial-gradient(circle at 15% 15%, rgba(26, 115, 232, 0.22) 0%, transparent 45%),
    radial-gradient(circle at 85% 20%, rgba(249, 171, 0, 0.12) 0%, transparent 40%),
    linear-gradient(180deg, #090D16 0%, #0E172A 100%);
  background-size: 20px 20px, 100% 100%, 100% 100%, 100% 100%;
}

.hidden {
  display: none !important;
}

.hidden-for-players {
  display: none !important;
}

body.is-host-mode .hidden-for-players {
  display: inline-flex !important;
}

body.is-host-mode aside.arena-side-col.hidden-for-players {
  display: block !important;
}

/* ==========================================
   OFFICIAL { DevFest [Cagayan de Oro] [2026] } LOCKUP
   ========================================== */
.cdo-logo-lockup {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  user-select: none;
}

.cdo-brace {
  font-family: var(--font-sans);
  font-weight: 800;
  color: var(--g-yellow);
  -webkit-text-stroke: 2px #111111;
  text-shadow: 0 2px 0 #111111;
  line-height: 0.9;
}

.cdo-logo-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.18rem;
}

.cdo-devfest-word {
  font-family: var(--font-sans);
  font-weight: 800;
  color: #FFFFFF;
  letter-spacing: -0.03em;
  line-height: 1;
}

.cdo-pills-row {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.cdo-pill-city {
  background: #FFFFFF;
  color: #111111;
  border: 2px solid #111111;
  border-radius: 999px;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 2px 0 #111111;
}

.cdo-pill-year {
  background: var(--g-yellow);
  color: #111111;
  border: 2px solid #111111;
  border-radius: 999px;
  font-weight: 800;
  white-space: nowrap;
  box-shadow: 0 2px 0 #111111;
}

.cdo-logo-lockup.compact .cdo-brace { font-size: 2.15rem; }
.cdo-logo-lockup.compact .cdo-devfest-word { font-size: 1.15rem; }
.cdo-logo-lockup.compact .cdo-pill-city,
.cdo-logo-lockup.compact .cdo-pill-year {
  font-size: 0.62rem;
  padding: 0.08rem 0.45rem;
}

.cdo-logo-lockup.hero-size {
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}
.cdo-logo-lockup.hero-size .cdo-brace {
  font-size: clamp(3.2rem, 7.5vw, 4.6rem);
  -webkit-text-stroke: 2.5px #111111;
}
.cdo-logo-lockup.hero-size .cdo-devfest-word {
  font-size: clamp(1.95rem, 4.8vw, 2.85rem);
}
.cdo-logo-lockup.hero-size .cdo-pill-city,
.cdo-logo-lockup.hero-size .cdo-pill-year {
  font-size: clamp(0.76rem, 1.9vw, 0.94rem);
  padding: 0.18rem 0.75rem;
}

/* ==========================================
   BACKGROUND ROUTE & VECTOR JEEPNEYS
   ========================================== */
.cdo-branding-backdrop {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
}

.golden-route-svg {
  width: 100%;
  height: 100%;
  opacity: 0.48;
}

.golden-route-line {
  fill: none;
  stroke: var(--g-yellow);
  stroke-width: 4.5;
  stroke-linecap: round;
}

.golden-route-line.secondary {
  stroke-width: 3.5;
  opacity: 0.55;
}

.floating-jeepney {
  position: absolute;
  width: 112px;
  opacity: 0.82;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.45));
}

.jeepney-top {
  top: 12%;
  right: 6%;
  animation: gentleFloatTop 9s ease-in-out infinite;
}

.jeepney-bottom {
  bottom: 10%;
  left: 5%;
  animation: gentleFloatBottom 10s ease-in-out infinite;
}

@keyframes gentleFloatTop {
  0%, 100% { transform: translate3d(0, 0, 0) rotate(-10deg); }
  50% { transform: translate3d(-10px, -8px, 0) rotate(-6deg); }
}

@keyframes gentleFloatBottom {
  0%, 100% { transform: translate3d(0, 0, 0) rotate(10deg); }
  50% { transform: translate3d(12px, -8px, 0) rotate(6deg); }
}

#antigravity-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 2;
}

#floating-popups {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 40;
  overflow: hidden;
}

.antigravity-bubble {
  position: absolute;
  font-family: var(--font-sans);
  font-weight: 800;
  font-size: 1.15rem;
  padding: 0.22rem 0.65rem;
  border-radius: 999px;
  color: #111111;
  background: var(--g-yellow-bright);
  border: 2px solid #111111;
  box-shadow: 0 3px 0 #111111;
  transform: translate(-50%, -50%);
  animation: bubbleFloatUp 1.1s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes bubbleFloatUp {
  0% { opacity: 0; transform: translate(-50%, 0) scale(0.7); }
  20% { opacity: 1; transform: translate(calc(-50% + var(--drift-x, 8px) * 0.3), -24px) scale(1.06); }
  100% { opacity: 0; transform: translate(calc(-50% + var(--drift-x, 16px)), -135px) scale(0.9); }
}

/* ==========================================
   TOP NAVIGATION BAR & 4-STEP PROGRESS TRACK
   ========================================== */
.hud-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  padding: calc(0.55rem + env(safe-area-inset-top, 0px)) 1rem 0.55rem;
  background: rgba(9, 13, 22, 0.92);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.hud-brand {
  display: flex;
  align-items: center;
  cursor: pointer;
}

.hud-telemetry-right {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.sync-pill,
.players-count-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.32rem 0.65rem;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--g-green);
}

.hud-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  min-width: 34px;
  padding: 0 0.55rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.hud-icon-btn:hover {
  background: rgba(255, 255, 255, 0.14);
}

.admin-pill-btn {
  background: var(--g-yellow);
  color: #111111;
  border: 2px solid #111111;
  font-weight: 800;
}

/* Clean 4-Step Progress Track */
.wave-stepper-bar {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.45rem 0.75rem;
  background: rgba(13, 19, 33, 0.85);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.wave-step {
  display: inline-flex;
  align-items: center;
  gap: 0.32rem;
  padding: 0.24rem 0.6rem;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text-muted);
  border: 1.5px solid transparent;
  white-space: nowrap;
}

.wave-step.active {
  color: #111111;
  background: var(--g-yellow);
  border-color: #111111;
  box-shadow: 0 2px 0 #111111;
}

.wave-step.completed {
  color: #FFFFFF;
  background: rgba(52, 168, 83, 0.22);
  border-color: var(--g-green);
}

.step-connector {
  width: 14px;
  height: 2px;
  background: rgba(255, 255, 255, 0.14);
  border-radius: 2px;
}

.cdo-pin-badge,
.cdo-pin-large {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--g-red);
  color: #FFFFFF;
  border: 1.5px solid #111111;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.64rem;
  font-weight: 800;
  padding: 0.05rem 0.38rem;
  line-height: 1.2;
}

.cdo-pin-large {
  font-size: 0.74rem;
  padding: 0.14rem 0.5rem;
  border: 2px solid #111111;
  box-shadow: 0 2px 0 #111111;
}

/* ==========================================
   MAIN VIEWPORT & TACTILE DEVFEST SURFACE CARDS
   ========================================== */
.arena-viewport {
  position: relative;
  z-index: 10;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 1rem 1rem calc(4.5rem + env(safe-area-inset-bottom, 0px));
  width: 100%;
  max-width: 1160px;
  margin: 0 auto;
}

.hud-screen {
  display: none;
  width: 100%;
}

.hud-screen.active {
  display: block;
  animation: cardReveal 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes cardReveal {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.cdo-surface-card {
  position: relative;
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 2px solid rgba(255, 255, 255, 0.16);
  border-radius: 22px;
  padding: 1.35rem;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}

/* ==========================================
   SCREEN 1A: LOBBY / ENTER PLAYER NAME
   ========================================== */
.lobby-card {
  max-width: 520px;
  margin: 0 auto;
}

.lobby-brand-showcase {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 1.15rem 0.85rem;
  margin-bottom: 1.1rem;
  border-radius: 16px;
  background: var(--cdo-royal-blue);
  background-image: radial-gradient(rgba(255, 255, 255, 0.2) 1px, transparent 1px);
  background-size: 12px 12px;
  border: 2.5px solid #111111;
  box-shadow: 0 5px 0 #111111;
}

.kahoot-pin-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.35rem;
  padding: 0.22rem 0.8rem;
  border-radius: 999px;
  background: #FFFFFF;
  color: #111111;
  border: 2px solid #111111;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 800;
  box-shadow: 0 2px 0 #111111;
}

.kahoot-pin-badge.large {
  font-size: 1rem;
  padding: 0.35rem 1rem;
  background: var(--g-yellow);
}

.hero-title {
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  text-align: center;
  margin-bottom: 0.35rem;
}

.hero-desc {
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.45;
  text-align: center;
  margin-bottom: 1.2rem;
}

.lobby-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.field-row-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}

.hud-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: #E2E8F0;
}

.input-neon-wrap {
  display: flex;
  gap: 0.5rem;
}

.input-neon-wrap input,
#firebase-db-url-input {
  flex: 1;
  padding: 0.8rem 0.95rem;
  border-radius: 12px;
  background: #0B101B;
  border: 2px solid rgba(255, 255, 255, 0.2);
  color: #FFFFFF;
  font-size: 16px;
  font-weight: 600;
  outline: none;
  transition: border-color 0.15s ease;
}

.input-neon-wrap input:focus,
#firebase-db-url-input:focus {
  border-color: var(--g-yellow);
}

.color-picker-row {
  display: flex;
  gap: 0.4rem;
}

.color-swatch {
  flex: 1;
  min-height: 42px;
  padding: 0.4rem 0.25rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid rgba(255, 255, 255, 0.14);
  color: #FFFFFF;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
}

.color-swatch::before {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--swatch);
}

.color-swatch.selected {
  border-color: var(--swatch);
  background: rgba(255, 255, 255, 0.12);
}

.sensor-permission-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  padding: 0.8rem 0.9rem;
  border-radius: 14px;
  background: rgba(26, 115, 232, 0.12);
  border: 1.5px solid rgba(66, 133, 244, 0.35);
}

.sensor-info {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.sensor-icon-circle {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(66, 133, 244, 0.2);
  color: #60A5FA;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sensor-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: #FFFFFF;
}

.sensor-sub {
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
}

.btn-cdo-launch {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.95rem 1.25rem;
  border-radius: 14px;
  border: 2.5px solid #111111;
  background: var(--g-yellow);
  color: #111111;
  font-size: 0.98rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 0 #111111;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.btn-cdo-launch:hover {
  background: #FFD026;
}

.btn-cdo-launch:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #111111;
}

.btn-neon-outline {
  padding: 0.55rem 0.95rem;
  border-radius: 10px;
  background: #FFFFFF;
  border: 2px solid #111111;
  color: #111111;
  font-size: 0.76rem;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 2px 0 #111111;
}

/* ==========================================
   SCREEN 1B: WAITING ROOM & HOST QR BANNER
   ========================================== */
.waiting-room-layout {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 760px;
  margin: 0 auto;
  width: 100%;
}

.kahoot-qr-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.2rem;
  background: var(--cdo-royal-blue);
  background-image: radial-gradient(rgba(255, 255, 255, 0.18) 1px, transparent 1px);
  background-size: 14px 14px;
  border: 2.5px solid #111111;
  box-shadow: 0 6px 0 #111111;
}

body:not(.is-host-mode) .kahoot-qr-banner {
  display: none;
}

.kahoot-join-steps {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  flex: 1;
}

.kahoot-step-pill {
  display: inline-block;
  align-self: flex-start;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 800;
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  background: var(--g-yellow);
  color: #111111;
  border: 1.5px solid #111111;
}

.kahoot-url-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.join-label {
  font-size: 0.9rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.9);
}

.join-url-display {
  font-family: var(--font-mono);
  font-size: clamp(0.95rem, 2.2vw, 1.25rem);
  font-weight: 800;
  color: #FFFFFF;
  text-decoration: none;
  background: rgba(15, 20, 28, 0.75);
  padding: 0.35rem 0.75rem;
  border-radius: 10px;
  border: 2px solid #111111;
  word-break: break-all;
}

.kahoot-pin-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
}

.pin-box,
.coord-chip,
.gps-coord-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: #FFFFFF;
  color: #111111;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 800;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  border: 1.5px solid #111111;
  box-shadow: 0 2px 0 #111111;
}

.pin-dot {
  background: var(--g-red);
  color: #FFFFFF;
  border-radius: 999px;
  padding: 0.04rem 0.32rem;
  font-size: 0.6rem;
}

.kahoot-qr-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0.5rem;
  border-radius: 14px;
  background: #FFFFFF;
  border: 2.5px solid #111111;
  box-shadow: 0 4px 0 #111111;
}

.qr-svg-wrap {
  width: 118px;
  height: 118px;
}

.qr-code-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.qr-zoom-hint {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 800;
  color: #111111;
}

.waiting-player-card {
  text-align: center;
}

.you-are-in-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.25rem 0 1.1rem;
}

.in-status-pill {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  background: var(--g-green);
  color: #FFFFFF;
  border: 2px solid #111111;
  box-shadow: 0 2px 0 #111111;
  margin-bottom: 0.75rem;
}

.waiting-badge-orb {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 1.4rem;
  font-weight: 800;
  background: var(--player-accent, var(--g-blue));
  color: #FFFFFF;
  border: 2.5px solid #111111;
  box-shadow: 0 4px 0 #111111;
  margin-bottom: 0.55rem;
}

.waiting-my-name {
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 0.3rem;
}

.waiting-see-name-sub {
  max-width: 440px;
  font-size: 0.86rem;
  color: var(--text-muted);
  line-height: 1.45;
  margin-bottom: 0.85rem;
}

.warmup-shake-strip {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  font-size: 0.76rem;
  color: var(--text-muted);
}

.link-btn-subtle {
  background: #FFFFFF;
  border: 1.5px solid #111111;
  color: #111111;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  cursor: pointer;
}

.lobby-waiting-bay {
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.bay-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.bay-count-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  font-weight: 800;
}

.bay-status {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--g-yellow-bright);
}

.floating-pilots-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  min-height: 44px;
}

.pilot-capsule {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: #161F33;
  border: 2px solid var(--capsule-color, var(--g-blue));
  font-size: 0.8rem;
  font-weight: 700;
}

.host-lobby-launch-bar {
  margin-top: 1.1rem;
  padding-top: 0.9rem;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

/* ==========================================
   SCREEN 2: ELEVATED ACTIVE WAVE SHAKE ARENA
   ========================================== */
.arena-grid {
  display: grid;
  grid-template-columns: 1.25fr 0.95fr;
  gap: 1rem;
  align-items: start;
}

body:not(.is-host-mode) .arena-side-col {
  display: none !important;
}

body:not(.is-host-mode) .arena-grid {
  grid-template-columns: 1fr;
  max-width: 480px;
  margin: 0 auto;
}

.arena-main-col {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

/* 1. Top Wave Status & Timer Card */
.wave-hud-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  padding: 1rem 1.15rem;
}

.wave-waypoint-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.35rem;
}

.wave-pill-tag {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 800;
  padding: 0.16rem 0.55rem;
  border-radius: 999px;
  background: var(--g-yellow);
  border: 1.5px solid #111111;
  color: #111111;
}

.wave-heading {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.wave-carryover-note {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.18rem;
  line-height: 1.35;
}

/* Precision Circular Countdown Ring */
.timer-orb-wrap {
  position: relative;
  width: 96px;
  height: 96px;
  flex-shrink: 0;
}

.timer-ring-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.timer-ring-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.1);
  stroke-width: 8;
}

.timer-ring-progress {
  fill: none;
  stroke: var(--g-yellow-bright);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 326.72;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 0.3s linear, stroke 0.3s ease;
}

.timer-orb-wrap.urgent .timer-ring-progress {
  stroke: var(--g-red);
}

.timer-readout {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
}

.timer-label {
  font-family: var(--font-mono);
  font-size: 0.5rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.timer-digits {
  font-family: var(--font-mono);
  font-size: 1.18rem;
  font-weight: 800;
  color: #FFFFFF;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.timer-orb-wrap.urgent .timer-digits {
  color: var(--g-red);
}

.timer-sec-sub {
  font-family: var(--font-mono);
  font-size: 0.54rem;
  color: var(--text-muted);
}

/* 2. Elevated Kinetic Score Gauge Module (Replaces generic AI circle) */
.kinetic-reactor-card {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 1.15rem 1.25rem;
  background: linear-gradient(180deg, rgba(22, 31, 51, 0.96) 0%, rgba(13, 19, 34, 0.98) 100%);
  border: 2.5px solid #111111;
  box-shadow:
    0 6px 0 #111111,
    inset 0 1px 0 rgba(255, 255, 255, 0.14);
  transition: transform 0.1s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.15s ease;
}

.kinetic-reactor-card.shake-hit {
  transform: translateY(-3px) scale(1.015);
  border-color: var(--g-yellow-bright);
}

.reactor-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.orb-pilot-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.84rem;
  font-weight: 800;
  padding: 0.25rem 0.7rem 0.25rem 0.3rem;
  border-radius: 999px;
  background: #FFFFFF;
  color: #111111;
  border: 2px solid #111111;
  box-shadow: 0 2px 0 #111111;
}

.orb-rank-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  background: var(--g-yellow);
  color: #111111;
  border: 2px solid #111111;
  box-shadow: 0 2px 0 #111111;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 800;
}

/* Precision 270° Speedometer Arc + Score Counter */
.reactor-gauge-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 190px;
  margin: 0.1rem 0;
}

.reactor-arc-svg {
  width: 245px;
  height: 190px;
  overflow: visible;
}

.arc-track {
  stroke: rgba(255, 255, 255, 0.09);
}

.arc-fill {
  stroke: var(--player-accent, var(--g-blue));
  stroke-dasharray: 510;
  stroke-dashoffset: 485;
  transition: stroke-dashoffset 0.08s ease-out, stroke 0.15s ease;
}

.kinetic-reactor-card.shake-hit .arc-fill {
  stroke: var(--g-yellow-bright);
}

.reactor-score-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding-top: 1.1rem;
}

.orb-score-label {
  font-family: var(--font-mono);
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--text-muted);
}

.orb-total-score {
  font-family: var(--font-sans);
  font-size: clamp(3.4rem, 11vw, 4.4rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
  color: #FFFFFF;
  font-variant-numeric: tabular-nums;
  margin: 0.15rem 0 0.35rem;
}

.shake-velocity-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  color: #E2E8F0;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.vel-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--g-yellow-bright);
}

/* 3. Bottom Sensor & Telemetry Dock */
.controls-telemetry-panel {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  padding: 1rem 1.15rem;
}

.shake-instruction-box {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 0.75rem 0.9rem;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1.5px solid rgba(255, 255, 255, 0.14);
}

.shake-phone-Header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.shake-svg-badge {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--g-yellow);
  color: #111111;
  border: 2px solid #111111;
  box-shadow: 0 2px 0 #111111;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  animation: subtlePhonePulse 1.4s ease-in-out infinite;
}

@keyframes subtlePhonePulse {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-8deg); }
  75% { transform: rotate(8deg); }
}

.shake-phone-texts {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.shake-main-title {
  font-size: 0.88rem;
  font-weight: 800;
  color: #FFFFFF;
}

.shake-sub-status {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.35;
}

.c-blue { color: var(--g-blue); }
.c-red { color: var(--g-red); }
.c-green { color: var(--g-green); }

.fallback-secondary-row {
  display: flex;
  justify-content: center;
  padding-top: 0.2rem;
}

.btn-secondary-fallback {
  background: transparent;
  border: 1px dashed rgba(255, 255, 255, 0.18);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.66rem;
  padding: 0.38rem 0.8rem;
  border-radius: 999px;
  cursor: pointer;
}

/* Host Live Leaderboard Side Panel */
.live-board-card {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.live-board-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.hud-mini-tag {
  font-family: var(--font-mono);
  font-size: 0.64rem;
  font-weight: 800;
  color: var(--g-yellow-bright);
}

.live-board-title {
  font-size: 1.05rem;
  font-weight: 800;
}

.live-wave-indicator {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 800;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: #FFFFFF;
  border: 1.5px solid #111111;
  color: #111111;
}

.live-standings-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.live-player-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.8rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1.5px solid rgba(255, 255, 255, 0.1);
}

.live-player-row.is-me {
  background: rgba(249, 171, 0, 0.16);
  border-color: var(--g-yellow);
}

.live-player-left {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.rank-badge {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.12);
}

.rank-1 { background: var(--g-yellow-bright); color: #111; border: 1.5px solid #111; }
.rank-2 { background: #FFFFFF; color: #111; border: 1.5px solid #111; }
.rank-3 { background: var(--g-red); color: #FFF; border: 1.5px solid #111; }

.pilot-meta {
  display: flex;
  flex-direction: column;
}

.pilot-callsign {
  font-weight: 700;
  font-size: 0.88rem;
}

.pilot-wave-sub {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  color: var(--text-muted);
}

.pilot-score-pill {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 800;
  color: var(--g-yellow-bright);
}

/* ==========================================
   SCREEN 3 & 4: LEADERBOARDS & TOP 3 PODIUM
   ========================================== */
.interwave-card,
.final-grand-card {
  max-width: 820px;
  margin: 0 auto;
}

.interwave-header,
.final-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 1.1rem;
}

.mission-tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 800;
  color: #111111;
  background: #FFFFFF;
  border: 2px solid #111111;
  box-shadow: 0 2px 0 #111111;
  padding: 0.22rem 0.65rem;
  border-radius: 999px;
  margin-bottom: 0.6rem;
}

.interwave-title,
.final-grand-title {
  font-size: clamp(1.45rem, 3.5vw, 2rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 0.3rem;
}

.interwave-subtitle,
.final-grand-sub {
  color: var(--text-muted);
  font-size: 0.88rem;
}

.carryover-explainer-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.65rem 0.9rem;
  border-radius: 12px;
  background: rgba(249, 171, 0, 0.14);
  border: 1.5px solid var(--g-yellow);
  margin-bottom: 1.1rem;
  font-size: 0.84rem;
  font-weight: 600;
}

.co-badge {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 800;
  padding: 0.16rem 0.5rem;
  border-radius: 6px;
  background: var(--g-yellow);
  color: #111111;
  border: 1.5px solid #111111;
}

.leaderboard-table-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.leaderboard-table-head {
  display: grid;
  grid-template-columns: 52px 1.6fr 0.9fr 0.9fr 1.1fr;
  padding: 0.5rem 0.85rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-muted);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.leaderboard-table-head.final-cols {
  grid-template-columns: 48px 1.6fr 0.75fr 0.75fr 0.75fr 1.1fr;
}

.leaderboard-rows {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.lb-row {
  display: grid;
  grid-template-columns: 52px 1.6fr 0.9fr 0.9fr 1.1fr;
  align-items: center;
  padding: 0.65rem 0.85rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1.5px solid rgba(255, 255, 255, 0.09);
  font-size: 0.86rem;
}

.lb-row.final-cols {
  grid-template-columns: 48px 1.6fr 0.75fr 0.75fr 0.75fr 1.1fr;
}

.lb-row.is-me {
  background: rgba(249, 171, 0, 0.18);
  border-color: var(--g-yellow);
}

.text-right {
  text-align: right;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.lb-total-cell {
  font-weight: 800;
  color: var(--g-yellow-bright);
}

.interwave-footer {
  margin-top: 1.2rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  padding-top: 0.9rem;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.waiting-host-pulse {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Top 3 Podium */
.victory-podium-stage {
  display: grid;
  grid-template-columns: 1fr 1.15fr 1fr;
  gap: 0.85rem;
  align-items: end;
  margin: 1.4rem 0 1.75rem;
}

.podium-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 1.25rem 0.9rem;
  border-radius: 18px;
  background: #141D30;
  border: 2.5px solid #111111;
  box-shadow: 0 5px 0 #111111;
}

.podium-1st {
  padding: 1.65rem 1rem;
  background: linear-gradient(180deg, rgba(249, 171, 0, 0.25) 0%, #141D30 100%);
  border-color: var(--g-yellow-bright);
}

.podium-2nd {
  border-color: #FFFFFF;
}

.podium-3rd {
  border-color: var(--g-red);
}

.podium-badge {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--badge, var(--g-blue));
  border: 2.5px solid #111111;
  box-shadow: 0 3px 0 #111111;
  margin-bottom: 0.5rem;
}

.podium-1st .podium-badge {
  width: 58px;
  height: 58px;
}

.your-rank-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.1rem;
  border-radius: 14px;
  margin-bottom: 1rem;
  background: rgba(255, 255, 255, 0.06);
  border: 2.5px solid var(--player-accent, var(--g-blue));
  box-shadow: 0 4px 0 #111111;
}

.your-rank-left,
.your-rank-right {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
}

.your-rank-right {
  align-items: flex-end;
}

.your-rank-label {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.your-rank-value {
  font-size: 1.9rem;
  font-weight: 800;
  line-height: 1.05;
}

.your-rank-of {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.your-rank-score {
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1.05;
  color: var(--g-yellow-bright);
}

.podium-crown {
  font-size: 1.75rem;
  margin-bottom: 0.25rem;
}

.podium-place-label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 800;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.podium-name {
  font-size: 1.05rem;
  font-weight: 800;
  margin-bottom: 0.25rem;
}

.podium-grand-score {
  font-family: var(--font-mono);
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--g-yellow-bright);
}

.podium-wave-math {
  margin-top: 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-muted);
}

.final-table-heading {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 800;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
}

/* ==========================================
   HOST ADMIN PANEL DRAWER & DIALOGS
   ========================================== */
.admin-console-drawer {
  position: fixed;
  top: 64px;
  right: 14px;
  z-index: 60;
  width: min(380px, calc(100vw - 28px));
  background: #0F1626;
  border: 2.5px solid #111111;
  border-radius: 18px;
  padding: 1.1rem;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.75), 0 5px 0 #111111;
}

.admin-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 0.65rem;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.admin-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 800;
  padding: 0.12rem 0.42rem;
  border-radius: 4px;
  background: var(--g-yellow);
  color: #111111;
  margin-bottom: 0.15rem;
}

.admin-title-row h4 {
  font-size: 0.92rem;
  font-weight: 800;
}

.admin-status-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 0.8rem;
}

.admin-stat-box {
  padding: 0.5rem 0.65rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  color: var(--text-muted);
}

.admin-section {
  margin-bottom: 0.8rem;
}

.admin-section-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.64rem;
  font-weight: 700;
  color: #CBD5E1;
  margin-bottom: 0.4rem;
}

.admin-btn-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
}

.admin-action-btn {
  padding: 0.55rem 0.6rem;
  border-radius: 10px;
  border: 1.5px solid rgba(255, 255, 255, 0.18);
  font-size: 0.74rem;
  font-weight: 700;
  color: #FFFFFF;
  cursor: pointer;
}

.admin-action-btn.btn-blue { background: var(--g-blue); border-color: #111; color: #FFF; }
.admin-action-btn.btn-yellow { background: var(--g-yellow); border-color: #111; color: #111; }
.admin-action-btn.btn-red { background: var(--g-red); border-color: #111; color: #FFF; }
.admin-action-btn.btn-green { background: var(--g-green); border-color: #111; color: #FFF; }
.admin-action-btn.btn-outline { background: rgba(255, 255, 255, 0.07); }

.duration-pills {
  display: flex;
  gap: 0.35rem;
}

.dur-pill {
  flex: 1;
  padding: 0.38rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #CBD5E1;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  cursor: pointer;
}

.dur-pill.active {
  background: var(--g-yellow);
  border-color: #111111;
  color: #111111;
  font-weight: 800;
}

#shake-threshold-slider {
  width: 100%;
  accent-color: var(--g-yellow);
}

.slider-scale-labels {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.58rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.admin-footer-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
  margin-bottom: 0;
}

.admin-util-btn {
  padding: 0.5rem 0.6rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #E2E8F0;
  font-size: 0.7rem;
  font-weight: 700;
  cursor: pointer;
}

.admin-util-btn.danger {
  background: rgba(234, 67, 53, 0.16);
  border-color: rgba(234, 67, 53, 0.5);
  color: #FCA5A5;
}

.full-span-btn {
  grid-column: 1 / -1;
  padding: 0.6rem;
}

.hud-dialog {
  margin: auto;
  width: min(460px, 92vw);
  border-radius: 18px;
  background: #0F1626;
  border: 2.5px solid #111111;
  color: #FFFFFF;
  padding: 1.25rem;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), 0 6px 0 #111111;
}

.hud-dialog::backdrop {
  background: rgba(5, 8, 16, 0.75);
  backdrop-filter: blur(5px);
}

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.dialog-desc,
.qr-modal-instruction {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.45;
  margin-bottom: 0.85rem;
}

.dialog-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}

.qr-modal-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.9rem;
}

.qr-modal-svg-box {
  width: min(240px, 64vw);
  height: min(240px, 64vw);
  padding: 0.75rem;
  border-radius: 16px;
  background: #FFFFFF;
  border: 3px solid #111111;
  box-shadow: 0 6px 0 #111111;
}

.qr-modal-details {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
}

/* ==========================================
   MOBILE PHONE RESPONSIVE BREAKPOINTS
   ========================================== */
@media (max-width: 860px) {
  .arena-grid {
    grid-template-columns: 1fr;
  }
  .victory-podium-stage {
    grid-template-columns: 1fr 1fr;
  }
  .podium-1st {
    grid-column: 1 / -1;
    order: -1;
  }
  .floating-jeepney {
    width: 82px;
    opacity: 0.45;
  }
}

@media (max-width: 600px) {
  .sync-pill,
  .gps-coord-tag {
    display: none !important;
  }

  .hud-header {
    padding: calc(0.45rem + env(safe-area-inset-top, 0px)) 0.75rem 0.45rem;
  }

  .cdo-logo-lockup.compact .cdo-brace { font-size: 1.75rem; }
  .cdo-logo-lockup.compact .cdo-devfest-word { font-size: 0.98rem; }
  .cdo-logo-lockup.compact .cdo-pill-city,
  .cdo-logo-lockup.compact .cdo-pill-year {
    font-size: 0.54rem;
    padding: 0.05rem 0.36rem;
  }

  .wave-stepper-bar {
    padding: 0.38rem 0.5rem;
    gap: 0.25rem;
  }

  .wave-step {
    padding: 0.2rem 0.5rem;
    font-size: 0.68rem;
  }

  .step-connector {
    width: 8px;
  }

  .arena-viewport {
    padding: 0.65rem 0.65rem calc(5.5rem + env(safe-area-inset-bottom, 0px));
  }

  .cdo-surface-card {
    padding: 1rem;
    border-radius: 18px;
  }

  .field-row-split {
    grid-template-columns: 1fr;
    gap: 0.7rem;
  }

  .sensor-permission-box {
    flex-direction: column;
    align-items: stretch;
  }

  .kahoot-qr-banner {
    flex-direction: column;
    text-align: center;
  }

  .kahoot-step-pill {
    align-self: center;
  }

  .kahoot-url-row,
  .kahoot-pin-row {
    justify-content: center;
  }

  .wave-hud-panel {
    padding: 0.85rem 0.95rem;
  }

  .wave-heading {
    font-size: 1rem;
  }

  .timer-orb-wrap {
    width: 86px;
    height: 86px;
  }

  .timer-digits {
    font-size: 1.08rem;
  }

  .reactor-gauge-stage {
    height: 172px;
  }

  .reactor-arc-svg {
    width: 224px;
    height: 172px;
  }

  .admin-console-drawer {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-height: 82dvh;
    overflow-y: auto;
    border-radius: 20px 20px 0 0;
    padding: 1rem 1rem calc(1.25rem + env(safe-area-inset-bottom, 0px));
  }
}

/* ==========================================
   SUSPENSE GATE BEFORE EACH LEADERBOARD
   ========================================== */
.reveal-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 2.2rem 1.5rem;
  max-width: 560px;
  margin: 0 auto;
}

.reveal-title {
  font-size: 2.1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 0.3rem;
}

.reveal-sub {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

.reveal-orbit {
  position: relative;
  width: 186px;
  height: 186px;
  display: grid;
  place-items: center;
  margin-bottom: 1.1rem;
}

.reveal-ring {
  position: absolute;
  border-radius: 50%;
  border: 3px solid transparent;
}

.ring-a {
  inset: 0;
  border-top-color: var(--g-blue);
  border-right-color: var(--g-blue);
  animation: revealSpin 1.6s linear infinite;
}

.ring-b {
  inset: 20px;
  border-bottom-color: var(--g-red);
  border-left-color: var(--g-red);
  animation: revealSpin 2.4s linear infinite reverse;
}

.ring-c {
  inset: 40px;
  border-top-color: var(--g-yellow-bright);
  border-left-color: var(--g-green);
  animation: revealSpin 1.05s linear infinite;
}

.reveal-scramble {
  font-family: var(--font-mono);
  font-size: 2.4rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #FFFFFF;
  text-shadow: 0 0 20px rgba(66, 133, 244, 0.6);
}

.reveal-status {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  min-height: 1.2em;
  margin-bottom: 1.4rem;
}

.reveal-wait-note {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

@keyframes revealSpin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .reveal-ring {
    animation: none;
  }
}

/* ==========================================
   FINAL 20 SECONDS OF A WAVE
   The room goes red and pulses so the clock running out is felt rather than
   read. Doubles in pace for the last 5. Applied to body, so the projector and
   every phone light up together.
   ========================================== */
body.wave-critical::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 45;
  box-shadow:
    inset 0 0 90px 16px rgba(234, 67, 53, 0.6),
    inset 0 0 240px 70px rgba(234, 67, 53, 0.26);
  animation: criticalPulse 1s ease-in-out infinite;
}

body.wave-critical .wave-hud-panel {
  border-color: var(--g-red);
  animation: criticalJitter 1s ease-in-out infinite;
}

body.wave-final-seconds::after {
  animation-duration: 0.4s;
}

body.wave-final-seconds .wave-hud-panel {
  animation-duration: 0.4s;
}

body.wave-final-seconds .timer-orb-wrap {
  animation: criticalThump 0.4s ease-in-out infinite;
}

@keyframes criticalPulse {
  0%,
  100% {
    opacity: 0.4;
  }
  50% {
    opacity: 1;
  }
}

@keyframes criticalJitter {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-1.5px);
  }
  75% {
    transform: translateX(1.5px);
  }
}

@keyframes criticalThump {
  0%,
  100% {
    transform: scale(1);
  }
  45% {
    transform: scale(1.08);
  }
}

@media (prefers-reduced-motion: reduce) {
  body.wave-critical::after,
  body.wave-critical .wave-hud-panel,
  body.wave-final-seconds .timer-orb-wrap {
    animation: none;
  }

  body.wave-critical::after {
    opacity: 0.75;
  }
}

/* ==========================================
   ANIMAL AVATARS
   ========================================== */
.avatar-picker-row {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 0.35rem;
}

.avatar-btn {
  min-height: 44px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid rgba(255, 255, 255, 0.14);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.avatar-btn .avatar-glyph {
  font-size: 1.25rem;
  line-height: 1;
}

.avatar-btn.selected {
  background: rgba(255, 255, 255, 0.14);
  border-color: var(--player-accent, var(--g-blue));
  box-shadow: 0 2px 0 #111111;
}

.capsule-avatar,
.row-avatar {
  font-size: 0.95em;
}

.orb-avatar {
  font-size: 1.05rem;
  line-height: 1;
}

.waiting-badge-orb span {
  font-size: 2rem;
  line-height: 1;
}

.podium-badge {
  display: grid;
  place-items: center;
  font-size: 1.5rem;
  line-height: 1;
}

.podium-1st .podium-badge {
  font-size: 1.9rem;
}

/* ==========================================
   SHAKE LOCK
   A phone being shaken hard will catch stray palm and thumb contacts. While a
   wave is live, anything on a player's screen that navigates, toggles or
   resets is put out of reach, including the logo that unlocks the host panel
   on a triple tap. Scoring input is untouched.
   ========================================== */
body.shake-lock {
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

body.shake-lock .hud-header .hud-icon-btn,
body.shake-lock .hud-header .hud-brand,
body.shake-lock .wave-stepper-bar {
  pointer-events: none;
  opacity: 0.5;
}

body.shake-lock #screen-arena {
  touch-action: pan-y;
}

/* Once the accelerometer is feeding the game, the tap fallback is only a
   target for accidents. */
body.shake-lock.sensor-live .fallback-secondary-row,
body.shake-lock.sensor-live .btn-activate-sensor {
  display: none !important;
}

/* Host key entry, shown only when this screen was not handed the key. */
.host-key-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.host-key-row input {
  flex: 1;
  font-family: var(--font-mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
