/* Miner Replaced — field manual design system.
   Tokens from the approved design direction: warm off-white paper and ink,
   moss green actions, ochre highlights, charcoal code surfaces. */

:root {
  --surface: #f5f3e9;
  --surface-alt: #ebeadd;
  --panel: #fbfaf2;
  --ink: #242b26;
  --muted: #566158;
  --accent: #345742;
  --accent-dark: #2a4536;
  --ochre: #c59636;
  --warning: #88572b;
  --border: #d6d9cc;
  --charcoal: #242b26;
  --charcoal-ink: #e8e6da;

  --font-body: ui-sans-serif, system-ui, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Consolas, monospace;

  --radius-control: 5px;
  --radius-panel: 10px;

  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px;
  --sp-5: 24px; --sp-6: 32px; --sp-7: 48px; --sp-8: 64px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: clamp(17px, 1.1vw, 18px);
  line-height: 1.72;
}

::selection { background: rgba(197, 150, 54, 0.35); }

h1, h2, h3 { font-family: var(--font-body); font-weight: 700; line-height: 1.2; }
h1 { font-size: clamp(32px, 4.4vw, 60px); line-height: 1.07; letter-spacing: -0.015em; margin: 0 0 var(--sp-4); }
h2 { font-size: clamp(24px, 2.4vw, 32px); margin: 0 0 var(--sp-4); }
h3 { font-size: 21px; line-height: 1.35; margin: 0 0 var(--sp-3); }
p { margin: 0 0 var(--sp-4); }
ul, ol { margin: 0 0 var(--sp-4); padding-left: var(--sp-5); }
li { margin-bottom: var(--sp-2); }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--accent-dark); }
strong { font-weight: 650; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }

.wrap { max-width: 1180px; margin: 0 auto; padding-left: var(--sp-5); padding-right: var(--sp-5); }

.visually-hidden, .skip-link:not(:focus) {
  position: absolute; width: 1px; height: 1px; margin: -1px;
  clip: rect(0 0 0 0); clip-path: inset(50%); overflow: hidden; white-space: nowrap;
}
.skip-link:focus {
  position: absolute; top: var(--sp-2); left: var(--sp-2); z-index: 10;
  background: var(--accent); color: var(--surface); padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius-control); text-decoration: none;
}

/* ------------------------------------------------------------- header */

.site-header { border-bottom: 1px solid var(--border); background: var(--surface); }
.site-header-inner { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4); flex-wrap: wrap; padding-top: var(--sp-3); padding-bottom: var(--sp-3); }
.brand { display: inline-flex; align-items: center; gap: var(--sp-3); color: var(--ink); text-decoration: none; min-height: 44px; }
.brand:hover { color: var(--ink); }
.brand-mark { color: var(--accent); flex: none; }
.brand-name { font-weight: 700; font-size: 19px; letter-spacing: -0.01em; }
.brand-tag { font-size: 12px; color: var(--muted); border: 1px solid var(--border); border-radius: var(--radius-control); padding: 1px 7px; text-transform: uppercase; letter-spacing: 0.06em; }
.site-nav { display: flex; gap: var(--sp-1); flex-wrap: wrap; }
.site-nav a {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 var(--sp-3);
  color: var(--ink); text-decoration: none; border-radius: var(--radius-control); font-weight: 550;
}
.site-nav a:hover { background: var(--surface-alt); color: var(--ink); }

/* --------------------------------------------------------------- hero */

.hero { padding: var(--sp-7) 0 var(--sp-6); }
.hero-inner { display: grid; grid-template-columns: 1.05fr 0.95fr; gap: var(--sp-7); align-items: center; }
.hero-lead { font-size: 1.14em; line-height: 1.62; color: var(--ink); margin-bottom: var(--sp-4); }
.hero-cta { display: flex; gap: var(--sp-3); flex-wrap: wrap; margin: 0 0 var(--sp-4); }
.hero-facts {
  font-size: 14px; color: var(--muted); margin: 0;
  border-top: 1px solid var(--border); padding-top: var(--sp-3);
}
.hero-figure { margin: 0; border: 1px solid var(--border); border-radius: var(--radius-panel); overflow: hidden; background: var(--panel); }
.hero-figure img { display: block; width: 100%; height: auto; }
.hero-figure figcaption { font-size: 13px; color: var(--muted); padding: var(--sp-2) var(--sp-3); border-top: 1px solid var(--border); }

