/* Beyblade X Arena — Styles */

:root {
  --bg-deep: #0a0e17;
  --bg-panel: #121a2b;
  --bg-panel-hover: #1a2540;
  --red: #ff2d55;
  --red-glow: rgba(255, 45, 85, 0.5);
  --blue: #00d4ff;
  --blue-glow: rgba(0, 212, 255, 0.5);
  --gold: #ffd60a;
  --purple: #bf5af2;
  --text: #e8edf5;
  --text-muted: #8892a8;
  --border: rgba(255, 255, 255, 0.08);
  --font-display: 'Orbitron', sans-serif;
  --font-body: 'Rajdhani', sans-serif;
}

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

html {
  font-size: 16px;
  touch-action: manipulation;
}

body {
  font-family: var(--font-body);
  background: var(--bg-deep);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(0, 212, 255, 0.12), transparent),
    radial-gradient(ellipse 60% 40% at 100% 100%, rgba(255, 45, 85, 0.08), transparent);
}

/* FX Layer */
#fx-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1200;
}

#particle-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

#flash-overlay {
  position: absolute;
  inset: 0;
  opacity: 0;
  background: white;
  transition: opacity 0.05s;
}

#flash-overlay.active { opacity: var(--flash-opacity, 0.85); }
#flash-overlay.burst-flash { background: radial-gradient(circle, #fff 0%, var(--red) 35%, transparent 72%); }
#flash-overlay.extreme-flash { background: radial-gradient(circle, #fff 0%, var(--purple) 30%, var(--gold) 55%, transparent 82%); }
#flash-overlay.blue-flash { background: radial-gradient(circle, #fff 0%, var(--blue) 40%, transparent 75%); }
#flash-overlay.gold-flash { background: radial-gradient(circle, #fff 0%, var(--gold) 45%, transparent 78%); }
#flash-overlay.go-shoot-flash {
  background: radial-gradient(circle, #fff 0%, #fff 12%, var(--gold) 30%, var(--red) 50%, transparent 80%);
}
#flash-overlay.lens-flare {
  background:
    radial-gradient(ellipse 180% 3% at 50% 50%, rgba(255, 255, 255, 0.9) 0%, rgba(0, 212, 255, 0.4) 30%, transparent 70%),
    radial-gradient(circle at 50% 50%, rgba(255, 214, 10, 0.15) 0%, transparent 50%);
}
#flash-overlay.anime-impact {
  background:
    radial-gradient(circle, #fff 0%, #fff 8%, transparent 45%),
    repeating-conic-gradient(from 0deg at 50% 50%, transparent 0 8deg, rgba(255, 255, 255, 0.25) 8deg 10deg, transparent 10deg 20deg);
}

#burst-ring,
#burst-ring-2,
.launch-burst-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border: 4px solid var(--red);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  opacity: 0;
  pointer-events: none;
  z-index: 3;
  box-shadow:
    0 0 24px currentColor,
    0 0 48px currentColor,
    inset 0 0 20px currentColor;
}

.launch-burst-ring {
  position: fixed;
  z-index: 2;
}

#burst-ring.animate,
.launch-burst-ring.animate,
#burst-ring-2.animate {
  animation: burstRing 0.9s cubic-bezier(0.12, 0.88, 0.28, 1) forwards;
  opacity: 1;
}

#burst-ring-2.animate,
#launch-burst-ring-2.animate {
  animation: burstRingAlt 1.15s cubic-bezier(0.08, 0.92, 0.18, 1) forwards;
}

@keyframes burstRing {
  0% {
    width: 0;
    height: 0;
    opacity: 1;
    border-width: 16px;
    transform: translate(-50%, -50%) scale(1);
    box-shadow:
      0 0 32px currentColor,
      0 0 64px currentColor,
      inset 0 0 28px currentColor;
  }
  35% { opacity: 1; }
  100% {
    width: 160vmax;
    height: 160vmax;
    opacity: 0;
    border-width: 2px;
    transform: translate(-50%, -50%) scale(1);
    box-shadow: 0 0 10px currentColor;
  }
}

@keyframes burstRingAlt {
  0% {
    width: 0;
    height: 0;
    opacity: 1;
    border-width: 10px;
    transform: translate(-50%, -50%) rotate(0deg) scale(1);
    box-shadow: 0 0 28px currentColor;
  }
  100% {
    width: 130vmax;
    height: 130vmax;
    opacity: 0;
    border-width: 2px;
    transform: translate(-50%, -50%) rotate(60deg) scale(1);
    box-shadow: none;
  }
}

body.shake { animation: screenShake 0.4s ease; }
body.shake-heavy { animation: screenShakeHeavy 0.65s ease; }
body.shake-go-shoot { animation: screenShakeGoShoot 1.1s cubic-bezier(0.22, 1, 0.36, 1); }

@keyframes screenShake {
  0%, 100% { transform: translate(0); }
  15% { transform: translate(-10px, 6px) rotate(-0.5deg); }
  30% { transform: translate(10px, -8px) rotate(0.5deg); }
  45% { transform: translate(-8px, -10px); }
  60% { transform: translate(8px, 10px); }
  75% { transform: translate(-5px, 4px); }
}

@keyframes screenShakeHeavy {
  0%, 100% { transform: translate(0) scale(1); }
  8% { transform: translate(-18px, 12px) scale(1.015) rotate(-1deg); }
  22% { transform: translate(18px, -14px) scale(0.985) rotate(1deg); }
  36% { transform: translate(-14px, -18px) scale(1.02); }
  50% { transform: translate(16px, 16px) scale(0.98); }
  64% { transform: translate(-10px, 8px) scale(1.01); }
  78% { transform: translate(8px, -6px) scale(0.995); }
}

@keyframes screenShakeGoShoot {
  0%, 100% { transform: translate(0) scale(1); }
  5% { transform: translate(-28px, 18px) scale(1.035) rotate(-2.5deg); }
  12% { transform: translate(30px, -20px) scale(0.965) rotate(2.5deg); }
  20% { transform: translate(-24px, -26px) scale(1.05); }
  28% { transform: translate(26px, 24px) scale(0.95); }
  38% { transform: translate(-18px, 14px) scale(1.025) rotate(-1deg); }
  50% { transform: translate(16px, -12px) scale(0.99) rotate(1deg); }
  65% { transform: translate(-10px, 8px) scale(1.01); }
  80% { transform: translate(6px, -4px); }
}

/* Header */
.arena-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: rgba(18, 26, 43, 0.9);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo-block {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-x {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 2rem;
  background: linear-gradient(135deg, var(--red), var(--blue));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 12px var(--blue-glow));
}

.arena-header h1 {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.event-subtitle {
  font-size: 0.72rem;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  margin-top: 0.15rem;
}

.session-select {
  background: var(--bg-deep);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  font-family: var(--font-body);
  font-size: max(0.75rem, 16px);
  max-width: 200px;
}

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

#btn-fullscreen.fullscreen-locked {
  border-color: var(--gold);
  color: var(--gold);
  box-shadow: 0 0 12px rgba(255, 214, 10, 0.35);
}

/* App navigation tabs */
.app-nav {
  display: flex;
  gap: 0.35rem;
  padding: 0.65rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: rgba(18, 26, 43, 0.95);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 4.6rem;
  z-index: 99;
  overflow-x: auto;
}

.app-nav-btn {
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 0.55rem 1rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-deep);
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.app-nav-btn.active {
  color: #fff;
  border-color: var(--blue);
  background: linear-gradient(135deg, rgba(0, 212, 255, 0.25), rgba(255, 45, 85, 0.15));
  box-shadow: 0 0 20px rgba(0, 212, 255, 0.2);
}

.app-view {
  display: none;
}

.app-view.active {
  display: block;
}

/* Layout */
.arena-layout {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0;
  min-height: calc(100vh - 8rem);
}

/* Scoreboard */
.scoreboard {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 1rem;
  align-items: stretch;
}

.player-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: box-shadow 0.3s, transform 0.2s;
}

.player-red {
  border-top: 3px solid var(--red);
  box-shadow: inset 0 0 40px rgba(255, 45, 85, 0.05);
}

.player-blue {
  border-top: 3px solid var(--blue);
  box-shadow: inset 0 0 40px rgba(0, 212, 255, 0.05);
}

.player-card.score-pop {
  animation: scorePop 0.35s ease;
}

@keyframes scorePop {
  0% { transform: scale(1); }
  50% { transform: scale(1.03); }
  100% { transform: scale(1); }
}

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

.player-name {
  font-family: var(--font-display);
  font-size: max(1.1rem, 16px);
  font-weight: 700;
  background: transparent;
  border: none;
  color: var(--text);
  width: 100%;
  padding: 0.25rem 0;
  border-bottom: 1px dashed transparent;
}

.player-name:focus {
  outline: none;
  border-bottom-color: var(--text-muted);
}

.player-badge {
  font-family: var(--font-display);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  flex-shrink: 0;
}

.player-red .player-badge { background: var(--red); color: #fff; }
.player-blue .player-badge { background: var(--blue); color: #000; }

.player-badge {
  display: none;
}

.score-display {
  text-align: center;
  padding: 0.25rem 0 0.15rem;
}

.score-num {
  font-family: var(--font-display);
  font-size: 4rem;
  font-weight: 900;
  line-height: 1;
  display: block;
  transition: color 0.2s;
}

.player-red .score-num { color: var(--red); text-shadow: 0 0 30px var(--red-glow); }
.player-blue .score-num { color: var(--blue); text-shadow: 0 0 30px var(--blue-glow); }

.score-label {
  display: none;
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  color: var(--text-muted);
}

.score-track {
  display: none;
}

.finish-hint,
.rules-note,
.vs-badge,
.launch-hint {
  display: none;
}

.finish-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
}

.btn-finish {
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.5rem 0.35rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-deep);
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
}

.finish-name {
  line-height: 1.2;
  text-align: center;
  font-size: 0.76rem;
}

.finish-name em {
  display: none;
}

.btn-finish strong {
  font-family: var(--font-display);
  font-size: 0.78rem;
  color: var(--gold);
  margin-left: auto;
}

.finish-icon { font-size: 0.95rem; flex-shrink: 0; }

/* VS Center */
.vs-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.35rem;
  min-width: 160px;
}

.match-info {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  text-align: center;
}

.match-label {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}

.match-label .round-num {
  font-size: 1.35rem;
  color: var(--gold);
}

.match-target {
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 0.12rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: 999px;
}

.round-num {
  font-family: var(--font-display);
  font-weight: 900;
  color: var(--gold);
}

.finish-rules {
  width: 100%;
  font-size: 0.68rem;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.3rem 0.5rem;
  background: rgba(0, 0, 0, 0.15);
}

.finish-rules summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text-muted);
  list-style: none;
}

.finish-rules summary::-webkit-details-marker { display: none; }

.finish-rules ul {
  margin: 0.45rem 0 0;
  padding-left: 1rem;
  line-height: 1.55;
}

.finish-rules li + li { margin-top: 0.2rem; }

.finish-rules strong { color: var(--text); font-weight: 600; }

.timer-block { text-align: center; width: 100%; }

.launch-timer {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--gold);
  display: block;
  min-height: 2rem;
  line-height: 2rem;
  text-shadow: 0 0 20px rgba(255, 214, 10, 0.6);
  transition: font-size 0.2s;
}

.launch-timer[hidden] { display: none !important; }

.launch-timer.go-shoot {
  font-size: 1.6rem;
  color: var(--red);
  text-shadow: 0 0 24px var(--red-glow);
  animation: goShootPulse 0.45s ease infinite;
}

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

.launch-hint {
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.voice-toggle {
  margin-top: 0.5rem;
  justify-content: center;
  font-size: 0.75rem;
}

.launch-timer.counting { animation: pulse 0.5s ease infinite; }

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

.match-settings {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  width: 100%;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.match-settings label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.match-settings select {
  background: var(--bg-deep);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  font-family: var(--font-body);
}

/* Buttons */
.btn {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.55rem 1rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-primary {
  background: linear-gradient(135deg, var(--red), #cc0033);
  color: #fff;
  width: 100%;
}

.btn-launch {
  background: linear-gradient(135deg, var(--gold), #e6a800);
  color: #000;
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  width: 100%;
  padding: 0.7rem;
}

.btn-launch:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.btn-ghost:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-sm { font-size: 0.8rem; padding: 0.35rem 0.7rem; }

/* Bottom panels — now separate views */
.camera-panel-full,
.battle-log-panel-full {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 11rem);
}

.camera-panel-full .camera-viewport {
  flex: 1;
  aspect-ratio: unset;
  min-height: 420px;
}

.battle-log-panel-full .battle-log {
  flex: 1;
  max-height: none;
  min-height: calc(100vh - 14rem);
}

.camera-panel, .battle-log-panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}

.panel-header h2 {
  font-family: var(--font-display);
  font-size: 0.85rem;
  letter-spacing: 0.1em;
}

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

.toggle {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.3rem;
  cursor: pointer;
}

.cam-select {
  background: var(--bg-deep);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.25rem 0.4rem;
  border-radius: 4px;
  font-size: 0.75rem;
  max-width: 140px;
}

.camera-viewport {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
  overflow: hidden;
  transition: none;
}

/* ─── Camera launch fullscreen ─── */
body.launch-active {
  overflow: hidden;
}

body.launch-active .app-nav {
  visibility: hidden;
  pointer-events: none;
}

body.launch-active .app-view {
  display: none !important;
}

body.launch-active #view-camera {
  display: block !important;
}

body.launch-active.launch-live #view-battle {
  display: block !important;
}

body.launch-active.launch-countdown .arena-header,
body.launch-active.launch-countdown .app-nav,
body.launch-active.launch-countdown .battle-log-panel,
body.launch-active.launch-countdown .vs-center {
  visibility: hidden;
  pointer-events: none;
}

/* Keep broadcast HUD (rails, scores, finish buttons) above standby/countdown overlay */
body.launch-active.launch-standby.launch-live .scoreboard,
body.launch-active.launch-countdown.launch-live .scoreboard {
  z-index: 1120;
}

body.launch-active.launch-live .arena-header,
body.launch-active.launch-live .app-nav,
body.launch-active.launch-live .battle-log-panel {
  visibility: hidden;
  pointer-events: none;
}

body.launch-active.launch-live .scoreboard {
  position: fixed;
  inset: 0;
  z-index: 950;
  display: block;
  pointer-events: none;
  background: transparent;
  padding: 0;
  --hud-rail-w: clamp(40px, 2.6vw, 48px);
  --hud-panel-w: min(42vw, 400px);
  --hud-inset-l: max(3.35rem, calc(env(safe-area-inset-left) + 2.75rem));
  --hud-inset-r: max(3.35rem, calc(env(safe-area-inset-right) + 2.75rem));
  --hud-name-top: max(2.7rem, calc(env(safe-area-inset-top) + 2.2rem));
  --hud-score-top: max(8.15rem, calc(env(safe-area-inset-top) + 7.4rem));
  --hud-rail-top: max(13.75rem, calc(env(safe-area-inset-top) + 12.75rem));
  --hud-rail-bottom: max(6.85rem, calc(env(safe-area-inset-bottom) + 5.85rem));
  --hud-btn-bottom: max(0.85rem, env(safe-area-inset-bottom));
}

body.launch-active.launch-live .scoreboard::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(to bottom, rgba(8, 12, 20, 0.72) 0%, rgba(8, 12, 20, 0.2) 14%, transparent 28%),
    linear-gradient(to right, rgba(255, 45, 85, 0.22) 0%, transparent 14%),
    linear-gradient(to left, rgba(0, 212, 255, 0.22) 0%, transparent 14%),
    linear-gradient(to top, rgba(10, 14, 23, 0.62) 0%, transparent 24%);
  z-index: -1;
}

