:root {
  --bg-a: #f5e3c7;
  --bg-b: #f2864b;
  --bg-c: #20333b;
  --panel: rgba(27, 31, 38, 0.82);
  --panel-edge: rgba(255, 237, 212, 0.2);
  --text-main: #fff5e5;
  --text-dim: rgba(255, 245, 229, 0.72);
  --accent: #ffcb47;
  --accent-strong: #ff7147;
  --ink: #1d120c;
  --shadow: rgba(12, 10, 8, 0.34);
}

* {
  box-sizing: border-box;
}

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

body {
  font-family: "Trebuchet MS", "Gill Sans", "Lucida Sans Unicode", sans-serif;
  color: var(--text-main);
  background:
    radial-gradient(circle at top left, rgba(255, 240, 212, 0.8), transparent 28%),
    radial-gradient(circle at bottom right, rgba(255, 113, 71, 0.36), transparent 34%),
    linear-gradient(135deg, var(--bg-a) 0%, var(--bg-b) 42%, var(--bg-c) 100%);
  overflow-x: hidden;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: auto;
  width: 42vmax;
  height: 42vmax;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(18px);
  opacity: 0.36;
}

body::before {
  top: -12vmax;
  right: -9vmax;
  background: rgba(255, 214, 128, 0.45);
}

body::after {
  bottom: -14vmax;
  left: -11vmax;
  background: rgba(32, 51, 59, 0.42);
}

.page-shell {
  position: relative;
  z-index: 1;
  width: min(920px, calc(100vw - 20px));
  margin: 24px auto;
  display: grid;
  grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.intro-panel,
.game-panel {
  backdrop-filter: blur(16px);
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  box-shadow:
    0 24px 80px var(--shadow),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.intro-panel {
  padding: 28px;
  border-radius: 28px;
}

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

h1,
.overlay h2 {
  margin: 0;
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  line-height: 0.95;
}

h1 {
  font-size: clamp(3.1rem, 5.8vw, 5rem);
  max-width: 10ch;
}

.deck {
  margin: 18px 0 0;
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--text-dim);
}

.feature-list {
  display: grid;
  gap: 14px;
  margin: 26px 0;
}

.feature-list article {
  padding: 16px 18px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(0, 0, 0, 0.12));
  border: 1px solid rgba(255, 239, 215, 0.08);
}

.feature-list h2 {
  margin: 0 0 8px;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.feature-list p {
  margin: 0;
  color: var(--text-dim);
  line-height: 1.5;
}

.cta {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 14px 20px;
  font: inherit;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #24150d;
  background: linear-gradient(135deg, var(--accent) 0%, #ffd977 46%, #fff0c8 100%);
  cursor: pointer;
  box-shadow: 0 14px 32px rgba(255, 203, 71, 0.3);
  transition:
    transform 140ms ease,
    box-shadow 140ms ease;
}

.cta:hover,
.cta:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 18px 40px rgba(255, 203, 71, 0.36);
}

.game-panel {
  padding: 18px;
  border-radius: 32px;
  width: 100%;
  max-width: 460px;
  justify-self: center;
}

.hud-strip {
  display: block;
  margin-bottom: 14px;
}

.hud-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.hud-item {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
}

.hud-label {
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.62rem;
}

.hud-item strong {
  font-size: clamp(0.92rem, 1.8vw, 1.2rem);
}

.hud-status {
  margin-left: auto;
  align-items: center;
}

.status-indicator {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  flex: 0 0 auto;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.08);
}

.status-indicator.is-running {
  background: #44d26c;
  box-shadow:
    0 0 0 2px rgba(68, 210, 108, 0.18),
    0 0 10px rgba(68, 210, 108, 0.45);
}

.status-indicator.is-stopped {
  background: #e25555;
  box-shadow:
    0 0 0 2px rgba(226, 85, 85, 0.18),
    0 0 10px rgba(226, 85, 85, 0.4);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.canvas-shell {
  position: relative;
  overflow: hidden;
  width: min(100%, 420px);
  margin: 0 auto;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(0, 0, 0, 0.18)),
    #111;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 18px 48px rgba(0, 0, 0, 0.35);
}

#gameCanvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 9 / 16;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  text-align: center;
  background:
    radial-gradient(circle at center, rgba(32, 51, 59, 0.38), rgba(16, 19, 24, 0.8));
  transition:
    opacity 180ms ease,
    visibility 180ms ease;
}

.overlay.hidden {
  opacity: 0;
  visibility: hidden;
}

.overlay h2 {
  font-size: clamp(2.8rem, 6vw, 5.4rem);
  max-width: 8ch;
}

.overlay p:last-child {
  max-width: 34ch;
  margin: 14px auto 0;
  line-height: 1.55;
  color: var(--text-dim);
}

.controls-note {
  margin: 14px 4px 0;
  color: var(--text-dim);
  line-height: 1.5;
}

@media (max-width: 980px) {
  .page-shell {
    grid-template-columns: 1fr;
  }

  .intro-panel {
    order: 2;
  }

  .game-panel {
    order: 1;
    max-width: 480px;
  }
}

@media (max-width: 640px) {
  html,
  body {
    min-height: 100dvh;
    overflow: hidden;
  }

  body {
    background: #101317;
  }

  body::before,
  body::after {
    display: none;
  }

  .page-shell {
    width: 100vw;
    min-height: 100dvh;
    margin: 0;
    gap: 0;
    padding:
      max(8px, env(safe-area-inset-top))
      8px
      max(8px, env(safe-area-inset-bottom))
      8px;
  }

  .intro-panel {
    display: none;
  }

  .game-panel {
    display: flex;
    flex-direction: column;
    justify-self: stretch;
    min-height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    max-width: none;
    padding: 6px 4px 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
  }

  .hud-strip {
    margin-bottom: 8px;
  }

  .hud-bar {
    gap: 8px;
    padding: 9px 10px;
    border-radius: 14px;
    background: rgba(10, 14, 18, 0.44);
    backdrop-filter: blur(10px);
  }

  .hud-item {
    gap: 4px;
  }

  .hud-label {
    font-size: 0.54rem;
    letter-spacing: 0.1em;
  }

  .hud-item strong {
    font-size: 0.84rem;
  }

  .status-indicator {
    width: 9px;
    height: 9px;
  }

  .canvas-shell {
    width: min(100%, calc((100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 82px) * 9 / 16));
    max-width: 100%;
    margin: 0 auto;
    border-radius: 18px;
    flex: 1 1 auto;
    align-self: center;
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.08),
      0 12px 30px rgba(0, 0, 0, 0.28);
  }

  .overlay {
    padding: 20px 18px;
  }

  .overlay h2 {
    font-size: clamp(2.2rem, 12vw, 4rem);
  }

  .overlay-kicker {
    font-size: 0.68rem;
  }

  .controls-note {
    display: none;
  }
}