/* ----------------------------------------------------------- sections */

.section { padding: var(--sp-6) 0; }
.section-title { margin-bottom: var(--sp-4); }
.section-lede { color: var(--muted); max-width: 70ch; }

.chip {
  font: inherit; font-size: 14px; min-height: 44px; padding: var(--sp-2) var(--sp-4);
  border: 1px solid var(--border); border-radius: var(--radius-control);
  background: var(--panel); color: var(--ink); cursor: pointer;
}
.chip:hover { border-color: var(--accent); }
.chip--active, .chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--surface); }
.chip--static { min-height: 0; padding: 2px 10px; cursor: default; background: var(--surface-alt); font-size: 13px; }
.chip--static:hover { border-color: var(--border); }
.chip--reset { border-style: dashed; color: var(--muted); }
.chip--reset:hover { color: var(--accent); border-color: var(--accent); }

/* ---------------------------------------------------------- directory */

.directory-controls { display: flex; flex-wrap: wrap; gap: var(--sp-3); align-items: center; margin-bottom: var(--sp-5); }
.directory-filter { flex: 1 1 260px; }
.directory-filter input {
  width: 100%; font: inherit; min-height: 44px; padding: var(--sp-2) var(--sp-4);
  border: 1px solid var(--border); border-radius: var(--radius-control); background: var(--panel); color: var(--ink);
}
.directory-filter input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 2px rgba(52, 87, 66, 0.25); }
.directory-chips { display: flex; gap: var(--sp-2); flex-wrap: wrap; }

.directory-list { list-style: none; margin: 0; padding: 0; border-bottom: 1px solid var(--border); }
.directory-item { margin: 0; border-top: 1px solid var(--border); }
.directory-item a {
  display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--sp-1);
  padding: var(--sp-4) var(--sp-2); color: var(--ink); text-decoration: none; border-radius: var(--radius-control);
}
.directory-item a:hover { background: var(--surface-alt); }
.directory-item-title { font-weight: 650; font-size: 1.05em; }
.directory-item a:hover .directory-item-title { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.directory-item-desc { color: var(--muted); font-size: 0.95em; line-height: 1.55; }
.directory-item-meta { display: flex; gap: var(--sp-3); align-items: center; margin-top: var(--sp-1); }
.directory-updated { font-size: 13px; color: var(--muted); }
.directory-empty { color: var(--muted); padding: var(--sp-4) var(--sp-2); }

/* ------------------------------------------------------- reading path */

.path-list { list-style: none; margin: 0; padding: 0; max-width: 70ch; }
.path-step { display: flex; gap: var(--sp-4); align-items: baseline; padding: var(--sp-3) 0; border-top: 1px solid var(--border); margin: 0; }
.path-step:last-child { border-bottom: 1px solid var(--border); }
.path-step-n {
  flex: none; width: 32px; height: 32px; border-radius: 50%; align-self: center;
  border: 1.5px solid var(--accent); color: var(--accent);
  display: inline-flex; align-items: center; justify-content: center; font-weight: 650; font-size: 15px;
}
.path-step-title { margin: 0; font-weight: 650; }
.path-step-note { margin: 0; color: var(--muted); font-size: 0.93em; }

/* ------------------------------------------------------- feature strip */

.feature-strip { background: var(--surface-alt); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: var(--sp-7) 0; margin-top: var(--sp-6); }
.feature-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: var(--sp-5); margin-top: var(--sp-5); }
.feature-card {
  display: flex; gap: var(--sp-4); align-items: flex-start;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-panel);
  padding: var(--sp-5); color: var(--ink); text-decoration: none;
}
.feature-card:hover { border-color: var(--accent); box-shadow: 0 2px 0 0 rgba(52, 87, 66, 0.18); }
.feature-card-body { display: flex; flex-direction: column; gap: var(--sp-2); }
.feature-card-title { font-weight: 650; font-size: 1.05em; }
.feature-card-desc { color: var(--muted); font-size: 0.93em; line-height: 1.55; }
.feature-card-cta { color: var(--accent); font-weight: 650; font-size: 0.93em; margin-top: var(--sp-1); }
.feature-card-cta::after { content: " →"; }

