:root {
  --bg-deep: #07080d;
  --bg-panel: #10131f;
  --bg-card: rgba(18, 22, 36, 0.92);
  --border-subtle: rgba(255, 255, 255, 0.12);
  --border-glow: rgba(0, 240, 255, 0.45);
  --text-main: #f4f7ff;
  --text-muted: #9aa5c4;
  --accent-cyan: #00f0ff;
  --accent-purple: #9d4edd;
  --accent-red: #ff2a5f;
  --accent-orange: #ff7b00;
  --accent-gold: #ffd166;
  --accent-green: #06d6a0;
  --stripe-1: rgba(255, 42, 95, 0.22);
  --stripe-2: rgba(255, 183, 3, 0.12);
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: 'Space Grotesk', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Safe interpolation token fallback for pre-2024 browsers */
  --in-oklab: ;
  --in-oklch: ;
}

@supports (background: linear-gradient(in oklab, white, black)) {
  :root {
    --in-oklab: in oklab;
    --in-oklch: in oklch;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg-deep);
  background-image:
    radial-gradient(circle at 18% 15%, rgba(0, 240, 255, 0.1), transparent 40%),
    radial-gradient(circle at 82% 80%, rgba(157, 78, 221, 0.12), transparent 45%),
    linear-gradient(to bottom var(--in-oklab), #07080d, #0d101b);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.5;
  text-align: start;
  overflow-x: hidden;
}

/* Modern Web Guidance: targeted text-wrap rules (never on *) */
h1,
h2,
h3 {
  margin: 0;
  font-family: var(--font-display);
  line-height: 1.2;
  text-wrap: balance;
}

p,
li {
  margin: 0;
  max-width: 80ch;
  text-wrap: pretty;
  overflow-wrap: break-word;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.hidden {
  display: none !important;
}

/* Live Meme News Ticker */
.news-ticker {
  display: flex;
  align-items: center;
  background: linear-gradient(to right var(--in-oklab), #13091c, #0b1629);
  border-bottom: 1px solid var(--border-subtle);
  height: 2.15rem;
  overflow: hidden;
  font-size: 0.8125rem;
}

.ticker-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0 0.75rem;
  height: 100%;
  background: linear-gradient(to right var(--in-oklch), var(--accent-red), var(--accent-orange));
  color: #fff;
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  white-space: nowrap;
  z-index: 2;
}

.pulse-dot {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 8px #fff;
  animation: pulseDot 1.1s infinite alternate;
}

@keyframes pulseDot {
  from { opacity: 0.35; transform: scale(0.85); }
  to { opacity: 1; transform: scale(1.15); }
}

.ticker-track-wrap {
  flex: 1;
  overflow: hidden;
  position: relative;
}

.ticker-track {
  display: inline-flex;
  gap: 3.5rem;
  white-space: nowrap;
  padding-left: 100%;
  animation: tickerSlide 85s linear infinite;
}

.ticker-track:hover {
  animation-play-state: paused;
}

@keyframes tickerSlide {
  0% { transform: translateX(0); }
  100% { transform: translateX(-100%); }
}

/* Top Site Header */
.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  padding: 0.65rem 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(10, 12, 20, 0.82);
  backdrop-filter: blur(12px);
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.brand-logo {
  text-decoration: none;
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 1rem + 0.8vw, 1.6rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-main);
  filter: drop-shadow(0 2px 10px rgba(0, 240, 255, 0.25));
}

.brand-tera {
  color: #ffffff;
}

.brand-si {
  background: linear-gradient(to right var(--in-oklch), var(--accent-cyan), var(--accent-purple));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.brand-tag {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  background: rgba(0, 240, 255, 0.09);
  border: 1px solid rgba(0, 240, 255, 0.28);
  color: var(--accent-cyan);
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.hud-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.42rem 0.75rem;
  border-radius: 0.5rem;
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.hud-btn:hover {
  border-color: var(--accent-cyan);
  background: rgba(0, 240, 255, 0.12);
  transform: translateY(-1px);
}

.spectra-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.42rem 0.85rem;
  border-radius: 999px;
  text-decoration: none;
  font-size: 0.78rem;
  color: #fff;
  background: linear-gradient(to right var(--in-oklch), #5a189a, #0077b6);
  border: 1px solid rgba(0, 240, 255, 0.4);
  box-shadow: 0 4px 16px rgba(0, 240, 255, 0.18);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.spectra-pill:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 22px rgba(0, 240, 255, 0.35);
}

/* Main Arcade Grid */
.arcade-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 22rem;
  gap: 1.25rem;
  max-width: 92rem;
  margin: 0 auto;
  padding: 1rem 1.25rem 2rem;
  align-items: start;
}

@media (max-width: 1120px) {
  .arcade-layout {
    grid-template-columns: 1fr;
  }
}

/* Game Stage & Canvas */
.game-stage-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.canvas-container {
  position: relative;
  width: 100%;
  aspect-ratio: 960 / 580;
  background: #05060a;
  border-radius: 1rem;
  border: 1px solid rgba(0, 240, 255, 0.3);
  box-shadow:
    0 18px 45px rgba(0, 0, 0, 0.65),
    0 0 32px rgba(0, 240, 255, 0.12);
  overflow: hidden;
  isolation: isolate;
}

#gameCanvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: pointer;
  touch-action: manipulation;
}

/* Live In-Game Top HUD */
.live-hud {
  position: absolute;
  top: 0.65rem;
  left: 0.75rem;
  right: 0.75rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  pointer-events: none;
  z-index: 4;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.hud-stat-group {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  background: rgba(8, 10, 18, 0.78);
  backdrop-filter: blur(8px);
  padding: 0.4rem 0.75rem;
  border-radius: 0.75rem;
  border: 1px solid var(--border-subtle);
}

.hud-stat {
  display: flex;
  flex-direction: column;
  min-width: 3.8rem;
}

.hud-label {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

.hud-value {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.15;
}

.hud-best {
  color: var(--accent-gold);
}

.psi-bar-wrap {
  width: 4.8rem;
  height: 0.48rem;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 0.25rem;
}

.psi-bar {
  height: 100%;
  width: 100%;
  background: linear-gradient(to right var(--in-oklch), var(--accent-cyan), var(--accent-green));
  transition: width 0.1s linear;
}

.hud-active-badges {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.3rem;
}

.status-badge {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 800;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  letter-spacing: 0.02em;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.5));
  animation: badgePop 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

@keyframes badgePop {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.shield-badge {
  background: rgba(0, 240, 255, 0.2);
  border: 1px solid var(--accent-cyan);
  color: var(--accent-cyan);
}

.overdrive-badge {
  background: rgba(255, 42, 95, 0.25);
  border: 1px solid var(--accent-red);
  color: #ff9ebb;
}

.inverted-badge {
  background: rgba(255, 209, 102, 0.22);
  border: 1px solid var(--accent-gold);
  color: var(--accent-gold);
}

/* Live Bottom Meme Overlays (X-Tweet Card & Sweating Insurance Agent Cam) */
.live-meme-widgets {
  position: absolute;
  bottom: 0.65rem;
  left: 0.75rem;
  right: 0.75rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 0.75rem;
  pointer-events: none;
  z-index: 4;
}

.x-live-card {
  max-width: 19.5rem;
  background: rgba(5, 7, 14, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 0.75rem;
  padding: 0.5rem 0.7rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.x-live-card.tweet-pop {
  transform: translateY(-4px) scale(1.02);
  border-color: var(--accent-cyan);
}

.x-card-header {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.22rem;
}

.x-avatar {
  width: 1.65rem;
  height: 1.65rem;
  border-radius: 50%;
  background: rgba(0, 240, 255, 0.16);
  border: 1px solid rgba(0, 240, 255, 0.4);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
}

.x-user-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.x-name {
  font-size: 0.75rem;
  font-weight: 800;
  color: #fff;
}

.x-verified {
  display: inline-block;
  background: #1d9bf0;
  color: #fff;
  font-size: 0.6rem;
  padding: 0.02rem 0.25rem;
  border-radius: 999px;
}

.x-handle {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  color: var(--text-muted);
}

.x-tweet-body {
  font-size: 0.78rem;
  color: #e2e8f0;
  line-height: 1.3;
}

/* Sweating Car Insurance Agent Panic Cam */
.insurer-cam-card {
  width: 17.5rem;
  background: rgba(14, 8, 18, 0.88);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 42, 95, 0.45);
  border-radius: 0.75rem;
  padding: 0.45rem 0.65rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  transition: transform 0.15s ease;
}

.insurer-cam-card.panic-shake {
  animation: camPanic 0.28s ease-in-out;
  border-color: var(--accent-gold);
}

@keyframes camPanic {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px) rotate(-1deg); }
  75% { transform: translateX(4px) rotate(1deg); }
}

.cam-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 0.22rem;
  margin-bottom: 0.3rem;
  font-family: var(--font-mono);
  font-size: 0.625rem;
  font-weight: 800;
}

.cam-rec-dot {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: var(--accent-red);
  box-shadow: 0 0 6px var(--accent-red);
  animation: pulseDot 0.7s infinite alternate;
}

.cam-title {
  color: #ffb3c6;
  flex: 1;
}

.cam-bpm {
  color: var(--accent-gold);
}

.cam-body {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.insurer-face {
  font-size: 2rem;
  line-height: 1;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.5));
}

