/* Phit stylesheet, part 8 of 8. Phone overrides, the expanded list, the shared page frame, sample runs, skip link, the first-comparison sheet, footer, plain pages and tap targets.
   The parts are one stylesheet cut into files: they must load in this order (index.html and the plain pages list them), because a later rule can override an earlier one. */

/* ----- phones: a short header, a bottom bar that fits, and controls a thumb can hit ----- */
.nav-label-short { display: none; }
.rename-btn, .run-rename-btn { min-width: 28px; min-height: 28px; }
@media (max-width: 799.98px) {
  .nav-foot { flex: 3 1 0; }                                    /* Documentation, Contact and Settings were squeezed into a quarter of the bar: the bar is shared by the number of items in each group (four and three) */
  #nav-main { flex: 4 1 0; }
  #nav-docs .nav-label-long, [data-tab="training"] .nav-label-long, [data-tab="records"] .nav-label-long { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
  #nav-docs .nav-label-short, [data-tab="training"] .nav-label-short, [data-tab="records"] .nav-label-short { display: inline; }
  .nav-item { min-width: 0; }
}
@media (max-width: 700px) {
  /* the logo, the demo counter and the session button in one row */
  .header-right { display: contents; }
  body > header { align-items: center; gap: 0.3rem 0.6rem; padding-bottom: 0.45rem; }
  #connection-status { margin-left: auto; max-width: 9.5rem; white-space: normal; text-align: right; font-size: var(--fs-xs); line-height: 1.25; }
  #account-btn { min-height: 40px; padding: 0.15rem 0.6rem; font-size: var(--fs-sm); }
  /* the chart's switches sit in one row you can swipe, instead of stacking to half a screen */
  .chart-controls { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 0.2rem; -webkit-overflow-scrolling: touch; }
  .chart-controls > * { flex: none; }
}
@media (pointer: coarse) {
  button.ghost, button.seg, .seg, button.toggle, .toggle, .icon-btn, summary, .filters-toggle, #run-search, #account-btn, select, input[type=text], input[type=search], input[type=number] { min-height: 44px !important; }
  .icon-btn { min-width: 44px; }
  .run-rename-btn, .rename-btn { min-width: 40px !important; min-height: 40px !important; }
  .link-btn, button.link { min-height: 32px; }
  .nav-item { min-height: 56px; }
}
.col-btn { min-width: 28px; min-height: 28px; }                 /* WCAG 2.2: at least 24 by 24 px */
.link-btn { min-height: 24px; }

/* Training with runs and no block yet: the nudge above the weeks */
.train-nudge { margin: 0 0 1rem; padding: 1.1rem 1.2rem; }
.train-nudge h2 { margin: 0 0 0.4rem; font-size: 1.15rem; letter-spacing: -0.01em; }
.train-nudge p { margin: 0 0 0.7rem; max-width: 52rem; color: var(--muted); line-height: 1.5; }
.train-nudge .train-gate-actions { justify-content: flex-start; margin: 0; }
.train-nudge .train-gate-actions button:not(.link) { border-radius: var(--r-pill); padding-left: 1.3rem; padding-right: 1.3rem; }

