/* Cyber Saber 3D Custom Neon & Futuristic Styles */

/* Ensure smooth native mobile feeling */
* {
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

body {
  touch-action: none;
  background-color: #010308;
}

/* Neon glow animations */
@keyframes neonPulse {
  0%, 100% {
    filter: drop-shadow(0 0 10px rgba(6, 182, 212, 0.6)) drop-shadow(0 0 25px rgba(6, 182, 212, 0.3));
  }
  50% {
    filter: drop-shadow(0 0 18px rgba(6, 182, 212, 0.9)) drop-shadow(0 0 35px rgba(244, 63, 94, 0.5));
  }
}

.neon-glow {
  animation: neonPulse 3s ease-in-out infinite;
}

/* Hologram scanline effect */
#game-root::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.03), rgba(0, 255, 240, 0.01), rgba(0, 0, 255, 0.03));
  background-size: 100% 3px, 4px 100%;
  z-index: 4;
  opacity: 0.5;
}

/* Touch slash layer covers playfield seamlessly with touch-action: none */
#touch-slash-layer {
  top: 0;
  pointer-events: auto;
  touch-action: none;
}

/* Subtle glowing screen division indicating left & right saber control zones */
.split-zone-divider {
  position: absolute;
  left: 50%;
  top: 14%;
  bottom: 12%;
  width: 1px;
  transform: translateX(-50%);
  background: linear-gradient(180deg, transparent 0%, rgba(6, 182, 212, 0.3) 30%, rgba(244, 63, 94, 0.3) 70%, transparent 100%);
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.2);
  pointer-events: none;
  opacity: 0.55;
}

/* Reserves the corner on phones so the combo pill does not sit under Pause. */
.pause-slot {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
}
@media (min-width: 640px) {
  .pause-slot { display: none; }
}

/* Corner pause control — not inside the transparent HUD or the full-screen slash layer. */
#btn-pause {
  position: absolute;
  top: 12px;
  right: 12px;
  left: auto;
  z-index: 36;
  width: 48px;
  height: 48px;
  min-width: 48px;
  min-height: 48px;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 12px;
  border: 1px solid rgba(71, 85, 105, 0.75);
  background: rgba(15, 23, 42, 0.94);
  color: #fff;
  box-shadow: 0 0 16px rgba(6, 182, 212, 0.28);
  pointer-events: auto;
  opacity: 1;
  visibility: visible;
  touch-action: manipulation;
}
#btn-pause svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
  display: block;
  pointer-events: none;
}
#btn-pause * {
  pointer-events: none;
}
#game-root.is-playing #btn-pause {
  display: flex !important;
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
}
#game-root.is-playing #ingame-hud {
  display: flex !important;
  opacity: 1 !important;
  visibility: visible !important;
  transition: none !important;
}
#game-root:not(.is-playing) #ingame-hud {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Custom scrollbars */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}
::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.6);
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb {
  background: rgba(6, 182, 212, 0.4);
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(6, 182, 212, 0.8);
}

/* Range input styling */
input[type="range"] {
  height: 6px;
  border-radius: 9999px;
  background: #1e293b;
}

/* Floating 3D Text Damage/Score Popups */
.floating-hit-score {
  position: absolute;
  pointer-events: none;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-weight: 900;
  text-shadow: 0 0 14px currentColor, 0 2px 4px rgba(0, 0, 0, 0.85);
  transform: translate(-50%, -50%);
  animation: floatUpFade 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  z-index: 25;
  white-space: nowrap;
  letter-spacing: 0.05em;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(7, 12, 24, 0.8);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

@keyframes floatUpFade {
  0% {
    opacity: 0;
    transform: translate(-50%, -20%) scale(0.6);
  }
  25% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.2);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -115%) scale(0.85);
  }
}

/* Menu stage: near-black void, perspective grid, flank light columns */
#menu-overlay.menu-stage {
  background: #010308;
}

#menu-overlay > .menu-atmosphere {
  position: fixed;
  inset: 0;
  z-index: 0;
  margin: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  flex: none;
  pointer-events: none;
  overflow: hidden;
  background:
    radial-gradient(ellipse 46% 32% at 50% 16%, rgba(8, 40, 68, 0.55), transparent 72%),
    #010308;
}

