/* ============================================================
   HEXA SLASH · NEON CYBER ARCADE STYLESHEET
   Pure CSS3, zero external frameworks, responsive across all viewports.
   ============================================================ */

:root {
  --bg: #08090f;
  --panel: rgba(15, 18, 29, 0.94);
  --panel-border: rgba(0, 242, 254, 0.24);
  --panel-hover: rgba(0, 242, 254, 0.14);
  --cyan: #00f2fe;
  --cyan-glow: rgba(0, 242, 254, 0.45);
  --magenta: #ff2a6d;
  --magenta-glow: rgba(255, 42, 109, 0.45);
  --gold: #fbc531;
  --gold-glow: rgba(251, 197, 49, 0.45);
  --lime: #05ffa1;
  --hazard: #ff3838;
  --white: #ffffff;
  --dim: #8b94a5;

  --radius-pill: 999px;
  --radius-md: 20px;
  --radius-sm: 12px;
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.5);
  --font-main: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  font-family: var(--font-main);
  color: var(--white);
  touch-action: none;
}

#app {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}

/* ==================== PRELOADER ==================== */
#preloader {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

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

.logo-wrap {
  width: 90px;
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
}

.logo-hexa {
  width: 100%;
  height: 100%;
  animation: hexaRotate 3s linear infinite;
}

.logo-hexa-img {
  width: 88px;
  height: 88px;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 0 16px rgba(0, 242, 254, 0.6));
  animation: logoPulse 3.5s ease-in-out infinite alternate;
}

@keyframes logoPulse {
  0% { transform: scale(0.96); filter: drop-shadow(0 0 12px rgba(0, 242, 254, 0.5)); }
  100% { transform: scale(1.04); filter: drop-shadow(0 0 22px rgba(255, 42, 109, 0.6)); }
}

@keyframes hexaRotate {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

#preloader h1 {
  font-size: 1.9rem;
  font-weight: 900;
  letter-spacing: 2px;
  color: var(--cyan);
  text-shadow: 0 0 16px var(--cyan-glow);
}

#preloadText {
  font-size: 0.85rem;
  color: var(--dim);
  font-weight: 500;
}

.bar-track {
  width: 220px;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 8px;
}

.bar-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--cyan), var(--magenta));
  border-radius: 999px;
  transition: width 0.1s linear;
  box-shadow: 0 0 12px var(--cyan-glow);
}

/* ==================== TOPBAR ==================== */
#topbar {
  position: absolute;
  top: max(10px, env(safe-area-inset-top));
  left: 10px;
  right: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 100;
  pointer-events: auto;
}

.top-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--panel);
  border: 1px solid var(--panel-border);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, background 0.15s ease;
}

.icon-btn:hover {
  background: var(--panel-hover);
}

.icon-btn:active {
  transform: scale(0.92);
}

.icon-btn svg {
  width: 20px;
  height: 20px;
}

.icon-btn img,
.hud-icon-img {
  width: 22px;
  height: 22px;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 0 3px rgba(0, 242, 254, 0.4));
}

.btn-icon-img {
  width: 18px;
  height: 18px;
  object-fit: contain;
  pointer-events: none;
  flex-shrink: 0;
}

.icon-cta {
  display: flex !important;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

#levelLabel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  padding: 4px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
  white-space: nowrap;
}

.hud-title {
  font-size: clamp(0.74rem, 2.5vw, 0.86rem);
  font-weight: 800;
  letter-spacing: 0.4px;
  color: var(--white);
  white-space: nowrap;
}

.hud-title span {
  color: var(--cyan);
}

.hud-title b {
  color: var(--gold);
}

.hud-combo {
  font-size: clamp(0.66rem, 2vw, 0.72rem);
  font-weight: 800;
  color: var(--magenta);
}

/* ==================== STAGE ==================== */
#stage {
  flex: 1;
  width: 100%;
  height: 100%;
  position: relative;
}

#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

/* ==================== BOTTOMBAR ==================== */
#bottombar {
  position: absolute;
  bottom: max(12px, env(safe-area-inset-bottom));
  left: 10px;
  right: 10px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  z-index: 100;
  pointer-events: auto;
}

