:root {
  --bg: #080d17;
  --panel: rgba(13, 20, 34, 0.78);
  --panel-border: rgba(148, 163, 184, 0.18);
  --panel-hover: rgba(30, 41, 59, 0.85);
  --text: #f1f5f9;
  --muted: #94a3b8;
  --cyan: #22d3ee;
  --emerald: #34d399;
  --purple: #c084fc;
  --red: #f87171;
  --amber: #fbbf24;
  --radius: 14px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

#viewport {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
}

#viewport canvas {
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
  cursor: grab;
  touch-action: none;
}

#viewport canvas.grabbing {
  cursor: grabbing;
}

/* Loading Overlay */
#loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 45%, #111b2e 0%, #070b13 100%);
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

#loading-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loading-card {
  width: min(380px, calc(100vw - 32px));
  padding: 28px 26px;
  border-radius: 18px;
  background: rgba(15, 23, 42, 0.88);
  border: 1px solid rgba(56, 189, 248, 0.28);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.65);
  text-align: center;
}

.loading-spinner {
  width: 38px;
  height: 38px;
  margin: 0 auto 14px;
  border-radius: 50%;
  border: 3px solid rgba(34, 211, 238, 0.18);
  border-top-color: var(--cyan);
  animation: spin 0.85s linear infinite;
}

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

.loading-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-bottom: 6px;
}

.loading-status {
  font-size: 12px;
  color: var(--muted);
  font-family: var(--font-mono);
  margin-bottom: 14px;
}

.loading-bar-track {
  height: 6px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.16);
  overflow: hidden;
  margin-bottom: 12px;
}

.loading-bar-fill {
  height: 100%;
  width: 6%;
  border-radius: 999px;
  background: linear-gradient(90deg, #06b6d4, #a855f7);
  transition: width 0.12s ease;
}

.loading-note {
  font-size: 10.5px;
  color: #64748b;
  letter-spacing: 0.02em;
}

/* Top HUD */
.hud-top {
  position: fixed;
  top: 14px;
  left: 16px;
  right: 16px;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  pointer-events: none;
}

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

.brand-pill {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 15px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot.live {
  background: var(--emerald);
  box-shadow: 0 0 10px var(--emerald);
  animation: pulse 2s ease-in-out infinite;
}

.status-dot.connecting {
  background: var(--amber);
  box-shadow: 0 0 8px var(--amber);
}

.status-dot.error {
  background: var(--red);
  box-shadow: 0 0 8px var(--red);
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.55; transform: scale(0.85); }
}

.brand-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.07em;
  color: #f8fafc;
}

.wasm-tag {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: #052e16;
  background: var(--emerald);
  padding: 1.5px 6px;
  border-radius: 999px;
}

.brand-sub {
  font-size: 11px;
  color: var(--muted);
  font-family: var(--font-mono);
  margin-top: 2px;
}

.sep {
  margin: 0 5px;
  opacity: 0.45;
}

