/* 日本企業クロニクル */
:root {
  color-scheme: light;
  --bg: #f5f4f0;
  --surface: #fcfcfb;
  --ink: #1b1b1a;
  --ink-2: #52514e;
  --muted: #74726c;
  --grid: #e3e1da;
  --line: #d8d6ce;
  --hl: #d0312d;
  --bar: #a3a9b1;
  --accent: #1b1b1a;
  --good: #1f7a4d;
  --bad: #b3261e;
  --s1: #2a78d6; --s2: #1baf7a; --s3: #6250d6; --s4: #eda100; --s5: #e87ba4; --s6: #008300; --s7: #eb6834;
  --font: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
  --serif: "Noto Serif JP", "Hiragino Mincho ProN", "Yu Mincho", serif;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --bg: #141413; --surface: #1a1a19; --ink: #f0efec; --ink-2: #c3c2b7; --muted: #9a988f; --grid: #2e2d2a; --line: #3a3935;
    --hl: #e66767; --bar: #6b717a; --accent: #f0efec; --good: #5cc28f; --bad: #f08a84;
    --s1: #3987e5; --s2: #199e70; --s3: #9085e9; --s4: #c98500; --s5: #d55181; --s6: #2e9b2e; --s7: #d95926;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #141413; --surface: #1a1a19; --ink: #f0efec; --ink-2: #c3c2b7; --muted: #9a988f; --grid: #2e2d2a; --line: #3a3935;
  --hl: #e66767; --bar: #6b717a; --accent: #f0efec; --good: #5cc28f; --bad: #f08a84;
  --s1: #3987e5; --s2: #199e70; --s3: #9085e9; --s4: #c98500; --s5: #d55181; --s6: #2e9b2e; --s7: #d95926;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.8; }
a { color: inherit; text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
.wrap { max-width: 960px; margin: 0 auto; padding: 0 16px; }

/* ヘッダー */
.site-head { border-bottom: 1px solid var(--line); background: var(--bg); position: sticky; top: 0; z-index: 5; }
.head-inner { display: flex; align-items: center; gap: 24px; height: 52px; }
.logo { font-family: var(--serif); font-weight: 700; font-size: 17px; text-decoration: none; letter-spacing: .02em; white-space: nowrap; }
.nav { display: flex; gap: 18px; font-size: 14px; overflow-x: auto; }
.nav a { text-decoration: none; color: var(--ink-2); white-space: nowrap; }
.nav a:hover { color: var(--ink); }

/* 見出し */
h1, h2, h3 { font-family: var(--serif); line-height: 1.4; letter-spacing: .01em; }
h1 { font-size: clamp(26px, 5vw, 36px); margin: 28px 0 12px; }
h2 { font-size: 21px; margin: 0 0 8px; }
h3 { font-size: 17px; margin: 20px 0 8px; }
.lead { font-size: 17px; }
.muted { color: var(--muted); font-size: 14px; }
.crumbs { font-size: 13px; color: var(--muted); margin-top: 20px; }
.crumbs a { color: var(--muted); }

/* トップ */
.hero { padding: 40px 0 8px; }
.hero h1 { font-size: clamp(34px, 8vw, 56px); line-height: 1.25; margin: 0 0 16px; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.pill { border: 1px solid var(--line); border-radius: 999px; padding: 2px 12px; font-size: 14px; text-decoration: none; background: var(--surface); }
.pill:hover { border-color: var(--ink-2); }

/* ブロック */
.block { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 20px; margin: 20px 0; }
.block-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin-bottom: 4px; }
.block-head h2 { margin: 0; }
.chart { width: 100%; height: 380px; }
.chart-sm { height: 260px; }
.pad { padding: 24px 0; }

/* タブ・チップ */
.tabs { display: inline-flex; flex-wrap: wrap; gap: 4px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 3px; }
.tab { border: 0; background: transparent; color: var(--ink-2); font: inherit; font-size: 13px; padding: 4px 10px; border-radius: 6px; cursor: pointer; }
.tab.on { background: var(--accent); color: var(--bg); }
.tab:focus-visible, .chip:focus-visible, .chip-add:focus-visible { outline: 2px solid var(--s1); outline-offset: 2px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 8px 0 12px; }
.chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); border-radius: 999px; font: inherit; font-size: 13px; padding: 2px 10px; cursor: pointer; }
.chip i { width: 12px; height: 4px; border-radius: 2px; display: inline-block; }
.chip:disabled { cursor: default; opacity: 1; }
.chip.ghost { color: var(--ink-2); border-style: dashed; }
.chip-add { font: inherit; font-size: 13px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink); padding: 3px 8px; max-width: 160px; }
.presets { display: inline-flex; gap: 6px; flex-wrap: wrap; }