.menu-col {
  position: absolute;
  top: 8%;
  bottom: 0;
  width: 56px;
  pointer-events: none;
}

.menu-col::before {
  content: "";
  position: absolute;
  inset: 0;
  filter: blur(10px);
}

.menu-col::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 6%;
  bottom: 8%;
  width: 2px;
  transform: translateX(-50%);
}

.menu-col-cyan {
  left: 5%;
}

.menu-col-cyan::before {
  background: linear-gradient(180deg, transparent 0%, rgba(34, 211, 238, 0.42) 24%, rgba(34, 211, 238, 0.16) 68%, transparent 100%);
  box-shadow: 0 0 36px rgba(34, 211, 238, 0.35);
}

.menu-col-cyan::after {
  background: linear-gradient(180deg, transparent, rgba(165, 243, 252, 0.9), rgba(34, 211, 238, 0.2), transparent);
  box-shadow: 0 0 12px rgba(34, 211, 238, 0.8);
}

.menu-col-magenta {
  right: 5%;
}

.menu-col-magenta::before {
  background: linear-gradient(180deg, transparent 0%, rgba(244, 63, 94, 0.4) 26%, rgba(168, 85, 247, 0.16) 70%, transparent 100%);
  box-shadow: 0 0 36px rgba(244, 63, 94, 0.32);
}

.menu-col-magenta::after {
  background: linear-gradient(180deg, transparent, rgba(251, 113, 133, 0.9), rgba(244, 63, 94, 0.2), transparent);
  box-shadow: 0 0 12px rgba(244, 63, 94, 0.75);
}

.menu-grid-floor {
  position: absolute;
  left: -8%;
  right: -8%;
  bottom: -6%;
  height: 52%;
  pointer-events: none;
  background-image:
    linear-gradient(to top, rgba(34, 211, 238, 0.42) 1px, transparent 1px),
    linear-gradient(to right, rgba(244, 63, 94, 0.3) 1px, transparent 1px);
  background-size: 64px 64px, 64px 64px;
  transform: perspective(520px) rotateX(66deg);
  transform-origin: center bottom;
  -webkit-mask-image: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.45) 52%, transparent 100%);
  mask-image: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.45) 52%, transparent 100%);
}

.menu-grid-floor::after {
  content: "";
  position: absolute;
  left: 8%;
  right: 8%;
  top: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(34, 211, 238, 0.55), rgba(244, 63, 94, 0.5), transparent);
  filter: blur(0.5px);
}

@media (min-width: 900px) {
  .menu-col {
    width: 96px;
  }
  .menu-col-cyan { left: 7%; }
  .menu-col-magenta { right: 7%; }
  .menu-grid-floor { height: 58%; }
}

@media (max-width: 640px) {
  .menu-col {
    width: 28px;
    opacity: 0.7;
  }
  .menu-col-cyan { left: 0; }
  .menu-col-magenta { right: 0; }
}

/* Title glow and readable secondary type */
.logo-aura {
  inset: -1.6rem -2.4rem;
  opacity: 0.62;
  filter: blur(34px);
  animation: auraPulse 3.4s ease-in-out infinite;
}

@keyframes auraPulse {
  0%, 100% { opacity: 0.46; transform: scale(1); }
  50% { opacity: 0.78; transform: scale(1.05); }
}

.saber-title {
  letter-spacing: 0.12em;
  filter:
    drop-shadow(0 0 8px rgba(255, 255, 255, 0.35))
    drop-shadow(0 0 16px rgba(34, 211, 238, 0.95))
    drop-shadow(0 0 34px rgba(6, 182, 212, 0.75))
    drop-shadow(0 0 48px rgba(168, 85, 247, 0.4));
}

.menu-meta {
  color: #d6dee8;
}

/* Lifted track card: low-opacity cyan-to-magenta frame */
.track-card {
  position: relative;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0) 30%),
    linear-gradient(#10182a, #0c1322) padding-box,
    linear-gradient(105deg, rgba(34, 211, 238, 0.4), rgba(148, 163, 184, 0.1), rgba(244, 63, 94, 0.36)) border-box;
  background-origin: border-box;
  background-clip: padding-box, padding-box, border-box;
  border: 1px solid transparent;
  box-shadow:
    0 18px 44px rgba(0, 0, 0, 0.5),
    0 0 26px rgba(6, 182, 212, 0.07),
    inset 0 1px 0 rgba(186, 230, 253, 0.22);
}

