/* THE SHARED LOOK (12 November 2026, Part 2 of the readability work): the
   new Hub's and Compare's sizes, spacing and controls, for every page.
   Loaded by base.html after style.css and before a page's own sheet
   (hub_v2.css, compare_v2.css), so a page's own rules still win.

   Three parts:
   1. The measurements, as custom properties: text 18px, nothing under 16px,
      headings 28/24/20px, an 8px-based spacing scale, 44px controls.
   2. The Hub's own pieces, moved here unchanged from hub_v2.css: the "i"
      info box, the segmented control, the panel, the small field label and
      dropdown, and the Precision/Accuracy pair. Each keeps its hv2- name
      (the Hub's and Compare's scripts and markup are untouched) and gains a
      ui- name for other pages. scripts/style_parity.py proves the Hub and
      Compare are pixel for pixel the same with them here.
   3. Base rules for a restyled page, scoped to <main class="ui-page">
      (base.html's main_attrs block), so a page changes only when it opts in
      and the Hub and Compare never do.
   4. Phones (13 November 2026): below 600px wide, every page at once, the
      Hub and Compare included. Laptop and tablet are unchanged. */

/* 1. Measurements ---------------------------------------------------------- */
:root {
  --ui-text: 18px;
  --ui-text-small: 16px;
  --ui-title: 28px;
  --ui-title-phone: 24px;
  --ui-h2: 24px;
  --ui-h3: 20px;
  --ui-figure: clamp(28px, 3.4vw, 40px);
  /* The ceiling of every large figure's size rule (tiles, the Precision/
     Accuracy pair, Latest session, Best groups): 40px on a phone (part 4). */
  --ui-figure-max: 60px;
  --ui-space-1: 4px;
  --ui-space-2: 8px;
  --ui-space-3: 12px;
  --ui-space-4: 16px;
  --ui-space-5: 24px;
  --ui-space-6: 32px;
  --ui-space-7: 48px;
  --ui-space-8: 64px;
  --ui-control: 44px;
  --ui-radius: 8px;
  --ui-radius-panel: 14px;
  --ui-focus: #8ab8ff;
  --ui-pressed-border: #3b82f6;
  --ui-pressed-bg: #1e3a66;
}

/* 2. The Hub's pieces, moved from hub_v2.css ------------------------------- */

/* The info box: an "i" beside a measure's name that opens a popover.
   Open state is a class set by info_box.js (not :hover in CSS), so one box
   is open at a time whatever opened it. */
.hv2-info {
  position: relative;
  display: inline-flex;
  vertical-align: middle;
}

.hv2-info-btn {
  position: relative;
  font-size: 16px;
  width: 28px;
  height: 28px;
  margin: -6px 0;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: inherit;
  cursor: pointer;
}

.hv2-info-btn > span {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border: 1.5px solid var(--text-muted);
  border-radius: 50%;
  color: var(--text-muted);
  font: italic 600 16px/18px Georgia, "Times New Roman", serif;
  letter-spacing: 0;
  text-transform: none;
}

.hv2-info-btn:hover > span,
.hv2-info-btn[aria-expanded="true"] > span {
  border-color: #8ab8ff;
  color: #8ab8ff;
}

.hv2-info-btn:focus-visible {
  outline: 2px solid #8ab8ff;
  outline-offset: 1px;
}

.hv2-info-pop {
  display: none;
  position: absolute;
  z-index: 20;
  top: calc(100% + 8px);
  left: -12px;
  /* Never wider than the viewport less a gutter each side; info_box.js
     then slides it sideways so it stays on screen at phone width. */
  width: min(360px, calc(100vw - 16px));
  padding: 12px 14px;
  background: var(--panel-raised);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.5);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--ui-text);
  font-style: normal;
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: 0;
  text-align: left;
  text-transform: none;
  white-space: normal;
}

.hv2-info.hv2-open .hv2-info-pop {
  display: block;
}

/* A wider popover for longer text, e.g. the three-measure explanation. */
.hv2-info-pop--wide {
  width: min(420px, calc(100vw - 16px));
}

/* A 44px tap area on a touch screen without a larger visible "i", the way
   .info-tip in style.css does it: an invisible ::before supplies the area. */
