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

.hidden {
  display: none !important;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0a0e1a;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  color: #e8ecf4;
  user-select: none;
}

body.mobile {
  touch-action: none;
  -webkit-user-select: none;
}

/* Portrait-only: shown when the phone is rotated to landscape */
.orientation-lock {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10000;
  align-items: center;
  justify-content: center;
  padding: max(24px, env(safe-area-inset-top, 0px)) max(24px, env(safe-area-inset-right, 0px))
    max(24px, env(safe-area-inset-bottom, 0px)) max(24px, env(safe-area-inset-left, 0px));
  background: #0a0e1a;
  pointer-events: auto;
}
.orientation-lock-card {
  text-align: center;
  max-width: 280px;
}
.orientation-lock-icon {
  font-size: 3rem;
  line-height: 1;
  margin-bottom: 16px;
  color: #4f8cff;
  transform: rotate(90deg);
}
.orientation-lock p {
  font-size: 1.05rem;
  line-height: 1.45;
  color: #c8d4f0;
}
@media (orientation: landscape) {
  body.mobile .orientation-lock {
    display: flex;
  }
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  position: fixed;
  inset: 0;
  z-index: 0;
}

#select-overlay,
#start-overlay,
#gameover-overlay,
.orientation-lock {
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
}

.boot-fallback {
  position: fixed;
  inset: 0;
  z-index: 50000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 24px;
  text-align: center;
  background: #0a0e1a;
  color: #e8ecf4;
}
.boot-fallback[hidden] {
  display: none !important;
}
.boot-fallback button {
  padding: 12px 20px;
  border-radius: 10px;
  border: none;
  background: #4f8cff;
  color: #fff;
  font-size: 16px;
  font-weight: 600;
}

.model-load-overlay {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 450;
  display: flex;
  justify-content: center;
  padding: 16px 20px calc(16px + env(safe-area-inset-bottom, 0px));
  pointer-events: none;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.22s ease, transform 0.22s ease;
}
.model-load-overlay[hidden] {
  display: none !important;
}
.model-load-overlay.visible {
  opacity: 1;
  transform: translateY(0);
}
.model-load-card {
  width: min(420px, 100%);
  padding: 14px 16px 12px;
  border-radius: 14px;
  background: rgba(8, 12, 28, 0.88);
  border: 1px solid rgba(120, 160, 255, 0.28);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.model-load-label {
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #9db0df;
}
.model-load-track {
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.1);
}
.model-load-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #3b82f6, #60a5fa, #93c5fd);
  transition: width 0.12s linear;
}
.model-load-percent {
  margin: 8px 0 0;
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #e8ecf4;
  text-align: right;
}

#hud {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease;
}
#hud.visible { opacity: 1; }

.hud-panel {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(8, 12, 28, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(120, 160, 255, 0.25);
  border-radius: 12px;
  padding: 10px 14px;
  min-width: 0;
  flex: 1 1 0;
  max-width: min(168px, calc(50% - 6px));
}

.hud-avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  object-fit: contain;
  padding: 5px;
  background: radial-gradient(circle at 50% 38%, #243056, #12182c 72%, #070a14);
  border: 2px solid var(--avatar-accent, #4f8cff);
  box-shadow: 0 0 12px -2px var(--avatar-accent, rgba(79, 140, 255, 0.6)), inset 0 0 6px rgba(0, 0, 0, 0.15);
  flex-shrink: 0;
}

/* Online same-bey: rival HUD logo only (you stay full color). */
.hud-avatar.hud-avatar--greyscale {
  filter: grayscale(1) brightness(1.05) contrast(0.95);
}

.hud-info {
  flex: 1;
  min-width: 0;
}

.hud-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #7a8cb8;
  margin-bottom: 4px;
}

.hud-value {
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.hud-bar-wrap {
  margin-top: 6px;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  overflow: hidden;
}

.hud-bar {
  height: 100%;
  border-radius: 3px;
  transition: width 0.15s linear;
}

#player-bar { background: linear-gradient(90deg, #3b82f6, #60a5fa); }

.hud-bar.is-overdrive {
  background: linear-gradient(90deg, #f59e0b, #fde68a);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.45);
}
#ai-bar { background: linear-gradient(90deg, #ef4444, #f87171); }
.hud-side-ai { flex-direction: row-reverse; }
.hud-side-ai .hud-info { text-align: right; }

#start-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 50% 30%, #1a2548 0%, #0a0e1a 70%);
  padding: 24px;
  text-align: center;
}

#start-overlay.hidden {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
}

#start-overlay.hidden * {
  pointer-events: none !important;
}

.boot-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(ellipse at 50% 30%, #1a2548 0%, #0a0e1a 70%);
  text-align: center;
  transition: opacity 0.45s ease;
}

.boot-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.boot-overlay.hidden * {
  pointer-events: none !important;
}

.boot-overlay-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(100%, 340px);
}

.boot-overlay .bey-icon {
  margin-bottom: 20px;
}

.boot-overlay-title {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
  background: linear-gradient(135deg, #fff 30%, #4f8cff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.boot-overlay-status {
  font-size: 13px;
  color: #8a9bc0;
  margin-bottom: 18px;
  min-height: 1.3em;
}

.boot-overlay-bar {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(120, 160, 255, 0.22);
  overflow: hidden;
}

.boot-overlay-bar-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2563eb, #6b9fff);
  box-shadow: 0 0 12px rgba(79, 140, 255, 0.55);
  transition: width 0.25s ease;
}

.boot-overlay-pct {
  margin-top: 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: #6b7da8;
}

.boot-overlay-tip {
  margin-top: 18px;
  max-width: 320px;
  min-height: 3.6em;
  font-size: 12px;
  line-height: 1.45;
  color: #9aaccf;
  opacity: 0.95;
  transition: opacity 0.35s ease;
}

.boot-overlay-tip .boot-tip-label {
  display: block;
  margin-bottom: 4px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.16em;
  color: #6b9fff;
}

.boot-overlay-tip.boot-tip-fade {
  opacity: 0;
}

body:not(.boot-ready) #select-overlay {
  pointer-events: none;
}

.bey-icon {
  width: 120px;
  height: 120px;
  margin: 0 auto 20px;
  overflow: hidden;
  position: relative;
  flex-shrink: 0;
  background: transparent;
  box-shadow: none;
}

.bey-icon-placeholder {
  position: absolute;
  inset: 12%;
  width: 76%;
  height: 76%;
  object-fit: contain;
  filter: grayscale(1) brightness(1.15) contrast(0.95);
  animation: bey-icon-spin 11s linear infinite;
  pointer-events: none;
  z-index: 1;
}

.bey-icon.is-ready .bey-icon-placeholder {
  display: none;
}

.bey-icon-canvas {
  display: block;
  width: 100%;
  height: 100%;
  position: relative;
  z-index: 0;
  transition: opacity 0.2s ease;
}

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

.bey-icon--fallback {
  border: none;
  background: transparent;
  box-shadow: none;
}

.bey-icon--fallback .bey-icon-placeholder {
  inset: 18%;
  width: 64%;
  height: 64%;
  animation: none;
}

.control-mode {
  width: min(100%, 360px);
  margin: 0 0 22px;
  padding: 0;
  border: none;
}

.control-mode-legend {
  display: block;
  width: 100%;
  margin: 0 0 10px;
  padding: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #8aa0d0;
  text-align: center;
}

.control-mode-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.control-mode-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-height: 118px;
  padding: 14px 10px 12px;
  border-radius: 16px;
  border: 1.5px solid rgba(140, 175, 255, 0.42);
  background: rgba(16, 24, 52, 0.88);
  color: #d5e0f8;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  transition:
    border-color 0.18s ease,
    background 0.18s ease,
    box-shadow 0.18s ease,
    color 0.18s ease,
    transform 0.12s ease;
}

.control-mode-card input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  pointer-events: none;
}

.control-mode-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(79, 140, 255, 0.12);
  border: 1px solid rgba(120, 170, 255, 0.28);
  color: #b7c8ef;
  transition: color 0.18s ease, background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.control-mode-copy {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  text-align: center;
}

.control-mode-title {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: inherit;
}

.control-mode-desc {
  font-size: 10px;
  line-height: 1.3;
  font-weight: 500;
  color: #8fa3cf;
  max-width: 14em;
}

.control-mode-check {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.22);
  background: transparent;
  transition: background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.control-mode-check::after {
  content: '';
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: transparent;
  transition: background 0.18s ease;
}

.control-mode-card:active {
  transform: scale(0.97);
}

.control-mode-card:focus-within {
  outline: 2px solid rgba(79, 140, 255, 0.65);
  outline-offset: 2px;
}

.control-mode-card:has(input:checked),
.control-mode-card.is-selected {
  color: #eef3ff;
  border-color: #4f8cff;
  background:
    linear-gradient(160deg, rgba(37, 99, 235, 0.38) 0%, rgba(12, 20, 48, 0.92) 70%);
  box-shadow:
    0 0 0 1px rgba(79, 140, 255, 0.35) inset,
    0 8px 28px rgba(37, 99, 235, 0.35);
}

.control-mode-card:has(input:checked) .control-mode-icon,
.control-mode-card.is-selected .control-mode-icon {
  color: #fff;
  background: rgba(79, 140, 255, 0.28);
  border-color: rgba(120, 180, 255, 0.55);
  box-shadow: 0 0 16px rgba(79, 140, 255, 0.45);
}

.control-mode-card:has(input:checked) .control-mode-desc,
.control-mode-card.is-selected .control-mode-desc {
  color: #b7c8ef;
}

.control-mode-card:has(input:checked) .control-mode-check,
.control-mode-card.is-selected .control-mode-check {
  border-color: #7eb0ff;
  background: #2563eb;
  box-shadow: 0 0 10px rgba(79, 140, 255, 0.55);
}

.control-mode-card:has(input:checked) .control-mode-check::after,
.control-mode-card.is-selected .control-mode-check::after {
  background: #fff;
  clip-path: polygon(14% 52%, 0 68%, 38% 100%, 100% 22%, 84% 8%, 36% 70%);
  inset: 3px;
  border-radius: 0;
}

.control-mode.online-locked,
.control-mode-card.online-locked {
  opacity: 0.72;
  pointer-events: none;
}

.control-mode.online-locked .control-mode-legend::after {
  content: ' (set by host)';
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #8b9cc8;
}

@media (max-width: 360px) {
  .control-mode-card {
    min-height: 108px;
    padding: 12px 8px 10px;
    gap: 6px;
  }
  .control-mode-icon {
    width: 42px;
    height: 42px;
  }
  .control-mode-icon svg {
    width: 30px;
    height: 30px;
  }
  .control-mode-title {
    font-size: 12px;
  }
}

body.mobile #start-overlay.start-overlay--control-prompt .bey-icon {
  display: none;
}

body.mobile #start-overlay.start-overlay--control-prompt h1 {
  margin-bottom: 10px;
  font-size: clamp(1.7rem, 8vw, 2.25rem);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

body.mobile #start-overlay.start-overlay--control-prompt #start-blurb {
  margin-bottom: 22px;
  color: #9badcf;
}

body.mobile #start-overlay.is-transition-prepared h1,
body.mobile #start-overlay.is-transition-prepared #start-blurb,
body.mobile #start-overlay.is-transition-prepared .control-mode,
body.mobile #start-overlay.is-transition-prepared #btn-start,
body.mobile #start-overlay.is-transition-prepared #permission-hint {
  opacity: 0;
  transform: translateY(14px);
}

body.mobile #start-overlay.is-transition-prepared.is-entering h1,
body.mobile #start-overlay.is-transition-prepared.is-entering #start-blurb,
body.mobile #start-overlay.is-transition-prepared.is-entering .control-mode,
body.mobile #start-overlay.is-transition-prepared.is-entering #btn-start,
body.mobile #start-overlay.is-transition-prepared.is-entering #permission-hint {
  opacity: 1;
  transform: none;
  transition:
    opacity 0.42s ease,
    transform 0.5s cubic-bezier(0.16, 0.82, 0.24, 1);
}

body.mobile #start-overlay.is-transition-prepared.is-entering #start-blurb {
  transition-delay: 0.06s;
}

body.mobile #start-overlay.is-transition-prepared.is-entering .control-mode {
  transition-delay: 0.13s;
}

body.mobile #start-overlay.is-transition-prepared.is-entering #btn-start {
  transition-delay: 0.2s;
}

