:root {
  color-scheme: light;
  --bg: #081b2d;
  --surface: #f8fbff;
  --surface-soft: #d9f2f6;
  --text: #10202b;
  --muted: #5c7180;
  --line: #b8d7df;
  --primary: #0a7fb0;
  --primary-strong: #065d82;
  --accent: #f0b744;
  --danger: #c7523b;
  --shadow: 0 22px 70px rgb(2 17 29 / 34%);
  --radius: 8px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(180deg, rgb(72 185 211 / 58%), rgb(7 41 67 / 82)),
    var(--bg);
}

body,
button,
input {
  font: inherit;
}

button,
input {
  color: inherit;
}

.skip-link {
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 10;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius);
  background: #ffffff;
  color: #0a3145;
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: translateY(0);
}

.game-shell {
  width: min(1320px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1rem 0 2rem;
}

.topbar,
.score-strip,
.play-layout,
.stage-controls,
.panel-heading,
.input-row,
.score-list li {
  display: flex;
}

.topbar {
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.25rem 0 1rem;
  color: #ffffff;
}

.topbar h1,
.stage h2,
.score-panel h2 {
  margin: 0;
  line-height: 1.05;
  letter-spacing: 0;
}

.topbar h1 {
  font-size: clamp(2rem, 5vw, 4rem);
}

.eyebrow {
  margin: 0 0 0.35rem;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.score-strip {
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
  max-width: 560px;
}

.score-strip span {
  min-width: 7.5rem;
  padding: 0.65rem 0.85rem;
  border: 1px solid rgb(255 255 255 / 26%);
  border-radius: var(--radius);
  background: rgb(255 255 255 / 14%);
  color: rgb(255 255 255 / 84%);
  font-weight: 800;
  text-align: center;
}

.score-strip strong {
  color: #ffffff;
  font-size: 1.35rem;
}

.play-layout {
  align-items: stretch;
  gap: 1rem;
}

.stage {
  flex: 1 1 820px;
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgb(255 255 255 / 28%);
  border-radius: var(--radius);
  background: #0c5575;
  box-shadow: var(--shadow);
}

canvas {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #1688a8;
}

.stage-controls {
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem;
  background: var(--surface);
}

.stage h2,
.score-panel h2 {
  font-size: clamp(1.25rem, 3vw, 1.9rem);
}

.stage p {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-weight: 700;
  line-height: 1.45;
}

.score-panel {
  flex: 0 0 360px;
  display: grid;
  align-content: start;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid rgb(255 255 255 / 42%);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface), transparent 4%);
  box-shadow: var(--shadow);
}

.panel-heading {
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 5.8rem;
  min-height: 2.75rem;
  padding: 0.68rem 1rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-weight: 900;
  cursor: pointer;
}

.button.primary {
  background: var(--primary);
  color: #ffffff;
}

.button.primary:hover,
.button.primary:focus-visible {
  background: var(--primary-strong);
}

.button.secondary {
  border-color: var(--line);
  background: #ffffff;
}

.button.secondary:hover,
.button.secondary:focus-visible {
  border-color: var(--primary);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

.score-form {
  display: grid;
  gap: 0.45rem;
}

.score-form label {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 900;
}

.input-row {
  gap: 0.6rem;
}

input {
  width: 100%;
  min-height: 2.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  padding: 0.65rem 0.75rem;
}

input:focus,
button:focus-visible,
.skip-link:focus {
  outline: 3px solid rgb(240 183 68 / 60%);
  outline-offset: 2px;
}

.score-list {
  display: grid;
  gap: 0.55rem;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: scores;
}

.score-list li {
  counter-increment: scores;
  align-items: center;
  gap: 0.65rem;
  min-height: 3.25rem;
  padding: 0.7rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.score-list li::before {
  content: counter(scores);
  display: grid;
  place-items: center;
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--primary-strong);
  font-size: 0.85rem;
  font-weight: 900;
}

.score-list span {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
  font-weight: 900;
}

.score-list strong {
  min-width: 2.4rem;
  color: var(--danger);
  font-size: 1.25rem;
  text-align: right;
}

.score-list small {
  min-width: 3.8rem;
  color: var(--muted);
  font-weight: 800;
  text-align: right;
}

.score-list .empty-score {
  color: var(--muted);
  font-weight: 800;
}

.score-list .empty-score::before {
  content: "-";
}

@media (max-width: 960px) {
  .topbar,
  .play-layout,
  .stage-controls,
  .input-row {
    flex-direction: column;
  }

  .topbar,
  .stage-controls {
    align-items: stretch;
  }

  .score-strip {
    justify-content: stretch;
  }

  .score-strip span {
    flex: 1 1 8rem;
  }

  .score-panel {
    flex-basis: auto;
  }
}

@media (max-width: 540px) {
  .game-shell {
    width: min(100% - 0.75rem, 1320px);
  }

  .stage-controls,
  .score-panel {
    padding: 0.75rem;
  }

  .score-list li {
    gap: 0.45rem;
  }
}