@media (pointer: coarse) {
  .hv2-info-btn::before {
    content: "";
    position: absolute;
    inset: -8px;
  }

  .hv2-info-btn > span {
    font-size: 16px;
  }
}

.hv2-seg,
.ui-seg {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
}

.hv2-segbtn,
.ui-segbtn {
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  font: 600 var(--ui-text) var(--font-sans);
  cursor: pointer;
}

.hv2-segbtn:hover,
.ui-segbtn:hover {
  border-color: #56627a;
}

.hv2-segbtn[aria-pressed="true"],
.ui-segbtn[aria-pressed="true"] {
  border-color: #3b82f6;
  background: #1e3a66;
}

.hv2-panel,
.ui-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
}

.hv2s-lab,
.ui-lab {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.hv2s-sel,
.ui-sel {
  min-height: 44px;
  padding: 0 10px;
  background: var(--panel);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  color: var(--text);
  font: var(--ui-text) var(--font-sans);
}

/* THE HEADLINE BLOCK (13 November 2026, hubV2Target.headlineBlock, the
   owner's ISO 5725 names): five equal figures in three rows. Accuracy and
   Inside zone; under a "Precision" heading, Mean radius and Extreme
   spread; Zero across the full width with its direction line. One figure
   size for all five (600 monospace, at most --ui-figure-max), sized to
   half the column so the full-width Zero matches the others. Each name has
   its colour: Accuracy amber, Precision blue, Zero mint, Inside zone the
   zone's coral. */
.hv2-head-box {
  display: block;
  margin-top: 14px;
  container-type: inline-size;
}

.hv2-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px 16px;
}