body.mobile #start-overlay.is-transition-prepared.is-entering #permission-hint {
  transition-delay: 0.25s;
}

#start-overlay h1 {
  font-size: clamp(1.6rem, 6vw, 2.4rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
  background: linear-gradient(135deg, #fff 30%, #4f8cff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

#start-overlay p {
  font-size: 14px;
  color: #8a9bc0;
  max-width: 360px;
  line-height: 1.5;
  margin-bottom: 20px;
}

.key-hints {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-bottom: 28px;
}

kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 8px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: #c8d4f0;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.35);
}

#btn-start {
  appearance: none;
  border: none;
  cursor: pointer;
  padding: 16px 40px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #fff;
  background: linear-gradient(135deg, #2563eb, #4f8cff);
  border-radius: 50px;
  box-shadow: 0 4px 24px rgba(37, 99, 235, 0.5);
  transition: transform 0.15s, box-shadow 0.15s;
  touch-action: manipulation;
}

#btn-start:active {
  transform: scale(0.96);
  box-shadow: 0 2px 12px rgba(37, 99, 235, 0.4);
}

#btn-start:disabled { opacity: 0.5; cursor: wait; }

#permission-hint {
  margin-top: 16px;
  font-size: 12px;
  color: #5a6a90;
  max-width: 320px;
}

#gameover-overlay {
  position: fixed;
  inset: 0;
  z-index: 250;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(5, 8, 18, 0.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 24px;
  text-align: center;
}

#gameover-overlay.visible { display: flex; }

#gameover-overlay h2 {
  font-size: clamp(2rem, 8vw, 3rem);
  font-weight: 900;
  margin-bottom: 12px;
}

#gameover-overlay h2.win { color: #4ade80; text-shadow: 0 0 30px rgba(74, 222, 128, 0.5); }
#gameover-overlay h2.lose { color: #f87171; text-shadow: 0 0 30px rgba(248, 113, 113, 0.5); }
#gameover-overlay h2.draw { color: #fbbf24; text-shadow: 0 0 30px rgba(251, 191, 36, 0.45); }

#gameover-msg {
  font-size: 15px;
  color: #9aa8c8;
  margin-bottom: 28px;
}

.gameover-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  width: min(100%, 280px);
}

/* ---------- Leave-tournament confirm (Change Bey) ---------- */
.confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 280;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(5, 8, 18, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.confirm-overlay.is-active {
  display: flex;
}

.confirm-dialog {
  width: min(100%, 360px);
  padding: 28px 24px 22px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: linear-gradient(165deg, rgba(24, 32, 54, 0.96), rgba(10, 14, 26, 0.98));
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
  text-align: center;
}

.confirm-title {
  margin: 0 0 10px;
  font-size: 1.35rem;
  font-weight: 800;
  color: #e8ecf4;
}

.confirm-message {
  margin: 0 0 22px;
  font-size: 14px;
  line-height: 1.45;
  color: #9aa8c8;
}

.confirm-message[hidden] {
  display: none;
}

.confirm-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.confirm-btn {
  appearance: none;
  border: 2px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
  padding: 13px 28px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #e8ecf4;
  border-radius: 50px;
  transition: background 0.15s, transform 0.15s;
  touch-action: manipulation;
}

.confirm-btn:active {
  transform: scale(0.96);
}

.confirm-btn-danger {
  background: rgba(185, 28, 28, 0.38);
  border-color: rgba(248, 113, 113, 0.45);
}

.confirm-btn-danger:active {
  background: rgba(185, 28, 28, 0.55);
}

.confirm-btn-secondary {
  background: rgba(255, 255, 255, 0.06);
}

.confirm-btn-secondary:active {
  background: rgba(255, 255, 255, 0.12);
}

#btn-restart,
.gameover-btn-secondary {
  appearance: none;
  border: 2px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
  padding: 14px 36px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #e8ecf4;
  border-radius: 50px;
  transition: background 0.15s, transform 0.15s;
  touch-action: manipulation;
}

#btn-restart {
  background: rgba(37, 99, 235, 0.35);
  border-color: rgba(96, 165, 250, 0.45);
}

.gameover-btn-secondary {
  background: rgba(255, 255, 255, 0.06);
}

#btn-restart:active,
.gameover-btn-secondary:active {
  transform: scale(0.96);
}

#btn-restart:active {
  background: rgba(37, 99, 235, 0.5);
}

.gameover-btn-secondary:active {
  background: rgba(255, 255, 255, 0.12);
}

#btn-restart:disabled,
.gameover-btn-secondary:disabled {
  opacity: 0.45;
  cursor: wait;
  transform: none;
}

body.mobile #btn-recalibrate:disabled {
  background: rgba(100, 100, 100, 0.22);
  border-color: rgba(255, 255, 255, 0.08);
  color: rgba(200, 204, 212, 0.5);
}