.hero-header {
  flex: 1;
  min-width: 0;
  margin: 0;
  padding: 0 12px 0 2px;
  text-align: left;
  font-size: clamp(15px, 1.55vw, 20px);
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.2;
  color: #f8fafc;
  text-shadow: 0 2px 14px rgba(2, 6, 23, 0.85), 0 0 24px rgba(34, 211, 238, 0.22);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

.stats-strip {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.stat-card {
  min-width: 100px;
  padding: 7px 13px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
}

.stat-card.accent-cyan {
  border-color: rgba(34, 211, 238, 0.32);
}

.stat-card.accent-purple {
  border-color: rgba(192, 132, 252, 0.32);
}

.stat-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.09em;
  color: var(--muted);
}

.stat-value-row {
  display: flex;
  align-items: baseline;
  gap: 7px;
  margin-top: 1px;
}

.stat-value {
  font-size: 22px;
  font-weight: 800;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.stat-card.accent-cyan .stat-value {
  color: var(--cyan);
}

.stat-card.accent-purple .stat-value {
  color: var(--purple);
}

.stat-sub {
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.icon-pill {
  padding: 9px 14px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(14px);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.icon-pill:hover {
  background: var(--panel-hover);
  border-color: rgba(34, 211, 238, 0.45);
}

/* Auto-hiding Audio Unlock Pill (only shown while browser blocks autoplay) */
.audio-unlock-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  align-self: center;
  padding: 9px 14px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(14, 116, 144, 0.86), rgba(30, 41, 59, 0.90));
  border: 1px solid rgba(34, 211, 238, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: #ecfeff;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 0 0 0 rgba(34, 211, 238, 0.45), 0 8px 26px rgba(0, 0, 0, 0.4);
  animation: audio-pill-pulse 2.2s ease-in-out infinite;
  transition: transform 0.12s ease, background 0.15s ease, border-color 0.15s ease;
}

.audio-unlock-pill:hover {
  background: linear-gradient(135deg, rgba(8, 145, 178, 0.92), rgba(30, 41, 59, 0.94));
  border-color: #67e8f9;
}

.audio-unlock-pill:active {
  transform: scale(0.96);
}

.audio-unlock-pill.hidden {
  display: none !important;
}

@keyframes audio-pill-pulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(34, 211, 238, 0.42), 0 8px 26px rgba(0, 0, 0, 0.4);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(34, 211, 238, 0.0), 0 8px 26px rgba(0, 0, 0, 0.4);
  }
}

/* Dynamic Event Banner */
.event-banner {
  position: fixed;
  top: 78px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 25;
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  font-family: var(--font-mono);
  backdrop-filter: blur(12px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
  white-space: nowrap;
}

.event-banner.hidden {
  opacity: 0;
  transform: translate(-50%, -8px);
}

.event-banner.hit {
  background: rgba(126, 34, 206, 0.88);
  border: 1px solid rgba(216, 180, 254, 0.75);
  color: #faf5ff;
  box-shadow: 0 0 28px rgba(168, 85, 247, 0.6);
}

.event-banner.blind {
  background: rgba(185, 28, 28, 0.88);
  border: 1px solid rgba(252, 165, 165, 0.75);
  color: #fef2f2;
  box-shadow: 0 0 24px rgba(239, 68, 68, 0.55);
}

.event-banner.done {
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(34, 211, 238, 0.65);
  color: #cffafe;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}

/* Left Control Dock */
.control-dock {
  position: fixed;
  top: 76px;
  left: 16px;
  max-height: calc(100vh - 134px);
  width: 256px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border-radius: 16px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.45);
  overflow-y: auto;
}

.control-dock.collapsed {
  transform: translateX(-290px);
  opacity: 0;
  pointer-events: none;
}

.control-dock::-webkit-scrollbar {
  width: 5px;
}

.control-dock::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.25);
  border-radius: 999px;
}

.dock-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

.dock-section:last-child {
  padding-bottom: 0;
  border-bottom: none;
}

.dock-links {
  flex-direction: row;
  gap: 6px;
}

.social-link {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 9px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  background: rgba(15, 23, 42, 0.52);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  text-decoration: none;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.social-link:hover {
  color: var(--text);
  border-color: rgba(34, 211, 238, 0.45);
  background: rgba(34, 211, 238, 0.10);
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.mass-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--purple);
  background: rgba(192, 132, 252, 0.14);
  padding: 2px 7px;
  border-radius: 999px;
}

.preset-grid,
.row-2,
.throw-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.cam-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 9px;
  border-radius: 9px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(30, 41, 59, 0.62);
  color: var(--text);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  transition: background 0.13s, border-color 0.13s, transform 0.08s;
}

.btn:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

.btn:hover {
  background: rgba(51, 65, 85, 0.78);
  border-color: rgba(148, 163, 184, 0.42);
}

.btn:active {
  transform: scale(0.97);
}

