/* ==========================================================================
   ELF BOWLING: STRIKES BACK — 100% Web-Based Arcade UI & Motion Graphics CSS
   ========================================================================== */

:root {
  --bg-deep: #071120;
  --bg-panel: rgba(11, 23, 42, 0.88);
  --bg-card: rgba(18, 34, 61, 0.92);
  --border-frost: rgba(148, 210, 255, 0.28);
  --border-gold: rgba(251, 191, 36, 0.55);
  --red-festive: #ef4444;
  --red-dark: #b91c1c;
  --green-elf: #22c55e;
  --green-dark: #15803d;
  --gold-arcade: #fbbf24;
  --cyan-ice: #38bdf8;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --shadow-neon: 0 10px 30px rgba(0, 0, 0, 0.55);
}

*, *::before, *::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: radial-gradient(circle at 50% 25%, #132a4a 0%, #071120 75%);
  color: var(--text-main);
  font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
  user-select: none;
  touch-action: none;
}

/* Main Game Canvas */
#game-viewport {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

#alley-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
}

#alley-canvas:active {
  cursor: grabbing;
}

/* ==========================================================================
   TOP HUD: ICONIC 1999 "NSTORMOMATIC" CHRISTMAS-LIGHTS OVERHEAD SCOREBOARD
   ========================================================================== */
#top-hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 12px 12px 4px;
  background: none;
  pointer-events: none;
}

#top-hud > * {
  pointer-events: auto;
}

@keyframes bulbTwinkle {
  0%, 100% { filter: brightness(1.05); transform: scale(1); }
  50% { filter: brightness(1.45); transform: scale(1.12); }
}

/* 1999 Festive Overhead Scoreboard Marquee */
#scorecard-bar.marquee-1999 {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 960px;
  width: fit-content;
  background: linear-gradient(180deg, #991b1b 0%, #7f1d1d 48%, #450a0a 100%);
  border: 2.5px solid #fbbf24;
  border-radius: 14px;
  padding: 9px 12px 7px;
  box-shadow:
    0 10px 28px rgba(0, 0, 0, 0.65),
    0 0 22px rgba(251, 191, 36, 0.22),
    inset 0 1px 0 rgba(254, 240, 138, 0.45);
  overflow: visible;
}

/* Draped Colorful Glowing Christmas Light Bulbs Along Top Trim */
.marquee-lights {
  position: absolute;
  top: -7px;
  left: 16px;
  right: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
  z-index: 2;
}

.marquee-lights .bulb {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 1.5px solid #1a1025;
  animation: bulbTwinkle 2.2s ease-in-out infinite;
}

.marquee-lights .bulb:nth-child(2n) { animation-delay: 0.55s; }
.marquee-lights .bulb:nth-child(3n) { animation-delay: 1.1s; }
.marquee-lights .bulb:nth-child(4n) { animation-delay: 1.65s; }

