/* Lifespan Atlas — single stylesheet. Colours are tokens; dark mode redefines them. */
:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --border: #dde1e6;
  --grid: #e8eaed;
  --text: #191919;
  --text-2: #555b63;
  --text-3: #6b7178;
  --accent: #1757ac;
  --accent-ink: #ffffff;
  --accent-soft: #e6effb;
  --highlight: #fff6d6;
  --ok: #0b6e1e;
  --error: #b3261e;
  --warn: #8a5a00;
  /* categorical slots (validated order, light) */
  --series-1: #257de0;
  --series-2: #f47230;
  --series-3: #00b894;
  --series-4: #f2a600;
  --neg: #ec4647;
  /* sequential ramp (6 bins) */
  --seq-1: #b6d5f8;
  --seq-2: #84b9f3;
  --seq-3: #519ced;
  --seq-4: #257de0;
  --seq-5: #1b64be;
  --seq-6: #0f4a96;
  --na: #e2e4e8;
  --radius: 10px;
  --font: system-ui, -apple-system, "Segoe UI", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", Meiryo, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #111418;
    --surface: #191c21;
    --surface-2: #22262c;
    --border: #343a42;
    --grid: #2b3037;
    --text: #eef0f2;
    --text-2: #b4bac2;
    --text-3: #9aa1a9;
    --accent: #6aabf1;
    --accent-ink: #0b1a2e;
    --accent-soft: #1b2b40;
    --highlight: #3a3216;
    --ok: #5fd170;
    --error: #ff8a80;
    --warn: #f2c14e;
    --series-1: #338ced;
    --series-2: #e76624;
    --series-3: #00a888;
    --series-4: #d28e05;
    --neg: #eb6263;
    --seq-1: #1757ac;
    --seq-2: #1b64be;
    --seq-3: #2370cd;
    --seq-4: #338ced;
    --seq-5: #6aabf1;
    --seq-6: #9dc8f7;
    --na: #30353c;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111418; --surface: #191c21; --surface-2: #22262c; --border: #343a42; --grid: #2b3037;
  --text: #eef0f2; --text-2: #b4bac2; --text-3: #9aa1a9; --accent: #6aabf1; --accent-ink: #0b1a2e;
  --accent-soft: #1b2b40; --highlight: #3a3216; --ok: #5fd170; --error: #ff8a80; --warn: #f2c14e;
  --series-1: #338ced; --series-2: #e76624; --series-3: #00a888; --series-4: #d28e05; --neg: #eb6263;
  --seq-1: #1757ac; --seq-2: #1b64be; --seq-3: #2370cd; --seq-4: #338ced; --seq-5: #6aabf1; --seq-6: #9dc8f7;
  --na: #30353c;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); font-family: var(--font);
  font-size: 16px; line-height: 1.7; overflow-wrap: anywhere;
}
a { color: var(--accent); text-underline-offset: 0.15em; }
a:hover { text-decoration-thickness: 2px; }
img { max-width: 100%; }
h1, h2, h3 { line-height: 1.35; margin: 0 0 0.6em; }
h1 { font-size: clamp(1.4rem, 1.1rem + 1.4vw, 2rem); letter-spacing: -0.01em; }
h2, .h2 { font-size: 1.3rem; }
h3, .h3 { font-size: 1.08rem; }
p { margin: 0 0 1em; }
small { font-size: 0.82em; }
code { font-size: 0.9em; background: var(--surface-2); padding: 0.1em 0.35em; border-radius: 4px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; background: var(--surface); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; top: 8px; }
.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 16px; }