.btn-live-replay {
  display: none;
}

body.launch-active.launch-live .btn-live-replay:not([hidden]) {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  position: fixed;
  top: max(0.5rem, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 1170;
  padding: 0.36rem 0.85rem 0.36rem 0.75rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 214, 10, 0.35);
  background: rgba(8, 12, 20, 0.88);
  box-shadow: 0 6px 28px rgba(0, 0, 0, 0.5);
  color: #fff;
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.btn-live-replay[hidden] {
  display: none !important;
}

.btn-live-replay-round {
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  color: rgba(255, 255, 255, 0.55);
}

#live-replay-battle-num {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 900;
  color: var(--gold);
  letter-spacing: 0;
}

.btn-live-replay-label {
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  background: rgba(255, 214, 10, 0.16);
  border: 1px solid rgba(255, 214, 10, 0.45);
  color: var(--gold);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
}

.btn-live-replay.is-idle .btn-live-replay-label {
  opacity: 0.6;
}

.btn-live-replay:active {
  transform: translateX(-50%) scale(0.98);
}

body.launch-active.launch-live .vs-center {
  display: flex;
  position: fixed;
  top: max(0.55rem, env(safe-area-inset-top));
  left: calc(50% + 5.75rem);
  transform: none;
  z-index: 1160;
  pointer-events: none;
  min-width: 0;
  flex-direction: row;
  align-items: center;
  gap: 0.35rem;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
}

body.launch-active.launch-live .vs-center .match-info,
body.launch-active.launch-live .vs-center #btn-argue-replay,
body.launch-active.launch-live .vs-center .vs-badge,
body.launch-active.launch-live .vs-center .rules-note,
body.launch-active.launch-live .vs-center .match-target,
body.launch-active.launch-live .vs-center .finish-rules,
body.launch-active.launch-live .vs-center .timer-block,
body.launch-active.launch-live .vs-center #btn-next-battle {
  display: none;
}

body.launch-active.launch-live .vs-center .match-info {
  display: none;
}

body.launch-active.launch-live .vs-center .match-label {
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  color: rgba(255, 255, 255, 0.55);
}

body.launch-active.launch-live .vs-center .round-num {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 900;
  color: var(--gold);
  line-height: 1;
}

body.launch-active.launch-live .vs-center #btn-undo-finish {
  display: inline-flex;
  pointer-events: auto;
  font-size: 0.72rem;
  padding: 0.28rem 0.6rem;
  margin-left: 0;
  border-radius: 999px;
  background: rgba(8, 12, 20, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

body.launch-active.launch-live .vs-center #btn-undo-finish:disabled {
  opacity: 0.4;
  pointer-events: none;
}

body.launch-active.launch-live .player-card {
  display: contents;
  pointer-events: none;
}

body.launch-active.launch-live .player-header {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  position: fixed;
  top: var(--hud-name-top);
  z-index: 956;
  width: var(--hud-panel-w);
  min-width: 0;
  max-width: var(--hud-panel-w);
  background: rgba(6, 10, 18, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-bottom: none;
  border-radius: 14px 14px 0 0;
  overflow: visible;
  box-shadow:
    0 10px 32px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  pointer-events: auto;
}

body.launch-active.launch-live .player-red .player-header {
  left: var(--hud-inset-l);
  border-left: 5px solid #ff2d55;
  background:
    linear-gradient(135deg, rgba(255, 45, 85, 0.24) 0%, rgba(6, 10, 18, 0.9) 55%);
}

body.launch-active.launch-live .player-blue .player-header {
  right: var(--hud-inset-r);
  left: auto;
  text-align: right;
  border-right: 5px solid #00d4ff;
  border-left: 1px solid rgba(255, 255, 255, 0.14);
  background:
    linear-gradient(225deg, rgba(0, 212, 255, 0.22) 0%, rgba(6, 10, 18, 0.9) 55%);
}

body.launch-active.launch-live .player-header::before {
  content: 'BLADER';
  display: block;
  font-family: var(--font-display);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.24em;
  padding: 0.32rem 0.75rem 0.1rem;
  color: rgba(255, 255, 255, 0.45);
}

body.launch-active.launch-live .player-red .player-header::before {
  color: rgba(255, 160, 180, 0.85);
}

body.launch-active.launch-live .player-blue .player-header::before {
  color: rgba(140, 220, 255, 0.85);
}

body.launch-active.launch-live .player-badge {
  display: none;
}

body.launch-active.launch-live .player-name {
  font-family: var(--font-display), 'PingFang TC', 'Heiti TC', 'Microsoft JhengHei', 'Noto Sans TC', sans-serif;
  font-size: clamp(1.85rem, 5.2vw, 2.75rem);
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.35;
  padding: 0.15rem 0.75rem 0.7rem;
  border: none;
  background: transparent;
  color: #fff;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.55);
  width: 100%;
  height: auto;
  text-align: inherit;
  overflow: visible;
}

body.launch-active.launch-live .player-red .player-name {
  color: #ffe8ee;
  text-shadow: 0 0 22px rgba(255, 45, 85, 0.45);
}

body.launch-active.launch-live .player-blue .player-name {
  color: #e4f9ff;
  text-shadow: 0 0 22px rgba(0, 212, 255, 0.45);
}

.broadcast-rail {
  display: none;
}

body.launch-active.launch-live .player-card .score-track {
  display: none;
}

body.launch-active.launch-live .broadcast-rail {
  display: flex;
  flex-direction: column-reverse;
  position: fixed;
  top: var(--hud-rail-top);
  bottom: var(--hud-rail-bottom);
  transform: none;
  width: var(--hud-rail-w);
  height: auto;
  padding: 0.5rem 0.38rem;
  gap: 0.38rem;
  z-index: 954;
  pointer-events: none;
}

body.launch-active.launch-live .broadcast-rail-red {
  left: max(0.35rem, env(safe-area-inset-left));
  background:
    linear-gradient(to right, rgba(255, 16, 74, 0.98), rgba(255, 16, 74, 0.42)),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.18), transparent 35%, rgba(255, 255, 255, 0.08));
  border: 1px solid rgba(255, 120, 150, 0.85);
  border-left: 0;
  border-radius: 0 10px 10px 0;
  box-shadow:
    0 0 28px rgba(255, 45, 85, 0.75),
    8px 0 42px rgba(255, 45, 85, 0.5),
    inset 0 0 18px rgba(255, 255, 255, 0.18);
}

body.launch-active.launch-live .broadcast-rail-blue {
  right: max(0.35rem, env(safe-area-inset-right));
  left: auto;
  background:
    linear-gradient(to left, rgba(0, 226, 255, 0.98), rgba(0, 226, 255, 0.42)),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.18), transparent 35%, rgba(255, 255, 255, 0.08));
  border: 1px solid rgba(132, 246, 255, 0.85);
  border-right: 0;
  border-radius: 10px 0 0 10px;
  box-shadow:
    0 0 28px rgba(0, 212, 255, 0.75),
    -8px 0 42px rgba(0, 212, 255, 0.5),
    inset 0 0 18px rgba(255, 255, 255, 0.18);
}

body.launch-active.launch-live .broadcast-rail .score-seg {
  flex: 1;
  max-width: none;
  width: 100%;
  min-height: 0;
  height: auto;
  border-radius: 5px;
  border: 2px solid rgba(255, 255, 255, 0.72);
  opacity: 1;
  background: rgba(4, 8, 14, 0.42);
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.24),
    0 0 12px rgba(255, 255, 255, 0.14);
  transition: background 0.2s, box-shadow 0.2s, transform 0.2s;
}

body.launch-active.launch-live .broadcast-rail-red .score-seg.filled {
  background: linear-gradient(180deg, #fff, #ffd3dc 42%, #ff1c59);
  border-color: #fff5f7;
  box-shadow:
    0 0 18px rgba(255, 255, 255, 0.95),
    0 0 34px rgba(255, 45, 85, 0.9),
    inset 0 0 10px rgba(255, 45, 85, 0.55);
}

body.launch-active.launch-live .broadcast-rail-blue .score-seg.filled {
  background: linear-gradient(180deg, #fff, #c8fbff 42%, #00d4ff);
  border-color: #f3feff;
  box-shadow:
    0 0 18px rgba(255, 255, 255, 0.95),
    0 0 34px rgba(0, 212, 255, 0.9),
    inset 0 0 10px rgba(0, 212, 255, 0.55);
}

body.launch-active.launch-live .broadcast-rail .score-seg.seg-pop {
  animation: broadcastSegPop 0.48s cubic-bezier(0.22, 1.2, 0.36, 1);
}

@keyframes broadcastSegPop {
  0% { filter: brightness(1); transform: scaleX(1); }
  35% { filter: brightness(2.3) saturate(1.5); transform: scaleX(1.45); }
  100% { filter: brightness(1); transform: scaleX(1); }
}

body.launch-active.launch-live .score-num.score-pop-num {
  animation: broadcastScorePop 0.52s cubic-bezier(0.22, 1.2, 0.36, 1);
}

@keyframes broadcastScorePop {
  0% { filter: brightness(1); transform: scale(1); }
  38% { filter: brightness(2) saturate(1.4); transform: scale(1.22) rotate(-2deg); }
  100% { filter: brightness(1); transform: scale(1); }
}

body.launch-active.launch-live .finish-hint {
  display: none;
}

body.launch-active.launch-live .score-display {
  display: flex;
  flex-direction: row;
  align-items: baseline;
  gap: 0.5rem;
  position: fixed;
  top: var(--hud-score-top);
  transform: none;
  padding: 0.1rem 0.85rem 0.55rem;
  width: var(--hud-panel-w);
  line-height: 0.9;
  margin: 0;
  isolation: isolate;
  z-index: 956;
  pointer-events: none;
  background: rgba(6, 10, 18, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-top: none;
  border-radius: 0 0 14px 14px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.42);
}

body.launch-active.launch-live .player-red .score-display {
  left: var(--hud-inset-l);
  justify-content: flex-start;
  border-left: 5px solid #ff2d55;
  background:
    linear-gradient(135deg, rgba(255, 45, 85, 0.16) 0%, rgba(6, 10, 18, 0.9) 60%);
}

body.launch-active.launch-live .player-blue .score-display {
  right: var(--hud-inset-r);
  left: auto;
  flex-direction: row-reverse;
  justify-content: flex-start;
  border-right: 5px solid #00d4ff;
  border-left: 1px solid rgba(255, 255, 255, 0.14);
  background:
    linear-gradient(225deg, rgba(0, 212, 255, 0.16) 0%, rgba(6, 10, 18, 0.9) 60%);
}

body.launch-active.launch-live .score-num {
  font-family: 'Bebas Neue', var(--font-display), sans-serif;
  font-size: clamp(3.25rem, 9vw, 6rem);
  font-weight: 400;
  letter-spacing: 0.02em;
  line-height: 0.82;
  filter: drop-shadow(0 4px 22px rgba(0, 0, 0, 0.72));
  position: relative;
  z-index: 956;
}

body.launch-active.launch-live .player-red .score-num {
  color: #ff174f;
  text-shadow:
    0 0 18px #fff,
    0 0 52px rgba(255, 23, 79, 1),
    0 0 92px rgba(255, 23, 79, 0.8),
    5px 5px 0 rgba(0, 0, 0, 0.65);
}

body.launch-active.launch-live .player-blue .score-num {
  color: #00e7ff;
  text-shadow:
    0 0 18px #fff,
    0 0 52px rgba(0, 231, 255, 1),
    0 0 92px rgba(0, 231, 255, 0.8),
    5px 5px 0 rgba(0, 0, 0, 0.65);
}

body.launch-active.launch-live .score-label {
  font-family: var(--font-display);
  font-size: 0;
  letter-spacing: 0.2em;
  color: rgba(255, 255, 255, 0.4);
  align-self: flex-end;
  margin-bottom: 0.65rem;
}

body.launch-active.launch-live .score-label::after {
  content: 'PT';
  font-size: clamp(0.62rem, 1.6vw, 0.82rem);
  font-weight: 700;
}

body.launch-active.launch-live .finish-buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.35rem;
  position: fixed;
  bottom: var(--hud-btn-bottom);
  width: var(--hud-panel-w);
  margin: 0;
  padding: 0.5rem;
  background: rgba(6, 10, 18, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.4);
  z-index: 956;
  pointer-events: auto;
}

body.launch-active.launch-live .player-red .finish-buttons {
  left: var(--hud-inset-l);
}

body.launch-active.launch-live .player-blue .finish-buttons {
  right: var(--hud-inset-r);
  left: auto;
}

body.launch-active.launch-live .btn-finish {
  flex-direction: column;
  justify-content: center;
  gap: 0.12rem;
  padding: 0.42rem 0.22rem;
  font-size: 0.62rem;
  border-radius: 8px;
  min-height: 54px;
}

body.launch-active.launch-live .finish-name {
  display: none;
}

body.launch-active.launch-live .finish-icon {
  font-size: 1.15rem;
}

body.launch-active.launch-live .btn-finish strong {
  font-size: 0.8rem;
  margin-left: 0;
}

body.launch-active .camera-panel {
  position: fixed;
  inset: 0;
  z-index: 900;
  margin: 0;
  border-radius: 0;
  border: none;
  display: flex;
  flex-direction: column;
  animation: camPanelExpand 0.55s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

body.launch-active .camera-panel .panel-header,
body.launch-active .camera-panel .cam-sub-panel {
  display: none !important;
}

body.launch-active #tournament-panel {
  display: none !important;
}

body.launch-active .camera-viewport {
  flex: 1;
  aspect-ratio: unset;
  width: 100%;
  height: 100%;
  min-height: 0;
  transform: translateZ(0);
  backface-visibility: hidden;
}

#camera-viewport.shake { animation: viewportShake 0.4s ease; }
#camera-viewport.shake-heavy { animation: viewportShakeHeavy 0.65s ease; }
#camera-viewport.shake-go-shoot { animation: viewportShakeGoShoot 1.1s cubic-bezier(0.22, 1, 0.36, 1); }

@keyframes viewportShake {
  0%, 100% { transform: translate3d(0, 0, 0); }
  15% { transform: translate3d(-10px, 6px, 0) rotate(-0.5deg); }
  30% { transform: translate3d(10px, -8px, 0) rotate(0.5deg); }
  45% { transform: translate3d(-8px, -10px, 0); }
  60% { transform: translate3d(8px, 10px, 0); }
  75% { transform: translate3d(-5px, 4px, 0); }
}

@keyframes viewportShakeHeavy {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  8% { transform: translate3d(-18px, 12px, 0) scale(1.015) rotate(-1deg); }
  22% { transform: translate3d(18px, -14px, 0) scale(0.985) rotate(1deg); }
  36% { transform: translate3d(-14px, -18px, 0) scale(1.02); }
  50% { transform: translate3d(16px, 16px, 0) scale(0.98); }
  64% { transform: translate3d(-10px, 8px, 0) scale(1.01); }
  78% { transform: translate3d(8px, -6px, 0) scale(0.995); }
}

@keyframes viewportShakeGoShoot {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  5% { transform: translate3d(-28px, 18px, 0) scale(1.035) rotate(-2.5deg); }
  12% { transform: translate3d(30px, -20px, 0) scale(0.965) rotate(2.5deg); }
  20% { transform: translate3d(-24px, -26px, 0) scale(1.05); }
  28% { transform: translate3d(26px, 24px, 0) scale(0.95); }
  38% { transform: translate3d(-18px, 14px, 0) scale(1.025) rotate(-1deg); }
  50% { transform: translate3d(16px, -12px, 0) scale(0.99) rotate(1deg); }
  65% { transform: translate3d(-10px, 8px, 0) scale(1.01); }
  80% { transform: translate3d(6px, -4px, 0); }
}

body.launch-active #camera-feed.active {
  animation: camZoomIn 0.55s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  transform-origin: center center;
}

