:root {
  --pitch: #1f4d36;
  --pitch-dark: #163b29;
  --line: #eef0e4;
  --chalk: #f6f4ec;
  --ink: #10231a;
  --ink-soft: #3d5347;
  --amber: #e8a33d;
  --steel: #2c4a5e;
  --steel-light: #3f6580;
  --danger: #b3452f;
  --radius: 10px;
  --font-display: "Space Grotesk", "Inter", sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--chalk);
  color: var(--ink);
  font-family: var(--font-body);
}

h1, h2 { font-family: var(--font-display); margin: 0; }

button {
  font-family: var(--font-body);
  cursor: pointer;
}

/* ---------- Topbar ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 14px 24px;
  background: var(--steel);
  color: var(--chalk);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--amber);
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
}

.brand h1 {
  font-size: 19px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.play-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.play-select, .play-name {
  border: 1px solid rgba(246,244,236,0.35);
  background: rgba(246,244,236,0.08);
  color: var(--chalk);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 14px;
}

.play-name { width: 180px; }

.play-select option { color: var(--ink); }

.btn {
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 600;
  transition: transform 0.08s ease, filter 0.15s ease;
}

.btn:active { transform: translateY(1px); }

.btn-primary { background: var(--amber); color: var(--ink); }
.btn-primary:hover { filter: brightness(1.06); }

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid rgba(16,35,26,0.25);
}
.topbar .btn-ghost {
  color: var(--chalk);
  border-color: rgba(246,244,236,0.4);
}
.btn-ghost:hover { background: rgba(16,35,26,0.06); }
.topbar .btn-ghost:hover { background: rgba(246,244,236,0.12); }

.btn-danger { background: transparent; color: #ffd9cc; border: 1px solid rgba(255,217,204,0.4); }
.btn-danger:hover { background: rgba(179,69,47,0.35); }

.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.save-status {
  font-size: 12px;
  opacity: 0.75;
  min-width: 70px;
}

/* ---------- Layout ---------- */

html, body { height: 100%; }

.columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  padding: 20px;
  align-items: stretch;
  height: calc(100vh - 66px); /* fills below the topbar */
  min-height: 560px;
}

@media (max-width: 980px) {
  .columns { grid-template-columns: 1fr; height: auto; }
}

.col {
  background: white;
  border-radius: var(--radius);
  border: 1px solid rgba(16,35,26,0.09);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0; /* allow flex children to shrink/grow inside fixed-height column */
}

.col-head h2 {
  font-size: 16px;
  font-weight: 600;
}

.col-sub {
  margin: 3px 0 0;
  font-size: 12.5px;
  color: var(--ink-soft);
}

.pitch-wrap {
  background: var(--pitch);
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--pitch-dark);
  flex: 1;
  min-height: 0;
}

.pitch { display: block; width: 100%; height: 100%; touch-action: none; }

/* ---------- Viewer column + tabs ---------- */

.col-head-tabs {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.view-tabs {
  display: flex;
  gap: 6px;
  background: rgba(16,35,26,0.06);
  border-radius: 9px;
  padding: 4px;
}

.tab-btn {
  border: none;
  background: transparent;
  color: var(--ink-soft);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 13.5px;
  padding: 7px 14px;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.tab-btn:hover { color: var(--ink); }

.tab-btn.tab-active {
  background: white;
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(16,35,26,0.15);
}

.viewer-pane {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
  min-height: 0;
}

.viewer-sub { text-align: center; }

/* ---------- Transport / step nav ---------- */

.transport, .step-nav, .step-actions, .toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.btn-round {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--steel);
  color: var(--chalk);
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.btn-round:hover { background: var(--steel-light); }

.scrubber { flex: 1; min-width: 60px; }

.speed { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-soft); }
.speed input { width: 70px; }

.step-nav { justify-content: space-between; }

.step-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  flex: 1;
}

.step-label-input {
  border: none;
  background: transparent;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  text-align: center;
  color: var(--ink);
  width: 100%;
  max-width: 180px;
}
.step-label-input:focus { outline: 1px solid var(--amber); border-radius: 4px; }

.step-count { font-size: 11.5px; color: var(--ink-soft); }

.toolbar { row-gap: 8px; }

.numbers-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--ink-soft);
  margin-left: auto;
}

.hint {
  margin: 0;
  font-size: 12px;
  color: var(--ink-soft);
}

/* toolbar toggle state */
.btn-active {
  background: var(--amber);
  color: var(--ink);
  border-color: var(--amber);
}

/* ---------- SVG pitch elements (classes used from app.js) ---------- */

.pitch-line { stroke: var(--line); stroke-width: 2; opacity: 0.85; }
.pitch-line-dashed { stroke: var(--line); stroke-width: 2; stroke-dasharray: 9 8; opacity: 0.85; }
.pitch-label { fill: var(--line); font-family: var(--font-body); font-size: 13px; opacity: 0.8; }

.player-dot {
  fill: var(--chalk);
  stroke: var(--ink);
  stroke-width: 2;
  cursor: grab;
}
.player-dot.selected { stroke: var(--amber); stroke-width: 3; }
.player-num {
  fill: var(--ink);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 13px;
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
}

.spin-ring {
  fill: none;
  stroke: var(--amber);
  stroke-width: 2.5;
  stroke-dasharray: 4 5;
}

.throw-arrow {
  stroke: var(--amber);
  stroke-width: 2.5;
  fill: none;
  marker-end: url(#arrowhead);
}