/* ------------------------------------------------------------ article */

.article-layout {
  display: grid; gap: 0 var(--sp-7); padding-top: var(--sp-6); padding-bottom: var(--sp-7);
  grid-template-columns: minmax(0, 70ch) minmax(180px, 240px);
  grid-template-areas: "head head" "main toc";
  justify-content: space-between;
}
.article-head { grid-area: head; max-width: 70ch; margin-bottom: var(--sp-5); }
.article-head h1 { font-size: clamp(30px, 3.4vw, 48px); line-height: 1.12; }
.prose { grid-area: main; max-width: 70ch; }

.breadcrumbs { font-size: 14px; color: var(--muted); margin-bottom: var(--sp-4); }
.breadcrumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.breadcrumbs li { margin: 0; display: flex; gap: var(--sp-2); align-items: center; }
.breadcrumbs li + li::before { content: "/"; color: var(--border); }
.breadcrumbs a { color: var(--muted); }

.lead {
  font-size: 1.13em; line-height: 1.62;
  border-left: 3px solid var(--ochre); padding-left: var(--sp-4); margin-bottom: var(--sp-4);
}
.article-meta { display: flex; gap: var(--sp-3); align-items: center; font-size: 14px; color: var(--muted); margin: 0; }

.article-section { margin-top: var(--sp-7); }
.article-section > h2 { border-top: 1px solid var(--border); padding-top: var(--sp-5); }
.prose h3 { margin-top: var(--sp-5); }

.prose code { font-family: var(--font-mono); font-size: 0.88em; background: var(--surface-alt); padding: 1px 6px; border-radius: 4px; }
.prose pre {
  background: var(--charcoal); color: var(--charcoal-ink); border-radius: var(--radius-panel);
  padding: var(--sp-4) var(--sp-5); overflow-x: auto; margin: 0 0 var(--sp-4);
}
.prose pre code { background: none; padding: 0; font-size: 14px; line-height: 1.6; color: inherit; }

.prose dl { margin: 0 0 var(--sp-4); }
.prose dt { font-weight: 650; margin-top: var(--sp-3); }
.prose dd { margin: 0 0 var(--sp-2) var(--sp-5); }
.prose details {
  border: 1px solid var(--border); border-radius: var(--radius-control);
  background: var(--panel); padding: var(--sp-3) var(--sp-4); margin: 0 0 var(--sp-4);
}
.prose summary { font-weight: 650; cursor: pointer; }
.prose summary::marker { color: var(--accent); }
.prose details > *:last-child { margin-bottom: 0; }
.prose figure { margin: 0 0 var(--sp-5); }
.prose figure svg { display: block; max-width: 100%; height: auto; }
.prose figure img {
  display: block; max-width: 100%; height: auto;
  border: 1px solid var(--border); border-radius: var(--radius-panel);
}
.prose figure figcaption { font-size: 14px; color: var(--muted); margin-top: var(--sp-2); max-width: 60ch; }

.figure, .diagram { margin: 0 0 var(--sp-5); }
.diagram svg { display: block; max-width: 320px; width: 100%; height: auto; }
.diagram figcaption { font-size: 14px; color: var(--muted); margin-top: var(--sp-2); max-width: 60ch; }

