/* Vitamins and minerals: same tokens as the rest of the Explorer (teal accent, IBM Plex, light and dark).
   data-theme on <html> overrides the system setting. */
:root {
  --page: #eef3f2; --panel: #f7faf9; --raised: #ffffff;
  --ink: #13201e; --muted: #4c5e5b; --line: #9aa9a6; --line-soft: #cad5d2;
  --accent: #0b7469; --accent-soft: rgba(11, 116, 105, 0.12); --on-accent: #ffffff;
  --stage-a: #f4f8f7; --stage-b: #d3dfdb;
  --warn-bg: #fff6e0; --warn-line: #b7862a;
  --vit: #b4561d; --min: #3a63b8; --hot: #d0574a;
  --shadow: 0 10px 30px rgba(17, 36, 33, 0.12);
  --font-ui: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-name: "Source Serif 4", Georgia, "Times New Roman", serif;
  --font-data: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Menlo, Consolas, monospace;
  --top: env(safe-area-inset-top, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --page: #0e1514; --panel: #141e1d; --raised: #1b2826;
    --ink: #e4eeeb; --muted: #9db0ac; --line: #5d7672; --line-soft: #283a38;
    --accent: #39b9ab; --accent-soft: rgba(57, 185, 171, 0.16); --on-accent: #04201c;
    --stage-a: #1c2826; --stage-b: #0a100f;
    --warn-bg: #2a2313; --warn-line: #c99a3c;
    --vit: #f09a5e; --min: #8fb0f2; --hot: #f08a7c;
    --shadow: 0 12px 34px rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --page: #0e1514; --panel: #141e1d; --raised: #1b2826;
  --ink: #e4eeeb; --muted: #9db0ac; --line: #5d7672; --line-soft: #283a38;
  --accent: #39b9ab; --accent-soft: rgba(57, 185, 171, 0.16); --on-accent: #04201c;
  --stage-a: #1c2826; --stage-b: #0a100f;
  --warn-bg: #2a2313; --warn-line: #c99a3c;
  --vit: #f09a5e; --min: #8fb0f2; --hot: #f08a7c;
  --shadow: 0 12px 34px rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--page); color: var(--ink); font-family: var(--font-ui); font-size: 16px; line-height: 1.55; -webkit-font-smoothing: antialiased; overflow-x: hidden; }
a { color: var(--accent); }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
main:focus, [tabindex="-1"]:focus { outline: none; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 8px; top: -60px; z-index: 50; background: var(--accent); color: var(--on-accent); padding: 8px 12px; border-radius: 8px; }
.skip:focus { top: calc(8px + var(--top)); }
.small { font-size: 14px; color: var(--muted); }
.eyebrow { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
h1, h2, h3 { line-height: 1.2; }
h2 { font-size: 21px; margin: 0 0 10px; }
h3 { font-size: 17px; margin: 18px 0 6px; }

/* top bar */
.topbar { display: flex; align-items: center; gap: 10px; padding: calc(10px + var(--top)) 16px 10px; border-bottom: 1px solid var(--line-soft); background: var(--panel); }
.brand { display: flex; flex-direction: column; line-height: 1.1; text-decoration: none; color: var(--ink); margin-right: auto; min-height: 44px; justify-content: center; }
.brand-name { font-family: var(--font-name); font-style: italic; font-weight: 600; font-size: 21px; }
.brand-sub { font-family: var(--font-data); font-size: 11px; color: var(--muted); }
.icon-btn, .btn { border: 1px solid var(--line); background: var(--raised); border-radius: 8px; padding: 8px 12px; min-height: 44px; font-size: 14px; font-weight: 500; }
.icon-btn:hover, .btn:hover { border-color: var(--accent); }

/* hero and notice */
.hero { padding: 24px 0 8px; }
.hero h1 { font-family: var(--font-name); font-size: clamp(30px, 6vw, 44px); margin: 4px 0 8px; }
.lede { font-size: 18px; max-width: 62ch; margin: 0; }
.notice { margin: 14px 0; padding: 12px 14px; border: 1px solid var(--warn-line); border-left-width: 6px; background: var(--warn-bg); border-radius: 10px; }
.notice h2 { font-size: 16px; margin: 0 0 4px; }
.notice p { margin: 0; }

.card { background: var(--raised); border: 1px solid var(--line-soft); border-radius: 14px; padding: 16px; margin: 16px 0; }

/* filters */
.filters { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end; }
.kinds { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.flabel { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-right: 4px; }
.kinds .flabel { width: 100%; }
.chip { min-height: 44px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); font-size: 14px; font-weight: 500; }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.sel select { min-height: 44px; min-width: 150px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); padding: 0 8px; }
.count { margin: 12px 0 6px; font-size: 14px; color: var(--muted); }
.none { font-style: italic; }

/* cards */
.cards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.ncard { display: flex; flex-direction: column; gap: 4px; height: 100%; padding: 12px; border: 1px solid var(--line-soft); border-radius: 12px; background: var(--panel); color: var(--ink); text-decoration: none; border-top: 4px solid var(--vit); }
.ncard.mineral { border-top-color: var(--min); }
.ncard:hover { border-color: var(--accent); }
.ncard .nm { font-weight: 700; font-size: 17px; }
.ncard .alt { font-size: 13px; color: var(--muted); font-family: var(--font-data); }
.ncard .sh { font-size: 14px; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0 0; padding: 0; list-style: none; }
.tag { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); }
.tag.kind-vitamin { color: var(--vit); background: transparent; border: 1px solid currentColor; }
.tag.kind-mineral { color: var(--min); background: transparent; border: 1px solid currentColor; }