.marquee-lights .b-red {
  background: radial-gradient(circle at 35% 30%, #fecaca, #ef4444 65%, #991b1b);
  box-shadow: 0 0 8px #ef4444, 0 0 14px rgba(239, 68, 68, 0.65);
}

.marquee-lights .b-gold {
  background: radial-gradient(circle at 35% 30%, #fef9c3, #facc15 65%, #b45309);
  box-shadow: 0 0 8px #facc15, 0 0 14px rgba(250, 204, 21, 0.65);
}

.marquee-lights .b-green {
  background: radial-gradient(circle at 35% 30%, #bbf7d0, #22c55e 65%, #15803d);
  box-shadow: 0 0 8px #22c55e, 0 0 14px rgba(34, 197, 94, 0.65);
}

.marquee-lights .b-cyan {
  background: radial-gradient(circle at 35% 30%, #e0f2fe, #38bdf8 65%, #0369a1);
  box-shadow: 0 0 8px #38bdf8, 0 0 14px rgba(56, 189, 248, 0.65);
}

.player-badge {
  display: flex;
  flex-direction: column;
  min-width: 88px;
  padding-right: 9px;
  border-right: 1.5px solid rgba(254, 240, 138, 0.35);
}

.player-badge .p-name {
  font-family: Georgia, 'Trebuchet MS', serif;
  font-style: italic;
  font-weight: 900;
  font-size: 1rem;
  color: #fef08a;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.75);
  white-space: nowrap;
  line-height: 1.1;
}

.player-badge .p-sub {
  font-size: 0.66rem;
  color: #fde68a;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-top: 2px;
  white-space: nowrap;
}

.frames-strip {
  display: flex;
  gap: 3px;
}

/* Crisp High-Contrast WHITE 1999 Bowling Frame Cells */
.frame-cell {
  width: 41px;
  background: #ffffff;
  border: 1.5px solid #1e293b;
  border-radius: 5px;
  overflow: hidden;
  text-align: center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 2px 4px rgba(0, 0, 0, 0.35);
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.frame-cell.frame-10 {
  width: 56px;
}

.frame-cell.active-frame {
  border-color: #facc15;
  box-shadow: 0 0 0 2px #facc15, 0 0 14px rgba(250, 204, 21, 0.72);
  transform: translateY(-1px);
}

.frame-num {
  font-size: 0.62rem;
  font-weight: 900;
  background: #1e293b;
  color: #fef08a;
  padding: 1px 0;
  line-height: 1.15;
}

.frame-rolls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  height: 19px;
  font-size: 0.78rem;
  font-weight: 900;
  line-height: 19px;
  background: #f8fafc;
}

.frame-cell.frame-10 .frame-rolls {
  grid-template-columns: 1fr 1fr 1fr;
}

.roll-box {
  border-left: 1px solid #94a3b8;
  border-bottom: 1px solid #94a3b8;
  color: #0f172a;
}

.roll-box:first-child {
  border-left: none;
}

.roll-box.strike-mark {
  color: #dc2626;
  background: #fef2f2;
}

.roll-box.spare-mark {
  color: #15803d;
  background: #f0fdf4;
}

.frame-total {
  height: 19px;
  line-height: 19px;
  font-size: 0.78rem;
  font-weight: 900;
  color: #0f172a;
  background: #ffffff;
}

.total-summary {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 8px 0 6px;
  min-width: 58px;
  border-right: 1.5px solid rgba(254, 240, 138, 0.35);
}

.total-summary .lbl {
  font-size: 0.56rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #fde68a;
}

.total-summary .val {
  font-size: 1.32rem;
  font-weight: 900;
  color: #fde047;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.75);
  line-height: 1.05;
}

.total-summary .style-val {
  font-size: 0.60rem;
  color: #fbcfe8;
  font-weight: 800;
}

/* Right Compact 3-Pill Utility Cluster inside Marquee */
#utility-cluster {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  flex-shrink: 0;
}

.hud-pill, .hud-btn, .hud-select {
  background: var(--bg-panel);
  color: var(--text-main);
  border: 1px solid var(--border-frost);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 0.72rem;
  font-weight: 800;
  cursor: pointer;
  backdrop-filter: blur(8px);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
  text-decoration: none;
  white-space: nowrap;
}

.hud-btn.marquee-pill {
  background: rgba(15, 23, 42, 0.78);
  border: 1.5px solid rgba(254, 240, 138, 0.55);
  color: #fef9c3;
  padding: 5px 9px;
  font-size: 0.72rem;
}

.hud-btn.marquee-pill.pill-3d {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.9), rgba(219, 39, 119, 0.9));
  border-color: #fde047;
  color: #ffffff;
}

.hud-btn:hover, .hud-select:hover {
  border-color: var(--gold-arcade);
  transform: translateY(-1px);
}

.hud-btn.active-toggle {
  background: linear-gradient(135deg, rgba(220, 38, 38, 0.92), rgba(153, 27, 27, 0.96));
  border-color: #fde047;
  color: #ffffff;
}

#btn-v1-coach.active {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.95), rgba(5, 150, 105, 0.98));
  border-color: #fde047;
  color: #ffffff;
  box-shadow: 0 0 14px rgba(16, 185, 129, 0.6), inset 0 1px 0 rgba(254, 240, 138, 0.45);
}

