@font-face {
  font-family: "Monster";
  src: url("monster_wrangler_assets/Abrushow.ttf") format("truetype");
  font-display: swap;
}

:root {
  color-scheme: dark;
  --paper: #f3f0e7;
  --ink: #080a0e;
  --line: rgba(255, 255, 255, 0.13);
  --lime: #c9ff3c;
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
  min-height: 100%;
  margin: 0;
  color: var(--paper);
  background:
    radial-gradient(circle at 15% 12%, rgba(111, 65, 255, 0.18), transparent 35%),
    radial-gradient(circle at 82% 84%, rgba(37, 219, 142, 0.12), transparent 32%),
    #07090d;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overscroll-behavior: none;
}

button { font: inherit; }

.game-shell {
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 0 max(24px, env(safe-area-inset-bottom));
}

.game-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding: 8px 2px 18px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.eyebrow {
  color: #9a9da6;
  font-size: 0.68rem;
  font-weight: 750;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1 {
  margin: 5px 0 0;
  font-family: Monster, Impact, sans-serif;
  font-size: clamp(2rem, 5vw, 4.25rem);
  font-weight: 400;
  line-height: 0.92;
  letter-spacing: 0.035em;
}

.sound-button,
.help-button,
.controls button,
#startButton {
  min-height: 48px;
  border: 1px solid var(--line);
  color: var(--paper);
  background: rgba(255, 255, 255, 0.07);
  border-radius: 999px;
  cursor: pointer;
  touch-action: manipulation;
}

.sound-button,
.help-button {
  padding: 0 18px;
  white-space: nowrap;
}

.help-button {
  border-color: rgba(201, 255, 60, .35);
  color: var(--lime);
}

.stage-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #000;
  border-radius: 22px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.4);
}

canvas {
  display: block;
  width: 100%;
  aspect-ratio: 12 / 7;
  background: #000;
  touch-action: none;
}

.game-overlay {
  position: absolute;
  inset: 0;
  display: none;
  padding: 20px;
  place-items: center;
  background: rgba(0, 0, 0, 0.56);
  backdrop-filter: blur(7px);
}

.game-overlay.is-visible { display: grid; }

.overlay-panel {
  width: min(490px, 100%);
  max-height: calc(100% - 10px);
  padding: clamp(24px, 5vw, 48px);
  overflow-y: auto;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(10, 12, 17, 0.9);
  border-radius: 22px;
  text-align: center;
}

.overlay-kicker {
  color: var(--lime);
  font-size: 0.68rem;
  font-weight: 850;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.overlay-panel h2 {
  margin: 12px 0 0;
  font-size: clamp(1.45rem, 4vw, 2.4rem);
  line-height: 1.02;
}

.overlay-panel p {
  margin: 14px auto 22px;
  color: #afb3bd;
  font-size: 0.92rem;
  line-height: 1.55;
}

.overlay-text {
  margin: 14px 0 22px;
  color: #afb3bd;
  text-align: left;
}

.overlay-text p {
  margin: 0 0 12px;
  color: #d8dae0;
}

.overlay-text ul {
  display: grid;
  margin: 0;
  padding-left: 18px;
  gap: 7px;
  font-size: .78rem;
  line-height: 1.45;
}

.overlay-text strong { color: #fff; }

#startButton {
  width: 100%;
  border-color: var(--lime);
  color: #0b1003;
  background: var(--lime);
  font-weight: 850;
}

.controls {
  display: none;
  margin-top: 14px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.dpad {
  display: grid;
  width: 168px;
  grid-template: repeat(2, 52px) / repeat(3, 52px);
  gap: 4px;
}

.dpad button {
  width: 52px;
  min-height: 52px;
  border-radius: 15px;
  font-size: 1.3rem;
  font-weight: 800;
}

.dpad .up { grid-column: 2; }
.dpad .left { grid-row: 2; grid-column: 1; }
.dpad .down { grid-row: 2; grid-column: 2; }
.dpad .right { grid-row: 2; grid-column: 3; }

.controls button.is-active {
  color: #0d1205;
  background: var(--lime);
  transform: translateY(2px);
}

.action-button {
  display: flex;
  width: min(230px, 44vw);
  min-height: 72px !important;
  padding: 10px 18px;
  align-items: flex-start;
  justify-content: center;
  flex-direction: column;
}

.action-button strong { font-size: 0.92rem; }
.action-button span { color: #a7aab2; font-size: 0.68rem; }
.action-button.is-active span { color: #25300b; }

.game-footer {
  display: flex;
  padding: 15px 3px 0;
  justify-content: space-between;
  gap: 24px;
  color: #858993;
  font-size: 0.72rem;
}

.game-footer p { margin: 0; }
.game-footer strong { color: #d8d9dd; }

@media (hover: none), (pointer: coarse), (max-width: 760px) {
  .controls { display: flex; }
  .game-footer { display: none; }
}

@media (max-width: 600px) {
  .game-shell { width: min(100% - 18px, 1240px); }
  .game-header { align-items: center; padding-bottom: 12px; }
  .sound-button,
  .help-button { min-height: 42px; padding: 0 13px; font-size: 0.76rem; }
  .stage-card { border-radius: 16px; }
  canvas {
    min-height: min(54svh, 430px);
    aspect-ratio: auto;
  }
  .controls { align-items: end; }
}

@media (max-height: 560px) and (orientation: landscape) {
  .game-shell { width: min(100% - 18px, 1240px); padding: 8px 0; }
  .game-header { position: absolute; z-index: 3; top: 12px; left: 24px; right: 24px; pointer-events: none; }
  .game-header > div:first-child, .sound-button { display: none; }
  .game-header { justify-content: flex-end; }
  .help-button { min-height: 40px; pointer-events: auto; background: rgba(15, 17, 23, .82); }
  canvas { height: calc(100svh - 18px); aspect-ratio: auto; }
  .controls {
    position: absolute;
    z-index: 4;
    right: 18px;
    bottom: 16px;
    left: 18px;
    margin: 0;
    pointer-events: none;
  }
  .controls button { pointer-events: auto; background: rgba(15, 17, 23, .72); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; }
}