/* ---------------------------------------------------------------- toc */

.toc { grid-area: toc; }
.toc nav {
  position: sticky; top: var(--sp-5);
  border: 1px solid var(--border); border-radius: var(--radius-panel); background: var(--panel);
  padding: var(--sp-4);
}
.toc-title { font-size: 13px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); margin: 0 0 var(--sp-2); }
.toc ul { list-style: none; margin: 0; padding: 0; }
.toc li { margin: 0; }
.toc a {
  display: block; padding: var(--sp-2) var(--sp-2); font-size: 15px; line-height: 1.4;
  color: var(--muted); text-decoration: none; border-radius: var(--radius-control);
}
.toc a:hover { color: var(--ink); background: var(--surface-alt); }

/* ------------------------------------------------------------ exercise */

.exercise {
  border: 1px solid var(--border); border-radius: var(--radius-panel); background: var(--panel);
  padding: var(--sp-5); margin: 0 0 var(--sp-5);
}
.exercise-stage svg { display: block; max-width: 340px; width: 100%; height: auto; }
.exercise-hint { font-size: 14px; color: var(--muted); margin: var(--sp-2) 0 var(--sp-4); }

.exercise-live { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--sp-5); align-items: start; margin-bottom: var(--sp-4); }
.exercise-live[hidden] { display: none; }
.exercise-live svg { display: block; max-width: 340px; width: 100%; height: auto; }
.exercise-panel { display: flex; flex-direction: column; gap: var(--sp-3); }
.exercise-status {
  font-family: var(--font-mono); font-size: 14px; line-height: 1.5;
  background: var(--surface-alt); border-radius: var(--radius-control); padding: var(--sp-3) var(--sp-4); margin: 0;
}
.exercise-status strong { color: var(--accent); }
.exercise-controls { display: flex; gap: var(--sp-3); flex-wrap: wrap; }

.button, .exercise-controls button {
  font: inherit; font-weight: 650; min-height: 44px; padding: var(--sp-2) var(--sp-5);
  border-radius: var(--radius-control); border: 1px solid var(--accent);
  background: var(--accent); color: var(--surface); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center;
}
.button:hover, .exercise-controls button:hover { background: var(--accent-dark); border-color: var(--accent-dark); color: var(--surface); }
.button--ghost { background: transparent; color: var(--accent); }
.button--ghost:hover { background: var(--surface-alt); color: var(--accent-dark); border-color: var(--accent-dark); }
.exercise-controls button:disabled { opacity: 0.45; cursor: default; background: var(--accent); }
.exercise-controls button.secondary { background: transparent; color: var(--accent); }
.exercise-controls button.secondary:hover { background: var(--surface-alt); color: var(--accent-dark); }

/* -------------------------------------------------------------- tables */

/* Authored tables sit in .table-wrap: on narrow screens the table scrolls
   sideways inside the component, while captions and surrounding
   instructions stay put. Cells wrap so labels stay readable. */
.table-wrap {
  overflow-x: auto; margin: 0 0 var(--sp-5);
  border: 1px solid var(--border); border-radius: var(--radius-panel); background: var(--panel);
}
.table-wrap:focus-visible { outline-offset: 4px; }
.table-wrap table { border-collapse: collapse; width: 100%; font-size: 15px; line-height: 1.5; }
.table-wrap caption { font-size: 14px; color: var(--muted); text-align: left; padding: var(--sp-3) var(--sp-4) 0; }
.table-wrap th, .table-wrap td { text-align: left; vertical-align: top; padding: var(--sp-2) var(--sp-3); border-bottom: 1px solid var(--border); }
.table-wrap th { font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); font-weight: 650; }
.table-wrap tbody tr:last-child td { border-bottom: none; }

/* ------------------------------------------------------------ grid svg */