.hud-btn.story-link {
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.3), rgba(139, 92, 246, 0.38));
  border-color: rgba(125, 211, 252, 0.6);
  color: #e0f2fe;
}

.hud-select {
  padding-right: 8px;
  outline: none;
}

.hud-select option {
  background: #0f172a;
  color: #f8fafc;
}

/* ==========================================================================
   CRT JUMBOTRON OVERLAY BANNER (Animated Scanline Scoreboard Reactions)
   ========================================================================== */
#jumbotron-banner {
  position: absolute;
  top: 98px;
  left: 50%;
  transform: translateX(-50%) translateY(-28px) scale(0.88);
  opacity: 0;
  pointer-events: none;
  z-index: 25;
  width: min(460px, 90vw);
  background: linear-gradient(180deg, #162338 0%, #09111f 100%);
  border: 3px solid var(--gold-arcade);
  border-radius: 16px;
  padding: 10px 16px;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.75), 0 0 28px rgba(251, 191, 36, 0.35);
  transition: transform 0.28s cubic-bezier(0.22, 1.35, 0.36, 1), opacity 0.22s ease;
  overflow: hidden;
}

#jumbotron-banner.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0) scale(1);
}

/* CRT scanline shimmer */
#jumbotron-banner::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    rgba(255, 255, 255, 0.03) 0px,
    rgba(255, 255, 255, 0.03) 1px,
    transparent 1px,
    transparent 3px
  );
  pointer-events: none;
}

.jumbo-inner {
  display: flex;
  align-items: center;
  gap: 12px;
}

.jumbo-thumb {
  width: 68px;
  height: 52px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid rgba(251, 191, 36, 0.45);
  background: #0f172a;
  flex-shrink: 0;
}

.jumbo-thumb.hidden,
.jumbo-badge.hidden {
  display: none;
}

.jumbo-badge {
  width: 56px;
  height: 52px;
  border-radius: 10px;
  border: 1.5px solid rgba(251, 191, 36, 0.55);
  background: radial-gradient(circle at 35% 30%, #1e3a5f 0%, #0b1628 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.95rem;
  line-height: 1;
  flex-shrink: 0;
  box-shadow: inset 0 1px 6px rgba(251, 191, 36, 0.18), 0 4px 12px rgba(0, 0, 0, 0.45);
}

.jumbo-copy {
  flex: 1;
}

.jumbo-title {
  font-size: 1.35rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--gold-arcade);
  text-shadow: 0 2px 10px rgba(251, 191, 36, 0.45);
  line-height: 1.05;
}

.jumbo-subtitle {
  margin-top: 3px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #e2e8f0;
  font-style: italic;
}

/* Live Status Toast */
#status-toast {
  position: absolute;
  top: 122px;
  right: 14px;
  z-index: 22;
  max-width: 320px;
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid var(--cyan-ice);
  color: #e0f2fe;
  padding: 7px 12px;
  border-radius: 10px;
  font-size: 0.74rem;
  font-weight: 600;
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  transition: all 0.2s ease;
}

#status-toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* ==========================================================================
   BOTTOM DOCK: ULTRA-SLIM FLOATING GLASS PILL BAR (< 48px tall!)
   ========================================================================== */
#bottom-hud {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 0 10px calc(10px + env(safe-area-inset-bottom));
  background: none;
  pointer-events: none;
}

#bottom-hud > * {
  pointer-events: auto;
}