.hv2-head-fig {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.hv2-head-group,
.hv2-head-zero {
  grid-column: 1 / -1;
}

.hv2-head-group {
  margin-bottom: -8px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  color: #60a5fa;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.hv2-head-zero {
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.hv2-head-name {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  min-width: 0;
}

.hv2-head-nm {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.hv2-head-i {
  display: inline-flex;
}

.hv2-head-acc .hv2-head-nm { color: #f5a524; }
.hv2-head-zone .hv2-head-nm { color: #f87171; }
.hv2-head-mr .hv2-head-nm,
.hv2-head-es .hv2-head-nm { color: #60a5fa; }
.hv2-head-zero .hv2-head-nm { color: #86efac; }

.hv2-head-sub {
  color: var(--text-muted);
  font-size: 16px;
}

.hv2-head-tag {
  display: inline-block;
  padding: 0 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 16px;
  font-weight: 400;
}

/* The number at the figure size, its unit half that (never under 16px):
   four digits and the unit take about 3.4em, so half the column / 3.5;
   a five-digit figure ("10.52 in") about 4.1em. */
.hv2-head-v {
  font: 600 clamp(24px, calc((50cqi - 8px - 4px) / 3.5), var(--ui-figure-max)) / 1.15 var(--font-mono);
  white-space: nowrap;
}

.hv2-head-long .hv2-head-v {
  font-size: clamp(22px, calc((50cqi - 8px - 4px) / 4.1), var(--ui-figure-max));
}

.hv2-head-u {
  font-size: max(16px, 0.5em);
}

/* Words in a figure's place ("Needs 2 shots"): text size, wrapping. */
.hv2-head-v.hv2-head-words,
.hv2-head-long .hv2-head-v.hv2-head-words {
  font: 600 var(--ui-text) / 1.3 var(--font-sans);
  white-space: normal;
  color: var(--text-muted);
}

.hv2-head-line {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 16px;
}

/* A figure in a line ("0.96 in") never breaks between number and unit. */
.hv2-head-line b {
  color: var(--text);
  white-space: nowrap;
}

/* Too narrow for two side by side: one column in the same order, every
   figure at the full-width size. */
@container (max-width: 250px) {
  .hv2-head {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }

  .hv2-head-v,
  .hv2-head-long .hv2-head-v {
    font-size: clamp(28px, calc((100cqi - 8px) / 4.1), var(--ui-figure-max));
  }
}

/* 3. A restyled page: <main class="ui-page"> -------------------------------- */

/* Body text 18px, never under 16px. */
.ui-page {
  font-size: var(--ui-text);
  line-height: 1.5;
}

/* The page title: 28px sentence case (24px on a phone), as the Hub's card
   titles, in place of the old small capitals label. */
.ui-page #page-heading h2 {
  margin: 0 0 var(--ui-space-5);
  font-size: var(--ui-title);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text);
}

@media (max-width: 720px) {
  .ui-page #page-heading h2 {
    font-size: var(--ui-title-phone);
  }
}

/* Section and sub-section headings. */
.ui-page h3,
.ui-page .ui-h2 {
  font-size: var(--ui-h2);
  line-height: 1.3;
}

.ui-page h4,
.ui-page .ui-h3 {
  font-size: var(--ui-h3);
  line-height: 1.35;
}

/* Fields: the Hub's 16px capitals label, an 18px value, 44px tall. */
.ui-page .field label,
.ui-page .radio-group legend {
  font-size: var(--ui-text-small);
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.ui-page .checkbox-field label {
  font-size: var(--ui-text);
  letter-spacing: 0;
  text-transform: none;
  color: var(--text);
}

.ui-page .checkbox-field input[type="checkbox"] {
  width: 22px;
  height: 22px;
}

.ui-page .field input:not([type="checkbox"]):not([type="radio"]),
.ui-page .field select,
.ui-page .field textarea {
  min-height: var(--ui-control);
  padding: 0 10px;
  border-radius: var(--ui-radius);
  font-size: var(--ui-text);
}

.ui-page .field textarea {
  padding: 10px;
}

.ui-page .field-hint,
.ui-page .carried-over-hint,
.ui-page .form-error,
.ui-page .panel-hint {
  font-size: var(--ui-text-small);
  line-height: 1.45;
}

.ui-page .empty-state {
  font-size: var(--ui-text);
}

/* Buttons: 18px, 44px tall, sentence case, never small capitals. */
.ui-page :is(button.primary, button.secondary, button.danger, .form-actions button, a.button-link),
.ui-btn {
  min-height: var(--ui-control);
  padding: 0 var(--ui-space-4);
  border-radius: var(--ui-radius);
  font: 600 var(--ui-text) / 1.2 var(--font-sans);
  letter-spacing: 0;
  text-transform: none;
}

.ui-page a.button-link {
  display: inline-flex;
  align-items: center;
}

/* Tables: 16px, even-width digits, headings in sentence case that wrap onto
   short lines so a column is as narrow as its numbers. A wide table scrolls
   inside its own box (.ui-table-wrap) with its first column pinned, the way
   Compare's ranking table does. */
.ui-page table.data-table th,
.ui-page table.data-table td,
.ui-table th,
.ui-table td {
  font-size: var(--ui-text-small);
  font-variant-numeric: tabular-nums;
  vertical-align: top;
}

.ui-page table.data-table th,
.ui-table th {
  letter-spacing: 0;
  text-transform: none;
  line-height: 1.25;
  vertical-align: bottom;
}

.ui-table-wrap {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--ui-radius);
}

.ui-table-wrap > table {
  max-width: none;
  border: 0;
  border-radius: 0;
  /* table.data-table clips with overflow: hidden, which stops a sticky
     first column sticking; the wrapper does the clipping instead. */
  overflow: visible;
}

.ui-table-wrap :is(th, td):first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  min-width: 9rem;
  background: var(--panel);
  /* Where the pinned column ends, once the rest slides under it. */
  box-shadow: inset -1px 0 0 var(--border-strong);
}

.ui-table-wrap th:first-child {
  background: var(--panel-raised);
}

/* A card on a restyled page (.results-group): the Hub's panel padding and
   corners. Its own heading is the 24px section heading above. */
.ui-page .results-group {
  padding: var(--ui-space-5);
  border-radius: var(--ui-radius-panel);
}

/* Account (account.html), 12 November 2026. Scoped here rather than changed
   in style.css because the admin area shares .button-link's look there. */
.ui-page .account-card h3 {
  margin: 0 0 var(--ui-space-4);
  font-size: var(--ui-h2);
}

.ui-page .account-facts {
  gap: var(--ui-space-2) var(--ui-space-5);
  margin: 0 0 var(--ui-space-4);
}

.ui-page .account-actions {
  gap: var(--ui-space-3);
}

.ui-page .account-card .button-link,
.ui-page .account-actions button,
.ui-page .account-sign-in-button {
  min-height: var(--ui-control);
  padding: 0 var(--ui-space-4);
  border-radius: var(--ui-radius);
  font: 600 var(--ui-text) / 1.2 var(--font-sans);
}

.ui-page .account-sign-in {
  padding: var(--ui-space-3) 0;
}

.ui-page .account-sign-in-current,
.ui-page .account-sign-in-when {
  font-size: var(--ui-text-small);
}

.ui-page .account-card p {
  margin: 0 0 var(--ui-space-3);
}

/* Analysis: each setting's Save is followed by space, so it never sits
   against the next setting's label. */
.ui-page #analysis .form-actions {
  margin: var(--ui-space-3) 0 var(--ui-space-6);
}

.ui-page #analysis .field-hint {
  margin-top: var(--ui-space-2);
}

/* Change password (account_password.html): one column, wide enough for an
   18px field. */
.ui-page #account-password-form {
  max-width: 32rem;
  gap: var(--ui-space-4);
}