.insurer-stats {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  min-width: 0;
}

.insurer-premium {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--accent-red);
}

.insurer-quote {
  font-size: 0.7rem;
  color: #f8fafc;
  font-style: italic;
  line-height: 1.25;
}

/* Overlay Screens (Start & Game Over) */
.overlay-screen {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.85rem;
  background: rgba(6, 8, 15, 0.86);
  backdrop-filter: blur(10px);
  z-index: 10;
  overflow-y: auto;
}

.overlay-card {
  width: 100%;
  max-width: 41rem;
  background: var(--bg-card);
  border: 1px solid rgba(0, 240, 255, 0.32);
  border-radius: 1rem;
  padding: 1.15rem 1.35rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.75);
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  text-align: center;
  align-items: center;
  margin: auto;
}

.meme-kicker {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--accent-gold);
  background: rgba(255, 209, 102, 0.12);
  border: 1px solid rgba(255, 209, 102, 0.35);
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
}

.hero-title {
  font-size: clamp(1.3rem, 1rem + 1.8vw, 2.15rem);
  letter-spacing: -0.02em;
}

.accent-gradient {
  background: linear-gradient(to right var(--in-oklch), var(--accent-cyan), var(--accent-gold), var(--accent-red));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-subtitle {
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* Skin Selector Grid */
.skin-selector-section {
  width: 100%;
}

.selector-title {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--accent-cyan);
  margin-bottom: 0.35rem;
  letter-spacing: 0.06em;
}

.skin-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.45rem;
}