/* Tiny 3-Word Floating Fade-Out Prompt (appears ONLY on Throw 1!) */
.throw1-prompt {
  display: inline-flex;
  align-items: center;
  padding: 3px 12px;
  border-radius: 999px;
  background: rgba(9, 17, 34, 0.82);
  border: 1px solid rgba(253, 224, 71, 0.55);
  color: #fef08a;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.45s ease, transform 0.45s ease;
}

.throw1-prompt.hidden {
  opacity: 0;
  transform: translateY(4px);
  pointer-events: none;
}

/* Single Translucent Floating Glass Pill Bar */
.bottom-glass-dock {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  max-width: min(fit-content, 98vw);
  min-height: 40px;
  max-height: 46px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(9, 17, 34, 0.78);
  border: 1.5px solid rgba(148, 210, 255, 0.32);
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.dock-sep {
  width: 1px;
  height: 22px;
  background: rgba(148, 210, 255, 0.25);
  flex-shrink: 0;
}

/* Ice-Track Coach Tip / Post-Gutter Help Nudge Pill */
.coach-tip-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  max-width: min(760px, 94vw);
  padding: 4px 12px;
  border-radius: 999px;
  border: 1.5px solid rgba(52, 211, 153, 0.72);
  background: linear-gradient(135deg, rgba(6, 78, 59, 0.92), rgba(11, 33, 48, 0.94));
  color: #ecfdf5;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: 0.01em;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  backdrop-filter: blur(10px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45), 0 0 14px rgba(16, 185, 129, 0.28);
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.coach-tip-pill:hover {
  transform: translateY(-1px);
  border-color: #fde047;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.55), 0 0 18px rgba(16, 185, 129, 0.45);
}

.coach-tip-pill.nudge {
  border-color: rgba(251, 191, 36, 0.85);
  background: linear-gradient(135deg, rgba(120, 53, 15, 0.92), rgba(6, 78, 59, 0.92));
  color: #fef3c7;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5), 0 0 16px rgba(251, 191, 36, 0.35);
}

.coach-tip-pill.hidden {
  display: none;
}

/* Quick Ball Switcher (Compact Inline Pills) */
#ball-selector-strip {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 4px;
}

.ball-chip {
  background: rgba(15, 28, 50, 0.78);
  border: 1.5px solid rgba(148, 210, 255, 0.22);
  color: #e2e8f0;
  border-radius: 999px;
  height: 30px;
  padding: 0 9px;
  font-size: 0.72rem;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.14s ease;
  white-space: nowrap;
}

.ball-ico {
  font-size: 0.92rem;
  line-height: 1;
}

.ball-chip:hover {
  border-color: var(--cyan-ice);
}

.ball-chip.selected {
  background: linear-gradient(135deg, rgba(220, 38, 38, 0.9), rgba(180, 83, 9, 0.9));
  border-color: var(--gold-arcade);
  color: #fff;
  box-shadow: 0 0 12px rgba(251, 191, 36, 0.4);
}

.ball-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

/* Contextual Controller Panels (Inline Inside Glass Dock) */
.ctrl-panel {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: transparent;
  border: none;
  padding: 0;
  box-shadow: none;
}

.ctrl-panel.active {
  display: inline-flex;
  flex-wrap: nowrap;
}

.bowl-cta {
  height: 30px;
  padding: 0 13px !important;
  font-size: 0.76rem !important;
  font-weight: 900;
  letter-spacing: 0.03em;
}

.hint-text {
  font-size: 0.72rem;
  color: #cbd5e1;
  font-weight: 600;
}

.hint-text strong {
  color: var(--gold-arcade);
}

/* 1999 Classic 5-Pip Hook / Curve Control Bar */
#panel-retro-arrow {
  gap: 7px;
  padding: 0;
}

.retro-hook-bar {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: rgba(6, 14, 28, 0.9);
  border: 1.5px solid rgba(251, 191, 36, 0.45);
  border-radius: 999px;
  padding: 2px 3px;
  height: 30px;
  box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.65);
}