.bottom-stat {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 80px;
  box-shadow: var(--shadow);
  white-space: nowrap;
}

.stat-label {
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--dim);
  text-transform: uppercase;
}

.stat-val {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--white);
  white-space: nowrap;
}

/* Cyber Lives */
.cyber-lives-row {
  display: flex;
  gap: 5px;
  margin-top: 3px;
}

.cyber-life {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  transition: all 0.2s ease;
}

.cyber-life.active {
  background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan-glow);
}

.cyber-life.lost {
  background: rgba(255, 255, 255, 0.1);
  transform: scale(0.7);
}

/* Fever Meter */
.fever-meter-wrap {
  flex: 1;
  max-width: 180px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: var(--shadow);
}

.fever-header {
  display: flex;
  justify-content: space-between;
  width: 100%;
}

.fever-tag {
  font-size: 0.6rem;
  font-weight: 800;
  color: var(--dim);
  letter-spacing: 0.5px;
}

.fever-tag.active {
  color: var(--lime);
  text-shadow: 0 0 8px rgba(5, 255, 161, 0.6);
  animation: pulseFever 0.8s infinite alternate;
}

@keyframes pulseFever {
  0% { opacity: 0.7; }
  100% { opacity: 1; }
}

.fever-track {
  width: 100%;
  height: 5px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 3px;
}

.fever-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--lime));
  border-radius: 999px;
  transition: width 0.15s ease;
  box-shadow: 0 0 8px rgba(5, 255, 161, 0.5);
}

/* Swipe prompt */
.swipe-hint-pill {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-pill);
  padding: 8px 14px;
  font-size: clamp(0.68rem, 2.2vw, 0.78rem);
  font-weight: 800;
  color: var(--cyan);
  box-shadow: var(--shadow);
  white-space: nowrap;
}

.pill-btn {
  height: 46px;
  padding: 0 16px;
  border-radius: var(--radius-pill);
  background: var(--panel);
  border: 1px solid var(--panel-border);
  color: var(--white);
  font-weight: 800;
  font-size: clamp(0.74rem, 2.4vw, 0.88rem);
  letter-spacing: 0.3px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, background 0.15s ease;
}

.pill-btn:active {
  transform: scale(0.95);
}

.pill-btn.primary {
  background: linear-gradient(135deg, var(--cyan), #00b4d8);
  color: #08090f;
  border: none;
  box-shadow: 0 6px 18px var(--cyan-glow);
}

/* ==================== OVERLAYS / MODALS ==================== */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 9, 15, 0.78);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.overlay.show {
  opacity: 1;
  visibility: visible;
}

.card {
  width: 100%;
  max-width: 380px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-md);
  padding: 28px 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 16px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.7);
  animation: popUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes popUp {
  0% { transform: scale(0.85); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.card h2 {
  font-size: 1.45rem;
  font-weight: 900;
  color: var(--white);
  text-shadow: 0 0 12px rgba(255, 255, 255, 0.2);
}

.subtitle {
  font-size: 0.86rem;
  color: var(--dim);
}

.howto-row {
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
  width: 100%;
}

.howto-thumb-img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 0 8px rgba(0, 242, 254, 0.45));
}

.over-trophy-img {
  width: 60px;
  height: 60px;
  object-fit: contain;
  margin: 0 auto 6px;
  display: block;
  filter: drop-shadow(0 0 16px rgba(251, 197, 49, 0.65));
  animation: trophyFloat 3s ease-in-out infinite alternate;
}

@keyframes trophyFloat {
  0% { transform: translateY(0); }
  100% { transform: translateY(-5px); }
}

.zone-badge {
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 900;
  flex-shrink: 0;
  color: #08090f;
}

.zone-badge.cyan { background: var(--cyan); }
.zone-badge.gold { background: var(--gold); }
.zone-badge.red { background: var(--hazard); color: #fff; }
.zone-badge.green { background: var(--lime); }

.howto-row strong {
  display: block;
  font-size: 0.9rem;
  color: var(--white);
}

.howto-row p {
  font-size: 0.8rem;
  color: var(--dim);
  line-height: 1.35;
}

.cta {
  width: 100%;
  min-height: 50px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--cyan), #00b4d8);
  border: none;
  color: #08090f;
  font-weight: 900;
  font-size: 0.95rem;
  letter-spacing: 0.5px;
  cursor: pointer;
  box-shadow: 0 6px 18px var(--cyan-glow);
  transition: transform 0.15s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 8px 14px;
}

