/* The Painted Court: maple floor, painted zones and lines. Fonts live in /fonts.css. */
:root {
  color-scheme: light;
  --maple: #e2ad6a;
  --zone: #fcfcfa;
  --ink: #13203f;
  --ink-2: #3a4560;
  --muted: #5c6680;
  --grid: #e4e6ec;
  --axis: #b9bfcc;
  --edge: #8f98ad;
  --blue: #1f43b8;
  --red: #d63a2f;
  --gold: #e0a300;
  --ochre: #9a6a00;
  --green: #187a44;
  --s1: var(--blue);
  --s2: var(--red);
  --s3: var(--gold);
  --good: var(--green);
  --warn: var(--ochre);
  --bad: var(--red);
  --error: #b3261e;
  --display: 'Fira Sans Extra Condensed', 'Fira Sans', system-ui, sans-serif;
  --text: 'Fira Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --line: rgba(255, 255, 255, 0.92);
  --clock: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Ccircle cx='10' cy='10' r='7.5' fill='none' stroke='%2313203f' stroke-width='2.2'/%3E%3Cpath d='M10 6v4.4l2.8 1.8' fill='none' stroke='%2313203f' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --calendar: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Crect x='3' y='4.5' width='14' height='12.5' rx='1.5' fill='none' stroke='white' stroke-width='2.2'/%3E%3Cpath d='M3 8.5h14M7 2.5v4M13 2.5v4' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round'/%3E%3C/svg%3E");
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18'%3E%3Cpath d='M7 4l5 5-5 5' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  color: var(--ink);
  font: 400 16px/1.45 var(--text);
  background-color: var(--maple);
  background-image: radial-gradient(120% 70% at 50% -10%, rgba(255, 246, 228, 0.32), transparent 62%), url('/floor.svg');
  background-size: 100% 1100px, 264px 1440px;
  background-repeat: no-repeat, repeat;
}

main { position: relative; min-height: 100vh; max-width: 760px; margin: 0 auto; padding: 0 16px 40px; }
main.narrow { max-width: 480px; }
/* Sidelines: on wide screens the column is a court painted on the floor */
@media (min-width: 840px) {
  main::before, main::after { content: ''; position: absolute; top: 0; bottom: 0; width: 4px; background: var(--line); }
  main::before { left: -28px; }
  main::after { right: -28px; }
}

