:root {
  --bg: #0f0f0f;
  --bg-2: #181818;
  --bg-3: #1f1f1f;
  --border: #2a2a2a;
  --text: #e8e8e8;
  --muted: #888;
  --dim: #666;
  --accent: #ff6b1a;
  --accent-dim: #b84500;
  --good: #4ade80;
  --bad: #f87171;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.mono, .stat-pct, .stat-frac, .stat-value, .hist-totals .mono {
  font-family: 'JetBrains Mono', ui-monospace, Menlo, monospace;
}

a { color: var(--accent); text-decoration: none; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(15,15,15,0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.brand {
  font-weight: 700;
  letter-spacing: 0.12em;
  font-size: 14px;
}
.tabs {
  display: flex;
  gap: 4px;
}
.tabs a {
  padding: 6px 12px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}
.tabs a.active {
  background: var(--bg-3);
  color: var(--accent);
}

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 16px 80px;
}

h1 { font-size: 28px; margin: 8px 0 16px; }
h2 { font-size: 20px; margin: 0 0 8px; }
h3 { font-size: 16px; margin: 0 0 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }

.muted { color: var(--muted); }
.dim { color: var(--dim); }

.card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin: 12px 0;
}
.card.warn { border-color: #5a3a00; background: #1a1305; }

.card-tag {
  display: inline-block;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  background: rgba(255,107,26,0.12);
  border: 1px solid rgba(255,107,26,0.3);
  padding: 2px 8px;
  border-radius: 4px;
  margin-bottom: 8px;
  font-weight: 700;
}

.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 720px) {
  .grid { grid-template-columns: 1fr 1fr 1fr; }
}

.session-card { display: flex; flex-direction: column; }
.drill-list-preview {
  margin: 8px 0 12px;
  padding-left: 18px;
  color: var(--muted);
  font-size: 14px;
}

.btn[hidden] { display: none !important; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  background: var(--bg-3);
  color: var(--text);
  padding: 10px 16px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
}
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #1a0a00; }
.btn.primary:hover { background: #ff7e36; }
.btn.ghost { background: transparent; }
.btn.small { padding: 6px 10px; font-size: 12px; }
.btn.make { background: #14361f; border-color: #1f5530; color: #4ade80; }
.btn.miss { background: #3a1414; border-color: #5a1f1f; color: #f87171; }

.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }

.session-header { margin-bottom: 16px; }

.drills { display: flex; flex-direction: column; gap: 10px; }

.drill {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
}
.drill-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
}
.drill-label { font-weight: 700; font-size: 16px; }
.drill-desc { font-size: 13px; margin-top: 2px; }
.drill-stats { text-align: right; }
.stat-pct {
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
}
.stat-frac { font-size: 12px; color: var(--muted); }
.stat-frac .makes { color: var(--good); font-weight: 700; }
.stat-frac .attempts { color: var(--text); }
.stat-frac .sep { color: var(--dim); margin: 0 2px; }
.stat-frac .target { margin-left: 6px; }

.drill-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.drill-actions .btn { flex: 1 1 calc(50% - 4px); min-width: 0; }
.drill-actions .btn.ghost.small { flex: 0 0 auto; }
.drill-actions .timer-start,
.drill-actions .timer-pause,
.drill-actions .timer-resume {
  flex: 1 1 100%;
  background: var(--accent);
  border-color: var(--accent);
  color: #1a0a00;
}
.drill-actions .timer-done { flex: 0 0 auto; }

.drill-info { min-width: 0; flex: 1; }

.drill-pl {
  margin-top: 8px;
  font-size: 13px;
}
.drill-pl summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 600;
  list-style: none;
  user-select: none;
  padding: 6px 10px;
  background: rgba(255,107,26,0.08);
  border: 1px solid rgba(255,107,26,0.20);
  border-radius: 6px;
  display: inline-block;
}
.drill-pl summary::-webkit-details-marker { display: none; }
.drill-pl summary:hover { background: rgba(255,107,26,0.14); }
.drill-pl[open] summary { margin-bottom: 8px; }
.drill-pl-body {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  white-space: pre-wrap;
  color: var(--text);
  line-height: 1.55;
  font-size: 13px;
}

.kind-tag {
  display: inline-block;
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  background: rgba(255,107,26,0.10);
  border: 1px solid rgba(255,107,26,0.25);
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 6px;
  font-weight: 600;
  vertical-align: middle;
}

.stat-time {
  font-family: 'JetBrains Mono', ui-monospace, Menlo, monospace;
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
  display: flex;
  align-items: baseline;
  gap: 6px;
  justify-content: flex-end;
}
.stat-time.done { color: var(--good); }
.stat-time .timer-total { font-size: 12px; font-weight: 500; }
.stat-time + .stat-frac,
.stat-pct + .stat-time { margin-top: 4px; }

.timer-badge {
  font-size: 12px;
  font-weight: 700;
  color: var(--good);
  background: rgba(74,222,128,0.10);
  border: 1px solid rgba(74,222,128,0.30);
  padding: 6px 10px;
  border-radius: 8px;
  align-self: center;
}

.finish-card label {
  display: block;
  margin-bottom: 12px;
}
.finish-card label > span {
  display: block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 6px;
}
.finish-card textarea {
  width: 100%;
  background: var(--bg-3);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  font-family: inherit;
  resize: vertical;
}

.knee-row { display: flex; gap: 6px; }
.knee-radio {
  flex: 1;
  display: block !important;
  cursor: pointer;
}
.knee-radio input { display: none; }
.knee-radio span {
  display: block;
  text-align: center;
  padding: 10px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
}
.knee-radio input:checked + span {
  background: var(--accent);
  color: #1a0a00;
  border-color: var(--accent);
}

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}
@media (min-width: 720px) {
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
}
.stat .stat-name {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.stat .stat-value {
  font-size: 32px;
  font-weight: 700;
  margin-top: 4px;
  color: var(--accent);
}
.stat .stat-value .unit { font-size: 16px; color: var(--muted); margin-left: 2px; }
.stat .delta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stat .delta.up { color: var(--good); }
.stat .delta.down { color: var(--bad); }

.history-item summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  list-style: none;
  gap: 12px;
}
.history-item summary::-webkit-details-marker { display: none; }
.hist-totals { display: flex; gap: 10px; align-items: center; font-size: 13px; }
.hist-detail { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.hist-detail .notes {
  background: var(--bg-3);
  padding: 10px;
  border-radius: 6px;
  font-size: 14px;
  margin: 0 0 12px;
}

.result-list {
  list-style: none;
  padding: 0;
  margin: 0 0 12px;
}
.result-list li {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  gap: 12px;
}
.result-list li:last-child { border-bottom: none; }

.schedule { list-style: none; padding: 0; margin: 0; }
.schedule li { padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.schedule li:last-child { border-bottom: none; }
.schedule strong { color: var(--accent); display: inline-block; min-width: 50px; }
