:root {
  color-scheme: light;
  --topbar-h: 94px;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-soft: #eceff3;
  --surface-raised: #ffffff;
  --ink: #14202b;
  --muted: #64748b;
  --line: #dde3ea;
  --line-strong: #c5cfd9;
  --accent: #0e7490;
  --up: #d43a3a;
  --up-soft: #f6d9d9;
  --down: #2264c0;
  --down-soft: #d7e5f8;
  --ma5: #0f9d58;
  --ma20: #7857cf;
  --mnav: #f08a24;
  --rank-s: #d21f3c;
  --rank-s-bg: #fbe3e8;
  --rank-a: #14805e;
  --rank-a-bg: #e0f2ea;
  --rank-b: #6b7280;
  --rank-b-bg: #eceef1;
  --rank-c: #b46905;
  --rank-c-bg: #fdf0d9;
  --rank-d: #c62828;
  --rank-d-bg: #fbe3e3;
  --chart-bg: #fbfcfd;
  --grid: #e3e9ee;
  --grid-strong: #cfd9de;
  --shadow: 0 10px 28px rgba(20, 32, 43, 0.07);
  --shadow-soft: 0 2px 8px rgba(20, 32, 43, 0.05);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0c121c;
  --surface: #18222f;
  --surface-soft: #212d3d;
  --surface-raised: #1e2a39;
  --ink: #eef3f9;
  --muted: #9aa8ba;
  --line: #2c3a4d;
  --line-strong: #3b4d64;
  --accent: #4cc5fb;
  --up: #ef5350;
  --up-soft: color-mix(in srgb, #ef5350 24%, #18222f);
  --down: #4c9aef;
  --down-soft: color-mix(in srgb, #4c9aef 24%, #18222f);
  --ma5: #22c55e;
  --ma20: #a78bfa;
  --mnav: #fb923c;
  --rank-s: #fb7185;
  --rank-s-bg: rgba(251, 113, 133, 0.18);
  --rank-a: #34d399;
  --rank-a-bg: rgba(52, 211, 153, 0.16);
  --rank-b: #9ca3af;
  --rank-b-bg: rgba(156, 163, 175, 0.18);
  --rank-c: #fbbf24;
  --rank-c-bg: rgba(251, 191, 36, 0.15);
  --rank-d: #f87171;
  --rank-d-bg: rgba(248, 113, 113, 0.16);
  --chart-bg: #111a28;
  --grid: #243247;
  --grid-strong: #33455c;
  --shadow: 0 14px 34px rgba(0, 0, 0, 0.48);
  --shadow-soft: 0 2px 12px rgba(0, 0, 0, 0.34);
}

/* Green Monster モード（管理者専用ページ） 基本カラー=はっきりしたグリーン */
:root[data-theme="green"] {
  color-scheme: dark;
  --bg: #0c3426;
  --surface: #10402f;
  --surface-soft: #0d3325;
  --surface-raised: #134735;
  --ink: #e7f2ec;
  --muted: #93b8a6;
  --line: #1d4d3a;
  --line-strong: #2a6349;
  --accent: #5fd39a;
  --up: #e5686a;
  --up-soft: color-mix(in srgb, #e5686a 22%, #10402f);
  --down: #6ba6e8;
  --down-soft: color-mix(in srgb, #6ba6e8 22%, #10402f);
  --ma5: #7ee0a6;
  --ma20: #b6a7ef;
  --mnav: #e8b053;
  --rank-s: #ef8a95;
  --rank-s-bg: rgba(229, 104, 106, 0.15);
  --rank-a: #7ed7a4;
  --rank-a-bg: rgba(126, 215, 164, 0.15);
  --rank-b: #b7cfc2;
  --rank-b-bg: rgba(183, 207, 194, 0.12);
  --rank-c: #e8b053;
  --rank-c-bg: rgba(232, 176, 83, 0.14);
  --rank-d: #ef8a8a;
  --rank-d-bg: rgba(239, 138, 138, 0.14);
  --chart-bg: #0a2c21;
  --grid: #143d2e;
  --grid-strong: #1d5140;
  --shadow: 0 14px 34px rgba(0, 22, 14, 0.42);
  --shadow-soft: 0 2px 10px rgba(0, 22, 14, 0.3);
}

/* 管理者バッジ（Green Monster ビューの目印） */
.adminBadge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #06301e;
  background: linear-gradient(135deg, #7ee0a6, #4fb587);
  box-shadow: 0 2px 8px rgba(0, 22, 14, 0.35);
}

/* Green Monster ページ全体を緑に: 落ち着いた深緑ベース + 控えめなハイライト */
:root[data-theme="green"] {
  background: #082018;
}
:root[data-theme="green"] body {
  background:
    radial-gradient(1000px 460px at 100% -8%, rgba(126, 224, 166, 0.06), transparent 60%),
    linear-gradient(165deg, #082018 0%, #0c3426 55%, #0e3b2b 100%);
  background-attachment: fixed;
}
/* パネルはわずかに半透明にして下地の緑を薄く透かす（やりすぎない） */
:root[data-theme="green"] .mainPanel,
:root[data-theme="green"] .chartWrap,
:root[data-theme="green"] .newsPane,
:root[data-theme="green"] .analystPanel {
  background: color-mix(in srgb, var(--surface) 90%, transparent);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  /* iOS: 一番上/下でのラバーバンド跳ね返りを抑え、固定要素の突き抜けを防ぐ（iOS16+/Chrome/Firefox） */
  overscroll-behavior-y: none;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Segoe UI", sans-serif;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
  transition: background-color 0.25s ease, color 0.25s ease;
  overscroll-behavior-y: none;
}

a {
  color: inherit;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

h1 {
  font-size: 17px;
  font-weight: 750;
  letter-spacing: 0.01em;
}

h2 {
  font-size: 19px;
  font-weight: 720;
}

h3 {
  font-size: 14px;
  font-weight: 700;
}

.eyebrow {
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ダッシュボードの目的文（タイトル下） */
.appPurpose {
  margin: 6px 0 0;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--muted);
  max-width: 620px;
  text-transform: none;
  letter-spacing: 0;
}

/* 各セクションの補足文（何を・どの並びで見せているか）目立たせない */
.paneHint {
  margin: 0 0 10px;
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.45;
  color: var(--muted);
  letter-spacing: 0;
}

/* ---------- top bar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  min-height: var(--topbar-h);
  padding: 12px 24px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brandMark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 55%, var(--ma20)));
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.02em;
  box-shadow: var(--shadow-soft);
}

.meta {
  display: flex;
  gap: 14px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.langToggle {
  display: inline-flex;
  padding: 3px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 9px;
}

.langToggle button {
  min-width: 38px;
  height: 26px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
}

.langToggle button.active {
  background: var(--surface-raised);
  color: var(--ink);
  box-shadow: var(--shadow-soft);
}

.themeToggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--ink);
  font-size: 15px;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.themeToggle:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

/* ---------- layout ---------- */

main {
  width: min(1500px, 100%);
  margin: 0 auto;
  padding: 18px 24px 48px;
}

.workspace {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.tickerPanel,
.mainPanel,
.thresholdBox {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.tickerPanel,
.mainPanel {
  box-shadow: var(--shadow);
}

.tickerPanel {
  position: sticky;
  top: calc(var(--topbar-h) + 14px);
  padding: 14px;
}

.panelHeader,
.sectionHeader,
.chartHeader {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}

.sectionNote {
  color: var(--muted);
  font-size: 12px;
}

/* ---------- ticker sidebar ---------- */

.tickerTabs {
  display: grid;
  gap: 8px;
}

.tickerButton {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 10px;
  width: 100%;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.tickerButton:hover {
  border-color: var(--line-strong);
  background: var(--surface-soft);
}

.tickerButton.active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 9%, var(--surface));
}

.tickerBadge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 9px;
  color: #fff;
  font-weight: 800;
  font-size: 12px;
}

.tickerInfo {
  min-width: 0;
}

.tickerInfo strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.tickerPrice {
  display: flex;
  gap: 8px;
  align-items: baseline;
  margin-top: 2px;
  font-size: 13px;
  font-weight: 750;
}

.tickerPrice b {
  font-size: 12px;
  font-weight: 750;
}

.tickerSub {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thresholdBox {
  margin-top: 12px;
  padding: 12px;
  background: var(--surface-soft);
}

.thresholdBox p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

/* ---------- main panel ---------- */

.mainPanel {
  padding: 16px;
}

.mainGrid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  grid-template-areas:
    "chart news"
    "tabs news";
  gap: 16px;
  align-items: start;
}

/* スマホ専用トップタブはデスクトップでは非表示（≤720pxでのみ表示） */
.mobileTabs {
  display: none;
}

.chartBlock {
  grid-area: chart;
  min-width: 0;
}

.tabsBlock {
  grid-area: tabs;
  min-width: 0;
}

.newsPane {
  grid-area: news;
  position: sticky;
  top: calc(var(--topbar-h) + 14px);
  max-height: calc(100vh - var(--topbar-h) - 44px);
  overflow-y: auto;
  min-width: 0;
  padding-right: 2px;
}

.newsPane .sectionHeader {
  position: sticky;
  top: 0;
  z-index: 3;
  flex-wrap: wrap;
  margin-bottom: 8px;
  padding: 4px 0 8px;
  background: var(--surface);
}

.eventReturn {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  white-space: nowrap;
}

.eventReturn small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.newsPane .timeline {
  grid-template-columns: 1fr;
}

@media (max-width: 1239px) {
  .mainGrid {
    grid-template-columns: 1fr;
    grid-template-areas:
      "chart"
      "news"
      "tabs";
  }

  .newsPane {
    position: static;
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }

  .newsPane .sectionHeader {
    position: static;
    padding: 0;
  }

  .newsPane .timeline {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.tickerHero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.tickerHero h2 {
  font-size: 22px;
}

.heroStats {
  display: grid;
  grid-template-columns: repeat(5, minmax(92px, 1fr));
  gap: 8px;
  min-width: min(680px, 68%);
}

.heroStat {
  padding: 10px 12px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.heroStat span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.heroStat strong {
  display: block;
  margin-top: 4px;
  font-size: 19px;
  font-weight: 780;
}

/* ---------- chart ---------- */

.chartWrap {
  position: relative;
  margin-top: 14px;
  padding: 14px;
  background: var(--chart-bg);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.popMini {
  display: flex;
  gap: 14px;
  margin: 0 0 9px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.popMini b {
  font-size: 12.5px;
  font-weight: 780;
}

/* 価格ポップアップ: 時価総額・mNAVを色分けして目立たせる */
.popKeyStats {
  margin-top: 2px;
  padding-top: 7px;
  border-top: 1px solid var(--line);
  color: var(--ink);
}
.popKeyStats b {
  font-weight: 820;
}
.popMcap {
  color: var(--accent);
}
.popMnav {
  color: var(--mnav);
}

/* 収集ジョブ実行状況: 右上のドットボタン＋ポップアップ */
.jobStatusBtn {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.jobStatusBtn.ok { color: var(--rank-a); }
.jobStatusBtn.partial { color: var(--mnav); }
.jobStatusBtn.fail { color: var(--rank-s); }
.jobRun {
  border-top: 1px solid var(--line);
  padding: 9px 0;
}
.jobRunHead {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}
.jobTime {
  color: var(--muted);
  font-size: 11px;
  margin-left: auto;
}
.jobBadge {
  font-size: 10px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
}
.jobBadge.ok { background: color-mix(in srgb, var(--rank-a) 20%, transparent); color: var(--rank-a); }
.jobBadge.partial { background: color-mix(in srgb, var(--mnav) 20%, transparent); color: var(--mnav); }
.jobBadge.fail { background: color-mix(in srgb, var(--rank-s) 20%, transparent); color: var(--rank-s); }
.jobSteps {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 7px;
}
.jobStep {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
}
.jobStep.ok { color: var(--rank-a); }
.jobStep.fail { color: var(--rank-s); border-color: var(--rank-s); }

.chartPopover {
  position: absolute;
  z-index: 12;
  width: 236px;
  padding: 11px 12px 12px;
  background: color-mix(in srgb, var(--surface-raised) 78%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.chartPopover::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--muted);
}

.chartPopover.s::before {
  background: var(--rank-s);
}

.chartPopover.a::before {
  background: var(--rank-a);
}

.chartPopover.b::before {
  background: var(--rank-b);
}

.chartPopover.c::before {
  background: var(--rank-c);
}

.chartPopover.d::before {
  background: var(--rank-d);
}

.chartPopover:not([hidden]) {
  animation: popIn 0.12s ease-out;
}

@keyframes popIn {
  from {
    opacity: 0;
    transform: translateY(5px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.popHead {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 2px 0 6px;
}

.popHead .tag {
  min-height: 18px;
  padding: 1px 7px;
  font-size: 10px;
}

.popClose {
  margin-left: auto;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}

.popClose:hover {
  background: var(--surface-soft);
  color: var(--ink);
}

.popDate {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.popTitle {
  margin: 0 0 5px;
  font-size: 13px;
  font-weight: 760;
  line-height: 1.35;
}

.popSummary {
  margin: 0 0 9px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.5;
}

.popMetrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 10px;
}

.popMetrics span {
  display: grid;
  gap: 1px;
  padding: 5px 8px;
  background: var(--surface-soft);
  border-radius: 8px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
}

.popMetrics b {
  font-size: 12.5px;
  font-weight: 780;
  color: var(--ink);
}

.popActions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.popDetail {
  flex: 1;
  height: 30px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
}

.popDetail:hover {
  filter: brightness(1.12);
}

.popLink {
  display: inline-flex;
  align-items: center;
  height: 30px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  text-decoration: none;
  white-space: nowrap;
}

.popLink:hover {
  color: var(--ink);
  border-color: var(--line-strong);
}

/* ---------- event detail modal ---------- */

.eventModal[hidden] {
  display: none;
}

.eventModal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(5, 10, 16, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.modalCard {
  position: relative;
  width: min(560px, 100%);
  max-height: 82vh;
  overflow-y: auto;
  padding: 15px 18px 18px;
  background: var(--surface-raised);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  box-shadow: var(--shadow);
  animation: popIn 0.14s ease-out;
}

.modalCard::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--muted);
}

.modalCard.s::before {
  background: var(--rank-s);
}

.modalCard.a::before {
  background: var(--rank-a);
}

.modalCard.b::before {
  background: var(--rank-b);
}

.modalCard.c::before {
  background: var(--rank-c);
}

.modalCard.d::before {
  background: var(--rank-d);
}

.modalTitle {
  margin: 2px 0 8px;
  font-size: 16px;
  font-weight: 760;
  line-height: 1.4;
}

.modalSummary {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.modalLabel {
  display: block;
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.modalWhy {
  margin: 0 0 12px;
  padding: 10px 12px;
  background: var(--surface-soft);
  border-radius: 10px;
}

.modalWhy .modalLabel {
  margin-bottom: 3px;
}

.modalWhy p {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.6;
}

.reactionStartLine {
  margin: 2px 0 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.reactionStartLine .shiftNote {
  color: var(--rank-a, var(--ink));
}

.timingBadge {
  font-weight: 700;
}

.reactGrid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  margin-bottom: 12px;
}

.reactGrid span {
  display: grid;
  gap: 1px;
  padding: 6px 8px;
  background: var(--surface-soft);
  border-radius: 8px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
}

.reactGrid b {
  font-size: 12.5px;
  font-weight: 780;
  color: var(--ink);
}

.reactGrid b.pos {
  color: var(--up);
}

.reactGrid b.neg {
  color: var(--down);
}

.modalMeta {
  margin-bottom: 14px;
}

.popDetail.asLink {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  padding: 0 14px;
  text-decoration: none;
}

@media (max-width: 720px) {
  .reactGrid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.chartTools {
  display: flex;
  align-items: center;
  gap: 14px;
}

.rangeButtons {
  display: inline-flex;
  padding: 3px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 9px;
}

.rangeButtons button {
  min-width: 42px;
  height: 28px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.rangeButtons button.active {
  background: var(--surface-raised);
  color: var(--ink);
  box-shadow: var(--shadow-soft);
}

.chartStats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(138px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.chartStat {
  padding: 8px 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 9px;
}

.chartStat span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.chartStat strong {
  display: block;
  margin-top: 3px;
  font-size: 13px;
  font-weight: 750;
}

.chart {
  width: 100%;
}

.chart svg {
  display: block;
  width: 100%;
  height: auto;
}

.chartCanvas {
  fill: var(--chart-bg);
}

.axisLabel {
  fill: var(--muted);
  font-size: 12px;
}

.axisTitle {
  fill: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.gridLine {
  stroke: var(--grid);
  stroke-width: 1;
}

.gridStrong {
  stroke: var(--grid-strong);
  stroke-width: 1;
}

.candle.up line {
  stroke: var(--up);
}

.candle.up rect {
  fill: var(--up-soft);
  stroke: var(--up);
}

.candle.down line {
  stroke: var(--down);
}

.candle.down rect {
  fill: var(--down-soft);
  stroke: var(--down);
}

.ma5line {
  stroke: var(--ma5);
}

.ma20line {
  stroke: var(--ma20);
}

.mnavBar {
  fill: var(--mnav);
  opacity: 0.18;
}

.mnavLine {
  stroke: var(--mnav);
  filter: drop-shadow(0 1px 2px color-mix(in srgb, var(--mnav) 24%, transparent));
}

.mnavAxisLabel,
.mnavAxisTitle {
  fill: var(--mnav);
}

.volBar.up {
  fill: var(--up);
  opacity: 0.72;
}

.volBar.down {
  fill: var(--down);
  opacity: 0.72;
}

.evLine.s {
  stroke: var(--rank-s);
}

.evLine.a {
  stroke: var(--rank-a);
}

.evLine.b {
  stroke: var(--rank-b);
}

.evLine.c {
  stroke: var(--rank-c);
}

.evLine.d {
  stroke: var(--rank-d);
}

.evMark.s {
  fill: var(--rank-s);
}

.evMark.a {
  fill: var(--rank-a);
}

.evMark.b {
  fill: var(--rank-b);
}

.evMark.c {
  fill: var(--rank-c);
}

.evMark.d {
  fill: var(--rank-d);
}

.evMark {
  stroke: var(--chart-bg);
  stroke-width: 1.2;
}

.evGroup {
  cursor: pointer;
}

.evGroup:hover .evMark {
  stroke: var(--ink);
  stroke-width: 1.8;
  transform: scale(1.25);
  transform-box: fill-box;
  transform-origin: center;
}

.evGroup:hover .evLine {
  opacity: 0.6;
}

.evGroup.syncHi .evMark {
  stroke: var(--ink);
  stroke-width: 2;
  transform: scale(1.35);
  transform-box: fill-box;
  transform-origin: center;
}

.evGroup.syncHi .evLine {
  opacity: 0.65;
}

.eventItem.syncHi {
  border-color: var(--accent);
}

/* ピン留め中（ポップアップ表示中）のマーカー強調 */
.evGroup.pinned .evMark {
  stroke: var(--ink);
  stroke-width: 2.6;
  transform: scale(2.1);
  transform-box: fill-box;
  transform-origin: center;
  filter: drop-shadow(0 0 6px var(--accent));
}

.evGroup.pinned .evLine {
  opacity: 1;
  stroke: var(--accent);
  stroke-width: 2.5;
  stroke-dasharray: none;
  filter: drop-shadow(0 0 4px var(--accent));
}

.evGroup.pinned .evHit {
  fill: transparent;
  stroke: var(--accent);
  stroke-width: 3;
  transform-box: fill-box;
  transform-origin: center;
  animation: pinPulse 1.1s ease-out infinite;
}

@keyframes pinPulse {
  0% {
    transform: scale(0.5);
    opacity: 1;
  }
  100% {
    transform: scale(2.1);
    opacity: 0;
  }
}

.latestLine {
  stroke: var(--ink);
  stroke-width: 1;
  stroke-dasharray: 4 5;
  opacity: 0.35;
}

.latestDot {
  fill: var(--ink);
  stroke: var(--chart-bg);
  stroke-width: 2;
}

.priceBadge {
  fill: var(--surface);
  stroke: var(--line-strong);
  stroke-width: 1;
}

.priceBadgeText {
  fill: var(--ink);
  font-size: 12px;
  font-weight: 800;
}

.legend {
  display: flex;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
}

.legend span {
  white-space: nowrap;
}

.legend i {
  display: inline-block;
  width: 16px;
  height: 8px;
  margin-right: 5px;
  vertical-align: middle;
}

.candleLegend {
  height: 12px;
  border: 1px solid var(--up);
  background: var(--up-soft);
}

.ma5Legend {
  border-top: 3px solid var(--ma5);
}

.ma20Legend {
  border-top: 3px solid var(--ma20);
}

.mnavLegend {
  border-top: 3px solid var(--mnav);
}

.barLegend {
  background: var(--down);
  opacity: 0.55;
}

.legend i.legendTriS,
.legend i.legendTriA,
.legend i.legendTriB {
  width: 0;
  height: 0;
  background: transparent;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 10px solid var(--rank-a);
  border-radius: 0;
}

.legend i.legendTriS {
  border-bottom-color: var(--rank-s);
}

.legend i.legendTriB {
  border-bottom-color: var(--rank-b);
}

.alertLegend {
  width: 10px;
  height: 10px;
  background: transparent;
  border: 1.5px solid var(--rank-d);
  border-radius: 50%;
}

.alLine {
  stroke: var(--rank-d);
  stroke-width: 1;
  stroke-dasharray: 2 4;
  opacity: 0.2;
}

.alGroup {
  cursor: pointer;
}

.alBadge {
  fill: var(--chart-bg);
  stroke: var(--rank-d);
  stroke-width: 1.5;
}

.alQ {
  fill: var(--rank-d);
  font-size: 10px;
  font-weight: 800;
}

.alGroup.hot .alBadge {
  stroke-width: 3;
  filter: drop-shadow(0 0 6px var(--rank-d));
}

.alGroup.hot .alLine {
  opacity: 0.95;
  stroke-width: 2.2;
  stroke-dasharray: none;
  filter: drop-shadow(0 0 4px var(--rank-d));
}

/* 関連度オシレーター */
.oscStem {
  stroke-width: 2;
  opacity: 0.55;
}

.oscDot {
  stroke: var(--chart-bg);
  stroke-width: 1;
}

.oscGroup.rel-high .oscStem,
.oscGroup.rel-high .oscDot {
  stroke: var(--rank-a);
  fill: var(--rank-a);
}

.oscGroup.rel-mid .oscStem,
.oscGroup.rel-mid .oscDot {
  stroke: var(--rank-c);
  fill: var(--rank-c);
}

.oscGroup.rel-low .oscStem,
.oscGroup.rel-low .oscDot {
  stroke: var(--muted);
  fill: var(--muted);
}

.rel-high {
  color: var(--rank-a);
}

.rel-mid {
  color: var(--rank-c);
}

.rel-low {
  color: var(--muted);
}

.relRow {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 0 12px;
}

.relRow .modalLabel {
  margin: 0;
}

.relBadge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--surface-soft);
  font-size: 12px;
  font-weight: 780;
}

.relNote {
  color: var(--muted);
  font-size: 11.5px;
}

.candBlock {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
}

.candRow {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 5px;
  font-size: 12px;
}

.candText {
  color: var(--muted);
  line-height: 1.45;
}

.candLink {
  color: var(--accent);
  text-decoration: none;
  font-weight: 700;
}

.alertItem.clickable {
  cursor: pointer;
}

.alertItem.clickable:hover {
  border-color: var(--rank-d);
}

/* ---------- section tabs ---------- */

.sectionTabs {
  position: sticky;
  top: calc(var(--topbar-h) + 8px);
  z-index: 10;
  display: flex;
  gap: 6px;
  margin-top: 16px;
  padding: 4px;
  background: color-mix(in srgb, var(--surface-soft) 88%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow-x: auto;
}

.sectionTabs button {
  min-width: 104px;
  height: 34px;
  padding: 0 12px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-weight: 750;
  cursor: pointer;
  white-space: nowrap;
}

.sectionTabs button.active {
  background: var(--surface-raised);
  color: var(--ink);
  box-shadow: var(--shadow-soft);
}

.tabSection {
  display: none;
  margin-top: 14px;
}

.tabSection.active {
  display: block;
}

select {
  height: 34px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
}

/* ---------- events / alerts / rankings ---------- */

.timeline,
.alertList {
  display: grid;
  gap: 9px;
}

.timeline.compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.eventItem,
.alertItem,
.rankingItem {
  display: grid;
  gap: 6px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  transition: border-color 0.15s ease;
}

.eventItem:hover,
.rankingItem:hover {
  border-color: var(--line-strong);
}

.eventItem.flash {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 40%, transparent);
}

.eventItem.clickable,
.rankingItem.clickable {
  cursor: pointer;
}


.eventItem.clickable:hover,
.rankingItem.clickable:hover {
  border-color: var(--accent);
}

.eventItem.clickable:hover .eventTitle,
.rankingItem.clickable:hover .rankingTitle {
  color: var(--accent);
}

.localRankingGrid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.localRankingGrid > div {
  min-width: 0;
}

.localRankingGrid h4 {
  margin: 0 0 8px;
  font-size: 13px;
}

.definitionGrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.definitionCard {
  padding: 13px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.definitionCard h4 {
  margin: 0 0 8px;
  font-size: 14px;
}

.definitionCard p,
.definitionCard li {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.definitionCard ul {
  display: grid;
  gap: 5px;
  margin: 0;
  padding-left: 18px;
}

.eventTop,
.rankingTop {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
}

.eventTitle,
.rankingTitle {
  font-weight: 700;
  font-size: 13px;
  line-height: 1.4;
}

.eventSummary {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.tagRow {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 21px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  text-decoration: none;
}

a.tag:hover {
  color: var(--ink);
}

.tag.s {
  background: var(--rank-s-bg);
  color: var(--rank-s);
}

.tag.a {
  background: var(--rank-a-bg);
  color: var(--rank-a);
}

.tag.b {
  background: var(--rank-b-bg);
  color: var(--rank-b);
}

.tag.c {
  background: var(--rank-c-bg);
  color: var(--rank-c);
}

.tag.d {
  background: var(--rank-d-bg);
  color: var(--rank-d);
}

.tag.ghost {
  background: transparent;
  padding: 2px 2px;
}

.tickChip {
  display: inline-flex;
  align-items: center;
  min-height: 21px;
  padding: 2px 9px;
  border-radius: 6px;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.tag.medium {
  gap: 5px;
  background: transparent;
  border: 1px solid var(--line-strong);
  color: var(--ink);
  font-weight: 720;
}

.tag.medium::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--med, var(--muted));
}

.m-sec {
  --med: #4c9aef;
}

.m-ir {
  --med: #2dd4bf;
}

.m-wire {
  --med: #14b8a6;
}

.m-officialX {
  --med: #38bdf8;
}

.m-insiderX {
  --med: #a78bfa;
}

.m-investor {
  --med: #f59e0b;
}

.m-kol {
  --med: #fb7185;
}

.m-officialSite {
  --med: #94a3b8;
}

.m-podcast {
  --med: #f472b6;
}

.m-media {
  --med: #9ca3af;
}

.pos {
  color: var(--up);
}

.neg {
  color: var(--down);
}

.muted {
  color: var(--muted);
}

.rankingValue {
  font-size: 17px;
  font-weight: 800;
  white-space: nowrap;
}

.rankingList {
  display: grid;
  gap: 8px;
}

.empty {
  color: var(--muted);
  font-size: 13px;
  padding: 12px;
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
}

/* ---------- responsive ---------- */

@media (max-width: 1120px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .tickerPanel {
    position: static;
  }

  .tickerTabs {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  }

  .timeline.compact,
  .localRankingGrid,
  .definitionGrid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .topbar {
    height: auto;
    padding: 12px 16px;
  }

  .tickerHero {
    flex-direction: column;
    align-items: stretch;
  }

  main {
    padding: 14px 14px 40px;
  }

  .heroStats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    min-width: 0;
  }

  .chartHeader,
  .chartTools {
    align-items: flex-start;
    flex-direction: column;
  }

  .tickerTabs {
    grid-template-columns: 1fr;
  }

  .meta {
    white-space: normal;
  }

  .sectionTabs {
    top: 8px;
  }

  /* A: チャートは潰さず実寸で横スクロール（三角マーカーを視認・タップ可能に） */
  .chart {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
  }

  .chart svg {
    min-width: 680px;
  }

  /* C: 凡例が見切れないよう折返し＋微縮小 */
  .legend {
    flex-wrap: wrap;
    gap: 6px 12px;
    font-size: 11px;
  }

  /* スマホ専用トップタブ：1画面1セクション（縦長を解消）。唯一の固定要素 */
  .mobileTabs {
    display: flex;
    gap: 6px;
    position: sticky;
    top: 0;
    z-index: 30;
    padding: 8px 0;
    margin-bottom: 6px;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    overflow-x: auto;
    /* 旧式の慣性フラグはsticky時にペイント抜けを起こすため付けない（iOS標準の慣性で十分） */
  }

  .mobileTabs button {
    flex: 0 0 auto;
    padding: 8px 14px;
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--surface-soft);
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
  }

  .mobileTabs button.active {
    background: var(--surface-raised);
    color: var(--ink);
    border-color: var(--muted);
  }

  .mobileTabs button.subtle {
    font-weight: 650;
    opacity: 0.85;
  }

  /* 案1: 銘柄ストリップも固定して、タブと「1つのナビ群」にする（コンパクト表示） */
  .tickerStrip {
    position: sticky;
    top: 0;
    z-index: 31;
    margin-bottom: 0;
    padding: 6px 0 4px;
    background: var(--bg);
  }
  .tickerStrip .tickerButton {
    padding: 4px 9px;
    box-shadow: none;
  }
  /* 基底(.tickerStrip .tickerBadge)より高い詳細度で小さく上書き */
  .tickerStrip .tickerButton .tickerBadge {
    width: 28px;
    height: 28px;
    font-size: 10px;
  }
  /* 名前・材料件数は省いてバッジ＋価格＋変化率のコンパクトなチップに */
  .tickerStrip .tickerInfo strong,
  .tickerStrip .tickerSub {
    display: none;
  }
  .tickerStrip .tickerInfo {
    justify-content: center;
  }
  /* タブバーは銘柄ストリップの直下に固定（top はJSでストリップ高に同期） */
  .mobileTabs {
    top: var(--sticky-ticker-h, 52px);
  }

  /* 選択中セクションだけ表示 */
  .mainGrid[data-mview="chart"] .newsPane {
    display: none;
  }

  .mainGrid:not([data-mview="chart"]) .chartBlock {
    display: none;
  }

  /* スマホではペイン内の旧タブ列は隠す（トップタブが担う） */
  .mainGrid:not([data-mview="chart"]) .newsPane .sectionHeader {
    display: none;
  }

  /* スマホでは詳細モーダルの「チャートで見る」は不要（別タブなので） */
  .modalChartBtn {
    display: none;
  }

  /* iPhone縦：横幅を端末にフィット（はみ出し・見切れをなくす） */
  .topbar {
    flex-wrap: wrap;
    gap: 8px 12px;
    padding: 10px 16px;
    /* ヘッダーの固定を解除：固定はトップタブ1本だけにして重なりを防ぐ */
    position: static;
  }

  .meta {
    flex-wrap: wrap;
    gap: 8px 10px;
    white-space: normal;
    margin-left: auto;
    justify-content: flex-end;
  }

  /* ニュース/インパクトのカードは1カラムで幅いっぱいに（2カラムは窮屈） */
  .newsPane .timeline {
    grid-template-columns: 1fr;
  }
}

/* ---- ファンドプロフィール（社名タップ→ポートフォリオ） ---- */
.tickerNameRow {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.nameClickable {
  cursor: pointer;
  border-bottom: 1px dashed transparent;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.nameClickable:hover,
.nameClickable:focus-visible {
  border-bottom-color: var(--muted);
  color: var(--accent, inherit);
}
.exchangeBadge {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: color-mix(in srgb, var(--panel) 70%, transparent);
  white-space: nowrap;
}
.portfolioBtn {
  min-height: 38px;
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: 0.025em;
  padding: 8px 18px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--accent) 72%, var(--line));
  color: #fff;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 58%, var(--ma20)));
  box-shadow: 0 5px 16px color-mix(in srgb, var(--accent) 24%, transparent);
  cursor: pointer;
  white-space: nowrap;
  transition: filter 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.portfolioBtn::before {
  content: "▦ ";
  opacity: 0.9;
}
.portfolioBtn:hover,
.portfolioBtn:focus-visible {
  filter: brightness(1.08);
  transform: translateY(-1px);
  box-shadow: 0 7px 20px color-mix(in srgb, var(--accent) 32%, transparent);
}
.profileHint {
  margin: 2px 0 0;
  font-size: 10.5px;
  color: var(--muted);
  opacity: 0.75;
}
.profileHint:empty {
  display: none;
}
.pfGrid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 4px;
}
.pfChip {
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 82%, transparent);
}
.pfSource {
  margin: 10px 0 0;
  font-size: 11px;
  color: var(--muted);
}
.portfolioModalCard {
  width: min(860px, 100%);
}
.pfSection {
  margin-top: 12px;
}
.pfSectionTitle {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 6px;
  font-size: 13px;
}
.pfSectionTitle span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 10.5px;
}
.pfTableWrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.pfTable {
  width: 100%;
  min-width: 600px;
  border-collapse: collapse;
  font-size: 12.5px;
}
.pfTable th,
.pfTable td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
.pfTable tbody tr:last-child td {
  border-bottom: 0;
}
.pfTable th {
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 10.5px;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.pfTable .pfRank {
  width: 52px;
  color: var(--muted);
  text-align: center;
}
.pfTable .pfNum {
  width: 112px;
  text-align: right;
  white-space: nowrap;
}
.pfName strong {
  display: block;
  font-weight: 720;
  line-height: 1.35;
}
.pfName small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.35;
}
.pfPct {
  color: var(--accent);
  font-weight: 800;
}
.pfMeta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 11px;
}
.pfMeta b {
  color: var(--ink);
}
.pfNote {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}
.pfFallback {
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--surface-soft);
}
.pfSourceLink {
  display: inline-flex;
  margin-top: 8px;
  color: var(--accent);
  font-size: 11.5px;
  font-weight: 750;
  text-decoration: none;
}
.pfSourceLink:hover,
.pfSourceLink:focus-visible {
  text-decoration: underline;
}

@media (max-width: 720px) {
  .tickerNameRow .portfolioBtn {
    flex-basis: 100%;
    width: fit-content;
  }
  .portfolioModalCard {
    padding-inline: 12px;
  }
}

/* ---- 全銘柄比較: インパクト × 材料不明 ---- */
.compareTableWrap {
  overflow-x: auto;
  margin-bottom: 18px;
}
.compareTitle {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--muted);
  text-transform: none;
}
.compareTable {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.compareTable th,
.compareTable td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}
.compareTable th {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}
.compareTable .num {
  text-align: right;
}
.compareTable .warnCount {
  color: var(--warn, #d97706);
  font-weight: 700;
}
.compDateChip {
  font: inherit;
  font-size: 11.5px;
  padding: 3px 8px;
  margin: 2px 4px 2px 0;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: inherit;
  cursor: pointer;
}
.compDateChip:hover {
  border-color: var(--muted);
}

/* ---- 定義タブ: 開発者向けリファレンスとしてグレーに落とす ---- */
.devSection {
  opacity: 0.78;
  filter: saturate(0.55);
}
.devSection h3,
.devSection h4 {
  color: var(--muted);
}
.devNote {
  font-style: italic;
}
#sectionTabs button[data-section="definitions"] {
  color: var(--muted);
  opacity: 0.7;
}

/* ---- チャートヘッダー: タイトルを折らず、ツール群は下に回り込む ---- */
.chartHeader {
  flex-wrap: wrap;
}
.chartHeader h3 {
  white-space: nowrap;
}
.chartTools {
  flex-wrap: wrap;
  row-gap: 6px;
}

/* ---- ニュースカード: 材料後の株価インパクトをシェイプ自体の色（背景の濃さ）で示す ----
   縁取り・はみ出しは使わない（選択強調と衝突するため）。 */
.eventItem.impHiUp {
  background: color-mix(in srgb, var(--up) 14%, var(--surface));
}
.eventItem.impMidUp {
  background: color-mix(in srgb, var(--up) 7%, var(--surface));
}
.eventItem.impHiDown {
  background: color-mix(in srgb, var(--down) 14%, var(--surface));
}
.eventItem.impMidDown {
  background: color-mix(in srgb, var(--down) 7%, var(--surface));
}

/* ---- チャート⇔ニュース同期: 選択中はシェイプの色をさらに濃くして強調（外枠なし） ---- */
.eventItem.syncHi.impHiUp,
.eventItem.syncHi.impMidUp {
  background: color-mix(in srgb, var(--up) 26%, var(--surface));
}
.eventItem.syncHi.impHiDown,
.eventItem.syncHi.impMidDown {
  background: color-mix(in srgb, var(--down) 26%, var(--surface));
}
.eventItem.syncHi:not(.impHiUp):not(.impMidUp):not(.impHiDown):not(.impMidDown) {
  background: color-mix(in srgb, var(--accent) 16%, var(--surface));
}

/* ---- ポップアップ: 同日の材料グリッド（強い順・複数列） ---- */
.popMoreLabel {
  margin-top: 8px;
  font-size: 10.5px;
  color: var(--muted);
}
.popEvGrid {
  display: grid;
  gap: 6px;
  margin-top: 6px;
}
.popEvItem {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  font: inherit;
  font-size: 11.5px;
  text-align: left;
  color: inherit;
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  min-width: 0;
}
.popEvItem:hover {
  border-color: var(--accent);
}
.popEvItem .popEvTitle {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.popEvItem b {
  flex-shrink: 0;
}

/* ---- ポップアップ: 同日材料の対等タイル（左から強い順・1〜3列） ---- */
.popEvCard {
  display: grid;
  gap: 5px;
  padding: 9px 10px;
  font: inherit;
  font-size: 11.5px;
  text-align: left;
  color: inherit;
  background: color-mix(in srgb, var(--surface) 84%, transparent);
  border: 1px solid var(--line);
  border-radius: 9px;
  cursor: pointer;
  min-width: 0;
}
.popEvCard:hover {
  border-color: var(--accent);
}
.popEvCard.strongest {
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
}
.popEvCard.s.strongest {
  background: color-mix(in srgb, var(--rank-s) 12%, var(--surface));
}
.popEvHead {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.popEvTitle2 {
  font-weight: 600;
  line-height: 1.35;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.popEvMini {
  display: flex;
  gap: 10px;
  color: var(--muted);
  font-size: 10.5px;
}
.popEvMini b {
  margin-left: 3px;
}

/* 件数が極端に多い日はポップアップ内でスクロール（チャートからはみ出さない） */
.popEvGrid {
  max-height: 330px;
  overflow-y: auto;
}

.popEvDate {
  margin-left: auto;
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
}

/* ランキング等から飛んできた対象タイルを明示 */
.popEvCard.targeted {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

/* ---- 右ペイン集約タブ: チャート＋右ペインだけ見ればいいシンプルUX ---- */
.newsTabs {
  display: flex;
  gap: 4px;
  width: 100%;
  flex-wrap: wrap;
}
.newsTabs button {
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  padding: 7px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.newsTabs button:hover {
  color: inherit;
}
.newsTabs button.active {
  background: var(--surface);
  border-color: var(--line-strong);
  color: inherit;
}
/* 材料不明・定義は控えめに（インパクト分析とニュースが主役） */
.newsTabs button.subtle {
  font-weight: 500;
  font-size: 11.5px;
  opacity: 0.65;
}
.newsTabs button.subtle.active {
  opacity: 0.9;
}
.paneSection {
  display: none;
}
.paneSection.active {
  display: block;
}
.paneControls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}
.paneRankHead {
  margin: 16px 0 8px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  text-transform: none;
}
#pane-impact .rankingList {
  display: grid;
  gap: 8px;
}
#pane-defs .definitionGrid {
  grid-template-columns: 1fr;
}

/* ---- 銘柄を上部の横並びストリップに（画面を1画面で広く使う） ----
   銘柄が増えたら横スクロールで選ぶ。 */
.workspace {
  display: block;
}
.tickerStrip {
  margin-bottom: 14px;
  overflow-x: auto;
  scrollbar-width: thin;
  padding-bottom: 4px;
}
.tickerStrip .tickerTabs {
  display: flex;
  gap: 10px;
  min-width: max-content;
}
.tickerStrip .tickerButton {
  flex: 0 0 auto;
  min-width: 216px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}
@media (max-width: 1239px) {
  .tickerStrip .tickerButton {
    min-width: 180px;
  }
}

/* ストリップ内のボタンは幅100%指定（旧サイドバー用）を打ち消してコンパクト固定幅に */
.tickerStrip .tickerButton {
  width: auto;
}

/* インパクト分析タブでの同期ハイライト（ニュースカードと同じ強調ルール） */
.rankingItem.syncHi {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, var(--surface));
}

/* ---- 銘柄ストリップをコンパクトに（5銘柄なら1画面に収まる自然幅） ---- */
.tickerStrip .tickerButton {
  min-width: 0;
  width: auto;
  padding: 8px 12px;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 8px;
}
.tickerStrip .tickerBadge {
  width: 36px;
  height: 36px;
  font-size: 11px;
}
.tickerStrip .tickerInfo strong {
  font-size: 12.5px;
  white-space: nowrap;
}
.tickerStrip .tickerSub {
  font-size: 10px;
  white-space: nowrap;
}

/* ---- 右ペインタブの文字詰め（EN時に定義が2段目へ落ちないように） ---- */
.newsTabs {
  flex-wrap: nowrap;
  overflow-x: auto;
}
.newsTabs button {
  padding: 6px 10px;
  white-space: nowrap;
}

/* ---- アナリスト分析パネル（チャート下・時系列追記） ---- */
.analystPanel {
  margin-top: 16px;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.analystPanel:empty {
  display: none;
}
.analystHead {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.analystHead h3 {
  margin: 0;
  font-size: 14px;
}
.analystSub {
  font-size: 11px;
  color: var(--muted);
}
.analystEntry {
  padding: 12px 0;
  border-top: 1px solid var(--line);
}
.analystEntryHead {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.analystEntryHead h4 {
  margin: 0;
  font-size: 13px;
}
.analystEntry p {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.75;
  color: color-mix(in srgb, var(--ink) 88%, transparent);
}
.analystDisclaimer {
  margin: 12px 0 0;
  font-size: 10.5px;
  color: var(--muted);
}

/* アナリスト分析: 根拠ニュースへのチャートリンク */
.analystRefs {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.analystRefsLabel {
  font-size: 10.5px;
  color: var(--muted);
}
.analystRefChip {
  font: inherit;
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: inherit;
  cursor: pointer;
}
.analystRefChip:hover {
  border-color: var(--accent);
  color: var(--accent);
}
