/* =========================================================
   Chillarin Blog - article.css
   記事ページ専用スタイル (Claude Design 移植 / D-3a)
   tokens.css の :root / :root.light に依存
   ========================================================= */

/* ===== Article root ===== */
.article {
  --warn: oklch(0.76 0.15 45);
  font-family: var(--font-sans);
  line-height: 1.8;
  font-feature-settings: "palt" 1;
  color: var(--text);
}

/* ===== Hero (Variant B) ===== */
.a-hero {
  position: relative;
  min-height: 480px;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
  isolation: isolate;
}

.a-hero-bg {
  position: absolute;
  inset: -60px;
  background-size: cover;
  background-position: center;
  filter: blur(64px) brightness(.55) saturate(1.25);
  transform: scale(1.15);
  z-index: 0;
}

/* ライトモード: 背景の blur 画像はほぼ消し、カバーを右の本物だけで見せる
   (トップ hero-dark と同じく、黒字が読みやすい明るいグラデ背景に揃える) */
:root.light .a-hero-bg {
  opacity: 0;
}

/* ライトモード: hero 本体に明るいグラデを敷いて黒字が読める背景を作る */
:root.light .a-hero {
  background: linear-gradient(135deg, var(--bg-elev) 0, var(--bg-card) 45%, var(--bg) 100%);
}

.a-hero-scrim {
  position: absolute; inset: 0; z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(180deg, transparent 45%, var(--bg) 100%),
    linear-gradient(90deg,
      var(--bg) 0, transparent 30%, transparent 70%, var(--bg) 100%),
    radial-gradient(ellipse at 72% 35%, var(--accent-soft), transparent 60%);
}

:root.light .a-hero-scrim {
  background:
    linear-gradient(180deg, transparent 55%, var(--bg) 100%),
    radial-gradient(ellipse at 72% 35%, var(--accent-soft), transparent 65%) !important;
}

.a-hero-inner {
  position: relative;
  z-index: 2;
  max-width: 1280px;
  margin: 0 auto;
  padding: 80px 32px 64px;
  display: grid;
  grid-template-columns: 1fr 560px;
  gap: 48px;
  align-items: center;
}

.a-hero-copy { max-width: 640px; }

/* ライトモードはトップ (hero-dark) に揃えて黒字統一 */
:root.light .a-hero-copy { color: var(--text); }
:root.light .a-hero-copy .a-subtitle { color: var(--text-dim); }
:root.light .a-hero-copy .a-metabar { color: var(--muted); }
:root.light .a-hero-copy .a-metabar .a-dot { background: var(--muted); }

.a-kicker {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: .72rem;
  letter-spacing: .26em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 20px;
}

.a-kicker::before {
  content: "";
  width: 32px;
  height: 1px;
  background: var(--accent);
}

/* ライトモード: トップ kicker と同じく落ち着いた色味 (text-shadow なし) */
:root.light .a-kicker,
:root.light .a-metabar .a-cat {
  color: var(--accent) !important;
  text-shadow: none;
}

:root.light .a-kicker::before {
  background: var(--accent);
}

.a-title {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: clamp(2.1rem, 3.6vw, 3rem);
  line-height: 1.25;
  letter-spacing: -.01em;
  margin: 0 0 18px;
  text-wrap: balance;
}

/* ライトモード: タイトルもトップに合わせて黒字 (text-shadow なし) */
:root.light .a-title {
  color: var(--text) !important;
  text-shadow: none;
}

.a-subtitle {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.08rem;
  line-height: 1.7;
  color: var(--text-dim);
  margin: 0 0 24px;
  max-width: 560px;
  text-wrap: pretty;
}

.a-metabar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: .76rem;
  color: var(--muted);
}

.a-metabar .a-cat {
  color: var(--accent);
  font-weight: 500;
}

.a-metabar .a-dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--muted);
  opacity: .6;
}

.a-hero-cover {
  position: relative;
  width: 560px;
  aspect-ratio: 16 / 9;
  background-size: cover;
  background-position: center;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, .12);
  box-shadow:
    0 24px 64px rgba(0, 0, 0, .55),
    0 0 0 1px rgba(255, 255, 255, .05) inset;
  justify-self: end;
}

.a-hero-mascot {
  position: absolute;
  bottom: -36px;
  width: 48px;
  height: 48px;
  background: url('/images/chinchilla-logo.png') center / contain no-repeat;
  filter:
    drop-shadow(0 4px 8px rgba(0, 0, 0, 0.5))
    drop-shadow(0 0 8px var(--accent-glow));
  pointer-events: none;
}
.a-hero-mascot--right { right: -56px; }
.a-hero-mascot--left {
  left: -56px;
  transform: scaleX(-1);
}

.a-hero-chip {
  position: absolute;
  left: 32px;
  bottom: 22px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: .7rem;
  letter-spacing: .12em;
  color: var(--muted);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 2px;
}

:root.light .a-hero-chip {
  color: var(--muted);
  background: var(--bg-elev);
  border-color: var(--border);
  backdrop-filter: none;
}

:root.light .a-hero-cover {
  border-color: var(--border);
  box-shadow:
    0 12px 32px rgba(11, 17, 22, .14),
    0 0 0 1px rgba(11, 17, 22, .04) inset;
}

.a-hero-chip-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
}

/* ===== Hero --lite (cover 無しのシンプル版、members 等で使用) ===== */
.a-hero--lite {
  min-height: auto;
  border-bottom: 1px solid var(--border);
}
.a-hero--lite .a-hero-scrim {
  background:
    linear-gradient(180deg, transparent 40%, var(--bg) 100%),
    radial-gradient(ellipse at 50% 40%, var(--accent-soft), transparent 60%);
}
:root.light .a-hero--lite .a-hero-scrim {
  background:
    linear-gradient(180deg, transparent 50%, var(--bg) 100%),
    radial-gradient(ellipse at 50% 40%, var(--accent-soft), transparent 65%) !important;
}
.a-hero-inner--lite {
  grid-template-columns: 1fr;
  padding: 72px 32px 56px;
  align-items: flex-start;
}
.a-hero--lite .a-hero-copy { max-width: 760px; }
.a-hero--lite .a-title {
  font-size: clamp(1.8rem, 3.2vw, 2.6rem);
}

/* lite のうち cover 画像が解決できたもの:
   トップの hero-dark と揃え「左テキスト+右画像」の 2 カラム構成。
   cover はやや大きめ＆左寄せ気味で配置する (テキスト幅を絞って画像を前に出す)。
   画像は HTML 側で --cover-dark / --cover-light を CSS 変数で渡し、ここで mode 別に切替。 */