.grid-svg .grid-axis { font-family: var(--font-mono); font-size: 11px; fill: var(--muted); }
.grid-svg .grid-cell { fill: var(--surface-alt); stroke: var(--border); stroke-width: 1.2; }
.grid-svg .grid-cell--target { fill: rgba(197, 150, 54, 0.22); stroke: var(--ochre); }
.grid-svg .grid-move { stroke: var(--ochre); stroke-width: 3; stroke-linecap: round; fill: none; }
.grid-svg .grid-drone { fill: var(--accent); stroke: var(--ink); stroke-width: 1.5; }
.grid-svg .grid-marker-label { font-family: var(--font-body); font-size: 11px; fill: var(--muted); }
.grid-svg .grid-flag { fill: var(--warning); }
.grid-svg--mini { width: 96px; flex: none; }
.grid-svg--mini .grid-move { stroke-width: 3.5; }

/* Live exercise svg state colors */
.grid-svg .grid-cell--visited { fill: rgba(52, 87, 66, 0.09); }
.grid-svg .grid-cell--current { fill: rgba(52, 87, 66, 0.18); stroke: var(--accent); stroke-width: 2; }

@media (prefers-reduced-motion: no-preference) {
  .grid-svg .grid-drone { transition: cx 160ms ease-out, cy 160ms ease-out; }
  .feature-card { transition: box-shadow 160ms ease-out; }
}

/* --------------------------------------------------------- sorting svg */

.sort-svg .sort-token-box { fill: var(--surface-alt); stroke: var(--border); stroke-width: 1.2; }
.sort-svg .sort-token-num { font-family: var(--font-mono); font-size: 20px; font-weight: 650; fill: var(--ink); }
.sort-svg .sort-bracket { stroke: var(--ochre); stroke-width: 2; }
.sort-svg .sort-bracket-label { font-family: var(--font-body); font-size: 11px; fill: var(--muted); }

/* Live sorting workbench (DOM tokens, not SVG). */
.sort-stage { min-width: 0; }
.sort-tokens { display: flex; gap: var(--sp-3); flex-wrap: wrap; }
.sort-token {
  width: 56px; height: 56px; border-radius: var(--radius-control);
  border: 1.5px solid var(--border); background: var(--surface-alt);
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 20px; font-weight: 650;
}
.sort-token--compare { border-color: var(--ochre); background: rgba(197, 150, 54, 0.16); }
.sort-token--swapped { border-color: var(--accent); background: rgba(52, 87, 66, 0.14); }
.sort-passline { margin: var(--sp-3) 0 0; font-size: 14px; color: var(--muted); min-height: 1.5em; }

/* ------------------------------------------------------ minesweeper svg */

