:root {
  color-scheme: dark;
  --ink: #f6fbff;
  --muted: #8aa0a8;
  --line: #d9fbff;
  --cyan: #39e8ff;
  --amber: #ffd65a;
  --red: #ff4b6c;
  --panel: rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  overflow: hidden;
  background: #020303;
  color: var(--ink);
  font-family: "Trebuchet MS", "Segoe UI", Arial, sans-serif;
}

button {
  min-height: 44px;
  border: 1px solid rgba(217, 251, 255, 0.48);
  border-radius: 4px;
  padding: 0 16px;
  background: rgba(0, 0, 0, 0.64);
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
  text-shadow: 0 0 10px rgba(57, 232, 255, 0.85);
  box-shadow: inset 0 0 16px rgba(57, 232, 255, 0.08), 0 0 18px rgba(57, 232, 255, 0.12);
}

select {
  min-height: 44px;
  border: 1px solid rgba(217, 251, 255, 0.48);
  border-radius: 4px;
  padding: 0 36px 0 12px;
  background: rgba(0, 0, 0, 0.72);
  color: var(--line);
  font: inherit;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
  text-shadow: 0 0 10px rgba(57, 232, 255, 0.85);
}

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

.game-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 8px;
  background:
    radial-gradient(circle at center, #071014 0%, #020303 64%),
    #020303;
}

.stage {
  position: relative;
  align-self: stretch;
  justify-self: center;
  width: min(100%, calc((100vh - 92px) * 1.7778));
  height: min(calc(100vh - 92px), calc(100vw / 1.7778));
  min-height: 0;
  overflow: hidden;
  border: 1px solid rgba(217, 251, 255, 0.34);
  border-radius: 6px;
  background: #010303;
  box-shadow: 0 34px 100px rgba(0, 0, 0, 0.78), inset 0 0 48px rgba(57, 232, 255, 0.08);
}

.stage::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    linear-gradient(rgba(255, 255, 255, 0.025) 50%, rgba(0, 0, 0, 0.11) 50%),
    radial-gradient(circle at center, transparent 54%, rgba(0, 0, 0, 0.46) 100%);
  background-size: 100% 4px, 100% 100%;
  mix-blend-mode: screen;
}

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

.hud {
  position: absolute;
  z-index: 3;
  top: 12px;
  left: 12px;
  right: 12px;
  display: grid;
  grid-template-columns: repeat(6, minmax(78px, 1fr));
  gap: 8px;
  pointer-events: none;
}

.hud div {
  min-height: 52px;
  padding: 8px 11px;
  border: 1px solid rgba(217, 251, 255, 0.18);
  border-radius: 4px;
  background: var(--panel);
}

.hud span {
  display: block;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 900;
  text-transform: uppercase;
}

.hud strong {
  display: block;
  margin-top: 1px;
  color: var(--line);
  font-size: clamp(1.05rem, 1.7vw, 1.75rem);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 14px rgba(217, 251, 255, 0.72);
}

.status-line {
  position: absolute;
  z-index: 3;
  left: 50%;
  bottom: 19px;
  transform: translateX(-50%);
  width: min(760px, calc(100% - 260px));
  color: var(--amber);
  font-size: clamp(0.82rem, 1.2vw, 1.05rem);
  font-weight: 900;
  text-align: center;
  text-shadow: 0 0 16px rgba(255, 214, 90, 0.78);
  pointer-events: none;
}

.banner {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto auto;
  place-items: center;
  justify-items: center;
  gap: 12px;
  padding: 18px 28px 24px;
  text-align: center;
  background:
    radial-gradient(circle at center, rgba(57, 232, 255, 0.08), rgba(1, 3, 3, 0.9) 66%),
    linear-gradient(180deg, rgba(1, 3, 3, 0.22), rgba(1, 3, 3, 0.98));
}

.banner.hidden {
  display: none;
}

.hidden {
  display: none !important;
}

