:root {
  --bg: #f4f6f5;
  --panel: #ffffff;
  --text: #15191c;
  --muted: #5e6871;
  --line: #dfe4e2;
  --chip: #eef2f0;
  --accent: #1f8f4e;
  --accent-ink: #ffffff;
  --accent-soft: #e3f3ea;
  --danger: #b3261e;
  --amber: #b26a00;
  --seg-0: #2f6fdf; --seg-1: #e2731b; --seg-2: #8a4fd6; --seg-3: #c23b6b; --seg-break: #8a949e; --seg-warm: #b0b7be;
  --hr: #d63a5e;
  --yellow-card: #f2c200;
  --red-card: #d62f26;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 16px rgba(0,0,0,.04);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1312; --panel: #171c1b; --text: #e8ecea; --muted: #9aa5a0; --line: #2a3230; --chip: #222a28;
    --accent: #2fb36a; --accent-soft: #173326; --amber: #f0a43a; --shadow: none;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1312; --panel: #171c1b; --text: #e8ecea; --muted: #9aa5a0; --line: #2a3230; --chip: #222a28;
  --accent: #2fb36a; --accent-soft: #173326; --amber: #f0a43a; --shadow: none;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hidden { display: none !important; }

/* header */
.top { background: var(--panel); border-bottom: 1px solid var(--line); }
.top .wrap { display: flex; align-items: center; gap: 12px; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; color: var(--text); text-decoration: none; }
.brand img { width: 32px; height: 32px; }
.top .spacer { flex: 1; }
.who { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--muted); min-width: 0; }
.who img { width: 28px; height: 28px; border-radius: 50%; }
.who .email { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }

/* buttons */
button, .btn { font: inherit; border: 1px solid var(--line); background: var(--chip); color: var(--text); border-radius: 10px; padding: 8px 14px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 8px; }
button:hover, .btn:hover { filter: brightness(0.97); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn-big { padding: 12px 20px; font-size: 17px; border-radius: 12px; }
.btn-danger { color: var(--danger); }
button:disabled { opacity: .5; cursor: not-allowed; }
.chip { padding: 5px 10px; border-radius: 999px; font-size: 14px; }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }

/* cards and layout */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; margin: 24px auto 48px; }
@media (max-width: 860px) { .grid { grid-template-columns: 1fr; } }
h1 { font-size: 28px; line-height: 1.2; margin: 0 0 6px; }
h2 { font-size: 18px; margin: 0 0 12px; }

