:root {
  --bg: #09050d;
  --panel: rgba(14, 12, 27, 0.88);
  --panel-alt: rgba(24, 18, 44, 0.92);
  --cream: #f8e9ff;
  --sand: #f4b4db;
  --caramel: #ff7fd4;
  --latte: #7de2ff;
  --cherry: #ff5f9f;
  --mint: #71ffd8;
  --gold: #ffd76f;
  --border: rgba(255, 255, 255, 0.14);
  --shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  color: var(--cream);
  background:
    radial-gradient(circle at 20% 18%, rgba(255, 95, 159, 0.28), transparent 18%),
    radial-gradient(circle at 80% 14%, rgba(125, 226, 255, 0.22), transparent 16%),
    radial-gradient(circle at 50% 82%, rgba(113, 255, 216, 0.1), transparent 20%),
    linear-gradient(180deg, #140d27 0%, #0a0714 55%, #040309 100%);
  font-family: "Trebuchet MS", "Verdana", sans-serif;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.05) 0 1px, transparent 1px 100%),
    linear-gradient(60deg, rgba(255, 255, 255, 0.05) 0 1px, transparent 1px 100%);
  background-size: 96px 96px, 160px 160px;
  pointer-events: none;
  opacity: 0.2;
  mix-blend-mode: screen;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  background:
    linear-gradient(rgba(255, 255, 255, 0.04) 50%, transparent 50%);
  background-size: 100% 4px;
  pointer-events: none;
  opacity: 0.14;
}

.backdrop {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 15% 18%, rgba(255, 95, 159, 0.16), transparent 16%),
    radial-gradient(circle at 82% 18%, rgba(125, 226, 255, 0.16), transparent 15%),
    radial-gradient(circle at 78% 74%, rgba(255, 215, 111, 0.14), transparent 18%),
    radial-gradient(circle at 28% 76%, rgba(113, 255, 216, 0.1), transparent 17%);
  pointer-events: none;
  filter: blur(2px);
}

.shell {
  width: min(1200px, calc(100vw - 24px));
  margin: 0 auto;
  padding: 18px 0 28px;
  position: relative;
  z-index: 1;
}

.panel {
  border: 1px solid var(--border);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 18%),
    linear-gradient(135deg, rgba(255, 95, 159, 0.12), rgba(125, 226, 255, 0.08)),
    var(--panel);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 22px;
  border-radius: 22px 22px 12px 12px;
  margin-bottom: 16px;
  position: relative;
  overflow: hidden;
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto -12% -38px;
  height: 120px;
  background:
    radial-gradient(circle at 20% 50%, rgba(255, 95, 159, 0.3), transparent 24%),
    radial-gradient(circle at 45% 40%, rgba(125, 226, 255, 0.2), transparent 18%),
    radial-gradient(circle at 70% 55%, rgba(255, 215, 111, 0.16), transparent 20%);
  filter: blur(8px);
  opacity: 0.9;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.24em;
  font-size: 0.72rem;
  font-weight: 700;
}

h1,
h2,
h3,
.name {
  font-family: "Impact", "Arial Narrow", "Trebuchet MS", sans-serif;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(2.6rem, 6vw, 5rem);
  line-height: 0.9;
  color: #fff7ff;
  text-shadow:
    0 0 10px rgba(255, 95, 159, 0.8),
    0 0 22px rgba(125, 226, 255, 0.55),
    0 2px 0 #120814;
}

h2 {
  margin: 0;
  font-size: clamp(1.2rem, 2vw, 1.6rem);
  color: #fff2ff;
  text-shadow: 0 0 14px rgba(125, 226, 255, 0.35);
}

h3 {
  margin: 0;
  font-size: clamp(1.2rem, 1.8vw, 1.8rem);
  color: #fff1fb;
}

.lede {
  max-width: 52ch;
  margin: 12px 0 0;
  color: rgba(248, 233, 255, 0.86);
  line-height: 1.55;
}

.hero-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-content: flex-start;
  justify-content: flex-end;
}

.chip {
  padding: 10px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: var(--cream);
  font-size: 0.86rem;
  box-shadow: inset 0 0 0 1px rgba(125, 226, 255, 0.08), 0 0 18px rgba(255, 95, 159, 0.08);
}

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

.story,
.game {
  border-radius: 20px;
  overflow: hidden;
  position: relative;
}

.story::before,
.game::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.08), transparent 28%),
    radial-gradient(circle at 8% 10%, rgba(255, 95, 159, 0.16), transparent 18%),
    radial-gradient(circle at 92% 0%, rgba(125, 226, 255, 0.12), transparent 16%);
  opacity: 0.6;
}

.story {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.story p {
  margin: 0;
  color: rgba(248, 233, 255, 0.84);
  line-height: 1.6;
}

.character-chooser {
  display: grid;
  gap: 10px;
}

.character-card {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.03));
  color: var(--cream);
  text-align: left;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(125, 226, 255, 0.06);
}