body.launch-active #camera-feed.active.mirrored {
  animation: camZoomInMirror 0.55s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes camPanelExpand {
  from { opacity: 0.6; transform: scale(0.85); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes camZoomIn {
  from { transform: scale(1); }
  to { transform: scale(1.18); }
}

@keyframes camZoomInMirror {
  from { transform: scaleX(-1) scale(1); }
  to { transform: scaleX(-1) scale(1.18); }
}

.launch-camera-overlay {
  position: fixed;
  inset: 0;
  z-index: 1100;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  contain: layout style paint;
  isolation: isolate;
}

.launch-camera-overlay[hidden] { display: none; }

body.launch-standby .launch-camera-overlay {
  pointer-events: auto;
  cursor: pointer;
}

body.launch-standby .launch-anime-bg,
body.launch-standby .launch-camera-vignette,
body.launch-standby .launch-burst-ring {
  pointer-events: none;
}

.launch-camera-vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 35%, rgba(0, 0, 0, 0.55) 100%);
  pointer-events: none;
}

/* ─── Anime background: halftone + impact ─── */
.launch-anime-bg {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}

.launch-halftone {
  position: absolute;
  inset: 0;
  opacity: 0;
  background-image: radial-gradient(circle, rgba(0, 0, 0, 0.55) 1px, transparent 1px);
  background-size: 5px 5px;
  mix-blend-mode: multiply;
}

body.launch-countdown .launch-halftone {
  opacity: 0.22;
}

.launch-impact-burst {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(140vmax, 1800px);
  height: min(140vmax, 1800px);
  transform: translate(-50%, -50%) scale(0) rotate(0deg);
  opacity: 0;
  pointer-events: none;
}

.launch-impact-burst::before,
.launch-impact-burst::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
}

.launch-impact-burst::before {
  background: repeating-conic-gradient(
    from -4deg at 50% 50%,
    transparent 0deg 7deg,
    rgba(255, 255, 255, 0.55) 7deg 9deg,
    transparent 9deg 18deg
  );
}

.launch-impact-burst::after {
  inset: 18%;
  background: repeating-conic-gradient(
    from 12deg at 50% 50%,
    transparent 0deg 11deg,
    rgba(255, 255, 255, 0.35) 11deg 13deg,
    transparent 13deg 24deg
  );
}

.launch-impact-burst.show {
  animation: impactBurstPop 0.55s cubic-bezier(0.08, 0.92, 0.2, 1) forwards;
}

.launch-impact-burst.show.step-0::before { filter: hue-rotate(180deg); }
.launch-impact-burst.show.step-1::before { filter: hue-rotate(40deg) saturate(1.4); }
.launch-impact-burst.show.step-2::before { filter: hue-rotate(-30deg) saturate(1.6); }
.launch-impact-burst.show.step-3::before { filter: saturate(0); }

@keyframes impactBurstPop {
  0% { transform: translate(-50%, -50%) scale(0) rotate(-25deg); opacity: 0; }
  25% { opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1.15) rotate(12deg); opacity: 0; }
}

body.anime-impact-frame .launch-camera-vignette {
  animation: animeImpactVignette 0.14s steps(2) forwards;
}

@keyframes animeImpactVignette {
  0% { background: radial-gradient(ellipse at center, rgba(255, 255, 255, 0.35) 0%, rgba(0, 0, 0, 0.85) 100%); }
  50% { background: radial-gradient(ellipse at center, transparent 10%, rgba(0, 0, 0, 0.7) 100%); }
  100% { background: radial-gradient(ellipse at center, transparent 35%, rgba(0, 0, 0, 0.55) 100%); }
}

.launch-camera-overlay.shockwave .launch-camera-vignette {
  animation: vignetteShock 1.05s ease-out;
}

@keyframes vignetteShock {
  0% { background: radial-gradient(ellipse at center, rgba(255, 255, 255, 0.5) 0%, rgba(255, 45, 85, 0.85) 100%); }
  20% { background: radial-gradient(ellipse at center, transparent 25%, rgba(255, 214, 10, 0.65) 100%); }
  100% { background: radial-gradient(ellipse at center, transparent 35%, rgba(0, 0, 0, 0.55) 100%); }
}

.launch-camera-overlay.anime-hit .launch-halftone {
  animation: halftoneFlash 0.35s ease-out;
}

@keyframes halftoneFlash {
  0% { opacity: 0.55; transform: scale(1.08); }
  100% { opacity: 0.22; transform: scale(1); }
}

/* ─── Anime countdown text (manga SFX style) ─── */
.launch-camera-text {
  position: relative;
  z-index: 2;
  font-family: 'Bangers', 'Bebas Neue', 'Orbitron', var(--font-display), sans-serif;
  font-weight: 400;
  font-style: italic;
  font-size: clamp(5.5rem, 26vw, 15rem);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: center;
  line-height: 0.88;
  color: #fff;
  opacity: 0;
  transform: skewX(-10deg) rotate(-3deg) translateZ(0);
  transition: none;
  -webkit-text-stroke: 5px #0a0a0a;
  paint-order: stroke fill;
  padding: 0 0.05em;
  text-shadow:
    6px 6px 0 #000,
    -3px -3px 0 rgba(255, 255, 255, 0.15);
  will-change: transform, opacity;
}

.launch-camera-text::before {
  display: block;
  content: attr(data-text);
  position: absolute;
  inset: 0;
  z-index: -1;
  color: transparent;
  -webkit-text-stroke: 0;
  transform: translate(8px, 8px) skewX(-10deg) rotate(-3deg);
  text-shadow: none;
  opacity: 0.45;
}

.launch-camera-text.show {
  animation: animeCdSlam 0.42s cubic-bezier(0.14, 0.95, 0.28, 1) forwards;
}

.launch-camera-text.step-0 {
  font-size: clamp(5rem, 22vw, 13rem);
  color: #7ae8ff;
  -webkit-text-stroke-color: #003344;
  text-shadow:
    6px 6px 0 #001a22,
    0 0 40px rgba(0, 212, 255, 0.7),
    0 0 80px rgba(0, 212, 255, 0.35);
}

.launch-camera-text.step-0.show {
  animation: animeCdSlam 0.44s cubic-bezier(0.14, 0.95, 0.28, 1) forwards;
}

.launch-camera-text.step-1 {
  font-size: clamp(6rem, 28vw, 16rem);
  color: #ffe566;
  -webkit-text-stroke-color: #442200;
  text-shadow:
    7px 7px 0 #221100,
    0 0 45px rgba(255, 214, 10, 0.75),
    0 0 90px rgba(255, 180, 0, 0.35);
  transform: skewX(-12deg) rotate(-4deg);
}

.launch-camera-text.step-1.show {
  animation: animeCdSlam 0.38s cubic-bezier(0.1, 0.92, 0.22, 1) forwards;
}

.launch-camera-text.step-2 {
  font-size: clamp(7.5rem, 34vw, 19rem);
  color: #ff6680;
  -webkit-text-stroke: 6px #330008;
  text-shadow:
    8px 8px 0 #1a0004,
    0 0 55px rgba(255, 45, 85, 0.85),
    0 0 110px rgba(255, 45, 85, 0.4);
  transform: skewX(-14deg) rotate(-5deg);
}

.launch-camera-text.step-2.show {
  animation: animeCdSlamBig 0.46s cubic-bezier(0.08, 0.9, 0.18, 1) forwards;
}

.launch-camera-text.go-shoot {
  font-family: 'Bangers', 'Bebas Neue', 'Orbitron', var(--font-display), sans-serif;
  font-size: clamp(4.2rem, 17vw, 11rem);
  letter-spacing: 0.04em;
  line-height: 0.92;
  color: #fff;
  -webkit-text-stroke: 6px #1a0008;
  background: none;
  -webkit-text-fill-color: #fff;
  text-shadow:
    8px 8px 0 #000,
    0 0 30px rgba(255, 214, 10, 0.9),
    0 0 60px rgba(255, 45, 85, 0.65),
    0 0 100px rgba(255, 45, 85, 0.35);
  filter: none;
  transform: skewX(-16deg) rotate(-6deg) scale(1);
  animation: animeGoShoot 0.52s cubic-bezier(0.06, 0.88, 0.16, 1) forwards;
}

.launch-camera-text.go-shoot::before {
  color: rgba(255, 214, 10, 0.35);
  -webkit-text-stroke: 0;
  transform: translate(10px, 10px) skewX(-16deg) rotate(-6deg);
  opacity: 0.6;
}

@keyframes animeCdSlam {
  0% {
    opacity: 0;
    transform: skewX(-10deg) rotate(-3deg) scale(3.2) translateX(8%);
    filter: brightness(2.5);
  }
  45% {
    opacity: 1;
    transform: skewX(-10deg) rotate(-3deg) scale(0.88) translateX(-2%);
    filter: brightness(1.15);
  }
  70% { transform: skewX(-10deg) rotate(-3deg) scale(1.06); }
  100% {
    opacity: 1;
    transform: skewX(-10deg) rotate(-3deg) scale(1);
    filter: brightness(1);
  }
}

@keyframes animeCdSlamBig {
  0% {
    opacity: 0;
    transform: skewX(-14deg) rotate(-5deg) scale(4) translateX(10%);
    filter: brightness(3);
  }
  40% {
    opacity: 1;
    transform: skewX(-14deg) rotate(-5deg) scale(0.82) translateX(-3%);
    filter: brightness(1.25);
  }
  65% { transform: skewX(-14deg) rotate(-5deg) scale(1.1); }
  100% {
    opacity: 1;
    transform: skewX(-14deg) rotate(-5deg) scale(1.02);
    filter: brightness(1);
  }
}

@keyframes animeGoShoot {
  0% {
    opacity: 0;
    transform: skewX(-16deg) rotate(-6deg) scale(3.5) translateX(12%);
    filter: brightness(3.5);
  }
  30% {
    opacity: 1;
    transform: skewX(-16deg) rotate(-6deg) scale(0.85) translateX(-4%);
    filter: brightness(1.4);
  }
  55% { transform: skewX(-16deg) rotate(-6deg) scale(1.12); }
  100% {
    opacity: 1;
    transform: skewX(-16deg) rotate(-6deg) scale(1);
    filter: brightness(1);
  }
}

.launch-camera-text.go-shoot.burst-out {
  animation: animeGoShootBurst 0.42s cubic-bezier(0.12, 0.95, 0.28, 1) forwards !important;
  pointer-events: none;
}

.launch-camera-text.go-shoot.burst-out::before {
  animation: animeGoShootBurstShadow 0.42s cubic-bezier(0.12, 0.95, 0.28, 1) forwards;
}

@keyframes animeGoShootBurst {
  0% {
    opacity: 1;
    transform: skewX(-16deg) rotate(-6deg) scale(1);
    filter: brightness(1);
    letter-spacing: 0.04em;
  }
  18% {
    opacity: 1;
    transform: skewX(-16deg) rotate(-6deg) scale(1.18);
    filter: brightness(2.2);
    letter-spacing: 0.06em;
  }
  45% {
    opacity: 1;
    transform: skewX(-18deg) rotate(-10deg) scale(2.4);
    filter: brightness(3.5) contrast(1.3);
    letter-spacing: 0.14em;
  }
  100% {
    opacity: 0;
    transform: skewX(-22deg) rotate(-14deg) scale(4.2);
    filter: brightness(5) contrast(1.5);
    letter-spacing: 0.28em;
  }
}

@keyframes animeGoShootBurstShadow {
  0% {
    opacity: 0.6;
    transform: translate(10px, 10px) skewX(-16deg) rotate(-6deg) scale(1);
  }
  45% {
    opacity: 0.85;
    transform: translate(18px, 18px) skewX(-18deg) rotate(-10deg) scale(2.2);
  }
  100% {
    opacity: 0;
    transform: translate(28px, 28px) skewX(-22deg) rotate(-14deg) scale(3.8);
  }
}

body.go-shoot-moment .camera-viewport {
  animation: camGoShootPunch 1.1s cubic-bezier(0.22, 1.2, 0.36, 1);
  filter: contrast(1.15) saturate(1.2);
}