/* ---------- Mode + difficulty (inside bey select) ---------- */
.play-setup {
  width: min(100%, 520px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  z-index: 20;
  flex-shrink: 0;
  padding-top: env(safe-area-inset-top, 0px);
}

.play-setup-modes {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  padding: 4px;
  background: rgba(8, 12, 28, 0.85);
  border: 1px solid rgba(120, 160, 255, 0.25);
  border-radius: 50px;
}

.play-setup-mode-btn,
.play-setup-diff-btn {
  appearance: none;
  border: none;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  font-family: inherit;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #7a8cb8;
  background: transparent;
  border-radius: 50px;
  transition: color 0.15s, background 0.15s;
}

.play-setup-mode-btn {
  padding: 12px 18px;
  font-size: 12px;
}

.play-setup-diff-btn {
  padding: 10px 12px;
  font-size: 10px;
}

.play-setup-mode-btn.active,
.play-setup-diff-btn.active {
  color: #fff;
  background: linear-gradient(135deg, #2563eb, #4f8cff);
  box-shadow: 0 2px 12px rgba(37, 99, 235, 0.4);
}

.play-setup-diff {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.play-setup-diff.hidden {
  display: none;
}

.play-setup-arena {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: min(100%, 320px);
}

.play-setup-arena.hidden {
  display: none;
}

.play-setup-arena-label {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #7a8cb8;
}

.play-setup-arena-select {
  appearance: none;
  width: 100%;
  max-width: 320px;
  padding: 10px 36px 10px 14px;
  border-radius: 12px;
  border: 1px solid rgba(120, 160, 255, 0.28);
  background:
    linear-gradient(45deg, transparent 50%, #7a8cb8 50%) right 14px top 50% / 6px 6px no-repeat,
    linear-gradient(135deg, transparent 50%, #7a8cb8 50%) right 9px top 50% / 6px 6px no-repeat,
    rgba(12, 18, 36, 0.85);
  color: #d8e2f8;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  touch-action: manipulation;
}

.play-setup-arena-select:focus {
  outline: none;
  border-color: rgba(79, 140, 255, 0.7);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.25);
}

.play-setup-arena-select option {
  background: #0c1224;
  color: #d8e2f8;
}

/* ---------- Arena stadium transition (tournament rival change) ---------- */
.arena-transition {
  position: fixed;
  inset: 0;
  z-index: 320;
  display: none;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 40%, rgba(20, 30, 60, 0.7) 0%, rgba(5, 8, 18, 0.98) 72%),
    #050812;
}

.arena-transition.is-active {
  display: flex;
  pointer-events: auto;
}

.arena-transition-card {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 28px 24px;
  opacity: 0;
  transform: translateY(16px) scale(0.96);
}

.arena-transition.is-in .arena-transition-card,
.arena-transition.is-hold .arena-transition-card {
  opacity: 1;
  transform: none;
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.arena-transition.is-out .arena-transition-card {
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.arena-transition-kicker {
  margin: 0 0 10px;
  font-size: 12px;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--arena-accent, #4f8cff);
  text-shadow: 0 0 18px rgba(79, 140, 255, 0.55);
}

.arena-transition-title {
  margin: 0;
  font-size: clamp(2rem, 8vw, 3.2rem);
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #f2f6ff;
  text-shadow: 0 0 36px rgba(79, 140, 255, 0.45);
}

.arena-transition-sub {
  margin: 14px 0 0;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #9aa8c8;
}

.arena-transition-sub.hidden {
  display: none;
}

/* ---------- Mortal Kombat-style tournament tower ---------- */
.tournament-transition-cover {
  position: fixed;
  inset: 0;
  z-index: 310;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  background:
    radial-gradient(
      ellipse at 50% 44%,
      color-mix(in srgb, var(--tournament-transition-accent, #4f8cff) 16%, transparent),
      transparent 58%
    ),
    #04060d;
  transition:
    opacity 0.45s ease,
    visibility 0s linear 0.45s;
}

.tournament-transition-cover.is-active {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  transition:
    opacity 0.16s ease,
    visibility 0s linear 0s;
}

.tournament-ladder {
  position: fixed;
  inset: 0;
  z-index: 330;
  display: none;
  overflow: hidden;
  color: #eef4ff;
  pointer-events: none;
  isolation: isolate;
  background: #04060d;
}

.tournament-ladder.is-active {
  display: block;
  pointer-events: auto;
}

/* Measure/layout the track before the first painted frame so it never pops. */
.tournament-ladder.is-active.is-positioning {
  visibility: hidden;
}

.tournament-ladder-backdrop {
  position: absolute;
  inset: 0;
  z-index: -2;
  background:
    linear-gradient(90deg, rgba(4, 6, 13, 0.96), rgba(11, 17, 34, 0.72) 50%, rgba(4, 6, 13, 0.96)),
    radial-gradient(ellipse at 50% 48%, rgba(42, 65, 122, 0.42), transparent 58%),
    #04060d;
}

.tournament-ladder-backdrop::before,
.tournament-ladder-backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.tournament-ladder-backdrop::before {
  opacity: 0.2;
  background:
    repeating-linear-gradient(0deg, transparent 0 42px, rgba(125, 157, 220, 0.16) 43px),
    repeating-linear-gradient(90deg, transparent 0 72px, rgba(125, 157, 220, 0.08) 73px);
  mask-image: radial-gradient(ellipse at center, #000 10%, transparent 76%);
}

.tournament-ladder-backdrop::after {
  background: linear-gradient(180deg, #04060d 0%, transparent 17%, transparent 78%, #04060d 100%);
}

.tournament-ladder-header {
  position: absolute;
  top: max(20px, env(safe-area-inset-top, 0px));
  left: 50%;
  z-index: 4;
  width: min(92vw, 680px);
  text-align: center;
  transform: translateX(-50%);
  opacity: 0;
}

.tournament-ladder.is-active .tournament-ladder-header {
  opacity: 1;
  transition: opacity 0.3s ease;
}

.tournament-ladder-kicker {
  margin: 0 0 5px;
  color: #7ca8ff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.36em;
  text-transform: uppercase;
  text-shadow: 0 0 20px rgba(79, 140, 255, 0.75);
}

.tournament-ladder-title {
  margin: 0;
  font-size: clamp(1.55rem, 4vw, 2.55rem);
  font-weight: 950;
  letter-spacing: 0.06em;
  line-height: 1;
  text-transform: uppercase;
  text-shadow: 0 4px 24px rgba(0, 0, 0, 0.85);
}

.tournament-ladder-progress {
  margin: 8px 0 0;
  color: #99a9c9;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.17em;
  text-transform: uppercase;
}

.tournament-ladder-viewport {
  position: absolute;
  top: 15vh;
  right: 0;
  bottom: 10vh;
  left: 0;
  overflow: hidden;
  perspective: 1000px;
  mask-image: linear-gradient(transparent, #000 14%, #000 86%, transparent);
}

.tournament-ladder-track {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 38vh 0;
  will-change: transform;
  transition-property: transform;
  transition-timing-function: cubic-bezier(0.18, 0.72, 0.14, 1);
}

.tournament-ladder-track::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 4px;
  transform: translateX(-50%);
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.08), transparent 35%),
    linear-gradient(#283451, #6384c4 50%, #283451);
  box-shadow: 0 0 18px rgba(79, 140, 255, 0.3);
}

.tournament-ladder-level {
  position: relative;
  display: grid;
  grid-template-columns: 88px minmax(118px, 154px) minmax(150px, 1fr);
  align-items: center;
  width: min(78vw, 580px);
  min-height: 128px;
  box-sizing: border-box;
  padding: 10px 18px 10px 8px;
  border: 1px solid rgba(130, 155, 205, 0.26);
  border-radius: 14px;
  opacity: 0.62;
  transform: scale(0.88) rotateX(3deg);
  background:
    linear-gradient(115deg, rgba(28, 38, 67, 0.92), rgba(8, 12, 24, 0.96)),
    #0a0e1a;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 14px 36px rgba(0, 0, 0, 0.38);
  transition:
    opacity 0.35s ease,
    transform 0.45s cubic-bezier(0.2, 0.9, 0.25, 1),
    border-color 0.35s ease,
    box-shadow 0.35s ease;
}

.tournament-ladder-level.is-current {
  z-index: 2;
  opacity: 0.9;
  transform: scale(1.02);
  border-color: color-mix(in srgb, var(--bey-color) 55%, #8fb2ff);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 0 0 1px rgba(102, 145, 232, 0.18),
    0 0 44px color-mix(in srgb, var(--bey-color) 30%, transparent),
    0 18px 46px rgba(0, 0, 0, 0.62);
}

.tournament-ladder-level.is-current.is-arrived {
  opacity: 1;
  transform: scale(1.08);
}

.tournament-ladder-rung {
  position: absolute;
  top: 50%;
  right: calc(100% + 1px);
  left: calc(100% + 1px);
  height: 2px;
  z-index: -1;
  background: rgba(105, 139, 205, 0.38);
}

.tournament-ladder-level-number {
  margin: 0;
  color: #7f90b3;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.18em;
  text-align: center;
  text-transform: uppercase;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}

.tournament-ladder-model-wrap {
  position: relative;
  width: 122px;
  height: 108px;
  justify-self: center;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(91, 126, 198, 0.22), transparent 68%);
  will-change: transform;
}

/* Only the rival the player is currently facing spins; past/future stay still. */
.tournament-ladder-level.is-current.is-spin-right .tournament-ladder-model-wrap {
  animation: tournament-ladder-spin-right 2.8s linear infinite;
}

.tournament-ladder-level.is-current.is-spin-left .tournament-ladder-model-wrap {
  animation: tournament-ladder-spin-left 2.8s linear infinite;
}

.tournament-ladder-model-wrap::after {
  content: "";
  position: absolute;
  inset: 12%;
  z-index: -1;
  border: 1px solid rgba(135, 165, 225, 0.16);
  border-radius: 50%;
  box-shadow: inset 0 0 20px rgba(79, 140, 255, 0.12);
}

.tournament-ladder-model {
  display: block;
  width: 116px;
  height: 116px;
  object-fit: contain;
  opacity: 0;
  transform: scale(0.92);
  filter: drop-shadow(0 9px 8px rgba(0, 0, 0, 0.7));
  transition:
    opacity 0.25s ease,
    filter 0.65s ease,
    transform 0.65s cubic-bezier(0.2, 0.9, 0.2, 1);
}

.tournament-ladder-model.is-ready {
  opacity: 1;
}

.tournament-ladder-level.is-silhouette .tournament-ladder-model {
  opacity: 0.92;
  filter:
    brightness(0)
    saturate(0)
    drop-shadow(0 0 8px rgba(103, 137, 201, 0.42));
}

.tournament-ladder-level.is-revealed .tournament-ladder-model {
  transform: scale(1);
  filter:
    brightness(1.08)
    saturate(1.08)
    drop-shadow(0 10px 9px rgba(0, 0, 0, 0.66))
    drop-shadow(0 0 8px color-mix(in srgb, var(--bey-color) 48%, transparent));
}

.tournament-ladder-level.is-current.is-arrived .tournament-ladder-model {
  animation: tournament-ladder-bey-reveal 0.7s cubic-bezier(0.16, 0.9, 0.24, 1) both;
}

.tournament-ladder-model-fallback {
  display: none;
  color: #111827;
  font-size: 58px;
  font-weight: 950;
  text-shadow: 0 0 16px rgba(118, 151, 216, 0.48);
}

.tournament-ladder-level.has-no-model .tournament-ladder-model-fallback {
  display: block;
}

.tournament-ladder-copy {
  min-width: 0;
  padding-left: 12px;
}

.tournament-ladder-state {
  display: block;
  margin-bottom: 6px;
  color: #7890bd;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.tournament-ladder-name {
  display: block;
  overflow: hidden;
  color: #dbe5fb;
  font-size: clamp(0.95rem, 2.4vw, 1.35rem);
  font-weight: 950;
  letter-spacing: 0.055em;
  line-height: 1.08;
  text-overflow: ellipsis;
  text-transform: uppercase;
}

.tournament-ladder-level.is-silhouette .tournament-ladder-name {
  color: #596987;
  letter-spacing: 0.24em;
}

.tournament-ladder-level.is-current.is-arrived .tournament-ladder-state {
  color: var(--bey-color);
  text-shadow: 0 0 14px color-mix(in srgb, var(--bey-color) 62%, transparent);
}

.tournament-ladder-level.is-current.is-arrived .tournament-ladder-name {
  color: #fff;
  text-shadow: 0 0 22px color-mix(in srgb, var(--bey-color) 45%, transparent);
}

.tournament-ladder-status {
  position: absolute;
  right: 12px;
  bottom: max(18px, env(safe-area-inset-bottom, 0px));
  left: 12px;
  z-index: 4;
  margin: 0;
  color: #f4f7ff;
  font-size: clamp(0.82rem, 2vw, 1rem);
  font-weight: 900;
  letter-spacing: 0.16em;
  text-align: center;
  text-transform: uppercase;
  opacity: 0;
  transform: translateY(8px);
}

.tournament-ladder.is-revealing .tournament-ladder-status {
  opacity: 1;
  transform: none;
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.tournament-ladder.is-out {
  opacity: 0;
  transition: opacity 0.38s ease;
}

@keyframes tournament-ladder-bey-reveal {
  0% {
    opacity: 0.1;
    transform: scale(0.78) rotate(-18deg);
    filter: brightness(4) saturate(0);
  }
  52% {
    opacity: 1;
    transform: scale(1.13) rotate(5deg);
    filter: brightness(1.75) saturate(1.3);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(0);
  }
}

@keyframes tournament-ladder-spin-right {
  to { transform: rotate(360deg); }
}

@keyframes tournament-ladder-spin-left {
  to { transform: rotate(-360deg); }
}

@media (max-width: 640px) {
  .tournament-ladder-header {
    top: max(14px, env(safe-area-inset-top, 0px));
  }

  .tournament-ladder-title {
    font-size: clamp(1.3rem, 7vw, 1.85rem);
  }

  .tournament-ladder-viewport {
    top: 13vh;
    bottom: 9vh;
  }

  .tournament-ladder-track {
    gap: 12px;
    padding: 39vh 0;
  }

  .tournament-ladder-level {
    grid-template-columns: 44px 112px minmax(112px, 1fr);
    width: min(90vw, 430px);
    min-height: 112px;
    padding: 6px 10px 6px 2px;
    border-radius: 12px;
  }

  .tournament-ladder-level-number {
    font-size: 9px;
  }

  .tournament-ladder-model-wrap {
    width: 104px;
    height: 96px;
  }

  .tournament-ladder-model {
    width: 102px;
    height: 102px;
  }

  .tournament-ladder-copy {
    padding-left: 8px;
  }

  .tournament-ladder-state {
    margin-bottom: 5px;
    font-size: 8px;
    letter-spacing: 0.14em;
  }

  .tournament-ladder-name {
    font-size: 0.9rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tournament-ladder-track,
  .tournament-ladder-level,
  .tournament-ladder-model,
  .tournament-ladder-status,
  .tournament-ladder.is-out {
    transition-duration: 0.01ms !important;
  }

  .tournament-ladder-level.is-current.is-arrived .tournament-ladder-model,
  .tournament-ladder-level.is-current.is-spin-right .tournament-ladder-model-wrap,
  .tournament-ladder-level.is-current.is-spin-left .tournament-ladder-model-wrap {
    animation: none;
  }
}

/* Tournament: no CPU difficulty block; tighter top section */
.play-setup.play-setup--tournament {
  gap: 6px;
}

.play-setup.play-setup--tournament .play-setup-hint {
  margin-top: 8px;
  margin-bottom: 6px;
}

.play-setup-diff-label {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #7a8cb8;
}

.play-setup-diff-btns {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 5px;
}

.play-setup-hint {
  margin: 2px 0 0;
  font-size: 10px;
  letter-spacing: 0.04em;
  color: #6b7da8;
  text-align: center;
}

.play-setup-hint.hidden {
  display: none;
}

.pick-sub {
  display: block;
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #6b7da8;
  margin-top: 2px;
}

.pick-slot.rival-slot {
  border-color: rgba(120, 160, 255, 0.35);
}

.select-mount {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
  flex: 1;
  min-height: 0;
}

body.vs-cpu #p2-abilities {
  display: none !important;
}

.campaign-hud {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 11;
  max-width: calc(100% - 24px);
  padding: 8px 14px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #c8d4f0;
  background: rgba(8, 12, 28, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(120, 160, 255, 0.22);
  border-radius: 16px;
  pointer-events: none;
  white-space: nowrap;
}
.campaign-hud.hidden {
  display: none;
}

body:has(.campaign-hud:not(.hidden)) #hud {
  padding-top: 52px;
}

.online-series-hud {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.online-series-label {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.1em;
  opacity: 0.88;
}

.online-series-score {
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}

.online-score-lights {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.score-light {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid rgba(120, 160, 255, 0.35);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25);
}

.score-light--pending {
  opacity: 0.45;
}

.score-light--win {
  background: #22c55e;
  border-color: #4ade80;
  box-shadow: 0 0 12px rgba(34, 197, 94, 0.65);
}

.score-light--loss {
  background: #ef4444;
  border-color: #f87171;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.55);
}

.score-light--draw {
  background: #eab308;
  border-color: #fbbf24;
  box-shadow: 0 0 10px rgba(234, 179, 8, 0.5);
}

/* ---------- Bey selection screen ---------- */
#select-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
  padding: 12px 16px 16px;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background:
    radial-gradient(at 0% 0%, rgba(79, 140, 255, 0.18) 0, transparent 50%),
    radial-gradient(at 100% 100%, rgba(20, 209, 255, 0.12) 0, transparent 50%),
    #0a0e1a;
  transition: opacity 0.5s ease;
}
#select-overlay.hidden {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

#select-overlay.hidden * {
  pointer-events: none !important;
}

.select-header {
  text-align: center;
  z-index: 10;
}
.select-title {
  font-size: clamp(1.1rem, 4.5vw, 1.8rem);
  font-weight: 800;
  letter-spacing: 0.04em;
  text-shadow: 0 0 18px rgba(79, 140, 255, 0.5);
  background: linear-gradient(135deg, #fff 30%, #4f8cff);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.select-sub {
  margin-top: 4px;
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #7a8cb8;
}

.select-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-shrink: 0;
  gap: 10px;
  margin-top: 6px;
  padding: 4px 0 2px;
  z-index: 30;
}

.select-random-btn {
  appearance: none;
  min-width: 132px;
  padding: 11px 18px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 255, 0.45);
  background: rgba(99, 102, 241, 0.14);
  color: #c7d2fe;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, filter 0.15s, transform 0.15s;
}

.select-random-btn:hover:not(:disabled) {
  background: rgba(99, 102, 241, 0.24);
  border-color: rgba(165, 180, 252, 0.7);
  filter: brightness(1.06);
}

.select-random-btn:active:not(:disabled) {
  transform: scale(0.98);
}

.select-random-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.select-random-btn.rolling {
  border-color: rgba(250, 204, 21, 0.55);
  background: rgba(250, 204, 21, 0.12);
  color: #fde68a;
}

.select-mount.is-random-spinning .carousel-arrow,
.select-mount.is-random-spinning .carousel-dot {
  pointer-events: none;
  opacity: 0.45;
}

.select-mount.is-random-spinning .bey-card.active {
  box-shadow: 0 0 0 1px rgba(250, 204, 21, 0.35), 0 0 24px rgba(99, 102, 241, 0.28);
}

.carousel-scene {
  perspective: 1200px;
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  max-height: 560px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.carousel-container {
  width: 300px;
  height: 520px;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.8s cubic-bezier(0.23, 1, 0.32, 1);
}

.carousel-arrow {
  position: absolute;
  z-index: 50;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  line-height: 1;
  color: #cdddff;
  cursor: pointer;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.16);
  transition: transform 0.15s, background 0.2s, border-color 0.2s;
}
.carousel-arrow:hover {
  background: rgba(79, 140, 255, 0.22);
  border-color: #4f8cff;
}
.carousel-arrow:active { transform: translateY(-50%) scale(0.9); }
.carousel-arrow.left { left: 8px; }
.carousel-arrow.right { right: 8px; }
@media (min-width: 768px) {
  .carousel-arrow { width: 60px; height: 60px; font-size: 36px; }
  .carousel-arrow.left { left: 6vw; }
  .carousel-arrow.right { right: 6vw; }
}

.bey-item {
  position: absolute;
  top: 0;
  left: 50%;
  width: 300px;
  transition: transform 0.8s cubic-bezier(0.23, 1, 0.32, 1),
    opacity 0.6s ease, filter 0.6s ease;
}

.bey-card {
  --bey-color: #4f8cff;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 18px 18px 20px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  transition: border-color 0.4s, box-shadow 0.4s, background 0.4s;
}
.bey-card.active {
  border-color: var(--bey-color);
  background: rgba(255, 255, 255, 0.1);
  box-shadow: 0 0 36px -4px var(--bey-color);
}
.bey-card.taken { opacity: 0.55; }

.bey-card.mystery {
  --bey-color: #4b5563;
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: none;
}
.bey-card.mystery .bey-emblem {
  background:
    radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.12), transparent 55%),
    repeating-conic-gradient(from 0deg, #2a3140 0 12deg, #1a2030 12deg 24deg);
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: none;
  animation: none;
}
.bey-card.mystery .bey-emblem span {
  font-size: 36px;
  letter-spacing: 0.08em;
  animation: none;
}
.bey-card.mystery .bey-type {
  background: rgba(255, 255, 255, 0.12);
  color: #8a9bc0;
}
.bey-card.mystery .bey-name {
  letter-spacing: 0.28em;
  color: #8a9bc0;
}
.bey-card.mystery .bey-stat-fill {
  background: rgba(255, 255, 255, 0.15);
  box-shadow: none;
}

.bey-soon {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%) rotate(-6deg);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
  color: #8a9bc0;
  border: 2px solid rgba(255, 255, 255, 0.22);
  padding: 3px 10px;
  border-radius: 6px;
  background: rgba(10, 14, 26, 0.75);
  pointer-events: none;
}

.bey-emblem {
  position: relative;
  width: 124px;
  height: 124px;
  margin-bottom: 14px;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 42px;
  font-weight: 800;
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 255, 255, 0.1), transparent 58%),
    radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.14), transparent 55%),
    conic-gradient(from 0deg, var(--bey-color), #0a0e1a 60%, var(--bey-color));
  border: 2px solid var(--bey-color);
  box-shadow: 0 0 28px -6px var(--bey-color);
}
.bey-card.active .bey-emblem { animation: bey-spin 3.5s linear infinite; }
@keyframes bey-spin { to { transform: rotate(360deg); } }
.bey-emblem span { transform: rotate(0); }
.bey-card.active .bey-emblem span { animation: bey-spin 3.5s linear infinite reverse; }
.bey-emblem-img {
  width: 90%;
  height: 90%;
  object-fit: contain;
  background: transparent;
  filter:
    drop-shadow(0 0 6px rgba(255, 255, 255, 0.45))
    drop-shadow(0 2px 5px rgba(0, 0, 0, 0.65));
  transform: rotate(0);
}
.bey-card.active .bey-emblem-img { animation: bey-spin 3.5s linear infinite reverse; }

/* Meteo L-Drago emblem */
.bey-emblem-img--ldrago {
  width: 86%;
  height: 86%;
  object-fit: contain;
  object-position: 50% 46%;
  filter:
    contrast(1.15)
    saturate(1.1)
    drop-shadow(0 0 1px rgba(185, 28, 28, 0.45))
    drop-shadow(0 1px 3px rgba(127, 29, 29, 0.2));
}

/* Lightning L-Drago emblem */
.bey-emblem-img--lightning_ldrago {
  width: 98%;
  height: 98%;
  object-fit: contain;
  object-position: 50% 50%;
  filter:
    contrast(1.15)
    saturate(1.1)
    drop-shadow(0 0 4px rgba(91, 33, 217, 0.55))
    drop-shadow(0 1px 3px rgba(40, 15, 96, 0.35));
}

/* Galaxy Pegasus emblem — no white plate; motif PNG is transparent. */
.bey-emblem--galaxy_pegasus {
  background:
    radial-gradient(circle at 50% 42%, rgba(56, 189, 248, 0.22), transparent 62%),
    conic-gradient(from 0deg, #123056, #070a14 58%, #123056);
}

/* Galaxy / Destroyer / Tempo stamps share Storm's 90% disc weight. */
.bey-emblem-img--galaxy_pegasus,
.bey-emblem-img--destroyer,
.bey-emblem-img--tempo {
  width: 90%;
  height: 90%;
  object-fit: contain;
  object-position: 50% 50%;
}

.bey-emblem-img--galaxy_pegasus {
  filter:
    contrast(1.08)
    saturate(1.12)
    drop-shadow(0 0 4px rgba(56, 189, 248, 0.55))
    drop-shadow(0 1px 3px rgba(239, 68, 68, 0.25));
}

.bey-emblem--destroyer {
  background:
    radial-gradient(circle at 50% 42%, rgba(168, 85, 247, 0.22), transparent 62%),
    conic-gradient(from 0deg, #2a1048, #0a0712 58%, #2a1048);
}

.bey-emblem-img--destroyer {
  filter:
    contrast(1.08)
    saturate(1.1)
    drop-shadow(0 0 4px rgba(192, 38, 211, 0.45))
    drop-shadow(0 1px 3px rgba(20, 8, 32, 0.5));
}

.bey-emblem--tempo {
  background:
    radial-gradient(circle at 50% 42%, rgba(148, 163, 184, 0.2), transparent 62%),
    conic-gradient(from 0deg, #2a3344, #0c1018 58%, #2a3344);
}

.bey-emblem-img--tempo {
  filter:
    contrast(1.08)
    saturate(1.05)
    drop-shadow(0 0 4px rgba(203, 213, 225, 0.4))
    drop-shadow(0 1px 3px rgba(15, 20, 28, 0.5));
}

/* Earth Eagle emblem */
.bey-emblem-img--eagle {
  width: 88%;
  height: 88%;
  object-fit: contain;
  object-position: 50% 50%;
  filter:
    contrast(1.08)
    saturate(1.12)
    drop-shadow(0 0 5px rgba(109, 40, 217, 0.45))
    drop-shadow(0 2px 5px rgba(20, 12, 36, 0.55));
}

/* Ray Striker emblem */
.bey-emblem-img--striker {
  width: 90%;
  height: 90%;
  object-fit: contain;
  object-position: 50% 50%;
  filter:
    contrast(1.1)
    saturate(1.15)
    drop-shadow(0 0 5px rgba(20, 184, 166, 0.5))
    drop-shadow(0 2px 5px rgba(0, 0, 0, 0.5));
}

/* Dark Bull: transparent logo on the standard spinning emblem disc */
.bey-emblem-img--bull {
  width: 86%;
  height: 86%;
  object-fit: contain;
  object-position: 50% 50%;
  filter:
    contrast(1.12)
    saturate(1.15)
    drop-shadow(0 0 6px rgba(255, 255, 255, 0.35))
    drop-shadow(0 2px 5px rgba(0, 0, 0, 0.55));
}

/* Earth Eagle emblem */

.bey-type {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #0a0e1a;
  background: var(--bey-color);
  padding: 3px 12px;
  border-radius: 999px;
  margin-bottom: 8px;
}
.bey-name {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-bottom: 6px;
}
.bey-desc {
  font-size: 12px;
  line-height: 1.45;
  color: #8a9bc0;
  height: 52px;
  overflow: hidden;
  margin-bottom: 10px;
}

/* Metal Fusion packaging star stats */
.bey-packaging-stats {
  width: 100%;
  margin: 6px 0 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.35) 0%, rgba(0, 0, 0, 0.18) 100%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}

.bey-packaging-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 5px 0;
}

.bey-packaging-row + .bey-packaging-row {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.bey-packaging-label {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #c8d4f0;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

.bey-packaging-stars {
  display: flex;
  align-items: center;
  gap: 3px;
  flex: 0 0 auto;
}

.bey-star {
  font-size: 18px;
  line-height: 1;
  color: rgba(255, 255, 255, 0.14);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.5);
  transition: color 0.2s;
}

.bey-star.on {
  color: #f5c518;
  text-shadow:
    0 0 6px rgba(245, 197, 24, 0.55),
    0 1px 0 #b8860b;
}

.bey-card.active .bey-star.on {
  color: #ffd84d;
  text-shadow:
    0 0 8px color-mix(in srgb, var(--bey-color) 40%, #f5c518),
    0 0 4px rgba(245, 197, 24, 0.6),
    0 1px 0 #b8860b;
}

.bey-card.mystery .bey-packaging-stats {
  opacity: 0.55;
}

.bey-card.mystery .bey-star.on {
  color: rgba(255, 255, 255, 0.14);
  text-shadow: none;
}

.bey-moves {
  width: 100%;
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.bey-move {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  text-align: left;
}
.bey-move-tag {
  flex: 0 0 auto;
  font-size: 8.5px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #0a0e1a;
  background: var(--bey-color);
  padding: 2px 6px;
  border-radius: 5px;
}
.bey-move-name {
  color: #cdddff;
  font-weight: 600;
  line-height: 1.2;
}

.bey-select-btn {
  appearance: none;
  cursor: pointer;
  margin-top: 18px;
  width: 100%;
  padding: 12px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fff;
  border: none;
  border-radius: 10px;
  background: var(--bey-color);
  transition: filter 0.15s, transform 0.15s;
}
.bey-select-btn:hover:not(:disabled) { filter: brightness(1.12); }
.bey-select-btn:active:not(:disabled) { transform: scale(0.96); }
.bey-select-btn:disabled {
  cursor: not-allowed;
  background: rgba(255, 255, 255, 0.1);
  color: #6a7aa0;
}

.bey-taken {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%) rotate(-8deg);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.18em;
  color: #f87171;
  border: 2px solid #f87171;
  padding: 3px 12px;
  border-radius: 6px;
  background: rgba(10, 14, 26, 0.7);
  opacity: 0;
  transition: opacity 0.3s;
}
.bey-card.taken .bey-taken { opacity: 1; }

.carousel-indicators {
  display: flex;
  gap: 8px;
  z-index: 10;
}
.carousel-dot {
  width: 26px;
  height: 4px;
  border-radius: 2px;
  background: rgba(122, 140, 184, 0.3);
  transition: background 0.4s, box-shadow 0.4s;
}
.carousel-dot.on {
  background: #4f8cff;
  box-shadow: 0 0 8px rgba(79, 140, 255, 0.6);
}

.select-picks {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  z-index: 10;
  pointer-events: none;
}

.select-picks-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  width: 100%;
}

.select-picks-note {
  width: 100%;
  margin: 4px 0 0;
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: center;
  color: #6b7da8;
}
.pick-slot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.pick-slot.active {
  border-color: #4f8cff;
  box-shadow: 0 0 16px -4px rgba(79, 140, 255, 0.7);
}
.pick-label {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #7a8cb8;
}
.pick-bey {
  font-size: 13px;
  font-weight: 700;
  color: var(--bey-color, #cdddff);
}
.pick-bey.empty { color: #5a6a90; font-weight: 500; font-style: italic; }

#controls-hint,
#tilt-hint {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  max-width: min(420px, calc(100vw - 32px));
  text-align: center;
  line-height: 1.35;
  white-space: normal;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.35);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s;
}

#controls-hint.visible,
#tilt-hint.visible { opacity: 1; }

/* ---------- Virtual joystick + ability buttons ---------- */
.virtual-joystick {
  position: fixed;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 12;
  width: 120px;
  height: 120px;
  pointer-events: none;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.virtual-joystick:not(.hidden) {
  pointer-events: auto;
  opacity: 1;
}

.virtual-joystick.hidden {
  display: none;
}

.virtual-joystick-base {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(12, 18, 40, 0.55);
  border: 2px solid rgba(120, 160, 255, 0.35);
  box-shadow: inset 0 0 24px rgba(79, 140, 255, 0.12);
}

.virtual-joystick-knob {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 52px;
  height: 52px;
  margin: -26px 0 0 -26px;
  border-radius: 50%;
  background: linear-gradient(145deg, #6b9fff, #2563eb);
  border: 2px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 2px 12px rgba(37, 99, 235, 0.45);
  pointer-events: none;
  will-change: transform;
}

.ability-bar {
  position: fixed;
  bottom: 48px;
  z-index: 11;
  display: flex;
  gap: 10px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease;
  touch-action: none;
}
.ability-bar.visible { opacity: 1; }
.ability-bar-left { left: 16px; }
.ability-bar-right { right: 16px; }

/* Gyro / tilt: same right bias, ~25% larger hit targets */
body.mobile:not(.joystick-mode) .ability-bar-right {
  right: 10px;
  bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  gap: 12px;
}

body.mobile:not(.joystick-mode) #player-abilities .ability-btn {
  width: 115px;
  min-height: 115px;
  padding: 12px 10px 10px;
  border-radius: 18px;
  gap: 4px;
}

body.mobile:not(.joystick-mode) #player-abilities .ability-icon {
  font-size: 28px;
}

body.mobile:not(.joystick-mode) #player-abilities .ability-name {
  font-size: 10px;
}

body.mobile:not(.joystick-mode) #player-abilities .ability-status {
  font-size: 9px;
}

/* Joystick mode: huge left / right pads: slap without aiming */
body.mobile.joystick-mode #player-abilities.ability-bar {
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: calc(148px + env(safe-area-inset-bottom, 0px));
  padding:
    8px
    max(8px, env(safe-area-inset-right, 0px))
    max(10px, env(safe-area-inset-bottom, 0px))
    max(8px, env(safe-area-inset-left, 0px));
  box-sizing: border-box;
  gap: 0;
  justify-content: space-between;
  align-items: stretch;
  z-index: 13;
}

body.mobile.joystick-mode #player-abilities .ability-btn {
  width: min(132px, 34vw);
  min-height: 132px;
  flex: 0 0 auto;
  flex-shrink: 0;
  padding: 14px 10px 12px;
  border-radius: 22px;
  gap: 5px;
  justify-content: center;
}