.a-hero--lite-cover { min-height: 420px; }
.a-hero--lite-cover .a-hero-inner--lite {
  grid-template-columns: minmax(0, 1fr) 560px;
  align-items: center;
  gap: 40px;
}
.a-hero--lite-cover .a-hero-copy { max-width: 520px; }
.a-hero--lite-cover .a-hero-cover {
  width: 560px;
  aspect-ratio: 16 / 9;
  justify-self: start;
  background-image: var(--cover-dark);
}
:root.light .a-hero--lite-cover .a-hero-cover {
  background-image: var(--cover-light);
}
.a-hero--lite-cover .a-hero-mascot { display: none; }
/* cover 付き lite の scrim は右寄りグラデで cover に光を寄せる */
.a-hero--lite-cover .a-hero-scrim {
  background:
    linear-gradient(180deg, transparent 50%, var(--bg) 100%),
    radial-gradient(ellipse at 72% 40%, var(--accent-soft), transparent 60%);
}
:root.light .a-hero--lite-cover .a-hero-scrim {
  background:
    linear-gradient(180deg, transparent 60%, var(--bg) 100%),
    radial-gradient(ellipse at 72% 40%, var(--accent-soft), transparent 65%) !important;
}

/* レスポンシブ: 1024px 以下で cover 少し縮小、720px 以下で 1 カラム積み */
@media (max-width: 1024px) {
  .a-hero--lite-cover .a-hero-inner--lite {
    grid-template-columns: minmax(0, 1fr) 440px;
    gap: 32px;
  }
  .a-hero--lite-cover .a-hero-cover { width: 440px; }
}
@media (max-width: 720px) {
  .a-hero--lite-cover .a-hero-inner--lite {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  .a-hero--lite-cover .a-hero-cover {
    width: 100%;
    max-width: 560px;
    justify-self: start;
  }
  .a-hero--lite-cover .a-hero-copy { max-width: 100%; }
}

/* ===== Layout (main + side) =====
   D-3a ではサイドバーは空だが grid は用意しておく。
   D-3c で .a-side 内の各 card を実装。 */
.a-layout {
  max-width: 1280px;
  margin: 0 auto;
  padding: 48px 32px 80px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 64px;
  align-items: flex-start;
}

/* Sidebar 無し・中央寄せの狭めレイアウト (members 等) */
.a-layout--narrow {
  max-width: 860px;
  grid-template-columns: 1fr;
  gap: 0;
}

.a-main { min-width: 0; }

/* members ページでは本文max幅を layout に合わせて広く */
.article--members .a-body { max-width: none; }

/* members シリーズカード(shortcode members-series-grid) */
.a-body .members-series-grid {
  margin: 24px 0 32px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}
.a-body .extra-series {
  display: flex;
  flex-direction: column;
  padding: 24px 22px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: inherit;
  text-decoration: none !important;
  transition: border-color .15s ease, transform .12s ease;
  position: relative;
}
.a-body .extra-series:hover {
  border-color: var(--accent-line);
  transform: translateY(-2px);
  text-decoration: none !important;
}
.a-body .extra-series .extra-card-kicker {
  margin: 0 0 8px;
  font-family: var(--font-mono);
  font-size: .68rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--accent);
}
.a-body .extra-series h3 {
  margin: 0 0 10px;
  font-family: var(--font-serif);
  font-size: 1.2rem;
  letter-spacing: -0.01em;
}
.a-body .extra-series .extra-card-desc {
  margin: 0 0 4px;
  font-size: .88rem;
  line-height: 1.65;
  color: var(--text-dim);
}
.a-body .members-series-status {
  align-self: flex-start;
  margin-top: 14px;
  font-family: var(--font-mono);
  font-size: .68rem;
  letter-spacing: .14em;
  padding: 2px 10px;
  border-radius: 2px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent-line);
}

/* ===== Stats strip ===== */
.a-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: 40px;
}

.a-stat {
  padding: 22px 26px;
  border-right: 1px solid var(--border);
}

.a-stat:last-child { border-right: none; }

.a-stat-num {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 2rem;
  line-height: 1;
  color: var(--accent);
}

.a-stat-label {
  font-family: var(--font-mono);
  font-size: .72rem;
  color: var(--muted);
  margin-top: 8px;
  letter-spacing: .14em;
  text-transform: uppercase;
}

/* ===== Body (Markdown レンダリング結果に当てる) ===== */
.a-body {
  max-width: 720px;
  font-size: 1rem;
  color: var(--text);
  counter-reset: a-h2-counter;
}

.a-lede {
  font-family: var(--font-serif);
  font-size: 1.22rem;
  line-height: 1.8;
  color: var(--text-dim);
  margin: 0 0 36px;
  text-wrap: pretty;
}

.a-lede::first-letter,
.a-body > p:first-of-type::first-letter {
  font-family: var(--font-serif);
  font-weight: 700;
  float: left;
  font-size: 4.2rem;
  line-height: .95;
  padding: 6px 14px 0 0;
  color: var(--accent);
}

/* front matter で no_dropcap = true の記事はドロップキャップを無効化
   (Claurin/カジュアル記事など、冒頭1文字の強調が文脈に合わない場合) */
.a-body.no-dropcap > p:first-of-type::first-letter {
  font-family: inherit;
  font-weight: inherit;
  float: none;
  font-size: inherit;
  line-height: inherit;
  padding: 0;
  color: inherit;
}

/* 最初の段落をリード文スタイルに(ただしサイズは通常、first-letterだけ強調) */
.a-body > p:first-of-type {
  font-family: var(--font-serif);
  font-size: 1.12rem;
  line-height: 1.85;
  color: var(--text-dim);
  margin-bottom: 32px;
  text-wrap: pretty;
}

.a-body p { margin: 0 0 22px; line-height: 1.8; }
.a-body strong { color: var(--text); font-weight: 700; }

.a-body :not(pre) > code {
  font-family: var(--font-mono);
  font-size: .88em;
  background: var(--accent-soft);
  color: var(--accent);
  padding: 1px 8px;
  border-radius: 3px;
  border: 1px solid var(--accent-line);
}

.a-body h2 {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.65rem;
  letter-spacing: -.005em;
  margin: 68px 0 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
  position: relative;
  scroll-margin-top: 100px;
  display: flex;
  align-items: baseline;
  gap: 14px;
  counter-increment: a-h2-counter;
}

.a-body h2::before {
  content: "§ " counter(a-h2-counter, decimal-leading-zero);
  flex: none;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: .72rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--accent);
  order: -1;
}

.a-body h2::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 56px;
  height: 2px;
  background: var(--accent);
}

.a-body h3 {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.15rem;
  margin: 36px 0 10px;
  color: var(--text);
  scroll-margin-top: 100px;
}

.a-body ul {
  padding-left: 0;
  margin: 18px 0 26px;
  list-style: none;
}

.a-body ul > li {
  position: relative;
  padding: 10px 0 10px 28px;
  border-bottom: 1px dashed var(--border);
}

.a-body ul > li:last-child { border-bottom: none; }