.cta:active {
  transform: scale(0.96);
}

.cta strong {
  font-size: 0.95rem;
  font-weight: 900;
}

.cta span {
  font-size: 0.7rem;
  font-weight: 600;
  opacity: 0.85;
}

.cta.secondary {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--panel-border);
  color: var(--white);
  box-shadow: none;
}

.cta.secondary:hover {
  background: var(--panel-hover);
}

.cta.text-link {
  background: transparent;
  box-shadow: none;
  color: var(--cyan);
  min-height: 36px;
  font-size: 0.85rem;
}

/* ==================== MENU & MODAL CARDS ==================== */
.menu-card {
  max-width: 360px;
  padding: 28px 20px;
  gap: 14px;
}

.menu-logo-wrap {
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.menu-stats-pill {
  display: flex;
  justify-content: center;
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-size: 0.82rem;
  color: var(--dim);
}

.menu-stats-pill b {
  color: var(--gold);
}

.menu-btn-stack, .pause-btn-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.best-pill {
  background: rgba(251, 197, 49, 0.12);
  border: 1px solid var(--gold);
  border-radius: var(--radius-pill);
  padding: 6px 16px;
  color: var(--gold);
  font-weight: 800;
  font-size: 0.85rem;
}

.win-btns {
  display: flex;
  gap: 10px;
  width: 100%;
  margin-top: 4px;
}

.win-btns .pill-btn {
  flex: 1;
}

/* ==================== TOAST & CONFETTI ==================== */
#confettiCanvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 150;
}

.toast {
  position: fixed;
  top: 75px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: rgba(15, 18, 29, 0.94);
  border: 1px solid var(--panel-border);
  color: var(--cyan);
  padding: 8px 18px;
  border-radius: var(--radius-pill);
  font-size: 0.82rem;
  font-weight: 800;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.6);
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s ease;
  z-index: 300;
  pointer-events: none;
  white-space: nowrap;
}

.toast.show {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* ==================== BLADE ARMORY ==================== */
.blade-card-modal {
  max-width: 400px;
}

.blade-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-height: 320px;
  overflow-y: auto;
  padding: 2px;
}

.blade-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
}

.blade-card:hover {
  background: var(--panel-hover);
}

.blade-card.selected {
  border-color: var(--cyan);
  background: rgba(0, 242, 254, 0.12);
  box-shadow: 0 0 12px var(--cyan-glow);
}

.blade-card.locked {
  opacity: 0.45;
  cursor: not-allowed;
}

.blade-color-preview {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
}

.blade-img-preview {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: contain;
  flex-shrink: 0;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.blade-lock-icon {
  width: 20px;
  height: 20px;
  object-fit: contain;
  margin-left: auto;
  opacity: 0.75;
  flex-shrink: 0;
}

.blade-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.blade-meta strong {
  font-size: 0.92rem;
  color: var(--white);
}

.blade-meta span {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--cyan);
  letter-spacing: 0.3px;
}

.blade-card.locked .blade-meta span {
  color: var(--dim);
}

/* ==================== RESPONSIVE MEDIA QUERIES ==================== */
@media (max-width: 400px) {
  #topbar {
    left: 6px;
    right: 6px;
  }
  .top-group {
    gap: 4px;
  }
  .icon-btn {
    width: 34px;
    height: 34px;
  }
  .icon-btn svg {
    width: 17px;
    height: 17px;
  }
  #levelLabel {
    padding: 3px 8px;
  }
  .hud-title {
    font-size: 0.72rem;
  }
  #bottombar {
    left: 6px;
    right: 6px;
  }
  .bottom-stat {
    min-width: 70px;
    padding: 3px 8px;
  }
  .fever-meter-wrap {
    padding: 3px 8px;
  }
  .swipe-hint-pill {
    padding: 6px 10px;
    font-size: 0.66rem;
  }
}
