:root {
  color-scheme: dark;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: #0b0f15;
  color: #eef4fb;
  --panel: #141b25;
  --panel-strong: #1c2633;
  --line: #2c3a4d;
  --green: #63d3a1;
  --yellow: #f2c94c;
  --red: #ff647c;
  --blue: #8fb4ff;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 15% 0%, rgba(99, 211, 161, 0.14), transparent 26rem),
    linear-gradient(135deg, #0b0f15 0%, #121924 55%, #17161c 100%);
}

button {
  position: relative;
  min-height: 40px;
  border: 1px solid #3a4c63;
  border-radius: 8px;
  background: #223044;
  color: #f4f8ff;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  transition:
    transform 120ms ease,
    border-color 120ms ease,
    background 120ms ease;
}

button:hover,
button:focus-visible {
  border-color: var(--yellow);
  outline: none;
}

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

button:disabled {
  cursor: not-allowed;
  opacity: 0.46;
}

button[aria-pressed="true"]:not([data-difficulty]) {
  border-color: #63d3a1;
  background: #244d3d;
}

.app-shell {
  width: min(1320px, calc(100vw - 24px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 10px 0 18px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 10px;
}

.topbar {
  border: 1px solid var(--line);
  background: rgba(20, 27, 37, 0.86);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.26);
  backdrop-filter: blur(12px);
}

.topbar {
  min-height: 58px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: 8px;
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--yellow);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(22px, 3vw, 32px);
  line-height: 1;
  letter-spacing: 0;
}

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
}

.actions button {
  min-width: 88px;
  padding: 0 14px;
}

#assist {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 112px;
  padding: 0 18px 0 34px;
  border: 0;
  border-radius: 14px 8px 14px 8px;
  background:
    radial-gradient(circle at 22% 18%, #fff0a6 0 9%, transparent 10%),
    linear-gradient(135deg, #ffcf4f 0%, #ff7a3d 42%, #f2355b 100%);
  box-shadow:
    0 0 0 1px rgba(255, 242, 168, 0.42) inset,
    0 8px 24px rgba(242, 53, 91, 0.28);
  clip-path: polygon(9% 0%, 100% 0%, 91% 100%, 0% 100%);
  color: #11161f;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.28);
}

#assist::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 50%;
  width: 14px;
  height: 18px;
  border-radius: 55% 55% 55% 12%;
  background:
    radial-gradient(circle at 58% 62%, #fff6b8 0 18%, transparent 20%),
    linear-gradient(145deg, #fff06d 0%, #ff933d 48%, #e92f50 100%);
  transform: translateY(-50%) rotate(-36deg);
  box-shadow: 0 0 14px rgba(255, 154, 61, 0.7);
}

#assist::after {
  content: "";
  position: absolute;
  inset: 5px 8px;
  border-radius: 11px 6px 11px 6px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  pointer-events: none;
}

#assist:hover,
#assist:focus-visible {
  border-color: transparent;
  filter: saturate(1.12) brightness(1.07);
}

#assist:disabled {
  opacity: 0.62;
  filter: grayscale(0.22);
}

#assist[aria-pressed="true"] {
  background:
    radial-gradient(circle at 22% 18%, #eafff5 0 9%, transparent 10%),
    linear-gradient(135deg, #63d3a1 0%, #2ba8dd 52%, #5d7cff 100%);
  color: #081019;
  box-shadow:
    0 0 0 1px rgba(234, 255, 245, 0.58) inset,
    0 8px 28px rgba(99, 211, 161, 0.3);
}

#superweapon {
  min-width: 106px;
  border-color: rgba(99, 211, 255, 0.5);
  background:
    repeating-radial-gradient(circle at 22% 50%, rgba(234, 255, 245, 0.55) 0 2px, transparent 3px 8px),
    linear-gradient(135deg, #10263d 0%, #0e7fa5 48%, #63d3ff 100%);
  color: #effcff;
  box-shadow:
    0 0 0 1px rgba(234, 255, 245, 0.22) inset,
    0 0 22px rgba(99, 211, 255, 0.16);
}

#superweapon[aria-pressed="true"] {
  color: #081019;
  border-color: transparent;
  background:
    repeating-radial-gradient(circle at 22% 50%, rgba(255, 255, 255, 0.78) 0 2px, transparent 3px 9px),
    linear-gradient(135deg, #fff06d 0%, #63d3ff 42%, #8fb4ff 100%);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.45) inset,
    0 0 30px rgba(99, 211, 255, 0.38);
}

#superweapon:disabled {
  opacity: 0.5;
  filter: grayscale(0.32);
}

.difficulty {
  display: flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid #304156;
  border-radius: 8px;
  background: rgba(13, 19, 28, 0.74);
}

.difficulty button {
  min-width: 76px;
  min-height: 34px;
  border-color: transparent;
  background: transparent;
  color: #aebfd4;
}

.difficulty button[aria-pressed="true"] {
  background: #f2c94c;
  color: #11161f;
}

.hud {
  display: grid;
  grid-template-columns: minmax(110px, 0.7fr) minmax(110px, 0.7fr) minmax(220px, 2fr);
  gap: 1px;
  overflow: hidden;
  border-radius: 8px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.hud div {
  min-height: 62px;
  padding: 12px 14px;
  background: rgba(28, 38, 51, 0.82);
}

.hud span {
  display: block;
  margin-bottom: 5px;
  color: #9fb0c5;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.hud strong {
  display: block;
  overflow: hidden;
  color: #f4f8ff;
  font-size: 18px;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game-panel {
  position: relative;
  min-height: 0;
  overflow: hidden;
  border: 1px solid #40556f;
  border-radius: 8px;
  background: #0e141c;
  box-shadow: 0 24px 76px rgba(0, 0, 0, 0.34);
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  touch-action: none;
}

.status-strip {
  display: grid;
  grid-template-columns: minmax(120px, 220px) minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 54px;
  padding: 10px 14px;
  border-radius: 8px;
}

.progress-track {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #263348;
}

.progress-track span {
  display: block;
  width: 100%;
  height: 100%;
  transform: scaleX(0);
  transform-origin: left;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--yellow));
  transition: transform 180ms ease;
}

.status-strip p {
  overflow: hidden;
  color: #d9e7f7;
  font-weight: 700;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.touch-pad {
  display: none;
  grid-template-columns: repeat(5, minmax(52px, 1fr));
  gap: 8px;
}

.touch-pad button {
  min-height: 52px;
}

.touch-pad [data-control="fire"] {
  background: #7f3344;
  border-color: #b55267;
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100vw - 16px, 680px);
    padding-top: 8px;
    gap: 8px;
  }

  .topbar {
    align-items: flex-start;
    display: grid;
  }

  h1 {
    font-size: 27px;
  }
  .touch-pad {
    display: grid;
  }
}

@media (max-width: 480px) {
  .topbar {
    display: grid;
  }

  .actions {
    justify-content: stretch;
  }

  .actions > button {
    flex: 1;
  }

  .difficulty {
    width: 100%;
  }

  .difficulty button {
    flex: 1;
    min-width: 0;
  }
}