.a-body ul > li::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 18px;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--accent);
  transform: rotate(45deg);
}

.a-body ol {
  padding-left: 1.4em;
  margin: 18px 0 26px;
}

.a-body ol li { margin: 8px 0; }

.a-body a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: var(--accent-line);
  text-underline-offset: 3px;
}

.a-body a:hover { text-decoration-color: var(--accent); }

.a-body blockquote {
  margin: 24px 0;
  padding: 12px 20px;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  color: var(--text-dim);
  font-style: italic;
}

.a-body img,
.a-body video {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  border: 1px solid var(--border);
  margin: 18px 0;
}

.a-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
  margin: 24px 0;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.a-body th {
  text-align: left;
  padding: 12px 16px;
  background: var(--bg-elev);
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}

.a-body td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-dim);
}

.a-body tbody tr:last-child td { border-bottom: none; }
.a-body tbody tr:hover { background: var(--accent-soft); }

/* ===== Code block (render hookでラップ: .a-pre コンテナ + .a-pre-head + <pre>) ===== */
.a-body .a-pre {
  margin: 28px 0;
  border-radius: 6px;
  overflow: hidden;
  background: #06090c;
  border: 1px solid var(--border-str);
}

:root.light .a-body .a-pre {
  background: #0f1a22;
  border-color: #1f2a36;
}

.a-body .a-pre-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  background: rgba(255, 255, 255, .03);
  border-bottom: 1px solid #1f2a36;
  font-family: var(--font-mono);
  font-size: .7rem;
  color: #8a96a6;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.a-body .a-pre-dots {
  display: flex;
  gap: 6px;
  flex: none;
}
.a-body .a-pre-dots span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #2c3b4d;
}
.a-body .a-pre-dots span:nth-child(1) { background: oklch(0.72 0.17 25); }
.a-body .a-pre-dots span:nth-child(2) { background: oklch(0.85 0.13 80); }
.a-body .a-pre-dots span:nth-child(3) { background: oklch(0.78 0.15 150); }

.a-body .a-pre-title { flex: 1; }

.a-body .a-pre-copy {
  font: inherit;
  font-size: .68rem;
  color: var(--accent);
  background: transparent;
  border: 1px solid var(--accent-line);
  padding: 3px 10px;
  border-radius: 3px;
  cursor: pointer;
  letter-spacing: .1em;
  text-transform: uppercase;
  transition: background-color .15s ease;
}
.a-body .a-pre-copy:hover { background: var(--accent-soft); }

/* render hook 後の <pre> or chroma div の中身。既存 style.css のターミナル風緑文字を上書き */
.a-body .a-pre pre,
.a-body .a-pre .highlight,
.a-body .a-pre .highlight pre,
.a-body .a-pre .chroma {
  margin: 0 !important;
  padding: 16px 18px !important;
  background: transparent !important;
  color: #c8d6e6 !important;
  font-family: var(--font-mono);
  font-size: .84rem;
  line-height: 1.65;
  border: none !important;
  overflow-x: auto;
  white-space: pre;
  border-radius: 0 !important;
}
.a-body .a-pre .highlight > pre,
.a-body .a-pre .chroma {
  padding: 16px 18px !important;
}
.a-body .a-pre .highlight {
  padding: 0 !important;
  background: transparent !important;
}

.a-body .a-pre code,
.a-body .a-pre pre code {
  background: transparent !important;
  color: inherit !important;
  padding: 0 !important;
  border: none !important;
  font-size: inherit !important;
}

/* render hook を通さない素の <pre> (予備: 既存記事で markdown の fence なしテキスト等) */
.a-body > pre {
  margin: 28px 0;
  padding: 16px 18px;
  background: #06090c;
  color: #c8d6e6;
  font-family: var(--font-mono);
  font-size: .84rem;
  line-height: 1.65;
  border: 1px solid var(--border-str);
  border-radius: 6px;
  overflow-x: auto;
  white-space: pre;
}

/* ===== Callout (引用風) ===== */
.a-body .a-callout {
  display: flex;
  gap: 18px;
  margin: 32px 0;
  padding: 20px 24px;
  border-top: 1px solid var(--accent-line);
  border-bottom: 1px solid var(--accent-line);
  background: linear-gradient(180deg, var(--accent-soft) 0, transparent 50%);
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.02rem;
  line-height: 1.8;
  color: var(--text-dim);
}
.a-body .a-callout-mark {
  font-size: 2.4rem;
  line-height: 1;
  color: var(--accent);
  font-family: var(--font-serif);
  font-style: normal;
  flex: none;
}
.a-body .a-callout > div > :last-child { margin-bottom: 0; }

/* ===== Box (info / warning / danger) ===== */
.a-body .a-box {
  display: flex;
  gap: 14px;
  margin: 28px 0;
  padding: 16px 20px;
  background: var(--bg-card);
  border-left: 3px solid var(--accent);
  border-radius: 0 4px 4px 0;
  font-size: .94rem;
  line-height: 1.75;
}
.a-body .a-box-warning { border-left-color: var(--warn); }
.a-body .a-box-danger { border-left-color: oklch(0.62 0.2 25); }

.a-body .a-box-icon {
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 700;
  font-size: .9rem;
}
.a-body .a-box-warning .a-box-icon {
  background: oklch(0.78 0.15 45 / .18);
  color: var(--warn);
}
.a-body .a-box-danger .a-box-icon {
  background: oklch(0.62 0.2 25 / .18);
  color: oklch(0.62 0.2 25);
}
.a-body .a-box > div > :last-child { margin-bottom: 0; }

/* ===== Collapse (details/summary) ===== */
.a-body .a-collapse {
  margin: 24px 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-card);
  overflow: hidden;
}
.a-body .a-collapse__summary {
  padding: 12px 16px;
  cursor: pointer;
  font-weight: 600;
  font-size: .94rem;
  color: var(--text);
  list-style: none;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background-color .15s ease;
}
.a-body .a-collapse__summary::-webkit-details-marker { display: none; }
.a-body .a-collapse__summary::before {
  content: "▶";
  font-size: .7rem;
  color: var(--accent);
  transition: transform .2s ease;
}
.a-body .a-collapse[open] .a-collapse__summary::before { transform: rotate(90deg); }
.a-body .a-collapse__summary:hover { background: var(--bg-hover, var(--bg-card)); }
.a-body .a-collapse__body {
  padding: 4px 16px 16px;
  border-top: 1px solid var(--border);
  font-size: .94rem;
  line-height: 1.75;
}
.a-body .a-collapse__body > :first-child { margin-top: 12px; }
.a-body .a-collapse__body > :last-child { margin-bottom: 0; }

/* ===== Divider ===== */
.a-divider {
  text-align: center;
  margin: 64px 0 16px;
  color: var(--border-str);
  font-size: 1.4rem;
  letter-spacing: 1em;
}

