/* 鉱山株ウォッチ：鉱山らしい紙面。岩の色の黒いヘッダーに安全標識の黄と黒の縞、背景に等高線、見出しの通し番号は坑道の深さ（-100 m）。
   数字は DIN 系の字（Bahnschrift）で桁をそろえる。データの色は dataviz の検証済みパレットの先頭3色（青・オレンジ・緑青）で、
   このサイトの面の色（ライト #ffffff・ダーク #17191c）で検証し直して合格（3色の全組み合わせ）。安全標識の黄は飾りだけに使い、データには使わない */
:root {
  color-scheme: light;
  --page: #f1efea; --surface: #ffffff; --surface-2: #f6f4ef;
  --ink: #16181b; --ink-2: #4b4f55; --muted: #7b7f86;
  --grid: #e6e3dc; --axis: #c9c5bb; --border: rgba(40,36,28,0.13);
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a;
  --accent: #9a5800; --hivis: #f2a900; --rock: #1a1c1f;
  --contour: rgba(90,70,40,0.07);
  --critical: #d03b3b; --good: #0ca30c; --good-text: #006300;
  --wash: rgba(242,169,0,0.09);
  --num: "Bahnschrift", "DIN Alternate", "DIN 2014", "Roboto Condensed", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page: #0f1012; --surface: #17191c; --surface-2: #1d2024;
    --ink: #eceae5; --ink-2: #b3b0a8; --muted: #7f7c75;
    --grid: #26292d; --axis: #373a3f; --border: rgba(255,240,210,0.10);
    --s1: #3987e5; --s2: #d95926; --s3: #199e70;
    --accent: #f2b53a; --contour: rgba(255,220,160,0.045); --good-text: #0ca30c;
    --wash: rgba(242,169,0,0.07);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0f1012; --surface: #17191c; --surface-2: #1d2024;
  --ink: #eceae5; --ink-2: #b3b0a8; --muted: #7f7c75;
  --grid: #26292d; --axis: #373a3f; --border: rgba(255,240,210,0.10);
  --s1: #3987e5; --s2: #d95926; --s3: #199e70;
  --accent: #f2b53a; --contour: rgba(255,220,160,0.045); --good-text: #0ca30c;
  --wash: rgba(242,169,0,0.07);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; color: var(--ink); background-color: var(--page);
  /* 等高線（地形図の同心の輪） */
  background-image: repeating-radial-gradient(ellipse 120% 90% at 85% -5%, transparent 0 26px, var(--contour) 26px 27px),
                    repeating-radial-gradient(ellipse 90% 70% at -10% 40%, transparent 0 34px, var(--contour) 34px 35px);
  background-attachment: fixed;
  font: 15px/1.8 system-ui, -apple-system, "Segoe UI", "Hiragino Sans", "Yu Gothic UI", "Meiryo", sans-serif; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
::selection { background: rgba(242,169,0,0.35); }

/* ヘッダー：岩の黒、下に安全標識の縞 */
.bar { position: sticky; top: 0; z-index: 10; background: var(--rock); color: #eceae5; }
.hazard { height: 6px; background: repeating-linear-gradient(-45deg, var(--hivis) 0 10px, #111214 10px 20px); }
.bar-in { max-width: 1120px; margin: 0 auto; padding: 12px 20px 4px; display: flex; align-items: center; gap: 16px; }
.logo { display: flex; flex-direction: column; text-decoration: none; color: inherit; line-height: 1.25; }
.logo .mark { font: 700 11px/1.4 var(--num); letter-spacing: 0.3em; color: var(--hivis); }
.logo .name { font-weight: 800; font-size: 21px; letter-spacing: 0.04em; color: #fff; }
.tools { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.lang, .theme { white-space: nowrap; font: 500 12px var(--num); letter-spacing: 0.04em; color: #eceae5; background: transparent;
  border: 1px solid #45484d; border-radius: 4px; padding: 4px 10px; text-decoration: none; cursor: pointer; }
.lang:hover, .theme:hover { border-color: var(--hivis); color: #fff; }
.tabs { max-width: 1120px; margin: 0 auto; padding: 0 12px; display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.tabs a { position: relative; color: #a3a09a; text-decoration: none; padding: 7px 10px 9px; font-size: 13.5px; white-space: nowrap; }
.tabs a:hover { color: #fff; }
.tabs a[aria-current] { color: #fff; font-weight: 700; }
.tabs a[aria-current]::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: 0; height: 3px; background: var(--hivis); }

main { max-width: 1120px; margin: 0 auto; padding: 8px 20px 24px; counter-reset: sec; }
.alert { background: rgba(208,59,59,0.10); border: 1px solid rgba(208,59,59,0.35); border-radius: 6px; padding: 10px 14px; margin: 16px 0; }

/* 冒頭 */
.hero { padding: 44px 0 12px; max-width: 900px; }
.kicker { display: inline-block; font: 700 12px var(--num); letter-spacing: 0.24em; color: var(--ink); background: var(--hivis);
  padding: 3px 12px; margin: 0 0 16px; clip-path: polygon(0 0, 100% 0, calc(100% - 8px) 100%, 0 100%); }
.hero h1 { font-size: clamp(28px, 4.6vw, 44px); line-height: 1.3; margin: 0 0 18px; font-weight: 800; letter-spacing: 0.01em; }
.hero h1 .hl { box-shadow: inset 0 -0.32em 0 rgba(242,169,0,0.45); }
.lead { color: var(--ink-2); font-size: 16px; margin: 0 0 16px; max-width: 860px; }

/* 見出し：坑道の深さの通し番号 */
.block { margin: 40px 0; }
.block > h2 { counter-increment: sec; font-size: 21px; margin: 0 0 14px; padding: 0 0 10px; border-bottom: 2px solid var(--ink); position: relative; }
.block > h2::before { content: "LEVEL −" counter(sec) "00 m"; display: block; font: 700 11px/1.6 var(--num); letter-spacing: 0.2em; color: var(--accent); }
.block > h2::after { content: ""; position: absolute; left: 0; bottom: -2px; width: 64px; height: 2px; background: var(--hivis); }
.block h3 { font-size: 15.5px; margin: 16px 0 8px; }
.more { margin: 12px 0 0; font-weight: 600; }
.caveat { margin: 12px 0 0; padding: 10px 14px; border-left: 4px solid var(--hivis); background: var(--surface); font-size: 14px; color: var(--ink-2); }
.more a { text-decoration: none; }
.more a:hover { text-decoration: underline; }
.note { color: var(--muted); font-size: 12.5px; margin: 8px 0 0; }
.updated { color: var(--muted); font: 12px var(--num); margin: 32px 0 0; }

/* 数字の札 */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; margin: 8px 0 14px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-top: 3px solid var(--ink); border-radius: 4px; padding: 10px 14px 12px; display: flex; flex-direction: column; }
.t-label { font-size: 12px; color: var(--ink-2); line-height: 1.5; }
.t-val { font: 700 26px/1.3 var(--num); font-variant-numeric: tabular-nums; margin: 2px 0; }
.t-note { font-size: 11.5px; color: var(--muted); line-height: 1.5; }

/* グラフの枠 */
.chart { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 16px 18px 12px; margin: 14px 0; }
.chart figcaption { display: flex; flex-direction: column; gap: 2px; margin-bottom: 8px; }
.chart figcaption strong { font-size: 14px; }
.chart figcaption span { font-size: 12.5px; color: var(--ink-2); }
.canvas { position: relative; width: 100%; }
.data summary { cursor: pointer; font-size: 12.5px; color: var(--ink-2); margin-top: 6px; }
.data .tbl-wrap { margin-top: 6px; }
.data table { font-size: 12.5px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 0 20px; }

/* 条件のランプ（点灯＝条件がそろっている。色だけに頼らず文字も出す） */
.signals { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.sig { display: grid; grid-template-columns: 22px 1fr; gap: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 12px 14px; }
.sig.lit { border-color: rgba(12,163,12,0.45); }
.lamp { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--axis); margin-top: 7px; }
.sig.lit .lamp { background: var(--good); border-color: var(--good); box-shadow: 0 0 0 4px rgba(12,163,12,0.16); }
.sig-top { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; }
.state { font: 700 11px/1.7 var(--num); letter-spacing: 0.06em; border: 1px solid var(--axis); border-radius: 3px; padding: 0 7px; color: var(--muted); }
.sig.lit .state { border-color: var(--good); color: var(--good-text); }
.sig-val { margin-left: auto; font: 700 15px var(--num); font-variant-numeric: tabular-nums; }
.sig p { margin: 2px 0 0; font-size: 13.5px; color: var(--ink-2); }
.sig .why { color: var(--muted); font-size: 12.5px; }

.lessons { margin: 0; padding-left: 1.4em; }
.lessons li { margin: 0 0 12px; }
.lessons p { margin: 2px 0 0; color: var(--ink-2); }

/* 表 */
.tbl-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; }
table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--grid); text-align: left; vertical-align: top; }
thead th { font-size: 11.5px; color: var(--muted); font-weight: 600; background: var(--surface-2); letter-spacing: 0.02em; line-height: 1.4; vertical-align: bottom; }
tbody tr:last-child th, tbody tr:last-child td { border-bottom: 0; }
table.num td { text-align: right; font-family: var(--num); font-size: 13.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.num td.txt, table.num td.flags { font-family: inherit; text-align: left; white-space: normal; }
tbody tr:hover th, tbody tr:hover td { background: var(--wash); }
table.num thead th:not(:first-child) { text-align: right; }
table.num thead th:nth-child(2) { text-align: left; }
table.num thead th:last-child:not(:nth-child(2)) { text-align: left; }
table.scen-t thead th:not(:first-child) { text-align: right; }
table.rank thead th:last-child { text-align: left; }
th small { display: block; font-weight: 400; color: var(--muted); font-size: 11.5px; }
th a { color: var(--ink); text-decoration: none; }
th a:hover { color: var(--accent); text-decoration: underline; }
table.num td.tier { text-align: left; font-family: inherit; }
table.rank thead th:nth-child(3) { text-align: left; }
.tier-m { display: none; }
td.r, th.r { text-align: right; font-family: var(--num); font-variant-numeric: tabular-nums; }
td.rk { font-weight: 700; color: var(--muted); text-align: left !important; }
td.hl { font-weight: 700; color: var(--ink); background: var(--wash); }
table.rank { font-size: 13px; }
table.rank th, table.rank td { padding: 8px 7px; }
.flag { display: inline-block; font-size: 11.5px; border: 1px solid rgba(208,59,59,0.55); color: var(--critical); border-radius: 3px; padding: 0 6px; margin: 1px 3px 1px 0; white-space: nowrap; line-height: 1.6; }
.flag.f-unverified { border-color: var(--axis); color: var(--muted); border-style: dashed; }
.flag.f-hedge, .flag.f-copper { border-color: rgba(154,88,0,0.55); color: var(--accent); }
.ok { color: var(--good-text); font-size: 12.5px; }
sup.unv { color: var(--critical); font-weight: 700; margin-left: 2px; cursor: help; }
sup.unv.soft { color: var(--muted); }
.flag-list { list-style: none; padding: 0; display: grid; gap: 6px; }
.flag-list li { font-size: 13.5px; color: var(--ink-2); }
.flag-list .flag { margin-right: 8px; }
.sources { columns: 2; column-gap: 28px; padding-left: 1.2em; font-size: 13.5px; }
.sources li { break-inside: avoid; margin-bottom: 4px; word-break: break-all; }
.methods li { margin-bottom: 8px; }
.tag { display: inline-block; font: 700 11px/1.8 var(--num); letter-spacing: 0.08em; border-radius: 3px; padding: 0 8px; color: var(--rock); background: var(--hivis); margin-right: 8px; }
.then-line { font-size: 14px; color: var(--ink-2); display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }

/* シナリオ */
.scen { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.sc-btn { display: flex; flex-direction: column; align-items: flex-start; font: inherit; font-size: 12px; line-height: 1.4; color: var(--ink-2);
  background: var(--surface); border: 1px solid var(--border); border-radius: 4px; padding: 6px 12px; cursor: pointer; }
.sc-btn b { font: 700 16px var(--num); color: var(--ink); }
.sc-btn:hover { border-color: var(--accent); }
.sc-btn.on { border-color: var(--ink); box-shadow: inset 0 -3px 0 var(--hivis); }
.sc-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
td.neg { color: var(--critical); }

/* 銘柄 */
.toc { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 24px 0 0; font-size: 13.5px; }
.co-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 0; margin: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; font-size: 13.5px; }
.facts dt, .facts dd { padding: 6px 12px; border-bottom: 1px solid var(--grid); margin: 0; }
.facts dt { color: var(--ink-2); font-size: 12.5px; }
.facts dd { font-family: var(--num); font-variant-numeric: tabular-nums; }
.facts dd small { font-family: system-ui, sans-serif; color: var(--muted); }
.facts dt:last-of-type, .facts dd:last-of-type { border-bottom: 0; }
.countries { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 4px; font-size: 13px; }
.countries li { display: grid; grid-template-columns: 150px 1fr 44px; gap: 8px; align-items: center; }
/* 国別の生産の棒。ヘッダーの .bar（固定表示）と名前がぶつからないよう cbar にする */
.countries .cbar { height: 8px; background: var(--grid); border-radius: 0 4px 4px 0; overflow: hidden; }
.countries .cbar i { display: block; height: 100%; background: var(--s1); border-radius: 0 4px 4px 0; }
.countries li > span:last-child { text-align: right; font-family: var(--num); }
.cty small { color: var(--critical); margin-left: 4px; font-size: 11px; }

/* ETFの内訳（1系列の横棒。項目名と数字は文字で出す） */
.hbars { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 5px; font-size: 13px; }
.hbars li { display: grid; grid-template-columns: minmax(120px, 42%) 1fr 52px; gap: 8px; align-items: center; }
.hb-b { height: 10px; background: var(--grid); border-radius: 0 4px 4px 0; overflow: hidden; }
.hb-b i { display: block; height: 100%; background: var(--s1); border-radius: 0 4px 4px 0; }
.hb-v { text-align: right; font-family: var(--num); font-variant-numeric: tabular-nums; }

footer.site-foot { max-width: 1120px; margin: 0 auto; padding: 18px 20px 40px; border-top: 1px solid var(--grid);
  display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 13px; color: var(--muted); }
footer.site-foot a { color: var(--ink); }

@media (max-width: 720px) {
  body { font-size: 14.5px; }
  .bar-in { padding: 10px 14px 4px; gap: 10px; }
  /* 文字を大きくしている端末でもヘッダーが折り返さないように */
  .logo { min-width: 0; }
  .logo .mark { font-size: 10px; letter-spacing: 0.16em; white-space: nowrap; }
  .logo .name { white-space: nowrap; }
  .tools { flex-shrink: 0; gap: 6px; }
  .lang, .theme { font-size: 11px; padding: 3px 8px; }
  .logo .name { font-size: 18px; }
  main { padding: 4px 14px 20px; }
  .grid2, .co-grid { grid-template-columns: 1fr; }
  .sources { columns: 1; }
  .chart { padding: 12px 10px 8px; }
  .sig-val { margin-left: 0; width: 100%; }
  .sig { padding: 10px 12px; gap: 8px; }
  .block { margin: 28px 0; }
  .block > h2 { font-size: 19px; }
  .hero { padding: 28px 0 6px; }
  .lead { font-size: 15px; }
  .tiles { grid-template-columns: 1fr 1fr; gap: 8px; }
  .t-val { font-size: 21px; }
  .countries li { grid-template-columns: 110px 1fr 40px; }

  /* 表はスマホ幅では1行を1枚のカードにする（列の見出しをセルの前に出す） */
  .tbl-wrap { overflow: visible; background: transparent; border: 0; border-radius: 0; }
  table.stack thead { display: none; }
  table.stack, table.stack tbody, table.stack tr { display: block; width: 100%; }
  table.stack tr { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 10px 14px; margin-bottom: 8px; }
  tbody tr:hover th, tbody tr:hover td { background: transparent; }
  table.stack th[scope="row"] { display: block; padding: 0 0 6px; border: 0; font-size: 15px; }
  table.stack th[scope="row"] small { display: inline; margin-left: 6px; }
  table.stack td { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 3px 0; border: 0;
    text-align: right; white-space: normal; min-width: 0 !important; }
  table.stack td::before { content: attr(data-label); color: var(--muted); font-size: 12px; text-align: left; flex: 0 1 auto; }
  table.stack td[data-label=""]::before { content: none; }
  table.stack td.txt { display: block; text-align: left; color: var(--ink-2); font-size: 13px; padding: 0 0 4px; }
  table.stack td.flags { justify-content: flex-start; flex-wrap: wrap; text-align: left; }
  /* 数字の表は2〜3列に並べて縦を短くする（見出しを数字の上に） */
  table.num.stack tr { display: grid; grid-template-columns: 1fr 1fr; column-gap: 14px; row-gap: 4px; }
  table.rank.stack tr { grid-template-columns: repeat(3, 1fr); column-gap: 10px; }
  table.num.stack th[scope="row"], table.num.stack td.flags { grid-column: 1 / -1; }
  table.num.stack td { flex-direction: column; align-items: flex-start; gap: 0; text-align: left; padding: 2px 0; font-size: 15px; font-weight: 600; }
  table.num.stack td::before { font-weight: 400; font-size: 11.5px; line-height: 1.4; }
  table.num.stack td.txt { font-weight: 400; font-size: 13px; }
  table.num.stack td.rk { position: absolute; }
  table.num.stack tr { position: relative; }
  table.num.stack td.rk { top: 10px; right: 14px; font-size: 20px; color: var(--accent); }
  table.num.stack td.rk { flex-direction: row; align-items: baseline; }
  table.num.stack td.rk::before { content: "#"; font-size: 14px; color: var(--accent); }
  table.holds.stack tr { position: relative; }
  table.holds.stack td.rk { position: absolute; top: 10px; right: 14px; }
  table.holds.stack td.rk::before { content: "#"; }
  table.num.stack td.flags { flex-direction: row; align-items: center; font-weight: 400; }
  table.num.stack td.hl { background: transparent; }
  table.status td { display: block; text-align: left; padding: 4px 0; }
  table.status td::before { display: block; font-size: 11.5px; margin-bottom: 1px; }
  /* 順位の表：種類は会社名の横へ、空のセル（—）は出さない */
  .tier-m { display: inline; }
  table.rank.stack td.tier, table.stack td.na { display: none; }
  table.num.stack td { font-size: 16px; }
  table.num.stack td::before { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  table.rank.stack tr, table.scen-t.stack tr, table.three.stack tr { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  table.rank.stack tr { padding: 10px 12px; }
  table.rank.stack th[scope="row"] { padding-right: 36px; }
  table.scen-t.stack tr, table.three.stack tr { padding: 8px 12px; margin-bottom: 6px; }
  table.scen-t.stack th[scope="row"], table.three.stack th[scope="row"] { padding-bottom: 2px; font-size: 14px; }
  /* ETFの上位銘柄：比率・種類・地域を1行に */
  table.holds.stack tr { padding: 8px 12px; margin-bottom: 6px; }
  table.holds.stack th[scope="row"] { padding: 0 36px 2px 0; font-size: 14px; }
  table.holds.stack td:not(.rk) { display: inline; padding: 0; font-size: 12.5px; color: var(--ink-2); }
  table.holds.stack td:not(.rk)::before { content: none; }
  table.holds.stack td.r { font-weight: 700; color: var(--ink); }
  table.holds.stack td.txt:not(:last-child)::after, table.holds.stack td.r::after { content: "・"; color: var(--muted); }
  table.holds.stack td.rk { font-size: 16px; color: var(--accent); display: flex; gap: 0; }
  table.num.stack td.flags::before, table.stack td.flags::before { margin-right: 6px; }
  /* 銘柄のページの数字の一覧：見出しと値を横に並べる */
  .facts { grid-template-columns: minmax(0, 44%) minmax(0, 1fr); font-size: 13px; }
  .facts dt, .facts dd { padding: 6px 10px; border-bottom: 1px solid var(--grid); }
  .facts dt { font-size: 11.5px; line-height: 1.45; }
  .facts dd { line-height: 1.5; }
  .facts dd small { display: block; font-size: 11px; line-height: 1.4; }
  .countries li { grid-template-columns: 38% 1fr 36px; font-size: 12.5px; }
  .toc { gap: 4px 12px; font-size: 13px; }
  .tabs { -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); }
}
@media (forced-colors: active) {
  .lamp, .hb-b i, .countries .cbar i { forced-color-adjust: none; }
}