/* Settings, Display: the week summary styles each drawn on a made-up week, and the time zone row */
.wsum-preview { margin-top: 0.5rem; max-width: 34rem; pointer-events: none; }                /* one sample, as wide as a real week, so it reads as it will in Training */
.wsum-preview .week { margin: 0; padding: 0.4rem 0.5rem; font-size: var(--fs-sm); }
.wsum-preview .week-title { font-size: var(--fs-sm); }
.tz-row { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.tz-row :is(input, select) { flex: 1 1 14rem; min-width: 0; }
#set-tz-note:empty { display: none; }

/* ----- the expanded list: the whole page for the runs, the same cards in several columns ----- */
.fold-btn { width: auto; min-height: 36px; padding: 0 0.7rem 0 0.5rem; gap: 0.35rem; flex: none; }          /* the left panel's Collapse / Expand, for the list of runs: a chevron and a word */
.fold-btn .nav-ico { width: 20px; height: 20px; transform: rotate(180deg); transition: transform 0.16s ease; }          /* pointing right: the list will grow to the right, across the page */
.fold-btn.is-expanded .nav-ico { transform: none; }
.fold-btn.is-folded .nav-ico { transform: none; }                                  /* the tables' Expand: pointing left, where they will come back from (Collapse points right, where they go) */
@media (max-width: 999.98px) { .fold-btn { display: none !important; } }           /* on a phone or a narrow window a list already has the whole width */
/* The Runs page is the list of runs across the whole page and nothing else; the Compare page is the comparison and nothing else (no list beside it). */
.layout.runs-expanded .results { display: none; }
.layout.compare-page .sidebar { display: none; }
.page-bar { display: none; }
.layout.compare-page .page-bar { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.layout.is-empty .page-bar { display: none; }                  /* no runs yet: the welcome page, with its own title, on whichever of the two pages */
.page-bar h1 { margin: 0; font-size: 1.15rem; }
@media (min-width: 1000px) {
  .layout.runs-expanded, .layout.compare-page { grid-template-columns: minmax(0, 1fr); }
  .layout.runs-expanded .sidebar { position: static; max-height: none; display: block; }
  .layout.runs-expanded .sidebar .runs { overflow: visible; max-height: none; padding-right: 0; }
  .runs-expanded .panel-header { align-items: center; gap: 0.2rem 0.9rem; flex-wrap: wrap; }
  .runs-expanded .panel-header.runs-head { align-items: flex-start; }
  .runs-expanded .panel-header h1 { font-size: 1.15rem; }
  .runs-expanded .runs-flat { display: flex; flex-direction: column; gap: 0.4rem; }          /* the plain list is every run, one card to a row across the whole page, as a group's runs are */
  .runs-expanded .group-runs { gap: 0.4rem; padding: 0 0.7rem 0.7rem; }                      /* a group's runs stack full width, as a week's do on the Training page */
  .runs-expanded .group-runs .run:not(.selected) { background: var(--panel); }              /* white cards on the tinted group, like the week lines */
  .runs-expanded .run { align-content: start; }                    /* cards of different heights in one row all start at the top */
  .runs-expanded details.group { margin-bottom: 0.7rem; }
  .runs-expanded details.group > summary .group-line, .runs-expanded .group-why { display: none; }          /* the one-line summary is enough here */
  .runs-expanded .group-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.2rem 0 0.5rem; }
  .runs-expanded .list-bar, .runs-expanded #add-group { max-width: 56rem; }
  .runs-expanded .compare-bar { position: sticky; bottom: 0.75rem; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; max-width: 34rem; margin: 0.75rem auto 0; padding: 0.6rem 0.9rem; border: 1px solid var(--accent); border-radius: var(--r-pill); background: var(--panel); box-shadow: 0 8px 28px rgb(0 0 0 / 0.18); }
}


/* ----- one frame for the top-level pages: the same width, the same gap under the header, the same card padding, the same heading position -----
   (the welcome page, the Training and Records pages before there is anything to show, and Records once there is). Settings and Documentation
   keep their own narrower reading width but start at the same height. */
:root { --page-narrow: 1360px; --page-gutter: 0.75rem; --page-top: 1rem; --card-pad-y: 1.25rem; --card-pad-x: 1.5rem; --fig-reserve: 25rem; }
.layout.is-empty, .records-view, .training { margin: var(--page-top) auto; padding: 0 var(--page-gutter); }
.layout.is-empty, .records-view { max-width: var(--page-narrow); }
.training-layout.gated { max-width: calc(var(--page-narrow) - 2 * var(--page-gutter)); margin: 0 auto; }
.layout.is-empty .panel, .train-gate, .records-view .panel { margin: 0; padding: var(--card-pad-y) var(--card-pad-x); max-width: none; }
.settings-page, .docs-page, .wizard-page { margin-top: var(--page-top); margin-bottom: var(--page-top); }
.guide-hero { padding: 0; gap: 0.5rem; }
.guide-hero::before { height: 11rem; }
.guide-hero h1, .train-gate h1 { margin: 0; font-size: 2rem; font-weight: 750; letter-spacing: -0.02em; line-height: 1.2; }
.guide-hero .lead, .train-hero .lead { max-width: 64rem; font-size: 1.1rem; }
.guide-hero .guide-foot, .train-gate .train-gate-actions { justify-content: center; margin: 0.35rem 0 0; }
/* the picture is sized so the three tiles under it are on the first screen, without scrolling: it takes the height that is left (the picture is 900 by 470) */
.guide-figure { width: min(100%, max(420px, calc((100vh - var(--fig-reserve)) * 1.915))); max-width: 1200px; margin: 1rem auto 0; }
.guide-points { gap: 0.7rem; margin-top: 0.9rem; max-width: min(100%, 1200px); }
.guide-points li { padding: 0.8rem 1rem; }
.train-gate { --fig-reserve: 27rem; }
.records-gate { --fig-reserve: 25.5rem; }
@media (max-width: 720px) { .guide-figure { width: 100%; } }

/* ----- the sample runs: a chip on each, and a line above the list with the way to take them out ----- */
.chip.sample { background: rgb(var(--accent-rgb) / 0.12); border-color: var(--accent); color: var(--accent-ink); }
.sample-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 0.3rem 0.6rem; margin: 0 0 0.6rem; padding: 0.45rem 0.7rem; border: 1px dashed var(--accent); border-radius: var(--r-lg); background: rgb(var(--accent-rgb) / 0.06); font-size: var(--fs-base); }
.sample-bar[hidden] { display: none; }
.sample-bar .link { font: inherit; }