.btn.primary {
  background: rgba(8, 145, 178, 0.34);
  border-color: rgba(34, 211, 238, 0.48);
  color: #e0f2fe;
}

.btn.primary:hover {
  background: rgba(8, 145, 178, 0.52);
}

.btn.active {
  background: rgba(6, 182, 212, 0.25);
  border-color: var(--cyan);
  color: #ecfeff;
}

.preset-btn {
  font-size: 11px;
  padding: 7px 6px;
}

.cam-btn {
  font-size: 10.5px;
  padding: 6px 4px;
}

.throw-btn {
  font-size: 11px;
}

.throw-btn:hover {
  border-color: rgba(192, 132, 252, 0.6);
  background: rgba(126, 34, 206, 0.32);
}

.hurl-btn {
  width: 100%;
  padding: 9px 12px;
  background: linear-gradient(135deg, rgba(147, 51, 234, 0.78), rgba(99, 102, 241, 0.78));
  border-color: rgba(216, 180, 254, 0.55);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 4px 18px rgba(147, 51, 234, 0.35);
}

.hurl-btn:hover {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.92), rgba(129, 140, 248, 0.92));
  border-color: rgba(233, 213, 255, 0.85);
}

.danger-toggle {
  width: 100%;
  justify-content: space-between;
  padding: 8px 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.danger-toggle .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #64748b;
  flex-shrink: 0;
}

.danger-toggle.on {
  background: rgba(185, 28, 28, 0.55);
  border-color: rgba(248, 113, 113, 0.85);
  color: #fee2e2;
  box-shadow: 0 0 18px rgba(239, 68, 68, 0.35);
}

.danger-toggle.on .dot {
  background: var(--red);
  box-shadow: 0 0 8px var(--red);
}

/* Speed & Sound Controls */
.speed-row,
.sound-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sound-btn {
  flex-shrink: 0;
  padding: 5px 8px;
  font-size: 11px;
}

.sound-row input[type="range"] {
  flex: 1;
}

.mini-label {
  font-size: 11.5px;
  color: var(--muted);
}

.segmented {
  display: flex;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 8px;
  padding: 2px;
  gap: 2px;
}

.seg-btn {
  padding: 4px 9px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-mono);
  cursor: pointer;
}

.seg-btn.active {
  background: rgba(34, 211, 238, 0.22);
  color: var(--cyan);
}

/* Range Slider */
input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.22);
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--purple);
  border: 2px solid #f5f3ff;
  box-shadow: 0 0 10px rgba(192, 132, 252, 0.7);
}

/* Toggle Switch */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  color: #cbd5e1;
  cursor: pointer;
  padding: 1px 0;
}

.toggle-row input {
  display: none;
}

.switch {
  position: relative;
  width: 34px;
  height: 19px;
  border-radius: 999px;
  background: rgba(71, 85, 105, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.25);
  flex-shrink: 0;
  transition: background 0.18s;
}

.switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #e2e8f0;
  transition: transform 0.18s;
}

.toggle-row input:checked + .switch {
  background: rgba(6, 182, 212, 0.7);
  border-color: var(--cyan);
}

.toggle-row input:checked + .switch::after {
  transform: translateX(15px);
}

kbd {
  display: inline-block;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(148, 163, 184, 0.28);
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  color: #cbd5e1;
}

/* Stereo Eyes Picture-in-Picture */
.stereo-pip {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 20;
  width: 332px;
  border-radius: 14px;
  background: var(--panel);
  border: 1px solid rgba(34, 211, 238, 0.28);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

.pip-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 11px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.14);
  white-space: nowrap;
}

.pip-title {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--cyan);
}

.pip-meta {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--muted);
}

.pip-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 1;
  background: #020617;
  overflow: hidden;
}

#stereo-canvas {
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: auto;
}

.pip-divider {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 1px;
  background: rgba(34, 211, 238, 0.45);
  pointer-events: none;
}

