:root {
  --bg-0: #061622;
  --bg-1: #0f2f3f;
  --panel: rgba(5, 22, 34, 0.88);
  --panel-border: rgba(151, 220, 255, 0.23);
  --ink: #eef7ff;
  --ink-muted: #9dc7df;
  --accent: #ffc857;
  --accent-soft: #ffd98f;
  --danger: #ff6b6b;
  --yellow-team: #ffd400;
  --red-team: #ff5a52;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: radial-gradient(circle at 12% 8%, #1e4f63 0, transparent 34%),
    radial-gradient(circle at 88% 20%, #173447 0, transparent 28%),
    linear-gradient(155deg, var(--bg-0), var(--bg-1));
  color: var(--ink);
  font-family: "Space Grotesk", sans-serif;
}

.bg-layer {
  position: fixed;
  inset: 0;
  background-image: linear-gradient(transparent 96%, rgba(255, 255, 255, 0.045) 100%),
    linear-gradient(90deg, transparent 96%, rgba(255, 255, 255, 0.032) 100%);
  background-size: 28px 28px;
  pointer-events: none;
  opacity: 0.8;
}

.app-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(310px, 360px) 1fr;
  gap: 18px;
  padding: 18px;
  min-height: 100vh;
}

.control-panel {
  backdrop-filter: blur(8px);
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  padding: 16px;
  display: grid;
  align-content: start;
  gap: 12px;
}

.title-block h1 {
  margin: 0;
  font-family: "Bebas Neue", sans-serif;
  letter-spacing: 0.04em;
  font-size: 2.4rem;
  line-height: 0.95;
}

.eyebrow {
  margin: 0 0 6px 0;
  color: var(--accent-soft);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.78rem;
}

.card {
  background: rgba(7, 29, 43, 0.88);
  border: 1px solid rgba(149, 198, 228, 0.2);
  border-radius: 14px;
  padding: 12px;
}

.card h2 {
  margin: 0 0 10px 0;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-muted);
}

.card p {
  margin: 4px 0;
  font-size: 0.93rem;
}

label,
select,
input,
button {
  font-family: inherit;
}

label {
  display: block;
  margin-top: 8px;
  margin-bottom: 6px;
  font-size: 0.85rem;
  color: var(--ink-muted);
}

input[type="range"],
select,
input[type="number"] {
  width: 100%;
  margin-bottom: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
  border: 1px solid rgba(145, 198, 231, 0.25);
  border-radius: 8px;
  padding: 8px;
}

input[type="range"] {
  padding: 0;
}

button {
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 10px 11px;
  font-weight: 700;
}

.button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 6px;
}

button.action {
  background: linear-gradient(135deg, #f9b233, var(--accent));
  color: #102133;
}

button.alt {
  background: linear-gradient(135deg, #8fd4ff, #4daee7);
  color: #082234;
}

button.full {
  width: 100%;
  margin-top: 6px;
}

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

#scoreboard {
  overflow-x: auto;
}

.score-row {
  display: grid;
  grid-template-columns: 52px repeat(10, minmax(24px, 1fr)) 48px;
  gap: 4px;
  margin-bottom: 5px;
}

.score-cell {
  text-align: center;
  padding: 4px 3px;
  border-radius: 7px;
  font-size: 0.74rem;
  background: rgba(255, 255, 255, 0.06);
}

.score-cell.team-red {
  color: var(--red-team);
  font-weight: 700;
  text-shadow: 0 0 8px rgba(255, 99, 90, 0.45);
}

.score-cell.team-yellow {
  color: var(--yellow-team);
  font-weight: 700;
  text-shadow: 0 0 8px rgba(255, 212, 0, 0.45);
}

.help-copy h3 {
  margin: 2px 0 6px;
  font-size: 0.9rem;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.help-copy p {
  margin: 3px 0;
  font-size: 0.8rem;
  color: var(--ink-muted);
}

.stats-card p {
  margin-top: 0;
  margin-bottom: 10px;
  font-size: 0.84rem;
  color: var(--ink-muted);
}

.shot-history {
  max-height: 145px;
  overflow-y: auto;
  display: grid;
  gap: 4px;
  padding-right: 2px;
}

.shot-entry {
  font-size: 0.75rem;
  color: #d7ecfb;
  border: 1px solid rgba(166, 211, 238, 0.16);
  border-radius: 8px;
  padding: 5px 7px;
  background: rgba(255, 255, 255, 0.03);
}

.sheet-wrap {
  display: grid;
  place-items: center;
  min-width: 0;
}

#sheetCanvas {
  width: auto;
  height: auto;
  max-width: min(100%, 980px);
  max-height: calc(100vh - 36px);
  border-radius: 18px;
  border: 1px solid rgba(173, 229, 255, 0.35);
  background: #d8effa;
  box-shadow: 0 24px 46px rgba(0, 0, 0, 0.28);
  touch-action: none;
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .control-panel {
    order: 2;
  }

  .sheet-wrap {
    order: 1;
  }

  #sheetCanvas {
    max-height: 62vh;
  }
}