/* Header */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); }
.site-header__inner { display: flex; align-items: center; gap: 12px; padding-top: 10px; padding-bottom: 10px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; color: var(--text); text-decoration: none; font-size: 1.05rem; }
.brand__mark { width: 28px; height: 28px; color: var(--accent); flex: none; }
.lang-switch { margin-left: auto; font-size: 0.9rem; padding: 4px 10px; border: 1px solid var(--border); border-radius: 999px; text-decoration: none; white-space: nowrap; }
.search { position: relative; flex: 1 1 220px; max-width: 360px; margin-left: auto; }
.search input { width: 100%; }
.search + .lang-switch { margin-left: 0; }
.search__list {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 20; list-style: none; margin: 0; padding: 4px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 8px 24px rgb(0 0 0 / 0.15);
  max-height: 320px; overflow: auto;
}
.search__list li a, .search__list li span { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; color: var(--text); text-decoration: none; }
.search__list li[aria-selected="true"] a, .search__list li a:hover { background: var(--accent-soft); }
.site-nav { border-top: 1px solid var(--border); }
.site-nav ul { display: flex; gap: 4px 18px; list-style: none; margin: 0 auto; padding-top: 6px; padding-bottom: 6px; overflow-x: auto; white-space: nowrap; scrollbar-width: none; }
.site-nav a { color: var(--text-2); text-decoration: none; font-size: 0.92rem; padding: 4px 0; display: inline-block; }
.site-nav a:hover { color: var(--accent); }
@media (max-width: 640px) {
  .search { order: 3; flex-basis: 100%; max-width: none; margin-left: 0; }
  .lang-switch { margin-left: auto; }
}

.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 4px; margin: 0; padding: 12px 0 0; font-size: 0.85rem; color: var(--text-3); }
.crumbs li + li::before { content: "›"; margin-right: 4px; }
.crumbs a { color: var(--text-3); }

main { padding-top: 20px; padding-bottom: 40px; }
.page-head { margin-bottom: 20px; }
.lead { color: var(--text-2); max-width: 70ch; }
.country-head { display: flex; gap: 16px; align-items: center; }
.country-head .flag--lg { width: 72px; height: auto; flex: none; }
.section { margin-top: 40px; }
.note, .table-note { color: var(--text-3); font-size: 0.86rem; }
.table-note { margin-top: 8px; }