/* ----- skip link: the first stop for the keyboard, shown only when it has the focus ----- */
.skip-link { position: absolute; left: 0.5rem; top: -4rem; z-index: 1000; padding: 0.5rem 0.9rem; border-radius: var(--r-md); background: var(--panel); color: var(--accent-ink); border: 2px solid var(--accent); font-weight: 600; text-decoration: none; }
.skip-link:focus { top: 0.5rem; }
main.content:focus { outline: none; }

/* ----- the sheet over the first comparison ----- */
.sheet { max-width: 34rem; }
.sheet::backdrop { background: rgb(18 24 38 / 0.38); backdrop-filter: blur(1.5px); }
.sheet-body { position: relative; padding: 1.4rem 1.4rem 1.1rem; }
.sheet-x { position: absolute; top: 0.6rem; right: 0.6rem; font-size: 1.4rem; }
.sheet h2 { margin: 0 2rem 0.4rem 0; font-size: 1.3rem; }
.sheet p { margin: 0 0 0.8rem; color: var(--muted); line-height: 1.5; }
.sheet-pair { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.15rem 0 0.1rem; }
.sheet-pair[hidden] { display: none; }
.sheet-run { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.3rem 0.75rem; border: 1px solid var(--border); border-radius: var(--r-pill); background: var(--bg); font-size: var(--fs-base); }
.sheet-run small { color: var(--muted); white-space: nowrap; }
.sheet-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.sheet .setup-card { margin: 0; padding: 0.8rem 0 0; border: 0; border-top: 1px solid var(--border); border-radius: 0; background: none; }
.sheet .sheet-foot { margin: 0.8rem 0 0; font-size: var(--fs-sm); }
@media (max-width: 600px) {
  .sheet { margin: auto 0 0; width: 100%; max-width: none; max-height: 92vh; border-radius: 18px 18px 0 0; }
  .sheet-body { padding: 1.2rem 1.1rem calc(1rem + env(safe-area-inset-bottom)); }
}