.hook-pip {
  background: rgba(15, 29, 52, 0.78);
  border: 1px solid rgba(148, 210, 255, 0.18);
  color: #cbd5e1;
  border-radius: 999px;
  height: 24px;
  padding: 0 7px;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 22px;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease, transform 0.1s ease;
  white-space: nowrap;
}

.hook-pip:hover {
  border-color: var(--gold-arcade);
  color: #ffffff;
}

.hook-pip.active {
  background: linear-gradient(135deg, #f59e0b 0%, #dc2626 100%);
  border-color: #fef08a;
  color: #ffffff;
  box-shadow: 0 0 10px rgba(250, 204, 21, 0.5);
}

.hook-pip.active[data-spin="0"] {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  border-color: #7dd3fc;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.45);
}

/* Keyboard Power Meter */
.power-meter-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.power-bar-track {
  position: relative;
  width: 160px;
  height: 14px;
  background: #091324;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  overflow: hidden;
}

.power-sweetspot {
  position: absolute;
  left: 88%;
  width: 8%;
  top: 0;
  bottom: 0;
  background: rgba(251, 191, 36, 0.5);
  border-left: 1px dashed #fbbf24;
  border-right: 1px dashed #fbbf24;
}

#kb-power-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #22c55e 0%, #eab308 70%, #ef4444 100%);
  transition: width 0.04s linear;
}

.telemetry-readout {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.72rem;
  color: var(--cyan-ice);
  background: rgba(7, 15, 28, 0.8);
  padding: 3px 8px;
  border-radius: 6px;
}

/* Android Tilt + Thumb-Clutch Swing Panel */
#panel-android-motion {
  flex-direction: column;
  gap: 7px;
  width: min(460px, 95vw);
}

.tilt-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 8px;
}

.tilt-bubble-track {
  position: relative;
  flex: 1;
  height: 14px;
  background: rgba(8, 16, 30, 0.9);
  border: 1px solid rgba(56, 189, 248, 0.4);
  border-radius: 999px;
}

.tilt-center-tick {
  position: absolute;
  left: 50%;
  top: 1px;
  bottom: 1px;
  width: 2px;
  background: rgba(255, 255, 255, 0.35);
  transform: translateX(-50%);
}

#tilt-bubble-dot {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 14px;
  height: 14px;
  background: var(--green-elf);
  border: 2px solid #fff;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 8px var(--green-elf);
}

#thumb-clutch-pad {
  width: 100%;
  padding: 13px 16px;
  border-radius: 14px;
  border: 2px solid var(--gold-arcade);
  background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
  color: #fff;
  font-size: 0.92rem;
  font-weight: 900;
  letter-spacing: 0.03em;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(220, 38, 38, 0.45);
  transition: transform 0.1s ease, background 0.15s ease;
}

#thumb-clutch-pad.engaged {
  background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
  border-color: #86efac;
  transform: scale(0.98);
  box-shadow: 0 0 24px rgba(34, 197, 94, 0.65);
}

/* Desktop Android Sensor Simulator Mini-Drawer */
#sim-sensor-drawer {
  display: none;
  align-items: center;
  gap: 10px;
  background: rgba(15, 23, 42, 0.95);
  border: 1px dashed var(--gold-arcade);
  border-radius: 10px;
  padding: 6px 12px;
  font-size: 0.72rem;
}

#sim-sensor-drawer.visible {
  display: flex;
  flex-wrap: wrap;
}