.mine-examples { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: var(--sp-5); margin-bottom: var(--sp-4); }
.mine-example h3 { font-size: 16px; margin-bottom: var(--sp-2); }
.mine-svg { display: block; width: 100%; max-width: 210px; height: auto; }
.mine-svg .mine-cell { fill: var(--surface-alt); stroke: var(--border); stroke-width: 1.2; }
.mine-svg .mine-cell--clue { fill: var(--charcoal); stroke: var(--charcoal); }
.mine-svg .mine-cell-text.mine-cell--clue-text { fill: var(--charcoal-ink); font-weight: 700; }
.mine-svg .mine-cell--safe { fill: rgba(52, 87, 66, 0.12); stroke: rgba(52, 87, 66, 0.45); }
.mine-svg .mine-cell--proven { fill: rgba(136, 87, 43, 0.16); stroke: var(--warning); }
.mine-svg .mine-cell--unknown { fill: var(--surface); stroke: var(--ochre); stroke-dasharray: 4 3; }
.mine-svg .mine-cell--revealed-safe { fill: rgba(52, 87, 66, 0.22); stroke: var(--accent); stroke-dasharray: none; }
.mine-svg .mine-cell--revealed-mine { fill: rgba(136, 87, 43, 0.3); stroke: var(--warning); stroke-dasharray: none; }
.mine-svg .mine-cell--ambiguous { fill: rgba(197, 150, 54, 0.2); stroke: var(--ochre); }
.mine-svg .mine-cell-text { font-family: var(--font-mono); font-size: 14px; font-weight: 650; fill: var(--ink); }
.mine-svg .mine-dot { fill: var(--warning); }
.mine-svg .mine-check { stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.mine-conclusion { font-size: 0.95em; margin: var(--sp-3) 0 0; }
.mine-conclusion[hidden] { display: none; }
.mine-example > button {
  font: inherit; font-weight: 650; min-height: 44px; padding: var(--sp-2) var(--sp-4);
  border-radius: var(--radius-control); border: 1px solid var(--accent);
  background: var(--accent); color: var(--surface); cursor: pointer; margin-top: var(--sp-3);
}
.mine-example > button:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.mine-example > button:disabled { opacity: 0.45; cursor: default; }
.exercise-controls--mines { margin-top: var(--sp-2); }

/* Mini previews inside feature cards keep their fixed small size. */
svg.grid-svg--mini { width: 96px; max-width: 96px; }

/* ------------------------------------------------------ related/sources */

.related, .sources { margin-top: var(--sp-7); border-top: 1px solid var(--border); padding-top: var(--sp-5); }
.related ul, .sources ul { padding-left: var(--sp-5); }
.source-link::after { content: " ↗"; font-size: 0.85em; color: var(--muted); }

/* -------------------------------------------------------------- footer */

.site-footer { border-top: 1px solid var(--border); background: var(--surface-alt); margin-top: var(--sp-7); padding: var(--sp-6) 0; }
.site-footer-inner { display: grid; gap: var(--sp-5); }
.site-footer-brand { display: flex; gap: var(--sp-3); align-items: flex-start; max-width: 70ch; }
.site-footer-brand p { margin: 0; font-size: 14px; color: var(--muted); }
.site-footer-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-5); font-size: 15px; }
.site-footer-nav li { margin: 0; }
.site-footer-note { margin: 0; font-size: 13px; color: var(--muted); }

/* Optional analytics stays in document flow and never covers a guide. */
.analytics-choice[hidden], [data-analytics-settings][hidden] { display: none; }
.analytics-choice { border-bottom: 1px solid var(--border); background: var(--panel); }
.analytics-choice-inner { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3) var(--sp-5); padding-top: var(--sp-3); padding-bottom: var(--sp-3); }
.analytics-choice-inner > div:first-child { flex: 1 1 430px; }
.analytics-choice h2 { font-size: 17px; margin: 0 0 var(--sp-1); }
.analytics-choice p { font-size: 14px; line-height: 1.5; margin: 0; }
.analytics-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.analytics-choice-status { flex-basis: 100%; color: var(--muted); }
.analytics-choice-status:empty { display: none; }
.analytics-settings { font: inherit; color: var(--accent); background: none; border: 0; padding: 10px 0; min-height: 44px; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; margin-right: var(--sp-3); }

/* -------------------------------------------------------------- 404 */

.notfound { padding: var(--sp-8) 0; }

/* ------------------------------------------------------------ responsive */

@media (max-width: 1000px) {
  .article-layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "head" "toc" "main";
  }
  .toc { margin-bottom: var(--sp-5); max-width: 70ch; }
  .toc nav { position: static; }
}

@media (max-width: 900px) {
  .hero-inner { grid-template-columns: 1fr; gap: var(--sp-5); }
  .hero { padding: var(--sp-6) 0 var(--sp-5); }
  .exercise-live { grid-template-columns: 1fr; }
  .exercise-live svg { max-width: 300px; }
}

@media (max-width: 640px) {
  .wrap { padding-left: var(--sp-4); padding-right: var(--sp-4); }
  .section { padding: var(--sp-5) 0; }
  .directory-item a { padding: var(--sp-4) var(--sp-1); }
  .exercise { padding: var(--sp-4); }
  .table-wrap table { font-size: 14px; }
  .table-wrap th, .table-wrap td { padding: var(--sp-2); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