.eye-tag {
  position: absolute;
  bottom: 6px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(2, 6, 23, 0.72);
  font-size: 9px;
  font-weight: 700;
  font-family: var(--font-mono);
  letter-spacing: 0.06em;
  color: #e2e8f0;
  pointer-events: none;
}

.eye-tag.left { left: 7px; }
.eye-tag.right { right: 7px; }

.pip-blind-mask {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(127, 29, 29, 0.62);
  border: 2px solid rgba(248, 113, 113, 0.85);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #fee2e2;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
}

.pip-blind-mask.hidden {
  display: none;
}

/* Bottom-Left Shortcut Bar */
.shortcut-bar {
  position: fixed;
  left: 16px;
  bottom: 14px;
  z-index: 15;
  padding: 6px 12px;
  border-radius: 10px;
  background: rgba(13, 20, 34, 0.64);
  border: 1px solid rgba(148, 163, 184, 0.14);
  backdrop-filter: blur(10px);
  font-size: 11px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 2px;
}

/* Desktop hides mobile-only controls chrome */
.hud-brand-row {
  display: contents;
}

.dock-mobile-header,
.mobile-bar,
.mobile-top-links {
  display: none;
}

.dock-mobile-title {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--cyan);
}

.dock-close-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(30, 41, 59, 0.65);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.stereo-pip.mobile-hidden {
  display: none;
}

@media (max-width: 960px) {
  .stats-strip { gap: 5px; }
  .stat-card { min-width: 78px; padding: 6px 9px; }
  .stat-value { font-size: 17px; }
  .stereo-pip { width: 256px; }
  .shortcut-bar { display: none; }
}

@media (pointer: coarse) {
  kbd { display: none; }
  input[type="range"] { height: 8px; }
  input[type="range"]::-webkit-slider-thumb { width: 22px; height: 22px; }
}