.skin-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  padding: 0.48rem 0.35rem;
  border-radius: 0.65rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.15s ease;
}

.skin-card:hover {
  background: rgba(0, 240, 255, 0.08);
  border-color: rgba(0, 240, 255, 0.4);
}

.skin-card.active {
  background: rgba(0, 240, 255, 0.15);
  border-color: var(--accent-cyan);
  box-shadow: 0 0 16px rgba(0, 240, 255, 0.25);
}

.skin-emoji {
  font-size: 1.25rem;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.4));
}

.skin-name {
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 700;
}

.skin-desc {
  font-size: 0.65rem;
  color: var(--text-muted);
}

.controls-preview {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem;
}

.control-pill {
  font-size: 0.74rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04);
  padding: 0.25rem 0.55rem;
  border-radius: 0.45rem;
  border: 1px solid var(--border-subtle);
}

kbd {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.08rem 0.32rem;
  border-radius: 0.25rem;
  background: rgba(0, 240, 255, 0.15);
  color: var(--accent-cyan);
  border: 1px solid rgba(0, 240, 255, 0.35);
}

.cta-row {
  width: 100%;
  display: flex;
  justify-content: center;
}

.primary-play-btn {
  padding: 0.68rem 1.4rem;
  border-radius: 0.65rem;
  border: none;
  background: linear-gradient(to right var(--in-oklch), var(--accent-red), var(--accent-orange));
  color: #fff;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(255, 42, 95, 0.4);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.primary-play-btn:hover {
  transform: translateY(-2px) scale(1.01);
  box-shadow: 0 12px 30px rgba(255, 42, 95, 0.6);
}

/* Game Over Card Specifics */
.gameover-card {
  gap: 0.48rem;
  padding: 0.9rem 1.15rem;
}

/* Modern Web Guidance visual-effects: diagonal hazard stripe gradient pattern */
.crash-alert-banner {
  width: 100%;
  padding: 0.25rem 0.6rem;
  border-radius: 0.45rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--accent-gold);
  border: 1px solid rgba(255, 42, 95, 0.45);
  background: repeating-linear-gradient(
    -45deg,
    var(--stripe-1) 0 1em,
    var(--stripe-2) 0 2em
  );
}

.gameover-title {
  font-size: clamp(1.15rem, 0.95rem + 1.2vw, 1.6rem);
  color: #fff;
}

.crash-reason-text {
  font-size: 0.8rem;
  color: #ffd6e0;
}