/* ==========================================================================
   LOBBY / SETUP MODAL & END-OF-GAME SUMMARY MODAL
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(4, 10, 20, 0.82);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  overflow-y: auto;
}

.modal-backdrop.hidden {
  display: none;
}

.lobby-card {
  width: min(860px, 96vw);
  max-height: 92dvh;
  overflow-y: auto;
  background: linear-gradient(180deg, #10203a 0%, #081223 100%);
  border: 2px solid var(--border-gold);
  border-radius: 20px;
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.8);
  padding: 18px 22px 22px;
}

.hero-banner-box {
  position: relative;
  width: 100%;
  height: 175px;
  border-radius: 14px;
  overflow: hidden;
  border: 1.5px solid rgba(251, 191, 36, 0.4);
  background: linear-gradient(125deg, #7f1d1d 0%, #14532d 50%, #0c4a6e 100%);
  margin-bottom: 14px;
}

.hero-banner-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.85;
}

.hero-overlay-copy {
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, rgba(8, 18, 35, 0.95) 0%, rgba(8, 18, 35, 0.2) 65%, transparent 100%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 14px 18px;
}

.arcade-kicker {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--gold-arcade);
}

.arcade-title {
  margin: 2px 0 4px;
  font-size: clamp(1.45rem, 3.5vw, 2.2rem);
  font-weight: 900;
  letter-spacing: 0.02em;
  color: #ffffff;
  text-shadow: 0 3px 14px rgba(0, 0, 0, 0.85);
}

.arcade-sub {
  margin: 0;
  font-size: 0.82rem;
  color: #cbd5e1;
}

.lobby-grid {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 14px;
}

.section-label {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--cyan-ice);
  margin-bottom: 7px;
}

.bowler-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.bowler-option {
  background: rgba(15, 29, 52, 0.85);
  border: 2px solid rgba(148, 210, 255, 0.22);
  border-radius: 12px;
  padding: 9px;
  cursor: pointer;
  text-align: left;
  color: var(--text-main);
  transition: all 0.15s ease;
}

.bowler-option:hover {
  border-color: var(--cyan-ice);
}

.bowler-option.selected {
  border-color: var(--gold-arcade);
  background: linear-gradient(180deg, rgba(30, 58, 95, 0.95), rgba(15, 29, 52, 0.95));
  box-shadow: 0 0 16px rgba(251, 191, 36, 0.28);
}

.bowler-option .b-role {
  font-size: 0.63rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--gold-arcade);
}

.bowler-option .b-name {
  font-size: 0.86rem;
  font-weight: 800;
  margin: 2px 0 4px;
}

.bowler-option .b-desc {
  font-size: 0.68rem;
  color: var(--text-muted);
  line-height: 1.3;
}

.settings-box {
  background: rgba(13, 25, 45, 0.85);
  border: 1px solid rgba(148, 210, 255, 0.2);
  border-radius: 12px;
  padding: 11px 13px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 700;
}

.pill-group {
  display: inline-flex;
  background: #07101e;
  border-radius: 999px;
  padding: 2px;
  border: 1px solid rgba(148, 210, 255, 0.22);
}

.pill-opt {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
}

.pill-opt.active {
  background: var(--red-festive);
  color: #fff;
}

.device-detect-card {
  margin-top: 12px;
  background: rgba(12, 34, 54, 0.72);
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 12px;
  padding: 10px 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.78rem;
}

.lobby-actions {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.btn-play-big {
  flex: 1;
  min-width: 210px;
  padding: 13px 24px;
  border-radius: 14px;
  border: 2px solid #fde047;
  background: linear-gradient(135deg, #16a34a 0%, #15803d 50%, #dc2626 100%);
  color: #ffffff;
  font-size: 1.08rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(22, 163, 74, 0.45);
  transition: transform 0.15s ease;
}

.btn-play-big:hover {
  transform: translateY(-2px) scale(1.01);
}

.btn-secondary-story {
  padding: 12px 18px;
  border-radius: 14px;
  border: 1.5px solid rgba(125, 211, 252, 0.6);
  background: rgba(14, 116, 144, 0.28);
  color: #e0f2fe;
  font-size: 0.84rem;
  font-weight: 800;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.btn-secondary-story:hover {
  border-color: var(--gold-arcade);
}

/* ==========================================================================
   1999 CUBICLE "BOSS KEY" WINDOWS 98 SPREADSHEET PARODY
   ========================================================================== */