body.mobile.joystick-mode #player-abilities .ability-name {
  font-size: 9px;
  max-height: 2.4em;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

body.mobile.joystick-mode #player-abilities .ability-icon {
  font-size: 30px;
}

body.mobile.joystick-mode #player-abilities .ability-status {
  font-size: 10px;
}

body.mobile.joystick-mode #tilt-hint {
  bottom: calc(168px + env(safe-area-inset-bottom, 0px));
}

body.mobile #hud {
  padding: 8px 10px;
  gap: 6px;
}

body.mobile:has(.campaign-hud:not(.hidden)) #hud {
  padding-top: 44px;
}

body.mobile .hud-panel {
  padding: 7px 10px;
  gap: 8px;
  border-radius: 10px;
}

body.mobile .hud-avatar {
  width: 42px;
  height: 42px;
  padding: 4px;
}

body.mobile .hud-label {
  font-size: 9px;
  letter-spacing: 0.1em;
  margin-bottom: 2px;
}

body.mobile .hud-value {
  font-size: 18px;
}

body.mobile .hud-bar-wrap {
  margin-top: 4px;
  height: 5px;
}

body.mobile .campaign-hud {
  top: 10px;
  padding: 6px 12px;
  font-size: 10px;
}

body.mobile #tilt-hint {
  bottom: max(10px, env(safe-area-inset-bottom, 0px));
  font-size: 10px;
  max-width: calc(100vw - 24px);
}