/* Parody X Community Note Box */
.community-note-box {
  width: 100%;
  text-align: start;
  background: rgba(29, 155, 240, 0.09);
  border: 1px solid rgba(29, 155, 240, 0.38);
  border-radius: 0.6rem;
  padding: 0.5rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.cn-header {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  color: #e2e8f0;
}

.cn-icon {
  font-size: 0.9rem;
}

.cn-body {
  font-size: 0.74rem;
  color: #cbd5e1;
  line-height: 1.32;
}

.cn-body a {
  color: var(--accent-cyan);
  font-weight: 700;
}

.cn-footer {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  color: var(--text-muted);
}

.score-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.4rem;
  width: 100%;
}

.score-box {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: 0.5rem;
  padding: 0.32rem 0.4rem;
  display: flex;
  flex-direction: column;
}

.score-box-label {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--text-muted);
}

.score-box-val {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 800;
  color: #fff;
}

.accent-gold {
  color: var(--accent-gold);
}

.rank-text {
  font-size: 0.75rem;
  color: var(--accent-cyan);
  margin-top: 0.12rem;
}

.save-score-form {
  display: flex;
  gap: 0.45rem;
  width: 100%;
  max-width: 25rem;
}

.save-score-form input {
  flex: 1;
  padding: 0.38rem 0.65rem;
  border-radius: 0.45rem;
  border: 1px solid var(--border-subtle);
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  min-width: 0;
}

.save-score-form input:focus {
  outline: 2px solid var(--accent-cyan);
  border-color: transparent;
}

.save-score-btn {
  padding: 0.38rem 0.75rem;
  border-radius: 0.45rem;
  border: 1px solid var(--accent-cyan);
  background: rgba(0, 240, 255, 0.16);
  color: var(--accent-cyan);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}

.save-score-btn:hover {
  background: rgba(0, 240, 255, 0.28);
}

/* Spectra Pitch Box inside Game Over */
.spectra-pitch-box {
  width: 100%;
  text-align: start;
  background: linear-gradient(to right var(--in-oklab), rgba(90, 24, 154, 0.28), rgba(0, 119, 182, 0.24));
  border: 1px solid rgba(0, 240, 255, 0.35);
  border-radius: 0.65rem;
  padding: 0.5rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
}

.pitch-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.pitch-badge {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 800;
  color: var(--accent-cyan);
}

.pitch-metric {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 800;
  color: var(--accent-green);
}

.pitch-copy {
  font-size: 0.74rem;
  color: #e2e8f0;
  line-height: 1.32;
}

.pitch-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.pitch-link-primary {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--accent-gold);
  text-decoration: none;
}

.pitch-link-primary:hover {
  text-decoration: underline;
}

.pitch-link-secondary {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--accent-cyan);
  text-decoration: none;
}

.pitch-link-secondary:hover {
  text-decoration: underline;
}

.gameover-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.45rem;
  width: 100%;
}

.share-x-btn,
.download-card-btn {
  padding: 0.58rem 0.85rem;
  border-radius: 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}

.share-x-btn {
  background: #ffffff;
  color: #000000;
  border: none;
}

.share-x-btn:hover {
  background: #e2e8f0;
  transform: translateY(-2px);
}

.download-card-btn {
  background: rgba(0, 240, 255, 0.14);
  color: var(--accent-cyan);
  border: 1px solid rgba(0, 240, 255, 0.4);
}

.download-card-btn:hover {
  background: rgba(0, 240, 255, 0.25);
  transform: translateY(-2px);
}

/* Mobile Touch Bar: Only shown on touch/coarse or mobile viewports */
.mobile-touch-bar {
  display: none;
  grid-template-columns: 1.6fr 1fr;
  gap: 0.55rem;
}

.touch-btn {
  padding: 0.8rem 0.75rem;
  border-radius: 0.75rem;
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 800;
  cursor: pointer;
  border: 1px solid var(--border-subtle);
  user-select: none;
  touch-action: manipulation;
}