.character-card .name {
  font-size: 1.1rem;
  font-weight: 800;
  color: #fff4fb;
  text-shadow: 0 0 12px rgba(255, 95, 159, 0.35);
}

.character-card .tag {
  color: var(--sand);
  font-size: 0.86rem;
}

.character-card.active {
  border-color: rgba(255, 95, 159, 0.7);
  background: linear-gradient(135deg, rgba(255, 95, 159, 0.22), rgba(125, 226, 255, 0.16));
  box-shadow:
    0 0 0 1px rgba(255, 95, 159, 0.22) inset,
    0 0 16px rgba(255, 95, 159, 0.18);
}

.facts {
  display: grid;
  gap: 10px;
  margin: 0;
}

.facts div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.facts dt {
  color: var(--sand);
}

.facts dd {
  margin: 0;
  font-weight: 700;
}

.game {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.game-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
}

.hud {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  font-size: 0.95rem;
}

.hud span {
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: inset 0 0 0 1px rgba(125, 226, 255, 0.06);
}

.stage {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 95, 159, 0.18), transparent 20%),
    linear-gradient(180deg, #2a1132 0%, #150d2a 34%, #090714 100%);
  box-shadow:
    0 0 0 1px rgba(125, 226, 255, 0.08) inset,
    0 0 50px rgba(255, 95, 159, 0.12);
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background:
    linear-gradient(180deg, rgba(11, 8, 22, 0.42), rgba(11, 8, 22, 0.84)),
    radial-gradient(circle at center, rgba(255, 95, 159, 0.1), transparent 52%);
}

.hidden {
  display: none;
}

.overlay-card {
  width: min(90%, 420px);
  padding: 22px;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 20%),
    linear-gradient(135deg, rgba(255, 95, 159, 0.18), rgba(125, 226, 255, 0.12)),
    rgba(12, 10, 28, 0.96);
  text-align: center;
  box-shadow: var(--shadow);
}

.overlay-kicker {
  margin: 0 0 10px;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.74rem;
  font-weight: 700;
}

.overlay-card p {
  color: rgba(248, 233, 255, 0.86);
  line-height: 1.55;
}

.overlay-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

button {
  font: inherit;
}

.primary,
.ghost,
.control {
  border: 0;
  cursor: pointer;
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease;
}

.primary:focus-visible,
.ghost:focus-visible,
.control:focus-visible,
.character-card:focus-visible {
  outline: 3px solid rgba(242, 197, 92, 0.9);
  outline-offset: 2px;
}

.primary {
  padding: 12px 16px;
  border-radius: 14px;
  color: #180817;
  background: linear-gradient(180deg, #fbd3ff, #ff73b5);
  font-weight: 700;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12), 0 0 18px rgba(255, 95, 159, 0.22);
}

.ghost {
  padding: 12px 16px;
  border-radius: 14px;
  color: var(--cream);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
}

.control {
  padding: 14px 18px;
  border-radius: 16px;
  color: var(--cream);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.05));
  border: 1px solid rgba(255, 255, 255, 0.16);
  min-width: 0;
}

.control-rush {
  color: #130714;
  background: linear-gradient(180deg, #71ffd8, #ff73b5);
  border-color: transparent;
  font-weight: 700;
  box-shadow: 0 0 18px rgba(255, 95, 159, 0.16);
}

.controls {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.controls .control {
  min-height: 52px;
}

.route {
  display: grid;
  gap: 8px;
}

.route-track {
  position: relative;
  height: 18px;
  border-radius: 999px;
  background:
    linear-gradient(90deg, rgba(255, 95, 159, 0.2), rgba(125, 226, 255, 0.2)),
    rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.14);
  overflow: hidden;
}

.route-progress {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #71ffd8 0%, #ffd76f 50%, #ff5f9f 100%);
}

.route-marker {
  position: absolute;
  top: -2px;
  transform: translateX(-50%);
  font-size: 0.72rem;
  color: var(--cream);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.75);
}

.route-caption {
  margin: 0;
  min-height: 1.5em;
  color: rgba(248, 233, 255, 0.8);
}

@media (max-width: 980px) {
  .hero,
  .layout,
  .game-header {
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .hero-meta {
    justify-content: flex-start;
  }

  .story {
    order: 2;
  }
}

@media (max-width: 640px) {
  .shell {
    width: min(100vw - 16px, 1200px);
    padding-top: 8px;
  }

  .hero,
  .story,
  .game {
    padding: 16px;
    border-radius: 18px;
  }

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

  .controls {
    grid-template-columns: 1fr;
  }
}

.stage::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, transparent 0 48%, rgba(255, 255, 255, 0.04) 49%, transparent 50%),
    radial-gradient(circle at center, transparent 58%, rgba(0, 0, 0, 0.4) 100%);
  mix-blend-mode: screen;
  opacity: 0.7;
}
