@font-face { font-family: "Barlow Condensed"; font-weight: 600; font-display: swap; src: url(fonts/barlow-condensed-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 700; font-display: swap; src: url(fonts/barlow-condensed-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 400; font-display: swap; src: url(fonts/barlow-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 500; font-display: swap; src: url(fonts/barlow-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 600; font-display: swap; src: url(fonts/barlow-latin-600-normal.woff2) format("woff2"); }

:root {
  --court: #155e46;
  --court-deep: #0f4a37;
  --line: #ffffff;
  --ink: #0f2a21;
  --paper: #edf1ec;
  --tape: #f0be2e;
  --miss: #c8553d;
  --muted: #4c6359;
  --display: "Barlow Condensed", "Arial Narrow", sans-serif;
  --body: "Barlow", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; animation: none !important; } }
body { margin: 0; font-family: var(--body); font-size: 1.0625rem; line-height: 1.5; color: var(--ink); background: var(--paper); }
.wrap { max-width: 68rem; margin: 0 auto; padding: 0 1.25rem; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 1rem; top: 1rem; background: var(--tape); color: var(--ink); padding: .5rem 1rem; z-index: 10; }
:focus-visible { outline: 3px solid var(--tape); outline-offset: 2px; }

h1, h2, h3 { font-family: var(--display); font-weight: 700; line-height: 1.05; margin: 0 0 .5rem; letter-spacing: -0.01em; }
h1 { font-size: clamp(2.6rem, 6vw, 4.5rem); }
h2 { font-size: clamp(2rem, 4vw, 3rem); }
h3 { font-size: 1.5rem; margin-top: 1.5rem; }
p { max-width: 42rem; }

/* Header */
.top { background: var(--court-deep); color: var(--line); }
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-top: .9rem; padding-bottom: .9rem; flex-wrap: wrap; }
.wordmark { font-family: var(--display); font-weight: 700; font-size: 1.6rem; margin: 0; letter-spacing: .01em; }
.top nav { display: flex; gap: 1.25rem; flex-wrap: wrap; }
.top nav a { color: var(--line); text-decoration: none; font-weight: 500; border-bottom: 2px solid transparent; }
.top nav a:hover { border-bottom-color: var(--tape); }

/* Court section: the court lines are the one decorative device */
.court {
  background:
    linear-gradient(var(--line), var(--line)) left 1.25rem top 0 / 2px 100% no-repeat,
    linear-gradient(var(--line), var(--line)) right 1.25rem top 0 / 2px 100% no-repeat,
    var(--court);
  color: var(--line);
  padding: 3rem 0 3.5rem;
}
.court .wrap { position: relative; }
.lede { font-size: 1.2rem; margin: 0 0 2rem; opacity: .92; }
.lede.dark { opacity: 1; color: var(--ink); }

.rally-builder { display: grid; grid-template-columns: 1fr 1fr 1.1fr; gap: 0; border: 2px solid var(--line); }
.shot { margin: 0; border: 0; border-right: 2px solid var(--line); padding: 1.25rem; min-width: 0; }
.shot legend { font-family: var(--display); font-weight: 700; font-size: 1.9rem; padding: 0; float: left; width: 100%; margin-bottom: .75rem; }
.shot label { display: block; font-size: .95rem; margin-bottom: .75rem; clear: both; }
.shot select { display: block; width: 100%; margin-top: .25rem; font: inherit; font-size: 1.05rem; color: var(--ink); background: var(--line); border: 0; border-radius: 4px; padding: .45rem .5rem; }
.shot select[data-k="type"] { font-family: var(--display); font-weight: 600; font-size: 1.35rem; }
.toggles { display: flex; gap: 1rem; flex-wrap: wrap; }
.tog { display: inline-flex !important; align-items: center; gap: .4rem; margin: 0 !important; }
.tog input { width: 1.1rem; height: 1.1rem; accent-color: var(--tape); }

.answer { border-right: 0; background: var(--tape); color: var(--ink); display: flex; flex-direction: column; justify-content: center; }
.answer-label { font-weight: 600; margin: 0; }
.answer-type { font-family: var(--display); font-weight: 700; font-size: clamp(2.8rem, 5vw, 4.2rem); line-height: 1; margin: .35rem 0; text-transform: capitalize; }
.answer-conf { margin: 0; font-size: 1.05rem; }
.answer.flash { animation: flash .35s ease-out; }
@keyframes flash { from { filter: brightness(1.18); } to { filter: none; } }

.dist { margin-top: 2.25rem; }
.dist h2 { font-size: 1.9rem; }
.hint { opacity: .85; margin-top: 0; }
.bars { list-style: none; padding: 0; margin: 1rem 0 0; display: grid; gap: .45rem; }
.bars li { display: grid; grid-template-columns: 9.5rem 1fr 3.5rem; align-items: center; gap: .75rem; }
.bar-name { text-transform: capitalize; font-weight: 500; }
.bar-track { position: relative; height: 1.1rem; background: rgba(255,255,255,.14); }
.bar-fill { position: absolute; inset: 0 auto 0 0; background: var(--tape); transition: width .3s ease; }
.bar-base { position: absolute; top: -4px; bottom: -4px; width: 3px; background: var(--line); transition: left .3s ease; }
.bar-pct { font-family: var(--display); font-weight: 600; font-size: 1.2rem; text-align: right; }
.zones-note { font-size: .9rem; opacity: .8; margin-top: 1.5rem; }

/* Paper sections */
.paper { padding: 3.5rem 0; }
.paper + .paper { padding-top: 0; }
.replay-controls { display: flex; flex-wrap: wrap; gap: .75rem; align-items: end; margin-bottom: 1rem; }
.replay-controls label { font-weight: 500; }
.replay-controls select { display: block; font: inherit; padding: .5rem; border: 2px solid var(--ink); border-radius: 4px; background: #fff; margin-top: .25rem; min-width: 16rem; }
button { font: inherit; font-weight: 600; padding: .6rem 1.1rem; border-radius: 4px; border: 2px solid var(--court); background: var(--court); color: var(--line); cursor: pointer; }
button.ghost { background: transparent; color: var(--court); }
button:disabled { opacity: .45; cursor: not-allowed; }
.tally { font-family: var(--display); font-weight: 600; font-size: 1.6rem; margin: .5rem 0 1rem; min-height: 2rem; }

.strip { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr)); gap: .5rem; counter-reset: shot; }
.strip li { counter-increment: shot; background: #fff; border-left: 4px solid var(--muted); padding: .6rem .75rem; min-height: 5.5rem; }
.strip li::before { content: "Shot " counter(shot) ", player " attr(data-p); font-size: .8rem; color: var(--muted); display: block; }
.strip .actual { font-family: var(--display); font-weight: 700; font-size: 1.35rem; text-transform: capitalize; display: block; line-height: 1.1; margin: .15rem 0; }
.strip .guess { font-size: .9rem; display: block; }
.strip li.hit { border-left-color: var(--court); }
.strip li.hit .guess { color: var(--court); font-weight: 600; }
.strip li.miss { border-left-color: var(--miss); }
.strip li.miss .guess { color: var(--miss); }
.strip li.given { border-left-color: var(--ink); background: #dfe6e0; }
.strip li.new { animation: flash .35s ease-out; }

/* Results */
.scores { width: 100%; max-width: 46rem; border-collapse: collapse; margin: 1rem 0 2rem; background: #fff; }
.scores caption { text-align: left; caption-side: bottom; font-size: .9rem; color: var(--muted); padding-top: .5rem; }
.scores th, .scores td { padding: .65rem .9rem; text-align: right; border-bottom: 1px solid #d3dbd5; }
.scores th:first-child, .scores td:first-child { text-align: left; }
.scores thead th { font-family: var(--display); font-size: 1.15rem; border-bottom: 2px solid var(--ink); }
.scores td { font-variant-numeric: tabular-nums; }
.scores tr.ours td { font-weight: 600; background: #fdf3d6; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 2.5rem; }
.recall { list-style: none; padding: 0; margin: 0; display: grid; gap: .4rem; }
.recall li { display: grid; grid-template-columns: 8.5rem 1fr 3rem; gap: .6rem; align-items: center; font-size: .95rem; }
.recall .rn { text-transform: capitalize; }
.recall .rt { height: .8rem; background: #d3dbd5; position: relative; }
.recall .rf { position: absolute; inset: 0 auto 0 0; background: var(--court); }
.recall .rp { text-align: right; font-variant-numeric: tabular-nums; }
.limits { padding-left: 1.1rem; }
.limits li { margin-bottom: .4rem; }

.foot { background: var(--ink); color: #c9d4ce; padding: 2rem 0; font-size: .9rem; }

@media (max-width: 52rem) {
  .rally-builder { grid-template-columns: 1fr; }
  .shot { border-right: 0; border-bottom: 2px solid var(--line); }
  .answer { border-bottom: 0; }
  .two-col { grid-template-columns: 1fr; gap: 0; }
  .bars li { grid-template-columns: 7rem 1fr 3rem; }
  .court { background: var(--court); }
}
