:root {
  --bg-1: #091119;
  --bg-2: #101d2c;
  --bg-3: #1e2635;
  --panel: rgba(10, 20, 31, 0.72);
  --panel-strong: rgba(13, 21, 31, 0.86);
  --line: rgba(154, 244, 255, 0.2);
  --text: #f4fbff;
  --muted: #9db4c7;
  --accent: #5ff4ff;
  --accent-2: #ffb95a;
  --danger: #ff667c;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.4);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Trebuchet MS", "Segoe UI", Tahoma, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(95, 244, 255, 0.18), transparent 28%),
    radial-gradient(circle at 80% 15%, rgba(255, 185, 90, 0.18), transparent 24%),
    linear-gradient(135deg, var(--bg-1), var(--bg-2) 55%, var(--bg-3));
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: auto;
  pointer-events: none;
  z-index: 0;
}

body::before {
  top: -120px;
  right: -80px;
  width: 380px;
  height: 380px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(95, 244, 255, 0.16), transparent 64%);
  filter: blur(4px);
}

body::after {
  bottom: -140px;
  left: -100px;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 185, 90, 0.14), transparent 68%);
  filter: blur(12px);
}

.page-shell {
  position: relative;
  z-index: 1;
  width: min(1440px, calc(100vw - 32px));
  margin: 24px auto 40px;
  display: grid;
  gap: 24px;
}

.hero-panel,
.game-shell,
.level-panel {
  backdrop-filter: blur(18px);
  background: linear-gradient(180deg, rgba(18, 29, 42, 0.88), rgba(10, 17, 25, 0.72));
  border: 1px solid rgba(160, 235, 255, 0.14);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}

.hero-panel {
  display: grid;
  grid-template-columns: 1.7fr 1fr;
  gap: 24px;
  padding: 28px;
  overflow: hidden;
}

.hero-copy h1,
.level-heading h2,
.side-panel h2,
.overlay-card h3 {
  margin: 0;
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.hero-copy h1 {
  font-size: clamp(2.6rem, 6vw, 4.5rem);
  line-height: 0.95;
}

.hero-text,
.panel-description,
.level-heading-text,
.overlay-card p {
  color: var(--muted);
  line-height: 1.6;
}

.eyebrow,
.panel-label,
.overlay-tag {
  margin: 0 0 10px;
  color: var(--accent);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-size: 0.78rem;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.stat-card {
  padding: 18px;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(16, 28, 41, 0.95), rgba(12, 21, 30, 0.8));
  border: 1px solid rgba(159, 229, 255, 0.14);
}

.stat-label {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin-bottom: 12px;
}

.stat-value {
  font-size: 1.1rem;
}

.game-shell {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 18px;
  padding: 18px;
}

.side-panel {
  display: grid;
  gap: 16px;
}

.panel-block {
  padding: 18px;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(16, 27, 39, 0.92), rgba(11, 18, 27, 0.78));
  border: 1px solid rgba(157, 223, 246, 0.1);
}

.chip-row,
.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.info-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 999px;
  background: rgba(95, 244, 255, 0.1);
  border: 1px solid rgba(95, 244, 255, 0.15);
  font-size: 0.82rem;
  color: #e8fbff;
}

.difficulty-chip {
  background: rgba(255, 185, 90, 0.12);
  border-color: rgba(255, 185, 90, 0.18);
}

.progress-track {
  position: relative;
  height: 14px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
  margin: 12px 0 10px;
}

.progress-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 22px rgba(95, 244, 255, 0.35);
  transition: width 120ms linear;
}

.tip-list {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.55;
}

.tip-list li + li {
  margin-top: 8px;
}

.stage-panel {
  min-width: 0;
}

.stage-frame {
  position: relative;
  overflow: hidden;
  min-height: 640px;
  height: min(72vh, 760px);
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(10, 16, 25, 0.1), rgba(5, 9, 15, 0.5)),
    radial-gradient(circle at top, rgba(95, 244, 255, 0.1), transparent 30%),
    linear-gradient(180deg, #081018, #0b1520);
  border: 1px solid rgba(160, 231, 255, 0.16);
}

#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
}

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(6, 11, 17, 0.56);
  backdrop-filter: blur(10px);
}

.overlay.hidden {
  display: none;
}

.overlay-card {
  width: min(420px, calc(100% - 28px));
  padding: 24px;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(15, 27, 39, 0.96), rgba(10, 18, 27, 0.84));
  border: 1px solid rgba(164, 235, 255, 0.16);
  box-shadow: 0 22px 80px rgba(0, 0, 0, 0.42);
  text-align: center;
}

.overlay-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 22px;
}

.action-button {
  border: 0;
  border-radius: 999px;
  padding: 12px 20px;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: transform 120ms ease, opacity 120ms ease, box-shadow 120ms ease;
}

.action-button:hover {
  transform: translateY(-1px);
}

.action-button.primary {
  color: #061118;
  background: linear-gradient(90deg, var(--accent), #9ef8ff);
  box-shadow: 0 12px 28px rgba(95, 244, 255, 0.26);
}

.action-button.secondary {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.level-panel {
  padding: 24px;
}

.level-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.level-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.level-card {
  position: relative;
  overflow: hidden;
  padding: 18px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(20, 31, 45, 0.94), rgba(11, 18, 26, 0.86));
  border: 1px solid rgba(168, 231, 255, 0.1);
  display: grid;
  gap: 14px;
}

.level-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: var(--card-accent, linear-gradient(90deg, var(--accent), var(--accent-2)));
}

.level-card-header,
.level-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.level-card h3 {
  margin: 0;
  font-size: 1.2rem;
}

.level-badge {
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  background: rgba(255, 255, 255, 0.06);
  color: #e8fbff;
}

.level-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.level-mechanic {
  color: var(--text);
  font-size: 0.84rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.level-progress {
  font-size: 0.84rem;
  color: var(--muted);
}

.play-button {
  border: 0;
  border-radius: 12px;
  padding: 11px 14px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
  transition: background 120ms ease, transform 120ms ease;
}

.play-button:hover {
  background: rgba(255, 255, 255, 0.14);
  transform: translateY(-1px);
}

.level-card.cleared {
  border-color: rgba(95, 244, 255, 0.24);
  box-shadow: inset 0 0 0 1px rgba(95, 244, 255, 0.08);
}

@media (max-width: 1180px) {
  .hero-panel,
  .game-shell {
    grid-template-columns: 1fr;
  }

  .level-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .page-shell {
    width: min(100vw - 18px, 100%);
    margin: 10px auto 18px;
    gap: 14px;
  }

  .hero-panel,
  .level-panel,
  .game-shell {
    padding: 14px;
  }

  .hero-stats,
  .level-grid {
    grid-template-columns: 1fr;
  }

  .level-heading {
    align-items: start;
    flex-direction: column;
  }

  .stage-frame {
    min-height: 420px;
    height: 56vh;
  }

  .overlay-actions {
    flex-direction: column;
  }

  .action-button {
    width: 100%;
  }
}
