/* カブクラブ — 見やすさ最優先のスタイル
   上昇=赤・下落=青（国内の慣習）＋ ▲▼ の記号を必ず添えて色だけに頼らない */
:root {
  color-scheme: light;
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --line: #e1e4e9;
  --text: #15181d;
  --text-2: #4f5661;
  --text-3: #7a818c;
  --brand: #17375e;
  --brand-ink: #ffffff;
  --accent: #2a78d6;
  --accent-soft: #e6f0fc;
  --up: #c4302b;
  --up-soft: #fdecea;
  --down: #1c5cab;
  --down-soft: #e7f0fb;
  --warn: #9a6400;
  --warn-soft: #fff5dc;
  --good: #0b7a0b;
  --good-soft: #e5f5e5;
  --chart-1: #2a78d6;
  --chart-2: #eb6834;
  --chart-3: #1baf7a;
  --chart-grid: #eceef1;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 8px rgba(15, 23, 42, .04);
  --radius: 12px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #121315; --surface: #1b1c1f; --surface-2: #24262a; --line: #33363b;
    --text: #f0efec; --text-2: #c3c2b7; --text-3: #8f9096;
    --brand: #0f2340; --accent: #5598e7; --accent-soft: #1b2a3f;
    --up: #f07672; --up-soft: #3a1e1e; --down: #6da7ec; --down-soft: #1a2638;
    --warn: #f0b84a; --warn-soft: #362a12; --good: #4cc44c; --good-soft: #17301a;
    --chart-1: #3987e5; --chart-2: #d95926; --chart-3: #199e70; --chart-grid: #2a2c30;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121315; --surface: #1b1c1f; --surface-2: #24262a; --line: #33363b;
  --text: #f0efec; --text-2: #c3c2b7; --text-3: #8f9096;
  --brand: #0f2340; --accent: #5598e7; --accent-soft: #1b2a3f;
  --up: #f07672; --up-soft: #3a1e1e; --down: #6da7ec; --down-soft: #1a2638;
  --warn: #f0b84a; --warn-soft: #362a12; --good: #4cc44c; --good-soft: #17301a;
  --chart-1: #3987e5; --chart-2: #d95926; --chart-3: #199e70; --chart-grid: #2a2c30;
  --shadow: none;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", Meiryo, sans-serif;
  font-size: 16px; line-height: 1.7;
  font-feature-settings: "palt";
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.num, td.n, th.n { font-variant-numeric: tabular-nums; }

/* ---------- ヘッダー ---------- */
.site-header { background: var(--brand); color: var(--brand-ink); position: sticky; top: 0; z-index: 20; }
.site-header .inner { max-width: 1160px; margin: 0 auto; padding: 0 16px; display: flex; align-items: center; gap: 20px; min-height: 56px; }
.logo { color: #fff; font-weight: 800; font-size: 22px; letter-spacing: .04em; white-space: nowrap; display: flex; align-items: center; gap: 8px; }
.logo:hover { text-decoration: none; }
.logo .mark { width: 30px; height: 30px; border-radius: 8px; background: #fff; color: var(--brand); display: grid; place-items: center; font-size: 15px; font-weight: 900; }
.logo small { font-size: 11px; font-weight: 500; opacity: .75; letter-spacing: 0; display: block; line-height: 1.2; }
.nav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; flex: 1; }
.nav::-webkit-scrollbar { display: none; }
.nav a { color: rgba(255,255,255,.82); padding: 8px 12px; border-radius: 8px; white-space: nowrap; font-size: 15px; font-weight: 600; }
.nav a:hover { background: rgba(255,255,255,.1); text-decoration: none; color: #fff; }
.nav a.on { background: rgba(255,255,255,.16); color: #fff; }
.theme-btn { background: transparent; border: 1px solid rgba(255,255,255,.3); color: #fff; border-radius: 8px; padding: 4px 9px; cursor: pointer; font-size: 14px; }
@media (max-width: 760px) {
  .site-header .inner { flex-wrap: wrap; gap: 0; padding-top: 8px; }
  .logo { flex: 1; }
  .nav { order: 3; flex-basis: 100%; margin: 4px -16px 0; padding: 0 12px 8px; }
  .nav a { font-size: 14px; padding: 6px 10px; }
}

/* ---------- 市況ティッカー ---------- */
.ticker { background: var(--surface); border-bottom: 1px solid var(--line); }
.ticker .inner { max-width: 1160px; margin: 0 auto; padding: 8px 16px; display: flex; gap: 22px; overflow-x: auto; scrollbar-width: none; font-size: 14px; }
.ticker .inner::-webkit-scrollbar { display: none; }
.tk { white-space: nowrap; display: flex; gap: 6px; align-items: baseline; }
.tk b { font-size: 15px; }
.tk .lbl { color: var(--text-2); font-size: 13px; }

/* ---------- レイアウト ---------- */
main { max-width: 1160px; margin: 0 auto; padding: 20px 16px 56px; }
h1 { font-size: 26px; line-height: 1.35; margin: 4px 0 6px; }
h2 { font-size: 20px; margin: 0 0 12px; line-height: 1.4; }
h3 { font-size: 17px; margin: 0 0 8px; }
.lead { color: var(--text-2); margin: 0 0 18px; }
.muted { color: var(--text-3); font-size: 13px; }
.sec { margin-top: 28px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.card + .card { margin-top: 16px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) { .g3, .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .g2, .g3 { grid-template-columns: minmax(0, 1fr); } h1 { font-size: 22px; } }
.crumb { font-size: 13px; color: var(--text-3); }
.crumb a { color: var(--text-3); }
.head-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.head-row h2 { margin: 0; }

/* ---------- 数値 ---------- */
.up { color: var(--up); }
.down { color: var(--down); }
.flat { color: var(--text-2); }
.big { font-size: 34px; font-weight: 800; line-height: 1.15; letter-spacing: -.01em; }
.mid { font-size: 22px; font-weight: 700; line-height: 1.2; }
.unit { font-size: .55em; font-weight: 600; margin-left: 2px; color: var(--text-2); }
.stat { padding: 14px 16px; }
.stat .lbl { color: var(--text-2); font-size: 13px; font-weight: 600; }
.stat .val { font-size: 26px; font-weight: 800; line-height: 1.25; margin-top: 2px; }
.stat .sub { font-size: 13px; color: var(--text-2); }

/* ---------- バッジ・ボタン ---------- */
.badge { display: inline-block; font-size: 11.5px; font-weight: 700; border-radius: 999px; padding: 1px 8px; line-height: 1.7; vertical-align: middle; white-space: nowrap; }
.b-main { background: var(--accent-soft); color: var(--accent); }
.b-shadow { background: var(--surface-2); color: var(--text-2); }
.b-warn { background: var(--warn-soft); color: var(--warn); }
.b-good { background: var(--good-soft); color: var(--good); }
.b-up { background: var(--up-soft); color: var(--up); }
.b-down { background: var(--down-soft); color: var(--down); }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tab { border: 1px solid var(--line); background: var(--surface); color: var(--text-2); border-radius: 999px; padding: 7px 16px; font-size: 14.5px; font-weight: 700; cursor: pointer; font-family: inherit; }
.tab.on { background: var(--brand); border-color: var(--brand); color: #fff; }
:root[data-theme="dark"] .tab.on { background: var(--accent); border-color: var(--accent); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tab.on { background: var(--accent); border-color: var(--accent); } }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: var(--surface); color: var(--text-2); padding: 5px 12px; font-size: 13.5px; font-weight: 700; cursor: pointer; font-family: inherit; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--accent-soft); color: var(--accent); }
.input { border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 8px; padding: 7px 12px; font-size: 15px; font-family: inherit; }
.fav { border: 0; background: none; cursor: pointer; font-size: 18px; color: var(--text-3); padding: 0 4px; line-height: 1; }
.fav.on { color: #e0a000; }

/* ---------- 表 ---------- */
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 15px; }
.tbl th, .tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.tbl th { background: var(--surface-2); color: var(--text-2); font-size: 13px; font-weight: 700; position: sticky; top: 0; }
.tbl th.sort { cursor: pointer; user-select: none; }
.tbl th.sort::after { content: " ⇅"; color: var(--text-3); font-weight: 400; }
.tbl th.asc::after { content: " ▲"; color: var(--accent); }
.tbl th.desc::after { content: " ▼"; color: var(--accent); }
.tbl td.n, .tbl th.n { text-align: right; }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl .name a { font-weight: 700; color: var(--text); }
.tbl .name a:hover { color: var(--accent); }
.tbl .name .sub { display: block; font-size: 12px; color: var(--text-3); }
.tbl td.sticky, .tbl th.sticky { position: sticky; left: 0; background: var(--surface); z-index: 1; }
.tbl th.sticky { background: var(--surface-2); z-index: 2; }
.tbl.compact th, .tbl.compact td { padding: 7px 10px; font-size: 14px; }

/* ---------- 利回り水準ゲージ ---------- */
.gauge { width: 96px; height: 8px; border-radius: 4px; background: linear-gradient(90deg, var(--down-soft), var(--surface-2) 50%, var(--up-soft)); position: relative; display: inline-block; vertical-align: middle; border: 1px solid var(--line); }
.gauge i { position: absolute; top: -4px; width: 4px; height: 14px; border-radius: 2px; background: var(--text); transform: translateX(-2px); }

/* ---------- カード型リンク ---------- */
.feature { display: block; color: var(--text); transition: border-color .15s; }
.feature:hover { text-decoration: none; border-color: var(--accent); }
.feature .ttl { font-weight: 800; font-size: 17px; display: flex; align-items: center; gap: 8px; }
.feature .ico { width: 34px; height: 34px; border-radius: 9px; background: var(--accent-soft); display: grid; place-items: center; font-size: 18px; flex: none; }
.feature p { margin: 6px 0 0; color: var(--text-2); font-size: 14px; }
.feature .go { color: var(--accent); font-weight: 700; font-size: 14px; margin-top: 8px; display: inline-block; }

/* ---------- ファンドの予想カード ---------- */
.pred { display: grid; grid-template-columns: 1.2fr 1fr; gap: 16px; }
@media (max-width: 760px) { .pred { grid-template-columns: 1fr; } }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 15px; }
.kv dt { color: var(--text-2); }
.kv dd { margin: 0; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.timing { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 760px) { .timing { grid-template-columns: 1fr; } }
.timing .t { border-radius: 10px; padding: 12px 14px; border: 1px solid var(--line); background: var(--surface-2); }
.timing .t .lbl { font-size: 13px; font-weight: 700; color: var(--text-2); }
.timing .t .d { font-size: 22px; font-weight: 800; }
.timing .t p { margin: 4px 0 0; font-size: 13px; color: var(--text-2); }
.note { font-size: 13px; color: var(--text-2); background: var(--surface-2); border-radius: 8px; padding: 10px 12px; margin-top: 12px; }

/* ---------- カレンダー ---------- */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.cal .dow { background: var(--surface-2); text-align: center; font-size: 13px; font-weight: 700; padding: 6px 0; color: var(--text-2); }
.cal .dow.sun, .cal .day.sun .dn { color: var(--up); }
.cal .dow.sat, .cal .day.sat .dn { color: var(--down); }
.cal .day { min-height: 98px; border-top: 1px solid var(--line); border-left: 1px solid var(--line); padding: 4px 5px; font-size: 12.5px; }
.cal .day:nth-child(7n+1) { border-left: 0; }
.cal .day.off { background: var(--surface-2); }
.cal .day.out { background: var(--bg); }
.cal .day.today { box-shadow: inset 0 0 0 2px var(--accent); }
.cal .dn { font-weight: 800; font-size: 13px; }
.cal .ev { display: block; border-radius: 5px; padding: 1px 5px; margin-top: 3px; line-height: 1.45; background: var(--accent-soft); color: var(--text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal .ev:hover { text-decoration: none; outline: 1px solid var(--accent); }
.cal .ev.k { background: var(--warn-soft); }
.cal-list { display: none; }
@media (max-width: 760px) {
  .cal { display: none; }
  .cal-list { display: block; }
}
.cal-list .dayrow { display: grid; grid-template-columns: 74px 1fr; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.cal-list .dayrow .dl { font-weight: 800; }
.cal-list .dayrow.today .dl { color: var(--accent); }
.cal-list .chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-block; border-radius: 999px; padding: 3px 11px; font-size: 14px; font-weight: 700; background: var(--accent-soft); color: var(--text); }
.chip.k { background: var(--warn-soft); }

/* ---------- グラフ ---------- */
.chart-box { position: relative; height: 300px; }
.chart-box.sm { height: 200px; }
.chart-box.xs { height: 54px; }
@media (max-width: 640px) { .chart-box { height: 240px; } }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--text-2); margin-bottom: 6px; }
.legend i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 5px; }

/* ---------- 寄与度バー ---------- */
.bars { display: grid; gap: 6px; }
.bar-row { display: grid; grid-template-columns: minmax(0, 9em) 1fr 4.5em; gap: 8px; align-items: center; font-size: 14px; }
.bar-row .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-row .tr { height: 12px; background: var(--surface-2); border-radius: 3px; position: relative; }
.bar-row .tr i { position: absolute; top: 0; bottom: 0; border-radius: 3px; }
.bar-row .v { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------- フッター ---------- */
footer { border-top: 1px solid var(--line); background: var(--surface); }
footer .inner { max-width: 1160px; margin: 0 auto; padding: 22px 16px 34px; font-size: 13px; color: var(--text-2); }
footer .links { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 10px; }
.disclaimer { font-size: 12.5px; color: var(--text-3); }
.empty { padding: 26px; text-align: center; color: var(--text-3); }

/* 補正 */
.grid > .card + .card, .grid > .card { margin-top: 0; }
.tbl .sub { display: block; font-size: 12px; color: var(--text-3); line-height: 1.4; }
.pred > *, .timing > *, .grid > * { min-width: 0; }
.tbl th, .tbl td { padding: 10px 10px; }
@media (max-width: 640px) { .tbl th, .tbl td { padding: 8px 8px; font-size: 14px; } .card { padding: 14px; } .big { font-size: 30px; } }
.cal-list .dayrow { grid-template-columns: 92px 1fr; }
.chip { border-radius: 10px; }