/* A form panel and a table's row buttons on a restyled page (Firearms,
   Ammo types, Target types, Sessions and the session page share
   .profile-form, .row-actions and the delete confirmation). */
.ui-page .profile-form {
  padding: var(--ui-space-5);
  border-radius: var(--ui-radius-panel);
  gap: var(--ui-space-4) var(--ui-space-5);
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin-bottom: var(--ui-space-5);
}

.ui-page .profile-form h3 {
  padding: 0;
  color: var(--text);
  font-size: var(--ui-h2);
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
}

.ui-page .row-actions {
  gap: var(--ui-space-2);
}

.ui-page .row-actions button {
  min-height: var(--ui-control);
  padding: 0 var(--ui-space-3);
  border-radius: var(--ui-radius);
  font: 600 var(--ui-text-small) / 1.2 var(--font-sans);
}

.ui-page .delete-confirm-text {
  font-size: var(--ui-text);
}

.ui-page table.data-table td {
  vertical-align: middle;
}

.ui-page table.data-table td a.row-link {
  font-size: var(--ui-text);
}

.ui-page .archived-tag {
  font-size: var(--ui-text-small);
}

.ui-page .empty-state {
  max-width: none;
  border-radius: var(--ui-radius-panel);
}

/* Chips (count-chip: "6 targets", a firearm, "1 drill target"). */
.ui-page .count-chip {
  font-size: var(--ui-text-small);
}

/* The All / Targets / Drills switch: the Hub's segmented look, 44px tall. */
.ui-page .kind-filter-option {
  min-height: var(--ui-control);
  padding: 0 var(--ui-space-4);
  font: 600 var(--ui-text) / 1.2 var(--font-sans);
}

/* Sessions (sessions.html), 12 November 2026. */
.ui-page .sessions-head {
  margin-bottom: var(--ui-space-4);
}

.ui-page .sessions-filters {
  gap: var(--ui-space-3) var(--ui-space-5);
  padding: var(--ui-space-4) var(--ui-space-5);
  border-radius: var(--ui-radius-panel);
  margin-bottom: var(--ui-space-6);
}

.ui-page .sessions-filters .field.sessions-filter-field {
  flex: 0 1 240px;
}

.ui-page .sessions-filter-summary {
  font-size: var(--ui-text-small);
}

.ui-page .session-month {
  gap: var(--ui-space-3);
  margin-bottom: var(--ui-space-6);
}

.ui-page .session-month-heading {
  font-size: var(--ui-h3);
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text);
}

.ui-page .session-month-heading span {
  color: var(--text-muted);
  font-size: var(--ui-text-small);
}

.ui-page .session-cards {
  gap: var(--ui-space-4);
}

.ui-page .session-card {
  gap: var(--ui-space-3);
  padding: var(--ui-space-4) var(--ui-space-5);
  border-radius: var(--ui-radius-panel);
}

.ui-page a.session-card-date {
  font-size: var(--ui-h3);
}

