:root {
  --bg: #050816;
  --bg-elevated: #0b1021;
  --accent: #7c3aed;
  --accent-soft: rgba(124, 58, 237, 0.14);
  --danger: #f97373;
  --text: #f9fafb;
  --muted: #9ca3af;
  --border-subtle: rgba(148, 163, 184, 0.3);
  --shadow-soft: 0 22px 45px rgba(15, 23, 42, 0.85);
  --radius-lg: 18px;
  --radius-md: 12px;
  --transition-fast: 150ms ease-out;
}

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, #1f2937 0, var(--bg) 55%);
  color: var(--text);
  display: flex;
  align-items: stretch;
  justify-content: center;
}

.page {
  width: 100%;
  max-width: 960px;
  padding: 24px 16px 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.header {
  text-align: center;
}

.title {
  margin: 0;
  font-size: clamp(2rem, 3vw + 1rem, 2.6rem);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: linear-gradient(120deg, #e5e7eb, #a855f7, #22c55e);
  -webkit-background-clip: text;
  color: transparent;
}

.subtitle {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.98rem;
}

.main {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1.4fr);
  gap: 18px;
  align-items: stretch;
}

@media (max-width: 800px) {
  .main {
    grid-template-columns: minmax(0, 1fr);
  }
}

.panel {
  backdrop-filter: blur(18px);
  background: radial-gradient(circle at top left, rgba(76, 29, 149, 0.35), transparent 55%),
    radial-gradient(circle at bottom right, rgba(6, 95, 70, 0.28), transparent 55%),
    linear-gradient(135deg, rgba(15, 23, 42, 0.94), rgba(17, 24, 39, 0.96));
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  padding: 18px 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  border: 1px solid rgba(148, 163, 184, 0.25);
}

.status {
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.status-item {
  flex: 1;
  padding: 10px 12px;
  border-radius: 999px;
  background: radial-gradient(circle at top left, rgba(96, 165, 250, 0.25), transparent 65%),
    linear-gradient(135deg, rgba(15, 23, 42, 0.85), rgba(15, 23, 42, 0.92));
  border: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.status-item:nth-child(2) {
  background: radial-gradient(circle at top left, rgba(147, 51, 234, 0.3), transparent 65%),
    linear-gradient(135deg, rgba(15, 23, 42, 0.9), rgba(15, 23, 42, 0.96));
}

.status-item:nth-child(3) {
  background: radial-gradient(circle at top left, rgba(52, 211, 153, 0.28), transparent 65%),
    linear-gradient(135deg, rgba(15, 23, 42, 0.9), rgba(15, 23, 42, 0.96));
}

.label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted);
}

.value {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn {
  flex: 1;
  min-width: 0;
  border-radius: 999px;
  border: 1px solid transparent;
  padding: 9px 14px;
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast),
    background var(--transition-fast), border-color var(--transition-fast),
    color var(--transition-fast), opacity 100ms ease-out;
}

.btn.primary {
  background: linear-gradient(135deg, #7c3aed, #22c55e);
  color: white;
  box-shadow: 0 14px 30px rgba(124, 58, 237, 0.6);
}

.btn.primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 18px 40px rgba(124, 58, 237, 0.8);
}

.btn.ghost {
  background: rgba(15, 23, 42, 0.75);
  border-color: var(--border-subtle);
  color: var(--muted);
}

.btn.ghost:hover:not(:disabled) {
  background: rgba(15, 23, 42, 0.92);
  color: var(--text);
}

.btn:disabled {
  opacity: 0.45;
  cursor: default;
  box-shadow: none;
  transform: none;
}

.hint {
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.4;
  color: var(--muted);
}

.game-wrapper {
  display: flex;
  align-items: stretch;
}

.game {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  max-height: 520px;
  margin: 0 auto;
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at top left, rgba(30, 64, 175, 0.4), transparent 60%),
    radial-gradient(circle at bottom right, rgba(8, 47, 73, 0.6), transparent 60%),
    radial-gradient(circle at center, rgba(15, 23, 42, 0.95), rgba(15, 23, 42, 1));
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.35);
  box-shadow: var(--shadow-soft);
}

