:root {
  --navy-950: #06163d;
  --navy-900: #081e51;
  --navy-800: #19316b;
  --blue-600: #1267bb;
  --yellow: #ffe315;
  --yellow-soft: #fff29b;
  --coral: #f27769;
  --cyan: #53d8f2;
  --paper: #fff9e8;
  --white: #ffffff;
  --ink: #0b1738;
  font-family: Bahnschrift, "Arial Narrow", "Trebuchet MS", sans-serif;
  color: var(--white);
  background: var(--navy-950);
  font-synthesis: none;
}

* { box-sizing: border-box; }

html, body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--navy-950);
}

button, kbd { font: inherit; }

button { -webkit-tap-highlight-color: transparent; }

.game-shell {
  position: relative;
  width: 100vw;
  height: 100svh;
  min-height: 520px;
  overflow: hidden;
  isolation: isolate;
  user-select: none;
  touch-action: manipulation;
  background: var(--navy-900);
}

#game-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.game-header {
  position: absolute;
  z-index: 4;
  top: 0;
  left: 0;
  right: 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  padding: max(22px, env(safe-area-inset-top)) clamp(20px, 3.5vw, 56px) 0;
  pointer-events: none;
}

.brand-mark {
  width: clamp(156px, 15.6vw, 240px);
  height: auto;
  margin-top: 8px;
  filter: drop-shadow(0 8px 12px rgba(3, 12, 35, .24));
}

.scoreboard {
  display: grid;
  justify-items: center;
  color: var(--paper);
  text-shadow: 0 5px 0 rgba(5, 17, 49, .24);
}

.score-label {
  color: var(--yellow);
  font-size: clamp(.66rem, .8vw, .8rem);
  font-weight: 900;
  letter-spacing: .22em;
  text-transform: uppercase;
}

.scoreboard strong {
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: clamp(3rem, 5.5vw, 5.6rem);
  font-weight: 900;
  font-style: italic;
  line-height: .9;
  letter-spacing: .02em;
}

.game-actions {
  justify-self: end;
  display: flex;
  gap: 10px;
  pointer-events: auto;
}

.icon-button {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  padding: 0;
  color: var(--yellow);
  border: 2px solid var(--yellow);
  border-radius: 50%;
  background: rgba(7, 26, 72, .72);
  box-shadow: 0 7px 0 rgba(3, 13, 38, .3);
  cursor: pointer;
  transition: transform 150ms ease, background-color 150ms ease;
}

.icon-button:hover:not(:disabled) { background: var(--navy-800); transform: translateY(-2px); }
.icon-button:active:not(:disabled) { transform: translateY(2px); }
.icon-button:disabled { opacity: .36; cursor: not-allowed; }
.icon-button:focus-visible, .primary-button:focus-visible { outline: 4px solid var(--cyan); outline-offset: 4px; }
.icon-button svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.sound-off, .music-off { display: none; }
.muted .sound-on { display: none; }
.muted .sound-off { display: block; }
.muted .music-on { display: none; }
.muted .music-off { display: block; }

.intro-panel,
.pause-panel,
.result-panel {
  position: absolute;
  z-index: 5;
  left: clamp(22px, 7vw, 110px);
  top: 50%;
  width: min(500px, calc(100% - 44px));
  transform: translateY(-47%);
}

.intro-panel[hidden], .pause-panel[hidden], .result-panel[hidden] { display: none; }

.intro-logo { display: none; width: 170px; height: auto; margin-bottom: 22px; }

.intro-signal,
.result-kicker {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 10px;
  color: var(--yellow);
  font-size: .76rem;
  font-weight: 900;
  letter-spacing: .2em;
  text-transform: uppercase;
}

.intro-signal span { font-size: 1.4rem; }

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

h1,
.pause-panel h2,
.result-panel h2 {
  margin-bottom: 18px;
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-weight: 900;
  font-style: italic;
  text-transform: uppercase;
  letter-spacing: .012em;
  line-height: .78;
  text-shadow: 0 8px 0 rgba(5, 19, 55, .22);
}

h1 { font-size: clamp(4.6rem, 8.8vw, 9.6rem); }
h1 span { display: block; color: var(--paper); font-size: .48em; letter-spacing: .05em; }
h1 { color: var(--yellow); }

.intro-copy {
  max-width: 390px;
  margin-bottom: 28px;
  color: rgba(255, 255, 255, .86);
  font-size: clamp(.98rem, 1.3vw, 1.2rem);
  line-height: 1.55;
}

.primary-button {
  min-width: 225px;
  min-height: 58px;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  padding: 0 22px 0 26px;
  color: var(--ink);
  border: 0;
  border-radius: 4px;
  background: var(--yellow);
  box-shadow: 8px 8px 0 var(--navy-950);
  font-size: .95rem;
  font-weight: 900;
  letter-spacing: .04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 150ms ease;
}

.primary-button b { font-size: 1.6rem; line-height: 1; }
.primary-button:hover { transform: translate(-2px, -2px); box-shadow: 11px 11px 0 var(--navy-950); }
.primary-button:active { transform: translate(5px, 5px); box-shadow: 3px 3px 0 var(--navy-950); }
.primary-button.small { min-width: 170px; justify-content: center; }

.key-hint {
  margin: 22px 0 0;
  color: rgba(255, 255, 255, .62);
  font-size: .76rem;
  font-weight: 800;
  letter-spacing: .09em;
  text-transform: uppercase;
}