.ui-page .session-card-where,
.ui-page .session-thumbs-more {
  font-size: var(--ui-text-small);
}

.ui-page .session-card-rounds,
.ui-page .session-card-notes,
.ui-page .session-fact {
  font-size: var(--ui-text);
}

.ui-page .session-card-facts {
  gap: var(--ui-space-2);
  padding-top: var(--ui-space-3);
}

/* The session page (session_detail.html), 12 November 2026. Its target
   cards' figures are the Hub's own pair and rows (hub_v2.css), unchanged. */
.ui-page .session-actions {
  gap: var(--ui-space-2);
}

.ui-page .session-actions button,
.ui-page .session-actions a.button-link {
  min-height: var(--ui-control);
  padding: 0 var(--ui-space-4);
  border-radius: var(--ui-radius);
  font: 600 var(--ui-text) / 1.2 var(--font-sans);
  letter-spacing: 0;
  text-transform: none;
}

.ui-page .drill-note,
.ui-page .pooled-note,
.ui-page .headline-figure-label,
.ui-page .headline-figure-sub,
.ui-page .target-card-number,
.ui-page .kind-chip,
.ui-page .target-photo-placeholder,
.ui-page .target-photo-link,
.ui-page .link-button {
  font-size: var(--ui-text-small);
}

.ui-page .target-card-title {
  font-size: var(--ui-h3);
}

/* A card's own section headings ("Details", "Group metrics", "Runs") and
   rows of figures. */
.ui-page .results-group h2 {
  font-size: var(--ui-h3);
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text);
}

.ui-page .result-label,
.ui-page .help-link,
.ui-page .timing-verdict-caveat,
.ui-page .timing-count-note,
.ui-page .save-kind-hint,
.ui-page .save-kind legend {
  font-size: var(--ui-text-small);
}

.ui-page .result-value {
  font-size: var(--ui-text);
}

.ui-page .drill-card-result-link {
  font-size: var(--ui-text);
}

.ui-page .target-card-toggle,
.ui-page .link-button {
  display: inline-flex;
  align-items: center;
  min-height: var(--ui-control);
}

.ui-page .target-card {
  max-width: none;
  padding: var(--ui-space-4) var(--ui-space-5);
  border-radius: var(--ui-radius-panel);
}

/* The firearm page (firearm_detail.html), 12 November 2026: every one of
   its own small text styles raised to 16px (derived from style.css: each
   page rule this page uses that set text under 16px), its section headings
   24px, and its dropdowns, tabs, chips and row toggles 44px tall. */
.ui-page :is(.firearm-comparison-flag-badge, .fp-bar-field label, .fp-best-summary, .fp-best-tag,
  .fp-big small, .fp-caption, .fp-chip-count, .fp-config, .fp-differs, .fp-drills-setup, .fp-figures,
  .fp-filter > summary, .fp-header-note, .fp-inside, .fp-key-item, .fp-key-title, .fp-kicker,
  .fp-left-out, .fp-lifetime-label, .fp-link-button, .fp-none, .fp-prov, .fp-row-label,
  .fp-runner-figure, .fp-stat dt, .fp-subtitle, .fp-tied-with, .fp-ww-row-count,
  .option-comparison-fixed-field label, .option-comparison-note, .option-comparison-unrecorded-note,
  .fp-reference label, .fp-reference span) {
  font-size: var(--ui-text-small);
}

.ui-page :is(.fp-card-title, .fp-chip, .fp-tab, .option-comparison-tab) {
  font-size: var(--ui-text-small);
  font-weight: 600;
}

.ui-page .fp-card-title {
  font-size: var(--ui-text);
}

.ui-page .fp-section-title,
.ui-page .fp-settings .results-group h2 {
  font-size: var(--ui-h2);
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text);
}

.ui-page :is(.fp-bar-select, .option-comparison-select, .inline-input, .fp-reference-input) {
  min-height: var(--ui-control);
  font-size: var(--ui-text);
  border-radius: var(--ui-radius);
}

.ui-page :is(.fp-chip, .fp-tab, .option-comparison-tab, .fp-filter > summary, .fp-link-button) {
  min-height: var(--ui-control);
}