.ability-btn {
  --ability-glow: #4f8cff;
  --cd-ratio: 0;
  --cd-fill: 1;
  position: relative;
  pointer-events: auto;
  cursor: pointer;
  overflow: hidden;
  isolation: isolate;
  width: 92px;
  padding: 9px 8px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border-radius: 12px;
  border: 2px solid color-mix(in srgb, var(--ability-glow) 70%, #fff 12%);
  background:
    linear-gradient(
      180deg,
      color-mix(in srgb, var(--ability-glow) 22%, rgba(8, 12, 28, 0.88)) 0%,
      rgba(8, 12, 28, 0.88) 100%
    );
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #e8ecf4;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06) inset,
    0 0 18px -4px var(--ability-glow);
  transition: transform 0.12s, box-shadow 0.2s, filter 0.2s, border-color 0.2s;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}

.ability-face {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: inherit;
  pointer-events: none;
}

.ability-btn:active { transform: scale(0.96); }

.ability-btn.ready {
  animation: ability-ready-pulse 1.6s ease-in-out infinite;
  border-color: var(--ability-glow);
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--ability-glow) 45%, transparent) inset,
    0 0 28px -2px var(--ability-glow);
}

.ability-btn.cooling {
  filter: saturate(0.55) brightness(0.82);
  border-color: rgba(255, 255, 255, 0.14);
  box-shadow: none;
  animation: none;
}

.ability-btn.active {
  animation: none;
  box-shadow: 0 0 32px -1px var(--ability-glow);
  border-color: #fff;
}

@keyframes ability-ready-pulse {
  0%, 100% {
    box-shadow:
      0 0 0 1px color-mix(in srgb, var(--ability-glow) 35%, transparent) inset,
      0 0 18px -4px var(--ability-glow);
  }
  50% {
    box-shadow:
      0 0 0 1px color-mix(in srgb, var(--ability-glow) 55%, transparent) inset,
      0 0 34px 0 var(--ability-glow);
  }
}

.ability-icon {
  font-size: 22px;
  line-height: 1;
  color: var(--ability-glow);
  text-shadow: 0 0 10px var(--ability-glow);
}
.ability-name {
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: center;
  line-height: 1.2;
  color: #c8d4f0;
}
.ability-subtitle {
  font-size: 7px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: center;
  line-height: 1.1;
  color: #a78bfa;
  opacity: 0.92;
}
.ability-status {
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--ability-glow) 80%, #fff);
}
.ability-btn.cooling .ability-status {
  color: #9aa8c8;
}
.ability-btn.ready .ability-status {
  color: #e8fff0;
  text-shadow: 0 0 8px color-mix(in srgb, var(--ability-glow) 70%, transparent);
}
.ability-btn.active .ability-status {
  color: #fff;
}
.ability-key {
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  padding: 0 4px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #cdddff;
}

/* Bottom wipe + ring fill so loading is obvious */
.ability-cd {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(
      to top,
      rgba(5, 8, 18, 0.82) 0%,
      rgba(5, 8, 18, 0.82) calc(var(--cd-ratio) * 100%),
      transparent calc(var(--cd-ratio) * 100%)
    );
  transform: none !important;
}

.ability-btn.cooling::before {
  content: '';
  position: absolute;
  inset: 6px;
  z-index: 0;
  border-radius: inherit;
  pointer-events: none;
  background: conic-gradient(
    from -90deg,
    var(--ability-glow) 0deg,
    var(--ability-glow) calc(var(--cd-fill) * 360deg),
    rgba(255, 255, 255, 0.08) calc(var(--cd-fill) * 360deg)
  );
  mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4px));
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4px));
  opacity: 0.95;
}

.ability-btn.ready::before,
.ability-btn.active::before {
  content: none;
}

/* ---------- Special-move logo flash ---------- */
#special-flash {
  --flash-glow: #4f8cff;
  position: fixed;
  inset: 0;
  z-index: 150;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
}
#special-flash::before {
  content: '';
  position: absolute;
  width: 64vmin;
  height: 64vmin;
  border-radius: 50%;
  background: radial-gradient(circle, var(--flash-glow) 0%, transparent 65%);
  filter: blur(10px);
  opacity: 0;
  transform: scale(0.5);
}
#special-flash img {
  width: min(46vmin, 360px);
  height: auto;
  filter: drop-shadow(0 0 26px var(--flash-glow));
  transform: scale(0.6);
  opacity: 0;
}
#special-flash { --flash-dur: 0.825s; }
#special-flash.flash-play { animation: special-flash-fade var(--flash-dur) ease-out both; }
#special-flash.flash-play::before { animation: special-flash-glow var(--flash-dur) ease-out both; }
#special-flash.flash-play img { animation: special-flash-pulse var(--flash-dur) cubic-bezier(0.2, 0.9, 0.3, 1) both; }

@keyframes special-flash-fade {
  0% { opacity: 0; }
  15% { opacity: 1; }
  70% { opacity: 1; }
  100% { opacity: 0; }
}
@keyframes special-flash-pulse {
  0% { transform: scale(0.6); opacity: 0; }
  25% { transform: scale(1.25); opacity: 1; }
  55% { transform: scale(1.0); opacity: 1; }
  100% { transform: scale(1.4); opacity: 0; }
}
@keyframes special-flash-glow {
  0% { transform: scale(0.5); opacity: 0; }
  25% { transform: scale(1.1); opacity: 0.85; }
  100% { transform: scale(1.45); opacity: 0; }
}

/* ---------- Mobile bey selection (iPhone 14+ / 390×844+) ---------- */
body.mobile #select-overlay {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  align-items: stretch;
  justify-content: stretch;
  gap: 0;
  height: 100dvh;
  max-height: 100dvh;
  padding:
    max(10px, env(safe-area-inset-top, 0px))
    max(16px, env(safe-area-inset-left, 0px))
    0
    max(16px, env(safe-area-inset-right, 0px));
  overflow: hidden;
  overflow-y: hidden;
}

body.mobile .play-setup {
  grid-row: 1;
  width: 100%;
  max-width: none;
  gap: 8px;
  padding-top: 0;
  z-index: 20;
}

body.mobile .select-mount {
  grid-row: 2;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  grid-template-areas:
    "header"
    "carousel"
    "actions"
    "dots";
  align-items: stretch;
  justify-items: center;
  min-height: 0;
  width: 100%;
  gap: 4px;
  overflow: hidden;
  padding-bottom: max(8px, env(safe-area-inset-bottom, 0px));
}

body.mobile .select-mount > .select-header {
  grid-area: header;
  width: 100%;
  justify-self: stretch;
}

body.mobile .select-mount > .carousel-scene {
  grid-area: carousel;
  width: 100%;
  height: 100%;
  min-height: 0;
  align-self: stretch;
  justify-self: stretch;
}

body.mobile .select-mount > .carousel-indicators {
  grid-area: dots;
}

body.mobile .select-mount > .select-actions {
  grid-area: actions;
  width: 100%;
  justify-self: stretch;
}

body.mobile .select-picks {
  display: none;
}

body.mobile .select-picks-chips {
  gap: 6px;
}

body.mobile .pick-slot {
  padding: 6px 10px;
  min-height: 0;
}

body.mobile .pick-bey {
  font-size: 9px;
  max-width: 88px;
}

body.mobile .select-picks-note {
  margin: 2px 0 0;
  font-size: 9px;
}

body.mobile .play-setup-mode-btn {
  flex: 1 1 0;
  min-height: 46px;
  padding: 12px 14px;
  font-size: 13px;
}

body.mobile .play-setup-diff {
  width: 100%;
  gap: 6px;
}

body.mobile .play-setup-diff-label,
body.mobile .play-setup-arena-label {
  display: none;
}

body.mobile .play-setup-arena {
  width: 100%;
  max-width: none;
  gap: 4px;
}

body.mobile .play-setup-arena-select {
  max-width: none;
  min-height: 42px;
  font-size: 12px;
  padding: 12px 40px 12px 14px;
}

body.mobile .play-setup-diff-btns {
  gap: 5px;
  width: 100%;
  flex-wrap: nowrap;
}

body.mobile .play-setup-diff-btn {
  flex: 1 1 0;
  min-width: 0;
  min-height: 42px;
  padding: 10px 4px;
  font-size: 10.5px;
  letter-spacing: 0.04em;
}

body.mobile .play-setup-hint {
  font-size: 11px;
  line-height: 1.35;
  margin: 0;
  color: #8a9bc0;
}

body.mobile .play-setup.play-setup--tournament {
  gap: 6px;
  padding-bottom: 2px;
}

body.mobile .play-setup.play-setup--tournament .play-setup-hint {
  margin-top: 12px;
  margin-bottom: 10px;
  padding: 0 8px;
}

body.mobile #select-overlay:has(.play-setup--tournament) .select-mount {
  gap: 4px;
}

body.mobile #select-overlay:has(.play-setup--tournament) .select-header {
  padding-top: 4px;
  margin-bottom: 0;
}

body.mobile #select-overlay:has(.play-setup--tournament) .carousel-scene {
  padding-top: 4px;
}