/* ----- the footer: small and quiet, at the foot of every page ----- */
.site-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.3rem 1.2rem; margin: 2rem auto 0; padding: 1rem var(--page-gutter) 1.2rem; max-width: var(--page-narrow); border-top: 1px solid var(--border); color: var(--muted); font-size: var(--fs-sm); }
.site-footer a { color: var(--muted); text-decoration: underline; text-underline-offset: 2px; }
.site-footer a:hover { color: var(--text); }
.site-footer a[hidden] { display: none; }
@media (max-width: 799.98px) { .site-footer { margin-top: 1rem; padding-bottom: calc(5rem + env(safe-area-inset-bottom)); } }       /* clear of the bottom bar */

/* ----- the sample runs, offered only where someone is stuck ----- */
.wz-stuck { margin: 1.1rem 0 0; color: var(--muted); font-size: var(--fs-base); }
.wz-stuck .link { font: inherit; }
.sample-bar .ghost { min-height: 30px; padding: 0.15rem 0.8rem; font-size: var(--fs-md); }

/* ----- loading the sample runs: its own card and bar, so it is never taken for the person's own import ----- */
.wz-sample-load { display: flex; flex-direction: column; align-items: center; gap: 0.4rem; margin-top: 0.4rem; padding: 1.3rem 1rem; text-align: center; border: 2px dashed var(--accent); border-radius: var(--r-2xl); background: rgb(var(--accent-rgb) / 0.06); color: var(--muted); }
.wz-sample-load b { color: var(--text); }
.wz-sample-load .progress { max-width: 18rem; margin-top: 0.3rem; }
.progress.sample > i { background: repeating-linear-gradient(135deg, var(--accent) 0 8px, rgb(var(--accent-rgb) / 0.5) 8px 16px); }

/* ----- the plain pages (about the demo, privacy, terms, feedback, not found): one reading column ----- */
.doc-page { max-width: 760px; line-height: 1.55; }
.doc-page.is-narrow { max-width: 640px; }
.doc-page.is-lost { max-width: 560px; margin: 4rem auto; }

/* a table of figures that is wider than a phone scrolls inside itself, not the whole page */
.compare-grid { overflow-x: auto; }

/* ----- tap targets and errors ----- */
.site-footer a { display: inline-block; padding: 0.45rem 0.25rem; }                                    /* a link is never a 15 px sliver */
@media (pointer: coarse) { .site-footer a { padding: 0.85rem 0.4rem; } }
.doc-page p > a:only-child { display: inline-block; padding: 0.5rem 0; }                                /* "Back to Phit" and its kind */
.wz-error { margin-top: 0.4rem; padding: 0.7rem 0.85rem; border: 1px solid var(--border); border-left: 3px solid var(--bad); border-radius: var(--r-lg); background: var(--bg); }
.wz-error b { display: block; color: var(--bad); }
.wz-error p { margin: 0.3rem 0 0; color: var(--muted); font-size: var(--fs-base); line-height: 1.45; }
#import-result .error { margin: 0.3rem 0 0.5rem; }
.doc-page a:not(.button-link) { color: var(--accent-ink); text-underline-offset: 2px; }                /* links on the plain pages are the app's link colour, in both themes (not the browser's blue) */

/* the first sheet's two ways in: the recommended comparison, or the runs themselves */
.sheet-choices { display: grid; gap: 0.7rem; margin: 0.9rem 0 1rem; }
.sheet-choice { display: flex; flex-direction: column; align-items: flex-start; gap: 0.35rem; text-align: left; width: 100%; padding: 0.85rem 1rem; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--panel); color: var(--text); font: inherit; cursor: pointer; }
.sheet-choice b { font-size: var(--fs-lg); }
.sheet-choice:hover { border-color: var(--accent); }
.sheet-choice.primary { border-color: var(--accent); background: rgb(var(--accent-rgb) / 0.08); }
.sheet-choice[hidden] { display: none; }
.sheet-reason { color: var(--muted); font-size: var(--fs-md); font-weight: 400; }