/* landing */
.hero { padding: 56px 0 24px; display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 32px; align-items: center; }
.hero h1 { font-size: 40px; letter-spacing: -0.02em; }
.hero p.lead { font-size: 18px; color: var(--muted); margin: 10px 0 24px; max-width: 32em; }
.hero .watch { justify-self: center; width: min(280px, 70vw); aspect-ratio: 1; border-radius: 50%; background: #000; border: 10px solid #2a2f2d; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #fff; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.watch .lbl { color: #9a9a9a; font-size: 15px; }
.watch .clk { font-size: 64px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.1; }
.watch .sub { color: #ffb020; font-size: 16px; }
.watch .pill { margin-top: 14px; background: #1f8f4e; border-radius: 999px; padding: 6px 22px; font-size: 15px; }
@media (max-width: 760px) { .hero { grid-template-columns: 1fr; padding-top: 32px; } .hero h1 { font-size: 32px; } }
.features { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 24px 0 56px; }
@media (max-width: 760px) { .features { grid-template-columns: 1fr; } }
.features h3 { margin: 0 0 6px; font-size: 16px; }
.features p { margin: 0; color: var(--muted); font-size: 15px; }
.signin { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.devlogin { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.devlogin input { font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--text); }

/* matches list */
.matches { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.matches a { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); color: var(--text); text-decoration: none; }
.matches a:hover { border-color: var(--accent); }
.date { text-align: center; line-height: 1.1; }
.date .d { font-size: 22px; font-weight: 700; }
.date .m { font-size: 12px; text-transform: uppercase; color: var(--muted); letter-spacing: .05em; }
.matches .title { font-weight: 600; }
.badge { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); white-space: nowrap; }
.badge.grey { background: var(--chip); color: var(--muted); }
.empty { text-align: center; padding: 40px 16px; color: var(--muted); }

/* connect */
.code { font: 700 36px/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .18em; text-align: center; padding: 16px; background: var(--accent-soft); color: var(--accent); border-radius: 12px; margin: 12px 0 6px; }
.steps { padding-left: 20px; margin: 10px 0; color: var(--muted); font-size: 15px; }
.steps li { margin: 4px 0; }
.devices { list-style: none; padding: 0; margin: 0 0 12px; }
.devices li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.devices li:last-child { border-bottom: 0; }
.devices .grow { flex: 1; min-width: 0; }

/* match page and viewer */
.mapgrid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: clip; background: var(--panel); }
.mapgrid #map { min-height: 460px; }
.mapcol { min-width: 0; display: flex; flex-direction: column; position: sticky; top: 0; align-self: start; }
@media (max-width: 860px) { .mapcol { position: static; } }
.mapcol #map { flex: 1; }
.mapgrid aside { padding: 16px; border-left: 1px solid var(--line); }
@media (max-width: 860px) { .mapgrid { grid-template-columns: minmax(0, 1fr); } .mapgrid #map { height: 56vh; min-height: 320px; flex: none; } .mapgrid aside { border-left: 0; border-top: 1px solid var(--line); } }
.row { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 15px; }
th, td { text-align: right; padding: 6px 4px; border-bottom: 1px solid var(--line); }
th:first-child, td:first-child { text-align: left; white-space: nowrap; }
th { font-weight: 600; font-size: 13px; color: var(--muted); }
tr.total td { font-weight: 700; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; }
.facts { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 12px 0 20px; color: var(--muted); }
.facts b { color: var(--text); }
.page-head { margin: 24px 0 8px; display: flex; flex-wrap: wrap; gap: 12px; align-items: end; justify-content: space-between; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
footer { color: var(--muted); font-size: 13px; padding: 24px 0 40px; text-align: center; }
.brand { white-space: nowrap; }

/* viewer details */
.chip-quiet { background: transparent; border-style: dashed; color: var(--muted); }
tr.off td { opacity: .45; }
h3.sub { font-size: 14px; margin: 18px 0 8px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; margin: 8px 0 16px; }
.kpis .k { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.kpis .k small { font-size: 13px; font-weight: 500; color: var(--muted); }
table.zones td.bar { width: 30%; }
table.zones td.bar span { display: block; height: 8px; border-radius: 4px; min-width: 2px; }
.z-walk { background: #9aa5a0; }
.z-jog { background: #4f9ad8; }
.z-run { background: #f0a43a; }
.z-sprint { background: #e5322d; }
ol.sprints { list-style: none; padding: 0; margin: 0; }
ol.sprints li { border-bottom: 1px solid var(--line); }
ol.sprints button { all: unset; display: block; width: 100%; padding: 8px 2px; cursor: pointer; font-size: 15px; }
ol.sprints button:hover { color: var(--accent); }
.units { display: flex; gap: 6px; }
.version { color: var(--muted); }

/* match page: back button, rename, share */
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 20px 0 0; }
.btn.back { background: var(--panel); border-color: var(--line); font-weight: 600; font-size: 15px; padding: 8px 14px 8px 12px; box-shadow: var(--shadow); }
.btn.back:hover { border-color: var(--accent); color: var(--accent); filter: none; }
.btn.back.quiet { font-weight: 500; color: var(--muted); }
.shared-note { font-size: 13px; padding: 4px 10px; border-radius: 999px; background: var(--chip); color: var(--muted); }
.page-head { margin-top: 16px; }
.title-block { min-width: 0; }
.title-row { display: flex; align-items: center; gap: 8px; }
.title-row h1 { margin: 0 0 6px; overflow-wrap: anywhere; }
.btn-icon { padding: 4px 8px; font-size: 16px; line-height: 1; background: transparent; border-color: transparent; color: var(--muted); }
.btn-icon:hover { border-color: var(--line); color: var(--text); }
.rename-form { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 6px; }
.rename-form input, .sharerow input { font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--text); min-width: 0; }
.rename-form input { font-size: 20px; font-weight: 600; width: min(420px, 100%); }
#share.on { color: var(--accent); border-color: var(--accent); }
.sharebox { width: min(560px, calc(100vw - 32px)); border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); color: var(--text); padding: 20px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.sharebox::backdrop { background: rgba(0,0,0,.45); }
.sharebox h2 { margin: 0 0 8px; }
.sharebox p { margin: 0 0 12px; }
.copied { min-height: 1.5em; font-size: 14px; color: var(--muted); margin: 8px 0 4px !important; }
.copied.ok { color: var(--accent); font-weight: 600; }
.dialog-actions { display: flex; justify-content: space-between; gap: 8px; margin-top: 4px; }
.sharerow { display: flex; flex-wrap: wrap; gap: 8px; }
.sharerow input { flex: 1 1 240px; font: 14px ui-monospace, SFMono-Regular, Menlo, monospace; }
.badges { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

/* navigation */
.nav { display: flex; gap: 4px; margin-left: 12px; }
.nav a { color: var(--muted); text-decoration: none; font-weight: 600; font-size: 15px; padding: 6px 10px; border-radius: 8px; }
.nav a:hover { color: var(--text); background: var(--chip); }
.nav a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }
@media (max-width: 640px) { .top .wrap { flex-wrap: wrap; height: auto; padding-block: 10px; } .nav { order: 3; width: 100%; margin: 0; } }

/* score */
.scoreline { display: flex; align-items: center; justify-content: center; gap: 18px; margin: 14px 0 4px; padding: 14px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); flex-wrap: wrap; }
.scoreline .team { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 20px; min-width: 0; }
.scoreline .home { justify-content: flex-end; flex: 1; text-align: right; }
.scoreline .away { flex: 1; }
.scoreline .score { font: 800 40px/1 system-ui, sans-serif; font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.scoreline .dash { color: var(--muted); margin: 0 8px; font-weight: 500; }
.shirt { width: 14px; height: 18px; border-radius: 3px; display: inline-block; border: 1px solid rgba(0,0,0,.15); flex: none; }
.cardbadge { display: inline-grid; place-items: center; min-width: 16px; height: 21px; padding: 0 3px; border-radius: 3px; font-size: 12px; font-weight: 700; }
.cardbadge.yellow { background: var(--yellow-card); color: #000; }
.cardbadge.red { background: var(--red-card); color: #fff; }
@media (max-width: 520px) { .scoreline { gap: 10px; padding: 12px 10px; } .scoreline .team { font-size: 16px; gap: 5px; } .scoreline .score { font-size: 30px; } .scoreline .dash { margin: 0 4px; } }

/* details form */
.details-form { margin: 8px 0 16px; display: grid; gap: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }
.form-grid label { display: grid; gap: 4px; font-size: 14px; font-weight: 600; color: var(--muted); }
.form-grid input, .form-grid select { font: inherit; font-weight: 400; color: var(--text); padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); min-width: 0; }
.team-input { display: flex; gap: 6px; }
.team-input input:first-child { flex: 1; }
.team-input input[type=color] { width: 44px; padding: 2px; height: auto; }
.form-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* map column tools, pitch view */
.maptools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.maptools .row { margin: 0; }
.maptools .spacer { flex: 1; }
.adjusting { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.sizebox { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.sizebox input[type=number] { width: 4.2em; font: inherit; padding: 4px 6px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--text); }
.sizebox .keep { display: inline-flex; align-items: center; gap: 4px; }
.field-input { display: flex; gap: 6px; }
.field-input select, .field-input input { flex: 1; min-width: 0; }
.times-form { margin: 8px 0 16px; display: grid; gap: 10px; }
.times-form h2 { margin: 0; }
.speedchart { width: 100%; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.speedchart canvas { display: block; }
.times-table { border-collapse: collapse; width: 100%; max-width: 520px; }
.times-table th, .times-table td { text-align: left; padding: 4px 8px 4px 0; font-size: 14px; }
.times-table thead th { color: var(--muted); font-weight: 600; }
.times-table input { font: inherit; padding: 4px 6px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--text); }
.times-table .len { font-variant-numeric: tabular-nums; }
.times-error { color: var(--danger); margin: 0; min-height: 1.2em; }
.times-form > * { min-width: 0; }
.times-table input { max-width: 100%; box-sizing: border-box; }
@media (max-width: 560px) {
  .times-table, .times-table tbody { display: block; }
  .times-table thead { display: none; }
  .times-table tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 4px 8px; align-items: center; padding: 6px 0; border-top: 1px solid var(--line); }
  .times-table th[scope=row] { grid-column: 1 / -1; padding: 0; }
  .times-table td { padding: 0; }
  .times-table input { width: 100%; min-width: 0; padding: 4px; }
}
.linkish { background: none; border: 0; padding: 0; color: var(--accent, inherit); text-decoration: underline; cursor: pointer; font: inherit; }
button.small { font-size: 14px; padding: 6px 10px; }
.pitchbox { position: relative; padding: 0; line-height: 0; background: #569641; }
.pitchbox canvas { display: block; width: 100%; height: auto; }
.sprintcard { margin-top: 16px; display: grid; gap: 10px; }
.sprintcard h2 { margin: 0; }
.sm-head { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; }
.sprintcard .pitchbox { border-radius: 10px; overflow: hidden; max-width: 820px; width: 100%; }
.pitchbox svg.sprintarrows { position: absolute; inset: 0; width: 100%; height: 100%; }
.pitchbox svg.sprintarrows path { cursor: pointer; }
.sm-picked { margin: 0; font-weight: 600; }
.pitchbox svg.guide { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.jumpbar { display: flex; gap: 6px; overflow-x: auto; position: sticky; top: 0; z-index: 1100; background: var(--bg); padding: 8px 0; margin: 0 0 8px; scrollbar-width: none; }
.jumpbar::-webkit-scrollbar { display: none; }
.jumpbar a { flex: none; padding: 6px 12px; border-radius: 999px; font-size: 14px; color: var(--muted); text-decoration: none; background: var(--chip); border: 1px solid var(--line); }
.jumpbar a:hover { color: var(--text); }
.jumpbar a.on { color: var(--accent); background: var(--accent-soft); border-color: var(--accent); font-weight: 600; }
.jumpbar:not(.hidden) ~ .mapgrid .mapcol { top: 52px; } /* the sticky map stops below the bar */
#mapgrid, #poscard, #zonescard, #hrcard, #sprintcard, #timelinecard { scroll-margin-top: 60px; }
.statcard { margin-top: 16px; }
.card-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; margin-bottom: 8px; }
.card-head h2 { margin: 0; }
.pos-diag { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 14px; color: var(--muted); margin: 0 0 6px; }
.pos-diag span { flex: 1 1 220px; }
.pos-total { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 4px; }
.pos-title { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.pos-score { font-size: 24px; font-weight: 700; color: var(--accent); text-transform: none; letter-spacing: 0; }
.pos-score small { font-size: 13px; color: var(--muted); font-weight: 500; }
.posrows { display: grid; gap: 0; margin: 4px 0 8px; }
.posrow { display: grid; gap: 5px; padding: 10px 0; border-top: 1px solid var(--line); }
.poshead { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.poshead .num { font-weight: 700; font-variant-numeric: tabular-nums; }
.posbar { height: 8px; border-radius: 4px; background: var(--chip); overflow: hidden; }
.posbar span { display: block; height: 100%; border-radius: 4px; background: var(--accent); }
.pitchnote { margin: 0; padding: 8px 12px; border-top: 1px solid var(--line); }
.mapnote { margin: 0; padding: 0 12px 8px; }
.details-form p { margin: 0; }
.ev-pin { position: absolute; width: 22px; height: 22px; margin: -11px 0 0 -11px; border-radius: 50%; display: grid; place-items: center; font-size: 15px; line-height: 1; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.4); cursor: help; }
.ev-pin.ev-yellow, .ev-pin.ev-red { width: 14px; height: 19px; margin: -10px 0 0 -7px; border-radius: 2px; border: 1px solid rgba(0,0,0,.35); }
.ev-pin.ev-yellow { background: var(--yellow-card); }
.ev-pin.ev-red { background: var(--red-card); }
.leaflet-div-icon.ev-pin { border: 0; }
.ev-pin.flash { animation: flash 1.2s ease-out 2; }
.ev-pin.movable { cursor: grab; touch-action: none; }
.pin-tag { position: absolute; transform: translate(14px, -50%); background: var(--text); color: var(--bg); font-size: 11px; font-weight: 600; line-height: 1.2; padding: 2px 6px; border-radius: 6px; white-space: nowrap; pointer-events: none; z-index: 4; }
.leaflet-tooltip.pin-tag { transform: none; position: absolute; border: 0; box-shadow: none; }
.leaflet-tooltip.pin-tag::before { display: none; }
.timeline-list li.tl-hot { background: color-mix(in srgb, #ffd400 30%, transparent); border-radius: 8px; transition: background .2s; }
.ev-pin.dragging { cursor: grabbing; transform: scale(1.25); z-index: 5; }
@keyframes flash { 0%, 100% { transform: scale(1); } 40% { transform: scale(1.9); box-shadow: 0 0 0 6px #ffd400; } }
@media (prefers-reduced-motion: reduce) { .ev-pin.flash { animation: none; outline: 3px solid #ffd400; } }
.corner-pin { background: #ffd400 !important; border: 2px solid #000 !important; border-radius: 50%; color: #000; font: 700 14px/22px system-ui, sans-serif; text-align: center; }

/* timeline */
.timeline { margin: 20px 0; }
.timeline-list { list-style: none; margin: 0; padding: 0; }
.timeline-list li > * { all: unset; box-sizing: border-box; display: grid; grid-template-columns: 96px 22px minmax(0, 1fr) auto; align-items: center; gap: 10px; width: 100%; padding: 8px 4px; border-bottom: 1px solid var(--line); }
.timeline-list .tl-head > div { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding-top: 0; }
.timeline-list .tl-head > div span:first-child { text-align: right; }
.tl-wall { color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
@media (max-width: 520px) { .timeline-list li > * { grid-template-columns: 74px 18px minmax(0, 1fr) auto; gap: 8px; } .tl-min { font-size: 14px; } }
.timeline-list li button { cursor: pointer; }
.timeline-list li button:hover .tl-text { color: var(--accent); }
.timeline-list li button:focus-visible { outline: 2px solid var(--accent); }
.tl-min { font-variant-numeric: tabular-nums; font-weight: 700; text-align: right; color: var(--muted); }
.tl-icon { width: 14px; height: 18px; justify-self: center; }
.tl-period { color: var(--muted); font-size: 14px; }
.tl-period .tl-icon { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.tl-goal .tl-icon::before { content: '⚽'; font-size: 15px; line-height: 18px; }
.tl-yellow .tl-icon { background: var(--yellow-card); border-radius: 2px; }
.tl-red .tl-icon { background: var(--red-card); border-radius: 2px; }

/* heart rate */
.hrchart { width: 100%; height: auto; display: block; margin: 4px 0 10px; touch-action: pan-y; }
.hrchart .hr-axis { fill: var(--muted); font-size: 10px; font-variant-numeric: tabular-nums; }
.hrchart .hr-zone { font-size: 10px; font-weight: 700; }
.hrchart .hr-grid { stroke: var(--line); stroke-width: 1; }
.hrchart .hr-half { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.hrchart .hr-cursor { stroke: var(--text); stroke-width: 1; stroke-opacity: .5; }
.hrchart .hr-dot { fill: var(--hr); stroke: var(--panel); stroke-width: 1.5; }
.hrchart .hr-readout { fill: var(--text); font-size: 11px; font-weight: 600; }
.hraxis { display: flex; justify-content: space-between; margin: 2px 0 10px; }
.hz-0 { background: #9aa5a0; } .hz-1 { background: #4f9ad8; } .hz-2 { background: #3fae5c; } .hz-3 { background: #f0a43a; } .hz-4 { background: #e5322d; }
.linkbtn { all: unset; color: var(--accent); cursor: pointer; text-decoration: underline; }
.maxhr-input { width: 70px; font: inherit; padding: 2px 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--text); }

/* dashboard side column, upcoming matches */
.side { display: grid; gap: 20px; align-content: start; }
.fixtures { list-style: none; padding: 0; margin: 0 0 12px; }
.fixtures li { display: flex; align-items: center; gap: 6px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.fixtures .grow { flex: 1; min-width: 0; }
.fx-teams { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.fixture-form { display: grid; gap: 10px; margin-top: 4px; }
.fixture-form label { display: grid; gap: 4px; font-size: 14px; font-weight: 600; color: var(--muted); }
.fixture-form input, .fixture-form select { font: inherit; font-weight: 400; color: var(--text); padding: 7px 9px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); min-width: 0; }
.minis { font-weight: 700; margin: 0 4px 0 6px; font-variant-numeric: tabular-nums; }
.matches .title .cardbadge { margin-left: 3px; vertical-align: 1px; }

/* trends */
.tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--line); margin: 8px 0 16px; }
.tabs a { padding: 10px 14px; color: var(--muted); text-decoration: none; font-weight: 600; border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs a[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }
.filters { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: end; margin-bottom: 16px; }
.filters label { display: grid; gap: 4px; font-size: 13px; font-weight: 600; color: var(--muted); }
.filters select { font: inherit; color: var(--text); padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.filters .units { margin: 0; }
#panel { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; margin-bottom: 40px; }
#panel > * { min-width: 0; }
.tsec h2 { margin-bottom: 10px; }
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px 20px; }
.kpi .k { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.2; }
.kpi .k small { font-size: 14px; font-weight: 500; color: var(--muted); }
.chartscroll { overflow: hidden; }
@media (max-width: 640px) {
  .trends .tabs { flex-wrap: wrap; overflow: visible; gap: 2px 0; }
  .trends .tabs a { padding: 8px 10px; }
  .trends .tsec { padding: 16px; }
  .kpi .k { font-size: 24px; }
  .kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
}
svg.bars { width: 100%; height: auto; display: block; }
svg.bars .grid { stroke: var(--line); stroke-width: 1; }
svg.bars .baseline { stroke: var(--muted); stroke-width: 1; }
svg.bars .axis { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
svg.bars .bar-fill { fill: var(--accent); }
svg.bars .fill-yellow { fill: var(--yellow-card); }
svg.bars .fill-red { fill: var(--red-card); }
svg.bars .hit { fill: transparent; cursor: pointer; }
svg.bars .hit.on { fill: var(--text); fill-opacity: .06; }
.legend { display: flex; gap: 14px; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.legend i.fill-yellow { background: var(--yellow-card); } .legend i.fill-red { background: var(--red-card); }
.tableview { margin-top: 8px; font-size: 14px; }
.tableview summary { cursor: pointer; color: var(--muted); }
.tip { position: fixed; z-index: 3000; pointer-events: none; background: var(--text); color: var(--bg); font-size: 13px; padding: 6px 9px; border-radius: 8px; max-width: min(260px, calc(100vw - 16px)); }
.tip .tip-hint { opacity: .75; font-size: 12px; }
.career-pitch { line-height: 0; border-radius: 10px; overflow: hidden; display: inline-block; max-width: 100%; }
.career-pitch canvas { max-width: 100%; height: auto !important; }

/* compare */
.compare { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin: 16px 0 40px; }
@media (max-width: 860px) { .compare { grid-template-columns: 1fr; } }
.cmp-panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: grid; gap: 10px; align-content: start; min-width: 0; }
.cmp-panel select { font: inherit; font-weight: 600; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--text); min-width: 0; width: 100%; }
.cmp-panel .row { margin: 0; }
.cmp-pitch { border-radius: 10px; overflow: hidden; }
.cmp-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; }
.cmp-stats b { font-size: 22px; font-variant-numeric: tabular-nums; }
.cmp-stats span { display: block; }
.cmp-note { margin: 0; }

/* avatar menu */
.avatar-menu { position: relative; }
.avatar { padding: 0; width: 38px; height: 38px; border-radius: 50%; overflow: hidden; border: 2px solid var(--line); background: var(--accent-soft); display: grid; place-items: center; }
.avatar:hover, .avatar[aria-expanded="true"] { border-color: var(--accent); filter: none; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar .initial { font-weight: 700; color: var(--accent); font-size: 16px; }
.menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 2500; min-width: 230px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.15); padding: 6px; display: grid; }
.menu-who { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; display: grid; min-width: 0; }
.menu-who b { color: var(--text); font-size: 15px; }
.menu-who span { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu a, .menu button { all: unset; box-sizing: border-box; display: block; padding: 9px 10px; border-radius: 8px; color: var(--text); font-size: 15px; cursor: pointer; }
.menu a:hover, .menu button:hover, .menu a:focus-visible, .menu button:focus-visible { background: var(--chip); }
.menu-version { padding: 8px 10px 4px; border-top: 1px solid var(--line); margin-top: 4px; font-size: 12px; color: var(--muted); }

/* confirmation dialog */
.confirm-dialog { width: min(440px, calc(100vw - 32px)); border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); color: var(--text); padding: 20px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.confirm-dialog::backdrop { background: rgba(0,0,0,.45); }
.confirm-dialog h2 { margin: 0 0 8px; }
.confirm-dialog p { margin: 0 0 16px; color: var(--muted); }
.confirm-dialog .dialog-actions { justify-content: flex-end; }
.type-confirm { display: grid; gap: 6px; margin: 0 0 16px; font-size: 14px; color: var(--muted); }
.type-confirm input { font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--text); }
.btn-danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; font-weight: 600; }

/* profile */
.profile { display: grid; gap: 20px; max-width: 720px; margin-bottom: 48px; }
.account-card { display: flex; align-items: center; gap: 16px; }
.account-face { width: 64px; height: 64px; border-radius: 50%; overflow: hidden; background: var(--accent-soft); display: grid; place-items: center; flex: none; }
.account-face img { width: 100%; height: 100%; object-fit: cover; }
.account-face .initial { font-size: 26px; font-weight: 700; color: var(--accent); }
.account-text { min-width: 0; }
.account-name { font-size: 20px; font-weight: 700; }
.danger-zone { border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); }
.danger-zone h2 { color: var(--danger); }
.connect-prompt p { margin: 0 0 12px; }
.deleted-note { margin: 16px 0 0; padding: 10px 14px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); }

/* help page */
.help-badge { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.help-grid { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 32px; align-items: start; padding-block: 28px 40px; }
.help-side { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow-y: auto; }
.help-side ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.help-side a { display: block; padding: 6px 10px; border-radius: 8px; color: var(--muted); text-decoration: none; font-size: 14px; border-left: 3px solid transparent; }
.help-side a:hover { color: var(--text); background: var(--chip); }
.help-side a.on { color: var(--accent); background: var(--accent-soft); border-left-color: var(--accent); font-weight: 600; }
.help-bar { display: none; }
.help-main { display: grid; gap: 20px; min-width: 0; max-width: 780px; }
.help-main h1 { font-size: 30px; }
.help-section { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; scroll-margin-top: 16px; display: grid; gap: 12px; min-width: 0; }
.help-section > * { margin: 0; }
.help-section h2 { display: flex; align-items: center; gap: 10px; font-size: 19px; margin: 0; }
.help-icon { width: 34px; height: 34px; border-radius: 10px; background: var(--accent-soft); display: grid; place-items: center; font-size: 18px; flex: none; }
.help-section p, .help-section li, .help-section dd { font-size: 15px; line-height: 1.6; }
.help-section ul, .help-section ol { padding-left: 22px; display: grid; gap: 6px; }
.help-section code { font-size: 13px; background: var(--chip); padding: 1px 5px; border-radius: 5px; }
.ui { white-space: nowrap; font-size: 13px; font-weight: 600; padding: 1px 7px; border: 1px solid var(--line); border-radius: 6px; background: var(--chip); color: var(--text); }
.help-tip { font-size: 14px !important; padding: 9px 12px; border-radius: 10px; background: var(--accent-soft); color: var(--text); }
.shot { margin: 0; display: grid; gap: 6px; justify-items: center; min-width: 0; }
.shot img { display: block; max-width: 100%; height: auto; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.shot a:hover img { border-color: var(--accent); }
.shot figcaption { font-size: 13px; color: var(--muted); text-align: center; }
.shot.narrow img { max-width: min(100%, 560px); }
.shot.tall img { max-height: 640px; width: auto; }
.shot.phone img { max-width: min(100%, 280px); }
.shot.watch img { border: 0; box-shadow: none; max-width: min(100%, 230px); }
.shot.watch.small img { max-width: 100%; }
.side-by-side { display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr); gap: 18px; align-items: start; }
.side-by-side > .shot img { max-width: 100%; }
.side-by-side > div { display: grid; gap: 10px; min-width: 0; }
.side-by-side > div > * { margin: 0; }
.side-by-side .shot.watch:nth-child(2) { justify-self: start; }
.watch-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.help-table { width: 100%; font-size: 14px; }
.help-table th, .help-table td { text-align: left; vertical-align: top; padding: 7px 8px; }
.help-table td:first-child { font-weight: 600; white-space: normal; }
.defs { margin: 0; display: grid; gap: 8px; }
.defs dt { font-weight: 700; }
.defs dd { margin: 0 0 4px; color: var(--muted); }
@media (max-width: 900px) {
  .help-grid { grid-template-columns: minmax(0, 1fr); padding-top: 12px; }
  .help-side { display: none; }
  .help-bar { display: flex; gap: 4px; overflow-x: auto; position: sticky; top: 0; z-index: 30; background: var(--panel); border-bottom: 1px solid var(--line); padding: 8px max(16px, env(safe-area-inset-left, 0px)); scrollbar-width: none; }
  .help-bar::-webkit-scrollbar { display: none; }
  .help-bar a { flex: none; padding: 6px 12px; border-radius: 999px; font-size: 14px; color: var(--muted); text-decoration: none; background: var(--chip); }
  .help-bar a.on { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
  .help-section { scroll-margin-top: 64px; }
}
@media (max-width: 640px) {
  .side-by-side { grid-template-columns: minmax(0, 1fr); }
  .side-by-side .shot.watch:nth-child(2) { justify-self: center; }
  .watch-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .help-section { padding: 16px; }
}

/* landing: watch picture and showcase */
.hero-watch { justify-self: center; width: min(320px, 72vw); height: auto; }
.showcase { display: grid; gap: 40px; margin: 8px 0 56px; }
.show-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 32px; align-items: center; }
.show-row.flip > :last-child { order: -1; }
.show-watches { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 440px; justify-self: center; }
.show-watches img { border: 0 !important; box-shadow: none !important; }
.show-row h2 { font-size: 24px; margin-bottom: 8px; }
.show-row p { color: var(--muted); margin: 0 0 10px; }
.show-row img { width: 100%; height: auto; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.show-more { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin: 0; }
@media (max-width: 760px) { .show-row { grid-template-columns: 1fr; gap: 14px; } .show-row.flip > :last-child { order: 0; } }
.shared-note a { color: inherit; }

/* page load: content stays hidden until its data is ready, then fades in at
   once (common.js pageReady), instead of filling in piece by piece */
body.loading main, body.loading footer { visibility: hidden; }
@media (prefers-reduced-motion: no-preference) {
  body.ready main { animation: page-in .18s ease-out; }
}
@keyframes page-in { from { opacity: 0; } to { opacity: 1; } }
/* the header's right side keeps its size while the avatar arrives */
.who { min-height: 38px; min-width: 38px; justify-content: flex-end; }