.ui-page .row-toggle {
  min-width: var(--ui-control);
  min-height: var(--ui-control);
  font-size: var(--ui-text-small);
}

/* The firearm page's session history, folded (13 November 2026): the
   Precision and Accuracy figures in the pair's figure face, and the expanded
   row's folded figures as a wrapping list. */
.ui-page #session-history-groups td:nth-child(4),
.ui-page #session-history-groups .session-history-row td:nth-child(5) > span:first-child {
  font-family: var(--font-mono);
  font-weight: 600;
}

.ui-page #session-history-groups .hv2-head-line {
  margin-top: 2px;
  font-size: var(--ui-text-small);
}

.ui-page .session-history-more {
  display: flex;
  flex-wrap: wrap;
  gap: var(--ui-space-2) var(--ui-space-5);
  margin: 0;
  white-space: normal;
  /* Stays in view and wraps to the visible width while the table beside it
     scrolls, so a phone shows all seven without a swipe. */
  position: sticky;
  left: var(--ui-space-3);
  max-width: min(calc(100vw - 10rem), 60rem);
}

.ui-page .session-history-more dt {
  color: var(--text-muted);
  font-size: var(--ui-text-small);
}

.ui-page .session-history-more dd {
  margin: 0;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* The expanded row is not pinned: it spans the table. */
.ui-page .ui-table-wrap tr:is(.session-history-more-row, .session-target-more) > td:first-child {
  position: static;
  box-shadow: none;
}

/* The Drills pages (drills.html, drill_detail.html, drill_result.html),
   12 November 2026: every page style they use that set text under 16px
   raised to 16px (derived from style.css, as the firearm page's), their
   panel titles 24px, and their buttons the shared button. The charts' own
   SVG text is drawn to the chart's scale and is left alone. */
.ui-page :is(.drill-card-empty, .drill-card-setup, .drill-edit-note, .drill-exclusion-note,
  .drill-figure-note, .drill-page-scope, .drill-panel-caption, .drill-panel-subtitle,
  .drill-record-date, .drill-result-badge, .drill-result-context, .drill-result-context-label,
  .drill-result-empty-runs, .drill-result-figure dt, .drill-result-measure-label,
  .drill-result-measure-sub, .drill-result-photo-note, .drill-result-splits-title,
  .drill-result-target-meta, .drill-runs-ask-text, .drill-runs-preview, .drill-settings-group-dates,
  .drill-settings-groups-intro, .drill-settings-history li, .drill-settings-line,
  .drill-settings-note, .drill-setup-label, .drill-timeline-line, .drill-verdict,
  .drills-config-label, .drills-config-value, .drills-glance-all, .drills-glance-sub,
  .drills-history-clean, .drills-history-links, .drills-history-timing, .recalibrate-run-note,
  .timing-run-splits) {
  font-size: var(--ui-text-small);
}

.ui-page :is(.drills-glance-name, .drills-config-all, .drill-card-result-link) {
  font-size: var(--ui-text);
}

/* 44px tall by padding, not display: flex, which would drop the
   disclosure arrow. */
.ui-page #drills-configure-summary {
  min-height: var(--ui-control);
  padding-block: 10px;
  box-sizing: border-box;
}

.ui-page .results-group h4.drill-result-run-title {
  font-size: var(--ui-h3);
}

.ui-page .results-group h3.drill-panel-title,
.ui-page h3.drill-panel-title {
  font-size: var(--ui-h2);
  letter-spacing: 0;
  text-transform: none;
}

.ui-page :is(.drill-runs-ask button, .drills-config-actions button, .drill-what-if-row button,
  .drill-radius-row button, .drills-head button) {
  min-height: var(--ui-control);
  padding: 0 var(--ui-space-4);
  border-radius: var(--ui-radius);
  font: 600 var(--ui-text) / 1.2 var(--font-sans);
  letter-spacing: 0;
  text-transform: none;
}

/* Instructions and Privacy (instructions.html, privacy.html), 12 November
   2026: 18px reading text at a comfortable measure, headings 28/24/20px,
   the page list and "On this page" at 16px and above. */
