/* サイト全体の見た目。色や余白は、デザインのキャンバス「トップページのイメージ」に合わせている。
   CSP（style-src 'self'）のため、見た目の指定はすべてこのファイルに書く（HTML に style="…" は書かない）。 */

:root {
  --accent: #2f5b9c;        /* サイドバーや選択中のボタンの青 */
  --accent-weak: #e8eef7;
  --bg: #eef1f5;
  --card: #ffffff;
  --head: #f5f6f8;
  --line: #dde2ea;
  --grid: #e6e9ef;
  --ink: #1c1e21;
  --ink-2: #44494f;
  --muted: #5f6670;
  --side-muted: #d6e0ef;
  --side-ring: #a9d2ff;     /* サイドバーの、円を描いて流れる文字（背景が濃い青なので、明るい青にしてある） */
  --side-navy: #183258;     /* サイドバーの下の横顔の影絵（v15.5。ページ下の行の帯は v19.2 で無くした） */
  --warn-bg: #fff1e6;
  --warn-ink: #a65308;
  /* グラフの色（JavaScript 側の js/chartkit.js と同じ値） */
  --c-blue: #2f5b9c;
  --c-orange: #c96a12;
  --c-green: #1baf7a;
  --c-yellow: #eda100;
  --c-pink: #e87ba4;
  --c-red: #d1242f;         /* 通貨強度の EUR の線（赤。v17.3。利用者の希望） */
  --c-sky: #1f97cc;         /* 通貨強度の JPY の線（水色。v17.3。白い地でも線が見える濃さ） */
  --c-ramp1: #5598e7;
  --c-ramp2: #86b6ef;
  /* 上げ下げの色（v15.6 から上昇が青・下落が赤。プラス＝青・マイナス＝赤。v15.5 までは日本の株価の表示にならって逆だった） */
  --c-up: #3f73b8;
  --c-down: #c24a36;
  --c-flat: #c3c8d0;
  --c-gray: #8a919b;        /* 残存営業日・出来高などの、色を付けない系列 */
  --c-gray-strong: #5f6670; /* 大引け（15:30）の出来高の棒（ふつうの灰色より濃い。v15.3） */
  --c-nikkei: #d1242f;      /* 個別銘柄の値動きの日経平均の線（太い赤。v15.7） */
  --c-call: #e4572e;        /* 日経225オプションのコール（オレンジ寄りの赤。v19.2。利用者の希望。プットは --c-blue） */
  /* 以下は v16 で変数にしたもの（暗い色では下の html[data-theme="dark"] で値を変える。明るい色の値は v15.9 までと同じ） */
  --surface: #ffffff;       /* ボタン・入力欄・吹き出しなど、カードの上に置くものの白 */
  --neutral: #f0efec;       /* 「変わらず」のマス（通貨強度・ヒートマップのまん中・判定の「標準的」） */
  --hover-line: #b9c1cd;    /* ボタンにカーソルを合わせたときの枠 */
  --link: #2f5b9c;          /* 文字のリンク・押せる銘柄名（明るい色では --accent と同じ） */
  --link-hover: #1f4573;
  --axis: #9aa1ab;          /* グラフの軸・横棒のまん中の線 */
  --side-bg: #2f5b9c;       /* サイドバーと下のメニューの青（明るい色では --accent と同じ） */
  --side-current: #ffffff;  /* サイドバーの選択中のページの地 */
  --warn-line: #f0cba8;
  --warn-text: #6b3602;
  --badge-bg: #eef1f5;      /* 経済指標の「中」の印 */
  --shimmer: rgba(28, 30, 33, 0.06);   /* 読み込み中の骨組みの板（v16） */
  --shimmer-glow: rgba(28, 30, 33, 0.02);
  /* ヒートマップの7段階（0＝大きく下落（赤）… 3＝変わらず … 6＝大きく上昇（青）。js/chartkit.js は、この値を読んで使う） */
  --heat-0: #c24a36;
  --heat-1: #e08572;
  --heat-2: #f3c1b5;
  --heat-3: #f0efec;
  --heat-4: #b9cdea;
  --heat-5: #7da3d8;
  --heat-6: #3f73b8;
  /* 上に文字をのせるマス用（参照マトリックス・判定・通貨強度）。両端だけ、文字が読める明るさにとどめたもの */
  --heat-soft-0: #df644f;
  --heat-soft-1: #e08572;
  --heat-soft-2: #f3c1b5;
  --heat-soft-3: #f0efec;
  --heat-soft-4: #b9cdea;
  --heat-soft-5: #7da3d8;
  --heat-soft-6: #5e8bc9;
}

/* 暗い色（v16。端末の設定か、About・サイドバーの切り替えで。js/theme.js が <html data-theme="dark"> を付ける）。
   地は黒に近い灰色、文字は白に近い灰色。青・赤などの色は、暗い地の上で見えるように少し明るくしてある。
   色の決まり（上昇＝青・下落＝赤、ヒートマップの並び）は明るい色と同じ */
html[data-theme="dark"] {
  color-scheme: dark;
  --accent: #2f5b9c;
  --accent-weak: #22344f;
  --bg: #15181d;
  --card: #1e2329;
  --head: #242a31;
  --line: #353c46;
  --grid: #2b323b;
  --ink: #e6e8eb;
  --ink-2: #c3c8d0;
  --muted: #9aa2ac;
  --side-muted: #c5d2e4;
  --side-ring: #9ec8f7;
  --side-navy: #122440;
  --warn-bg: #3a2a16;
  --warn-ink: #f0b36b;
  --c-blue: #6f9be0;
  --c-orange: #e8893a;
  --c-green: #34c48f;
  --c-yellow: #f2b733;
  --c-pink: #f08fb5;
  --c-red: #f05a64;
  --c-sky: #5ccbf2;
  --c-ramp1: #5f9ae8;
  --c-ramp2: #8bbaf0;
  --c-up: #6f9be0;
  --c-down: #e3685a;
  --c-flat: #5b636e;
  --c-gray: #8f98a3;
  --c-gray-strong: #aab2bc;
  --c-nikkei: #f05a64;
  --c-call: #f27a54;
  --surface: #262c34;
  --neutral: #2b3139;
  --hover-line: #566270;
  --link: #8db4f0;
  --link-hover: #b4cdf6;
  --axis: #6b7682;
  --side-bg: #24446f;
  --side-current: #e3e9f2;
  --warn-line: #7a4d1a;
  --warn-text: #f0b36b;
  --badge-bg: #2b3139;
  --shimmer: rgba(230, 232, 235, 0.08);
  --shimmer-glow: rgba(230, 232, 235, 0.03);
  --heat-0: #d6584a;
  --heat-1: #9c4a3f;
  --heat-2: #5e3d3a;
  --heat-3: #2b3139;
  --heat-4: #2c4260;
  --heat-5: #3a6499;
  --heat-6: #6f9be0;
  --heat-soft-0: #ab4134;
  --heat-soft-1: #8c463c;
  --heat-soft-2: #5e3d3a;
  --heat-soft-3: #2b3139;
  --heat-soft-4: #2c4260;
  --heat-soft-5: #38598a;
  --heat-soft-6: #3b67a6;
}
html[data-theme="light"] { color-scheme: light; }
/* Highcharts の既定の色（ナビゲータなど）は、グラフの枠の color-scheme で明るい／暗いが決まる（vendor/highcharts/highcharts-palette.css）。
   js/chartkit.js で colorScheme を inherit にしてあるので、上の html の color-scheme がそのまま効く */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }
/* ページ内のリンク（#…）で移動するときは、なめらかに動かす（動きを減らす設定の人には、すぐに切り替える） */
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
.card[id], .card-row[id] { scroll-margin-top: 12px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.7;
}

a { color: var(--link); }
a:hover { color: var(--link-hover); }

h1, h2, h3, p, ul, ol, dl, dd, fieldset, legend { margin: 0; padding: 0; }
ul, ol { list-style: none; }
fieldset { border: 0; min-width: 0; }
button, input, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }

:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.sidebar :focus-visible, .tabbar :focus-visible { outline-color: #ffffff; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

.skip-link {
  position: absolute; left: 8px; top: -60px; z-index: 30;
  padding: 10px 14px; border-radius: 6px; background: var(--ink); color: var(--bg);
}
.skip-link:focus { top: 8px; color: var(--bg); }

.icon {
  flex: 0 0 auto; width: 18px; height: 18px;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}

/* ---------- 全体のレイアウト（左にサイドバー、右に本文） ---------- */

/* 背景の左 240px を青くしておく（ページが長いときも、サイドバーの色が下まで続くように） */
.layout { display: flex; min-height: 100vh; background: linear-gradient(90deg, var(--side-bg) 0 240px, transparent 240px); }

.sidebar {
  flex: 0 0 240px; position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 20px;
  padding: 20px 14px; background: var(--side-bg); color: #ffffff;
}

/* サイト名（文字だけ。ロゴは置かない） */
.brand, .mobile-brand { display: flex; align-items: center; text-decoration: none; font-weight: 700; letter-spacing: 0.02em; }
.brand { min-height: 44px; padding: 0 12px; color: #ffffff; font-size: 19px; }
.brand:hover { color: #ffffff; }
.mobile-brand { display: none; color: var(--link); font-size: 15px; }

.nav { display: flex; flex-direction: column; gap: 18px; }
.nav ul { display: flex; flex-direction: column; gap: 2px; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-label { padding: 0 12px 4px; font-size: 12px; font-weight: 700; color: var(--side-muted); }
.nav a {
  display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px;
  border-radius: 6px; color: #ffffff; font-weight: 500; text-decoration: none;
}
.nav a:hover { background: rgba(255, 255, 255, 0.14); }
.nav a[aria-current="page"] { background: var(--side-current); color: var(--side-bg); font-weight: 700; }

/* メニューの下の空いた場所（v15.5）：横顔の影絵（紺）が、下のページ下の行（同じ紺）から立ち上がる。頭のうしろにぼかした光、
   頭のまわりの円に沿って英文がゆっくり回る（左へ向かって＝反時計回り。文字は影絵のうしろを通る）。絵は templates/base.html。
   絵は幅 240px（サイドバーの端から端まで）・高さ 336px（viewBox 240×336）で、空きの下の端に置く。空きが 336px より低いときは、
   絵全体を縮める（頭も円も切らない。preserveAspectRatio の meet で、まん中・下にそろえる）。空きが 240px より低いとき（英文が 8px より
   小さくなるとき）は円の英文を外し、120px より低いときは何も出さない。
   回転の中心は円の中心（絵の座標で 122.2, 124.8）。v15.4 までの「円の左上の 1/4 の弧だけ見える英文」は、この円に変わった */
.sidebar-art { flex: 1 1 auto; min-height: 0; display: flex; align-items: flex-end; margin: 0 -14px -20px; container-type: size; }
.sidebar-scene { display: block; width: 100%; height: 100%; max-height: 336px; }
.sidebar-glow { fill: url(#sidebar-glow); }
.sidebar-glow-0 { stop-color: #e8f1ff; stop-opacity: 0.3; }
.sidebar-glow-1 { stop-color: #cfe0f8; stop-opacity: 0.1; }
.sidebar-glow-2 { stop-color: #cfe0f8; stop-opacity: 0; }
/* 回る位置は時計に合わせる（v19.1。js/theme.js が --ring-delay を決める。ページを切り替えても、前のページの続きから回る） */
.sidebar-ring-turn { transform-origin: 122.2px 124.8px; animation: sidebar-ring-turn 50s linear var(--ring-delay, 0s) infinite; }
.sidebar-ring-text { fill: var(--side-ring); font-size: 11.5px; font-weight: 500; }
.sidebar-figure { fill: var(--side-navy); fill-rule: evenodd; }
@keyframes sidebar-ring-turn { to { transform: rotate(-360deg); } }
@container (max-height: 239px) { .sidebar-ring-turn { display: none; } }
@container (max-height: 119px) { .sidebar-scene { display: none; } }
@media (prefers-reduced-motion: reduce) { .sidebar-ring-turn { animation: none; } }

/* ページ下の行の紺の帯（v15.5〜v19.1）は v19.2 で無くした（名乗りは v19.1 で本文の下 .site-foot へ）。
   影絵は、サイドバーの下の端（.sidebar-art の下の端）から立ち上がる */

/* 上の余白は、右上の表示の色のボタン（.main-top。v16）が入る分だけ広い */
.main { position: relative; flex: 1 1 0; min-width: 0; padding: 52px 28px 28px; display: flex; flex-direction: column; gap: 16px; }
.main:focus { outline: none; }
/* 本文の下の行：サイトの名乗り（v19.1。サイドバーの下から移した。スマホでも出す）。本文が短いページでは、画面のいちばん下に置く */
.site-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); }
.site-foot small { font-size: 12px; color: var(--muted); }
#dashboard { display: flex; flex-direction: column; gap: 16px; }

.tabbar { display: none; }
.to-top { display: none; }   /* 一番上へ戻るボタンは、スマホだけ（下の「画面の幅がせまいとき」） */

/* ---------- 見出し・ボタン・お知らせ ---------- */

.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; }
.page-head h1 { font-size: 24px; font-weight: 700; line-height: 1.4; }

.btn {
  display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink-2);
  font-size: 13px; font-weight: 500; cursor: pointer;
}
.btn:hover { border-color: var(--hover-line); }
.btn[disabled] { opacity: 0.6; cursor: progress; }
.btn .icon { width: 16px; height: 16px; }

.notice { padding: 10px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); font-size: 13px; }
.notice-warn { border-color: var(--warn-line); background: var(--warn-bg); color: var(--warn-text); }

.panel {
  padding: 18px 20px; border: 1px solid var(--line); border-radius: 8px; background: var(--card);
  display: flex; flex-direction: column; gap: 10px;
}
.panel h2 { font-size: 16px; }
.notes { list-style: disc; padding-left: 1.4em; display: flex; flex-direction: column; gap: 4px; }
/* About のサイト表明（文は templates の about.html に書いてある）。v19.1 から、名言を読み込んだあとは名言（.quote）を出す */
.panel-statement { padding: 22px 20px; }
.statement { font-size: 20px; font-weight: 700; line-height: 1.5; color: var(--link); }
.quote { display: flex; flex-direction: column; gap: 10px; margin: 0; }
.quote-text { margin: 0; font-size: 18px; font-weight: 700; line-height: 1.7; color: var(--link); overflow-wrap: anywhere; }
.quote-by { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: flex-end; gap: 2px 14px; font-size: 13px; color: var(--ink-2); }
.quote-name::before { content: "— "; }
/* 数字の見方（v19.1 でページごとに区切った。上の行は、それぞれの区切りへ移るボタン） */
.panel-notes { gap: 14px; }
.notes-jump { display: flex; flex-wrap: wrap; gap: 6px; }
.notes-jump a {
  display: inline-flex; align-items: center; min-height: 36px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink-2);
  font-size: 13px; font-weight: 500; text-decoration: none; white-space: nowrap;
}
.notes-jump a:hover { border-color: var(--hover-line); color: var(--ink); }
.notes-group { display: flex; flex-direction: column; gap: 8px; padding-top: 12px; border-top: 1px solid var(--grid); scroll-margin-top: 16px; }
.notes-group h3 { font-size: 15px; font-weight: 700; color: var(--ink); }
.notes-group h3 .sub { margin-left: 4px; font-size: 12px; font-weight: 500; color: var(--muted); }
/* About の管理者の欄（「Bluesky: @…」「Twitter(X): @…」を1行ずつ。v15.8） */
.admin-links { display: flex; flex-direction: column; gap: 4px; }

.link-list { display: flex; flex-direction: column; }
.link-list a {
  display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 6px 4px;
  border-top: 1px solid var(--grid); color: var(--ink); text-decoration: none;
}
.link-list li:first-child a { border-top: 0; }
.link-list a:hover strong { text-decoration: underline; }
.link-list .icon { color: var(--link); width: 22px; height: 22px; }
.link-list span { display: flex; flex-direction: column; line-height: 1.5; }
.link-list small { color: var(--muted); font-size: 12px; }

table.plain { width: 100%; border-collapse: collapse; font-size: 13px; }
table.plain th, table.plain td { padding: 8px; border-bottom: 1px solid var(--grid); text-align: left; vertical-align: top; }
table.plain th { background: var(--head); font-size: 12px; color: var(--ink-2); }
.num { text-align: right !important; font-variant-numeric: tabular-nums; }

/* ---------- カード ---------- */

.card-row { display: flex; flex-wrap: wrap; gap: 16px; }

.card {
  flex: 1 1 520px; min-width: 0; display: flex; flex-direction: column; overflow: hidden;
  border: 1px solid var(--line); border-radius: 8px; background: var(--card);
}
.card-wide { flex: 3 1 600px; }
.card-narrow { flex: 2 1 400px; }

.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--head);
}
.card-head h2 { font-size: 14px; font-weight: 700; line-height: 1.5; }
.card-meta { flex: 0 0 auto; font-size: 12px; color: var(--muted); }
.card-body { flex: 1 1 auto; padding: 14px 16px 12px; display: flex; flex-direction: column; gap: 10px; }
.card-body h3 { font-size: 12px; font-weight: 700; color: var(--ink-2); }
.card-body h3 .sub { margin-left: 6px; font-weight: 500; color: var(--muted); }

/* 切り替えのボタン類（押せる部分の高さは 44px 以上にしている） */
.controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
/* 左に凡例、右に選択欄（米国株価指数）。凡例が長いときは、凡例のほうを折り返す */
.controls-split { flex-wrap: nowrap; justify-content: space-between; }
.controls-split .legend { flex: 1 1 auto; min-width: 0; }
.controls-split .field { flex: 0 0 auto; }

.seg, .field { display: flex; align-items: center; gap: 8px; }
.seg legend, .chips legend, .field label { float: left; font-size: 12px; font-weight: 700; color: var(--ink-2); }
.seg-box { display: flex; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.seg-box button {
  min-height: 44px; padding: 0 12px; border: 0; border-radius: 6px; background: transparent;
  color: var(--ink-2); font-size: 13px; font-weight: 500; cursor: pointer; white-space: nowrap;
}
.seg-box button:hover { background: var(--head); }
.seg-box button[aria-pressed="true"] { background: var(--accent); color: #ffffff; font-weight: 700; }

/* 複数を選べるボタン（比較する日など）。角丸の四角で、ほかのボタン（.btn・.seg-box）と同じ丸み */
.chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.chips legend { margin-right: 2px; }
.chip {
  min-height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface);
  color: var(--ink-2); font-size: 13px; font-weight: 500; cursor: pointer; white-space: nowrap;
}
.chip:hover { border-color: var(--hover-line); }
.chip[aria-pressed="true"] { border-color: var(--link); background: var(--accent-weak); color: var(--link); font-weight: 700; }
.hint { font-size: 12px; color: var(--muted); }
.hint.is-alert { color: var(--warn-ink); font-weight: 700; }

.field select {
  min-height: 44px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); color: var(--ink); font-size: 13px;
}

/* 凡例（線の色と名前の対応） */
.legend { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 12px; color: var(--ink-2); }
.legend-tight { gap: 2px 12px; }
.legend li { display: flex; align-items: center; gap: 6px; }
.legend strong { font-size: 13px; color: var(--ink); font-variant-numeric: tabular-nums; }
/* 凡例の騰落率に上げ下げの色（v20） */
.legend strong.pos { color: var(--c-up); }
.legend strong.neg { color: var(--c-down); }
.legend .date { color: var(--muted); }
/* 凡例の最後に添える短い注記（例：前日終値＝0%） */
.legend .legend-note { color: var(--muted); }
.swatch { flex: 0 0 auto; width: 20px; height: 2px; border-radius: 2px; background: var(--muted); }
.swatch-thick { height: 3px; }
/* 指数（日経平均・S&P500）の線の見本：赤の太い点線（v19.1。グラフと同じ 3.5px の点と 7px の間） */
/* 指数の線の凡例（赤の太い破線。v20。線 10.5px・間 7px。v19.1 は点線） */
.swatch-dots-nikkei { height: 3.5px; border-radius: 0; background: repeating-linear-gradient(90deg, var(--c-nikkei) 0 10.5px, transparent 10.5px 17.5px); }
.swatch-dash { background: repeating-linear-gradient(90deg, var(--c-ramp2) 0 5px, transparent 5px 8px); }
.c-blue { background-color: var(--c-blue); }
.c-orange { background-color: var(--c-orange); }
.c-green { background-color: var(--c-green); }
.c-yellow { background-color: var(--c-yellow); }
.c-pink { background-color: var(--c-pink); }
.c-red { background-color: var(--c-red); }
.c-sky { background-color: var(--c-sky); }
.c-ramp1 { background-color: var(--c-ramp1); }
.c-ramp2 { background-color: var(--c-ramp2); }
.c-ink { background-color: var(--ink); }
.c-nikkei { background-color: var(--c-nikkei); }
.c-call { background-color: var(--c-call); }
.c-up { background-color: var(--c-up); }
.c-down { background-color: var(--c-down); }
.c-gray { background-color: var(--c-gray); }
/* 面や棒で描く系列の見本（線の見本より太い四角） */
.swatch-box { width: 10px; height: 10px; border-radius: 2px; }
.swatch-box + .swatch-box { margin-left: -3px; }
/* 縦の線の見本（分布の図の、P25・中央値・P75・現在の線） */
.swatch-v { width: 1px; height: 12px; border-radius: 0; background: var(--ink); }
.swatch-v-dash { background: repeating-linear-gradient(180deg, var(--ink) 0 3px, transparent 3px 5px); }
.swatch-v-now { width: 3px; }

/* グラフを描く枠（高さはここで決め、Highcharts が枠に合わせて描く） */
.chart { width: 100%; height: 230px; }
/* となりのカードのほうが背が高いときは、カードの下に空きができないよう、グラフを縦に伸ばす（上限まで） */
.chart-tall { flex: 1 1 270px; height: auto; min-height: 270px; max-height: 460px; }
.empty { padding: 28px 8px; text-align: center; font-size: 13px; color: var(--muted); }

/* VIX の3つの数字 */
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.stat { padding: 8px 10px; border-radius: 6px; background: var(--head); }
.stat dt { font-size: 12px; line-height: 1.5; color: var(--ink-2); }
.stat dd { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 6px; font-size: 20px; font-weight: 700; line-height: 1.3; font-variant-numeric: tabular-nums; }
.stat-tag { font-size: 12px; font-weight: 700; color: var(--ink-2); }

/* 通貨強度：左に推移の線、右に「今の強さ」（1列） */
.split { display: flex; gap: 20px; }
.split-side { flex: 0 0 150px; display: flex; flex-direction: column; gap: 6px; }
.split-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
/* 今の強さ：強い通貨から順に並べたマス。背景の色は、強さに応じて JavaScript が付ける（js/chartkit.js の heatBlend）。
   左のグラフと下端がそろうように、マスの高さを伸ばす */
.fxstrip { flex: 1 1 auto; display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.fxstrip li {
  flex: 1 1 36px; min-height: 36px; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 0 10px; border-radius: 3px; background: var(--neutral); color: var(--ink); font-variant-numeric: tabular-nums;
}
.fxstrip .fx-code { font-weight: 700; }

/* 2つ並べるグラフ（原油・金、日米のイールドカーブ） */
.pair { flex: 1 1 auto; display: flex; gap: 20px; }
.pair-item { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.pair-item .chart { flex: 1 1 200px; height: auto; min-height: 200px; max-height: 380px; }
.value-line { display: flex; align-items: baseline; gap: 8px; }
.value-line strong { font-size: 20px; line-height: 1.3; font-variant-numeric: tabular-nums; }
.value-line span { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
/* 期間の騰落率の数字に上げ下げの色（v20。.value-line span より強い指定で上書き） */
.value-line .pos { color: var(--c-up); }
.value-line .neg { color: var(--c-down); }

/* 経済指標カレンダー */
.cal { width: 100%; border-collapse: collapse; font-size: 13px; }
.cal th { white-space: nowrap; padding: 6px 8px; border-bottom: 1px solid var(--line); background: var(--head); text-align: left; font-size: 12px; font-weight: 700; color: var(--ink-2); }
.cal td { padding: 9px 8px; border-bottom: 1px solid var(--grid); vertical-align: top; }
.cal .cal-time { white-space: nowrap; font-variant-numeric: tabular-nums; }
.cal .cal-cur { font-weight: 700; }
.cal .cal-day th { background: var(--card); padding-top: 12px; font-size: 12px; color: var(--ink); }
.cal tr.is-past td { color: var(--muted); }
.badge { display: inline-block; padding: 0 6px; border-radius: 4px; font-size: 12px; font-weight: 700; line-height: 1.7; }
.badge-high { background: var(--warn-bg); color: var(--warn-ink); }
.badge-medium { background: var(--badge-bg); color: var(--ink-2); }

/* ページの下の「データの更新状況」 */
.status { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.status-title { margin-right: 1em; }
.status-item { margin-right: 1em; white-space: nowrap; }
.status-item.is-failed { color: var(--warn-ink); font-weight: 700; }
.status-item[title] { cursor: help; }

/* ---------- 株式ページ ---------- */

#stocks-page, #vix-page, #words-page, .page-body { display: flex; flex-direction: column; gap: 16px; }
/* カードを縦に積むところでは、高さを中身に合わせる（.card の flex は、横に並べるとき用の指定なので打ち消す。
   v15.6 で Words のページも、ほかのページと同じだけカードのあいだをあけた） */
.page-body > .card, #words-page > .card { flex: 0 0 auto; }

/* いちばん上の行：左にページ内の移動、右に日付の切り替え（前の取引日・日付・次の取引日） */
#stocks-page .page-head { align-items: center; }
.date-nav { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.icon-btn {
  flex: 0 0 auto; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink-2); cursor: pointer;
}
.icon-btn:hover { border-color: var(--hover-line); }
.icon-btn[disabled] { opacity: 0.4; cursor: default; }
.icon-btn .icon { width: 16px; height: 16px; }
.date-field {
  display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--surface);
}
.date-field label { font-size: 12px; font-weight: 700; color: var(--ink-2); white-space: nowrap; }
.date-field input { min-height: 40px; min-width: 0; border: 0; background: transparent; color: var(--ink); font-size: 13px; }

/* ページ内の移動（角丸の四角のボタン） */
.jump { display: flex; flex-wrap: wrap; gap: 6px; }
.jump a {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink-2);
  font-size: 13px; font-weight: 500; text-decoration: none; white-space: nowrap;
}
.jump a:hover { border-color: var(--hover-line); color: var(--ink); }

/* いちばん上の数字 */
.tiles { display: flex; flex-wrap: wrap; gap: 12px; }
.tile { flex: 1 1 170px; min-width: 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); }
.tile dt { font-size: 12px; color: var(--ink-2); }
.tile dd { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 8px; }
.tile-value { font-size: 20px; font-weight: 700; line-height: 1.3; font-variant-numeric: tabular-nums; }
.tile-sub { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

.seg-wrap, .seg-wrap .seg-box { flex-wrap: wrap; }

/* 個別銘柄の値動き：左にグラフ、右に抽出銘柄の表 */
.lines { display: flex; flex-wrap: wrap; gap: 20px; }
.lines-main { flex: 3 1 480px; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
/* container-type：この枠の幅に合わせて、中の表の形を変えられるようにする（下の @container を参照） */
.lines-side { flex: 2 1 320px; min-width: 0; display: flex; flex-direction: column; gap: 6px; container-type: inline-size; }
/* 右の表のほうが背が高いとき（「自分で選ぶ」で入力欄が出ているときなど）は、グラフを下まで伸ばして、空きを作らない */
.chart-lines { flex: 1 1 340px; height: auto; min-height: 340px; max-height: 520px; }

table.mini { width: 100%; border-collapse: collapse; font-size: 13px; }
table.mini th {
  padding: 6px 8px; border-bottom: 1px solid var(--line); background: var(--head);
  text-align: left; font-size: 12px; font-weight: 700; color: var(--ink-2); white-space: nowrap;
}
table.mini td { height: 44px; padding: 0 8px; border-bottom: 1px solid var(--grid); font-variant-numeric: tabular-nums; }
/* 銘柄名の列は、残りの幅をすべて使い、入りきらない名前は「…」で切る（表が枠からはみ出さないように） */
table.mini-picks td:first-child { width: 100%; max-width: 0; }
table.mini-picks td.num, table.mini-picks th.num { white-space: nowrap; }
.pick-name { display: flex; align-items: center; gap: 6px; min-width: 0; }
/* 銘柄名と、その後ろの銘柄コード。コードは省かない（名前が長いときは、名前のほうを「…」で切る） */
.pick-label { flex: 1 1 auto; min-width: 0; display: flex; }
.pick-label .name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-label .code { flex: 0 0 auto; color: var(--ink-2); white-space: nowrap; }
.pick-remove {
  flex: 0 0 auto; width: 36px; height: 44px; margin: 0 -8px 0 auto; display: flex; align-items: center; justify-content: center;
  border: 0; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer;
}
.pick-remove:hover { background: var(--head); color: var(--ink); }
.pick-remove .icon { width: 14px; height: 14px; }
/* 表を置く枠の幅が 480px より狭いとき（スマホや、幅のせまいパソコン画面）は、1銘柄を2段にする。
   上の段に「銘柄名（コード）」を省かずに書き（長い名前は折り返す）、下の段に数字4つ（終値・騰落率・出来高乖離・値幅乖離）を並べる。
   数字の列の幅は、見出しの文字が入る最小の幅（左右の余白は 6px）にして、幅 320px の画面にも収まるようにしてある */
@container (max-width: 479px) {
  table.mini-picks, table.mini-picks thead, table.mini-picks tbody { display: block; }
  table.mini-picks tr { display: grid; grid-template-columns: minmax(0, 1fr) 4.6em 4.9em 5.6em 4.8em; }
  table.mini-picks tbody tr { border-bottom: 1px solid var(--grid); }
  table.mini-picks th { padding-left: 6px; padding-right: 6px; }
  table.mini-picks td { height: auto; border-bottom: 0; }
  table.mini-picks td:first-child { grid-column: 1 / -1; width: auto; max-width: none; padding: 7px 8px 0; }
  table.mini-picks td:only-child { padding-bottom: 7px; }
  table.mini-picks td:nth-child(2) { grid-column: 2; }
  table.mini-picks td.num { padding: 0 6px 7px; }
  /* 色の線と「×」のボタンは、銘柄名の1行目の高さに合わせる（名前が2行に折り返しても、1行目の横に置く） */
  .pick-name { align-items: flex-start; }
  .pick-name .swatch { margin-top: calc(0.85em - 1.5px); }
  .pick-label { display: block; }
  .pick-label .name { overflow: visible; white-space: normal; }
  /* ボタンの押せる範囲（高さ44px）は保ったまま、行の高さは文字1行ぶんにする */
  .pick-remove { margin-top: -11px; margin-bottom: -11px; }
}
.pick-add { display: flex; flex-direction: column; gap: 4px; }
.pick-add label { font-size: 12px; font-weight: 700; color: var(--ink-2); }
.pick-box { display: flex; gap: 6px; }
.pick-box input {
  flex: 1; min-width: 0; min-height: 44px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); font-size: 13px;
}

/* 横棒の並び（業種別・規模別・寄与度）。まん中の縦線が0で、右に伸びれば上昇、左なら下落 */
.bar-columns { flex: 1 1 auto; display: flex; flex-wrap: wrap; gap: 8px 28px; }
.bars { min-width: 0; display: flex; flex-direction: column; font-size: 12px; }
.bar-columns .bars { flex: 1 1 260px; }
/* となりのカードのほうが背が高いときは、下に空きができないよう、行の間隔を広げる（上限まで） */
.bar-columns .bars li { flex: 1 1 21px; max-height: 40px; }
.bar-columns .bars:only-child li { grid-template-columns: 13em 1fr 4.6em; }   /* 1列のときは、名前の欄を広く取る */
.bars li { display: grid; grid-template-columns: 10.5em 1fr 4.6em; align-items: center; column-gap: 8px; min-height: 21px; }
.bars-size li { grid-template-columns: 9.5em 1fr 4.6em; }
.bars-link { font-size: 13px; }
.bars-link li { grid-template-columns: minmax(0, 13em) 1fr 5.4em; }
.bars li.is-empty { display: block; padding: 6px 0; color: var(--muted); }   /* 「当てはまる銘柄がありません」 */
.bar-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.bar-name { display: block; line-height: 44px; }
.bar { position: relative; align-self: stretch; min-height: 21px; }
.bar::before { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 1px; background: var(--axis); }
.bar-fill { position: absolute; top: 50%; height: 12px; margin-top: -6px; }
.bar-fill.is-up { border-radius: 0 3px 3px 0; background: var(--c-up); }
.bar-fill.is-down { border-radius: 3px 0 0 3px; background: var(--c-down); }
.bar-value { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* 市場の広がり */
.share-bar { display: flex; gap: 2px; height: 16px; border-radius: 4px; overflow: hidden; }
.share-bar span { min-width: 0; }
.share-up { background: var(--c-up); }
.share-flat { background: var(--c-flat); }
.share-down { background: var(--c-down); }
.share-text { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--ink-2); }
.share-text strong { font-size: 13px; color: var(--ink); font-variant-numeric: tabular-nums; }
/* 値上がりの数は青、値下がりの数は赤（v20。.pos・.neg より先に書いてあるので、ここで上書き） */
.share-text strong.pos { color: var(--c-up); }
.share-text strong.neg { color: var(--c-down); }
.chart-mini { height: 100px; }
/* 見出しとグラフのまとまり（データが無いときは、まとまりごと隠す） */
.block { display: flex; flex-direction: column; gap: 10px; }
.block-tight { gap: 4px; }

/* ヒートマップ */
.heat-legend { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--muted); }
.heat-legend > :first-child, .heat-scale { flex: 0 0 auto; }
.heat-scale { display: flex; }
.heat-scale span { width: 26px; height: 12px; }
/* 0＝大きく下落（赤）… 3＝変わらず … 6＝大きく上昇（青）。値は :root の --heat-0〜6（js/chartkit.js も同じ変数を読む。v15.6 で向きを逆に） */
.heat-0 { background: var(--heat-0); }
.heat-1 { background: var(--heat-1); }
.heat-2 { background: var(--heat-2); }
.heat-3 { background: var(--heat-3); }
.heat-4 { background: var(--heat-4); }
.heat-5 { background: var(--heat-5); }
.heat-6 { background: var(--heat-6); }
.chart-map { height: 440px; }

/* ランキング */
.rank-grid { display: flex; flex-wrap: wrap; gap: 12px 28px; }
.rank-grid > div { flex: 1 1 220px; min-width: 0; }
.ranklist { font-size: 13px; }
.ranklist li { display: grid; grid-template-columns: 1.6em 1fr auto; align-items: center; gap: 8px; border-bottom: 1px solid var(--grid); }
.ranklist .rank-no { color: var(--muted); font-variant-numeric: tabular-nums; }
.ranklist a { display: block; min-width: 0; line-height: 44px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ranklist .rank-num { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* 決算発表の予定 */
.earn { display: flex; flex-direction: column; gap: 10px; }
.earn-day h3 { padding-bottom: 4px; border-bottom: 1px solid var(--line); }
.earn-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); column-gap: 28px; font-size: 13px; }
.earn-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-width: 0; border-bottom: 1px solid var(--grid); }
.earn-list a { display: block; min-width: 0; line-height: 44px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.earn-list span { flex: 0 0 auto; font-size: 12px; color: var(--muted); }

/* ---------- VIX ページ ---------- */

/* プラス・マイナスで色を変える数字（ベーシス・損益）。向きは、上昇・下落の色と同じ（プラスが赤、マイナスが青） */
.pos { color: var(--c-up); }
.neg { color: var(--c-down); }

/* データを取り込む前に出す、コマンドの表示 */
.command { margin: 0; padding: 10px 12px; border-radius: 6px; background: var(--head); overflow-x: auto; font-size: 13px; line-height: 1.6; }
.command code { font-family: ui-monospace, "Cascadia Mono", Consolas, "Courier New", monospace; white-space: pre; }

/* カードの見出し：名前と右側の注記が1行に入らないときは、注記を下の行に送る */
.card-head-wrap { flex-wrap: wrap; row-gap: 0; }
.card-head-wrap .card-meta { flex: 0 1 auto; }

/* 表が枠より広くなったとき（とても幅のせまい画面）は、表の中だけを横に動かせるようにする */
.table-scroll { overflow-x: auto; }

/* カーソルを合わせた日の値（数値の枠）。枠の幅に合わせて、3列 → 2段 → 1段 と並べ方を変える（下の @container）。
   3列のときは、まん中の列（限月・VIX指数・建玉）を少しせまくして、日付と表示範囲の列を広く取る */
.readout-box { container-type: inline-size; }
.readout { display: grid; grid-template-columns: 1.15fr 0.95fr 1.15fr; gap: 6px; }
.readout > div { min-width: 0; padding: 5px 8px 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.readout dt { overflow: hidden; font-size: 11px; line-height: 1.5; color: var(--ink-2); white-space: nowrap; text-overflow: ellipsis; }
.readout dd {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 6px;
  font-size: 14px; font-weight: 700; line-height: 1.4; font-variant-numeric: tabular-nums;
}
/* 3列のときの数字の大きさは、枠の幅に合わせる（幅 340px で約 14.6px、270px で 11.6px。cqi は「枠の幅の 1%」） */
.readout dd { font-size: clamp(11.5px, 4.3cqi, 15px); }
.readout dd > span { white-space: nowrap; }
.readout small { margin-left: 1px; font-size: 11px; font-weight: 500; color: var(--ink-2); }
.readout .ro-note { display: none; font-size: 11px; font-weight: 700; color: var(--ink-2); }
/* 3列のとき：「表示範囲」は2行になるので、いつも2行ぶんの高さを取っておく。
   交代日の「交代・ロール」は、いちばん下の横長の枠（限月交代）に出す */
.readout .ro-range dd { min-height: 2.8em; align-content: flex-start; }
.readout .ro-roll { grid-column: 1 / -1; display: flex; align-items: baseline; gap: 10px; }
.readout .ro-roll dd { font-size: 13px; }
@container (min-width: 640px) {
  .readout { grid-template-columns: repeat(12, minmax(0, 1fr)); }
  .readout > div { grid-column: span 2; }
  .readout .ro-volume, .readout .ro-oi { grid-column: span 3; }
  .readout .ro-dte, .readout .ro-range { grid-column: span 4; }
  .readout dd { font-size: 15px; }
  .readout .ro-range dd { min-height: 0; }
  .readout .ro-note { display: inline; }
  .readout .ro-roll { display: none; }
}
@container (min-width: 1000px) {
  .readout { grid-template-columns: 1.15fr 0.95fr 2fr 0.85fr 0.85fr 0.85fr 1.05fr 1.05fr 1.85fr; }
  .readout > div, .readout .ro-volume, .readout .ro-oi, .readout .ro-dte, .readout .ro-range { grid-column: auto; }
}

/* 限月交代のグラフ（4つの段とナビゲータを、1つのグラフの中に縦に並べる） */
.chart-roll { height: 700px; }
/* 分布の図 */
.chart-dist { height: 190px; }

/* ベーシスチェッカーの入力欄 */
.entries { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px 12px; }
.entry { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.entry-wide { grid-column: span 2; }
.entry label, .sliders legend { font-size: 12px; font-weight: 700; color: var(--ink-2); }
.entry input, .entry select {
  width: 100%; min-width: 0; min-height: 44px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink);
  font-size: 15px; font-variant-numeric: tabular-nums;
}
.entry input:invalid { border-color: var(--warn-ink); }
.entry-note { display: flex; align-items: center; gap: 8px; min-height: 28px; font-size: 12px; color: var(--muted); }
.text-btn {
  min-height: 28px; padding: 0 2px; border: 0; background: transparent; color: var(--link);
  font-size: 12px; text-decoration: underline; cursor: pointer;
}
.text-btn:hover { color: var(--link-hover); }

/* 照合の幅（スライダー） */
.sliders { display: flex; flex-direction: column; gap: 2px; }
.slider-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 24px; }
.slider { display: grid; grid-template-columns: 6.6em minmax(0, 1fr) 4.6em; align-items: center; gap: 8px; min-height: 44px; }
.slider label { font-size: 12px; color: var(--ink-2); white-space: nowrap; }
.slider input { width: 100%; min-width: 0; height: 44px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.slider output { font-size: 13px; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* 判定（数字の枠5つ）。見た目は TOP の VIX の数字（.stat）と同じ */
.verdict { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.verdict .stat { min-width: 0; }
.verdict small { font-size: 12px; font-weight: 700; color: var(--ink-2); }
.stat dd.stat-sub { display: block; min-height: 1.5em; font-size: 12px; font-weight: 500; line-height: 1.5; color: var(--muted); }
.judge { display: inline-block; padding: 1px 10px; border-radius: 4px; font-size: 15px; line-height: 1.7; color: var(--ink); white-space: nowrap; }
.judge-none { box-shadow: inset 0 0 0 1px var(--line); background: var(--surface); color: var(--ink-2); }
.judge-ok { background: var(--heat-soft-3); box-shadow: inset 0 0 0 1px var(--line); }
/* 高い＝青、低い＝赤（プラス＝青・マイナス＝赤にそろえる。v15.6 で逆に）。色は --heat-soft-… */
.judge-mid-high { background: var(--heat-soft-4); }
.judge-far-high { background: var(--heat-soft-6); }
.judge-mid-low { background: var(--heat-soft-2); }
.judge-far-low { background: var(--heat-soft-0); }

/* 類似局面の表と、その下の集計 */
table.mini-sim td { height: 34px; white-space: nowrap; }
table.mini-sim th:last-child { white-space: normal; }
.sim-foot { display: flex; flex-wrap: wrap; gap: 2px 18px; font-size: 12px; color: var(--ink-2); }
.sim-foot > div { display: flex; align-items: baseline; gap: 6px; }
.sim-foot dd { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink); }
.sim-foot dd.pos { color: var(--c-up); }
.sim-foot dd.neg { color: var(--c-down); }

/* 参照マトリックス。マスの色は、上に文字をのせる用の7段階（:root の --heat-soft-0〜6。js/chartkit.js も同じ変数を読む） */
.heat-soft-0 { background: var(--heat-soft-0); }
.heat-soft-1 { background: var(--heat-soft-1); }
.heat-soft-2 { background: var(--heat-soft-2); }
.heat-soft-3 { background: var(--heat-soft-3); }
.heat-soft-4 { background: var(--heat-soft-4); }
.heat-soft-5 { background: var(--heat-soft-5); }
.heat-soft-6 { background: var(--heat-soft-6); }
table.matrix { width: 100%; border-collapse: separate; border-spacing: 2px; table-layout: fixed; font-size: 13px; }
table.matrix th { padding: 4px 2px; font-size: 12px; font-weight: 700; line-height: 1.4; color: var(--ink-2); text-align: center; white-space: nowrap; }
table.matrix th:first-child { width: 5.6em; text-align: left; }
table.matrix td {
  height: 46px; padding: 2px; border-radius: 3px; text-align: center; line-height: 1.35;
  color: var(--ink); font-variant-numeric: tabular-nums;
}
table.matrix .mx-v { display: block; font-weight: 700; }
table.matrix .mx-n { display: block; font-size: 11px; }
table.matrix td.is-sparse { box-shadow: inset 0 0 0 1px var(--grid); background: var(--surface); color: var(--muted); }
table.matrix td.is-now { outline: 2px solid var(--ink); outline-offset: -1px; }
.mx-legend { flex-wrap: wrap; gap: 4px 8px; }
.mx-scale { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.mx-key { display: inline-flex; align-items: center; gap: 4px; margin-left: 8px; white-space: nowrap; }
.mx-mark { flex: 0 0 auto; width: 18px; height: 12px; border-radius: 2px; text-align: center; line-height: 12px; }
.mx-mark-sparse { box-shadow: inset 0 0 0 1px var(--grid); background: var(--surface); }
.mx-mark-now { outline: 2px solid var(--ink); outline-offset: -2px; }

/* ワードクラウドのページ（v12） */
.field-week { gap: 6px; }
.step-btn {
  flex: 0 0 auto; width: 30px; height: 30px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface);
  color: var(--ink-2); font-size: 18px; line-height: 1; cursor: pointer;
}
.step-btn:hover { border-color: var(--hover-line); }
.step-btn[disabled] { opacity: 0.4; cursor: default; }
.words-layout { display: flex; flex-wrap: wrap; gap: 16px 24px; align-items: flex-start; }
.words-cloud { flex: 3 1 480px; min-width: 0; }
.words-counts { flex: 1 1 240px; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.chart-words { height: 460px; }
.words-table-scroll { max-height: 460px; overflow-y: auto; }
table.mini-words td { height: 32px; }
table.mini-words td:first-child { width: 100%; max-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.mini-words .num { white-space: nowrap; }
table.mini-days { table-layout: fixed; }
table.mini-days th .sub { display: block; font-weight: 500; color: var(--muted); }
table.mini-days td { height: 34px; padding: 0 6px; vertical-align: middle; }
table.mini-days td .dw-word { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.mini-days td .dw-count { display: block; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
td.empty-cell { text-align: center; color: var(--muted); }
/* 日ごとのワードクラウドと、TOP のカード（v13） */
.step-btn-text { width: auto; padding: 0 10px; font-size: 12px; font-weight: 700; }
.field-week input[type="date"] { min-height: 30px; padding: 0 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink); font: inherit; font-size: 13px; }
.words-note { font-size: 12px; color: var(--muted); }
/* 日ごとの右上の「日経平均（11/30）+1.23%」（v15.6。色は上昇・下落の色） */
.day-nikkei { margin-left: 12px; white-space: nowrap; }
.day-nikkei strong { margin-left: 4px; font-weight: 700; font-variant-numeric: tabular-nums; }
.card-full { flex: 1 1 100%; }
.chart-words-card { height: 360px; }

/* グラフの上の数字の下に出す備考（Options の建玉のカードの注記など。v15 の ETF のページから残した） */
.chart-note { font-size: 12px; color: var(--muted); }

/* ---------- 画面の幅がせまいとき（スマホ） ---------- */

@media (max-width: 899px) {
  /* 下のメニューの高さと、その下の間。v15.7 で入れた誤操作防止の 16px の間は、v16 でメニューが下へスクロールすると隠れるようになったので
     v17 でなくした。残すのは、ホームバーの分（safe-area。分かる端末だけ）だけ */
  :root { --tabbar-h: 68px; --tabbar-gap: env(safe-area-inset-bottom, 0px); }
  body { font-size: 15px; }
  .layout { background: none; }
  .sidebar { display: none; }
  .mobile-brand { display: flex; }
  /* 下は、メニューと、その上に浮かぶ「一番上へ戻る」ボタンにかからないだけ空ける */
  .main { padding: 16px 12px calc(var(--tabbar-h) + var(--tabbar-gap) + 64px); gap: 12px; }
  #dashboard { gap: 12px; }
  .page-head { flex-wrap: nowrap; align-items: center; }
  .page-head h1 { font-size: 22px; }
  .btn { padding: 0 12px; }

  /* 下のメニュー（v14。v20 で ETF を消して8ページ）：サイドバーと同じページを1列に並べ、横にスクロールする。1つのタブの幅は画面の 22% なので、
     4つと次の一部が見え、続きがあると分かる。スクロールバーは出さない。選択中のタブは site.js がまん中に寄せる。
     v18 から、両端の無い輪（右へも左へも回し続けられる。site.js） */
  .tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: block; background: var(--side-bg);
    padding-bottom: var(--tabbar-gap);
  }
  .tabbar-scroll {
    display: flex; height: var(--tabbar-h); overflow-x: auto; overflow-y: hidden;
    scrollbar-width: none; -webkit-overflow-scrolling: touch; scroll-snap-type: x proximity;
  }
  .tabbar-scroll::-webkit-scrollbar { display: none; }
  /* 左右に続きがあるとき、その側の端をうすくぼかす（site.js が .has-left / .has-right を付ける） */
  .tabbar::before, .tabbar::after {
    content: ""; position: absolute; top: 0; height: var(--tabbar-h); width: 34px; pointer-events: none; opacity: 0; transition: opacity 0.15s;
  }
  .tabbar::before { left: 0; background: linear-gradient(90deg, var(--side-bg) 30%, transparent); }
  .tabbar::after { right: 0; background: linear-gradient(270deg, var(--side-bg) 30%, transparent); }
  .tabbar.has-left::before, .tabbar.has-right::after { opacity: 1; }
  .tabbar a {
    flex: 0 0 auto; min-width: 22%; padding: 0 8px; scroll-snap-align: start;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    border-top: 3px solid transparent; color: var(--side-muted);
    font-size: 12px; font-weight: 500; text-decoration: none; white-space: nowrap;
  }
  .tabbar a[aria-current], .tabbar a[data-current] { border-top-color: #ffffff; color: #ffffff; font-weight: 700; }
  /* TOP の左の縦線（v19.1）：About と TOP のあいだ（輪の切れ目）の目印。写しの組の TOP にも付く（site.js が class ごと写す） */
  .tabbar a.tab-home { position: relative; }
  .tabbar a.tab-home::before {
    content: ""; position: absolute; left: 0; top: 16px; bottom: 14px; width: 1px; background: rgba(255, 255, 255, 0.55);
  }
  /* 両端を作らない（v18）：site.js が、タブの並びの写しを左右に置いて輪にし、スクロールが止まったら見た目を変えずにまん中の組へ戻す。
     戻す一瞬だけ吸い付き（scroll-snap）を止める（戻した位置で吸い付き直して、タブが動いて見えないように） */
  .tabbar-scroll.is-jumping { scroll-snap-type: none; }
  .tabbar .icon { width: 22px; height: 22px; }
  /* 下へスクロールしているあいだはメニューを下へ隠し、上へ戻す・一番上・一番下に着くと出す（v16。site.js が .is-hidden を付け外しする）。
     隠れているあいだは触れない（pointer-events）ので、スクロールの途中で指が当たっても、ページのスクロールのじゃまをしない */
  .tabbar { transition: transform 0.22s ease-out; }
  .tabbar.is-hidden { transform: translateY(calc(100% + 4px)); pointer-events: none; }
  @media (prefers-reduced-motion: reduce) { .tabbar { transition: none; } }

  /* 一番上へ戻るボタン（v15.7。スマホだけ）：下のメニューの右上に浮かぶ丸いボタン。ある程度下へスクロールしたときだけ出る
     （site.js が .is-shown を付ける）。出ていないあいだは押せず、読み上げもしない（visibility: hidden） */
  .to-top {
    position: fixed; right: 14px; bottom: calc(var(--tabbar-h) + var(--tabbar-gap) + 12px); z-index: 20;
    display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0;
    border: 0; border-radius: 50%; background: var(--side-bg); color: #ffffff; cursor: pointer;
    box-shadow: 0 2px 8px rgba(28, 30, 33, 0.3);
    opacity: 0; visibility: hidden; transform: translateY(8px);
    transition: opacity 0.2s, transform 0.2s, visibility 0s linear 0.2s;
  }
  .to-top.is-shown { opacity: 1; visibility: visible; transform: none; transition: opacity 0.2s, transform 0.2s, visibility 0s; }
  /* メニューが隠れているあいだは、このボタンも隠す（v16） */
  .to-top.is-shown.is-hidden { opacity: 0; visibility: hidden; transform: translateY(8px); transition: opacity 0.2s, transform 0.2s, visibility 0s linear 0.2s; }
  .to-top .icon { width: 22px; height: 22px; }
  @media (prefers-reduced-motion: reduce) { .to-top, .to-top.is-shown { transition: none; } }   /* 動きを減らす設定では、ふわっと出さない */

  .card-row { gap: 12px; }
  .card, .card-wide, .card-narrow { flex: 1 1 100%; }
  .card-head { padding: 10px 12px; gap: 8px; }
  .card-body { padding: 12px; }
  .controls { gap: 8px; }
  .controls-split { flex-wrap: wrap; }
  .controls-split .field { flex: 1 1 auto; }
  .seg-fill, .seg-fill .seg-box { flex: 1 1 auto; }
  .seg-fill { width: 100%; }
  .seg-fill .seg-box button { flex: 1; padding: 0 6px; }
  .seg-box button { padding: 0 10px; }
  .field { flex: 1 1 auto; }
  .field select { flex: 1; font-size: 14px; }

  .chart { height: 200px; }
  .chart-tall { flex: 0 0 auto; height: 220px; min-height: 0; }
  .stats { gap: 6px; }
  .stat { padding: 8px; }
  .stat dd { font-size: 18px; }
  .split, .pair { flex-direction: column; gap: 10px; }
  .split-side { flex: 0 0 auto; }
  .fxstrip { font-size: 14px; }
  .fxstrip li { flex: 0 0 auto; padding: 0 12px; }
  .pair-item .chart { flex: 0 0 auto; height: 170px; min-height: 0; }

  /* カレンダーは、表をやめて1件ずつの並びにする */
  .cal thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .cal, .cal tbody { display: block; }
  .cal tr { display: grid; grid-template-columns: auto auto 1fr; gap: 2px 8px; align-items: center; padding: 10px 2px; border-bottom: 1px solid var(--grid); }
  .cal td { padding: 0; border: 0; }
  .cal .cal-title { grid-column: 1 / -1; grid-row: 2; font-size: 14px; font-weight: 500; }
  .cal .cal-impact { grid-column: 3; grid-row: 1; }
  .cal td.num { grid-row: 3; text-align: left !important; font-size: 12px; color: var(--muted); }
  .cal td.num::before { content: attr(data-label) " "; }
  .cal .cal-forecast { grid-column: 1 / 3; }
  .cal .cal-previous { grid-column: 3; }
  .cal .cal-day { display: block; padding: 10px 2px 4px; }
  .cal .cal-day th { display: block; padding: 0; border: 0; }
  .status-item { display: inline-block; }
}

/* 株式ページ（スマホ） */
@media (max-width: 899px) {
  #stocks-page, #vix-page, #words-page, .page-body { gap: 12px; }
  /* 上に日付の切り替え、その下にページ内の移動（横に流して1行にする） */
  #stocks-page .page-head { flex-direction: column; align-items: stretch; gap: 8px; }
  .date-nav { order: -1; margin-left: 0; }
  .date-field { flex: 1 1 auto; }
  .date-field input { flex: 1; font-size: 14px; }
  .jump { flex-wrap: nowrap; overflow-x: auto; margin: 0 -12px; padding: 0 12px 4px; }
  .tiles { gap: 8px; }
  .tile { flex: 1 1 150px; padding: 10px 12px; }
  .tile-value { font-size: 18px; }
  .seg-wrap, .seg-wrap .seg-box { width: 100%; }
  .seg-wrap .seg-box button { flex: 1 1 auto; }
  .lines { gap: 12px; }
  .lines-main, .lines-side { flex: 1 1 100%; }
  .chart-lines { flex: 0 0 auto; height: 290px; min-height: 0; }
  .bars { font-size: 13px; }
  .bars li { grid-template-columns: 10.5em 1fr 4.6em; min-height: 26px; }
  .bar-columns .bars li, .bar-columns .bars:only-child li { flex: 0 0 auto; grid-template-columns: 10.5em 1fr 4.6em; }
  .bars-size li { grid-template-columns: 9.5em 1fr 4.6em; }
  .bars-link li { grid-template-columns: minmax(0, 9.5em) 1fr 5.4em; }
  .bar { min-height: 26px; }
  .heat-legend { width: 100%; }
  .chart-mini { height: 120px; }
  .chart-map { height: 520px; }
  .earn-list { grid-template-columns: 1fr; }
}

/* VIX ページ（スマホ） */
@media (max-width: 899px) {
  .chart-roll { height: 580px; }
  .chart-dist { height: 170px; }
  .entry-note { min-height: 0; }
  .entry-dte .entry-note { min-height: 44px; }
  .text-btn { min-height: 44px; font-size: 13px; }
  .slider-grid { grid-template-columns: minmax(0, 1fr); }
  .verdict { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .verdict .stat-judge { grid-column: 1 / -1; }
  table.mini-sim { font-size: 12px; }
  table.mini-sim th, table.mini-sim td { padding-left: 4px; padding-right: 4px; }
  table.matrix { border-spacing: 1px; font-size: 12px; }
  table.matrix th { font-size: 11px; }
  table.matrix th:first-child { width: 4.6em; }
  table.matrix .mx-n { font-size: 10px; }
  .mx-key { margin-left: 0; }
}

/* VIX ページ（とても幅のせまいスマホ） */
@media (max-width: 360px) {
  .entry input, .entry select { padding: 0 6px; font-size: 14px; }
  /* 類似局面の表：「期近」の列（＝ VIX ＋ ベーシス）を省いて、損益の列が画面に入るようにする */
  table.mini-sim th:nth-child(3), table.mini-sim td:nth-child(3) { display: none; }
  table.mini-sim th, table.mini-sim td { padding-left: 3px; padding-right: 3px; }
}

/* @container が使えない古いブラウザー向け：幅のせまいスマホでは、抽出銘柄の表から「終値」の列を省いて、
   銘柄名の幅を確保する（新しいブラウザーでは、上の @container で表を2段にするので、この指定は使わない） */
@supports not (container-type: inline-size) {
  @media (max-width: 479px) {
    table.mini-picks th:nth-child(2), table.mini-picks td:nth-child(2) { display: none; }
  }
}

@media (max-width: 899px) {
  .words-cloud, .words-counts { flex: 1 1 100%; }
  .chart-words { height: 320px; }
  .chart-words-card { height: 280px; }
  .words-table-scroll { max-height: 320px; }
  table.mini-days { min-width: 560px; }
}

/* ---------- タッチの端末での、長押しと2回押し（v16） ---------- */

/* ボタンやリンクを素早く2回押しても画面を拡大しない（押した反応も早くなる） */
button, a, label, input, select, .seg-box button, .tabbar a, .jump a, .to-top, .theme-toggle { touch-action: manipulation; }
/* 指で操作する端末では、グラフ・数字の枠・ボタン・メニューを長押ししても、文字の選択や吹き出し（コールアウト）を出さない
   （iOS では、グラフの近くの文字が選ばれてしまうため）。About の本文や表の文字は、いままでどおり選べる */
@media (pointer: coarse) {
  .chart, .chart-mini, .chart-map, .chart-roll, .chart-dist, .chart-words, .chart-words-card, .chart-lines,
  .card-head, .controls, .seg, .seg-box, .chips, .field, .legend, .stats, .tiles, .readout, .verdict, .fxstrip, .heat-legend,
  .bars, .share-bar, .share-text, .jump, .date-nav, .tabbar, .to-top, .sliders, .entries label, .entry-note, .sim-foot,
  table.matrix, .mx-legend, .words-note, .chart-note, .status, .theme-toggle {
    -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  }
}

/* ---------- 読み込み中の骨組み（v16） ---------- */

/* データを読み込んでいるあいだ（.is-loading が付いているあいだ）、グラフの場所にうすい板を出して、ゆっくり明滅させる。
   描けたら .is-loading を外す（JavaScript）。グラフの中身はふわっと出す。動きを減らす設定では、明滅も、ふわっと出すのもしない */
.is-loading .chart, .is-loading .chart-mini, .is-loading .chart-map, .is-loading .chart-roll, .is-loading .chart-dist,
.is-loading .chart-words, .is-loading .chart-words-card, .is-loading .chart-lines, .is-loading .chart-tall,
.is-loading .skeleton {
  border-radius: 8px;
  background: linear-gradient(100deg, var(--shimmer) 20%, var(--shimmer-glow) 50%, var(--shimmer) 80%);
  background-size: 200% 100%;
  animation: shimmer 1.6s ease-in-out infinite;
}
.is-loading .skeleton { min-height: 44px; }
.is-loading .skeleton-text { min-height: 1.2em; width: 60%; border-radius: 4px; }
.is-loading .skeleton-row { min-height: 44px; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
/* ページ全体の骨組み（Stock・VIX・Options のページ。templates/dashboard/_skeleton.html）：上に1行、表の形、グラフの形 */
.page-skeleton { display: flex; flex-direction: column; gap: 16px; }
.page-skeleton .skeleton-row { max-width: 420px; }
.skeleton-card { padding: 14px 16px; }
.skeleton-block { min-height: 200px; }
.skeleton-chart { min-height: 340px; }
@media (max-width: 899px) { .page-skeleton { gap: 12px; } .skeleton-block { min-height: 160px; } .skeleton-chart { min-height: 260px; } }
.chart .highcharts-container { transition: opacity 0.25s ease-out; }
.is-loading .chart .highcharts-container { opacity: 0; }
@media (prefers-reduced-motion: reduce) {
  .is-loading .chart, .is-loading .chart-mini, .is-loading .chart-map, .is-loading .chart-roll, .is-loading .chart-dist,
  .is-loading .chart-words, .is-loading .chart-words-card, .is-loading .chart-lines, .is-loading .chart-tall,
  .is-loading .skeleton { animation: none; background: var(--shimmer); }
  .chart .highcharts-container { transition: none; }
}

/* ---------- 前回の内容を出しているあいだの知らせ（v16） ---------- */

/* 本文のいちばん上に1行。ふつうは「前回の内容（12/1 16:21）を表示しています。更新中…」で、新しいデータが届いたら消える。
   届かなかったときは「つながりません…」（色は注意の色） */
.stale-note {
  display: flex; align-items: center; gap: 8px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); font-size: 12px; color: var(--muted);
}
.stale-note.is-warn { border-color: var(--warn-line); background: var(--warn-bg); color: var(--warn-text); }
.stale-note::before {
  content: ""; flex: 0 0 auto; width: 10px; height: 10px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent;
  animation: stale-spin 1s linear infinite;
}
.stale-note.is-warn::before { animation: none; border-right-color: currentColor; }
@keyframes stale-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .stale-note::before { animation: none; border-right-color: currentColor; } }

/* ---------- 表示の色の切り替え（v16。画面の右上の丸いボタン） ---------- */

/* 本文のいちばん上の行（templates/base.html の .main-top）。PC では本文の右上に浮かべる（本文の上の余白の中。中身と重ならない）。
   スマホでは、サイト名（左）と同じ行の右端 */
.main-top { position: absolute; top: 10px; right: 20px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
@media (max-width: 899px) { .main-top { position: static; } }   /* スマホ：サイト名と同じ行の右端 */
.theme-toggle {
  flex: 0 0 auto; width: 34px; height: 34px; padding: 0; display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: 50%; background: var(--surface); color: var(--ink-2); cursor: pointer;
}
.theme-toggle:hover { border-color: var(--hover-line); color: var(--ink); }
.theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.theme-toggle .theme-icon { display: flex; }
.theme-toggle .icon { width: 18px; height: 18px; }
/* 月＝押すと暗くなる（明るいときに出す）、太陽＝押すと明るくなる（暗いときに出す） */
.theme-toggle .theme-icon-sun { display: none; }
html[data-theme="dark"] .theme-toggle .theme-icon-moon { display: none; }
html[data-theme="dark"] .theme-toggle .theme-icon-sun { display: flex; }

/* ---------- 日経225オプションのページ（v19） ---------- */

#options-page { display: flex; flex-direction: column; gap: 16px; }
#options-page .page-head { align-items: center; }
/* 上の行の右：その日の日経平均（Yahoo の終値と前日比。v20）。日付の切り替えのすぐ左に置く */
.nikkei-line { margin-left: auto; font-size: 13px; color: var(--ink-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.nikkei-line strong { margin-left: 2px; font-size: 15px; font-weight: 700; color: var(--ink); }
.nikkei-line span { margin-left: 2px; font-weight: 700; }
#options-page .date-nav { margin-left: 0; }
/* 限月の切り替え（期近・第2・第3）と、選んだ限月の説明の1行。下のカードすべてに効く */
.month-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.month-bar .seg legend { white-space: nowrap; }
.month-bar .seg-box button { min-width: 5.5em; }
.month-info { font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.month-info strong { color: var(--ink); }
/* 比べる条件：当てはまった日の数と、その目安（データ不足・推定は不安定） */
.cond-count { font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.cond-count strong { font-size: 15px; color: var(--ink); }
.cond-level { display: inline-block; margin-left: 8px; padding: 0 8px; border-radius: 4px; font-size: 12px; font-weight: 700; line-height: 1.8; }
.cond-level-unstable { background: var(--head); box-shadow: inset 0 0 0 1px var(--line); color: var(--ink-2); }
.cond-level-insufficient { background: var(--warn-bg); box-shadow: inset 0 0 0 1px var(--warn-line); color: var(--warn-text); }
.slider input:disabled { cursor: default; opacity: 0.45; }
.slider input:disabled + output { color: var(--muted); }
/* 数字の枠（IV のカードは6つ＝3列×2行（v20 で判定を足した）、建玉の構成比のカードは4つ）。見た目は VIX ページの判定の枠と同じ */
.verdict-options-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.verdict-options-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.verdict-options .stat dd span { white-space: nowrap; }
/* 数字の枠の下の小さな文字は、2行に分けて書くことがある（例：「P10〜P90」の下に値） */
.verdict-options .stat dd.stat-sub { white-space: pre-line; }
/* 凡例の印：過去の中央値（灰色の破線）、P10〜P90 の帯（うすい灰色）、最大・最小（細い灰色の線）、
   建玉の中央値（ひし形）、P10〜P90 のひげ（縦の線の両端に横の線） */
.swatch-dash-gray { height: 2px; background: repeating-linear-gradient(90deg, var(--c-gray-strong) 0 5px, transparent 5px 8px); }
.swatch-band { background: var(--c-gray); opacity: 0.35; }
/* P25〜P75 の濃い帯（v19.2） */
.swatch-band-inner { background: var(--c-gray); opacity: 0.7; }
.swatch-thin { height: 1px; }
.swatch-diamond { width: 9px; height: 9px; border-radius: 1px; background: var(--c-gray-strong); transform: rotate(45deg); }
.swatch-whisker {
  width: 9px; height: 14px; border-radius: 0; background:
    linear-gradient(var(--c-gray-strong), var(--c-gray-strong)) center / 1.5px 100% no-repeat,
    linear-gradient(var(--c-gray-strong), var(--c-gray-strong)) top / 100% 1.5px no-repeat,
    linear-gradient(var(--c-gray-strong), var(--c-gray-strong)) bottom / 100% 1.5px no-repeat;
}
.chart-options-iv { height: 320px; }
/* IV と建玉の構成比（v19.2）：スマホ・幅のせまい画面では縦に並べ、PC（幅の広い画面。下の min-width: 1320px）では横に2つ並べる */
.options-pair { display: flex; flex-direction: column; gap: 16px; }
.options-pair > .card { flex: 0 0 auto; }
.oi-charts { display: flex; flex-direction: column; gap: 6px; }
/* 区分のラベルが3行（距離と円の範囲。v20）になった分、少し高く */
.chart-options-oi { height: 236px; }
/* 建玉の増減の切り替え：プットを選んでいるときは青（プットの線の色）、コールのときはオレンジ寄りの赤（v20） */
.seg-side .seg-box button[aria-pressed="true"][data-value="put"] { background: var(--c-blue); }
.seg-side .seg-box button[aria-pressed="true"][data-value="call"] { background: var(--c-call); }
/* 表の下：権利行使価格ごとの増減の最大と最小（v20） */
.flow-extremes { font-size: 12px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.flow-extremes strong { font-size: 13px; }
.flow-extreme-none { color: var(--muted); }
/* 建玉の増減：日付（行）× 距離の区分（列）のマス。色は js/options.js が値に応じて付ける（chartkit.js の heatBlend）。
   11区分が画面の幅に収まるように、列の幅はそろえ（table-layout: fixed）、せまい画面では数字を隠して色だけにする */
.flow-wrap { overflow-x: auto; }
table.flow { width: 100%; border-collapse: separate; border-spacing: 2px; table-layout: fixed; font-size: 11px; }
table.flow th { padding: 2px 1px; font-size: 11px; font-weight: 700; line-height: 1.3; color: var(--ink-2); text-align: center; white-space: nowrap; }
table.flow thead th:first-child, table.flow tbody th { width: 7.4em; text-align: left; }
table.flow tbody th { font-weight: 500; font-variant-numeric: tabular-nums; }
table.flow td {
  position: relative; height: 26px; padding: 0 1px; border-radius: 3px; background: var(--heat-soft-3); color: var(--ink);
  text-align: center; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; cursor: pointer;
}
table.flow td.is-none { box-shadow: inset 0 0 0 1px var(--grid); background: var(--surface); color: var(--muted); cursor: default; }
table.flow td.is-picked { outline: 2px solid var(--ink); outline-offset: -1px; }
.flow-date-short { display: none; }
.flow-holiday {
  display: inline-block; margin-left: 4px; padding: 0 3px; border-radius: 3px; background: var(--warn-bg);
  box-shadow: inset 0 0 0 1px var(--warn-line); color: var(--warn-text); font-size: 10px; font-weight: 700; line-height: 1.5;
}
.flow-detail { min-height: 1.6em; font-size: 12px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
@media (pointer: coarse) {
  table.flow, .month-bar, .cond-count { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
}

/* 日経225オプションのページ（スマホ） */
@media (max-width: 899px) {
  #options-page { gap: 12px; }
  #options-page .page-head { flex-direction: column; align-items: stretch; gap: 8px; }
  /* スマホ：上から、日付の切り替え・日経平均・ページ内の移動 */
  #options-page .date-nav { order: -2; }
  .nikkei-line { order: -1; margin-left: 0; }
  .month-bar .seg, .month-bar .seg-box { width: 100%; }
  .month-bar .seg-box button { flex: 1 1 0; min-width: 0; }
  .verdict-options, .verdict-options-4 { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .verdict-options .stat { padding: 6px 8px; }
  .verdict-options .stat dd:not(.stat-sub) { font-size: 17px; }
  .chart-options-iv { height: 280px; }
  .chart-options-oi { height: 216px; }
  .heat-legend { flex-wrap: wrap; }
}
/* 日経225オプションのページ（幅 640px より狭い画面）：増減のマスは色だけ（数字は読み上げ用に残す）。日付は「12/3」の形 */
@media (max-width: 639px) {
  table.flow { border-spacing: 1px; }
  table.flow thead th:first-child, table.flow tbody th { width: 3.6em; }
  table.flow th { font-size: 10px; }
  table.flow td { height: 24px; }
  table.flow .flow-num { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .flow-date-long { display: none; }
  .flow-date-short { display: inline; }
  .flow-holiday { margin-left: 2px; padding: 0 2px; }
}

/* About（スマホ。v19.1）：名言は少し小さく、数字の見方の区切りへ移るボタンは指で押しやすい高さに */
@media (max-width: 899px) {
  .quote-text { font-size: 16px; }
  .notes-jump a { min-height: 40px; }
}

/* 日経225オプションのページ（PC の幅の広い画面。v19.2）：IV と建玉の構成比のカードを横に2つ並べる（横幅が広すぎて見づらかったため）。
   2つのカードの高さはそろえ、IV のグラフは、建玉の構成比のカードの高さまで縦に伸ばす。数字の枠は、IV は3列、建玉は4列。
   v20：横に並べるのは幅 1320px から（1240px では、区分の「−10%」と境目の円の文字が収まらないため） */
@media (min-width: 1320px) {
  .options-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: stretch; }
  .options-pair .verdict-options { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .options-pair .verdict-options-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .options-pair .verdict-options-4 .stat dd:not(.stat-sub) { font-size: 18px; }
  .options-pair .chart-options-iv { flex: 1 1 320px; height: auto; min-height: 320px; max-height: 560px; }
  .options-pair .chart-options-oi { height: 216px; }
}