/* ===== Related Stories (トップ v3 世代の意匠・2026-06 Phase F) ===== */
.a-related {
  margin-top: 72px;
  padding-top: 40px;
  border-top: 1px solid var(--border);
  max-width: 720px;
}

.a-related-head { margin-bottom: 24px; }

.a-related-kicker {
  margin: 0 0 6px;
  font-family: var(--font-mono);
  font-size: .72rem;
  letter-spacing: .24em;
  text-transform: uppercase;
  color: var(--accent);
}

.a-related-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 1.4rem;
  letter-spacing: -.01em;
  padding-bottom: 14px;
  position: relative;
}
.a-related-title::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 56px;
  height: 3px;
  border-radius: 2px;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
}

.a-related-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.a-rel {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  text-decoration: none;
  color: var(--text);
  transition: transform .18s ease, border-color .18s ease, box-shadow .25s ease;
}

.a-rel:hover {
  border-color: var(--accent-line);
  transform: translateY(-4px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25), 0 0 14px var(--accent-soft);
  text-decoration: none;
}

.a-rel-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, var(--bg-elev), var(--bg-card));
  overflow: hidden;
}
.a-rel-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .35s ease;
}
.a-rel:hover .a-rel-thumb img { transform: scale(1.05); }

.a-rel-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 3px 10px;
  font-family: var(--font-mono);
  font-size: .66rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent-on);
  background: var(--accent);
  border-radius: 999px;
}

.a-rel-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 16px 16px;
  flex: 1;
}

.a-rel-title-text {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.45;
}
.a-rel:hover .a-rel-title-text { color: var(--accent); }

.a-rel-date {
  margin-top: auto;
  font-family: var(--font-mono);
  font-size: .72rem;
  color: var(--muted);
}

/* ===== Sidebar (D-3c) ===== */
.a-side {
  position: sticky;
  top: 96px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.a-side-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 18px;
}

.a-side-label {
  font-family: var(--font-mono);
  font-size: .7rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  font-weight: 500;
}

/* --- Reading Progress bar --- */
.a-progress {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 10px;
}
.a-progress-bar {
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width .15s linear;
}
.a-progress-meta {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: .7rem;
  color: var(--muted);
}

/* --- TOC (Hugo .TableOfContents が出力する #TableOfContents nav を装飾) --- */
.a-side-toc #TableOfContents {
  font-size: .84rem;
  line-height: 1.5;
}
.a-side-toc #TableOfContents ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.a-side-toc #TableOfContents li { margin: 0; }
.a-side-toc #TableOfContents a {
  display: block;
  padding: 7px 0 7px 12px;
  color: var(--muted);
  text-decoration: none;
  border-left: 1px solid var(--border);
  transition: color .15s, border-color .15s;
}
.a-side-toc #TableOfContents a:hover {
  color: var(--text);
  border-left-color: var(--accent-line);
  text-decoration: none;
}
.a-side-toc #TableOfContents a.active {
  color: var(--accent);
  border-left-color: var(--accent);
  font-weight: 500;
}
/* ネストしたサブ項目 (h3) */
.a-side-toc #TableOfContents ul ul a {
  padding-left: 28px;
  font-size: .8rem;
}

/* --- Chinchilla live stream card --- */
.a-side-stream-embed {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.a-side-stream-player {
  width: 100%;
  height: 100%;
}
.a-side-stream-embed iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}
.a-side-stream-offline {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  background: #1a1a1a;
  color: #eee;
  padding: 12px;
}
.a-side-stream-offline-title {
  font-size: .95rem;
  font-weight: 600;
  margin: 0 0 8px;
}
.a-side-stream-offline-schedule {
  font-size: .78rem;
  margin: 0;
  color: #bbb;
  font-family: var(--font-mono);
}
.a-side-stream-caption {
  margin: 10px 0 0;
  font-size: .8rem;
  color: var(--muted);
  text-align: center;
}

/* --- Author card --- */
.a-author-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.a-author-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg-elev) center center / cover no-repeat;
  border: 1px solid var(--border-str);
  flex: none;
}
.a-author-name {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: .96rem;
}
.a-author-handle {
  font-family: var(--font-mono);
  font-size: .72rem;
  color: var(--muted);
}
.a-author-bio {
  font-size: .82rem;
  color: var(--text-dim);
  line-height: 1.65;
  margin: 10px 0 14px;
}
.a-author-follow {
  display: block;
  width: 100%;
  padding: 8px 12px;
  font-family: inherit;
  font-size: .82rem;
  font-weight: 500;
  color: var(--accent-on);
  background: var(--accent);
  border: none;
  border-radius: 3px;
  cursor: pointer;
  letter-spacing: .04em;
  text-align: center;
  text-decoration: none;
  transition: filter .15s ease;
}
.a-author-follow:hover {
  filter: brightness(1.08);
  text-decoration: none;
}

/* --- Tags pill --- */
.a-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.a-tag {
  font-family: var(--font-mono);
  font-size: .72rem;
  padding: 3px 10px;
  border-radius: 2px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  color: var(--muted);
  text-decoration: none;
  transition: border-color .15s, color .15s;
}
.a-tag::before {
  content: "#";
  color: var(--accent);
  margin-right: 2px;
}
.a-tag:hover {
  border-color: var(--accent-line);
  color: var(--text);
  text-decoration: none;
}

/* =========================================================
   共通 button (.a-btn) — Apps Hero CTA 等で使用
   ========================================================= */
.a-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  font-family: var(--font-sans);
  font-size: .88rem;
  font-weight: 500;
  letter-spacing: .02em;
  border-radius: 4px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background-color .15s ease, border-color .15s ease, filter .15s ease;
  white-space: nowrap;
}
.a-btn:hover { text-decoration: none; }

.a-btn--primary {
  background: var(--accent);
  color: var(--accent-on);
  border-color: var(--accent);
}
.a-btn--primary:hover { filter: brightness(1.08); color: var(--accent-on); }

.a-btn--ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border-str);
}
.a-btn--ghost:hover { border-color: var(--accent-line); color: var(--accent); }

/* =========================================================
   Apps list (/apps/)
   ========================================================= */
.apps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
  margin: 32px 0 16px;
}

.app-card {
  display: flex;
  flex-direction: column;
  padding: 24px 22px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: inherit;
  text-decoration: none !important;
  transition: border-color .15s ease, transform .12s ease;
}
.app-card:hover {
  border-color: var(--accent-line);
  transform: translateY(-2px);
  text-decoration: none !important;
}

.app-card--soon {
  opacity: .6;
  cursor: default;
  pointer-events: none;
}

.app-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.app-card-title {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.15rem;
  margin: 0;
  letter-spacing: -.005em;
}