.ui-page .instructions-section {
  max-width: 72ch;
  padding: var(--ui-space-5) var(--ui-space-6);
  border-radius: var(--ui-radius-panel);
  font-size: var(--ui-text);
  line-height: 1.6;
}

.ui-page .instructions-section h1 {
  font-size: var(--ui-title);
  line-height: 1.25;
}

.ui-page .instructions-section h2 {
  margin-top: var(--ui-space-6);
  font-size: var(--ui-h2);
  line-height: 1.3;
}

.ui-page .instructions-section h3 {
  margin-top: var(--ui-space-5);
  font-size: var(--ui-h3);
}

.ui-page #instructions-toc,
.ui-page .instructions-pages-menu {
  border-radius: var(--ui-radius-panel);
  font-size: var(--ui-text-small);
}

.ui-page #instructions-toc a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
}

.ui-page .instructions-onpage-title {
  font-size: var(--ui-text-small);
}

.ui-page .instructions-pager a {
  font-size: var(--ui-text);
}

@media (max-width: 720px) {
  .ui-page .instructions-section {
    padding: var(--ui-space-4);
  }
}

/* The admin area (admin_base.html's main), 12 November 2026: its own
   small styles raised to 16px (derived from style.css), its headings 24px,
   its action links and buttons the shared button. */
.ui-page :is(.admin-health-tile p, .admin-pill, .admin-record, .admin-row-action) {
  font-size: var(--ui-text-small);
}

.ui-page .admin-invite-form .form-actions {
  margin: var(--ui-space-3) 0 var(--ui-space-6);
}

.ui-page.admin-main h2 {
  font-size: var(--ui-h2);
  line-height: 1.3;
}

.ui-page :is(.admin-actions button, .form-actions .admin-action-link),
.ui-page.admin-main .button-link {
  min-height: var(--ui-control);
  padding: 0 var(--ui-space-4);
  border-radius: var(--ui-radius);
  font: 600 var(--ui-text) / 1.2 var(--font-sans);
  letter-spacing: 0;
  text-transform: none;
}

/* The Mark tab (index.html), 13 November 2026, with care. Only the parts
   that are not under a finger while marking opt in: the setup picker
   (#mark-setup), the results under the canvas (#results), the save form
   and the dialogs, each carrying .ui-page itself. The toolbar, the canvas
   toolbar, the canvas and the magnifier keep their own styles exactly, so
   nothing above or around the photo changes size while marking. */
.ui-title#page-heading h2 {
  margin: 0 0 var(--ui-space-5);
  font-size: var(--ui-title);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text);
}

@media (max-width: 720px) {
  .ui-title#page-heading h2 {
    font-size: var(--ui-title-phone);
  }
}

.ui-page#mark-setup h3 {
  font-size: var(--ui-h2);
}

.ui-page :is(.mark-setup-name, .mark-setup-step) {
  font-size: var(--ui-text);
  letter-spacing: 0;
  text-transform: none;
}

.ui-page :is(.mark-setup-description, .mark-setup-summary-text, #mark-setup-summary, .mark-setup-tip) {
  font-size: var(--ui-text-small);
}

.ui-page .mark-setup-mode-btn {
  min-height: var(--ui-control);
  font-size: var(--ui-text);
}

.ui-page#results .results-group h2 {
  font-size: var(--ui-h3);
}

.ui-page :is(.save-kind legend, .save-kind-hint, .carried-over-hint, .caliber-notice) {
  font-size: var(--ui-text-small);
}

/* A large figure and its label, as on the Hub's tiles. */
.ui-tile {
  display: flex;
  flex-direction: column;
  gap: var(--ui-space-1);
  min-width: 0;
  padding: var(--ui-space-3) var(--ui-space-4);
  background: var(--panel-raised);
  border: 1px solid var(--border);
  border-radius: var(--ui-radius);
}

.ui-figure {
  font: 600 var(--ui-figure) / 1.15 var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* A figure's place taken by words ("Needs 2 shots"): text size, muted. */
.ui-figure.ui-words {
  font: 600 var(--ui-text) / 1.3 var(--font-sans);
  color: var(--text-muted);
}

/* A notice: a short message with a coloured left edge. */
.ui-notice {
  margin: 0;
  padding: var(--ui-space-3) var(--ui-space-4);
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent-scale);
  border-radius: var(--ui-radius);
  font-size: var(--ui-text);
}

