@font-face {
  font-family: "Dragon";
  src: url("feed_the_dragon_assets/AttackGraffiti.ttf") format("truetype");
  font-display: swap;
}

:root {
  color-scheme: dark;
  --green: #5dff78;
  --deep: #031108;
  --line: rgba(128, 255, 149, .17);
}

* { box-sizing: border-box; }

body {
  min-height: 100svh;
  margin: 0;
  color: #effff2;
  background:
    radial-gradient(circle at 8% 10%, rgba(44, 217, 90, .15), transparent 34%),
    radial-gradient(circle at 92% 86%, rgba(18, 93, 44, .25), transparent 38%),
    #020b05;
  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(1120px, 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;
  padding: 7px 2px 16px;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
}

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

.eyebrow {
  color: #799783;
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
}

h1 {
  margin: 5px 0 0;
  color: var(--green);
  font-family: Dragon, Impact, sans-serif;
  font-size: clamp(2rem, 7vw, 5rem);
  font-weight: 400;
  line-height: .88;
  letter-spacing: .02em;
}

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

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

.help-button {
  border-color: var(--green);
  color: var(--green);
}

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

canvas {
  display: block;
  width: 100%;
  aspect-ratio: 5 / 2;
  min-height: 270px;
  background: #000;
  touch-action: none;
}

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

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

.overlay-panel {
  width: min(500px, 100%);
  max-height: calc(100% - 8px);
  overflow-y: auto;
  padding: clamp(22px, 5vw, 44px);
  border: 1px solid rgba(128, 255, 149, .18);
  background: rgba(2, 18, 8, .93);
  border-radius: 22px;
  text-align: center;
}

.overlay-kicker {
  color: var(--green);
  font-size: .68rem;
  font-weight: 850;
  letter-spacing: .17em;
  text-transform: uppercase;
}

.overlay-panel h2 {
  margin: 11px 0 0;
  font-size: clamp(1.55rem, 5vw, 2.75rem);
  line-height: 1;
}

.overlay-panel p {
  margin: 13px auto 20px;
  color: #a2baa8;
  font-size: .9rem;
  line-height: 1.48;
}

.overlay-text {
  margin: 13px auto 20px;
  color: #a2baa8;
  font-size: .9rem;
  line-height: 1.48;
  text-align: left;
}

.overlay-text p { margin: 0 0 12px; }
.overlay-text ul { margin: 0; padding-left: 20px; }
.overlay-text li + li { margin-top: 7px; }

#startButton {
  width: 100%;
  border-color: var(--green);
  color: #051308;
  background: var(--green);
  font-weight: 850;
}

.controls {
  display: none;
  margin-top: 14px;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.controls button {
  display: flex;
  min-height: 68px;
  padding: 9px 18px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-radius: 16px;
}

.controls button strong { font-size: 1.35rem; }
.controls button span { color: #a5b8aa; font-size: .78rem; font-weight: 750; }
.controls button.is-active { color: #041208; background: var(--green); transform: translateY(2px); }
.controls button.is-active span { color: #173d20; }

.game-footer {
  display: flex;
  padding: 14px 3px 0;
  justify-content: space-between;
  gap: 22px;
  color: #77917d;
  font-size: .72rem;
}

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

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

@media (max-width: 600px) {
  .game-shell { width: calc(100% - 18px); }
  .game-header { padding-bottom: 11px; align-items: center; }
  .sound-button,
  .help-button { min-height: 42px; padding: 0 13px; font-size: .76rem; }
  .stage-card { border-radius: 16px; }
  canvas { height: min(58svh, 520px); min-height: 330px; aspect-ratio: auto; }
}

@media (max-height: 520px) and (orientation: landscape) {
  .game-shell { width: min(100% - 18px, 1120px); padding: 8px 0; }
  .game-header {
    position: absolute;
    z-index: 5;
    top: 14px;
    right: 18px;
    display: flex;
    padding: 0;
  }
  .game-header > div:first-child,
  .sound-button { display: none; }
  canvas { height: calc(100svh - 18px); min-height: 0; aspect-ratio: auto; }
  .controls {
    position: absolute;
    z-index: 4;
    right: 16px;
    bottom: 14px;
    left: 16px;
    margin: 0;
    grid-template-columns: 110px 110px;
    justify-content: end;
    pointer-events: none;
  }
  .controls button { pointer-events: auto; background: rgba(2, 20, 8, .75); }
}