.app-card-tagline {
  margin: 0 0 14px;
  font-size: .88rem;
  line-height: 1.65;
  color: var(--text-dim);
}

.app-card-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
  padding-top: 4px;
}

/* =========================================================
   Apps single (/apps/<slug>/) — Hero & CTA
   ========================================================= */
.a-hero--app .a-hero-inner--lite {
  padding: 72px 32px 56px;
}

.app-status-pill {
  font-family: var(--font-mono);
  font-size: .68rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid var(--accent-line);
  background: var(--accent-soft);
  border-radius: 2px;
  padding: 2px 10px;
  font-weight: 500;
}
.app-status-pill--soon {
  color: var(--muted);
  border-color: var(--border-str);
  background: var(--bg-elev);
}

.app-status-note {
  margin: 0 0 22px;
  font-family: var(--font-mono);
  font-size: .76rem;
  letter-spacing: .04em;
  color: var(--muted);
}

.app-cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

.app-tech-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

/* Apps sidebar 内の Quick Links */
.app-side-links {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.app-side-links li { margin: 0; }
.app-side-links a {
  display: block;
  padding: 8px 0;
  color: var(--text);
  text-decoration: none;
  font-size: .86rem;
  border-bottom: 1px dashed var(--border);
  transition: color .15s ease;
}
.app-side-links li:last-child a { border-bottom: none; }
.app-side-links a:hover { color: var(--accent); text-decoration: none; }

.flex-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.flex-row--gap-lg { gap: 16px; }

/* =========================================================
   Breadcrumb (Hero Lite 内などで使用)
   ========================================================= */
.a-breadcrumb {
  font-family: var(--font-mono);
  font-size: .74rem;
  letter-spacing: .04em;
  color: var(--muted);
  margin: 0 0 18px;
}
.a-breadcrumb a {
  color: var(--muted);
  text-decoration: none;
}
.a-breadcrumb a:hover {
  color: var(--accent);
  text-decoration: none;
}
.a-breadcrumb .sep {
  margin: 0 10px;
  opacity: .6;
}
.a-breadcrumb .current { color: var(--text); }

/* =========================================================
   List pages (カテゴリ / タグ / posts)
   - 記事カードグリッドはトップ v3 世代の assets/css/list.css (.lp-*) に移行。
     旧 .list-card (横長ミニカード) は 2026-06 Phase E で廃止
   ========================================================= */
.list-empty {
  padding: 48px 24px;
  text-align: center;
  background: var(--bg-card);
  border: 1px dashed var(--border-str);
  border-radius: 6px;
  color: var(--muted);
  font-size: .92rem;
}

/* =========================================================
   Terms index (/categories/, /tags/)
   ========================================================= */
.terms-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.term-card {
  display: block;
  padding: 20px 22px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: inherit;
  text-decoration: none !important;
  transition: border-color .15s ease, transform .12s ease;
}
.term-card:hover {
  border-color: var(--accent-line);
  transform: translateY(-2px);
  text-decoration: none !important;
}

.term-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.term-card-title {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.1rem;
  margin: 0;
  letter-spacing: -.005em;
  color: var(--text);
}
.term-card-count {
  font-family: var(--font-mono);
  font-size: .72rem;
  letter-spacing: .14em;
  color: var(--muted);
  white-space: nowrap;
}
.term-card-desc {
  margin: 0;
  font-size: .86rem;
  line-height: 1.65;
  color: var(--text-dim);
}

/* =========================================================
   Games (/games/ list + /games/<slug>/ single)
   ========================================================= */

/* --- Games list (1列縦積み・横長カード) --- */
.games-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-top: 32px;
}

.game-card {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 20px;
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  text-decoration: none !important;
  color: inherit;
  transition: border-color .15s ease, transform .12s ease;
}
.game-card:hover {
  border-color: var(--accent-line);
  transform: translateY(-2px);
  text-decoration: none !important;
}

.game-card-thumb {
  width: 240px;
  aspect-ratio: 16 / 10;
  background-size: cover;
  background-position: center;
  background-color: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 4px;
}

.game-card-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

@media (max-width: 520px) {
  .game-card { grid-template-columns: 1fr; }
  .game-card-thumb { width: 100%; }
}

.game-card-title {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.1rem;
  margin: 0;
  letter-spacing: -.005em;
  color: var(--text);
}
.game-card:hover .game-card-title { color: var(--accent); }

.game-card-desc {
  margin: 0;
  font-size: .86rem;
  line-height: 1.6;
  color: var(--text-dim);
}

.game-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
  padding-top: 4px;
}

/* --- Game single --- */
.game-canvas-wrapper {
  margin: 24px 0;
  border-radius: 6px;
  overflow: hidden;
  background: var(--bg-card);
  border: 1px solid var(--border);
  /* 実寸・portrait 等のキャンバス個別サイズは /css/games-v2.css が担当 */
}

.game-ranking {
  margin: 24px 0;
}

