:root {
  color-scheme: dark;
  --ink: #eaf3f5;
  --muted: #89979b;
  --panel: #10161a;
  --line: #2b373c;
  --orange: #ff8a22;
  --blue: #8de8ff;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

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

body {
  background:
    radial-gradient(circle at 50% -10%, #243036 0, #0b1013 44%, #050708 100%);
  color: var(--ink);
  font-family: "Arial Narrow", "Roboto Condensed", Arial, sans-serif;
  user-select: none;
}

button {
  color: inherit;
  font: inherit;
}

.game-shell {
  width: min(100%, 760px);
  min-height: 100svh;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 14px max(18px, env(safe-area-inset-bottom));
}

.topbar,
.status-strip,
.instrument-panel,
.instructions,
footer {
  display: flex;
  align-items: center;
}

.topbar {
  justify-content: space-between;
  margin-bottom: 12px;
}

.eyebrow {
  margin: 0 0 2px;
  color: #799097;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.18em;
}

h1 {
  margin: 0;
  font-size: clamp(27px, 7vw, 40px);
  font-style: italic;
  letter-spacing: -0.04em;
  line-height: 0.95;
  text-shadow: 2px 2px 0 #29373d;
}

.sound-button {
  border: 1px solid #415057;
  border-radius: 2px;
  background: #10171a;
  padding: 9px 10px;
  color: #87979c;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
}

.sound-button span {
  color: var(--orange);
}

.game-card,
.results {
  overflow: hidden;
  border: 1px solid #344147;
  background: linear-gradient(145deg, #161e22, #0b0f12);
  box-shadow: 0 20px 60px #000a, inset 0 1px #ffffff0d;
}

.status-strip {
  height: 38px;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
  background: #0c1114;
  color: #b2bec1;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.13em;
}

.status-lamp {
  width: 7px;
  height: 7px;
  margin-right: 8px;
  border-radius: 50%;
  background: #73df88;
  box-shadow: 0 0 8px #73df88;
}

.status-lamp.hot {
  background: var(--blue);
  box-shadow: 0 0 12px var(--blue);
}

.status-lamp.fail {
  background: var(--orange);
  box-shadow: 0 0 9px var(--orange);
}

.attempts {
  margin-left: auto;
  color: #64757a;
}

.canvas-wrap {
  position: relative;
  overflow: hidden;
  height: clamp(390px, 62svh, 560px);
  background: #080b0d;
  touch-action: none;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

.helmet {
  position: absolute;
  z-index: 5;
  inset: 0;
  pointer-events: none;
  transform: translateY(-110%);
  transition: transform 680ms cubic-bezier(0.7, 0, 0.25, 1);
}

.helmet.down {
  transform: translateY(0);
}

.helmet.ready {
  opacity: 0;
  transition: opacity 260ms ease;
}

.helmet-shell {
  position: absolute;
  inset: -10% -18% -7%;
  border: 3px solid #1c2428;
  border-radius: 48% 48% 30% 30% / 20% 20% 38% 38%;
  background:
    linear-gradient(115deg, transparent 38%, #ffffff0a 39%, transparent 43%),
    radial-gradient(circle at 50% 30%, #303b3f, #151b1f 54%, #090c0e 78%);
  box-shadow: inset 0 0 70px #000, 0 20px 50px #000;
}

.helmet-ridge {
  position: absolute;
  top: 3%;
  left: 48%;
  width: 5%;
  height: 80%;
  border-right: 1px solid #ffffff0c;
  border-left: 1px solid #000;
  transform: skewX(-4deg);
}

.helmet-window {
  position: absolute;
  top: 24%;
  left: 26%;
  width: 48%;
  height: 35%;
  padding: 10px;
  border: 3px solid #07090a;
  border-radius: 6px;
  background: #1d2529;
  box-shadow: 0 5px 15px #000, inset 0 1px #536168;
}

.helmet-glass {
  width: 100%;
  height: 100%;
  border: 2px solid #050707;
  background: linear-gradient(155deg, #182426, #020405 70%);
  box-shadow: inset 0 0 22px #000;
}

.helmet-vents {
  position: absolute;
  top: 67%;
  left: 40%;
  display: flex;
  gap: 7px;
}

.helmet-vents i {
  display: block;
  width: 4px;
  height: 34px;
  border-radius: 3px;
  background: #06090a;
  transform: rotate(14deg);
  box-shadow: 1px 0 #3e484c;
}

.helmet-mark {
  position: absolute;
  top: 73%;
  left: 25%;
  color: #778085;
  font-size: 11px;
  font-weight: 900;
  transform: rotate(-12deg);
}

.flash {
  position: absolute;
  z-index: 8;
  inset: 0;
  pointer-events: none;
  background: #dffaff;
  opacity: 0;
}

.flash.fire {
  animation: flash 180ms ease-out;
}

@keyframes flash {
  0% { opacity: 0.92; }
  100% { opacity: 0; }
}

.message {
  position: absolute;
  z-index: 9;
  top: 13%;
  left: 50%;
  min-width: 170px;
  padding: 8px 12px;
  border: 1px solid #78878d;
  background: #090d10e8;
  color: #eaf7fa;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-align: center;
  opacity: 0;
  transform: translate(-50%, -7px);
  transition: 180ms ease;
}

.message.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.instrument-panel {
  gap: 12px;
  padding: 11px 12px;
  border-top: 1px solid #34434a;
  border-bottom: 1px solid #273238;
  background: #11181b;
}

.meter {
  flex: 1;
}

.meter > span,
.readout span {
  display: block;
  margin-bottom: 4px;
  color: #708087;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.15em;
}

.meter-track {
  overflow: hidden;
  height: 5px;
  background: #293238;
}

.meter-track i {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--orange), #dffcff);
  box-shadow: 0 0 8px var(--blue);
  transition: width 90ms linear;
}

.readout {
  min-width: 62px;
  text-align: right;
}

.readout strong {
  display: block;
  color: var(--blue);
  font-family: Consolas, monospace;
  font-size: 16px;
}

.instructions {
  min-height: 80px;
  gap: 15px;
  justify-content: space-between;
  padding: 12px;
}

.instructions p {
  max-width: 360px;
  margin: 0;
  color: #a7b3b7;
  font-size: 12px;
  line-height: 1.45;
}

.primary-button {
  flex: 0 0 auto;
  border: 0;
  border-bottom: 3px solid #8d3900;
  border-radius: 2px;
  background: linear-gradient(#ff9c35, #e9680a);
  padding: 12px 16px 10px;
  color: #160c04;
  font-size: 11px;
  font-weight: 1000;
  letter-spacing: 0.1em;
  box-shadow: 0 0 18px #ff6a001c;
}

.primary-button:active {
  transform: translateY(2px);
  border-bottom-width: 1px;
}

.primary-button:disabled {
  filter: grayscale(1);
  opacity: 0.45;
}

.results {
  margin-top: 14px;
  padding: 18px;
}

.rank-stamp {
  display: grid;
  grid-template-columns: 1fr auto;
  border-bottom: 1px solid #324047;
  padding-bottom: 14px;
}

.rank-stamp span {
  color: var(--orange);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.2em;
}

.rank-stamp strong {
  align-self: end;
  font-size: clamp(24px, 6vw, 38px);
  font-style: italic;
  letter-spacing: -0.04em;
}

.rank-stamp b {
  grid-row: 1 / 3;
  grid-column: 2;
  padding-left: 18px;
  color: var(--blue);
  font-family: Consolas, monospace;
  font-size: 48px;
  line-height: 1;
}

.score-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  margin: 16px 0;
  background: #2a353a;
  border: 1px solid #2a353a;
}

.score-item {
  display: flex;
  justify-content: space-between;
  padding: 9px;
  background: #101619;
  color: #89989d;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.score-item b {
  color: #e5f2f5;
  font-family: Consolas, monospace;
  font-size: 13px;
}

.verdict {
  color: #a6b3b7;
  font-size: 12px;
  line-height: 1.5;
}

.results .primary-button {
  width: 100%;
}

footer {
  justify-content: space-between;
  padding-top: 10px;
  color: #4e5e63;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.1em;
}

@media (max-width: 480px) {
  .game-shell {
    padding-right: 8px;
    padding-left: 8px;
  }

  .canvas-wrap {
    height: min(59svh, 510px);
  }

  .instructions {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
  }

  .primary-button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .helmet {
    transition-duration: 1ms;
  }
}