/* Forms */
input, select, textarea, button { font: inherit; color: inherit; }
input[type="search"], input[type="text"], input[type="email"], input[type="number"], input[type="password"], input:not([type]), select, textarea {
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; min-height: 42px; max-width: 100%;
}
textarea { width: 100%; line-height: 1.7; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > label, .field > legend { font-size: 0.85rem; color: var(--text-2); font-weight: 600; }
.field--wide { flex: 1 1 260px; }
.field--inline { flex-direction: row; align-items: center; gap: 8px; flex-wrap: wrap; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px; padding: 8px 16px;
  border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); text-decoration: none; cursor: pointer; font-weight: 600;
}
.btn:hover { border-color: var(--accent); }
.btn--primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn--ghost { background: transparent; }
.btn--sm { min-height: 32px; padding: 4px 10px; font-size: 0.85rem; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 16px; }
.filters--inline { align-items: center; background: none; border: 0; padding: 0; gap: 8px; }
.filters__label { color: var(--text-2); font-size: 0.9rem; }
.js [data-nojs] { display: none; }
.seg { display: flex; flex-direction: column; }
.seg > legend { margin-bottom: 4px; }
.seg label { display: inline-block; }
.seg { flex-direction: row; flex-wrap: wrap; gap: 0; }
.seg > legend { width: 100%; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: inline-block; padding: 8px 12px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; min-height: 42px; line-height: 1.5; font-size: 0.92rem; }
.seg label:first-of-type span { border-radius: 8px 0 0 8px; }
.seg label:last-of-type span { border-radius: 0 8px 8px 0; }
.seg label + label span { margin-left: -1px; }
.seg input:checked + span { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); position: relative; }
.seg input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Average line */
.avg { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin: 0 0 16px; }
.avg__label { color: var(--text-2); }
.avg__value { font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.avg__note { color: var(--text-3); font-size: 0.82rem; }

/* Tables */
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow-x: auto; }
.table-wrap--tall { max-height: 640px; overflow-y: auto; }
table.data { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
table.data th, table.data td { padding: 8px 12px; border-bottom: 1px solid var(--grid); text-align: left; vertical-align: middle; }
table.data thead th { font-size: 0.8rem; color: var(--text-2); font-weight: 600; background: var(--surface-2); position: sticky; top: 0; z-index: 1; }
table.data tbody tr:last-child > * { border-bottom: 0; }
table.data tbody th { font-weight: 500; }
.num { text-align: right !important; white-space: nowrap; }
.strong { font-weight: 700; }
.rank { width: 3.5em; text-align: right !important; color: var(--text-2); white-space: nowrap; }
.country-cell a { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; }
.country-cell a:hover span { text-decoration: underline; color: var(--accent); }
.flag { width: 24px; height: 18px; object-fit: cover; border-radius: 2px; box-shadow: 0 0 0 1px rgb(0 0 0 / 0.12); flex: none; vertical-align: middle; }
tr.is-japan > * { background: var(--highlight); }
tr.is-selected > * { background: var(--accent-soft); font-weight: 700; }
.cell-note { display: block; color: var(--text-3); font-weight: 400; }
@media (max-width: 640px) {
  .hide-sm { display: none; }
  table.data th, table.data td { padding: 8px 8px; }
}

/* Tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.tile--main { border-color: var(--accent); box-shadow: inset 0 3px 0 var(--accent); }
.tile__label { margin: 0; color: var(--text-2); font-size: 0.88rem; }
.tile__value { margin: 2px 0 6px; font-size: 1.9rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.2; }
.tile__meta { margin: 0; color: var(--text-2); font-size: 0.86rem; }

/* Prose */
.prose { max-width: 75ch; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li { margin-bottom: 0.35em; }
.callout { border-left: 4px solid var(--accent); background: var(--accent-soft); padding: 12px 16px; border-radius: 0 var(--radius) var(--radius) 0; margin: 16px 0; }
.callout p:last-child { margin: 0; }
.ai-note { font-size: 0.85rem; color: var(--text-3); border-top: 1px dashed var(--border); padding-top: 8px; max-width: 75ch; }
.glossary dt { font-weight: 700; margin-top: 1em; }
.glossary dd { margin: 0.2em 0 0; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; }
.kv dt { color: var(--text-2); }
.kv dd { margin: 0; }
details.more { margin: 16px 0; }
details summary { cursor: pointer; color: var(--accent); font-weight: 600; }

/* Explain section */
.explain .why-lists { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin-top: 16px; }
.mini-list { margin: 0; padding-left: 1.6em; }
.mini-list a { display: inline-flex; align-items: center; gap: 8px; }

/* Chips */
.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 0; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text); text-decoration: none; font-size: 0.9rem; min-height: 34px; }
.chip.is-active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.chip__x { margin-left: 4px; text-decoration: none; color: var(--text-2); font-size: 1.1rem; line-height: 1; padding: 0 2px; }
.compare-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 16px; }

/* Cards */
.actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.card-link { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; text-decoration: none; color: var(--text); }
.card-link strong { display: block; color: var(--accent); }
.card-link span { color: var(--text-2); font-size: 0.9rem; }
.card-link:hover { border-color: var(--accent); }