/* A band reaching the page's edges, as the Hub's cards, for a page made of
   a few large sections. */
.ui-band {
  margin-left: calc(-1 * max(2rem, env(safe-area-inset-left, 0px)));
  margin-right: calc(-1 * max(2rem, env(safe-area-inset-right, 0px)));
  padding: var(--ui-space-7) max(2rem, env(safe-area-inset-right, 0px)) var(--ui-space-7) max(2rem, env(safe-area-inset-left, 0px));
  border-top: 4px solid var(--ui-band-edge, var(--border-strong));
}

@media (max-width: 380px) {
  .ui-band {
    margin-left: calc(-1 * max(12px, env(safe-area-inset-left, 0px)));
    margin-right: calc(-1 * max(12px, env(safe-area-inset-right, 0px)));
    padding-left: max(12px, env(safe-area-inset-left, 0px));
    padding-right: max(12px, env(safe-area-inset-right, 0px));
  }
}

/* The session page's red Delete at least AA at every width (13 November
   2026, the owner's request; it was phones only, and sat just under 4.5:1).
   Compare's own near-misses are fixed in compare_v2.css. */
.ui-page .row-actions button.danger {
  color: #f47272;
}

/* 4. Phones ------------------------------------------------------------------
   Below 600px wide only (the owner's, 13 November 2026), for every page at
   once, the Hub and Compare included; a laptop or tablet is unchanged
   (scripts/style_parity.py at 1280px proves it). Large figures at most 40px,
   their units half that as before, so a card's figures stay one size; body
   text and captions 16px; headings a step down; tighter padding and less
   space between sections. The charts' own phone sizes (thinner lines,
   smaller points, fainter gridlines, 44px tap areas) are drawn by their
   scripts (hv2pPhone). The Mark tab's toolbar and photo area carry no
   ui-page class and none of these rules touch them. */
@media (max-width: 599px) {
  :root {
    --ui-text: 16px;
    --ui-title: 24px;
    --ui-title-phone: 24px;
    --ui-h2: 20px;
    --ui-h3: 18px;
    --ui-figure-max: 40px;
    --ui-space-5: 16px;
    --ui-space-6: 24px;
    --ui-space-7: 32px;
    --ui-space-8: 40px;
  }

  /* The Hub's and Compare's cards: titles a step down, less room between
     cards and between the parts of a card, tighter tiles and panels. */
  .hv2-page .hv2-card {
    gap: 14px;
    padding-top: 40px;
    padding-bottom: 40px;
  }

  .hv2-page .hv2-card-head h2 {
    font-size: 24px;
  }

  .hv2-page .hv2-card-body {
    gap: 14px;
  }

  .hv2-panel,
  .ui-panel {
    gap: 12px;
    padding: 12px;
  }

  .hv2-page :is(.hv2s-tile, .hv2a-panel) {
    padding: 10px;
  }

  .hv2-page .hv2p-fig {
    padding: 10px 4px 10px 12px;
  }

  .hv2-page .hv2u-item {
    gap: 12px;
    padding: 10px 12px;
  }

  /* The drill charts (drill_charts.js draws their points two-thirds the
     size): lines two-thirds as wide, gridlines and rings fainter. */
  .drill-line {
    stroke-width: 1.33px;
  }

  .drill-grid {
    stroke-opacity: 0.55;
  }

  /* Their labels at the phone's 16px (12.5px on a laptop); each chart is
     drawn at its box's own width, so 16px is 16px on the screen. */
  .drill-chart text {
    font-size: 16px;
  }

  /* A code sample at the 16px minimum, wrapping rather than push the page
     sideways. */
  .ui-page code {
    font-size: 16px;
    overflow-wrap: anywhere;
  }

  /* How far can I still shoot well? keeps its points a 44px tap apart
     (hv2pChart on a phone), so with many distances on a narrow phone it
     scrolls inside its own box, as the Hub's other charts already do. */
  #hv2-range .hv2p-chart {
    overflow-x: auto;
  }
}