::selection { background: rgba(224, 163, 0, 0.45); color: var(--ink); }
input, textarea { caret-color: var(--blue); }
a { color: inherit; text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.error { color: var(--error); }

h2 { margin: 0 0 12px; font: 700 19px/1.15 var(--display); text-transform: uppercase; letter-spacing: 0.02em; }

/* The key: a court-blue zone with the centre circle and half-court line */
.key { position: relative; overflow: hidden; margin: 0 -16px 14px; padding: 24px 20px 0; color: #fff; background: var(--blue); }
.key.solo { padding-bottom: 22px; }
.key::before { content: ''; position: absolute; top: 0; bottom: 0; right: 44px; width: 4px; background: rgba(255, 255, 255, 0.92); }
.key::after { content: ''; position: absolute; top: -96px; right: -50px; width: 192px; height: 192px; border: 4px solid rgba(255, 255, 255, 0.92); border-radius: 50%; }
.key > * { position: relative; z-index: 1; }
.key :focus-visible { outline-color: #fff; }
.key h1 { margin: 0 0 12px; padding-right: 150px; font: 900 34px/1 var(--display); text-transform: uppercase; letter-spacing: 0.01em; overflow-wrap: break-word; text-wrap: balance; }
.key.solo h1 { margin: 0; }
@media (min-width: 520px) { .key { margin: 16px 0 14px; border-radius: 2px; } }
@media (max-width: 380px) {
  .key::after { top: -72px; right: -42px; width: 144px; height: 144px; }
  .key::before { right: 28px; }
  .key h1 { padding-right: 108px; font-size: 30px; }
}

.key-date { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin: 0 0 16px; }
.key-date[hidden] { display: none; }
.key .key-date input {
  display: inline-block;
  width: auto;
  min-height: 0;
  margin: 0;
  padding: 0 0 2px;
  color: #fff;
  background: transparent;
  border: 0;
  border-bottom: 3px solid rgba(255, 255, 255, 0.6);
  border-radius: 0;
  font: 900 46px/1 var(--display);
  font-variant-numeric: tabular-nums;
  caret-color: #fff;
}
.key .key-date input::-webkit-calendar-picker-indicator { width: 26px; height: 26px; color: transparent; background: var(--calendar) center / 26px no-repeat; opacity: 1; cursor: pointer; }
input[type=time]::-webkit-calendar-picker-indicator { width: 20px; height: 20px; color: transparent; background: var(--clock) center / 20px no-repeat; opacity: 1; cursor: pointer; }
#weekday { flex-basis: 100%; font: 700 22px/1 var(--display); text-transform: uppercase; letter-spacing: 0.03em; color: rgba(255, 255, 255, 0.9); }

.views { display: grid; grid-template-columns: 1fr 1fr; margin: 0 -20px; background: var(--blue); border-top: 1px solid rgba(255, 255, 255, 0.28); }
.views[hidden] { display: none; }
.views a {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  font: 700 18px/1 var(--display);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-decoration: none;
  color: rgba(255, 255, 255, 0.78);
}
.views a:hover { color: #fff; }
.views a[aria-current=page] { color: #fff; box-shadow: inset 0 -6px 0 #fff; }

/* White painted zones on the floor */
/* Each zone is painted flush on the floor inside a square court line. Neighbouring
   zones sit exactly 15px apart, so their lines merge into one shared line and the
   zones stack into a single court of boxes. */
.card { position: relative; margin: 10px 0 15px; padding: 18px 16px; background: var(--zone); border-radius: 2px; }
.card::before { content: ''; position: absolute; inset: -9px; border: 3px solid var(--line); pointer-events: none; }

label.field { display: block; font: 600 14px/1.3 var(--text); color: var(--ink-2); }
.field + .field { margin-top: 14px; }

input:not([type=radio]), textarea {
  display: block;
  width: 100%;
  min-height: 50px;
  margin-top: 6px;
  padding: 10px 12px;
  font: 600 18px/1.2 var(--text);
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  background: #fff;
  border: 2px solid var(--edge);
  border-radius: 2px;
}
input:not([type=radio]):hover, textarea:hover { border-color: var(--ink-2); }
textarea { min-height: 104px; resize: vertical; font-weight: 400; line-height: 1.45; }
input::placeholder { color: #6b7389; font-weight: 400; }

button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 44px;
  padding: 8px 16px;
  font: 700 17px/1 var(--display);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  text-decoration: none;
  color: var(--ink);
  background: var(--zone);
  border: 2px solid var(--ink);
  border-radius: 2px;
  cursor: pointer;
}
button:hover, .btn:hover { background: #fff; box-shadow: inset 0 -3px 0 var(--ink); }
button.primary, .btn.primary { color: #fff; background: var(--blue); border-color: var(--blue); }
button.primary:hover, .btn.primary:hover { box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.28); }
button.save { width: 100%; min-height: 56px; font-size: 22px; letter-spacing: 0.06em; color: #fff; background: var(--red); border-color: var(--red); }
button:disabled { opacity: 0.45; cursor: default; box-shadow: none; }

.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pair .field + .field { margin-top: 0; }
.computed { margin: 12px 0 0; font: 600 15px/1.3 var(--text); color: var(--ink-2); }

/* Good / Normal / Poor: a choice is a solid painted fill */
fieldset { margin: 0; padding: 0; border: 0; }
fieldset + fieldset { margin-top: 18px; }
legend { margin-bottom: 8px; padding: 0; font: 700 19px/1.2 var(--display); letter-spacing: 0.01em; color: var(--ink); }
.options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.options label { position: relative; display: flex; }
.options input { position: absolute; inset: 0; margin: 0; opacity: 0; }
.options span {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 54px;
  padding: 6px 4px;
  font: 700 16px/1.1 var(--display);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--ink);
  background: #fff;
  border: 2px solid var(--edge);
  border-radius: 2px;
  cursor: pointer;
}
.options label:hover span { border-color: var(--ink); }
.options input[value="3"]:checked + span { color: #fff; background: var(--green); border-color: var(--green); }
.options input[value="2"]:checked + span { color: #fff; background: var(--ochre); border-color: var(--ochre); }
.options input[value="1"]:checked + span { color: #fff; background: var(--red); border-color: var(--red); }
.options input:focus-visible + span { outline: 3px solid var(--ink); outline-offset: 2px; }

/* Save baseline under the thumb */
.baseline {
  position: sticky;
  bottom: 0;
  z-index: 5;
  margin: 16px -16px 0;
  padding: 10px 16px calc(12px + env(safe-area-inset-bottom));
  background: var(--zone);
  box-shadow: 0 -10px 24px -18px rgba(60, 32, 8, 0.7);
}
@media (min-width: 520px) { .baseline { margin: 16px 0 0; border-radius: 2px; } }
.status { margin: 0 0 8px; font: 600 15px/1.35 var(--text); text-align: center; }
.status:empty { display: none; }
.after-save { margin: 0 0 8px; font: 600 15px/1.35 var(--text); text-align: center; }
#login .status { margin-top: 12px; }

/* Period controls */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 4px 0 12px; }
.tabs { display: flex; }
.tabs button { border-radius: 0; }
.tabs button:first-child { border-radius: 2px 0 0 2px; }
.tabs button:last-child { margin-left: -2px; border-radius: 0 2px 2px 0; }
.tabs button[aria-pressed=true] { position: relative; color: #fff; background: var(--blue); border-color: var(--blue); }
.nav { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.nav button { width: 44px; padding: 0; }
.nav button svg { display: block; }
.nav strong { padding: 0 6px; font: 700 18px/1.1 var(--display); text-align: center; text-transform: uppercase; letter-spacing: 0.02em; }
@media (max-width: 519px) {
  .toolbar .tabs, .toolbar .nav { flex: 1 1 100%; margin-left: 0; }
  .toolbar .tabs button { flex: 1; }
  .toolbar .nav strong { flex: 1; }
}
#summary-view { transition: opacity 120ms; }
#summary-view.loading { opacity: 0.55; pointer-events: none; }

/* Ledgers: progress and day detail */
.note { font-size: 15px; color: var(--muted); }
.progress .note, .figure-card .note { margin: -6px 0 8px; }
.card > .note + .btn { margin-top: 2px; }
.ledger { margin: 0; }
.ledger > div { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 10px 0; border-top: 1px solid var(--grid); }
.ledger > div:first-child { border-top: 0; }
.ledger dt { font: 600 15px/1.3 var(--text); color: var(--ink-2); }
.ledger dd { margin: 0; font: 600 16px/1.25 var(--text); font-variant-numeric: tabular-nums; text-align: right; }
.ledger dd strong { font: 700 25px/1.05 var(--display); letter-spacing: 0.01em; }
.ledger dd span { display: block; margin-top: 2px; font: 500 14px/1.2 var(--text); color: var(--muted); }
.level { display: inline-block; width: 6px; margin-right: 6px; border-radius: 2px 2px 0 0; }

/* The period totals as the hall's scoreboard: a dark housing with lit amber numerals */
.progress.card { color: #fff; background: #15171c; box-shadow: inset 0 0 0 4px #262a33; }
.progress h2 { color: #fff; text-align: center; letter-spacing: 0.08em; }
.progress .note { text-align: center; color: rgba(255, 255, 255, 0.72); }
.progress .ledger { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.progress .ledger > div {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 8px;
  text-align: center;
  background: #07080a;
  border: 0;
  border-radius: 2px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08), inset 0 10px 18px -10px rgba(0, 0, 0, 0.9);
}
.progress .ledger dt { font: 700 13px/1.15 var(--display); text-transform: uppercase; letter-spacing: 0.08em; color: rgba(255, 255, 255, 0.72); }
.progress .ledger dd { text-align: center; }
.progress .ledger dd strong { display: block; font: 900 30px/1 var(--display); color: #ffc21a; text-shadow: 0 0 12px rgba(255, 176, 0, 0.45); white-space: nowrap; }
.progress .ledger dd span { margin-top: 6px; color: rgba(255, 255, 255, 0.7); }
@media (max-width: 439px) { .progress .ledger dd strong { font-size: 24px; } }
@media (max-width: 359px) { .progress .ledger { grid-template-columns: 1fr; } .progress .ledger dd strong { font-size: 28px; } }

.day-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 4px; }
.day-head h2 { margin: 0; }
.day-detail h3 { margin: 16px 0 4px; font: 700 16px/1.2 var(--display); text-transform: uppercase; letter-spacing: 0.02em; color: var(--ink-2); }
.exercises { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.parts { margin-top: 12px; }
.parts-bar { display: flex; gap: 2px; height: 10px; margin-bottom: 8px; }
.parts-bar i { display: block; min-width: 2px; }
.parts-bar i:first-child { border-radius: 2px 0 0 2px; }
.parts-bar i:last-child { border-radius: 0 2px 2px 0; }
.parts-bar i:only-child { border-radius: 2px; }

/* Charts */
.chart svg { display: block; }
.chart text { font: 400 12px var(--text); fill: var(--muted); font-variant-numeric: tabular-nums; }
.chart text.row-label { font-weight: 600; fill: var(--ink); font-variant-numeric: normal; }
.chart.day-figure text.row-note { fill: var(--ink-2); }
@media (max-width: 359px) { .chart.day-figure text.row-note { font-size: 11px; } }
.day-figure svg { cursor: pointer; touch-action: pan-y; user-select: none; -webkit-user-select: none; border-radius: 2px; }
.day-band { fill: rgba(224, 163, 0, 0.26); }
.day-figure .mark { opacity: 0.82; transition: opacity 160ms ease-out; }
.day-figure .mark.on { opacity: 1; }
.day-band, .day-pill { transition: transform 180ms cubic-bezier(0.16, 1, 0.3, 1); }
.day-pill rect { fill: var(--ink); }
.chart .day-pill text { fill: #fff; font-weight: 600; }
.chart text.future { opacity: 0.5; }

.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0 0 10px; padding: 0; list-style: none; font-size: 14px; color: var(--ink-2); }
.legend li { display: flex; align-items: flex-end; gap: 6px; }
.legend i { display: block; width: 12px; height: 12px; border-radius: 2px; }
.parts .legend { margin: 0; }
.counts { margin: 12px 0 0; padding: 0; list-style: none; font-size: 14px; color: var(--ink-2); }
.counts li { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 0 12px; padding: 4px 0; }
.counts b { font-weight: 600; color: var(--ink); }

/* Coach list */
.row { display: flex; gap: 8px; }
.row input { flex: 1; min-width: 0; margin-top: 0; }
.list { margin: 0; padding: 0; list-style: none; }
.list li + li { border-top: 1px solid var(--grid); }
.list a { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 56px; padding: 10px 0; text-decoration: none; }
.list a:hover strong { text-decoration: underline; text-decoration-thickness: 2px; }
.list strong { font: 700 20px/1.1 var(--display); text-transform: uppercase; letter-spacing: 0.01em; overflow-wrap: anywhere; }
.list span { font-size: 14px; color: var(--muted); white-space: nowrap; }
.back { display: inline-flex; align-items: center; gap: 2px; min-height: 44px; margin-top: 8px; font: 700 17px/1 var(--display); text-transform: uppercase; letter-spacing: 0.03em; text-decoration: none; }
.back:hover { text-decoration: underline; }
.back svg { display: block; }

/* Day-by-day table */
details summary { display: flex; align-items: center; gap: 6px; min-height: 44px; font: 700 18px/1.1 var(--display); text-transform: uppercase; letter-spacing: 0.02em; list-style: none; cursor: pointer; }
details summary::-webkit-details-marker { display: none; }
details summary::before { content: ''; width: 18px; height: 18px; background: currentColor; -webkit-mask: var(--chevron) center / contain no-repeat; mask: var(--chevron) center / contain no-repeat; transition: transform 180ms cubic-bezier(0.16, 1, 0.3, 1); }
details[open] summary::before { transform: rotate(90deg); }
.scroll { overflow-x: auto; margin-top: 10px; scrollbar-color: var(--axis) transparent; }
table { border-collapse: collapse; font-size: 14px; }
th, td { padding: 7px 12px 7px 0; text-align: left; vertical-align: top; white-space: nowrap; border-bottom: 1px solid var(--grid); }
th { font-weight: 600; color: var(--ink-2); }
td.num { font-variant-numeric: tabular-nums; }
td.text { min-width: 180px; white-space: pre-wrap; overflow-wrap: anywhere; }

#tip {
  position: fixed;
  z-index: 10;
  max-width: 220px;
  padding: 7px 10px;
  font: 500 13px/1.35 var(--text);
  white-space: pre-line;
  color: #fff;
  background: var(--ink);
  border-radius: 2px;
  box-shadow: 0 6px 18px -8px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  .day-band, .day-pill, .day-figure .mark, #summary-view, details summary::before { transition: none; }
}