/* ----- a run's menu: the name, three quick actions, one-tap type and effort, delete (the ... on a card) ----- */
.menu-head { display: flex; align-items: center; gap: 0.5rem; padding: 0.4rem 0.5rem 0.55rem; font-size: var(--fs-lg); }
.menu-head small { margin-left: auto; color: var(--muted); font-size: var(--fs-sm); font-weight: 400; white-space: nowrap; }
.menu-back { display: inline-flex; min-height: 0; padding: 0.15rem; background: none; color: var(--muted); border-radius: var(--r-sm); }
.menu-back:hover, .menu-back:focus-visible { background: rgb(var(--ink-rgb) / 0.08); color: var(--text); }
.menu-tiles { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 0.4rem; padding: 0 0.25rem; }
.menu-tile { display: flex; flex-direction: column; align-items: center; gap: 0.35rem; min-height: 0; padding: 0.65rem 0.3rem 0.55rem; border: 1px solid var(--border); border-radius: var(--r-xl); background: none; color: var(--text); font-size: var(--fs-sm); font-weight: 600; }
.menu-tile svg { color: var(--accent); }
.menu-tile:hover, .menu-tile:focus-visible { background: rgb(var(--ink-rgb) / 0.06); border-color: var(--accent); }
.menu-cap { display: flex; align-items: center; justify-content: space-between; padding: 0.6rem 0.5rem 0.25rem; color: var(--muted); font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.menu-cap em { padding: 0.05rem 0.5rem; border-radius: var(--r-pill); background: rgb(var(--ink-rgb) / 0.07); font-style: normal; font-weight: 500; text-transform: none; letter-spacing: 0; }
.menu-cap em.mine { background: rgb(var(--accent-rgb) / 0.14); color: var(--accent-ink); }
.menu-seg { display: flex; margin: 0 0.25rem; padding: 3px; border-radius: var(--r-xl); background: rgb(var(--ink-rgb) / 0.07); }
.menu-seg button { flex: 1; min-height: 0; padding: 0.42rem 0.2rem; border-radius: var(--r-lg); background: none; color: var(--muted); font-size: var(--fs-sm); font-weight: 600; white-space: nowrap; }
.menu-seg button[aria-checked="true"] { background: var(--panel); color: var(--text); box-shadow: 0 1px 3px rgb(0 0 0 / 0.25); }
.menu-seg i { display: inline-block; width: 8px; height: 8px; margin-right: 0.3rem; border-radius: 50%; }
.menu-seg i.easy { background: var(--good); } .menu-seg i.moderate { background: var(--warn); } .menu-seg i.hard { background: var(--bad); }
.menu-foot { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; margin-top: 0.6rem; padding: 0.5rem 0.5rem 0.15rem; border-top: 1px solid var(--border); }
.menu-foot .hint { margin: 0; font-size: var(--fs-xs); }
.menu-link { display: inline-flex; align-items: center; gap: 0.35rem; min-height: 0; padding: 0.2rem 0; background: none; font-size: var(--fs-md); font-weight: 600; }
.menu-link.del { color: var(--bad); } .menu-link.reset { color: var(--warn-ink); }
.menu-list { display: flex; flex-direction: column; }
.menu-item { display: block; width: 100%; min-height: 0; padding: 0.5rem 0.6rem; border-radius: var(--r-md); background: none; color: var(--text); font-size: var(--fs-md); font-weight: 500; text-align: left; }
.menu-item:hover, .menu-item:focus-visible { background: rgb(var(--ink-rgb) / 0.08); }
.menu-item small { margin-left: 0.3rem; color: var(--muted); font-weight: 400; }

/* ----- "download everything from Garmin": the sample-runs bar's frame, with a progress line under the words ----- */
.dl-bar #dl-text { flex: 1 1 16rem; }
.dl-bar .progress { flex: 1 1 100%; }
.dl-bar [hidden] { display: none; }