/* Cite */
.cite { margin-top: 40px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.cite__text { font-size: 0.9rem; color: var(--text-2); }
.cite__actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.cite__status { color: var(--ok); font-size: 0.9rem; }

/* Ads: height reserved up front so content never shifts when an ad loads. */
.ad { position: relative; margin: 24px 0; min-height: 280px; background: var(--surface-2); border-radius: var(--radius); padding-top: 22px; overflow: hidden; contain: layout; }
.ad__label { position: absolute; top: 4px; left: 10px; font-size: 0.75rem; color: var(--text-2); letter-spacing: 0.05em; }
.ad--placeholder { display: flex; align-items: center; justify-content: center; border: 1px dashed var(--border); }
.ad__dev { color: var(--text-2); font-size: 0.8rem; }
@media (min-width: 768px) { .ad { min-height: 250px; } }

/* Charts (inline SVG) */
.chart { margin: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 12px 8px; }
.chart__plot { position: relative; }
.chart__svg { width: 100%; height: auto; display: block; overflow: visible; touch-action: pan-y; }
.chart__grid { stroke: var(--grid); stroke-width: 1; }
.chart__axis { stroke: var(--border); stroke-width: 1; }
.chart__tick { fill: var(--text-3); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart__note { fill: var(--text-3); font-size: 11px; }
.chart__proj-bg { fill: var(--surface-2); opacity: 0.6; }
.chart__divider { stroke: var(--text-3); stroke-width: 1; }
.chart__line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart__line--proj { stroke-dasharray: 5 4; }
.chart__dot { stroke: var(--surface); stroke-width: 2; }
.chart__label { fill: var(--text); font-size: 12px; }
.chart__label-v { fill: var(--text-2); font-variant-numeric: tabular-nums; }
.chart__leader { fill: none; stroke: var(--text-3); stroke-width: 1; }
.chart__line.s1 { stroke: var(--series-1); } .chart__dot.s1 { fill: var(--series-1); }
.chart__line.s2 { stroke: var(--series-2); } .chart__dot.s2 { fill: var(--series-2); }
.chart__line.s3 { stroke: var(--series-3); } .chart__dot.s3 { fill: var(--series-3); }
.chart__line.s4 { stroke: var(--series-4); } .chart__dot.s4 { fill: var(--series-4); }
.chart__legend { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 0 0 6px; padding: 0; font-size: 0.86rem; color: var(--text-2); }
.chart__legend li { display: inline-flex; align-items: center; gap: 6px; }
.key { display: inline-block; width: 16px; height: 3px; border-radius: 2px; vertical-align: middle; background: var(--text-3); }
.key.s1 { background: var(--series-1); } .key.s2 { background: var(--series-2); } .key.s3 { background: var(--series-3); } .key.s4 { background: var(--series-4); }
.key--dash { background: repeating-linear-gradient(90deg, var(--text-3) 0 5px, transparent 5px 9px); }
.chart__table { margin-top: 8px; font-size: 0.9rem; }
.chart__table .table-scroll { max-height: 360px; overflow: auto; margin-top: 8px; }
.chart-tip {
  position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 6px 18px rgb(0 0 0 / 0.16); padding: 6px 10px; font-size: 0.82rem; z-index: 5; min-width: 140px; font-variant-numeric: tabular-nums;
}
.chart-tip b { display: block; margin-bottom: 2px; }
.chart-tip div { display: flex; align-items: center; gap: 6px; justify-content: space-between; }
.chart-tip span.v { margin-left: auto; font-weight: 600; }
.chart-cross { stroke: var(--text-3); stroke-width: 1; }

/* Map */
.map { margin: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; }
.map__canvas { aspect-ratio: 1000 / 446; width: 100%; }
.map__canvas svg, .map__svg { width: 100%; height: auto; display: block; }
.map__c, .map__na, .map__dot { stroke: var(--surface); stroke-width: 0.5; }
.map__dot { stroke-width: 1; }
.map__na { fill: var(--na); }
.b1 { fill: var(--seq-1); } .b2 { fill: var(--seq-2); } .b3 { fill: var(--seq-3); }
.b4 { fill: var(--seq-4); } .b5 { fill: var(--seq-5); } .b6 { fill: var(--seq-6); }
.map__dim { opacity: 0.25; }
.map a:hover .map__c, .map a:focus .map__c, .map a:hover .map__dot { stroke: var(--text); stroke-width: 1.5; }
.map__legend { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 14px; padding: 0; margin: 10px 0 0; font-size: 0.84rem; color: var(--text-2); }
.map__legend li { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 14px; height: 14px; border-radius: 3px; display: inline-block; }
.swatch.b1 { background: var(--seq-1); } .swatch.b2 { background: var(--seq-2); } .swatch.b3 { background: var(--seq-3); }
.swatch.b4 { background: var(--seq-4); } .swatch.b5 { background: var(--seq-5); } .swatch.b6 { background: var(--seq-6); }
.swatch.map__na { background: var(--na); }

/* Google map */
.gmap { position: relative; aspect-ratio: 16 / 10; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); background: var(--surface-2); }
.gmap iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* Calculator */
.calc { display: flex; flex-wrap: wrap; gap: 14px 16px; align-items: flex-end; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.calc select { width: 100%; }
.calc__filter { margin-bottom: 4px; }
.calc #calc-age { width: 8em; }
.result { margin-top: 20px; background: var(--surface); border: 2px solid var(--accent); border-radius: var(--radius); padding: 18px; }
.result__title { font-size: 1.05rem; color: var(--text-2); }
.result__value { font-size: 1.15rem; }
.result__value strong { font-size: 2.2rem; color: var(--text); font-variant-numeric: tabular-nums; }
.result__reach { font-size: 1.2rem; font-weight: 700; margin-left: 4px; }
.result__facts { padding-left: 1.2em; }
.dbip { margin-top: 24px; font-size: 0.82rem; color: var(--text-3); }
.dbip a { color: var(--text-3); }

/* Misc */
.result-list { list-style: none; padding: 0; display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.result-list a { display: flex; align-items: center; gap: 8px; }
.notice { background: var(--surface-2); border-radius: var(--radius); padding: 10px 14px; border-left: 4px solid var(--text-3); }
.notice--ok { border-left-color: var(--ok); }
.notice--error { border-left-color: var(--error); }
.form { display: flex; flex-direction: column; gap: 14px; max-width: 640px; }
.form--narrow { max-width: 360px; }
.hp { position: absolute; left: -9999px; }
.req { color: var(--error); font-size: 0.8em; }
.related { margin-top: 32px; }

/* Footer */
.site-footer { background: var(--surface); border-top: 1px solid var(--border); padding: 24px 0 32px; font-size: 0.86rem; color: var(--text-2); }
.site-footer .note { margin: 0 0 12px; }
.footer-links { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 0; margin: 0 0 12px; }
.copy { color: var(--text-3); margin: 0; }

/* Admin */
.admin-nav { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; margin-left: auto; font-size: 0.92rem; }
.inline { display: inline-block; margin: 0 8px 8px 0; }
.badge { display: inline-block; font-size: 0.78rem; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); }
.badge--verified { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.badge--unverified { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.warn { color: var(--warn); }
.log { background: var(--surface-2); padding: 12px; border-radius: var(--radius); overflow-x: auto; font-size: 0.85rem; }
.checks label { display: block; margin: 4px 0; }
.steps li { margin-bottom: 0.5em; }
.sep { width: 1px; height: 20px; background: var(--border); margin: 0 6px; }

@media (forced-colors: active) {
  .chart__line { stroke: CanvasText; }
  .seg input:checked + span { outline: 2px solid Highlight; }
}
@media print {
  .site-header, .site-nav, .ad, .filters, .site-footer, .cite__actions { display: none !important; }
}

/* Phone width: the chart viewBox scales down, so enlarge its text in user units
   and let the legend + tooltip carry series identity instead of end labels. */
@media (max-width: 640px) {
  .chart { padding: 8px 6px 6px; }
  .chart__tick { font-size: 22px; }
  .chart__note { font-size: 20px; }
  .chart__label, .chart__leader { display: none; }
  .chart__line { stroke-width: 3; }
  .chart__dot { r: 6; }
}

/* In-table bars (wide screens). Thin, rounded at the data end, square at zero. */
.bar-col { width: 38%; min-width: 140px; padding-left: 4px !important; padding-right: 16px !important; }
.bar-track { position: relative; height: 12px; }
.bar { position: absolute; top: 0; bottom: 0; background: var(--series-1); border-radius: 0 4px 4px 0; min-width: 1px; }
.bar--neg { background: var(--neg); border-radius: 4px 0 0 4px; }
.bar-zero { position: absolute; top: -4px; bottom: -4px; width: 1px; background: var(--text-3); }
tr.is-japan .bar { background: var(--seq-6); }
.bar-scale { position: relative; height: 1.2em; font-weight: 400; color: var(--text-2); font-variant-numeric: tabular-nums; }
.bar-scale span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.bar-scale span:first-child { transform: none; }
.bar-scale span:nth-child(2) { transform: translateX(-100%); }

.gap-note { margin: 12px 0 0; color: var(--text-2); font-size: 0.92rem; }
.mini-v { color: var(--text-2); font-variant-numeric: tabular-nums; margin-left: 4px; }

/* Header banner (replaces the text title when set in /admin/banner).
   Shown 48px tall (36px on phones), at most 360px wide, aspect ratio kept. */
.brand--banner { display: block; line-height: 0; flex: 0 1 auto; min-width: 0; }
.brand--banner img { display: block; height: 48px; width: auto; max-width: min(360px, 100%); object-fit: contain; object-position: left center; }
@media (max-width: 640px) {
  .brand--banner { max-width: calc(100% - 96px); }
  .brand--banner img { height: 36px; }
}
.banner-preview { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; margin: 8px 0 12px; }
.banner-preview > div { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; min-height: 72px; display: flex; align-items: center; }
.banner-preview .on-light { background: #ffffff; }
.banner-preview .on-dark { background: #191c21; }
.banner-preview img { height: 48px; width: auto; max-width: 360px; object-fit: contain; }
.banner-slot { border-top: 1px solid var(--border); padding-top: 16px; margin-top: 16px; }
.icon-preview { display: flex; flex-wrap: wrap; gap: 12px; margin: 8px 0 12px; }
.icon-preview figure { margin: 0; text-align: center; font-size: 0.8rem; color: var(--text-3); }
.icon-preview figure > div { width: 110px; height: 110px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 4px; }
.icon-preview .on-light { background: #ffffff; }
.icon-preview .on-dark { background: #191c21; }
.icon-preview img.apple { border-radius: 20px; }
.related-countries { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px 32px; }
.mini-list--ranked li[aria-current] { color: var(--text); }
.error-entry { margin: 6px 0; }
.error-entry summary { font-weight: 400; color: var(--text); font-size: 0.9rem; }
.table-wrap--narrow { max-width: 520px; }

/* Touch targets of at least 24px for list-style links (not links inside sentences). */
.footer-links a, .crumbs a, .lang-switch, table.data td a { display: inline-block; min-height: 24px; padding: 3px 0; line-height: 18px; }
.footer-links { gap: 2px 18px; }
.crumbs ol { align-items: center; }

/* Icons (Lucide sprite). Stroke follows the text colour, so dark mode needs nothing extra. */
.icon {
  width: 1.15em; height: 1.15em; flex: none; vertical-align: -0.2em;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.site-nav a { display: inline-flex; align-items: center; gap: 6px; }
.site-nav a .icon { width: 1.05em; height: 1.05em; opacity: 0.8; }
.site-nav a:hover .icon { opacity: 1; }
h2 .icon, .h2 .icon, h3 .icon, .h3 .icon { color: var(--accent); margin-right: 0.35em; width: 1.05em; height: 1.05em; vertical-align: -0.15em; }
.btn .icon { width: 1.1em; height: 1.1em; }
.lang-switch { display: inline-flex; align-items: center; gap: 4px; }
.lang-switch .icon { width: 1em; height: 1em; }
.search .search__icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; width: 1.05em; height: 1.05em; }
.search input[type="search"] { padding-left: 34px; }
.card-link strong { display: flex; align-items: center; gap: 8px; }
.card-link strong .icon { width: 1.2em; height: 1.2em; }