body.mobile #select-overlay:has(.play-setup--tournament) .carousel-container {
  height: 100%;
  max-height: 100%;
  margin-top: 0;
}

body.mobile .select-header {
  flex: 0 0 auto;
  padding: 4px 4px 2px;
  margin-bottom: 2px;
  width: 100%;
}

body.mobile .select-title {
  font-size: clamp(1.05rem, 4.2vw, 1.35rem);
  line-height: 1.2;
}

body.mobile .select-sub {
  margin-top: 4px;
  font-size: 10px;
  letter-spacing: 0.18em;
}

body.mobile .carousel-scene {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  width: 100%;
  overflow: hidden;
  perspective: 1000px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  position: relative;
  padding-top: 2px;
  padding-bottom: 2px;
}

body.mobile .carousel-container {
  width: min(300px, calc(100vw - 80px));
  height: 100%;
  max-height: 100%;
  margin-top: 0;
  position: relative;
  transform-style: preserve-3d;
  overflow: visible;
}

body.mobile .carousel-arrow {
  width: 48px;
  height: 48px;
  min-width: 48px;
  min-height: 48px;
  font-size: 24px;
}

body.mobile .carousel-arrow.left { left: 0; }
body.mobile .carousel-arrow.right { right: 0; }

body.mobile .carousel-indicators {
  flex: 0 0 auto;
  justify-content: center;
  padding: 4px 0 2px;
  gap: 8px;
}

body.mobile .carousel-dot {
  width: 28px;
  height: 5px;
}

body.mobile .bey-item {
  position: absolute;
  top: 0;
  left: 50%;
  width: min(300px, calc(100vw - 80px));
  height: auto;
  max-height: 100%;
  display: block;
  overflow: visible;
}

body.mobile .bey-card {
  width: 100%;
  flex: none;
  min-height: 0;
  max-height: 100%;
  padding: 12px 14px 14px;
  overflow-x: hidden;
  overflow-y: visible;
  box-sizing: border-box;
}

body.mobile .bey-packaging-stats {
  margin: 4px 0 10px;
  padding: 8px 10px;
}

body.mobile .bey-packaging-label {
  font-size: 10px;
}

body.mobile .bey-star {
  font-size: 16px;
}

body.mobile .bey-emblem {
  width: 96px;
  height: 96px;
  margin-bottom: 8px;
  font-size: 36px;
  flex-shrink: 0;
}

body.mobile .bey-emblem-img {
  width: 92%;
  height: 92%;
}

body.mobile .bey-emblem-img--ldrago,
body.mobile .bey-emblem-img--lightning_ldrago,
body.mobile .bey-emblem-img--eagle,
body.mobile .bey-emblem-img--striker,
body.mobile .bey-emblem-img--bull {
  width: 88%;
  height: 88%;
}

body.mobile .bey-emblem-img--galaxy_pegasus,
body.mobile .bey-emblem-img--destroyer,
body.mobile .bey-emblem-img--tempo {
  width: 90%;
  height: 90%;
}

body.mobile .bey-type {
  margin-bottom: 6px;
  flex-shrink: 0;
  font-size: 10.5px;
  padding: 4px 14px;
}

body.mobile .bey-name {
  font-size: 18px;
  margin-bottom: 6px;
  flex-shrink: 0;
}

body.mobile .bey-desc {
  height: auto;
  max-height: 3em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 8px;
  font-size: 12px;
  line-height: 1.45;
  flex-shrink: 0;
}

body.mobile .bey-moves {
  margin-top: 8px;
  gap: 4px;
  flex-shrink: 0;
}

body.mobile .bey-move {
  font-size: 11px;
  gap: 8px;
}

body.mobile .bey-move-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.mobile .bey-select-btn {
  margin-top: 10px;
  min-height: 44px;
  padding: 12px;
  font-size: 14px;
  flex-shrink: 0;
  width: 100%;
}

body.mobile .select-actions {
  width: 100%;
  flex: 0 0 auto;
  margin-top: 0;
  padding: 2px 4px max(6px, env(safe-area-inset-bottom, 0px));
  z-index: 40;
}

body.mobile .select-random-btn {
  width: min(300px, calc(100vw - 80px));
  max-width: 100%;
  min-height: 44px;
  padding: 12px 16px;
}

/* Casual / Practice / 2P: keep Random in the reserved footer; card stays top-aligned. */
body.mobile #select-overlay:has(.play-setup--casual) .carousel-container,
body.mobile #select-overlay:has(.play-setup--practice) .carousel-container,
body.mobile #select-overlay:has(.play-setup--two-player) .carousel-container {
  height: 100%;
  max-height: 100%;
}

body.mobile #select-overlay:has(.play-setup--casual) .carousel-scene,
body.mobile #select-overlay:has(.play-setup--practice) .carousel-scene,
body.mobile #select-overlay:has(.play-setup--two-player) .carousel-scene {
  align-items: flex-start;
  padding-top: 0;
}

body.mobile #select-overlay:has(.play-setup--casual) .bey-emblem,
body.mobile #select-overlay:has(.play-setup--practice) .bey-emblem,
body.mobile #select-overlay:has(.play-setup--two-player) .bey-emblem {
  width: 88px;
  height: 88px;
  margin-bottom: 6px;
  font-size: 34px;
}

body.mobile #select-overlay:has(.play-setup--casual) .bey-packaging-stats,
body.mobile #select-overlay:has(.play-setup--practice) .bey-packaging-stats,
body.mobile #select-overlay:has(.play-setup--two-player) .bey-packaging-stats {
  margin: 2px 0 6px;
  padding: 6px 8px;
}

body.mobile #select-overlay:has(.play-setup--casual) .bey-select-btn,
body.mobile #select-overlay:has(.play-setup--practice) .bey-select-btn,
body.mobile #select-overlay:has(.play-setup--two-player) .bey-select-btn {
  margin-top: 8px;
  min-height: 42px;
  padding: 10px;
}

body.mobile .select-picks-chips {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 10px;
  width: 100%;
}

body.mobile .select-picks-note {
  margin: 6px 0 0;
  padding: 0 4px;
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: center;
  color: #6b7da8;
  line-height: 1.3;
}

body.mobile .pick-slot {
  flex: 1 1 0;
  min-width: 0;
  min-height: 48px;
  padding: 10px 12px;
  border-radius: 14px;
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

body.mobile .pick-slot.rival-slot {
  flex-direction: row;
  align-items: center;
}

body.mobile .pick-sub {
  display: none;
}

body.mobile .pick-label {
  font-size: 10px;
  letter-spacing: 0.12em;
}

body.mobile .pick-bey {
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

/* Tall modern phones (iPhone 14 Pro Max, Plus, 15 Pro Max) */
@media (min-width: 420px) and (min-height: 860px) {
  body.mobile .carousel-container,
  body.mobile .bey-item {
    width: min(320px, calc(100vw - 88px));
  }

  body.mobile .bey-emblem {
    width: 124px;
    height: 124px;
  }

  body.mobile .select-mount {
    gap: 10px;
  }
}

/* Compact fallback: older / smaller phones only */
@media (max-height: 700px), (max-width: 374px) {
  body.mobile .play-setup-hint,
  body.mobile .select-sub,
  body.mobile .select-picks-note {
    display: none;
  }

  body.mobile .play-setup {
    gap: 5px;
  }

  body.mobile .play-setup-diff-btn {
    font-size: 9px;
    min-height: 38px;
    padding: 8px 2px;
  }

  body.mobile .select-mount {
    gap: 4px;
  }

  body.mobile .carousel-container,
  body.mobile .bey-item {
    width: min(280px, calc(100vw - 88px));
  }

  body.mobile .bey-emblem {
    width: 100px;
    height: 100px;
  }

  body.mobile .bey-card {
    padding: 12px 14px 14px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  body.mobile .bey-name {
    font-size: 16px;
  }

  body.mobile .bey-desc {
    font-size: 10.5px;
    margin-bottom: 8px;
  }

  body.mobile .pick-slot {
    min-height: 44px;
    padding: 8px 10px;
  }
}

/* ---------- Online multiplayer ---------- */
#select-overlay:has(.online-flow:not(.hidden)) {
  justify-content: flex-start;
  padding: 16px 20px 28px;
  gap: 12px;
}

#select-overlay:has(.online-flow:not(.hidden)) .select-mount,
#select-overlay:has(.online-flow:not(.hidden)) .select-picks {
  display: none !important;
}

#select-overlay:has(.online-flow:not(.hidden)) .play-setup {
  width: min(100%, 560px);
  flex-shrink: 0;
}

#select-overlay:has(.online-flow:not(.hidden)) .play-setup-diff,
#select-overlay:has(.online-flow:not(.hidden)) .play-setup-arena,
#select-overlay:has(.online-flow:not(.hidden)) .play-setup-hint {
  display: none !important;
}

#select-overlay:has(.online-flow:not(.hidden)) .play-setup-modes {
  gap: 4px;
  padding: 3px;
}

#select-overlay:has(.online-flow:not(.hidden)) .play-setup-mode-btn {
  padding: 9px 12px;
  font-size: 10px;
}

#select-overlay:has(.online-flow:not(.hidden)) .online-flow {
  width: min(100%, 720px);
  flex: 1 1 auto;
  min-height: 0;
}

.online-flow {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
}