.game-controls-card {
  margin: 32px 0;
  padding: 20px 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.game-controls-card .a-side-label {
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.game-controls-dl {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 8px 16px;
  margin: 0 0 16px;
  font-size: .9rem;
}
.game-controls-dl dt {
  font-family: var(--font-mono);
  font-size: .74rem;
  letter-spacing: .04em;
  color: var(--muted);
  padding-top: 2px;
}
.game-controls-dl dd {
  margin: 0;
  color: var(--text-dim);
}

.game-controls-card .a-body {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px dashed var(--border);
}

@media (max-width: 520px) {
  .game-controls-dl {
    grid-template-columns: 1fr;
    gap: 2px 0;
  }
  .game-controls-dl dd { margin-bottom: 10px; }
}

/* =========================================================
   List sidebar (/categories/*, /posts/ 等の Sidebar)
   ========================================================= */
.list-sidebar-links {
  list-style: none;
  padding: 0;
  margin: 0;
}
.list-sidebar-links li { margin: 0; }
.list-sidebar-links a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  color: var(--text);
  text-decoration: none;
  font-size: .88rem;
  border-bottom: 1px dashed var(--border);
}
.list-sidebar-links li:last-child a { border-bottom: none; }
.list-sidebar-links a:hover { color: var(--accent); }
.list-sidebar-links .count {
  font-family: var(--font-mono);
  font-size: .72rem;
  color: var(--muted);
}

.list-sidebar-posts {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.list-sidebar-posts li { margin: 0; }
.list-sidebar-posts a {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--text);
  text-decoration: none;
  padding-bottom: 12px;
  border-bottom: 1px dashed var(--border);
}
.list-sidebar-posts li:last-child a {
  padding-bottom: 0;
  border-bottom: none;
}
.list-sidebar-posts time {
  font-family: var(--font-mono);
  font-size: .7rem;
  color: var(--muted);
}
.list-sidebar-posts .title {
  font-size: .86rem;
  line-height: 1.4;
  color: var(--text);
}
.list-sidebar-posts a:hover .title { color: var(--accent); }


/* ===== Responsive ===== */
@media (max-width: 960px) {
  .a-layout { grid-template-columns: 1fr; }
  .a-side { position: static; }
  .a-hero-inner { grid-template-columns: 1fr; }
  .a-hero-cover {
    width: 100%;
    max-width: 560px;
    justify-self: start;
  }
  .a-stats { grid-template-columns: 1fr; }
  .a-stat {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .a-stat:last-child { border-bottom: none; }
  .a-related-grid { grid-template-columns: 1fr; }
  .a-hero-mascot {
    right: -20px;
    bottom: -20px;
    width: 84px;
    height: 84px;
  }
}

/* ==========================================================
   Chillarin Trading Lab — 運用成績サマリ（無料・trading カテゴリ hero 下）
   CSS 変数経由で dark/light 両対応。hex ハードコード禁止。
   ========================================================== */
.ctl-status {
  margin: 28px 0 8px;
  padding: 22px 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
}
.ctl-status-head { margin-bottom: 16px; }
.ctl-status-title {
  font-family: var(--font-sans);
  font-size: 1.18rem;
  font-weight: 700;
  margin: 0 0 4px;
  color: var(--text);
}
.ctl-status-note {
  font-size: .82rem;
  color: var(--muted);
  margin: 0;
}
.ctl-status-note .ctl-updated { margin-left: 8px; }

/* 総括 KPI */
.ctl-kpis {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}
.ctl-kpi {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.ctl-kpi-label { font-size: .72rem; color: var(--muted); letter-spacing: .02em; }
.ctl-kpi-value {
  font-family: var(--font-mono);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.1;
}
.ctl-kpi-bench { color: var(--text-dim); }
.ctl-kpi-note { font-size: .62rem; color: var(--muted); line-height: 1.4; margin-top: 2px; }

/* 損益の色（CSS 変数経由）。テーブルセルの色指定に勝つよう .ctl-status スコープで詳細度を確保 */
.ctl-status .is-up,
.ctl-status .ctl-pos td.is-up   { color: var(--accent); }
.ctl-status .is-down,
.ctl-status .ctl-pos td.is-down { color: var(--warn); }

/* Fund 別カード */
.ctl-funds {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}
.ctl-fund {
  padding: 14px 16px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.ctl-fund-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.ctl-fund-name { font-weight: 700; font-size: .98rem; color: var(--text); }
.ctl-fund-kind {
  font-size: .7rem;
  color: var(--muted);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 9px;
}
.ctl-fund-eq { display: flex; align-items: baseline; gap: 12px; margin-bottom: 8px; }
.ctl-fund-eq-val { font-family: var(--font-mono); font-size: 1.25rem; font-weight: 700; color: var(--text); }
.ctl-fund-ret { font-family: var(--font-mono); font-size: .95rem; font-weight: 700; }

/* 保有銘柄テーブル */
.ctl-pos {
  width: 100%;
  border-collapse: collapse;
  font-size: .8rem;
  font-family: var(--font-mono);
}
.ctl-pos th {
  text-align: right;
  font-weight: 600;
  color: var(--muted);
  font-size: .7rem;
  padding: 4px 6px;
  border-bottom: 1px solid var(--border);
}
.ctl-pos th:first-child, .ctl-pos td:first-child { text-align: left; }
.ctl-pos td {
  text-align: right;
  padding: 5px 6px;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
}
.ctl-pos tr:last-child td { border-bottom: none; }
.ctl-pos .ctl-sym { color: var(--text); font-weight: 600; }
.ctl-pos-empty { font-size: .8rem; color: var(--muted); margin: 8px 0 0; }
/* 含み損益セル: $ 額（主）+ % 率（従・小さく薄め）を縦に並べる。
   損益の色（is-up/is-down）は親 td に付き、$ 額は currentColor を継承、% は少し落とす */
.ctl-pos-pnl { white-space: nowrap; line-height: 1.25; }
.ctl-pos-pnl .ctl-pnl-usd { display: block; }
.ctl-pos-pnl .ctl-pnl-pct {
  display: block;
  font-size: .68rem;
  opacity: .72;
}

/* 動線・注記 */
.ctl-links { display: flex; flex-wrap: wrap; gap: 10px 18px; margin-bottom: 14px; }
.ctl-link {
  font-size: .85rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color .15s;
}
.ctl-link:hover { border-bottom-color: var(--accent); }
.ctl-link-member { color: var(--text-dim); }
.ctl-disclaimer {
  font-size: .72rem;
  line-height: 1.6;
  color: var(--muted);
  margin: 0;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}

@media (max-width: 640px) {
  .ctl-kpis { grid-template-columns: 1fr; }
  .ctl-funds { grid-template-columns: 1fr; }
}

/* ==========================================================
   Chillarin Trading Lab — 運用ダッシュボードページ (/trading/)
   既存 .ctl-kpi / .ctl-fund / .ctl-pos / .ctl-link / .ctl-disclaimer を再利用しつつ、
   ダッシュボード専用のフレーム・サマリ・資産推移グラフを足す。
   色は CSS 変数経由で dark/light 両対応。
   ========================================================== */

/* 損益色を dashboard スコープでも有効化（既存は .ctl-status スコープのみ） */
.ctl-dash .is-up,   .ctl-dash td.is-up   { color: var(--accent); }
.ctl-dash .is-down, .ctl-dash td.is-down { color: var(--warn); }

/* ヒーロー: 通常の lite hero を少し締めて dashboard 導入に */
.ctl-dash-hero .a-subtitle { max-width: 52ch; }

.ctl-dash {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-top: 8px;
}

/* 汎用カード枠 */
.ctl-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px 20px;
}

/* ===== サマリ（大きい equity + KPI 群）===== */
.ctl-dash-summary {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 2fr;
  gap: 18px;
  align-items: stretch;
}
.ctl-dash-eqbox {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  padding: 22px 24px;
  background:
    radial-gradient(140% 120% at 0% 0%, var(--accent-soft), transparent 55%),
    var(--bg-elev);
  border: 1px solid var(--border-str);
  border-radius: 16px;
}
/* 左端にアクセントのグローバー */
.ctl-dash-eqbox::before {
  content: "";
  position: absolute;
  left: 0; top: 12%; bottom: 12%;
  width: 3px;
  border-radius: 3px;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
}
.ctl-dash-eqlabel {
  font-size: .72rem;
  color: var(--muted);
  letter-spacing: .08em;
  text-transform: uppercase;
}
.ctl-dash-eq {
  font-family: var(--font-mono);
  font-size: 2.7rem;
  font-weight: 800;
  line-height: 1;
  color: var(--text);
  letter-spacing: -.01em;
}
.ctl-dash-ret {
  font-family: var(--font-mono);
  font-size: 1.2rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  width: fit-content;
  padding: 2px 8px;
  border-radius: 8px;
}
.ctl-dash-ret.is-up   { color: var(--accent); background: var(--accent-soft); }
.ctl-dash-ret.is-down { color: var(--warn);   background: color-mix(in oklch, var(--warn) 18%, transparent); }
/* 上下矢印アイコン（疑似要素）*/
.ctl-dash-ret.is-up::before   { content: "▲"; font-size: .72em; }
.ctl-dash-ret.is-down::before { content: "▼"; font-size: .72em; }
/* サマリ右側の KPI は既存 .ctl-kpis を流用、dashboard 内では詰める */
.ctl-dash-summary .ctl-kpis { margin: 0; align-content: center; }
.ctl-dash-summary .ctl-kpi {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
}
.ctl-kpi-updated, .ctl-kpi-bench { font-family: var(--font-mono); }
/* ベンチを符号で色付け（プラスはアクセント寄り、マイナスは警告寄り）— JS 無しの素直な表現 */
.ctl-kpi-bench { color: var(--text-dim); }

/* ===== 資産推移グラフ（フィンテック・ダーク基調）=====
   .ctl-chart に is-up / is-down が付き、currentColor で線・面・点の色を一括切替。
   なめらか曲線 + 面グラデ + グロー + グリッド + 2 本線 + ホバーツールチップ。 */
.ctl-card--chart {
  padding: 18px 20px 14px;
  position: relative;
  overflow: hidden;
}
/* カード背景にうっすらアクセントの放射グラデを敷いて金融ダッシュらしさを出す */
.ctl-card--chart::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(120% 80% at 50% -10%, var(--accent-soft), transparent 60%);
  opacity: .5;
  pointer-events: none;
}
.ctl-chart { margin: 0; position: relative; z-index: 1; }

/* 系列の配色（3 本比較: Fund A=teal / Fund B=orange / SPY=blue、合計=teal）。
   dark/light 両方で視認できる明度を選ぶ（濃すぎ・薄すぎを避ける）。*/
.ctl-chart {
  --ctl-a:   var(--accent);                 /* Fund A = ブランド teal */
  --ctl-b:   var(--warn);                   /* Fund B = orange */
  --ctl-spy: oklch(0.74 0.13 255);          /* SPY = blue（中立） */
  --ctl-total: var(--accent);               /* 合計 = teal */
}
:root.light .ctl-chart { --ctl-spy: oklch(0.58 0.15 255); }  /* light では少し濃く */
.ctl-s-a     { color: var(--ctl-a); }
.ctl-s-b     { color: var(--ctl-b); }
.ctl-s-spy   { color: var(--ctl-spy); }
.ctl-s-total { color: var(--ctl-total); }
.ctl-s-other { color: var(--text-dim); }

.ctl-chart-cap {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: .95rem;
  color: var(--text);
  margin-bottom: 8px;
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}
.ctl-chart-sub { font-weight: 400; font-size: .74rem; color: var(--muted); font-family: var(--font-mono); }

/* ===== タブ（2 ビュー切替）===== */
.ctl-chart-tabs {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  margin-bottom: 10px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.ctl-tab {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: .78rem;
  font-weight: 600;
  padding: 5px 14px;
  border-radius: 7px;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.ctl-tab:hover { color: var(--text-dim); }
.ctl-tab.is-active {
  background: var(--accent-soft);
  color: var(--accent);
}

/* 凡例 */
.ctl-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin: 0 0 8px;
  font-size: .74rem;
  color: var(--text-dim);
}
.ctl-leg { display: inline-flex; align-items: center; gap: 6px; }
.ctl-leg i { width: 18px; height: 0; border-top-width: 3px; border-top-style: solid; border-radius: 2px; flex: none; }
.ctl-leg--series i { border-top-color: currentColor; }   /* 系列クラスの color を継承 */
.ctl-leg--base i   { border-top-color: var(--muted); border-top-style: dotted; }

/* チャート本体 */
.ctl-chart-wrap { position: relative; }
.ctl-chart-svg {
  display: block;
  width: 100%;
  height: auto;            /* viewBox の縦横比を維持（歪み解消）*/
  overflow: visible;
}
/* グリッド・軸ラベル */
.ctl-chart-grid {
  stroke: var(--border);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}
.ctl-chart-ylabel,
.ctl-chart-xlabel {
  fill: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
}
/* 面塗り（合計ビューのみ。系列クラスの currentColor を薄く）*/
.ctl-chart-area { stroke: none; fill: currentColor; opacity: .14; }
/* 本線 + グロー（色は系列クラスの currentColor を継承）*/
.ctl-chart-line {
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linejoin: round;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}
.ctl-chart-glow {
  stroke: currentColor;
  stroke-width: 7;
  stroke-linejoin: round;
  stroke-linecap: round;
  opacity: .18;
  filter: blur(3px);
  vector-effect: non-scaling-stroke;
}
/* baseline（元本/各$1500）破線 */
.ctl-chart-base {
  stroke: var(--muted);
  stroke-width: 1;
  stroke-dasharray: 2 4;
  opacity: .65;
  vector-effect: non-scaling-stroke;
}
/* データ点マーカー（色は系列クラス継承）*/
.ctl-chart-dot {
  fill: var(--bg-card);
  stroke: currentColor;
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}
.ctl-chart-dot.is-last {
  fill: currentColor;
  filter: drop-shadow(0 0 5px currentColor);
}
/* ホバーガイド */
.ctl-hover-vline {
  stroke: var(--text-dim);
  stroke-width: 1;
  stroke-dasharray: 3 3;
  opacity: .5;
  vector-effect: non-scaling-stroke;
}
/* ツールチップ */
.ctl-tooltip {
  position: absolute;
  top: 6px;
  pointer-events: none;
  min-width: 188px;
  padding: 9px 12px;
  background: var(--bg-elev);
  border: 1px solid var(--border-str);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgb(0 0 0 / .28);
  font-size: .76rem;
  z-index: 3;
}
.ctl-tooltip[hidden] { display: none; }
.ctl-tt-date {
  font-family: var(--font-mono);
  font-size: .72rem;
  color: var(--muted);
  margin-bottom: 6px;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--border);
}
.ctl-tt-rows { display: flex; flex-direction: column; gap: 3px; }
.ctl-tt-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 14px;
  line-height: 1.5;
}
/* 系列名の前に色ドット（系列クラスの currentColor）*/
.ctl-tt-row > span {
  color: var(--text-dim);
  position: relative;
  padding-left: 14px;
}
.ctl-tt-row > span::before {
  content: "";
  position: absolute;
  left: 0; top: 50%;
  width: 8px; height: 8px;
  margin-top: -4px;
  border-radius: 2px;
  background: currentColor;   /* = 行の系列クラス color */
}
.ctl-tt-row b { font-family: var(--font-mono); font-weight: 700; color: var(--text); white-space: nowrap; }
.ctl-tt-row b em { font-style: normal; font-size: .88em; margin-left: 4px; }
.ctl-tt-row b em.is-up   { color: var(--accent); }
.ctl-tt-row b em.is-down { color: var(--warn); }

/* 空状態 */
.ctl-chart-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 160px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: 12px;
  padding: 20px;
}
.ctl-chart-placeholder span { font-size: 1rem; font-weight: 700; color: var(--text-dim); }
.ctl-chart-placeholder p { font-size: .8rem; margin: 0; max-width: 36ch; line-height: 1.6; }