.game::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(
      rgba(15, 23, 42, 0.6),
      rgba(15, 23, 42, 0.9)
    ),
    radial-gradient(circle at 10% 20%, rgba(56, 189, 248, 0.14), transparent 45%),
    radial-gradient(circle at 80% 80%, rgba(244, 63, 94, 0.18), transparent 40%);
  mix-blend-mode: soft-light;
  opacity: 0.75;
  pointer-events: none;
}

.player,
.enemy {
  position: absolute;
  border-radius: 8px;
  transform: translate3d(0, 0, 0);
}

.player {
  width: 26px;
  height: 26px;
  background: radial-gradient(circle at 30% 20%, #ffffff, #a855f7);
  box-shadow:
    0 0 20px rgba(168, 85, 247, 0.9),
    0 0 40px rgba(59, 130, 246, 0.7);
}

.player::after {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: inherit;
  border: 1px solid rgba(248, 250, 252, 0.8);
}

.enemy {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, #4b5563, #111827);
  box-shadow:
    0 0 10px rgba(15, 23, 42, 0.9),
    0 0 26px rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(55, 65, 81, 0.9);
}

.enemy::after {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: inherit;
  border: 1px dashed rgba(156, 163, 175, 0.7);
}

.enemy--large {
  width: 42px;
  height: 42px;
  box-shadow: 0 0 14px rgba(15, 23, 42, 0.95), 0 0 28px rgba(107, 114, 128, 0.5);
  border-color: rgba(75, 85, 99, 0.9);
}

.enemy--star {
  background: transparent;
  border: none;
  box-shadow: 0 0 12px rgba(251, 191, 36, 0.5), 0 0 24px rgba(245, 158, 11, 0.3);
}

.enemy--star::after {
  display: none;
}

.enemy--star::before {
  content: "★";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  line-height: 1;
  color: #fbbf24;
  text-shadow: 0 0 8px rgba(251, 191, 36, 0.8);
}

.enemy--meteor {
  background: linear-gradient(135deg, #7f1d1d, #450a0a);
  border: 1px solid rgba(239, 68, 68, 0.6);
  box-shadow:
    0 0 12px rgba(239, 68, 68, 0.5),
    0 0 24px rgba(185, 28, 28, 0.4),
    inset 0 0 8px rgba(251, 146, 60, 0.2);
}

.enemy--meteor::after {
  border-color: rgba(251, 146, 60, 0.5);
  border-style: solid;
}

.level-notification {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
  pointer-events: none;
  padding: 14px 28px;
  border-radius: var(--radius-md);
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: brightness(1.5) saturate(1.1);
  -webkit-backdrop-filter: brightness(1.5) saturate(1.1);
  border: 1px solid rgba(248, 250, 252, 0.35);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.08),
    0 0 40px rgba(255, 255, 255, 0.2),
    0 0 80px rgba(147, 197, 253, 0.25),
    inset 0 0 30px rgba(255, 255, 255, 0.06);
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: #f9fafb;
  text-shadow:
    0 0 12px rgba(255, 255, 255, 0.9),
    0 0 24px rgba(255, 255, 255, 0.6),
    0 0 48px rgba(147, 197, 253, 0.5),
    0 0 72px rgba(147, 197, 253, 0.3);
  animation: level-notification-in 0.35s ease-out;
}

@keyframes level-notification-in {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.9);
    filter: brightness(0.8);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    filter: brightness(1);
  }
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3;
  pointer-events: none;
}

.overlay-card {
  pointer-events: auto;
  padding: 20px 22px 18px;
  border-radius: var(--radius-md);
  background: rgba(15, 23, 42, 0.96);
  border: 1px solid rgba(148, 163, 184, 0.6);
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.9);
  text-align: center;
  min-width: min(260px, 90%);
}

.overlay-title {
  margin: 0 0 8px;
  font-size: 1.1rem;
}

.overlay-text {
  margin: 0 0 12px;
  font-size: 0.9rem;
  color: var(--muted);
}

.overlay-stats {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-bottom: 14px;
  font-size: 0.86rem;
}

.overlay-stat-label {
  color: var(--muted);
}

.overlay-stat-value {
  font-weight: 600;
}

.footer {
  margin-top: 4px;
  text-align: center;
  font-size: 0.8rem;
  color: rgba(148, 163, 184, 0.7);
}