/* Shared card shell for lobby + selection */
.online-lobby,
.online-select {
  padding: 24px 20px;
  background: rgba(12, 18, 36, 0.92);
  border: 1px solid rgba(120, 160, 255, 0.22);
  border-radius: 18px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

/* ---- Lobby ---- */
.online-lobby {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 20px;
}

/* display:flex on panels overrides the native [hidden] rule: keep toggles working */
.online-lobby [hidden] {
  display: none !important;
}

.online-lobby-header {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.online-lobby-title {
  margin: 0;
  font-size: clamp(1.25rem, 2.5vw, 1.6rem);
  font-weight: 800;
  letter-spacing: 0.06em;
  background: linear-gradient(135deg, #fff 30%, #4f8cff);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.online-lobby-status {
  color: #8a9bc0;
  margin: 0;
  font-size: 14px;
}

.online-lobby-peers {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  width: 100%;
  max-width: 320px;
}

.online-peer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.online-peer-dot {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid rgba(120, 160, 255, 0.25);
  background: rgba(255, 255, 255, 0.04);
  transition: border-color 0.3s, background 0.3s, box-shadow 0.3s;
}

.online-peer.connected .online-peer-dot {
  border-color: #4f8cff;
  background: rgba(59, 130, 246, 0.2);
  box-shadow: 0 0 16px rgba(59, 130, 246, 0.45);
}

.online-peer-name {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #6b7da8;
  transition: color 0.3s;
}

.online-peer.connected .online-peer-name {
  color: #93c5fd;
}

.online-peer-connector {
  flex: 1 1 auto;
  height: 2px;
  min-width: 48px;
  margin: 0 8px;
  margin-bottom: 22px;
  background: rgba(120, 160, 255, 0.15);
  border-radius: 1px;
  position: relative;
}

.online-peer-connector::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, #4f8cff, transparent);
  opacity: 0;
  transition: opacity 0.3s;
}

.online-lobby-peers:has(.online-peer.connected + .online-peer-connector + .online-peer.connected)
  .online-peer-connector::after {
  opacity: 1;
}

.online-lobby-share {
  width: 100%;
  max-width: 480px;
  padding: 16px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(120, 160, 255, 0.15);
}

.online-lobby-entry {
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 14px;
}

/* `display:flex` on lobby panels overrides the HTML hidden attribute without this. */
.online-lobby-entry[hidden],
.online-lobby-room[hidden],
.online-lobby-share[hidden],
.online-ready-popup[hidden] {
  display: none !important;
}

.online-join-block {
  width: 100%;
  padding: 16px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(120, 160, 255, 0.15);
}

.online-lobby-divider {
  margin: 0;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #6b7ca8;
}

.online-create-block {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.online-joystick-locked-note {
  margin: 0;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(120, 160, 255, 0.15);
  color: rgba(220, 230, 255, 0.88);
  font-size: 0.86rem;
  line-height: 1.35;
  text-align: left;
}

.online-joystick-option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(120, 160, 255, 0.15);
  cursor: pointer;
  user-select: none;
}

.online-joystick-option input {
  margin-top: 3px;
  width: 18px;
  height: 18px;
  accent-color: #3b82f6;
  flex-shrink: 0;
}

.online-joystick-option-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.online-joystick-option-title {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #e8eeff;
}

.online-joystick-option-desc {
  font-size: 12px;
  line-height: 1.35;
  color: #8b9cc8;
}

.online-controls-label {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #9eb0d8;
}

.online-code-input {
  flex: 1;
  min-width: 0;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(120, 160, 255, 0.25);
  background: rgba(0, 0, 0, 0.35);
  color: #e8eeff;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-align: center;
  text-transform: uppercase;
  font-family: ui-monospace, monospace;
}

.online-code-input::placeholder {
  color: #5a6a90;
  font-weight: 600;
  letter-spacing: 0.12em;
}

.online-join-btn,
.online-create-btn {
  appearance: none;
  padding: 12px 18px;
  border-radius: 12px;
  border: none;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}

.online-join-btn {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #fff;
}

.online-join-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.online-create-btn {
  width: 100%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #e8eeff;
}

.online-create-btn:hover:not(:disabled),
.online-join-btn:hover:not(:disabled) {
  filter: brightness(1.08);
}

.online-lobby-room {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.online-room-code-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
}

.online-copy-code-btn {
  appearance: none;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid rgba(120, 160, 255, 0.3);
  background: rgba(79, 140, 255, 0.12);
  color: #c5d8ff;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  cursor: pointer;
}

.online-link-label {
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #8a9bc0;
}

.online-link-row {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}

.online-link-input {
  flex: 1;
  min-width: 0;
  padding: 11px 14px;
  border-radius: 10px;
  border: 1px solid rgba(120, 160, 255, 0.25);
  background: rgba(0, 0, 0, 0.35);
  color: #e8eeff;
  font-size: 13px;
  font-family: ui-monospace, monospace;
}

.online-room-code {
  margin: 10px 0 0;
  font-size: 13px;
  color: #8a9bc0;
}

.online-room-code strong {
  color: #c5d4f5;
  letter-spacing: 0.08em;
}

.online-link-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.online-link-actions .online-copy-btn,
.online-link-actions .online-share-btn {
  flex: 1 1 auto;
  min-width: 120px;
}

.online-share-btn {
  appearance: none;
  padding: 12px 24px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: #c5d4f5;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: filter 0.15s, background 0.15s;
}

.online-share-btn:hover:not(:disabled) {
  filter: brightness(1.1);
}

.online-wait-hint {
  margin: 0;
  font-size: 13px;
  color: #7a8cb8;
}

.online-copy-btn,
.online-continue-btn,
.online-lock-btn {
  appearance: none;
  padding: 12px 24px;
  border-radius: 12px;
  border: none;
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  color: #fff;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: filter 0.15s, transform 0.15s, opacity 0.15s;
}

.online-copy-btn:hover:not(:disabled),
.online-continue-btn:hover:not(:disabled),
.online-lock-btn:hover:not(:disabled) {
  filter: brightness(1.1);
}

.online-copy-btn:active:not(:disabled),
.online-continue-btn:active:not(:disabled),
.online-lock-btn:active:not(:disabled) {
  transform: scale(0.98);
}

.online-continue-btn {
  min-width: 200px;
}

.online-continue-btn:disabled,
.online-lock-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.online-ready-popup {
  position: fixed;
  inset: 0;
  z-index: 360;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding:
    16px
    max(16px, env(safe-area-inset-right, 0px))
    max(20px, env(safe-area-inset-bottom, 0px))
    max(16px, env(safe-area-inset-left, 0px));
  pointer-events: none;
}

.online-ready-popup:not([hidden]) {
  pointer-events: auto;
}

.online-ready-popup-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 12, 24, 0.78);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: online-ready-fade-in 0.25s ease-out;
}

.online-ready-popup-card {
  position: relative;
  width: min(100%, 420px);
  padding: 22px 20px 20px;
  border-radius: 18px 18px 16px 16px;
  background: linear-gradient(180deg, rgba(18, 26, 48, 0.98), rgba(12, 18, 36, 0.98));
  border: 1px solid rgba(120, 160, 255, 0.28);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  text-align: center;
  animation: online-ready-slide-up 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}

.online-ready-popup-eyebrow {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #86efac;
}

.online-ready-popup-title {
  margin: 0 0 8px;
  font-size: clamp(1.2rem, 4vw, 1.45rem);
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #e8eeff;
}

.online-ready-popup-desc {
  margin: 0 0 18px;
  font-size: 14px;
  line-height: 1.45;
  color: #8a9bc0;
}

.online-ready-popup-card .online-continue-btn {
  width: 100%;
  max-width: none;
  min-width: 0;
  padding: 14px 20px;
  font-size: 14px;
}

@keyframes online-ready-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes online-ready-slide-up {
  from {
    opacity: 0;
    transform: translateY(28px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (min-width: 768px) {
  .online-ready-popup {
    align-items: center;
    padding: 24px;
  }

  .online-ready-popup-card {
    border-radius: 18px;
    padding: 28px 24px 24px;
  }
}

.online-lock-btn.locked {
  background: rgba(34, 197, 94, 0.25);
  border: 1px solid rgba(34, 197, 94, 0.5);
  color: #86efac;
}

/* ---- Bey selection ---- */
.online-select {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.online-select-header {
  text-align: center;
  flex-shrink: 0;
}

.online-select-title {
  margin: 0 0 6px;
  font-size: clamp(1.15rem, 2.5vw, 1.45rem);
  font-weight: 800;
  letter-spacing: 0.05em;
  color: #e8eeff;
}

.online-select-hint {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: #8a9bc0;
}

.online-select-arena {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  flex-shrink: 0;
  width: min(100%, 360px);
  margin: 0 auto;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(120, 160, 255, 0.28);
  background: rgba(18, 28, 52, 0.92);
  box-sizing: border-box;
}

.online-select-arena-label {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 700;
  color: #b8c6e6;
  text-align: center;
}

.online-select-arena-select {
  appearance: none;
  width: 100%;
  max-width: none;
  min-height: 44px;
  padding: 12px 40px 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(120, 160, 255, 0.4);
  background:
    linear-gradient(45deg, transparent 50%, #9eb0d8 50%) right 16px top 50% / 6px 6px no-repeat,
    linear-gradient(135deg, transparent 50%, #9eb0d8 50%) right 11px top 50% / 6px 6px no-repeat,
    rgba(8, 14, 28, 0.95);
  color: #eef3ff;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  touch-action: manipulation;
}

.online-select-arena-select:disabled {
  opacity: 0.65;
  cursor: default;
}

.online-select-arena-select:focus {
  outline: none;
  border-color: rgba(79, 140, 255, 0.7);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.25);
}

.online-select-arena-select option {
  background: #0c1224;
  color: #d8e2f8;
}

.online-select-arena-guest {
  margin: 0;
  font-size: 13px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-weight: 700;
  color: #d0daf4;
  text-align: center;
}

.online-select-arena-guest.hidden,
.online-select-arena-select.hidden,
.online-select-arena-label.hidden {
  display: none;
}

.online-select-statuses {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.online-select-statuses .online-opponent-status,
.online-select-statuses .online-your-status {
  margin: 0;
}

.online-opponent-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 10px auto 0;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(120, 160, 255, 0.2);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #8a9bc0;
}

.online-opponent-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: #eab308;
  box-shadow: 0 0 6px rgba(234, 179, 8, 0.6);
}

.online-opponent-status.rival-locked .online-opponent-status-dot {
  background: #22c55e;
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.6);
}

.online-your-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 8px auto 0;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(120, 160, 255, 0.2);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #8a9bc0;
}

.online-your-status.rival-locked {
  color: #c8f0d4;
  border-color: rgba(34, 197, 94, 0.35);
}

.online-your-status.rival-locked .online-opponent-status-dot {
  background: #22c55e;
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.6);
}

.online-opponent-status.revealing .online-opponent-status-dot {
  background: #4f8cff;
  box-shadow: 0 0 6px rgba(79, 140, 255, 0.6);
}

.online-select-panels {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  gap: 12px;
}

.online-select-yours {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  padding: 10px 8px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(120, 160, 255, 0.12);
}

.online-select-label {
  text-align: center;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #8a9bc0;
  margin: 0 0 12px;
}

.online-carousel-mount {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 0;
  width: 100%;
}

.online-carousel-scene {
  --online-bey-card-width: 260px;
  position: relative;
  width: 100%;
  max-height: 380px;
  flex: 1 1 auto;
  overflow: visible;
  display: flex;
  align-items: center;
  justify-content: center;
}

.online-carousel-scene .carousel-container {
  width: var(--online-bey-card-width);
  height: 340px;
  margin: 0 auto;
}

.online-carousel-scene .bey-item {
  top: 50%;
  width: var(--online-bey-card-width);
  opacity: 1;
}

.online-carousel-scene .bey-card.online-pick-card {
  padding: 16px 14px 18px;
  gap: 6px;
  background: #10182c;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
}

.online-carousel-scene .bey-card.online-pick-card.active {
  background: #141e36;
  border-color: var(--bey-color);
  box-shadow:
    0 8px 28px rgba(0, 0, 0, 0.45),
    0 0 36px -4px var(--bey-color);
}

.online-carousel-scene .bey-card.online-pick-card .bey-name {
  color: #eef2ff;
}

.online-carousel-scene .bey-card.online-pick-card .bey-packaging-stats {
  background: rgba(0, 0, 0, 0.42);
  border-color: rgba(255, 255, 255, 0.14);
}

.online-carousel-scene .bey-emblem {
  width: 96px;
  height: 96px;
  margin: 0 auto 12px;
  font-size: 32px;
}

.online-carousel-scene .bey-emblem .bey-emblem-img {
  width: 86%;
  height: 86%;
  object-fit: contain;
  object-position: center;
  display: block;
  margin: 0 auto;
}

.online-carousel-scene .bey-type {
  font-size: 9px;
  margin-bottom: 2px;
}

.online-carousel-scene .bey-name {
  font-size: 14px;
  line-height: 1.2;
  margin-bottom: 6px;
}

.online-carousel-scene .bey-packaging-stats {
  transform: scale(0.88);
  transform-origin: center top;
  margin-top: 2px;
}

.online-carousel-scene .carousel-arrow {
  width: 38px;
  height: 38px;
  font-size: 22px;
  z-index: 2;
}

.online-carousel-scene .carousel-arrow.left { left: 4px; }
.online-carousel-scene .carousel-arrow.right { right: 4px; }

.online-carousel-mount .carousel-indicators {
  margin-top: 10px;
}

.online-mystery-card {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 240px;
  padding: 20px 16px;
  border-radius: 14px;
  border: 2px dashed rgba(120, 160, 255, 0.3);
  background: rgba(0, 0, 0, 0.25);
  transition: border-color 0.3s, background 0.3s;
}

.online-mystery-card.rival-locked {
  border-style: solid;
  border-color: rgba(59, 130, 246, 0.5);
  background: rgba(59, 130, 246, 0.08);
}

.mystery-emblem {
  width: 96px;
  height: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  opacity: 0.45;
  margin-bottom: 12px;
  line-height: 1;
}

.mystery-emblem img,
.mystery-emblem .bey-emblem-img {
  width: 86%;
  height: 86%;
  object-fit: contain;
  object-position: center;
  opacity: 1;
}

.mystery-status {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #8a9bc0;
  text-align: center;
}

.online-select-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  flex-shrink: 0;
  padding-top: 4px;
  position: sticky;
  bottom: 0;
  z-index: 2;
  background: linear-gradient(180deg, transparent 0%, rgba(8, 12, 24, 0.92) 28%, rgba(8, 12, 24, 0.98) 100%);
  padding-bottom: max(4px, env(safe-area-inset-bottom, 0px));
}

.online-lock-btn {
  min-width: 168px;
}

.online-unlock-btn {
  appearance: none;
  padding: 11px 18px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: transparent;
  color: #c5d0ea;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.online-unlock-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.35);
}

.online-random-btn {
  appearance: none;
  min-width: 132px;
  padding: 11px 18px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 255, 0.45);
  background: rgba(99, 102, 241, 0.14);
  color: #c7d2fe;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, filter 0.15s, transform 0.15s;
}

.online-random-btn:hover:not(:disabled) {
  background: rgba(99, 102, 241, 0.24);
  border-color: rgba(165, 180, 252, 0.7);
  filter: brightness(1.06);
}

.online-random-btn:active:not(:disabled) {
  transform: scale(0.98);
}