/* ===== Fund カード（dashboard 版は 2 列、フッターに現金/確定/手数料）===== */
.ctl-funds--dash { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 0; }
.ctl-funds--dash .ctl-fund {
  position: relative;
  overflow: hidden;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 18px;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.ctl-funds--dash .ctl-fund:hover {
  transform: translateY(-2px);
  border-color: var(--border-str);
  box-shadow: 0 10px 28px rgb(0 0 0 / .22);
}
/* カード上辺にファンド識別のアクセントライン（A=accent / B=warn 系で対比）*/
.ctl-funds--dash .ctl-fund::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 3px;
}
.ctl-funds--dash .ctl-fund:nth-child(1)::before { background: linear-gradient(90deg, var(--accent), transparent); }
.ctl-funds--dash .ctl-fund:nth-child(2)::before { background: linear-gradient(90deg, var(--warn), transparent); }
/* dashboard 版は equity をやや大きく */
.ctl-funds--dash .ctl-fund-eq-val { font-size: 1.4rem; }
.ctl-funds--dash .ctl-fund-ret {
  padding: 1px 7px;
  border-radius: 7px;
  font-size: .9rem;
}
.ctl-funds--dash .ctl-fund-ret.is-up   { background: var(--accent-soft); }
.ctl-funds--dash .ctl-fund-ret.is-down { background: color-mix(in oklch, var(--warn) 16%, transparent); }
.ctl-fund-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: .76rem;
  color: var(--muted);
}
.ctl-fund-foot b { font-family: var(--font-mono); color: var(--text-dim); font-weight: 700; }
.ctl-fund-foot b.is-up   { color: var(--accent); }
.ctl-fund-foot b.is-down { color: var(--warn); }