/* body map */
.map-grid { display: grid; grid-template-columns: minmax(150px, 220px) 1fr; gap: 16px; align-items: start; }
.body { width: 100%; height: auto; max-height: 360px; }
.body .shape { fill: var(--stage-b); stroke: var(--line); stroke-width: 1.5; }
.body .spot { fill: var(--panel); stroke: var(--line); stroke-width: 2; transition: fill 0.2s; }
.body .spot.on { fill: var(--accent); stroke: var(--accent); }
.body .spot.picked { fill: var(--hot); stroke: var(--hot); }
.body .lbl { font: 600 9px var(--font-ui); fill: var(--muted); }
.sites { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 6px; }
.sitebtn { width: 100%; min-height: 44px; text-align: left; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line-soft); background: var(--panel); display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.sitebtn.on { border-color: var(--accent); }
.sitebtn[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.sitebtn .n { font-family: var(--font-data); font-size: 13px; }
.maphead { font-weight: 600; margin: 4px 0 8px; }

/* detail */
.detail { margin: 16px 0; }
.dnav { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.dnav .sp { flex: 1; }
.dnav a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 10px; border-radius: 8px; text-decoration: none; font-weight: 500; }
.dnav a:hover { background: var(--accent-soft); }
.dhead h2 { font-family: var(--font-name); font-size: clamp(28px, 5vw, 38px); margin: 0; }
.dhead .alt { font-family: var(--font-data); color: var(--muted); margin: 2px 0 6px; }
.dhead .sh { font-size: 18px; margin: 6px 0; }
.dgrid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.dgrid > .card { margin: 0; }
.dfull { grid-column: 1 / -1; }
.prose p { margin: 0 0 8px; }
.cite { font-size: 11px; font-family: var(--font-data); vertical-align: super; line-height: 0; margin-left: 2px; text-decoration: none; }
.cite + .cite { margin-left: 1px; }
.amt { width: 100%; border-collapse: collapse; font-size: 15px; }
.amt th, .amt td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line-soft); }
.amt th { font-weight: 600; color: var(--muted); }
.linklist { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.linklist a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line-soft); background: var(--panel); text-decoration: none; }
.linklist a:hover { border-color: var(--accent); }
.srcmini { font-size: 14px; padding-left: 20px; }

/* viewer */
.viewer { margin: 0; }
.vstage { position: relative; aspect-ratio: 4 / 3; width: 100%; border-radius: 12px; overflow: hidden; background: radial-gradient(circle at 50% 40%, var(--stage-a), var(--stage-b)); touch-action: none; }
.vstage canvas, .vstage svg { display: block; width: 100%; height: 100%; }
.vstage:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.vbar { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 4px; }
.vbar .btn { min-width: 44px; }
.vpick { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
.vleg { display: flex; flex-wrap: wrap; gap: 4px 12px; list-style: none; padding: 0; margin: 4px 0; font-size: 13px; }
.vleg i { display: inline-block; width: 12px; height: 12px; border-radius: 50%; border: 1px solid var(--line); margin-right: 4px; vertical-align: -1px; }
.vmsg { position: absolute; inset: auto 8px 8px 8px; font-size: 13px; background: var(--raised); border-radius: 8px; padding: 6px 8px; margin: 0; }

/* table */
.tablewrap { overflow-x: auto; }
.amounts { border-collapse: collapse; width: 100%; font-size: 14px; min-width: 520px; }
.amounts caption { text-align: left; font-size: 14px; color: var(--muted); padding-bottom: 6px; }
.amounts th, .amounts td { padding: 6px 8px; border-bottom: 1px solid var(--line-soft); text-align: left; vertical-align: top; }
.amounts thead th { color: var(--muted); font-weight: 600; }
.amounts tbody th { font-weight: 600; }
.info { padding-left: 20px; font-size: 14px; color: var(--muted); }

/* learn */
.ideas li { margin-bottom: 8px; }
.myths { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.myths li { border: 1px solid var(--line-soft); border-radius: 10px; padding: 10px 12px; background: var(--panel); }
.myths .m { margin: 0 0 4px; }
.myths .t { margin: 0; }
.myths b { display: inline-block; min-width: 48px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.05em; }
.myths .m b { color: var(--hot); }
.myths .t b { color: var(--accent); }
.words { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0; }
.words dt { font-weight: 700; }
.words dd { margin: 0; }
.sources { font-size: 14px; padding-left: 26px; }
.sources li { margin-bottom: 4px; overflow-wrap: anywhere; }
.sources li:target { background: var(--accent-soft); }
.loadfail { color: var(--hot); font-weight: 600; }
.foot { padding: 16px; font-size: 13px; color: var(--muted); }

@media (max-width: 720px) {
  .dgrid { grid-template-columns: 1fr; }
  .map-grid { grid-template-columns: 1fr; }
  .body { max-width: 200px; margin: 0 auto; display: block; }
  .words { grid-template-columns: 1fr; }
  .words dd { margin-bottom: 8px; }
  .sel { flex: 1 1 140px; }
  .sel select { width: 100%; min-width: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