/* カード */
.sw { display: grid; grid-template-columns: 1fr 1fr; gap: 0 24px; }
.sw-h { display: flex; align-items: center; gap: 8px; }
.sw-h.strong::before, .sw-h.weak::before { content: ""; width: 10px; height: 10px; border-radius: 50%; }
.sw-h.strong::before { background: var(--good); }
.sw-h.weak::before { background: var(--bad); }
.cards { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
#sw-feat { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.card a { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 14px; text-decoration: none; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
.card a:hover { border-color: var(--ink-2); }
.card-rank { grid-row: 1 / 3; font-family: var(--serif); font-size: 26px; font-weight: 700; line-height: 1.1; min-width: 3.4em; }
.card-rank small { font-family: var(--font); font-size: 12px; font-weight: 400; color: var(--muted); margin-left: 2px; }
.card-title { font-weight: 700; font-size: 15px; line-height: 1.5; }
.card-text { font-size: 13px; color: var(--ink-2); line-height: 1.5; }
.cards:not(#sw-strong):not(#sw-weak):not(#sw-feat) .card a { grid-template-columns: 1fr; }

/* 表 */
.table-wrap { overflow-x: auto; }
table.rank { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
table.rank th, table.rank td { padding: 6px 8px; border-bottom: 1px solid var(--grid); text-align: left; }
table.rank th { color: var(--muted); font-weight: 400; font-size: 13px; }
table.rank .num { text-align: right; }
table.rank tr.jp td { color: var(--hl); font-weight: 700; }

/* リスト・その他 */
.links { columns: 2 220px; padding-left: 1.2em; margin: 0; }
.links li { break-inside: avoid; }
.source { font-size: 13px; color: var(--muted); margin: 16px 0; }
.btn { display: inline-block; border: 1px solid var(--ink); border-radius: 6px; padding: 4px 14px; font-size: 14px; text-decoration: none; margin: 4px 6px 4px 0; }
.btn:hover { background: var(--ink); color: var(--bg); }
.pr { font-family: var(--font); font-size: 11px; border: 1px solid var(--muted); color: var(--muted); border-radius: 3px; padding: 0 4px; vertical-align: middle; }

/* フッター */
.site-foot { border-top: 1px solid var(--line); margin-top: 48px; padding: 24px 0 40px; font-size: 13px; color: var(--ink-2); }
.foot-title { font-family: var(--serif); font-weight: 700; font-size: 15px; color: var(--ink); margin: 0; }

@media (max-width: 640px) {
  .sw { grid-template-columns: 1fr; }
  .block { padding: 16px 12px; }
  .chart { height: 320px; }
  .head-inner { gap: 14px; }
  .nav { gap: 12px; font-size: 13px; }
}

/* 主役の国を選ぶ */
.focus-pick { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 12px 0 4px; font-size: 14px; }
.focus-pick label { color: var(--ink-2); }
.focus-pick select { font: inherit; font-size: 15px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); padding: 4px 10px; max-width: 100%; }
.focus-pick select:focus-visible { outline: 2px solid var(--s1); outline-offset: 2px; }
table.rank tr.focus td { color: var(--hl); font-weight: 700; }
table.rank tr.ref td { color: var(--s1); font-weight: 700; }
table.compare td small { color: var(--muted); font-size: 12px; margin-left: 2px; }
table.compare td:first-child { min-width: 12em; }


/* ---- 日本企業クロニクル 追加 ---- */
.kicker { font-size: 13px; letter-spacing: .08em; color: var(--muted); margin: 0 0 8px; }
.hero h1 { font-size: clamp(30px, 6.4vw, 48px); }
.pill i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
.pill small { color: var(--muted); margin-left: 6px; font-size: 12px; }
.more { font-size: 13px; color: var(--ink-2); text-decoration: none; white-space: nowrap; }
.more:hover { text-decoration: underline; }
.era-line { font-size: 13px; color: var(--ink-2); margin: 8px 0 0; line-height: 2; }
.era-line b { font-size: 15px; color: var(--ink); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 0 20px; }
.grid2 .block { margin: 10px 0; }
.mini-rank { list-style: none; padding: 0; margin: 4px 0 0; }
.mini-rank a { display: grid; grid-template-columns: 2em 1fr auto; gap: 8px; text-decoration: none; padding: 6px 2px; border-bottom: 1px solid var(--grid); font-size: 15px; }
.mini-rank a:hover .n { text-decoration: underline; }
.mini-rank .r { font-family: var(--serif); font-weight: 700; color: var(--muted); }
.mini-rank .v { font-variant-numeric: tabular-nums; color: var(--ink-2); font-size: 14px; }
.grid-cards { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.chart-tall { height: 520px; }
.chart-strip { height: 120px; }
.sub { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; margin: -4px 0 8px; }
.tag { display: inline-block; font-size: 13px; border: 1px solid var(--line); border-radius: 4px; padding: 0 8px; text-decoration: none; background: var(--surface); }
.badges { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.badge { font-size: 13px; text-decoration: none; border: 1px solid var(--line); border-left: 3px solid var(--hl); border-radius: 6px; padding: 3px 10px; background: var(--surface); }
.badge b { font-family: var(--serif); font-size: 15px; margin-left: 4px; }
.badge small { color: var(--muted); }
table.facts { width: 100%; border-collapse: collapse; font-size: 15px; }
table.facts th, table.facts td { text-align: left; vertical-align: top; padding: 8px 8px; border-bottom: 1px solid var(--grid); }
table.facts th { width: 9em; color: var(--muted); font-weight: 400; font-size: 14px; white-space: nowrap; }
table.facts .muted { font-size: 13px; }
ol.timeline { list-style: none; padding: 0; margin: 12px 0 0; }
.timeline li { display: grid; grid-template-columns: 5.2em 1fr; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--grid); font-size: 15px; line-height: 1.7; }
.timeline .ev-y { font-family: var(--serif); font-weight: 700; font-variant-numeric: tabular-nums; }
.timeline .ev-y.same { color: transparent; }
.timeline .ev-c { display: block; font-size: 13px; font-weight: 700; }
.timeline .ev-c a { text-decoration: none; }
.timeline i.t { font-style: normal; font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 3px; padding: 0 4px; margin-left: 6px; white-space: nowrap; }
.timeline li.muted { display: block; }
ol.srcs { font-size: 13px; padding-left: 1.6em; margin: 4px 0 0; color: var(--ink-2); }
ol.srcs li { margin: 2px 0; overflow-wrap: anywhere; }
.legend-row { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--ink-2); margin: 10px 0 4px; }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; vertical-align: 0; }
.filter-row { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 14px; margin: 10px 0 0; }
.filter-row select, .picker input, .search input { font: inherit; font-size: 15px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); padding: 5px 10px; max-width: 100%; }
.decade-tabs .tab small { color: inherit; opacity: .6; font-size: 11px; margin-left: 4px; }
.picker { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.picker label { font-size: 14px; color: var(--ink-2); }
.picker input { min-width: 14em; }
.chip .x { font-size: 14px; color: var(--muted); }
.search { margin: 16px 0; }
.search input { width: 100%; max-width: 420px; }
#search-results:empty { display: none; }
#search-results { margin-top: 10px; }
table.rank tbody tr[hidden] { display: none; }
table.rank td.rk { color: var(--muted); width: 3em; }
table.sortable th { cursor: pointer; }
table.compare th { color: var(--ink); font-weight: 700; font-size: 14px; }
table.compare td:first-child { color: var(--muted); font-size: 13px; }
.cmp-only[hidden] { display: none; }
@media (max-width: 640px) {
  .chart-tall { height: 440px; }
  .timeline li { grid-template-columns: 4.4em 1fr; gap: 8px; font-size: 14px; }
  table.facts th { width: 6.5em; white-space: normal; }
}
.timeline li[hidden] { display: none; }