.prestart-score {
  display: grid;
  gap: 2px;
  color: var(--line);
  font-weight: 900;
  text-transform: uppercase;
  text-shadow: 0 0 16px rgba(217, 251, 255, 0.78);
}

.prestart-score span {
  color: var(--muted);
  font-size: 0.72rem;
}

.prestart-score strong {
  font-size: clamp(1.35rem, 2.4vw, 2.4rem);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.logo-image {
  width: min(540px, 74vw, 58vh);
  max-height: 43vh;
  object-fit: contain;
  filter: drop-shadow(0 0 22px rgba(57, 232, 255, 0.46));
}

.banner p {
  margin: 0;
  color: var(--amber);
  font-size: clamp(0.92rem, 1.6vw, 1.2rem);
  font-weight: 900;
  text-transform: uppercase;
}

.banner h1 {
  margin: 0;
  color: transparent;
  -webkit-text-stroke: 2px var(--line);
  font-size: clamp(3.2rem, 9vw, 8.8rem);
  line-height: 0.9;
  text-shadow:
    0 0 14px rgba(217, 251, 255, 0.9),
    0 0 48px rgba(57, 232, 255, 0.5);
}

.banner-title {
  margin: 0;
  color: var(--line);
  font-size: clamp(1.8rem, 4vw, 3.8rem);
  line-height: 1;
  text-transform: uppercase;
  text-shadow:
    0 0 14px rgba(217, 251, 255, 0.9),
    0 0 38px rgba(57, 232, 255, 0.45);
}

.banner-message {
  color: var(--amber);
  font-size: clamp(0.92rem, 1.6vw, 1.2rem);
  font-weight: 900;
  text-transform: uppercase;
  text-shadow: 0 0 14px rgba(255, 214, 90, 0.55);
}

.attract-panel {
  width: min(620px, 92%);
  min-height: 92px;
  display: grid;
  place-items: center;
}

.attract-page {
  width: 100%;
  display: grid;
  gap: 8px;
  justify-items: center;
}

.attract-page h2 {
  margin: 0;
  color: var(--line);
  font-size: clamp(1.1rem, 2.6vw, 2rem);
  text-transform: uppercase;
  text-shadow: 0 0 14px rgba(217, 251, 255, 0.7);
}

.attract-page ul {
  display: grid;
  grid-template-columns: repeat(2, minmax(150px, 1fr));
  gap: 6px 20px;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--ink);
  font-weight: 900;
  text-transform: uppercase;
}

.difficulty-info {
  display: none;
  color: var(--amber);
  font-weight: 900;
  text-transform: uppercase;
  text-shadow: 0 0 12px rgba(255, 214, 90, 0.68);
}

.mini-screen {
  position: relative;
  width: min(440px, 80vw);
  height: 78px;
  border: 1px solid rgba(217, 251, 255, 0.24);
  border-radius: 4px;
  overflow: hidden;
  background:
    radial-gradient(circle at 32% 44%, rgba(57, 232, 255, 0.13), transparent 38%),
    rgba(0, 0, 0, 0.34);
}

.mini-screen span {
  position: absolute;
  display: block;
}