/* ===== 動線カード（縦並びリンク + アイコン）===== */
.ctl-links-card { display: flex; flex-direction: column; gap: 4px; }
.ctl-links-card .ctl-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 8px;
  border-bottom: 1px solid var(--border);
  border-radius: 8px;
  transition: background .15s ease, padding-left .15s ease;
}
.ctl-links-card .ctl-link:hover {
  background: var(--accent-soft);
  padding-left: 12px;
}
.ctl-links-card .ctl-link:last-child { border-bottom: none; }
.ctl-link-ic {
  font-size: 1.05rem;
  width: 1.9em; height: 1.9em;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 9px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  flex: none;
}

/* ===== レスポンシブ ===== */
@media (max-width: 720px) {
  .ctl-dash-summary { grid-template-columns: 1fr; }
  .ctl-funds--dash { grid-template-columns: 1fr; }
  .ctl-dash-eq { font-size: 2.1rem; }
  .ctl-chart-ylabel, .ctl-chart-xlabel { font-size: 13px; }  /* 縮小時に潰れないよう拡大 */
  .ctl-tooltip { min-width: 132px; font-size: .72rem; }
}

/* ==========================================================
   Chillarin Trading Lab — ヒーロー右カラム埋め込み版（trading カテゴリ専用）
   汎用 hero-lite-cover の右 cover 領域（560px）に成績サマリカードを置く。
   ========================================================== */
/* trading 専用: cover 背景は使わないので scrim を中央寄りに戻す */
.a-hero--trading .a-hero-scrim {
  background:
    linear-gradient(180deg, transparent 50%, var(--bg) 100%),
    radial-gradient(ellipse at 60% 40%, var(--accent-soft), transparent 62%);
}
:root.light .a-hero--trading .a-hero-scrim {
  background:
    linear-gradient(180deg, transparent 60%, var(--bg) 100%),
    radial-gradient(ellipse at 60% 40%, var(--accent-soft), transparent 66%) !important;
}

.ctl-herobox {
  width: 560px;
  justify-self: start;
  align-self: center;
  box-sizing: border-box;
  padding: 18px 20px;
  background: color-mix(in oklab, var(--bg-card) 86%, transparent);
  border: 1px solid var(--border);
  border-radius: 16px;
  backdrop-filter: blur(6px);
  box-shadow: 0 8px 28px rgba(0,0,0,.18);
}
.ctl-herobox-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}
.ctl-herobox-title { font-family: var(--font-sans); font-weight: 700; font-size: 1rem; color: var(--text); }
.ctl-herobox-updated { font-size: .72rem; color: var(--muted); white-space: nowrap; }

/* 合計 equity 行 */
.ctl-herobox-total {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px 12px;
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.ctl-herobox-eq { font-family: var(--font-mono); font-size: 1.8rem; font-weight: 700; color: var(--text); line-height: 1; }
.ctl-herobox-ret { font-family: var(--font-mono); font-size: 1.05rem; font-weight: 700; }
.ctl-herobox-base { font-size: .72rem; color: var(--muted); margin-left: auto; }

/* Fund 行 */
.ctl-herobox-funds { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.ctl-herobox-fund {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: baseline;
  gap: 10px;
  padding: 8px 10px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 9px;
}
.ctl-herobox-fname { font-size: .82rem; color: var(--text-dim); }
.ctl-herobox-fval { font-family: var(--font-mono); font-size: .95rem; font-weight: 700; color: var(--text); }
.ctl-herobox-fret { font-family: var(--font-mono); font-size: .85rem; font-weight: 700; min-width: 56px; text-align: right; }

.ctl-herobox-links { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.ctl-herobox-link {
  display: inline-block;
  align-self: flex-start;
  font-size: .82rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
.ctl-herobox-link:hover { border-bottom-color: var(--accent); }
.ctl-herobox-link-member { color: var(--text-dim); font-weight: 600; }
.ctl-herobox-link-member:hover { border-bottom-color: var(--text-dim); }
.ctl-herobox-note { font-size: .68rem; color: var(--muted); margin: 0; line-height: 1.5; }

/* 損益色（herobox スコープで詳細度確保） */
.ctl-herobox .is-up   { color: var(--accent); }
.ctl-herobox .is-down { color: var(--warn); }

/* レスポンシブ: hero-lite-cover の breakpoint に合わせる */
@media (max-width: 1024px) {
  .ctl-herobox { width: 440px; }
}
@media (max-width: 720px) {
  .ctl-herobox { width: 100%; max-width: 560px; }
}
