:root {
  color-scheme: light;
  --page: #eef2ec;
  --ink: #18201d;
  --muted: #66736c;
  --panel: #fbfcf8;
  --stage: #17201d;
  --stage-edge: #2e3934;
  --accent: #087f73;
  --accent-dark: #05665c;
  --danger: #d9344e;
  --gold: #e0a21b;
  --line: #cfd8d1;
  --focus: #f0b429;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
canvas,
select {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  width: calc(100% - 32px);
  max-width: 1120px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 28px 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.game-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
}

.title-block {
  min-width: 180px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent-dark);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: 2.35rem;
  line-height: 1;
  letter-spacing: 0;
}

.score-strip {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.score-block {
  min-width: 132px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 10px 30px rgb(24 32 29 / 8%);
}

.score-label {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.score-block strong {
  display: block;
  min-height: 1.75rem;
  font-size: 1.45rem;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.stage-wrap {
  width: 100%;
  max-width: calc((100svh - 230px) * 16 / 9);
  margin: 0 auto;
  border: 2px solid var(--stage-edge);
  border-radius: 8px;
  background: var(--stage);
  box-shadow: 0 18px 48px rgb(24 32 29 / 18%);
  overflow: hidden;
}

#gameCanvas {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  min-height: 220px;
  cursor: crosshair;
  touch-action: none;
}

.controls {
  width: 100%;
  display: flex;
  gap: 10px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}

.control-field {
  min-width: 150px;
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 2px solid var(--stage-edge);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
  background: transparent;
  font-size: 0.86rem;
  font-weight: 850;
}

.control-field span {
  color: var(--muted);
  font-size: 0.76rem;
  text-transform: uppercase;
}

.select {
  min-width: 78px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 850;
  cursor: pointer;
}

.select:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.button {
  min-width: 128px;
  min-height: 48px;
  border: 2px solid transparent;
  border-radius: 8px;
  padding: 0 18px;
  font: inherit;
  font-size: 1rem;
  font-weight: 850;
  letter-spacing: 0;
  cursor: pointer;
  transition:
    transform 120ms ease,
    background-color 120ms ease,
    border-color 120ms ease,
    color 120ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button:active {
  transform: translateY(0);
}

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

.button:disabled {
  cursor: wait;
  opacity: 0.64;
  transform: none;
}

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

.primary:hover:not(:disabled) {
  background: var(--accent-dark);
}

.secondary {
  background: transparent;
  border-color: var(--stage-edge);
  color: var(--ink);
}

.secondary:hover:not(:disabled) {
  background: #dde6df;
}

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

@media (max-width: 680px) {
  .app-shell {
    width: calc(100% - 20px);
    padding: 16px 0;
    gap: 12px;
  }

  .stage-wrap {
    max-width: calc((100svh - 245px) * 16 / 9);
  }

  .game-header {
    align-items: stretch;
    flex-direction: column;
  }

  h1 {
    font-size: 1.9rem;
  }

  .score-strip {
    width: 100%;
    justify-content: stretch;
  }

  .score-block {
    flex: 1 1 145px;
    min-width: 0;
  }

  .score-block strong {
    font-size: 1.22rem;
  }

  #gameCanvas {
    min-height: 190px;
  }

  .controls {
    justify-content: stretch;
  }

  .control-field {
    flex: 1 1 100%;
    justify-content: space-between;
  }

  .button {
    flex: 1 1 136px;
  }
}

@media (max-width: 520px) {
  .app-shell {
    margin-left: 10px;
    margin-right: 10px;
    max-width: 370px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .button {
    transition: none;
  }

  .button:hover {
    transform: none;
  }
}