@keyframes camGoShootPunch {
  0% { transform: scale(1); filter: brightness(1) contrast(1) saturate(1); }
  10% { transform: scale(1.16) rotate(-0.5deg); filter: brightness(1.6) contrast(1.25) saturate(1.35); }
  28% { transform: scale(1.08) rotate(0.3deg); filter: brightness(1.3) contrast(1.15) saturate(1.2); }
  100% { transform: scale(1); filter: brightness(1) contrast(1) saturate(1); }
}

body.launch-countdown .camera-viewport.cam-punch {
  animation: camStepPunch 0.34s cubic-bezier(0.22, 1.3, 0.36, 1);
  will-change: transform;
}

body.launch-countdown #camera-feed.active,
body.launch-countdown #camera-feed-img:not([hidden]) {
  will-change: transform;
}

@keyframes camStepPunch {
  0% { transform: scale(1); filter: brightness(1) contrast(1); }
  35% { transform: scale(1.1) rotate(-0.4deg); filter: brightness(1.3) contrast(1.12); }
  100% { transform: scale(1); filter: brightness(1) contrast(1); }
}

.launch-camera-hint {
  position: absolute;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.45);
  letter-spacing: 0.1em;
  z-index: 2;
}

.launch-camera-text.launch-standby-text {
  font-size: clamp(3.5rem, 16vw, 8rem);
  color: var(--gold);
  -webkit-text-stroke: 3px rgba(34, 17, 0, 0.45);
  opacity: 0.38;
  text-shadow: 0 0 20px rgba(255, 214, 10, 0.18);
  animation: standbyPulse 1.8s ease-in-out infinite;
}

.launch-camera-text.launch-standby-text::before {
  opacity: 0.18;
}

@keyframes standbyPulse {
  0%, 100% { opacity: 0.28; transform: skewX(-10deg) rotate(-3deg) scale(1); }
  50% { opacity: 0.48; transform: skewX(-10deg) rotate(-3deg) scale(1.03); }
}

.btn-start-countdown {
  position: absolute;
  bottom: 3.25rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 4;
  pointer-events: auto;
  font-family: var(--font-display);
  font-size: clamp(0.85rem, 2.5vw, 1rem);
  font-weight: 800;
  letter-spacing: 0.06em;
  padding: 0.85rem 1.5rem;
  min-height: 48px;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  color: #000;
  background: linear-gradient(135deg, var(--gold), #e6a800);
  box-shadow: 0 4px 28px rgba(255, 214, 10, 0.45);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.btn-start-countdown[hidden] { display: none; }

body.launch-standby .launch-halftone {
  opacity: 0.08;
}

body.launch-standby .launch-camera-vignette {
  background: radial-gradient(ellipse at center, transparent 45%, rgba(0, 0, 0, 0.45) 100%);
}

.btn-relaunch {
  position: fixed;
  top: max(1rem, env(safe-area-inset-top));
  right: max(1rem, env(safe-area-inset-right));
  z-index: 960;
  font-family: var(--font-display);
  font-size: clamp(0.75rem, 2.2vw, 0.95rem);
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 0.65rem 1rem;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(135deg, var(--red), #cc0033);
  box-shadow: 0 4px 24px rgba(255, 45, 85, 0.45);
  transition: transform 0.15s, filter 0.15s;
}

.btn-relaunch[hidden] { display: none; }

.btn-relaunch:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

body.launch-active.launch-countdown .btn-relaunch {
  display: none !important;
}

/* Exit (top-right) + relaunch (bottom-center) in launch-live */
body.launch-active.launch-live .btn-relaunch {
  top: auto;
  bottom: max(5.25rem, calc(env(safe-area-inset-bottom) + 4.5rem));
  left: 50%;
  right: auto;
  transform: translateX(-50%);
  padding: 0.55rem 1.1rem;
  font-size: clamp(0.72rem, 2vw, 0.88rem);
  max-width: min(52vw, 14rem);
  white-space: nowrap;
  z-index: 956;
}

body.launch-active.launch-live .btn-relaunch:hover:not(:disabled) {
  transform: translateX(-50%) translateY(-1px);
}

body.launch-active.launch-live .btn-exit-launch {
  top: max(0.75rem, env(safe-area-inset-top));
  right: max(0.75rem, env(safe-area-inset-right));
  left: auto;
}

body.launch-active.launch-live .rec-badge {
  top: max(0.75rem, env(safe-area-inset-top));
  bottom: auto;
  left: max(0.75rem, env(safe-area-inset-left));
}

body.launch-active.launch-live .launch-camera-hint {
  bottom: calc(5.5rem + env(safe-area-inset-bottom));
}

body.launch-active .rec-badge {
  top: 1.25rem;
  left: 1.25rem;
  font-size: 0.85rem;
  padding: 0.45rem 0.85rem;
}

#camera-feed {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}

#camera-feed.active { display: block; }
#camera-feed.mirrored { transform: scaleX(-1); }

#camera-feed-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

#camera-feed-img.mirrored { transform: scaleX(-1); }

.cam-source-select { max-width: 220px; }

.cam-sub-panel {
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.cam-sub-panel[hidden] { display: none; }

.cam-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
  width: 100%;
  margin: 0;
  line-height: 1.4;
}

.cam-hint-dji-usb {
  color: var(--blue);
  background: rgba(0, 212, 255, 0.08);
  border: 1px solid rgba(0, 212, 255, 0.25);
  border-radius: 8px;
  padding: 0.5rem 0.65rem;
}

.remote-cam-layout {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  width: 100%;
}

.remote-qr {
  border-radius: 8px;
  background: #fff;
  flex-shrink: 0;
}

.remote-cam-info {
  flex: 1;
  min-width: 0;
  font-size: 0.85rem;
}

.remote-cam-info strong {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--gold);
  letter-spacing: 0.15em;
}

.dji-status {
  margin-top: 0.35rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.dji-steps {
  margin: 0.35rem 0 0;
  padding-left: 1.1rem;
}

.dji-steps li + li {
  margin-top: 0.25rem;
}

.remote-quick-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--blue);
  margin: 0 0 0.35rem;
}

.remote-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.35rem;
}

.cam-hint-compact {
  font-size: 0.68rem;
  opacity: 0.75;
  word-break: break-all;
}

.remote-help {
  width: 100%;
  margin-top: 0.25rem;
}

.remote-help summary {
  font-size: 0.75rem;
  color: var(--text-muted);
  cursor: pointer;
}

.remote-status {
  margin-top: 0.35rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.host-secure-warn {
  flex: 1 1 100%;
  background: rgba(255, 45, 85, 0.12);
  border: 1px solid var(--red);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
  line-height: 1.5;
  color: #ffb3c0;
}

.host-secure-warn[hidden] { display: none; }

.host-secure-warn strong { color: var(--red); }

.host-secure-warn a { color: var(--blue); }

.cam-url-row {
  display: flex;
  gap: 0.5rem;
  width: 100%;
}

.cam-url-input {
  flex: 1;
  min-width: 0;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  font-family: var(--font-body);
  font-size: 0.8rem;
}

body.launch-active #camera-feed-img {
  animation: camZoomIn 0.55s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  transform-origin: center center;
}

body.launch-active #camera-feed-img.mirrored {
  animation: camZoomInMirror 0.55s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.camera-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  color: var(--text-muted);
  text-align: center;
  padding: 2rem;
}

.camera-placeholder.hidden { display: none; }

.placeholder-icon { font-size: 3rem; opacity: 0.5; }

.scanlines {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.08) 2px,
    rgba(0, 0, 0, 0.08) 4px
  );
  pointer-events: none;
}

.rec-badge {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: #fff;
  background: rgba(255, 45, 85, 0.85);
  padding: 0.3rem 0.6rem;
  border-radius: 4px;
  animation: recBlink 1.5s ease infinite;
}

.rec-badge[data-hint]::after {
  content: ' · ' attr(data-hint);
  font-weight: 600;
  opacity: 0.9;
  letter-spacing: 0.04em;
}

.rec-dot {
  width: 8px;
  height: 8px;
  background: #fff;
  border-radius: 50%;
}

@keyframes recBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* Battle log */
.battle-log {
  list-style: none;
  max-height: 280px;
  overflow-y: auto;
  padding: 0.75rem;
}

.battle-log li {
  padding: 0.5rem 0.75rem;
  border-left: 3px solid var(--border);
  margin-bottom: 0.4rem;
  font-size: 0.9rem;
  animation: logSlide 0.3s ease;
}

@keyframes logSlide {
  from { opacity: 0; transform: translateX(-10px); }
  to { opacity: 1; transform: translateX(0); }
}

.battle-log li.red { border-left-color: var(--red); }
.battle-log li.blue { border-left-color: var(--blue); }
.battle-log li.system { border-left-color: var(--gold); color: var(--text-muted); font-style: italic; }

.battle-log .log-time {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-right: 0.5rem;
}

.battle-log .log-points {
  font-weight: 700;
  color: var(--gold);
}

.battle-log .log-score {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--gold);
  white-space: nowrap;
}

.battle-log .log-vs {
  font-family: var(--font-display);
  font-size: 0.78em;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin: 0 0.2rem;
}

.battle-log li.log-section {
  border-left-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.03);
  font-style: normal;
  font-weight: 600;
  color: var(--text);
  text-align: center;
  letter-spacing: 0.04em;
}

.battle-log li.log-result {
  border-left-width: 4px;
  background: rgba(255, 214, 10, 0.08);
  font-style: normal;
  font-weight: 600;
  color: var(--text);
  padding: 0.65rem 0.85rem;
}

.battle-log li.log-result.red { border-left-color: var(--red); }
.battle-log li.log-result.blue { border-left-color: var(--blue); }

/* Battle replay */
.replay-panel-full {
  min-height: calc(100vh - 9rem);
  min-height: calc(100dvh - 9rem);
}

.replay-count-badge {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  vertical-align: middle;
  background: rgba(255, 214, 10, 0.15);
  color: var(--gold);
}

.replay-sync-status {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 600;
  vertical-align: middle;
}

.replay-sync-status[data-status="idle"],
.replay-sync-status:empty {
  display: none;
}

.replay-sync-status[data-status="synced"] {
  background: rgba(52, 199, 89, 0.15);
  color: #34c759;
}

.replay-sync-status[data-status="syncing"] {
  background: rgba(0, 212, 255, 0.15);
  color: var(--blue);
}

.replay-sync-status[data-status="pending"] {
  background: rgba(255, 214, 10, 0.15);
  color: var(--gold);
}

.replay-hint {
  padding: 0 1rem 0.75rem;
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.replay-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  align-items: start;
}

.replay-main {
  min-width: 0;
}

.replay-list {
  list-style: none;
  padding: 0 0.75rem 1rem;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.replay-match-group {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: rgba(255, 255, 255, 0.02);
}

.replay-match-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 214, 10, 0.05);
}

.replay-match-title {
  font-weight: 700;
  flex: 1 1 160px;
}

.replay-match-meta {
  flex: 1 1 100%;
  font-size: 0.82rem;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.replay-match-actions {
  display: flex;
  gap: 0.35rem;
  margin-left: auto;
}

.btn-replay-match-play {
  font-size: 0.78rem;
  padding: 0.35rem 0.65rem;
}

.replay-rounds {
  list-style: none;
  margin: 0;
  padding: 0.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.replay-round-item {
  display: flex;
  align-items: stretch;
  gap: 0.35rem;
}

.replay-round-item .replay-item-btn {
  flex: 1;
  min-width: 0;
}

.replay-item-thumb {
  width: 56px;
  height: 42px;
  object-fit: cover;
  border-radius: 6px;
  background: #000;
  flex-shrink: 0;
  align-self: center;
}

.btn-replay-delete {
  align-self: center;
  padding: 0.25rem 0.45rem;
  opacity: 0.65;
}

.btn-replay-delete:hover { opacity: 1; }

.sync-conflict-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sync-conflict-modal[hidden] { display: none; }

.sync-conflict-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
}

.sync-conflict-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  max-width: 360px;
  width: calc(100% - 2rem);
}

.sync-conflict-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 1rem;
}

.battle-log-stats {
  margin: 0 0 0.5rem;
  font-size: 0.75rem;
  color: var(--muted);
}

.panel-header-actions {
  display: flex;
  gap: 0.35rem;
}

.replay-round-item .replay-item-btn {
  border-radius: calc(var(--radius) - 2px);
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-rows: auto auto;
  gap: 0.15rem 0.65rem;
  align-items: center;
}

.replay-round-item.is-active .replay-item-btn {
  border-color: var(--gold);
  background: rgba(255, 214, 10, 0.08);
}

.replay-item-badge {
  grid-row: 1 / span 2;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 2.4rem;
  height: 2.4rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.06);
  color: var(--gold);
}

.replay-item-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
}

.replay-item-meta {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.replay-item-delta {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
}

.replay-item-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.replay-finish-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  font-size: 0.68rem;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
}

.replay-finish-chip--p1 {
  border: 1px solid rgba(255, 59, 92, 0.35);
  color: var(--red);
}

.replay-finish-chip--p2 {
  border: 1px solid rgba(0, 212, 255, 0.35);
  color: var(--blue);
}

.replay-item-time {
  grid-column: 3;
  grid-row: 1 / span 2;
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.replay-item-video {
  font-size: 0.68rem;
  padding: 0.08rem 0.35rem;
  border-radius: 999px;
  background: rgba(0, 212, 255, 0.12);
  color: var(--blue);
}

.replay-round-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
}

.replay-round-tab {
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.78rem;
  cursor: pointer;
}

.replay-round-tab.active,
.replay-round-tab:hover {
  border-color: var(--gold);
  color: var(--text);
  background: rgba(255, 214, 10, 0.08);
}

.replay-empty {
  padding: 2.5rem 1rem;
  text-align: center;
  color: var(--text-muted);
}

.replay-empty-icon {
  display: block;
  font-size: 2rem;
  margin-bottom: 0.5rem;
  opacity: 0.6;
}

.replay-item-btn {
  width: 100%;
  text-align: left;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.replay-item-btn:hover {
  border-color: var(--gold);
  background: rgba(255, 214, 10, 0.06);
}

.replay-tag {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-style: normal;
  background: rgba(0, 212, 255, 0.15);
  color: var(--blue);
}

.replay-tag-win {
  background: rgba(255, 214, 10, 0.15);
  color: var(--gold);
}

.replay-player {
  margin: 0 0.75rem 1rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.25);
}

.replay-sidebar {
  position: sticky;
  top: 0.75rem;
}

.replay-video-wrap {
  margin-bottom: 0.75rem;
}