.thrust-touch {
  background: linear-gradient(to right var(--in-oklch), #0077b6, #00b4d8);
  color: #fff;
  border-color: rgba(0, 240, 255, 0.5);
}

.flip-touch {
  background: rgba(255, 209, 102, 0.14);
  color: var(--accent-gold);
  border-color: rgba(255, 209, 102, 0.45);
}

/* Right Sidebar */
.arcade-sidebar {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.sidebar-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: 0.9rem;
  padding: 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.card-title {
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}

.live-pill {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: rgba(6, 214, 160, 0.15);
  color: var(--accent-green);
  border: 1px solid rgba(6, 214, 160, 0.35);
}

.leaderboard-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.leaderboard-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.42rem 0.65rem;
  border-radius: 0.5rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

.leaderboard-item.is-player {
  background: rgba(0, 240, 255, 0.12);
  border-color: rgba(0, 240, 255, 0.4);
}

.lb-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.lb-rank {
  color: var(--accent-gold);
  font-weight: 800;
  min-width: 1.4rem;
}

.lb-name {
  font-weight: 700;
  color: var(--text-main);
}

.lb-score {
  font-weight: 800;
  color: var(--accent-cyan);
}

.lore-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.lore-list li {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
}

.lore-list strong {
  color: var(--text-main);
}

.lore-icon {
  font-size: 1.05rem;
  line-height: 1.2;
}

/* Spectra Mini Telemetry Card */
.spectra-mini-card {
  background: linear-gradient(to bottom var(--in-oklab), #141129, #0c1626);
  border-color: rgba(157, 78, 221, 0.4);
}

.mini-link {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--accent-cyan);
  text-decoration: none;
}

.mini-link:hover {
  text-decoration: underline;
}

.mini-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.telemetry-bars {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.telemetry-row {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.telemetry-meta {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.72rem;
}

.bad-text { color: var(--accent-red); }
.warn-text { color: var(--accent-gold); }
.good-text { color: var(--accent-green); font-weight: 700; }

.bar-track {
  width: 100%;
  height: 0.45rem;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 999px;
}

.fill-danger { background: var(--accent-red); }
.fill-warn { background: var(--accent-gold); }
.fill-good { background: linear-gradient(to right var(--in-oklch), var(--accent-cyan), var(--accent-green)); }

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 100;
}

.toast {
  background: rgba(14, 18, 32, 0.95);
  border: 1px solid var(--accent-cyan);
  color: #fff;
  padding: 0.65rem 1rem;
  border-radius: 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  animation: badgePop 0.25s ease;
}

/* ==========================================
   MOBILE & TABLET RESPONSIVE OPTIMIZATIONS
   ========================================== */
@media (hover: none), (pointer: coarse), (max-width: 820px) {
  .mobile-touch-bar {
    display: grid;
  }
}

@media (max-width: 768px) {
  .arcade-layout {
    padding: 0.65rem 0.65rem 1.5rem;
    gap: 0.85rem;
  }

  .site-header {
    padding: 0.55rem 0.75rem;
    gap: 0.45rem;
  }

  .brand-tag {
    display: none;
  }

  .btn-label {
    display: none;
  }

  .spectra-pill {
    font-size: 0.7rem;
    padding: 0.35rem 0.65rem;
  }

  /* Give the game stage a tall, phone-friendly height instead of squishing to 16:9 */
  .canvas-container {
    aspect-ratio: auto;
    height: clamp(27rem, 68dvh, 35rem);
    border-radius: 0.85rem;
  }

  .live-hud {
    top: 0.45rem;
    left: 0.5rem;
    right: 0.5rem;
  }

  .hud-stat-group {
    padding: 0.3rem 0.55rem;
    gap: 0.5rem;
  }

  /* Hide rocket boost bar on narrow mobile so HUD stays compact */
  .hud-stat:nth-child(3) {
    display: none;
  }

  .hud-value {
    font-size: 1.05rem;
  }

  .status-badge {
    font-size: 0.62rem;
    padding: 0.2rem 0.48rem;
  }

  /* Hide live X card on mobile & shrink Insurance Cam so it never blocks gameplay */
  .x-live-card {
    display: none;
  }

  .live-meme-widgets {
    bottom: 0.45rem;
    left: 0.5rem;
    right: 0.5rem;
    justify-content: flex-end;
  }

  .insurer-cam-card {
    width: 13.5rem;
    padding: 0.32rem 0.5rem;
  }

  .insurer-face {
    font-size: 1.5rem;
  }

  .insurer-premium {
    font-size: 0.68rem;
  }

  .insurer-quote {
    font-size: 0.62rem;
  }

  /* Compact Start & Game Over cards on mobile so everything fits cleanly */
  .overlay-screen {
    padding: 0.5rem;
    align-items: flex-start;
  }

  .overlay-card {
    padding: 0.85rem 0.85rem;
    gap: 0.5rem;
  }

  .skin-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.38rem;
  }

  .skin-card {
    padding: 0.4rem 0.3rem;
  }

  .skin-desc {
    display: none;
  }

  .controls-preview {
    display: none;
  }

  .score-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.35rem;
  }

  .primary-play-btn,
  .share-x-btn,
  .download-card-btn {
    width: 100%;
    justify-content: center;
  }
}