#boss-key-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #c0c0c0;
  color: #000000;
  font-family: Tahoma, 'MS Sans Serif', Arial, sans-serif;
  font-size: 12px;
  display: none;
  flex-direction: column;
  transition: none !important;
  animation: none !important;
}

#boss-key-overlay.visible {
  display: flex;
  transition: none !important;
  animation: none !important;
}

.win98-titlebar {
  background: linear-gradient(90deg, #000080, #1084d0);
  color: #ffffff;
  font-weight: bold;
  padding: 4px 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.win98-close-btn {
  background: #c0c0c0;
  border-top: 2px solid #fff;
  border-left: 2px solid #fff;
  border-right: 2px solid #404040;
  border-bottom: 2px solid #404040;
  padding: 2px 8px;
  font-weight: bold;
  cursor: pointer;
}

.win98-toolbar {
  padding: 4px 8px;
  border-bottom: 1px solid #808080;
  background: #d4d0c8;
  flex-shrink: 0;
}

.win98-sheet {
  flex: 1;
  background: #ffffff;
  overflow: auto;
  padding: 0;
}

.win98-sheet table {
  width: 100%;
  min-height: 100%;
  border-collapse: collapse;
}

.win98-sheet th, .win98-sheet td {
  border: 1px solid #c0c0c0;
  padding: 4px 8px;
  text-align: left;
  white-space: nowrap;
}

.win98-sheet th {
  background: #e4e4e4;
  font-weight: bold;
  text-align: center;
}

.win98-sheet tr.win98-total-row td {
  background: #f0f4f8;
  border-top: 2px solid #404040;
}

.win98-statusbar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 3px 8px;
  background: #d4d0c8;
  border-top: 1px solid #808080;
  font-size: 11px;
}

.win98-tabs {
  display: inline-flex;
  gap: 3px;
}

.win98-tab {
  padding: 2px 10px;
  background: #c0c0c0;
  border: 1px solid #808080;
  border-top: none;
}

.win98-tab.active {
  background: #ffffff;
  font-weight: bold;
}

.menu-utility-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

#v1-guide-modal {
  z-index: 60;
}

/* Keep Desktop Marquee crisp & single-row on 781-1100px viewports */
@media (min-width: 781px) and (max-width: 1100px) {
  #top-hud {
    padding: 10px 8px 4px;
  }
  #scorecard-bar.marquee-1999 {
    padding: 8px 9px 6px;
    gap: 7px;
  }
  .player-badge {
    min-width: 74px;
    padding-right: 6px;
  }
  .player-badge .p-name {
    font-size: 0.86rem;
  }
  .player-badge .p-sub {
    font-size: 0.60rem;
  }
  .frame-cell {
    width: 34px;
  }
  .frame-cell.frame-10 {
    width: 48px;
  }
  .total-summary {
    min-width: 48px;
    padding: 0 6px 0 4px;
  }
  .hud-btn.marquee-pill {
    padding: 4px 7px;
    font-size: 0.66rem;
  }
}