/* Difficulty: solid dark idle, filled cyan when selected */
.diff-btn {
  background: #0b1220;
  color: #cbd5e1;
  border: 1px solid rgba(148, 163, 184, 0.34);
}

.diff-btn:hover {
  border-color: rgba(186, 214, 232, 0.55);
  color: #f1f5f9;
}

.diff-btn.active-diff {
  background: #06b6d4;
  color: #ffffff;
  border-color: #22d3ee;
  box-shadow:
    0 0 16px rgba(6, 182, 212, 0.62),
    0 0 4px rgba(34, 211, 238, 0.85);
}

.diff-btn.active-diff:hover {
  filter: brightness(1.06);
}

/* Track Badges in Carousel */
.track-badge-synth {
  background: rgba(6, 182, 212, 0.18);
  border: 1px solid rgba(6, 182, 212, 0.45);
  color: #38bdf8;
}

.track-badge-ai {
  background: rgba(168, 85, 247, 0.22);
  border: 1px solid rgba(168, 85, 247, 0.6);
  color: #c084fc;
  box-shadow: 0 0 10px rgba(168, 85, 247, 0.35);
  animation: aiGlowPulse 2.5s ease-in-out infinite;
}

@keyframes aiGlowPulse {
  0%, 100% {
    box-shadow: 0 0 8px rgba(168, 85, 247, 0.3);
  }
  50% {
    box-shadow: 0 0 16px rgba(168, 85, 247, 0.65), 0 0 24px rgba(6, 182, 212, 0.4);
  }
}

/* AI Presets in Generator */
.ai-preset-btn:hover {
  background: rgba(15, 23, 42, 0.95);
  box-shadow: 0 0 12px rgba(168, 85, 247, 0.25);
}

/* Native audio element in dark theme */
#ai-audio-player {
  filter: invert(0.9) hue-rotate(180deg);
}

/* Equal input-mode pills; only the active one is filled cyan */
.ctrl-mode-row {
  width: 100%;
  max-width: 100%;
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.ctrl-mode-btn {
  flex: 1 1 0;
  min-width: 0;
  height: 44px;
  min-height: 44px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.32);
  background: #0b1220;
  color: #cbd5e1;
  font-size: clamp(10px, 2.65vw, 13px);
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.01em;
  white-space: nowrap;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.ctrl-mode-btn:hover {
  border-color: rgba(34, 211, 238, 0.5);
  color: #ffffff;
}

.ctrl-mode-btn.is-active {
  background: #06b6d4;
  color: #ffffff;
  border-color: #67e8f9;
  box-shadow:
    0 0 16px rgba(6, 182, 212, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.ctrl-mode-btn.is-active:hover {
  filter: brightness(1.06);
}

@media (max-width: 420px) {
  .ctrl-mode-row { gap: 6px; }
  .ctrl-mode-btn {
    padding: 0 4px;
    letter-spacing: -0.02em;
    font-size: 10px;
  }
}

/* Secondary actions stay in the neon language */
.neon-secondary {
  background: rgba(8, 14, 26, 0.9);
  border: 1px solid rgba(34, 211, 238, 0.4);
  color: #e2e8f0;
  box-shadow: inset 0 1px 0 rgba(186, 230, 253, 0.08);
}

.neon-secondary:hover {
  background: rgba(8, 20, 36, 0.95);
  border-color: rgba(103, 232, 249, 0.85);
  color: #ffffff;
  box-shadow:
    0 0 18px rgba(6, 182, 212, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

#btn-start-game {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    0 10px 24px rgba(6, 182, 212, 0.42),
    0 18px 40px rgba(244, 63, 94, 0.34),
    0 0 40px rgba(34, 211, 238, 0.36);
}

#btn-start-game:hover {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.34),
    0 12px 28px rgba(6, 182, 212, 0.55),
    0 22px 48px rgba(244, 63, 94, 0.42),
    0 0 52px rgba(34, 211, 238, 0.5);
}

.diff-btn:focus-visible,
.ctrl-mode-btn:focus-visible,
.neon-secondary:focus-visible,
#btn-start-game:focus-visible {
  outline: 2px solid #67e8f9;
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .logo-aura {
    animation: none;
    opacity: 0.55;
  }
}