:root {
  color-scheme: dark;
  --bg: #06070c;
  --panel: #0d1118;
  --panel-2: #151922;
  --ink: #edf7ff;
  --muted: #8291a5;
  --cyan: #56e6ff;
  --green: #83ff9f;
  --coral: #ff6f61;
  --amber: #ffc857;
  --edge: rgba(255, 255, 255, 0.14);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at 18% 20%, rgba(86, 230, 255, 0.12), transparent 28rem),
    radial-gradient(circle at 82% 12%, rgba(255, 111, 97, 0.10), transparent 24rem),
    linear-gradient(160deg, #06070c 0%, #0b1018 52%, #09070d 100%);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button {
  appearance: none;
  border: 1px solid var(--edge);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.10), rgba(255, 255, 255, 0.04));
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  min-height: 38px;
  padding: 0 14px;
  transition:
    border-color 120ms ease,
    background 120ms ease,
    transform 120ms ease;
}

button:hover {
  border-color: rgba(86, 230, 255, 0.7);
  background: linear-gradient(180deg, rgba(86, 230, 255, 0.22), rgba(86, 230, 255, 0.07));
}

button:active {
  transform: translateY(1px);
}

button:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
}

.shell {
  align-items: center;
  display: flex;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.game {
  background: rgba(13, 17, 24, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 8px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  display: grid;
  gap: 12px;
  max-width: 1180px;
  padding: 14px;
  width: min(100%, 1180px);
}

.topbar {
  align-items: center;
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr auto 1fr;
  min-height: 46px;
}

.brand {
  color: var(--ink);
  font-size: clamp(1rem, 2.3vw, 1.55rem);
  font-weight: 900;
  letter-spacing: 0;
}

.readouts {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: center;
}

.pips {
  display: flex;
  gap: 6px;
  min-width: 70px;
}

.pip {
  background: var(--coral);
  border: 1px solid rgba(255, 255, 255, 0.30);
  box-shadow: 0 0 14px rgba(255, 111, 97, 0.46);
  clip-path: polygon(50% 0%, 94% 76%, 50% 58%, 6% 76%);
  height: 20px;
  width: 20px;
}

.pip.empty {
  background: rgba(255, 255, 255, 0.08);
  box-shadow: none;
}

.meter {
  align-items: center;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 8px;
  color: var(--green);
  display: inline-flex;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  height: 36px;
  justify-content: center;
  min-width: 72px;
  padding: 0 10px;
}

.meter.danger {
  border-color: rgba(255, 111, 97, 0.7);
  color: var(--coral);
  box-shadow: 0 0 18px rgba(255, 111, 97, 0.24);
}

.actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.stage {
  aspect-ratio: 16 / 9;
  background: #05070b;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  min-height: 210px;
  overflow: hidden;
  position: relative;
}

canvas {
  display: block;
  height: 100%;
  touch-action: none;
  width: 100%;
}

.overlay {
  align-items: center;
  background: linear-gradient(180deg, rgba(5, 7, 11, 0.62), rgba(5, 7, 11, 0.24));
  display: flex;
  flex-direction: column;
  gap: 12px;
  inset: 0;
  justify-content: center;
  padding: 24px;
  pointer-events: auto;
  position: absolute;
  text-align: center;
}

.overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.overlay h1 {
  font-size: clamp(2rem, 7vw, 5.2rem);
  line-height: 0.9;
  margin: 0;
  text-shadow:
    0 0 18px rgba(86, 230, 255, 0.46),
    0 8px 32px rgba(0, 0, 0, 0.55);
}

.overlay p {
  color: rgba(237, 247, 255, 0.82);
  font-size: clamp(1rem, 2vw, 1.22rem);
  font-weight: 700;
  margin: 0;
}

.overlay button {
  background: linear-gradient(180deg, rgba(131, 255, 159, 0.32), rgba(86, 230, 255, 0.12));
  border-color: rgba(131, 255, 159, 0.72);
  min-width: 124px;
}

.touch-controls {
  display: none;
  gap: 8px;
  grid-template-columns: repeat(4, minmax(48px, 1fr));
}

.touch-controls button {
  font-size: 1.15rem;
  height: 46px;
  padding: 0;
  touch-action: none;
}

@media (max-width: 760px) {
  .shell {
    align-items: start;
    padding: 10px;
  }

  .game {
    padding: 10px;
  }

  .topbar {
    grid-template-columns: 1fr;
  }

  .brand,
  .actions {
    justify-content: center;
    text-align: center;
  }

  .readouts {
    order: 2;
  }

  .actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    order: 3;
  }

  .touch-controls {
    display: grid;
  }
}