/* Responsive Adjustments for Android Portrait (412×915) & Small Screens */
@media (max-width: 780px) {
  #top-hud {
    padding: 8px 4px 2px;
  }
  #scorecard-bar.marquee-1999 {
    width: 100%;
    max-width: 100%;
    flex-wrap: wrap;
    justify-content: space-between;
    padding: 8px 6px 5px;
    gap: 5px;
    border-radius: 10px;
  }
  .marquee-lights {
    top: -6px;
    left: 10px;
    right: 10px;
  }
  .marquee-lights .bulb {
    width: 8px;
    height: 8px;
  }
  .player-badge {
    min-width: 0;
    max-width: 68px;
    padding-right: 4px;
    overflow: hidden;
  }
  .player-badge .p-name {
    font-size: 0.72rem;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .player-badge .p-sub {
    font-size: 0.52rem;
    white-space: nowrap;
  }
  .frames-strip {
    flex: 1 1 auto;
    min-width: 0;
    gap: 2px;
  }
  .frame-cell {
    flex: 1 1 0;
    min-width: 19px;
    width: auto;
    border-radius: 4px;
  }
  .frame-cell.frame-10 {
    flex: 1.45 1 0;
    min-width: 28px;
    width: auto;
  }
  .frame-num {
    font-size: 0.50rem;
    padding: 0;
  }
  .frame-rolls {
    height: 15px;
    line-height: 15px;
    font-size: 0.62rem;
  }
  .frame-total {
    height: 14px;
    line-height: 14px;
    font-size: 0.58rem;
  }
  .total-summary {
    min-width: 38px;
    padding: 0 3px;
    border-right: none;
  }
  .total-summary .lbl {
    font-size: 0.48rem;
  }
  .total-summary .val {
    font-size: 0.96rem;
  }
  .total-summary .style-val {
    font-size: 0.52rem;
  }
  #utility-cluster {
    width: 100%;
    justify-content: center;
    gap: 5px;
    padding-top: 2px;
    border-top: 1px solid rgba(254, 240, 138, 0.2);
  }
  .hud-btn.marquee-pill {
    padding: 3px 8px;
    font-size: 0.66rem;
  }
  #jumbotron-banner {
    top: 122px;
    width: min(390px, 94vw);
    padding: 8px 12px;
  }
  .jumbo-title {
    font-size: 1.1rem;
  }
  .jumbo-subtitle {
    font-size: 0.74rem;
  }
  #status-toast {
    top: 122px;
    right: 8px;
    left: 8px;
    max-width: none;
    text-align: center;
  }
  #bottom-hud {
    gap: 4px;
    padding: 0 6px calc(8px + env(safe-area-inset-bottom));
  }
  .bottom-glass-dock {
    gap: 5px;
    padding: 3px 6px;
    max-height: 44px;
  }
  .ball-label {
    display: none;
  }
  .ball-chip {
    padding: 0 7px;
    height: 28px;
  }
  .hook-pip {
    height: 24px;
    padding: 0 6px;
    font-size: 0.66rem;
  }
  .bowl-cta {
    height: 28px;
    padding: 0 10px !important;
    font-size: 0.70rem !important;
  }
  .coach-tip-pill {
    font-size: 0.64rem;
    padding: 4px 10px;
    max-width: 96vw;
    white-space: normal;
    line-height: 1.2;
  }
  #lobby-modal {
    padding: 8px;
    align-items: flex-start;
  }
  .lobby-card {
    max-height: 92dvh;
    overflow-y: auto;
    padding: 12px;
    border-radius: 16px;
  }
  .hero-banner-box {
    height: 106px;
    max-height: 110px;
    margin-bottom: 10px;
  }
  .hero-overlay-copy {
    padding: 8px 12px;
  }
  .arcade-title {
    font-size: 1.25rem;
  }
  .arcade-sub {
    font-size: 0.72rem;
  }
  .lobby-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .bowler-cards {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }
  .bowler-option {
    padding: 7px 6px;
  }
  .bowler-option .b-name {
    font-size: 0.76rem;
    margin: 2px 0 0;
  }
  .bowler-option .b-desc {
    display: none;
  }
  .settings-box {
    padding: 8px 10px;
    gap: 7px;
  }
  .setting-row {
    font-size: 0.74rem;
  }
  .pill-opt {
    font-size: 0.68rem;
    padding: 3px 8px;
  }
  .device-detect-card {
    margin-top: 8px;
    padding: 7px 10px;
    font-size: 0.70rem;
    gap: 6px;
  }
  .lobby-actions {
    margin-top: 10px;
    gap: 6px;
  }
  .btn-play-big {
    padding: 11px 16px;
    font-size: 0.94rem;
    min-width: 100%;
  }
  .btn-secondary-story {
    padding: 8px 12px;
    font-size: 0.74rem;
  }
}