kbd {
  display: inline-block;
  min-width: 66px;
  padding: 6px 10px;
  margin-right: 6px;
  color: var(--paper);
  border: 1px solid rgba(255, 255, 255, .34);
  border-bottom-width: 3px;
  border-radius: 4px;
  background: rgba(4, 17, 50, .46);
  text-align: center;
}

.pause-panel, .result-panel {
  left: 50%;
  width: min(420px, calc(100% - 40px));
  padding: 42px;
  transform: translate(-50%, -50%);
  border: 2px solid var(--yellow);
  background: rgba(6, 22, 61, .94);
  box-shadow: 12px 12px 0 rgba(2, 11, 32, .55);
  text-align: center;
}

.pause-panel h2, .result-panel h2 { font-size: clamp(3rem, 6vw, 4.8rem); color: var(--paper); }
.pause-panel p { color: rgba(255, 255, 255, .7); }
.panel-bolt { display: block; color: var(--yellow); font-size: 3rem; }

.result-kicker { justify-content: center; }
.result-numbers { display: grid; grid-template-columns: 1fr 1px 1fr; gap: 22px; align-items: center; margin: 28px 0 30px; }
.result-numbers div { display: grid; gap: 4px; }
.result-numbers span { color: rgba(255, 255, 255, .58); font-size: .7rem; font-weight: 900; letter-spacing: .16em; text-transform: uppercase; }
.result-numbers strong { color: var(--yellow); font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif; font-size: 3rem; line-height: 1; }
.result-numbers i { width: 1px; height: 52px; background: rgba(255, 255, 255, .18); }
.result-panel .key-hint { margin-bottom: 0; }

.game-footer {
  position: absolute;
  z-index: 4;
  left: 0;
  right: 0;
  bottom: max(16px, env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 clamp(20px, 3.5vw, 56px);
  color: rgba(255, 255, 255, .58);
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .11em;
  text-transform: uppercase;
  pointer-events: none;
}

.game-footer p { margin: 0; }
.desktop-hint { color: var(--yellow); }
.mobile-hint { display: none; color: var(--yellow); }
.edition { justify-self: end; }

.energy-meter { display: flex; align-items: center; gap: 9px; }
.energy-icon { color: var(--yellow); font-size: 1.2rem; }
.energy-track { width: 100px; height: 7px; padding: 1px; border: 1px solid rgba(255, 255, 255, .42); transform: skewX(-12deg); }
.energy-track i { display: block; width: 100%; height: 100%; background: var(--yellow); transform-origin: left; transition: transform 180ms ease; }

.status-strip {
  position: absolute;
  z-index: 6;
  left: 50%;
  top: 26%;
  padding: 9px 16px;
  transform: translate(-50%, -10px);
  opacity: 0;
  color: var(--navy-950);
  background: var(--yellow);
  font-size: .72rem;
  font-weight: 1000;
  letter-spacing: .16em;
  text-transform: uppercase;
  pointer-events: none;
}

.status-strip.show { animation: status-pop 1.8s ease both; }

@keyframes status-pop {
  0% { opacity: 0; transform: translate(-50%, 10px) scale(.92); }
  14%, 72% { opacity: 1; transform: translate(-50%, 0) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -12px) scale(.98); }
}

@media (max-width: 760px) {
  .game-shell { min-height: 480px; }
  .game-header { padding-inline: 16px; }
  .game-header { display: block; }
  .brand-mark { width: 135px; margin-top: 6px; }
  .scoreboard { position: absolute; top: max(20px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); }
  .game-actions { position: absolute; top: max(20px, env(safe-area-inset-top)); right: 16px; }
  .score-label { font-size: .56rem; }
  .scoreboard strong { font-size: 3.3rem; }
  .icon-button { width: 42px; height: 42px; }
  .game-actions { gap: 7px; }

  .intro-panel { left: 22px; top: 47%; width: min(310px, calc(100% - 44px)); }
  .intro-signal { font-size: .63rem; }
  h1 { font-size: clamp(4rem, 20vw, 5.5rem); }
  .intro-copy { max-width: 285px; margin-bottom: 22px; font-size: .9rem; }
  .primary-button { min-width: 210px; min-height: 54px; }
  .key-hint { display: none; }

  .pause-panel, .result-panel { padding: 30px 24px; }
  .pause-panel h2, .result-panel h2 { font-size: 3.25rem; }

  .game-footer { display: flex; justify-content: space-between; gap: 12px; padding-inline: 16px; font-size: .58rem; }
  .game-footer p { justify-self: end; }
  .edition { display: none; }
  .desktop-hint { display: none; }
  .mobile-hint { display: inline; }
  .energy-track { width: 58px; }
  #energy-label { display: none; }
}

@media (max-width: 430px) {
  .brand-mark { width: 120px; }
  .game-actions { gap: 5px; }
  .icon-button { width: 38px; height: 38px; }
  .icon-button svg { width: 20px; height: 20px; }
  .intro-panel { left: 18px; width: calc(100% - 36px); }
  .intro-copy { max-width: 250px; }
  .game-footer p { white-space: nowrap; }
}

@media (max-height: 620px) and (orientation: landscape) {
  .intro-panel { left: 5vw; top: 51%; width: 380px; }
  h1 { font-size: 5rem; }
  .intro-copy { display: none; }
  .intro-signal { margin-bottom: 6px; }
  .primary-button { min-height: 50px; }
  .key-hint { margin-top: 15px; }
  .brand-mark { width: 153px; }
  .game-header { padding-top: 12px; }
  .game-footer { bottom: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
