/* Septagonest — retro-futuristic neon tunnel */

:root {
  --void: #05060f;
  --deep: #0c1024;
  --neon: #00f5d4;
  --hot: #ff2d6a;
  --gold: #ffd60a;
  --wall: #7b2ff7;
  --wall-dim: rgba(123, 47, 247, 0.35);
  --text: #e8f4ff;
  --muted: rgba(232, 244, 255, 0.55);
}

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

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: "Share Tech Mono", "Courier New", monospace;
  color: var(--text);
  background: var(--void);
  user-select: none;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 40%, rgba(0, 245, 212, 0.08) 0%, transparent 55%),
    repeating-conic-gradient(from 0deg at 50% 50%, transparent 0deg 51.4deg, rgba(123, 47, 247, 0.03) 51.4deg 102.8deg);
  z-index: 0;
}

.stage {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 0.75rem;
}

.hud {
  display: flex;
  align-items: flex-end;
  gap: 1.5rem;
  width: min(800px, 100%);
  padding: 0 0.25rem 0.5rem;
  position: relative;
}

.hud-block {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.hud-center {
  flex: 1;
  text-align: center;
}

.hud-right {
  text-align: right;
}

.hud-label {
  font-family: "Orbitron", sans-serif;
  font-size: 0.6rem;
  letter-spacing: 0.2em;
  color: var(--muted);
}

.hud-value {
  font-family: "Orbitron", sans-serif;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--neon);
  text-shadow: 0 0 12px rgba(0, 245, 212, 0.5);
}

.hud-value-sm {
  font-size: 0.85rem;
  color: var(--gold);
  text-shadow: 0 0 10px rgba(255, 214, 10, 0.35);
  word-break: break-all;
}

.hud-sub {
  font-size: 0.62rem;
  color: var(--muted);
  letter-spacing: 0.06em;
}

.hud-right .hud-value {
  color: var(--gold);
  text-shadow: 0 0 10px rgba(255, 214, 10, 0.35);
}

.mute-btn {
  position: absolute;
  right: 0;
  top: 0;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(0, 245, 212, 0.25);
  color: var(--text);
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
}

.mute-btn:hover {
  border-color: var(--neon);
}

.canvas-wrap {
  position: relative;
  width: min(800px, 100vw - 1.5rem);
  aspect-ratio: 1;
  max-height: calc(100vh - 5rem);
}

#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: crosshair;
  border: 1px solid rgba(0, 245, 212, 0.2);
  border-radius: 4px;
  background: var(--deep);
  box-shadow:
    0 0 40px rgba(0, 245, 212, 0.08),
    inset 0 0 80px rgba(0, 0, 0, 0.6);
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5, 6, 15, 0.88);
  backdrop-filter: blur(6px);
  padding: 1rem;
  z-index: 10;
}

.overlay.hidden {
  display: none;
}

.card {
  max-width: 420px;
  text-align: center;
  padding: 1.5rem;
  border: 1px solid rgba(0, 245, 212, 0.25);
  background: linear-gradient(160deg, rgba(12, 16, 36, 0.95), rgba(5, 6, 15, 0.98));
  box-shadow: 0 0 30px rgba(123, 47, 247, 0.2);
}

.title-main {
  display: block;
  font-family: "Orbitron", sans-serif;
  font-size: clamp(1.6rem, 5vw, 2.2rem);
  font-weight: 900;
  letter-spacing: 0.12em;
  color: var(--neon);
  text-shadow: 0 0 20px rgba(0, 245, 212, 0.6);
}

.title-sub {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  color: var(--muted);
}

.tagline {
  margin: 1.25rem 0 0.75rem;
  font-size: 0.85rem;
  line-height: 1.55;
  color: var(--muted);
}

.tagline strong {
  color: var(--hot);
}

.ref-level {
  font-size: 0.75rem;
  color: var(--wall);
  margin-bottom: 1.25rem;
}

.ref-level em {
  color: var(--gold);
  font-style: normal;
}

.level-pick {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
  text-align: left;
}

.level-btn {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.65rem 0.85rem;
  background: rgba(0, 245, 212, 0.04);
  border: 1px solid rgba(0, 245, 212, 0.2);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  font-family: inherit;
}

.level-btn:hover:not(:disabled) {
  border-color: var(--neon);
  background: rgba(0, 245, 212, 0.1);
}

.level-btn.is-active {
  border-color: var(--neon);
  background: rgba(0, 245, 212, 0.12);
  box-shadow: 0 0 16px rgba(0, 245, 212, 0.15);
}

.level-btn:disabled,
.level-btn-locked {
  opacity: 0.45;
  cursor: not-allowed;
}

.stars-bank {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  margin-bottom: 1rem;
  font-family: "Orbitron", sans-serif;
  font-size: 0.95rem;
  color: var(--gold);
}

.stars-bank-icon {
  font-size: 1.15rem;
  text-shadow: 0 0 12px rgba(255, 214, 10, 0.6);
}

#totalStars {
  font-weight: 700;
  font-size: 1.2rem;
}

.stars-bank-label {
  font-size: 0.65rem;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.level-btn-name {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-family: "Orbitron", sans-serif;
  font-size: 0.8rem;
  color: var(--gold);
}

.level-complete-tick {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 50%;
  background: rgba(0, 245, 212, 0.2);
  border: 1px solid var(--neon);
  color: var(--neon);
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1;
  flex-shrink: 0;
  box-shadow: 0 0 10px rgba(0, 245, 212, 0.35);
}

.level-btn.is-complete {
  border-color: rgba(0, 245, 212, 0.45);
}

#endStars {
  color: var(--gold);
}

.level-btn-desc {
  font-size: 0.7rem;
  color: var(--muted);
}

.controls-hint {
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 1.25rem;
}

.controls-hint kbd {
  display: inline-block;
  padding: 0.1rem 0.35rem;
  margin: 0 0.1rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 3px;
  font-size: 0.65rem;
}

.play-btn {
  font-family: "Orbitron", sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.15em;
  padding: 0.85rem 2rem;
  background: linear-gradient(180deg, var(--neon), #00c4a7);
  color: var(--void);
  border: none;
  cursor: pointer;
  box-shadow: 0 0 24px rgba(0, 245, 212, 0.4);
  transition: transform 0.12s, box-shadow 0.12s;
}

.play-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 32px rgba(0, 245, 212, 0.55);
}

.play-btn-ghost {
  background: transparent;
  color: var(--neon);
  border: 1px solid rgba(0, 245, 212, 0.4);
  box-shadow: none;
  margin-top: 0.5rem;
}

.play-btn-ghost:hover {
  background: rgba(0, 245, 212, 0.08);
}

.end-title {
  font-family: "Orbitron", sans-serif;
  font-size: 1.5rem;
  color: var(--hot);
  text-shadow: 0 0 16px rgba(255, 45, 106, 0.5);
}

.end-sub {
  margin: 0.5rem 0 1rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.end-stats {
  margin-bottom: 1.25rem;
  text-align: left;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  padding: 0.35rem 0;
  font-size: 0.8rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.stat-row-total strong {
  color: var(--neon);
}

.end-buttons {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.home-link {
  margin-top: 0.75rem;
  font-size: 0.75rem;
  color: var(--muted);
  text-decoration: none;
}

.home-link:hover {
  color: var(--neon);
}

@media (max-width: 520px) {
  .hud {
    flex-wrap: wrap;
    gap: 0.75rem;
  }
  .mute-btn {
    position: static;
    margin-left: auto;
  }
}