.mini-ship {
  left: 48%;
  top: 28px;
  width: 0;
  height: 0;
  border-left: 12px solid transparent;
  border-right: 12px solid transparent;
  border-bottom: 28px solid #d9fbff;
  filter: drop-shadow(0 0 8px #39e8ff);
  transform: rotate(25deg);
}

.mini-shape {
  width: 24px;
  height: 24px;
  border: 2px solid currentColor;
  filter: drop-shadow(0 0 8px currentColor);
}

.mini-square {
  left: 14%;
  top: 28px;
  color: #39a7ff;
}

.mini-triangle {
  left: 72%;
  top: 18px;
  color: #68ffa6;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
  background: transparent;
}

.mini-pentagon {
  left: 31%;
  top: 13px;
  color: #ff4b6c;
  clip-path: polygon(50% 0, 100% 38%, 82% 100%, 18% 100%, 0 38%);
}

.mini-kite {
  right: 13%;
  top: 34px;
  width: 34px;
  height: 20px;
  border: 2px solid #fff;
  clip-path: polygon(100% 50%, 38% 0, 0 50%, 38% 100%);
  filter: drop-shadow(0 0 10px #fff);
  animation: kiteDrift 2.6s linear infinite;
}

@keyframes kiteDrift {
  from { transform: translateX(36px); }
  to { transform: translateX(-36px); }
}

.banner button {
  min-width: 170px;
  min-height: 56px;
  border-color: var(--line);
  background: rgba(217, 251, 255, 0.08);
}

.difficulty-picker {
  display: grid;
  grid-template-columns: repeat(3, minmax(86px, 1fr));
  gap: 8px;
  width: min(390px, 92%);
  margin: 0;
  padding: 0;
  border: 0;
  color: var(--muted);
  font-weight: 900;
  text-transform: uppercase;
}

.difficulty-picker legend {
  grid-column: 1 / -1;
  font-size: 0.72rem;
  margin-bottom: 2px;
}

.difficulty-picker input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.difficulty-picker label {
  min-height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(217, 251, 255, 0.34);
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.48);
  color: var(--ink);
  cursor: pointer;
  text-shadow: 0 0 10px rgba(57, 232, 255, 0.72);
}

.difficulty-picker input:checked + label {
  border-color: var(--amber);
  color: #061015;
  background: linear-gradient(135deg, var(--cyan), var(--amber));
  text-shadow: none;
}

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

.control-deck {
  width: min(100%, calc((100vh - 92px) * 1.7778));
  justify-self: center;
  min-height: 68px;
  display: grid;
  grid-template-columns: minmax(270px, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid rgba(217, 251, 255, 0.28);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.56);
  box-shadow: inset 0 0 24px rgba(57, 232, 255, 0.06), 0 16px 50px rgba(0, 0, 0, 0.44);
}

.score-table {
  display: flex;
  gap: 16px;
  align-items: center;
  min-width: 0;
  color: var(--line);
  font-weight: 900;
  text-transform: uppercase;
  text-shadow: 0 0 12px rgba(217, 251, 255, 0.55);
}

.score-table span {
  color: var(--muted);
  font-size: 0.75rem;
  white-space: nowrap;
}

.score-table ol {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin: 0;
  padding: 0;
  list-style-position: inside;
  font-variant-numeric: tabular-nums;
}

.score-table li {
  min-width: 104px;
}

.score-entry {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: end;
  width: min(360px, 100%);
}

.score-entry.hidden {
  display: none;
}

.score-entry label {
  grid-column: 1 / -1;
  color: var(--amber);
  font-weight: 900;
  text-transform: uppercase;
}

.score-entry input {
  min-height: 54px;
  width: 100%;
  border: 1px solid rgba(217, 251, 255, 0.58);
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.72);
  color: var(--line);
  font: inherit;
  font-size: 2rem;
  font-weight: 900;
  letter-spacing: 0;
  text-align: center;
  text-transform: uppercase;
  text-shadow: 0 0 14px rgba(217, 251, 255, 0.7);
}

@media (max-width: 820px) {
  .game-shell {
    padding: 6px;
    gap: 6px;
  }

  .stage {
    width: 100%;
    height: min(calc(100vh - 142px), calc(100vw / 1.7778));
  }

  .hud {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    top: 10px;
    left: 10px;
    right: 10px;
  }

  .hud div {
    min-height: 46px;
    padding: 7px 8px;
  }

  .status-line {
    bottom: 14px;
    width: calc(100% - 24px);
  }

  .control-deck {
    width: 100%;
    grid-template-columns: 1fr;
    min-height: 124px;
    padding: 8px;
  }

  .actions button {
    flex: 1;
    padding: 0 8px;
  }
}
