/* Coach page (controller.html): tabs, numbered steps, drill picture cards,
   the drill sheet, trigger tiles, +/− settings and the live pod map.
   Builds on style.css tokens. */
body.coach main { max-width: 980px; padding-top: 8px; }
.topbar {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  max-width: 980px; margin: 0 auto; padding: 14px 16px 6px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; letter-spacing: 0.01em; }
.tabs {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 10;
  display: flex; gap: 6px; max-width: 980px; margin: 0 auto; padding: 8px 16px;
  background: var(--bg);
}
.tabs button {
  flex: 1; background: var(--card); color: var(--muted); border: 1px solid var(--line);
  padding: 10px 12px; border-radius: 12px; font-weight: 700;
}
.tabs button[aria-selected="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
button:focus-visible, .drillcard:focus-visible, .tile:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Steps */
.step { padding: 18px; }
.stephead { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 14px; }
.stephead h2 { font-size: 22px; margin: 2px 0 2px; }
.stephead p { margin: 0; }
.stepnum {
  flex: none; width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 800; font-size: 18px;
  background: var(--accent); color: #04130a;
}
h3.sub { font-size: 14px; margin: 22px 0 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }

/* Step 1: connect */
.connect { display: grid; gap: 18px; grid-template-columns: 1fr; }
@media (min-width: 720px) { .connect { grid-template-columns: auto 1fr; align-items: start; } }
.qrbox { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.qrbox .qr { margin: 0; }
.roomline { font-size: 15px; color: var(--muted); }
.roomline .code, .roomline .pin { font: 700 18px/1 ui-monospace, Menlo, Consolas, monospace; letter-spacing: 3px; color: var(--text); }
.podside { min-width: 0; }
.howjoin { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.howjoin svg { max-width: 100%; height: auto; }
.howjoin p { flex: 1; min-width: 180px; margin: 0; }
.podshead { font-size: 15px; margin: 12px 0 8px; }
.looktiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin-bottom: 8px; }
.looktile {
  display: flex; gap: 10px; align-items: center; text-align: left; padding: 8px 10px;
  background: #0e141b; color: var(--text); border: 1px solid var(--line); border-radius: 12px; font: inherit; cursor: pointer;
}
.looktile svg { flex: none; }
.looktile b { display: block; font-size: 15px; }
.looktile .small { display: block; line-height: 1.3; }
.looktile[aria-checked="true"] { border-color: var(--accent); background: rgba(34, 197, 94, 0.08); box-shadow: inset 0 0 0 1px var(--accent); }
.looktile:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.podgrid { display: flex; flex-wrap: wrap; gap: 10px; }
/* Each connected pod is drawn as a little phone with its number (set as data-n by coach-ui.js). */
.podgrid .chip {
  width: 54px; height: 88px; padding: 0; border-radius: 12px; justify-content: center; flex-direction: column;
  background: #1b2329; border: 2px solid #3a4650; color: var(--text); font-size: 0; position: relative; gap: 0;
}
.podgrid .chip::before { content: ''; position: absolute; left: 5px; right: 5px; top: 7px; bottom: 12px; border-radius: 5px; background: #05080a; }
.podgrid .chip .dot { position: absolute; bottom: 4px; left: 50%; margin-left: -4px; width: 8px; height: 3px; border-radius: 2px; background: #3a4650; }
.podgrid .chip::after { content: attr(data-n); position: relative; font-size: 24px; font-weight: 800; color: #64748b; }
.podgrid .chip:hover::before { background: #0e1a12; }
.podgrid .chip .bad { position: absolute; top: -8px; right: -8px; font-size: 10px; background: var(--red); color: #fff; padding: 2px 5px; border-radius: 6px; }
details.more { margin-top: 14px; }
details.more > summary { cursor: pointer; color: var(--muted); font-weight: 600; }
details.more[open] > summary { margin-bottom: 12px; }

/* Step 2: drill cards */
.sportchips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 12px; scrollbar-width: none; }
.sportchips::-webkit-scrollbar { display: none; }
.pill {
  flex: none; background: #0e141b; color: var(--text); border: 1px solid var(--line);
  padding: 8px 14px; border-radius: 999px; font-weight: 600; font-size: 14px;
}
.pill[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #04130a; }
/* Drills grouped by sport: one labelled row per sport that scrolls sideways. */
.drillcards { display: grid; gap: 18px; }
.dgroup { min-width: 0; }
.dghead { font-size: 16px; margin: 0 0 8px; display: flex; gap: 8px; align-items: baseline; }
.drow {
  display: flex; gap: 10px; overflow-x: auto; padding: 2px 2px 8px; scroll-snap-type: x proximity;
  scrollbar-width: thin; -webkit-overflow-scrolling: touch;
}
.drow > .drillcard { flex: none; width: 168px; scroll-snap-align: start; }
@media (min-width: 720px) { .drow > .drillcard { width: 190px; } }
.drillcard {
  display: flex; flex-direction: column; gap: 4px; text-align: left; padding: 8px 8px 10px;
  background: #0e141b; color: var(--text); border: 2px solid var(--line); border-radius: 14px; font-weight: 400;
}
.drillcard svg { width: 100%; height: auto; border-radius: 9px; display: block; margin-bottom: 4px; }
.drillcard[aria-current="true"] { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.25); }
/* A card holds two buttons: the drill itself and its star. */
div.drillcard { position: relative; padding: 0; }
.dc-main {
  display: flex; flex-direction: column; gap: 4px; width: 100%; padding: 8px 8px 10px; text-align: left;
  background: transparent; color: var(--text); border-radius: 12px; font-weight: 400;
}
.star {
  position: absolute; top: 12px; right: 12px; width: 38px; height: 38px; padding: 0; border-radius: 50%;
  background: rgba(11, 15, 20, 0.75); color: #e8eef6; font-size: 20px; line-height: 1;
}
.star[aria-pressed="true"] { color: #facc15; }

/* Layer 1: sport tiles. Layer 2: one sport's drills. */
.sportgrid, .dgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
@media (min-width: 720px) { .sportgrid, .dgrid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; } }
.sporttile {
  display: flex; flex-direction: column; gap: 2px; padding: 6px 6px 10px; text-align: left;
  background: #0e141b; color: var(--text); border: 2px solid var(--line); border-radius: 14px; font-weight: 400;
}
.sporttile svg { width: 100%; height: auto; display: block; border-radius: 9px; margin-bottom: 6px; }
.st-name { font-weight: 800; font-size: 16px; padding: 0 4px; }
.sporttile .muted { padding: 0 4px; }
.layer2head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.layer2head .dghead { margin: 0; font-size: 20px; }
.starhint { padding: 12px; border: 1px dashed var(--line); border-radius: 12px; margin: 0; }

/* Progress overview */
.progresslist { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.pstudent {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left; padding: 12px 14px;
  background: #0e141b; color: var(--text); border: 1px solid var(--line); border-radius: 12px; font-weight: 400;
}
.pname { font-weight: 800; font-size: 17px; }
.spark { width: 100%; height: 36px; display: block; }
.badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 6px; background: var(--line); color: var(--text); }
.badge.good { background: rgba(34, 197, 94, 0.18); color: #86efac; }
.badge.bad { background: rgba(239, 68, 68, 0.18); color: #fca5a5; }
.pflag { font-size: 12px; color: #fde68a; }

/* One student's report */
.report h3 { font-size: 15px; margin: 22px 0 10px; }
.rephead { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 8px; margin: 12px 0; }
.rephead p { margin: 0; }
.repname { font-size: 28px; margin: 2px 0 0; }
.trend, .dirmap { width: 100%; height: auto; display: block; border-radius: 12px; }
.trend { background: #0e141b; border: 1px solid var(--line); }
.tablewrap { overflow-x: auto; }
.printonly { display: none; }

@media print {
  body, .card { background: #fff !important; color: #111 !important; }
  .topbar, .tabs, #panelTrain, #panelResults, .noprint, .startbar { display: none !important; }
  .card { border: 0; padding: 0; }
  .printonly { display: block; }
  .muted { color: #555 !important; }
  .stat { background: #f3f4f6; border-color: #ddd; }
  .trend { background: #fff; }
}
.dc-sport { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.dc-name { font-weight: 800; font-size: 16px; line-height: 1.15; }
.dc-trains { font-size: 13px; color: var(--muted); line-height: 1.3; }
.dc-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.dc-tags span { font-size: 11px; background: var(--line); border-radius: 6px; padding: 2px 6px; }

/* Step 3: the drill sheet */
.sheet { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 760px) { .sheet { grid-template-columns: 1.25fr 1fr; align-items: start; } }
.sheetart { min-width: 0; }
.sheetart svg { width: 100%; height: auto; display: block; border-radius: 12px; }
.sheetcap { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 8px; font: 500 14px ui-monospace, Menlo, Consolas, monospace; min-height: 34px; }
.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); padding: 6px 12px; border-radius: 10px; font-size: 14px; }
.howto { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.howto li { display: flex; gap: 12px; align-items: flex-start; background: #0e141b; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; font-size: 15px; }
.hicon { flex: none; width: 44px; height: 44px; display: grid; place-items: center; }
.tiles3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.tiles2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tile {
  display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; padding: 12px 8px;
  background: #0e141b; color: var(--text); border: 2px solid var(--line); border-radius: 14px; font-weight: 400;
}
.tile b { font-size: 16px; }
.tile[aria-checked="true"] { border-color: var(--accent); background: rgba(34, 197, 94, 0.08); }
@media (max-width: 480px) { .tile .small { display: none; } }
.steppers { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; }
.stepper { display: flex; justify-content: space-between; align-items: center; gap: 8px; background: #0e141b; border: 1px solid var(--line); border-radius: 12px; padding: 8px 8px 8px 14px; }
.slabel { font-weight: 600; }
.sctl { display: flex; align-items: center; gap: 6px; }
.sctl button { width: 40px; height: 40px; padding: 0; border-radius: 10px; background: var(--line); color: var(--text); font-size: 22px; line-height: 1; }
.sctl output { min-width: 58px; text-align: center; font-weight: 800; font-size: 18px; font-variant-numeric: tabular-nums; }
.switches { margin-top: 14px; }
.switch { display: flex; gap: 12px; align-items: center; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { flex: none; width: 50px; height: 30px; border-radius: 999px; background: var(--line); position: relative; transition: background 0.15s; }
.switch .track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform 0.15s; }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(20px); }
.switch input:focus-visible + .track { outline: 3px solid var(--accent); outline-offset: 2px; }
.studentchips { display: grid; gap: 8px; }
.chiprow { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.chiprow > .muted:empty { display: none; }
.linkbtn { background: none; color: #8ab4f8; padding: 4px 0; font-weight: 600; justify-self: start; }
.startbar {
  position: sticky; bottom: 0; z-index: 5; display: flex; gap: 10px; margin: 20px -18px -18px;
  padding: 12px 18px calc(12px + env(safe-area-inset-bottom, 0px));
  background: var(--card); border-top: 1px solid var(--line); border-radius: 0 0 16px 16px;
}
.startbar .secondary { display: inline-flex; align-items: center; gap: 6px; }
.startbtn { flex: 1; font-size: 20px; padding: 16px; }

/* Live */
.livewrap { display: grid; gap: 14px; grid-template-columns: 1fr; margin: 6px 0 12px; }
@media (min-width: 760px) { .livewrap { grid-template-columns: 1.4fr 1fr; align-items: center; } }
.livemap svg { width: 100%; height: auto; display: block; border-radius: 12px; }
.empty { text-align: center; padding: 28px 12px; }
@media (prefers-reduced-motion: reduce) { .switch .track, .switch .track::after { transition: none; } }

/* My drills cards */
.drillcard.create {
  align-items: center; justify-content: center; text-align: center; min-height: 160px; gap: 8px;
  border-style: dashed; border-color: var(--accent);
}

/* Simple settings */
.typetiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.typetiles .tile svg { display: block; }
.podpick { display: grid; gap: 8px; padding: 10px 12px; margin-bottom: 8px; background: #0e141b; border: 1px solid var(--line); border-radius: 12px; }
.podnums { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.podnum {
  width: 44px; height: 44px; padding: 0; border-radius: 10px; font-size: 17px; font-weight: 800;
  background: #1b2329; color: var(--text); border: 2px solid #3a4650;
}
.podnum[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #04130a; }
.podnum.blue[aria-pressed="true"] { background: #3b82f6; border-color: #3b82f6; color: #fff; }
.podnum.yellow[aria-pressed="true"] { background: #eab308; border-color: #eab308; color: #1c1400; }
.podpick.route b { font-size: 18px; }
.drillcard.create .plus { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: #04130a; font-size: 32px; font-weight: 800; line-height: 1; }
.drillcard.mine .dc-sport { color: var(--accent); }

/* Locked saved drill, pods needed */
.lockbox { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin-top: 16px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: #0e141b; }
.lockbox b::before { content: '🔒 '; }
.warn { margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: rgba(234, 179, 8, 0.12); border: 1px solid rgba(234, 179, 8, 0.4); color: #fde68a; font-size: 14px; }

/* Builder */
.courtgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.courtpick { display: flex; flex-direction: column; gap: 4px; padding: 5px 5px 8px; background: #0e141b; color: var(--text); border: 2px solid var(--line); border-radius: 10px; font-weight: 600; font-size: 13px; }
.courtpick svg { width: 100%; height: auto; display: block; border-radius: 6px; }
.courtpick[aria-pressed="true"] { border-color: var(--accent); }
.bcanvas svg { width: 100%; height: auto; display: block; border-radius: 12px; touch-action: none; user-select: none; -webkit-user-select: none; }
.podtools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.podtools .muted { flex-basis: 100%; }
.danger-pill { color: #fca5a5; border-color: rgba(239, 68, 68, 0.5); }
.versionask { margin-top: 16px; padding: 12px 14px; border: 1px solid rgba(234, 179, 8, 0.5); border-radius: 12px; background: rgba(234, 179, 8, 0.08); }

/* Run again on a result */
.runagain { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; }

/* Demo class bar and AI coach notes */
.demobar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; justify-content: space-between; padding: 10px 12px; margin: 0 0 12px; border: 1px dashed var(--line); border-radius: 12px; }
.demobar span { flex: 1 1 220px; color: var(--muted); }
.aicard { margin: 18px 0; padding: 14px; border-radius: 14px; border: 1px solid rgba(168, 85, 247, 0.45); background: linear-gradient(180deg, rgba(168, 85, 247, 0.10), rgba(168, 85, 247, 0.02)); }
.aicard:empty { display: none; }
.aihead { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.aihead h3 { margin: 0; }
.aihead .badge { margin-left: 6px; vertical-align: middle; background: rgba(168, 85, 247, 0.22); color: #e9d5ff; }
.aihead .row { gap: 8px; }
.ailang { background: #0e141b; color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 8px; }
.aisummary { font-size: 15px; line-height: 1.5; margin: 12px 0; }
.aicard h4 { margin: 14px 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.aicard ul { margin: 0; padding-left: 20px; line-height: 1.5; }
.aicols { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 4px 18px; }
.aicard .warn { color: #fcd34d; margin: 8px 0; }
.aicard .bad { color: #fca5a5; margin: 10px 0 0; }
.parentnote { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; background: #0e141b; border: 1px solid var(--line); }
.parentnote p { margin: 0; flex: 1; line-height: 1.5; }
@media print { .aicard { background: none; border-color: #999; } .aihead .badge, .parentnote button { display: none; } }

/* Printed performance report: only .printreport prints from the report card */
.printreport { display: none; }
@media print {
  @page { margin: 14mm; }
  #reportCard > :not(.printreport) { display: none !important; }
  #reportCard { box-shadow: none; }
  .printreport { display: block; color: #111; font-size: 12px; line-height: 1.45; }
  .printreport h1 { font-size: 26px; margin: 2px 0; }
  .printreport h3 { font-size: 15px; margin: 18px 0 6px; color: #111; }
  .printreport h4 { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: #555; margin: 8px 0 4px; }
  .pr-head { display: flex; justify-content: space-between; align-items: flex-end; border-bottom: 3px solid #16a34a; padding-bottom: 8px; }
  .pr-kicker { margin: 0; text-transform: uppercase; letter-spacing: 0.08em; font-size: 11px; color: #16a34a; font-weight: 700; }
  .pr-sub, .pr-cap { margin: 0; color: #555; font-size: 11px; }
  .pr-brand { font-weight: 800; color: #16a34a; }
  .pr-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 12px 0 4px; }
  .pr-kpis div { border: 1px solid #ddd; border-radius: 8px; padding: 8px 10px; }
  .pr-kpis b { display: block; font-size: 22px; }
  .pr-kpis span { color: #555; font-size: 11px; }
  .pr-ai { border: 1px solid #d8c7f5; background: #faf7ff; border-radius: 8px; padding: 4px 12px 10px; break-inside: avoid; }
  .pr-ai ul { margin: 0; padding-left: 18px; }
  .pr-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  .pr-note { font-style: italic; margin: 8px 0 0; }
  .pr-table { width: 100%; border-collapse: collapse; }
  .pr-table th, .pr-table td { border-bottom: 1px solid #ddd; padding: 5px 6px; text-align: left; }
  .pr-table th { font-size: 11px; color: #555; }
  .pr-table .up { color: #15803d; font-weight: 700; }
  .pr-table .down { color: #b91c1c; font-weight: 700; }
  .pr-drill { break-inside: avoid; border-top: 1px solid #eee; margin-top: 10px; }
  .pr-facts { margin: 0 0 6px; }
  .pr-pair { display: grid; grid-template-columns: 1.3fr 1fr; gap: 12px; align-items: start; }
  .pr-pair.single { grid-template-columns: 1fr; }
  .pr-pair svg { width: 100%; height: auto; }
  .pr-foot { margin-top: 16px; padding-top: 6px; border-top: 1px solid #ddd; color: #777; font-size: 10px; }
}

/* Results: ranking podium, ranked list, history cards */
.cardhead { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.cardhead h2 { margin-bottom: 8px; }
.rankfilters { display: grid; grid-template-columns: 2fr 1fr; gap: 10px; }
@media (max-width: 520px) { .rankfilters { grid-template-columns: 1fr; } }
.seg { display: flex; gap: 4px; padding: 4px; margin: 12px 0 4px; background: #0e141b; border: 1px solid var(--line); border-radius: 12px; }
.seg button { flex: 1; padding: 8px 6px; border-radius: 9px; background: transparent; color: var(--muted); border: 0; font-weight: 700; }
.seg button[aria-checked="true"] { background: var(--accent); color: #04130a; }
.avatar { flex: none; display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: #1e293b; color: #e2e8f0; font-weight: 800; font-size: 14px; border: 2px solid #334155; }
.avatar.none { color: var(--muted); background: transparent; border-style: dashed; }
.podium { display: flex; justify-content: center; align-items: flex-end; gap: 10px; margin: 18px 0 6px; }
.podium:empty { display: none; }
.podium .step { flex: 1; max-width: 180px; display: flex; flex-direction: column; align-items: center; gap: 3px; text-align: center; min-width: 0; }
.podium .medal { font-size: 26px; line-height: 1; }
.podium .avatar { width: 52px; height: 52px; font-size: 17px; }
.podium .p1 .avatar { width: 62px; height: 62px; border-color: #facc15; box-shadow: 0 0 0 4px rgba(250, 204, 21, 0.18); }
.podium .p2 .avatar { border-color: #cbd5e1; }
.podium .p3 .avatar { border-color: #d97706; }
.podium .pname { font-size: 14px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.podium .pscore { font-size: 24px; font-weight: 800; }
.podium .pscore small { font-size: 12px; color: var(--muted); font-weight: 600; }
.podium .block { width: 100%; margin-top: 6px; border-radius: 10px 10px 0 0; display: grid; place-items: center; font-weight: 800; font-size: 20px; color: rgba(255, 255, 255, 0.85); }
.podium .p1 .block { height: 74px; background: linear-gradient(#ca8a04, #854d0e); }
.podium .p2 .block { height: 52px; background: linear-gradient(#64748b, #334155); }
.podium .p3 .block { height: 38px; background: linear-gradient(#b45309, #78350f); }
.ranklist { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.ranklist:empty { display: none; }
.ranklist li { display: flex; align-items: center; gap: 10px; padding: 10px 2px; border-bottom: 1px solid var(--line); }
.ranklist .pos { width: 22px; text-align: center; font-weight: 800; color: var(--muted); }
.ranklist .who { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.ranklist .bar { height: 5px; background: #0e141b; border-radius: 3px; margin-top: 5px; overflow: hidden; }
.ranklist .bar i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.ranklist .score { font-weight: 800; font-size: 18px; }
.rankempty { text-align: center; padding: 18px 10px; color: var(--muted); }
.rankempty p { margin: 0 0 10px; }
.histlist { display: flex; flex-direction: column; gap: 6px; }
.histday { margin: 14px 0 2px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.histday:first-child { margin-top: 0; }
.histrow { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 10px 12px; background: #0e141b; color: var(--text); border: 1px solid var(--line); border-radius: 12px; font-weight: 400; }
.histrow:not([disabled]):hover { border-color: var(--accent); }
.histrow .what { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.histrow .what b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.histrow .mark { flex: none; min-width: 58px; text-align: center; padding: 6px 8px; border-radius: 10px; font-weight: 800; font-size: 18px; line-height: 1.05; background: #1e293b; }
.histrow .mark small { display: block; font-size: 10px; font-weight: 600; opacity: 0.8; }
.histrow .mark.good { background: rgba(34, 197, 94, 0.18); color: #86efac; }
.histrow .mark.ok { background: rgba(234, 179, 8, 0.18); color: #fde047; }
.histrow .mark.low { background: rgba(239, 68, 68, 0.16); color: #fca5a5; }
.histrow .mark.time { background: rgba(59, 130, 246, 0.18); color: #93c5fd; }
@media (max-width: 420px) { .histrow .when { display: none; } }

/* ===== Look: "Performance lab" theme for the whole coach app ===== */
body.coach {
  --bg: #0b1117; --card: #121b24; --line: #1f2b38; --text: #e6edf3; --muted: #8b9bad;
  --accent: #c6f432; --accent-ink: #0b1117; --good: #4ade80; --warn: #f5a524;
  --panel: #0e151d; --mono: 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace;
  background: var(--bg);
  font-family: Barlow, system-ui, -apple-system, 'Segoe UI', sans-serif;
}
body.coach .secondary { background: transparent; color: var(--text); border: 1px solid #2a3644; }
body.coach .card { background: var(--card); border-color: var(--line); border-radius: 14px; }
body.coach .stat .n, body.coach .mono, body.coach .ranklist .score, body.coach .histrow .mark, body.coach .podium .pscore { font-family: var(--mono); }
.kicker { font-size: 12px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); }
.pagehead { display: flex; justify-content: space-between; align-items: flex-end; margin: 6px 0 4px; }
.pagehead h1 { font-size: 28px; font-weight: 800; margin: 2px 0 0; }

/* App shell: side navigation on tablets and computers, a bottom bar on phones */
.shell { display: flex; min-height: 100vh; }
.sidenav { width: 210px; flex: none; position: sticky; top: 0; height: 100vh; box-sizing: border-box; padding: 20px 14px; background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 18px; z-index: 20; }
.sidenav .brand { font-size: 17px; font-weight: 800; padding: 0 6px; }
.navtabs { display: flex; flex-direction: column; gap: 4px; }
.navtabs button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; border-radius: 10px; background: transparent; color: var(--muted); border: 0; font-weight: 600; font-size: 15px; text-align: left; }
.navtabs button:hover { color: var(--text); background: #151f2a; }
.navtabs button[aria-selected="true"] { background: #1a2430; color: #fff; }
.navtabs button[aria-selected="true"] svg { color: var(--accent); }
.navfoot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.navpods { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px; }
.navpods:empty { display: none; }
.navpods span { height: 24px; border-radius: 4px; background: var(--accent); color: var(--accent-ink); font: 700 11px/24px var(--mono); text-align: center; }
.content { flex: 1; min-width: 0; }
body.coach main { max-width: 1120px; padding: 18px 24px 60px; }
@media (max-width: 760px) {
  .shell { display: block; }
  .sidenav { position: fixed; top: auto; bottom: 0; left: 0; right: 0; width: auto; height: auto; flex-direction: row; align-items: center; padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px)); border-right: 0; border-top: 1px solid var(--line); gap: 6px; }
  .sidenav .brand, .navpods { display: none; }
  .navtabs { flex-direction: row; flex: 1; }
  .navtabs button { flex: 1; flex-direction: column; gap: 2px; padding: 6px 4px; font-size: 12px; text-align: center; }
  .navfoot { margin: 0; }
  .navfoot .chip { padding: 6px; font-size: 0; gap: 0; }
  body.coach main { padding: 12px 14px 96px; }
}

/* Session: Plan, Run, Review */
.sessionbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin: 4px 0 6px; }
.steps3 { display: flex; gap: 4px; padding: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.sstep { display: flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: 9px; border: 0; background: transparent; color: var(--muted); font-weight: 700; font-size: 15px; }
.sstep .n { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; border: 1.5px solid currentColor; font-size: 12px; box-sizing: border-box; }
.sstep[aria-current="step"] { background: var(--accent); color: var(--accent-ink); }
.sstep[aria-current="step"] .n { background: var(--accent-ink); color: var(--accent); border-color: var(--accent-ink); }
.sstep.locked { opacity: 0.45; cursor: default; }
.sessmeta { display: flex; gap: 14px; align-items: center; color: var(--muted); font-size: 14px; }
.sessmeta .mono { color: var(--text); font-size: 18px; font-weight: 700; }

/* Run */
.livehead { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.livetitle { flex: 1; min-width: 180px; }
.livetitle h2 { font-size: 26px; font-weight: 800; margin: 2px 0 0; }
.livecount { font: 700 17px var(--mono); color: var(--text); }
.runlayout { display: grid; grid-template-columns: minmax(0, 1fr) 250px; gap: 16px; margin-top: 14px; }
@media (max-width: 900px) { .runlayout { grid-template-columns: 1fr; } }
.stage .livemap { position: relative; border-radius: 14px; overflow: hidden; }
.stage .livemap svg { display: block; width: 100%; height: auto; }
.whochip { position: absolute; left: 12px; bottom: 12px; right: 12px; display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 12px; background: rgba(11, 17, 23, 0.88); border: 1px solid var(--line); }
.whochip .whotext { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.whochip .whotext b { font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.whochip .big { font: 800 34px/1 var(--mono); margin: 0; }
.whochip .big.countdown { font-size: 44px; }
.livestats { margin-top: 12px; }
.livestats .stat .n { font-size: 26px; }
.ondeck { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px; align-self: start; }
.ondeck h3.sub { margin-top: 0; }
.deckrow { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; }
.deckrow.now { background: rgba(198, 244, 50, 0.1); }
.deckrow .who { display: flex; flex-direction: column; min-width: 0; }
.deckrow .who b { font-size: 15px; }
.deckrow .avatar { width: 34px; height: 34px; font-size: 12px; }
.deckrow.now .avatar { border-color: var(--accent); }
.good { color: var(--good); }
.warn { color: var(--warn); }
#live .danger { min-height: 46px; padding: 0 22px; }

/* Review */
.reviewbar { display: flex; flex-wrap: wrap; gap: 10px; margin: 6px 0 4px; }
.reviewbar button { min-height: 48px; padding: 0 20px; }
.pbcard { margin: 6px 0 12px; padding: 22px 24px; border-radius: 20px; background: #ff6b2c; color: #140600; animation: pbin 0.5s cubic-bezier(0.2, 1.4, 0.4, 1); }
.pbcard.first { background: #1a2430; color: var(--text); border: 1px solid var(--line); animation: none; }
.pbkicker { font-weight: 800; font-size: 15px; letter-spacing: 0.14em; text-transform: uppercase; }
.pbtime { font: 800 84px/0.95 Barlow, sans-serif; letter-spacing: -2px; margin: 6px 0 4px; font-variant-numeric: tabular-nums; }
.pbtime small { font-size: 30px; letter-spacing: 0; }
.pbname { font-weight: 800; font-size: 20px; }
.pbdiff { font-weight: 700; margin-top: 4px; }
.pbcard.first p { margin: 6px 0 0; color: var(--muted); }
@keyframes pbin { from { transform: scale(0.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .pbcard { animation: none; } }

/* Analytics headline numbers */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 14px 0 4px; }
@media (max-width: 860px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.kpi .l { font-size: 13px; color: var(--muted); }
.kpi .v { font: 700 30px/1.2 var(--mono); margin-top: 4px; }
.kpi .v small { font-size: 14px; color: var(--muted); font-weight: 500; }
.kpi .s { font-size: 13px; color: var(--muted); font-weight: 600; margin-top: 2px; }
.kpi .s.good { color: var(--accent); }
.kpi .s.warn { color: var(--warn); }
#trendCard svg { display: block; }

@media print {
  .sidenav, .sessionbar { display: none !important; }
  .shell { display: block !important; }
}

/* Edit layout on the drill preview */
.layouttools { margin-top: 8px; padding: 12px; border-radius: 12px; background: var(--panel, #0e151d); border: 1px solid var(--line); }
.layouttools p { margin: 0 0 10px; }
.layouttools .row { gap: 8px; flex-wrap: wrap; }
.layouttools button { min-height: 44px; padding: 0 16px; }
.layouttools button:disabled { opacity: 0.4; cursor: default; }
#sheetSvg.editing { touch-action: none; }

/* Sport above the drill name: small, coloured, uppercase */
.sporttag, .csport { display: block; font-size: 11px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); line-height: 1.3; }
.chiprow .pill { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 8px 14px; border-radius: 12px; text-align: left; }
.chiprow .pill .cname { font-weight: 700; font-size: 15px; display: flex; align-items: baseline; gap: 8px; }
.chiprow .pill .ccount { font: 600 12px var(--mono, monospace); padding: 1px 6px; border-radius: 6px; background: #1f2b38; color: var(--muted); }
.chiprow .pill[aria-pressed="true"] .csport { color: var(--accent-ink, #0b1117); opacity: 0.7; }
.chiprow .pill[aria-pressed="true"] .ccount { background: rgba(11, 17, 23, 0.15); color: var(--accent-ink, #0b1117); }
.histrow .sporttag { margin-bottom: 1px; }
.dashboard h2 .sporttag { margin-bottom: 2px; }

/* Edit layout: a filled accent button so it stands out under the preview */
.sheetcap .editbtn { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 12px; border: 0;
  background: var(--accent); color: var(--accent-ink, #0b1117); font: 800 15px Barlow, system-ui, sans-serif; box-shadow: 0 0 0 4px rgba(198, 244, 50, 0.18); }
.sheetcap .editbtn:hover { filter: brightness(1.08); }
.sheetcap .editbtn.hidden { display: none; }
.sheetcap .row { gap: 10px; }
.sheetcap .editbtn { white-space: nowrap; flex: none; }
.sheetcap .editbtn svg { width: 18px; height: 18px; flex: none; }
.sheetcap .row { flex-wrap: nowrap; }

/* Training calendar */
.calnav { display: flex; align-items: center; gap: 6px; }
.calnav b { min-width: 150px; text-align: center; font-size: 16px; }
.calnav button { min-width: 44px; min-height: 44px; padding: 0; font-size: 22px; }
.calgrid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; margin-top: 6px; }
.calhead { text-align: center; font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: 0.06em; text-transform: uppercase; padding-bottom: 2px; }
.calcell { position: relative; min-height: 58px; border-radius: 10px; border: 1px solid var(--line); background: #0e151d; color: var(--muted); padding: 6px 8px; display: flex; flex-direction: column; justify-content: space-between; align-items: flex-start; font-weight: 600; }
.calcell.empty { border: 0; background: transparent; }
.calcell:disabled { cursor: default; }
.calcell .dnum { font-size: 14px; }
.calcell .dcount { align-self: flex-end; font: 700 13px var(--mono, monospace); }
.calcell.l1 { background: rgba(198, 244, 50, 0.16); border-color: rgba(198, 244, 50, 0.35); color: #e6edf3; }
.calcell.l2 { background: rgba(198, 244, 50, 0.38); border-color: rgba(198, 244, 50, 0.6); color: #f4ffd6; }
.calcell.l3 { background: var(--accent); border-color: var(--accent); color: var(--accent-ink, #0b1117); }
.calcell.today { box-shadow: inset 0 0 0 2px #e6edf3; }
.calcell.picked { outline: 3px solid #fff; outline-offset: 1px; }
.calcell:not(:disabled):hover { filter: brightness(1.12); }
.callegend { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.callegend i { width: 16px; height: 16px; border-radius: 4px; display: inline-block; }
.callegend .l1 { background: rgba(198, 244, 50, 0.16); }
.callegend .l2 { background: rgba(198, 244, 50, 0.38); }
.callegend .l3 { background: var(--accent); }
.callegend .calsum { margin-left: auto; color: var(--text); font-weight: 600; }
.calday:empty { display: none; }
.calday { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.calday h3.sub { margin: 4px 0 2px; }
.calentry { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 10px 12px; background: #0e151d; color: var(--text); border: 1px solid var(--line); border-radius: 12px; font-weight: 400; }
.calentry:hover { border-color: var(--accent); }
.calentry .what { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.calentry .avatar { width: 34px; height: 34px; font-size: 12px; }
.calentry .score { font: 700 16px var(--mono, monospace); }
@media (max-width: 520px) { .calcell { min-height: 44px; padding: 4px; } .calcell .dcount { font-size: 11px; } .calnav b { min-width: 110px; font-size: 14px; } }

/* Step 4: the pods a drill uses */
.podcounts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 4px 0 12px; }
.podcounts .pc { border: 2px solid var(--line); border-radius: 12px; padding: 8px; text-align: center; background: var(--panel, #0e151d); }
.podcounts .pc b { display: block; font: 800 26px var(--mono, monospace); }
.podcounts .pc span { color: var(--muted); font-size: 12px; font-weight: 700; }
.podcounts .pc.need { border-color: var(--accent); }
.podcounts .pc.ok { border-color: #4ade80; }
.podcounts .pc.ok b { color: #4ade80; }
.podcounts .pc.wait { border-color: #f5a524; }
.podcounts .pc.wait b { color: #f5a524; }
.podslots { display: flex; flex-wrap: wrap; gap: 8px; }
.podslot { width: 58px; height: 84px; border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 0; font-weight: 400; }
.podslot b { font-size: 24px; font-weight: 900; }
.podslot span { font-size: 11px; font-weight: 800; }
.podslot.on { background: rgba(74, 222, 128, 0.1); border: 2px solid #4ade80; color: var(--text); }
.podslot.on span { color: #4ade80; }
.podslot.off { background: #11181f; border: 2px dashed #3a4650; color: var(--muted); }
.podslot.off span { color: #f5a524; }
#podStatus .warn { color: #f5a524; font-weight: 700; }
#podStatus .good { color: #4ade80; font-weight: 700; }

/* Too few pods for the kind of drill */
.fewbox { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 10px 0; padding: 10px 12px; border-radius: 12px; background: rgba(245, 165, 36, 0.1); border: 1px solid rgba(245, 165, 36, 0.5); color: #f5a524; font-weight: 700; }
.fewbox span { flex: 1 1 240px; }
.fewbox button { min-height: 44px; padding: 0 16px; }
#bFew, #podNeeds { color: #f5a524; font-weight: 700; }
.tile .minpods { display: inline-block; font-style: normal; font-size: 11px; font-weight: 800; color: #f5a524; border: 1px solid rgba(245, 165, 36, 0.5); border-radius: 6px; padding: 1px 6px; margin-top: 4px; }
#bName.missing { border: 2px solid #f87171; box-shadow: 0 0 0 4px rgba(248, 113, 113, 0.2); }
#bNameMissing { margin: 6px 0 0; }