.online-random-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.online-random-btn.rolling {
  border-color: rgba(250, 204, 21, 0.55);
  background: rgba(250, 204, 21, 0.12);
  color: #fde68a;
}

.online-carousel-mount.is-random-spinning .carousel-arrow,
.online-carousel-mount.is-random-spinning .carousel-dot {
  pointer-events: none;
  opacity: 0.45;
}

.online-carousel-mount.is-random-spinning .bey-card.active {
  box-shadow: 0 0 0 1px rgba(250, 204, 21, 0.35), 0 0 24px rgba(99, 102, 241, 0.28);
}

/* PC / desktop layout */
@media (min-width: 640px) {
  .online-link-row {
    flex-direction: row;
    align-items: stretch;
  }

  .online-copy-btn,
  .online-share-btn {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .online-lobby,
  .online-select {
    padding: 28px 32px;
  }

  .online-lobby-peers {
    max-width: 360px;
  }

  .online-peer-dot {
    width: 52px;
    height: 52px;
  }
}

@media (min-width: 768px) {
  #select-overlay:has(.online-flow:not(.hidden)) {
    justify-content: center;
    padding: 24px 32px;
  }

  .online-select-panels {
    gap: 24px;
  }

  .online-carousel-scene {
    --online-bey-card-width: 240px;
    max-height: 380px;
  }

  .online-carousel-scene .carousel-container {
    width: var(--online-bey-card-width);
    height: 340px;
  }

  .online-carousel-scene .bey-item {
    width: var(--online-bey-card-width);
  }
}

@media (max-width: 600px) {
  .online-carousel-scene {
    max-height: min(42vh, 280px);
  }
}

/* Mobile online tab + selection */
body.mobile #select-overlay:has(.online-flow:not(.hidden)) {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  padding:
    max(8px, env(safe-area-inset-top, 0px))
    max(12px, env(safe-area-inset-left, 0px))
    max(8px, env(safe-area-inset-bottom, 0px))
    max(12px, env(safe-area-inset-right, 0px));
  gap: 8px;
}

body.mobile #select-overlay:has(.online-flow:not(.hidden)) .play-setup {
  width: 100%;
  flex-shrink: 0;
}

body.mobile #select-overlay:has(.online-flow:not(.hidden)) .online-flow {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

body.mobile #select-overlay:has(.online-flow:not(.hidden)) .online-flow:has(.online-lobby) {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

body.mobile #select-overlay:has(.online-flow:not(.hidden)) .online-flow:has(.online-select) {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

body.mobile .online-lobby,
body.mobile .online-select {
  padding: 12px 12px 8px;
  gap: 10px;
  flex: 1 1 auto;
  min-height: 0;
}

body.mobile .online-lobby {
  overflow: hidden;
}

body.mobile .online-select {
  overflow: visible;
}

body.mobile .online-lobby-peers {
  max-width: 100%;
}

body.mobile .online-peer-dot {
  width: 40px;
  height: 40px;
}

body.mobile .online-link-input {
  font-size: 11px;
}

body.mobile .online-select-header {
  margin-bottom: 0;
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 4px 8px;
}

body.mobile .online-select-title {
  width: 100%;
  font-size: 1rem;
  margin-bottom: 0;
}

body.mobile .online-select-hint {
  width: 100%;
  font-size: 11px;
  line-height: 1.35;
}

body.mobile .online-select-arena {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 10px 12px;
}

body.mobile .online-select-arena-label {
  font-size: 10px;
}

body.mobile .online-select-arena-select {
  min-height: 46px;
  font-size: 12px;
  padding: 12px 38px 12px 12px;
}

body.mobile .online-select-statuses {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  width: 100%;
  margin-top: 4px;
}

body.mobile .online-opponent-status,
body.mobile .online-your-status {
  margin: 0;
  font-size: 10px;
  padding: 4px 10px;
}

body.mobile .online-select-panels {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

body.mobile .online-select-yours {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 4px 2px;
  overflow: hidden;
}

/* Fill remaining height: fixed vh caps clipped full bey cards */
body.mobile .online-carousel-scene.carousel-scene {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  width: 100%;
  overflow: visible;
  align-items: center;
  justify-content: center;
  padding-top: 0;
  padding-bottom: 0;
}

body.mobile .online-carousel-scene {
  --online-bey-card-width: min(280px, calc(100vw - 64px));
}

body.mobile .online-carousel-scene .carousel-container {
  width: var(--online-bey-card-width);
  height: 100%;
  max-height: 100%;
  margin-top: 0;
}

body.mobile .online-carousel-scene .bey-item {
  top: 50%;
  width: var(--online-bey-card-width);
}

body.mobile .online-carousel-scene .bey-card.online-pick-card {
  padding: 12px 12px 14px;
  gap: 4px;
}

body.mobile .online-carousel-scene .bey-emblem {
  width: 80px;
  height: 80px;
  margin-bottom: 8px;
  font-size: 28px;
}

body.mobile .online-carousel-scene .bey-type {
  font-size: 9px;
  padding: 3px 10px;
  margin-bottom: 4px;
}

body.mobile .online-carousel-scene .bey-name {
  font-size: 15px;
  margin-bottom: 4px;
}

body.mobile .online-carousel-scene .bey-packaging-stats {
  transform: scale(0.82);
  transform-origin: center top;
  margin: 0;
  padding: 6px 8px;
}

body.mobile .online-carousel-scene .carousel-arrow {
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
  font-size: 20px;
}

body.mobile .online-carousel-mount {
  flex: 1 1 auto;
  min-height: 0;
  justify-content: center;
  display: flex;
  flex-direction: column;
}

body.mobile .online-carousel-mount .carousel-indicators {
  flex-shrink: 0;
  margin-top: 6px;
}

body.mobile .online-lock-btn,
body.mobile .online-random-btn,
body.mobile .online-continue-btn {
  width: 100%;
  max-width: none;
}

body.mobile .online-select-actions {
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  padding-top: 6px;
  padding-bottom: max(4px, env(safe-area-inset-bottom, 0px));
}

#btn-restart.ready-waiting {
  opacity: 0.65;
  cursor: wait;
}

/* ── Let it rip launch mini-game ───────────────────────────────── */
.launch-overlay {
  position: fixed;
  inset: 0;
  z-index: 280;
  display: none;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  touch-action: none;
  user-select: none;
  background:
    radial-gradient(ellipse at 50% 42%, rgba(18, 28, 58, 0.55) 0%, rgba(4, 7, 16, 0.88) 70%),
    rgba(4, 7, 16, 0.72);
}

.launch-overlay.is-active {
  display: flex;
  pointer-events: auto;
}

.launch-overlay-card {
  position: relative;
  z-index: 1;
  width: min(92vw, 420px);
  text-align: center;
  padding: 28px 22px 24px;
  opacity: 0;
  transform: translateY(14px) scale(0.96);
}

.launch-overlay.is-in .launch-overlay-card,
.launch-overlay.is-hold .launch-overlay-card,
.launch-overlay.is-rip .launch-overlay-card,
.launch-overlay.is-result .launch-overlay-card {
  opacity: 1;
  transform: none;
  transition: opacity 0.28s ease, transform 0.28s ease;
}

.launch-overlay.is-out .launch-overlay-card {
  opacity: 0;
  transform: translateY(-12px) scale(1.02);
  transition: opacity 0.24s ease, transform 0.24s ease;
}

.launch-overlay-kicker {
  margin: 0 0 8px;
  font-size: 11px;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: var(--launch-accent, #4f8cff);
  text-shadow: 0 0 16px color-mix(in srgb, var(--launch-accent, #4f8cff) 55%, transparent);
}

.launch-overlay-count {
  margin: 0;
  min-height: 1.15em;
  font-size: clamp(2.6rem, 12vw, 4.4rem);
  font-weight: 900;
  letter-spacing: 0.04em;
  line-height: 1.1;
  text-transform: uppercase;
  color: #f4f7ff;
  text-shadow: 0 0 40px color-mix(in srgb, var(--launch-accent, #4f8cff) 50%, transparent);
}

.launch-overlay-count.is-rip-text {
  font-size: clamp(1.85rem, 8.5vw, 3rem);
  letter-spacing: 0.08em;
  color: #fff6d8;
  text-shadow:
    0 0 28px rgba(255, 196, 64, 0.65),
    0 0 56px color-mix(in srgb, var(--launch-accent, #4f8cff) 40%, transparent);
}

.launch-overlay-count.is-pop {
  animation: launch-count-pop 0.38s cubic-bezier(0.2, 0.9, 0.3, 1) both;
}

.launch-overlay-count.grade-perfect {
  color: #ffe08a;
  text-shadow: 0 0 36px rgba(255, 200, 64, 0.75);
}

.launch-overlay-count.grade-great {
  color: #9dffc2;
}

.launch-overlay-count.grade-good {
  color: #9ec5ff;
}

.launch-overlay-count.grade-weak {
  color: #ffd29a;
}

.launch-overlay-count.grade-miss {
  color: #ff9b9b;
}

@keyframes launch-count-pop {
  0% { transform: scale(0.72); opacity: 0.35; }
  55% { transform: scale(1.08); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

.launch-overlay-hint {
  margin: 16px 0 0;
  min-height: 1.3em;
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #9aa8c8;
}

.launch-overlay-meter {
  margin: 22px auto 0;
  width: min(78vw, 280px);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.launch-overlay-meter.is-live {
  opacity: 1;
}

.launch-overlay-meter-track {
  position: relative;
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: visible;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.launch-overlay-meter-zones {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  overflow: hidden;
}

.launch-overlay-meter-zone {
  position: absolute;
  top: 0;
  bottom: 0;
}

.launch-overlay-meter-zone.zone-miss {
  background: linear-gradient(180deg, rgba(248, 113, 113, 0.55), rgba(185, 28, 28, 0.7));
}

.launch-overlay-meter-zone.zone-weak {
  background: linear-gradient(180deg, rgba(251, 191, 36, 0.55), rgba(217, 119, 6, 0.72));
}

.launch-overlay-meter-zone.zone-good {
  background: linear-gradient(180deg, rgba(96, 165, 250, 0.6), rgba(37, 99, 235, 0.75));
}

.launch-overlay-meter-zone.zone-great {
  background: linear-gradient(180deg, rgba(74, 222, 128, 0.65), rgba(22, 163, 74, 0.8));
}

.launch-overlay-meter-zone.zone-perfect {
  background: linear-gradient(180deg, rgba(253, 230, 138, 0.95), rgba(245, 158, 11, 0.95));
  box-shadow: 0 0 14px rgba(255, 200, 80, 0.55);
}

.launch-overlay-meter-labels {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  padding: 0 2px;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
}

.launch-overlay-meter-labels .zone-label.zone-miss {
  color: #fca5a5;
}

.launch-overlay-meter-labels .zone-label.zone-perfect {
  color: #fde68a;
  text-shadow: 0 0 10px rgba(251, 191, 36, 0.45);
}

.launch-overlay-meter-needle {
  position: absolute;
  top: -6px;
  left: 0%;
  width: 3px;
  height: 22px;
  margin-left: -1.5px;
  border-radius: 2px;
  background: #fff;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.7);
  z-index: 2;
}

.launch-overlay-result {
  margin: 14px 0 0;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #d7e2ff;
}

.launch-overlay-spin {
  margin: 8px 0 0;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #8fa0c4;
}

.countdown-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(4rem, 20vw, 8rem);
  font-weight: 900;
  color: #fff;
  text-shadow: 0 0 40px rgba(59, 130, 246, 0.8);
  pointer-events: none;
  opacity: 0;
  z-index: 400;
  transition: opacity 0.2s;
}

.countdown-overlay.visible {
  opacity: 1;
}

.countdown-overlay--rip {
  font-size: clamp(2rem, 11vw, 4.5rem);
  letter-spacing: 0.05em;
  text-align: center;
  padding: 0 20px;
  line-height: 1.1;
}

.gameover-ready {
  margin: -16px 0 24px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #7dd3fc;
}

.gameover-ready.hidden {
  display: none;
}

.net-debug {
  position: fixed;
  top: 8px;
  right: 8px;
  z-index: 300;
  padding: 4px 8px;
  font-size: 10px;
  font-family: monospace;
  background: rgba(0, 0, 0, 0.65);
  color: #7dd3fc;
  border-radius: 6px;
  pointer-events: none;
}

body.vs-online #start-keys {
  display: none !important;
}

body.vs-online #p2-abilities {
  display: none !important;
}