.replay-player-viewport {
  overflow: hidden;
  border-radius: calc(var(--radius) - 2px) calc(var(--radius) - 2px) 0 0;
  background: #000;
  line-height: 0;
}

.replay-theater-viewport {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}

.replay-theater-viewport .replay-theater-video {
  position: relative;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.replay-video {
  display: block;
  width: 100%;
  max-height: 220px;
  background: #000;
  margin-bottom: 0;
  transition: transform 0.15s ease;
}

.replay-video[hidden] { display: none; }

.replay-player-bar {
  padding: 0.4rem 0.5rem 0.5rem;
  border-radius: 0 0 calc(var(--radius) - 2px) calc(var(--radius) - 2px);
  background: rgba(0, 0, 0, 0.88);
  border: 1px solid var(--border);
  border-top: none;
}

.replay-player-bar[hidden] {
  display: none;
}

.replay-player-speed-row {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.35rem;
}

.btn-replay-player-zoom {
  padding: 0.3rem 0.55rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-family: var(--font-body);
  font-size: 0.78rem;
  cursor: pointer;
  white-space: nowrap;
}

.btn-replay-player-zoom:hover {
  background: rgba(255, 255, 255, 0.16);
}

.btn-replay-player-zoom.is-active {
  border-color: var(--gold, #ffd166);
  color: var(--gold, #ffd166);
}

.replay-player-speed {
  min-width: 5.5rem;
  padding: 0.3rem 0.55rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-family: var(--font-body);
  font-size: 0.8rem;
  cursor: pointer;
}

.replay-player-progress {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.replay-player-progress--wide {
  padding: 0.45rem 0.65rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(8px);
}

.btn-replay-player-play {
  flex: 0 0 auto;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 0.85rem;
  line-height: 1;
  cursor: pointer;
}

.btn-replay-player-play:hover {
  background: rgba(255, 255, 255, 0.22);
}

.replay-player-time {
  flex: 0 0 auto;
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  color: rgba(255, 255, 255, 0.75);
  min-width: 2.2rem;
}

.replay-player-scrubber {
  flex: 1 1 auto;
  min-width: 0;
  height: 0.35rem;
  accent-color: var(--gold, #ffd166);
  cursor: pointer;
}

.replay-player-meta h3 {
  margin: 0 0 0.25rem;
  font-size: 1rem;
  line-height: 1.35;
}

.replay-player-meta p {
  margin: 0 0 0.75rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.replay-events {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
  max-height: 180px;
  overflow-y: auto;
}

.replay-events[hidden] { display: none; }

.replay-event-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.55rem;
  border-radius: calc(var(--radius) - 2px);
  background: rgba(255, 255, 255, 0.03);
  font-size: 0.8rem;
}

.replay-event-row--p1 { border-left: 3px solid var(--red); }
.replay-event-row--p2 { border-left: 3px solid var(--blue); }

.replay-event-time {
  min-width: 2.5rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.replay-event-label {
  flex: 1;
  min-width: 0;
}

.replay-event-points {
  font-weight: 700;
  color: var(--gold);
}

.replay-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

body.replay-playing .btn-finish {
  pointer-events: none;
  opacity: 0.45;
}

/* Fullscreen replay theater */
.replay-theater {
  position: fixed;
  inset: 0;
  z-index: 12000;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.replay-theater[hidden] { display: none; }

.replay-theater-backdrop {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(255, 59, 92, 0.18), transparent 55%),
    radial-gradient(ellipse at 80% 50%, rgba(0, 212, 255, 0.18), transparent 55%),
    linear-gradient(180deg, #0a0a12 0%, #12121f 50%, #0a0a12 100%);
}

.replay-theater--no-video .replay-theater-backdrop {
  display: flex;
}

.replay-theater-backdrop-label {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 4vw, 2rem);
  letter-spacing: 0.2em;
  color: rgba(255, 255, 255, 0.35);
  text-transform: uppercase;
}

.replay-theater-video {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  transition: transform 0.15s ease;
}

.replay-theater-video:not([src]),
.replay-theater-video.no-video {
  display: none;
}

.replay-theater-vignette {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    linear-gradient(to top, rgba(0, 0, 0, 0.82) 0%, transparent 38%),
    linear-gradient(to bottom, rgba(0, 0, 0, 0.45) 0%, transparent 22%);
}

.replay-theater-footer {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 4.75rem;
  z-index: 4;
  display: flex;
  flex-direction: column;
  pointer-events: none;
}

.replay-theater-hud {
  position: relative;
  left: auto;
  right: auto;
  bottom: auto;
  z-index: 1;
  padding: 1rem 1rem 0.35rem;
  text-align: center;
  pointer-events: none;
  contain: layout style;
}

.replay-theater-chrome {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  pointer-events: none;
  padding: 0 0.75rem max(0.65rem, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.35rem;
}

.replay-theater-chrome[hidden] {
  display: none;
}

.replay-theater-chrome .replay-player-speed-row,
.replay-theater-chrome .replay-player-progress {
  pointer-events: auto;
}

.replay-theater-chrome .replay-player-speed-row {
  justify-content: flex-end;
  padding-right: max(0, env(safe-area-inset-right));
}

.replay-theater-chrome .replay-player-progress--wide {
  width: 100%;
  box-sizing: border-box;
}

.replay-hud-battle {
  margin: 0 0 0.5rem;
  font-family: var(--font-display);
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  color: var(--gold);
  min-height: 1.2em;
}

.replay-hud-scores {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 0.35rem;
  width: 100%;
  max-width: 420px;
  margin-left: auto;
  margin-right: auto;
}

.replay-hud-player {
  flex: 0 0 140px;
  width: 140px;
  min-width: 140px;
  max-width: 140px;
  padding: 0.55rem 0.65rem;
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-sizing: border-box;
  overflow: hidden;
}

.replay-hud-player span {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 0.15rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.replay-hud-player strong {
  display: block;
  width: 100%;
  text-align: center;
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 7vw, 2.5rem);
  line-height: 1;
  min-height: 2.5rem;
  font-variant-numeric: tabular-nums;
  transform: translateZ(0);
}

.replay-hud-player strong.replay-hud-pop {
  animation: replayHudScorePop 0.42s cubic-bezier(0.22, 1.2, 0.36, 1);
}

@keyframes replayHudScorePop {
  0% { filter: brightness(1); }
  40% { filter: brightness(1.55); }
  100% { filter: brightness(1); }
}

.replay-hud-red strong { color: var(--red); }
.replay-hud-blue strong { color: var(--blue); }

.replay-hud-vs {
  flex: 0 0 auto;
  font-family: var(--font-display);
  font-size: 0.9rem;
  color: var(--text-muted);
}

.replay-hud-label {
  margin: 0;
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.75);
  min-height: 1.25em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.replay-theater-active {
  overflow: hidden;
}

body.replay-theater-active #fx-layer {
  z-index: 12050;
  bottom: 12rem;
  height: auto;
}

body.replay-theater-active.shake,
body.replay-theater-active.shake-heavy,
body.replay-theater-active.shake-go-shoot {
  animation: none !important;
  transform: none !important;
}

.replay-theater.shake { animation: screenShake 0.4s ease; }
.replay-theater.shake-heavy { animation: screenShakeHeavy 0.65s ease; }
.replay-theater.shake-go-shoot { animation: screenShakeGoShoot 1.1s cubic-bezier(0.22, 1, 0.36, 1); }

.btn-replay-theater-stop {
  position: absolute;
  top: max(0.75rem, env(safe-area-inset-top));
  right: max(0.75rem, env(safe-area-inset-right));
  z-index: 4;
  pointer-events: auto;
}

body.replay-theater-active .app-nav,
body.replay-theater-active .arena-header {
  visibility: hidden;
}

@media (max-width: 768px) {
  .replay-hud-scores { max-width: 100%; gap: 0.65rem; }
  .replay-hud-player {
    flex-basis: 118px;
    width: 118px;
    min-width: 118px;
    max-width: 118px;
    padding: 0.45rem 0.5rem;
  }
  .replay-hud-player strong { font-size: 2rem; min-height: 2rem; }
}

@media (min-width: 900px) {
  .replay-layout {
    grid-template-columns: minmax(0, 1fr) min(380px, 38%);
    gap: 0.75rem;
    padding: 0 0.75rem 1rem;
  }

  .replay-list {
    padding: 0;
  }

  .replay-player {
    margin: 0;
  }

  .replay-sidebar:not([hidden]) {
    max-height: calc(100dvh - 10rem);
    overflow-y: auto;
  }

  .replay-video {
    max-height: 200px;
  }
}

@media (max-width: 768px) {
  .replay-panel-full {
    min-height: calc(100vh - 9rem);
    min-height: calc(100dvh - 9rem);
  }

  .replay-match-header {
    flex-direction: column;
    align-items: stretch;
  }

  .replay-match-actions {
    margin-left: 0;
  }

  .replay-round-item .replay-item-btn {
    grid-template-columns: auto 1fr;
  }

  .replay-item-time {
    grid-column: 2;
    grid-row: auto;
  }
}

/* Victory overlay */
.victory-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  backdrop-filter: blur(8px);
  animation: fadeIn 0.4s ease;
  padding: 1rem;
  overflow-y: auto;
}

.victory-overlay[hidden] { display: none; }

/* Keep header controls (e.g. 重置對戰) clickable above the victory overlay */
body.victory-open .arena-header {
  z-index: 2100;
}

.victory-overlay-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  width: min(100%, 420px);
}

.victory-overlay--tournament .victory-overlay-inner {
  width: min(100%, 920px);
  flex-direction: row;
  align-items: stretch;
  text-align: left;
}

.victory-overlay--tournament .victory-content {
  flex: 0 0 min(100%, 340px);
  text-align: center;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.victory-content {
  text-align: center;
  padding: 3rem;
  animation: victoryScale 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes victoryScale {
  from { transform: scale(0.5); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.victory-label {
  font-family: var(--font-display);
  font-size: 1rem;
  letter-spacing: 0.3em;
  color: var(--gold);
  margin-bottom: 0.5rem;
}

.victory-content h2 {
  font-family: var(--font-display);
  font-size: 3rem;
  font-weight: 900;
  background: linear-gradient(135deg, var(--gold), #fff, var(--gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.5rem;
}

.victory-detail {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.victory-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
}

.victory-schedule-panel {
  flex: 1;
  min-width: 0;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.1rem 1.15rem;
  max-height: min(70vh, 520px);
  overflow-y: auto;
  animation: victoryScale 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.victory-schedule-panel[hidden] { display: none; }

.victory-schedule-title {
  font-family: var(--font-display);
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  margin-bottom: 0.65rem;
  color: var(--blue);
}

.victory-schedule-meta {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0.85rem;
}

.victory-schedule-bar {
  flex: 1;
  height: 5px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
}

.victory-schedule-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--blue), var(--gold));
  border-radius: 999px;
}

.victory-schedule-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.victory-schedule-item {
  width: 100%;
  text-align: left;
  font-family: var(--font-body);
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.7rem 0.85rem;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.victory-schedule-item.recommended {
  border-color: var(--blue);
  box-shadow: 0 0 0 1px rgba(0, 212, 255, 0.25);
}

.victory-schedule-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.victory-schedule-label {
  font-weight: 700;
  font-size: 0.88rem;
}

.victory-schedule-tag {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--blue);
  background: rgba(0, 212, 255, 0.15);
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  white-space: nowrap;
}

.victory-schedule-players {
  font-size: 0.92rem;
  color: var(--text-muted);
}

.victory-schedule-message {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.5;
  padding: 0.65rem 0.75rem;
  background: var(--bg-deep);
  border-radius: 10px;
  border: 1px dashed var(--border);
}

.victory-schedule-message.done-all {
  color: var(--gold);
  border-color: rgba(255, 214, 10, 0.35);
  text-align: center;
}

@media (max-width: 768px) {
  .victory-overlay--tournament .victory-overlay-inner {
    flex-direction: column;
    width: min(100%, 420px);
  }

  .victory-schedule-panel {
    max-height: none;
  }
}

@media (hover: hover) and (pointer: fine) {
  .victory-schedule-item:hover {
    border-color: var(--blue);
    transform: translateY(-1px);
  }
}

.victory-schedule-item:active {
  transform: scale(0.98);
}

/* Finish center announcement */
.finish-announce {
  position: fixed;
  inset: 0;
  z-index: 1800;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  isolation: isolate;
  transition: opacity 0.18s ease;
}

.finish-announce[hidden] {
  display: none;
}

.finish-announce.show {
  opacity: 1;
}

.finish-announce-backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at center, rgba(255, 255, 255, 0.22) 0%, rgba(0, 0, 0, 0.42) 34%, transparent 68%),
    repeating-linear-gradient(90deg, transparent 0 18px, rgba(255, 255, 255, 0.05) 19px 20px);
  mix-blend-mode: screen;
  opacity: 0;
}

.finish-announce.show .finish-announce-backdrop {
  animation: finishBackdropBlast 1.45s ease-out forwards;
}

.finish-announce-inner {
  position: relative;
  text-align: center;
  padding: clamp(1.25rem, 3vw, 2.4rem) clamp(1.5rem, 5vw, 4rem);
  transform: scale(0.35) translateY(26px) rotate(-5deg);
  opacity: 0;
  animation: none;
  filter: drop-shadow(0 18px 34px rgba(0, 0, 0, 0.72));
}

.finish-announce.show .finish-announce-inner {
  animation:
    finishAnnouncePop 0.72s cubic-bezier(0.16, 1.45, 0.26, 1) forwards,
    finishAnnounceShake 0.16s steps(2, end) 0.12s 5;
}

@keyframes finishAnnouncePop {
  0% {
    transform: scale(0.25) translateY(50px) rotate(-9deg);
    opacity: 0;
    filter: blur(8px) brightness(2.2);
  }
  28% {
    transform: scale(1.34) translateY(-8px) rotate(3deg);
    opacity: 1;
    filter: blur(0) brightness(1.8);
  }
  58% {
    transform: scale(0.94) translateY(0) rotate(-1deg);
    opacity: 1;
  }
  100% {
    transform: scale(1) translateY(0) rotate(0);
    opacity: 1;
  }
}

@keyframes finishAnnounceShake {
  0%, 100% { margin-left: 0; }
  50% { margin-left: 10px; }
}

@keyframes finishBackdropBlast {
  0% { opacity: 0; transform: scale(0.7); }
  18% { opacity: 1; transform: scale(1.06); }
  100% { opacity: 0.18; transform: scale(1.35); }
}

.finish-announce-player {
  margin: 0 0 0.35rem;
  font-family: var(--font-display);
  font-size: clamp(0.9rem, 2.2vw, 1.25rem);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  opacity: 0.85;
}

.finish-announce-en {
  margin: 0;
  font-family: 'Bangers', 'Bebas Neue', var(--font-display);
  font-size: clamp(4.2rem, 14vw, 10.5rem);
  line-height: 0.82;
  letter-spacing: 0.065em;
  text-transform: uppercase;
  -webkit-text-stroke: clamp(1px, 0.35vw, 4px) rgba(255, 255, 255, 0.92);
  text-shadow:
    0 0 20px currentColor,
    0 7px 0 rgba(0, 0, 0, 0.72),
    0 0 54px currentColor,
    0 0 110px currentColor;
}

.finish-announce-zh {
  margin: 0.65rem 0 0;
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 3.6vw, 1.8rem);
  letter-spacing: 0.18em;
  opacity: 0.9;
}

.finish-announce-points {
  margin: 0.8rem 0 0;
  font-family: var(--font-display);
  font-size: clamp(2.8rem, 8vw, 5.6rem);
  font-weight: 900;
  letter-spacing: 0.08em;
  color: var(--gold);
  text-shadow:
    0 0 18px #fff,
    0 0 44px rgba(255, 214, 10, 0.95),
    0 5px 0 rgba(0, 0, 0, 0.65);
}

.finish-announce--p1 .finish-announce-player { color: var(--red); }
.finish-announce--p2 .finish-announce-player { color: var(--blue); }

.finish-announce--extreme .finish-announce-en {
  color: #d86bff;
  text-shadow:
    0 0 22px #fff,
    0 0 48px #d86bff,
    0 0 90px #ffd60a,
    0 7px 0 rgba(0, 0, 0, 0.72);
}

.finish-announce--burst .finish-announce-en {
  color: #ff174f;
}

.finish-announce--over .finish-announce-en {
  color: #ffe042;
}

.finish-announce--spin .finish-announce-en {
  color: #00e7ff;
}

body.launch-active .finish-announce {
  z-index: 1900;
}

body.replay-theater-active .finish-announce {
  z-index: 12100;
}

/* Finish toast */
.finish-toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--bg-panel);
  border: 2px solid var(--gold);
  padding: 1rem 2rem;
  border-radius: 12px;
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  z-index: 1500;
  box-shadow: 0 0 40px rgba(255, 214, 10, 0.3);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.finish-toast.show {
  transform: translateX(-50%) translateY(0);
}

.finish-toast[hidden] { display: block; visibility: hidden; }
.finish-toast.show { visibility: visible; }

/* ─── Tournament panel ─── */
.tournament-panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  min-height: calc(100vh - 11rem);
  display: flex;
  flex-direction: column;
}

.tournament-body {
  display: grid;
  grid-template-columns: minmax(200px, 260px) 1fr;
  gap: 0;
  flex: 1;
  min-height: 320px;
}

.tournament-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
}

.tournament-header h2 {
  font-family: var(--font-display);
  font-size: 0.85rem;
  letter-spacing: 0.1em;
}

.tournament-rundown-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.35rem 0.75rem;
  padding: 0.45rem 1rem 0.65rem;
  border-bottom: 1px solid var(--border);
}