/* Mobile Portrait & Compact Touch Screens */
@media (max-width: 768px), (max-height: 520px) {
  kbd { display: none; }
  .shortcut-bar { display: none; }

  .hud-top {
    top: max(8px, env(safe-area-inset-top));
    left: max(10px, env(safe-area-inset-left));
    right: max(10px, env(safe-area-inset-right));
    flex-direction: column;
    gap: 6px;
    align-items: stretch;
  }

  .mobile-top-links {
    order: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-shrink: 0;
  }

  .top-social-link {
    flex: 0 0 auto;
    padding: 5px 10px;
    min-height: 29px;
    border-radius: 11px;
    background: var(--panel);
    border: 1px solid var(--panel-border);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    color: var(--text);
    font-size: 11px;
    font-weight: 600;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
  }

  .hero-header {
    order: 2;
    flex: none;
    padding: 9px 4px 7px;
    text-align: center;
    font-size: 14.5px;
    font-weight: 800;
    letter-spacing: -0.005em;
    white-space: normal;
  }

  .stats-strip {
    order: 3;
    flex: none;
    justify-content: center;
    gap: 6px;
    min-width: 0;
  }

  .stat-card {
    flex: 0 0 auto;
    min-width: 128px;
    max-width: none;
    padding: 6px 14px;
    border-radius: 12px;
  }

  .audio-unlock-pill {
    padding: 7px 12px;
    border-radius: 12px;
    font-size: 11.5px;
    min-height: 38px;
  }

  .stat-label { font-size: 8.5px; letter-spacing: 0.07em; }
  .stat-value-row { gap: 4px; flex-wrap: nowrap; }
  .stat-value { font-size: 16px; }
  .stat-sub { font-size: 9.5px; white-space: nowrap; }

  .event-banner {
    top: calc(max(8px, env(safe-area-inset-top)) + 126px);
    max-width: calc(100vw - 24px);
    padding: 6px 12px;
    font-size: 10.5px;
    letter-spacing: 0.04em;
    white-space: normal;
    text-align: center;
  }

  /* Slide-up glass control drawer on mobile (closed by default so robot is unobstructed) */
  .control-dock {
    top: auto;
    left: max(10px, env(safe-area-inset-left));
    right: max(10px, env(safe-area-inset-right));
    bottom: calc(max(12px, env(safe-area-inset-bottom)) + 58px);
    width: auto;
    max-width: 420px;
    margin: 0 auto;
    max-height: calc(100dvh - 150px);
    padding: 12px 14px;
    border-radius: 18px;
    z-index: 30;
    transform: translateY(18px);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.18s ease;
  }

  .control-dock.mobile-open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  .dock-mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.14);
  }

  .control-dock .btn {
    min-height: 38px;
    font-size: 12.5px;
  }

  .control-dock .seg-btn {
    padding: 6px 11px;
    font-size: 11.5px;
  }

  .control-dock .social-link {
    min-height: 36px;
    font-size: 12px;
  }

  /* Hide redundant desktop Hurl button & social links inside drawer since they're always on top/bottom bars */
  .control-dock .hurl-btn,
  .control-dock .dock-links {
    display: none;
  }

  /* Compact Stereo Eyes PiP tucked cleanly above the bottom action bar */
  .stereo-pip {
    right: max(10px, env(safe-area-inset-right));
    bottom: calc(max(12px, env(safe-area-inset-bottom)) + 58px);
    width: 212px;
    border-radius: 12px;
    z-index: 20;
  }

  .pip-header {
    padding: 4px 8px;
    gap: 6px;
  }

  .pip-title { font-size: 7.5px; letter-spacing: 0.05em; }
  .pip-meta { font-size: 8px; }
  .eye-tag { font-size: 7.5px; padding: 1px 4px; bottom: 4px; }

  /* Always-accessible thumb-friendly bottom bar */
  .mobile-bar {
    position: fixed;
    left: max(10px, env(safe-area-inset-left));
    right: max(10px, env(safe-area-inset-right));
    bottom: max(10px, env(safe-area-inset-bottom));
    z-index: 28;
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: 460px;
    margin: 0 auto;
    pointer-events: none;
  }

  .mobile-bar > * {
    pointer-events: auto;
  }

  .mobile-hurl {
    flex: 1.5;
    width: auto;
    min-height: 44px;
    border-radius: 13px;
    font-size: 13.5px;
    font-weight: 700;
  }

  .mobile-pill {
    flex: 0.85;
    min-height: 44px;
    border-radius: 13px;
    font-size: 12.5px;
    font-weight: 700;
    background: var(--panel);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
  }
}

/* Landscape phones (wide & short): single compact top row with GitHub & X right at top, dock on left */
@media (max-height: 520px) and (min-width: 561px) {
  .hud-top {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .mobile-top-links {
    order: 1;
    justify-content: flex-start;
    gap: 6px;
  }

  .hero-header {
    order: 2;
    flex: 1;
    padding: 0 8px;
    text-align: center;
    font-size: 12px;
    white-space: nowrap;
  }

  .stats-strip {
    order: 3;
    flex: 0 1 auto;
    justify-content: flex-end;
  }

  .stat-card {
    flex: 0 1 auto;
    min-width: 82px;
  }

  .audio-unlock-pill {
    padding: 6px 10px;
    font-size: 11px;
    min-height: 32px;
  }

  .event-banner {
    top: calc(max(8px, env(safe-area-inset-top)) + 48px);
  }

  .control-dock {
    left: max(10px, env(safe-area-inset-left));
    right: auto;
    width: 276px;
    margin: 0;
    bottom: calc(max(10px, env(safe-area-inset-bottom)) + 54px);
    max-height: calc(100dvh - 120px);
  }

  .stereo-pip {
    width: 206px;
    bottom: calc(max(10px, env(safe-area-inset-bottom)) + 54px);
  }

  .mobile-bar {
    max-width: 360px;
    left: max(10px, env(safe-area-inset-left));
    right: auto;
    margin: 0;
  }
}
