/* Barefoot Trick-Run Builder */

* { box-sizing: border-box; }

:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --ink: #1c2733;
  --muted: #5b6b7b;
  --line: #d8dfe6;
  --accent: #0b67a4;
  --ok: #1a7f37;
  --warn-bg: #fff5e0;
  --warn-ink: #8a5a00;
  --bad-bg: #fdeaea;
  --bad-ink: #9b1c1c;
  --info-bg: #e8f0fd;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.45;
}

header {
  background: #12314a;
  color: #fff;
  padding: 14px 22px;
}
header h1 { margin: 0; font-size: 20px; }
.tagline { margin: 2px 0 0; color: #b9cbdc; font-size: 12.5px; }

main {
  display: flex;
  gap: 18px;
  padding: 18px;
  align-items: flex-start;
  max-width: 1400px;
  margin: 0 auto;
}

.passes { flex: 1 1 auto; display: flex; flex-direction: column; gap: 18px; min-width: 0; }

.pass-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px 16px;
}
.pass-panel h2 { margin: 0 0 10px; font-size: 16px; }
.pass-note { font-weight: 400; font-size: 12px; color: var(--muted); }

/* ---- Start box ---- */
.start-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 0 0 12px;
  padding: 10px 12px;
  background: #f0f6fb;
}
.start-box legend { font-weight: 600; font-size: 12.5px; padding: 0 6px; }
.start-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.start-row label { font-size: 12.5px; color: var(--muted); display: flex; gap: 5px; align-items: center; }
.start-points { margin-left: auto; font-weight: 700; color: var(--accent); white-space: nowrap; }

/* ---- Trick rows ---- */
.trick-list { display: flex; flex-direction: column; gap: 8px; }

.trick-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fbfcfd;
}
.trick-row.zeroed { background: var(--bad-bg); border-color: #eec7c7; }
.trick-row.downgraded { background: var(--warn-bg); border-color: #ecd9a8; }
.trick-row.reverse { background: #eefaf0; border-color: #bfe3c8; }

.trick-main { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.trick-main select, .start-row select {
  font: inherit; font-size: 13px;
  padding: 4px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  max-width: 300px;
}
.trick-main label.opt {
  font-size: 12px; color: var(--muted);
  display: inline-flex; align-items: center; gap: 4px;
}

.row-points {
  margin-left: auto;
  font-weight: 700;
  min-width: 64px;
  text-align: right;
  white-space: nowrap;
}
.row-points .struck { text-decoration: line-through; color: var(--muted); font-weight: 400; margin-right: 6px; }
.zeroed .row-points { color: var(--bad-ink); }
.reverse .row-points, .trick-row:not(.zeroed):not(.downgraded) .row-points { color: var(--ok); }
.downgraded .row-points { color: var(--warn-ink); }

.row-controls { display: inline-flex; gap: 2px; }
.row-controls button {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 5px;
  cursor: pointer;
  font-size: 12px;
  padding: 2px 7px;
  color: var(--muted);
}
.row-controls button:hover { background: #eef3f7; color: var(--ink); }
.row-controls button.del:hover { background: var(--bad-bg); color: var(--bad-ink); }

.row-flags { margin: 6px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 3px; }
.row-flags li {
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 5px;
  background: var(--warn-bg);
  color: var(--warn-ink);
}
.row-flags li.severe { background: var(--bad-bg); color: var(--bad-ink); }
.row-flags li.good { background: #eefaf0; color: var(--ok); }
.row-flags li.info { background: var(--info-bg); color: #1c449b; }
.row-flags .cite { opacity: 0.75; font-size: 11px; margin-left: 6px; }

/* action buttons share one shape; blue = additive, red = destructive */
.add-trick, .clear-pass {
  margin-top: 10px;
  font: inherit; font-size: 13px;
  padding: 6px 16px;
  background: #fff;
  border-radius: 7px;
  cursor: pointer;
}
.add-trick { border: 1px solid var(--accent); color: var(--accent); }
.add-trick:hover { background: #eaf4fb; }
.clear-pass { border: 1px solid #e3b4b4; color: var(--bad-ink); margin-left: 8px; }
.clear-pass:hover { background: var(--bad-bg); }

.pass-subtotal { margin-top: 10px; text-align: right; font-weight: 700; font-size: 14px; }

/* ---- Summary ---- */
.summary {
  flex: 0 0 280px;
  position: sticky;
  top: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
}
.summary h2 { margin: 0 0 8px; font-size: 16px; }

.totals { width: 100%; border-collapse: collapse; }
.totals td { padding: 5px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.totals td:last-child { text-align: right; font-weight: 600; }
.totals tr.grand td { border-bottom: none; font-size: 17px; font-weight: 800; color: var(--accent); padding-top: 9px; }

.caps-meter { margin-top: 10px; display: flex; flex-direction: column; gap: 4px; }
.caps-meter .cap { font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; }
.caps-meter .cap.full { color: var(--bad-ink); font-weight: 600; }

#clear-run {
  margin-top: 12px;
  width: 100%;
  font: inherit; font-size: 13px;
  padding: 7px 0;
  border: 1px solid #e3b4b4;
  color: var(--bad-ink);
  background: #fff;
  border-radius: 7px;
  cursor: pointer;
}
#clear-run:hover { background: var(--bad-bg); }

.rules-notes { margin-top: 14px; font-size: 12.5px; }
.rules-notes summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.notes-body p { margin: 8px 0; color: var(--muted); }

@media (max-width: 900px) {
  main { flex-direction: column; }
  .summary { position: static; flex: none; width: 100%; }
}