.tournament-rundown {
  margin: 0;
  flex: 1 1 16rem;
  min-width: 0;
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.schedule-rules-edit {
  flex: 0 0 auto;
  font-size: 0.72rem;
}

.schedule-rules-edit-toggle {
  cursor: pointer;
  color: var(--blue);
  list-style: none;
  user-select: none;
}

.schedule-rules-edit-toggle::-webkit-details-marker {
  display: none;
}

.schedule-rules-edit[open] .schedule-rules-edit-toggle {
  margin-bottom: 0.45rem;
}

.schedule-rules-edit-panel {
  min-width: min(100%, 22rem);
}

.schedule-rules-edit-panel textarea {
  display: block;
  width: 100%;
  min-height: 4.5rem;
  margin-bottom: 0.45rem;
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
  font: inherit;
  line-height: 1.45;
  resize: vertical;
}

.schedule-rules-edit-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.schedule-rules-edit-hint {
  margin: 0.35rem 0 0;
  font-size: 0.65rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.player-qr-card {
  margin: 0;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  background: rgba(0, 212, 255, 0.04);
}

.player-qr-card-inner {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.player-qr-img {
  flex-shrink: 0;
  border-radius: 8px;
  background: #fff;
  padding: 4px;
}

.player-qr-meta {
  flex: 1;
  min-width: 0;
}

.player-qr-title {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
}

.player-qr-hint {
  margin: 0 0 0.5rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.player-qr-link {
  margin: 0 0 0.5rem;
  font-size: 0.72rem;
  word-break: break-all;
  color: var(--blue);
  font-family: ui-monospace, monospace;
}

@media print {
  .player-qr-card {
    break-inside: avoid;
    border: 1px solid #ccc;
    background: #fff;
    color: #000;
  }
  .player-qr-hint { color: #333; }
  .player-qr-link { color: #000; }
}

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

.tournament-tools-menu {
  position: relative;
}

.tournament-tools-menu > summary {
  list-style: none;
  cursor: pointer;
}

.tournament-tools-menu > summary::-webkit-details-marker {
  display: none;
}

.tournament-tools-panel {
  position: absolute;
  top: calc(100% + 0.35rem);
  right: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 9rem;
  padding: 0.45rem;
  border-radius: 8px;
  background: var(--bg-panel, #1a1a22);
  border: 1px solid var(--border);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.tournament-tools-panel .btn {
  justify-content: flex-start;
  width: 100%;
}

.tournament-tools-danger {
  color: #f87171;
}

.player-qr-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  margin-top: 0.35rem;
}

.player-qr-more {
  position: relative;
}

.player-qr-more > summary {
  list-style: none;
  cursor: pointer;
}

.player-qr-more > summary::-webkit-details-marker {
  display: none;
}

.player-qr-more-panel {
  position: absolute;
  top: calc(100% + 0.25rem);
  left: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.4rem;
  border-radius: 8px;
  background: var(--bg-panel, #1a1a22);
  border: 1px solid var(--border);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
}

.player-qr-more-panel .btn {
  white-space: nowrap;
}

.screen-share-panel {
  margin-top: 0.75rem;
  padding-top: 0.65rem;
  border-top: 1px dashed rgba(255, 255, 255, 0.1);
}

.screen-share-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}

.screen-share-status {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted, #8b95a8);
}

.screen-share-status[data-state="live"] {
  color: var(--blue, #00d4ff);
}

.screen-share-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.screen-share-link {
  margin: 0.4rem 0 0;
  font-size: 0.72rem;
  color: var(--gold, #ffd60a);
  word-break: break-all;
  line-height: 1.35;
}

.screen-share-hint {
  margin: 0.35rem 0 0;
  font-size: 0.7rem;
  color: var(--text-muted, #8b95a8);
  line-height: 1.4;
}

.draw-badge {
  font-size: 0.72rem;
  padding: 0.25rem 0.55rem;
  border-radius: 4px;
  background: var(--bg-deep);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.draw-badge.drawn {
  color: var(--gold);
  border-color: var(--gold);
}

.tournament-sync-status {
  font-size: 0.68rem;
  padding: 0.25rem 0.55rem;
  border-radius: 4px;
  background: var(--bg-deep);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.tournament-sync-status[data-status="synced"] {
  color: #6ee7a0;
  border-color: rgba(110, 231, 160, 0.35);
}

.tournament-sync-status[data-status="syncing"] {
  color: var(--gold);
  border-color: rgba(255, 200, 80, 0.35);
}

.tournament-sync-status[data-status="offline"],
.tournament-sync-status[data-status="local"] {
  color: var(--text-muted);
}

.tournament-sync-status[data-status="error"] {
  color: #f87171;
  border-color: rgba(248, 113, 113, 0.35);
}

.cloud-sync-status[data-status="synced"] {
  color: #6ee7a0;
  border-color: rgba(110, 231, 160, 0.35);
}

.cloud-sync-status[data-status="error"] {
  color: #f87171;
  border-color: rgba(248, 113, 113, 0.35);
}

.roster-panel {
  padding: 0.85rem;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.roster-toolbar { display: flex; flex-direction: column; gap: 0.5rem; }

.roster-count {
  font-family: var(--font-display);
  font-size: 0.8rem;
  color: var(--gold);
}

.roster-add-row {
  display: flex;
  gap: 0.4rem;
}

.roster-add-row input {
  flex: 1;
  min-width: 0;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.4rem 0.5rem;
  border-radius: 6px;
  font-family: var(--font-body);
}

.roster-list {
  list-style: none;
  max-height: min(420px, 50vh);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.roster-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--bg-deep);
  border-radius: 6px;
  padding: 0.25rem 0.4rem;
}

.roster-num {
  font-family: var(--font-display);
  font-size: 0.7rem;
  color: var(--text-muted);
  width: 1.25rem;
  text-align: center;
  flex-shrink: 0;
}

.roster-name-input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.9rem;
  padding: 0.2rem;
}

.roster-name-input:focus { outline: none; border-bottom: 1px dashed var(--text-muted); }

.btn-icon {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  line-height: 1;
  padding: 0.15rem 0.35rem;
}

.bulk-import {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.bulk-import textarea {
  width: 100%;
  margin: 0.4rem 0;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 0.4rem;
  font-family: var(--font-body);
  resize: vertical;
}

.bracket-panel {
  padding: 0.85rem 1rem 1.25rem;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.bracket-title {
  font-family: var(--font-display);
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  margin-bottom: 0.75rem;
}

.bracket-session-hint {
  font-weight: 400;
  color: var(--text-muted);
  font-family: var(--font-body);
  letter-spacing: 0;
}

.bracket-view {
  flex: 1;
  overflow: visible;
  min-height: 0;
}

.bracket-empty {
  color: var(--text-muted);
  font-size: 0.95rem;
  text-align: center;
  padding: 3rem 1rem;
  background: var(--bg-deep);
  border-radius: 12px;
  border: 1px dashed var(--border);
}

/* Summary bar */
.bracket-summary {
  margin-bottom: 1rem;
  padding: 0.85rem 1rem;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.bracket-summary-stats {
  display: flex;
  gap: 1.25rem;
  margin-bottom: 0.65rem;
}

.bracket-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 3.5rem;
}

.bracket-stat-num {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--gold);
  line-height: 1;
}

.bracket-stat-label {
  font-size: 0.68rem;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  margin-top: 0.2rem;
}

.bracket-progress-bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.bracket-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--blue), var(--gold));
  border-radius: 999px;
  transition: width 0.35s ease;
}

.bracket-next-hint {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.45;
}

.bracket-next-hint strong { color: var(--blue); }
.bracket-next-hint.done-all { color: var(--gold); }

.bracket-next-link {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  text-align: left;
  line-height: inherit;
}

.bracket-next-link:hover strong { text-decoration: underline; }

/* Horizontal bracket board */
.bracket-board {
  display: flex;
  gap: 0.85rem;
  overflow-x: auto;
  padding-bottom: 0.75rem;
  margin-bottom: 1rem;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
}

.bracket-column {
  flex: 0 0 min(260px, 78vw);
  min-width: 220px;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
}

.bracket-column-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.35rem 0.5rem;
  padding: 0.55rem 0.75rem;
  margin-bottom: 0.6rem;
  border-radius: 10px;
  background: var(--bg-deep);
  border-left: 4px solid var(--border);
}

.phase-prelim .bracket-column-head { border-left-color: var(--blue); }
.phase-quarter .bracket-column-head { border-left-color: #5ac8fa; }
.phase-semi .bracket-column-head { border-left-color: var(--purple); }
.phase-final .bracket-column-head { border-left-color: var(--gold); }
.phase-revival .bracket-column-head { border-left-color: #bf5af2; }
.phase-challenge .bracket-column-head { border-left-color: var(--red); }

.bracket-column-title {
  font-family: var(--font-display);
  font-size: 0.88rem;
  letter-spacing: 0.06em;
  margin: 0;
}

.bracket-column-sub {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.bracket-column-progress {
  margin-left: auto;
  font-family: var(--font-display);
  font-size: 0.72rem;
  color: var(--gold);
  font-weight: 700;
}

.bracket-bye-list {
  list-style: none;
  margin: 0;
  padding: 0.5rem 0.65rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.bracket-bye-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  padding: 0.55rem 0.65rem;
  border-radius: 10px;
  background: rgba(90, 200, 250, 0.08);
  border: 1px dashed rgba(90, 200, 250, 0.35);
}

.bracket-bye-item .bracket-label {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.bracket-bye-player-edit {
  flex: 1 1 7rem;
  min-width: 0;
}

.bracket-bye-player-input {
  width: 100%;
  min-width: 0;
  padding: 0.3rem 0.4rem;
  border: 1px solid rgba(90, 200, 250, 0.3);
  border-radius: 6px;
  background: var(--bg-deep);
  color: var(--text);
  font: inherit;
}

.bracket-bye-hint {
  margin-left: auto;
  font-size: 0.72rem;
  color: #5ac8fa;
  font-weight: 600;
}

.bracket-r2-wait {
  margin: 0.5rem 0.65rem 0.75rem;
}

.phase-prelim-r2 .bracket-column-head {
  border-left-color: #64d2ff;
}

.bracket-column-wrap {
  flex: 0 0 min(260px, 78vw);
  min-width: 220px;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.bracket-column-gated {
  opacity: 0.92;
}

.bracket-gate-body {
  padding: 0.75rem;
  border-radius: 10px;
  background: var(--bg-deep);
  border: 1px dashed rgba(255, 255, 255, 0.12);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.bracket-gate-hint {
  margin: 0;
  font-size: 0.82rem;
  color: var(--gold);
  line-height: 1.45;
}

.bracket-gate-preview {
  margin: 0;
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.revival-loser-list {
  margin: 0;
  padding: 0 0 0 1rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.revival-loser-list li {
  margin: 0.2rem 0;
}

.bracket-next-hint.flow-hint {
  color: var(--text-muted);
  font-size: 0.78rem;
}

.challenge-manual {
  margin-top: 0.35rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.challenge-manual summary {
  cursor: pointer;
  user-select: none;
}

.bracket-extra {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0.85rem;
}

.bracket-extra-block {
  min-width: 0;
}

.bracket-matches {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin: 0;
  padding: 0;
}

.bracket-match {
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  font-size: 0.88rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.bracket-match.pending { border-color: rgba(255, 255, 255, 0.1); }
.bracket-match.active {
  border-color: var(--blue);
  box-shadow: 0 0 0 1px var(--blue), 0 0 20px rgba(0, 212, 255, 0.25);
}
.bracket-match.done {
  border-color: rgba(255, 214, 10, 0.35);
  background: rgba(255, 214, 10, 0.04);
}

.bracket-match-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.45rem;
}

.bracket-match-meta {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.bracket-score-badge {
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--gold);
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  background: rgba(255, 214, 10, 0.12);
  border: 1px solid rgba(255, 214, 10, 0.25);
}

.bracket-battle-badge {
  font-size: 0.62rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.bracket-label {
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.03em;
}

.bracket-status-badge {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  white-space: nowrap;
}

.bracket-status-badge.status-pending {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
}

.bracket-status-badge.status-active {
  background: rgba(0, 212, 255, 0.2);
  color: var(--blue);
}

.bracket-status-badge.status-done {
  background: rgba(255, 214, 10, 0.18);
  color: var(--gold);
}

.bracket-slots {
  display: flex;
  flex-direction: column;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  margin-bottom: 0.5rem;
}

.bracket-slots .slot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  padding: 0.5rem 0.65rem;
  background: rgba(255, 255, 255, 0.03);
  font-size: 0.92rem;
  min-height: 2.1rem;
}

.bracket-slots .slot.winner {
  background: rgba(255, 214, 10, 0.16);
  color: var(--gold);
  font-weight: 700;
}

.bracket-slots .slot.loser {
  opacity: 0.4;
}

.bracket-slots .slot.empty {
  color: var(--text-muted);
  font-style: italic;
  font-size: 0.82rem;
}

.bracket-slots .slot-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bracket-slots .slot-side-meta {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-shrink: 0;
}

.bracket-slots .slot-score {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 800;
  min-width: 1.1rem;
  text-align: center;
  color: var(--text-muted);
}

.bracket-slots .slot-score.win {
  color: var(--gold);
  text-shadow: 0 0 12px rgba(255, 214, 10, 0.35);
}

.bracket-slots .slot.winner .slot-score {
  color: var(--gold);
}

.bracket-slots .slot-crown {
  flex-shrink: 0;
  font-size: 0.85rem;
}

.bracket-slots .slot-divider {
  text-align: center;
  font-family: var(--font-display);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  padding: 0.15rem;
  background: rgba(0, 0, 0, 0.25);
}

.bracket-match.done .bracket-slots .slot-divider,
.bracket-match.active .bracket-slots .slot-divider {
  font-size: 0.78rem;
  color: var(--gold);
  letter-spacing: 0.08em;
}

.bracket-match .btn-load-match {
  width: 100%;
  justify-content: center;
}

.challenge-picker {
  margin-top: 0.65rem;
  padding: 0.65rem 0.75rem;
  background: rgba(191, 90, 242, 0.1);
  border: 1px solid rgba(191, 90, 242, 0.25);
  border-radius: 8px;
  font-size: 0.82rem;
  line-height: 1.45;
}

.challenge-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.35rem;
}

/* ─── Exit launch button (mobile touch alternative to Esc) ─── */
.btn-exit-launch {
  position: fixed;
  top: max(0.75rem, env(safe-area-inset-top));
  right: max(0.75rem, env(safe-area-inset-right));
  z-index: 1150;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.5rem 0.85rem;
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: background 0.15s, border-color 0.15s;
}

.btn-exit-launch[hidden] { display: none; }

.btn-cam-mirror {
  position: fixed;
  bottom: max(0.55rem, env(safe-area-inset-bottom));
  left: max(0.55rem, env(safe-area-inset-left));
  top: auto;
  z-index: 1140;
  width: 1.9rem;
  height: 1.9rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.28);
  color: rgba(255, 255, 255, 0.45);
  cursor: pointer;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0.55;
  transition: background 0.15s, border-color 0.15s, color 0.15s, opacity 0.15s;
}

.btn-cam-mirror[hidden] { display: none; }

.btn-cam-mirror.is-active {
  border-color: rgba(0, 212, 255, 0.4);
  background: rgba(0, 212, 255, 0.12);
  color: rgba(180, 235, 255, 0.85);
  opacity: 0.75;
}

.btn-cam-mirror:active {
  transform: scale(0.94);
  opacity: 0.9;
}

body.launch-active.launch-live .btn-cam-mirror {
  top: auto;
  bottom: max(0.55rem, env(safe-area-inset-bottom));
}

.btn-exit-launch:active {
  background: rgba(255, 45, 85, 0.7);
  border-color: var(--red);
}

/* ─── Hover rules (pointer devices only) ─── */
@media (hover: hover) and (pointer: fine) {
  .btn-finish:hover { background: var(--bg-panel-hover); transform: translateY(-1px); }
  .btn-finish.spin:hover { border-color: var(--blue); box-shadow: 0 0 16px var(--blue-glow); }
  .btn-finish.burst:hover { border-color: var(--red); box-shadow: 0 0 16px var(--red-glow); }
  .btn-finish.over:hover { border-color: var(--gold); box-shadow: 0 0 16px rgba(255, 214, 10, 0.4); }
  .btn-finish.extreme:hover { border-color: var(--purple); box-shadow: 0 0 16px rgba(191, 90, 242, 0.5); }
  .app-nav-btn:hover { color: var(--text); border-color: var(--text-muted); }
  .btn-primary:hover { filter: brightness(1.15); transform: translateY(-1px); }
  .btn-launch:hover { filter: brightness(1.1); }
  .btn-ghost:hover { border-color: var(--text); color: var(--text); }
  .btn-relaunch:hover:not(:disabled) { filter: brightness(1.12); transform: translateY(-1px); }
  .btn-icon:hover { color: var(--red); }
  .btn-exit-launch:hover { background: rgba(255, 45, 85, 0.5); border-color: var(--red); }
  .btn-cam-mirror:hover {
    opacity: 0.9;
    border-color: rgba(255, 255, 255, 0.35);
    color: rgba(255, 255, 255, 0.8);
  }
}

/* ─── Touch active feedback (all devices) ─── */
.btn-finish:active { transform: scale(0.96); }
.btn-finish.spin:active { border-color: var(--blue); box-shadow: 0 0 12px var(--blue-glow); }
.btn-finish.burst:active { border-color: var(--red); box-shadow: 0 0 12px var(--red-glow); }
.btn-finish.over:active { border-color: var(--gold); box-shadow: 0 0 12px rgba(255, 214, 10, 0.4); }
.btn-finish.extreme:active { border-color: var(--purple); box-shadow: 0 0 12px rgba(191, 90, 242, 0.5); }
.app-nav-btn:active { color: var(--text); border-color: var(--text-muted); transform: scale(0.96); }
.btn-primary:active { filter: brightness(1.15); }
.btn-launch:active { filter: brightness(1.1); }
.btn-ghost:active { border-color: var(--text); color: var(--text); }
.btn-sm:active { transform: scale(0.96); }

/* ─── Responsive ─── */
@media (max-width: 900px) {
  .tournament-body { grid-template-columns: 1fr; }
  .roster-panel { border-right: none; border-bottom: 1px solid var(--border); }

  .bracket-board { gap: 0.65rem; }
  .bracket-column { flex-basis: min(240px, 88vw); }

  .scoreboard {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
  }

  .vs-center { order: -1; flex-direction: row; flex-wrap: wrap; justify-content: center; }

  .score-num { font-size: 3rem; }

  .app-nav { padding: 0.5rem 1rem; }
  .arena-layout { padding: 1rem; }
}

@media (max-width: 768px) {
  .arena-header {
    flex-direction: column;
    align-items: stretch;
    padding: 0.75rem 1rem;
    gap: 0.5rem;
  }

  .logo-block { justify-content: center; }

  .header-controls {
    justify-content: center;
    gap: 0.4rem;
  }

  .header-controls .session-select {
    flex: 1;
    max-width: none;
  }

  .app-nav {
    padding: 0.5rem 0.75rem;
    gap: 0.25rem;
    top: 0;
    position: sticky;
  }

  .arena-header {
    position: relative;
  }

  .app-nav-btn {
    padding: 0.5rem 0.75rem;
    font-size: 0.72rem;
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  .vs-center {
    flex-direction: column;
    min-width: 0;
  }

  .btn-finish {
    min-height: 48px;
  }

  .panel-header {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .camera-controls {
    width: 100%;
    justify-content: flex-start;
  }

  .cam-source-select { max-width: none; flex: 1; }
  .cam-select { max-width: none; flex: 1; }

  .remote-cam-layout {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .remote-cam-info {
    text-align: center;
  }

  .remote-actions { justify-content: center; }

  .tournament-header {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
    text-align: center;
  }

  .tournament-header-actions {
    justify-content: center;
  }

  .bracket-column { min-width: 200px; }

  .camera-panel-full,
  .battle-log-panel-full {
    min-height: calc(100vh - 9rem);
    min-height: calc(100dvh - 9rem);
  }

  .camera-panel-full .camera-viewport {
    min-height: 280px;
  }

  .battle-log-panel-full .battle-log {
    min-height: calc(100vh - 12rem);
    min-height: calc(100dvh - 12rem);
  }

  .tournament-panel {
    min-height: calc(100vh - 9rem);
    min-height: calc(100dvh - 9rem);
  }

  .arena-layout {
    min-height: calc(100vh - 6rem);
    min-height: calc(100dvh - 6rem);
  }

  body.launch-active.launch-live .finish-buttons {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.25rem;
    width: 100%;
  }

  body.launch-active.launch-live .btn-finish {
    min-height: 44px;
    padding: 0.35rem 0.25rem;
    font-size: 0.7rem;
  }

  body.launch-active.launch-live .finish-icon {
    font-size: 0.9rem;
  }

  body.launch-active.launch-live .btn-finish strong {
    font-size: 0.75rem;
  }

  body.launch-active.launch-live .scoreboard {
    --hud-panel-w: calc((100vw - 5rem - env(safe-area-inset-left) - env(safe-area-inset-right)) / 2);
    --hud-inset-l: max(3rem, calc(env(safe-area-inset-left) + 2.5rem));
    --hud-inset-r: max(3rem, calc(env(safe-area-inset-right) + 2.5rem));
    --hud-rail-w: 36px;
    --hud-score-top: max(6.4rem, calc(env(safe-area-inset-top) + 5.65rem));
    --hud-rail-top: max(11rem, calc(env(safe-area-inset-top) + 10rem));
    --hud-rail-bottom: max(6.25rem, calc(env(safe-area-inset-bottom) + 5.25rem));
  }

  body.launch-active.launch-live .player-header {
    max-width: var(--hud-panel-w);
    width: var(--hud-panel-w);
  }

  body.launch-active.launch-live .player-name {
    font-size: clamp(1.35rem, 4.5vw, 1.75rem);
  }

  body.launch-active.launch-live .score-num {
    font-size: clamp(2.65rem, 11vw, 4.25rem);
  }

  body.launch-active.launch-live .finish-buttons {
    width: var(--hud-panel-w);
    max-width: 320px;
  }

  body.launch-active.launch-live .btn-finish {
    min-height: 48px;
  }

  body.launch-active.launch-live .btn-finish strong {
    font-size: 0.75rem;
  }

  body.launch-active.launch-live .btn-relaunch {
    bottom: max(4.75rem, calc(env(safe-area-inset-bottom) + 4rem));
    max-width: min(calc(100vw - 8rem), 9.5rem);
    padding: 0.45rem 0.65rem;
    font-size: clamp(0.58rem, 2.8vw, 0.72rem);
    white-space: normal;
    line-height: 1.15;
    text-align: center;
  }

  body.launch-active.launch-live .btn-relaunch::after {
    content: none;
  }

  body.launch-active.launch-live .rec-badge[data-hint]::after {
    content: none;
  }

  .btn-relaunch {
    font-size: 0.72rem;
    padding: 0.55rem 0.85rem;
  }

  .finish-toast {
    font-size: 1rem;
    padding: 0.75rem 1.25rem;
    bottom: 1rem;
    max-width: 90vw;
  }
}

/* Phone landscape — width often >768px so needs its own breakpoint */
@media (max-height: 520px) and (orientation: landscape) {
  body.launch-active.launch-live .btn-live-replay {
    top: max(0.4rem, env(safe-area-inset-top));
    padding: 0.28rem 0.7rem;
    gap: 0.35rem;
  }

  body.launch-active.launch-live .btn-live-replay #live-replay-battle-num {
    font-size: 0.9rem;
  }

  body.launch-active.launch-live .vs-center {
    top: max(0.4rem, env(safe-area-inset-top));
    left: calc(50% + 4.75rem);
  }

  body.launch-active.launch-live .vs-center .match-label {
    font-size: 0.5rem;
    letter-spacing: 0.1em;
  }

  body.launch-active.launch-live .vs-center .round-num {
    font-size: 0.9rem;
  }

  body.launch-active.launch-live .scoreboard {
    --hud-name-top: max(2.15rem, calc(env(safe-area-inset-top) + 1.75rem));
    --hud-score-top: max(5.5rem, calc(env(safe-area-inset-top) + 4.85rem));
    --hud-rail-top: max(9rem, calc(env(safe-area-inset-top) + 8.25rem));
    --hud-rail-bottom: max(4.85rem, calc(env(safe-area-inset-bottom) + 4rem));
    --hud-btn-bottom: max(0.45rem, env(safe-area-inset-bottom));
    --hud-panel-w: calc((100vw - 5.5rem - env(safe-area-inset-left) - env(safe-area-inset-right)) / 2);
    --hud-inset-l: max(2.85rem, calc(env(safe-area-inset-left) + 2.35rem));
    --hud-inset-r: max(2.85rem, calc(env(safe-area-inset-right) + 2.35rem));
    --hud-rail-w: 32px;
  }

  body.launch-active.launch-live .btn-relaunch {
    bottom: max(3.65rem, calc(env(safe-area-inset-bottom) + 3.1rem));
    max-width: min(calc(100vw - 7rem), 8.5rem);
    padding: 0.32rem 0.45rem;
    font-size: clamp(0.5rem, 2.2vh, 0.62rem);
    line-height: 1.1;
    white-space: normal;
    text-align: center;
  }

  body.launch-active.launch-live .btn-relaunch::after {
    content: none;
  }

  body.launch-active.launch-live .btn-exit-launch {
    top: max(0.45rem, env(safe-area-inset-top));
    right: max(0.45rem, env(safe-area-inset-right));
    padding: 0.38rem 0.55rem;
    font-size: 0.72rem;
  }

  body.launch-active.launch-live .rec-badge {
    top: max(0.45rem, env(safe-area-inset-top));
    bottom: auto;
    left: max(0.45rem, env(safe-area-inset-left));
    right: auto;
    font-size: 0.58rem;
    padding: 0.22rem 0.4rem;
  }

  body.launch-active.launch-live .rec-badge[data-hint]::after {
    content: none;
  }

  body.launch-active.launch-live .player-header {
    width: var(--hud-panel-w);
    max-width: var(--hud-panel-w);
  }

  body.launch-active.launch-live .player-name {
    font-size: clamp(1.05rem, 3.6vw, 1.35rem);
    line-height: 1.35;
    padding: 0.12rem 0.45rem 0.5rem;
  }

  body.launch-active.launch-live .player-header::before {
    font-size: 0.5rem;
    padding: 0.2rem 0.45rem 0.08rem;
  }

  body.launch-active.launch-live .score-num {
    font-size: clamp(2.25rem, 10vh, 3.5rem);
  }

  body.launch-active.launch-live .score-display {
    padding: 0.05rem 0.55rem 0.35rem;
    gap: 0.35rem;
  }

  body.launch-active.launch-live .finish-buttons {
    width: var(--hud-panel-w);
    padding: 0.28rem;
    gap: 0.12rem;
  }

  body.launch-active.launch-live .btn-finish {
    min-height: 36px;
    padding: 0.18rem 0.08rem;
    font-size: 0.48rem;
  }

  body.launch-active.launch-live .btn-finish strong {
    font-size: 0.56rem;
  }

  body.launch-active.launch-live .finish-icon {
    font-size: 0.9rem;
  }
}

@media (max-width: 480px) {
  .logo-x { font-size: 1.5rem; }
  .arena-header h1 { font-size: 0.85rem; }
  .event-subtitle { font-size: 0.65rem; }

  .arena-layout { padding: 0.65rem; }

  .player-card { padding: 0.85rem 0.65rem; gap: 0.65rem; }

  .score-num { font-size: 2.5rem; }

  .btn-finish {
    padding: 0.45rem 0.3rem;
    font-size: 0.72rem;
    min-height: 48px;
  }

  .finish-name { font-size: 0.68rem; }
  .finish-name em { font-size: 0.58rem; }
  .finish-icon { font-size: 0.9rem; }

  .btn-launch {
    padding: 0.75rem;
    font-size: 0.7rem;
    padding-bottom: max(0.75rem, env(safe-area-inset-bottom));
  }

  .btn-relaunch {
    font-size: 0.68rem;
    padding: 0.5rem 0.7rem;
  }

  .vs-center { gap: 0.5rem; }
  .round-num { font-size: 1.6rem; }
  .vs-badge { font-size: 1.2rem; }
  .launch-timer { font-size: 1.8rem; min-height: 2.4rem; line-height: 2.4rem; }
  .launch-timer.go-shoot { font-size: 1.3rem; }

  .victory-content { padding: 1.5rem; }
  .victory-content h2 { font-size: 2rem; }
  .victory-label { font-size: 0.85rem; }

  .bracket-column { flex-basis: min(220px, 85vw); min-width: 180px; }

  .roster-add-row input { font-size: max(0.85rem, 16px); }

  .cam-url-input { font-size: max(0.8rem, 16px); }

  .launch-camera-hint {
    bottom: calc(6.5rem + env(safe-area-inset-bottom));
    font-size: 0.65rem;
  }

  body.launch-active.launch-live .launch-camera-hint {
    bottom: calc(7rem + env(safe-area-inset-bottom));
  }
}

/* ─── Admin modals & bracket ops ─── */
.admin-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.admin-modal[hidden] { display: none; }
.admin-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}
.admin-modal-card {
  position: relative;
  background: var(--panel, #12182a);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 1.25rem;
  max-width: 400px;
  width: 100%;
  max-height: 90vh;
  overflow: auto;
}
.admin-fieldset {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 0.75rem;
  margin: 0.75rem 0;
}
.admin-fieldset label {
  display: block;
  margin: 0.35rem 0;
  font-size: 0.85rem;
}
.admin-fieldset input {
  width: 100%;
  margin-top: 0.2rem;
}
.admin-bgm-volume {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}
.admin-bgm-volume input[type="range"] {
  flex: 1;
  min-width: 8rem;
  margin-top: 0;
}
.admin-bgm-volume #arena-bgm-volume-label {
  min-width: 2.5rem;
  font-variant-numeric: tabular-nums;
  opacity: 0.85;
}
.admin-modal-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 1rem;
}
.checklist-items {
  list-style: none;
  padding: 0;
  margin: 0.75rem 0;
}
.checklist-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.25rem 0.6rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.9rem;
}
.checklist-item.ok .checklist-icon { color: #34c759; }
.checklist-item.warn .checklist-icon { color: #ff9f0a; }
.checklist-hint {
  grid-column: 2;
  font-size: 0.78rem;
  opacity: 0.65;
}
.checklist-summary {
  margin: 0.5rem 0 0.75rem;
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  font-size: 0.85rem;
  background: rgba(255, 255, 255, 0.05);
}
.checklist-summary[data-status="ok"] {
  color: #34c759;
  border: 1px solid rgba(52, 199, 89, 0.25);
}
.checklist-summary[data-status="warn"] {
  color: #ffd60a;
  border: 1px solid rgba(255, 214, 10, 0.25);
}
.checklist-summary[data-status="critical"] {
  color: #ff9f0a;
  border: 1px solid rgba(255, 45, 85, 0.25);
}
.checklist-competition-toggle {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin: 0 0 0.75rem;
  font-size: 0.82rem;
  line-height: 1.35;
  cursor: pointer;
}
.checklist-competition-toggle input {
  margin-top: 0.15rem;
  flex-shrink: 0;
}

.admin-modal-card--wide {
  max-width: 28rem;
}

.shortcuts-hint {
  margin: 0 0 0.75rem;
  font-size: 0.82rem;
  color: var(--text-muted, #8e8e93);
}

.shortcuts-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  margin-bottom: 0.5rem;
}

.shortcuts-table td {
  padding: 0.35rem 0.25rem;
  vertical-align: top;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.shortcuts-table kbd {
  display: inline-block;
  min-width: 1.5rem;
  padding: 0.15rem 0.45rem;
  font-family: inherit;
  font-size: 0.78rem;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  white-space: nowrap;
}

body.scoring-locked .btn-finish,
body.scoring-locked .btn-score-adj {
  opacity: 0.45;
  pointer-events: none;
}

body.launch-countdown .scoreboard {
  pointer-events: none;
}
.bracket-admin {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin: 0.35rem 0;
}

.bracket-score-edit {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 0.35rem 0.5rem;
  margin: 0.5rem 0 0.35rem;
  padding: 0.45rem 0.5rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
}

.bracket-score-field {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 3rem;
}

.bracket-score-name {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.bracket-score-name.red { color: var(--red); }
.bracket-score-name.blue { color: var(--blue); }

.bracket-score-in {
  width: 3rem;
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  text-align: center;
  padding: 0.2rem 0.25rem;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  background: var(--bg-deep);
  color: inherit;
}

.bracket-score-sep {
  font-size: 1.2rem;
  font-weight: 700;
  opacity: 0.5;
  padding-bottom: 0.25rem;
}

.bracket-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.35rem;
}

.bracket-adjust {
  margin-top: 0.4rem;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  font-size: 0.68rem;
}

.bracket-adjust > summary {
  width: fit-content;
  padding-top: 0.4rem;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}

.bracket-adjust[open] > summary {
  color: var(--blue);
}

.bracket-adjust-panel {
  display: grid;
  gap: 0.5rem;
  margin-top: 0.45rem;
  padding: 0.55rem;
  border: 1px solid rgba(0, 212, 255, 0.16);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.2);
}

.bracket-label-edit,
.bracket-pairing-edit label {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
  color: var(--text-muted);
}

.bracket-label-input,
.bracket-player-select {
  min-width: 0;
  width: 100%;
  padding: 0.35rem 0.45rem;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 6px;
  background: var(--bg-deep);
  color: var(--text);
  font: inherit;
}

.bracket-pairing-edit {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: end;
  gap: 0.35rem;
}

.bracket-adjust-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.bracket-adjust-hint {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.62rem;
  line-height: 1.4;
}

.bracket-status-badge.status-pending.bye-pending,
.bracket-match.bye-pending .bracket-status-badge {
  background: rgba(255, 159, 10, 0.18);
  color: #ff9f0a;
}

.bracket-match.bye-pending {
  opacity: 0.92;
  border-style: dashed;
}

.bracket-match.active .bracket-score-in {
  border-color: rgba(0, 212, 255, 0.45);
}

.bracket-match.done .bracket-score-in {
  border-color: rgba(255, 214, 10, 0.35);
}

.btn-bracket-win-p1:hover { color: var(--red); border-color: rgba(255, 45, 85, 0.45); }
.btn-bracket-win-p2:hover { color: var(--blue); border-color: rgba(0, 212, 255, 0.45); }

.bracket-match {
  cursor: pointer;
}
.bracket-match button,
.bracket-match input,
.bracket-match select {
  cursor: pointer;
}
.btn-xs {
  font-size: 0.65rem;
  padding: 0.15rem 0.35rem;
  line-height: 1.2;
}
.score-adjust {
  display: flex;
  gap: 0.25rem;
  justify-content: center;
  margin-top: 0.35rem;
}
.btn-score-adj {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.06);
  color: inherit;
  font-size: 1rem;
  cursor: pointer;
}
.btn-score-adj:hover { background: rgba(255, 255, 255, 0.12); }
body.launch-active.launch-live .score-adjust { display: none; }
.replay-sync-status[data-status="pending"] { color: #ff9f0a; }
.overlay-hint {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.72rem;
  opacity: 0.7;
}

/* Sync banner + broadcast controls */
.arena-sync-banner {
  display: block;
  width: calc(100% - 2rem);
  margin: 0 1rem 0.5rem;
  padding: 0.5rem 0.85rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
  border: none;
  font-family: inherit;
  cursor: pointer;
}
.arena-sync-banner[hidden] {
  display: none;
}
.arena-sync-banner:not([hidden]):hover {
  filter: brightness(1.08);
}
.arena-sync-banner:not([hidden]):focus-visible {
  outline: 2px solid var(--gold, #ffc850);
  outline-offset: 2px;
}
.arena-sync-banner[data-level="warn"] {
  background: rgba(255, 159, 10, 0.15);
  border: 1px solid rgba(255, 159, 10, 0.35);
  color: #ff9f0a;
}
.arena-sync-banner[data-level="error"] {
  background: rgba(255, 69, 58, 0.15);
  border: 1px solid rgba(255, 69, 58, 0.35);
  color: #ff453a;
}

.platform-room-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: rgba(0, 212, 255, 0.15);
  border: 1px solid rgba(0, 212, 255, 0.35);
  color: var(--blue, #00d4ff);
  white-space: nowrap;
}
.platform-room-badge[hidden] { display: none; }

.platform-room-panel {
  margin: 0 1rem 0.65rem;
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(14, 20, 32, 0.92);
}
.platform-room-panel > summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--gold, #ffd60a);
}
.platform-room-form {
  display: grid;
  gap: 0.55rem;
  margin-top: 0.65rem;
}
.platform-room-form label {
  display: grid;
  gap: 0.25rem;
  font-size: 0.8rem;
  color: var(--muted, #8b95a8);
}
.platform-room-form input {
  padding: 0.45rem 0.6rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.28);
  color: inherit;
  font: inherit;
}
.platform-room-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.platform-room-status {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted, #8b95a8);
}
.platform-room-status[data-ok="1"] { color: var(--green, #34c759); }
.platform-room-status[data-ok="0"] { color: var(--red, #ff2d55); }

.header-broadcast {
  display: flex;
  gap: 0.35rem;
  align-items: center;
}
.session-select--compact { max-width: 6.5rem; font-size: 0.8rem; }
.broadcast-message-input,
.station-name-input {
  width: 7rem;
  font-size: 0.8rem;
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(0,0,0,0.25);
  color: inherit;
}
.broadcast-message-input { width: 9rem; }
#btn-replay-pause-upload.active {
  border-color: #ff9f0a;
  color: #ff9f0a;
}
.btn-victory-revert--prominent {
  border: 2px solid #ff9f0a !important;
  color: #ff9f0a !important;
  font-weight: 700;
  font-size: 1rem;
  padding: 0.65rem 1.25rem;
  animation: victory-revert-pulse 2s ease-in-out infinite;
}
@keyframes victory-revert-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 159, 10, 0.4); }
  50% { box-shadow: 0 0 12px 2px rgba(255, 159, 10, 0.25); }
}


/* ==========================================================================
   MatchMaster Integration & Static Cloud Host Cleanups (No Conflicts)
   ========================================================================== */
.mm-only-btn {
  display: none;
}

body.mm-connected .mm-only-btn {
  display: inline-flex;
}

/* Hide local tournament editing & LAN-only panels when MatchMaster owns the tournament */
body.mm-connected #session-select,
body.mm-connected #btn-draw,
body.mm-connected #draw-status,
body.mm-connected #btn-reset-bracket,
body.mm-connected #btn-backup-tournament,
body.mm-connected #btn-restore-tournament,
body.mm-connected #cloud-sync-status,
body.mm-connected .roster-add-row,
body.mm-connected .bulk-import,
body.mm-connected .schedule-rules-edit,
body.mm-connected #player-qr-card,
body.mm-connected .roster-item-actions,
body.mm-connected .btn-remove-player,
body.mm-connected .btn-rename-player {
  display: none !important;
}

/* Hide LAN-only widgets on Cloudflare Pages static hosting */
body.cloud-static-host #player-qr-card,
body.cloud-static-host #btn-admin-settings,
body.cloud-static-host #btn-event-checklist,
body.cloud-static-host .header-broadcast,
body.cloud-static-host .header-station,
body.cloud-static-host #cam-source option[value="dji"],
body.mm-connected #phase-select,
body.mm-connected .header-broadcast,
body.mm-connected .header-station,
body.mm-connected #btn-event-checklist {
  display: none !important;
}

/* Floating Manual Record button in full-screen Live Camera mode */
.btn-live-record {
  display: none;
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(92px, calc(env(safe-area-inset-bottom) + 76px));
  z-index: 65;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1.5px solid rgba(255, 255, 255, 0.35);
  background: rgba(15, 23, 42, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #f8fafc;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

body.launch-live .btn-live-record {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* Manual Record / Stop Button */
.btn-manual-record.is-recording {
  background: rgba(239, 68, 68, 0.28);
  border-color: #ef4444;
  color: #fecaca;
  font-weight: 700;
  animation: rec-pulse 1.2s ease-in-out infinite;
}

@keyframes rec-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.45); }
  50% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
}
