:root {
  color-scheme: dark;
  --bg: #030408;
  --bg-2: #0b0d14;
  --panel: rgba(11, 15, 24, 0.82);
  --text: #f4f7fb;
  --muted: #a7b2c4;
  --accent: #ff4d5a;
  --accent-2: #8cf0c0;
  --border: rgba(255, 255, 255, 0.13);
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  --radius: 20px;
  --radius-sm: 14px;
  --max-width: 1360px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 77, 90, 0.16), transparent 28%),
    radial-gradient(circle at 80% 18%, rgba(255, 255, 255, 0.05), transparent 18%),
    linear-gradient(160deg, var(--bg), var(--bg-2));
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(transparent 96%, rgba(255, 77, 90, 0.06) 100%),
    radial-gradient(circle at 20% 10%, rgba(255, 77, 90, 0.10), transparent 14%);
  mix-blend-mode: screen;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(var(--max-width), calc(100% - 32px));
  margin: 0 auto;
  padding: 22px 0 28px;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 20px;
}

.eyebrow {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--accent);
  font-size: 0.78rem;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 6px;
  font-size: clamp(2rem, 4vw, 3.6rem);
  line-height: 1;
}

.subtitle {
  margin: 0;
  color: var(--muted);
  max-width: 56ch;
  line-height: 1.55;
}

.hud {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.hud__item,
.info-card,
.panel {
  border: 1px solid var(--border);
  background: var(--panel);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}

.hud__item {
  min-width: 116px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
}

.hud__label,
.panel__kicker {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.hud strong {
  display: block;
  margin-top: 6px;
  font-size: 1.35rem;
}

.game-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  gap: 20px;
}

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

.stage-frame {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: calc(var(--radius) + 6px);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background:
    linear-gradient(180deg, rgba(10, 12, 18, 0.98), rgba(4, 4, 6, 0.98)),
    radial-gradient(circle at 50% 18%, rgba(255, 77, 90, 0.08), transparent 38%);
  box-shadow: var(--shadow);
}

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

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.22), rgba(0, 0, 0, 0.76));
}

.overlay--gameover {
  background: linear-gradient(180deg, rgba(38, 5, 10, 0.18), rgba(0, 0, 0, 0.84));
}

.overlay--pause {
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.28), rgba(0, 0, 0, 0.84));
}

.hidden {
  display: none;
}

.panel {
  width: min(100%, 480px);
  padding: 28px;
  border-radius: 24px;
}

.panel--compact {
  width: min(100%, 360px);
}

.panel h2,
.info-card h2 {
  margin-bottom: 10px;
  font-size: 1.35rem;
}

.panel p,
.info-card p,
.controls-list,
.mission-list {
  color: var(--muted);
  line-height: 1.6;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  font-weight: 700;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.button--primary {
  color: #160508;
  background: linear-gradient(135deg, #ffb0b7, var(--accent));
  box-shadow: 0 12px 30px rgba(255, 77, 90, 0.25);
}

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

.sidebar {
  display: grid;
  gap: 16px;
}

.info-card {
  padding: 20px;
  border-radius: var(--radius);
}

.controls-list,
.mission-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.controls-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.controls-list li:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.mission-list {
  padding-left: 18px;
}

.mission-list li + li {
  margin-top: 10px;
}

@media (max-width: 980px) {
  .topbar,
  .game-layout {
    grid-template-columns: 1fr;
    display: grid;
    align-items: start;
  }

  .topbar {
    gap: 16px;
  }

  .hud {
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  .app-shell {
    width: min(100% - 20px, var(--max-width));
    padding-top: 14px;
  }

  .panel,
  .info-card {
    padding: 18px;
    border-radius: 18px;
  }

  .stage-frame {
    border-radius: 18px;
  }

  .hud__item {
    min-width: calc(50% - 6px);
    flex: 1 1 130px;
  }
}
