/* ============================================================
   用語解説（Just-in-Time Learning）共通スタイル
   ============================================================ */
:root {
  --primary:   #00838F;  /* ティール（用語ページのアクセント） */
  --primary-d: #006064;
  --secondary: #E65100;
  --success:   #2E7D32;
  --danger:    #C62828;
  --purple:    #6A1B9A;
  --bg:        #F8F9FA;
  --text:      #212121;
  --border:    #DEE2E6;
  --card-bg:   #FFFFFF;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Hiragino Kaku Gothic ProN', 'Noto Sans JP', sans-serif;
  background: var(--bg); color: var(--text);
  line-height: 1.85; font-size: 18px;
}

/* ─── トップナビ ─── */
.top-nav {
  background: var(--primary); color: white;
  padding: 12px 24px;
  display: flex; justify-content: space-between; align-items: center;
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.1);
}
.top-nav a { color: white; text-decoration: none; font-weight: 600; font-size: 16px; }
.top-nav a:hover { text-decoration: underline; }
.top-nav .nav-back::before { content: "← "; }
.top-nav .nav-site { font-size: 14px; opacity: 0.9; }

/* ─── ヒーロー ─── */
.hero {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-d) 100%);
  color: white; padding: 48px 24px 40px; text-align: center;
}
.hero .term-jp { font-size: 38px; font-weight: 800; margin-bottom: 4px; letter-spacing: 1px; }
.hero .term-en { font-size: 20px; opacity: 0.92; margin-bottom: 12px; font-style: italic; }
.hero .tagline { font-size: 19px; opacity: 0.95; line-height: 1.7; max-width: 760px; margin: 0 auto; }
.hero .badges { margin-top: 18px; }
.hero .badge {
  display: inline-block; background: rgba(255,255,255,0.2);
  border: 1px solid rgba(255,255,255,0.35); border-radius: 14px;
  padding: 4px 14px; font-size: 14px; margin: 3px;
}

/* ─── コンテナ ─── */
.container { max-width: 1100px; margin: 0 auto; padding: 24px 20px 60px; }

/* ─── 文脈アンカー ─── */
.context-box {
  background: #FFF3E0; border-left: 5px solid #E65100;
  border-radius: 10px; padding: 22px 28px; margin: 28px 0;
}
.context-box h2 {
  font-size: 20px; color: #BF360C; margin-bottom: 12px; border: none;
  display: flex; align-items: center; gap: 8px;
}
.context-box .example-quote {
  background: #FFFFFF; padding: 14px 18px; border-radius: 6px; margin-top: 10px;
  font-family: 'SF Mono', Consolas, monospace; font-size: 17px;
  border: 1px solid #FFCC80;
}
.context-box .example-quote .highlight { background: #FFD54F; padding: 1px 6px; border-radius: 3px; font-weight: 700; }

/* ─── セクション ─── */
.section {
  background: var(--card-bg); border-radius: 12px; padding: 32px 36px;
  margin: 24px 0; box-shadow: 0 2px 10px rgba(0,0,0,.05);
}
.section h2 {
  font-size: 26px; color: var(--primary); border-left: 5px solid var(--primary);
  padding-left: 14px; margin-bottom: 18px;
  display: flex; align-items: center; gap: 8px;
}
.section h3 { font-size: 20px; color: #333; margin: 24px 0 12px; }
.section p { margin-bottom: 14px; }
.section ul, .section ol { padding-left: 24px; margin: 8px 0 14px; }
.section li { margin: 8px 0; line-height: 1.85; }
.section strong { color: var(--primary-d); }
.section code {
  background: #ECEFF1; color: #006064; padding: 2px 8px;
  border-radius: 3px; font-family: 'SF Mono', Consolas, monospace; font-size: 16px;
}

/* ─── 30秒結論カード ─── */
.tldr {
  background: linear-gradient(135deg, #E0F7FA 0%, #B2EBF2 100%);
  border-radius: 12px; padding: 24px 28px; margin: 24px 0;
  border: 2px solid #00838F;
}
.tldr h2 {
  font-size: 22px; color: var(--primary-d); margin-bottom: 14px; border: none; padding: 0;
}
.tldr ul { padding-left: 24px; }
.tldr li { font-size: 18px; margin: 8px 0; color: #004D40; }
.tldr li strong { color: #BF360C; }

/* ─── 図 ─── */
.fig-wrap { text-align: center; margin: 28px 0 8px; }
.fig-wrap img { max-width: 100%; border-radius: 8px; box-shadow: 0 3px 14px rgba(0,0,0,.10); }
.fig-cap { font-size: 15px; color: #666; margin-top: 10px; line-height: 1.6; }

/* ─── 数式ブロック ─── */
.formula-box {
  background: #1A237E; color: #E8EAF6; border-radius: 10px;
  padding: 24px 28px; margin: 18px 0;
  font-size: 19px; line-height: 1.8; overflow-x: auto;
}
.formula-box .label { font-size: 14px; opacity: 0.7; margin-bottom: 6px; letter-spacing: 1px; }
.formula-box .katex { color: #FFE082; }
.formula-box .formula-line { padding: 8px 0; }
.formula-box .annot { color: #B0BEC5; font-size: 14px; margin-top: 8px; font-style: italic; }

/* 数式の意味 説明テーブル */
.formula-meaning {
  background: #F5F5F5; border-radius: 8px; padding: 18px 22px; margin: 14px 0;
}
.formula-meaning dl {
  display: grid; grid-template-columns: max-content 1fr;
  gap: 10px 20px;
}
.formula-meaning dt { font-weight: 700; color: var(--primary-d); padding: 4px 0; white-space: nowrap; }
.formula-meaning dd { color: #333; padding: 4px 0; margin: 0; }
.formula-meaning .katex { font-size: 1.1em; }

/* ─── 計算ステップ ─── */
.calc-step {
  border-left: 4px solid var(--primary);
  background: #F0F9FA; padding: 18px 22px; margin: 12px 0;
  border-radius: 0 8px 8px 0;
}
.calc-step .step-num {
  display: inline-block; background: var(--primary); color: white;
  font-weight: 700; font-size: 14px;
  padding: 3px 10px; border-radius: 12px; margin-right: 8px;
}
.calc-step .step-title { font-size: 18px; font-weight: 700; color: var(--primary-d); }
.calc-step .step-body { margin-top: 8px; font-size: 17px; }

/* ─── 比較表 ─── */
.compare-table {
  width: 100%; border-collapse: collapse; font-size: 17px; margin: 16px 0;
}
.compare-table th {
  background: var(--primary); color: white;
  padding: 12px 14px; text-align: left; font-size: 16px;
}
.compare-table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
.compare-table tr:nth-child(even) td { background: #FAFBFC; }
.compare-table tr:hover td { background: #E0F7FA; }

/* ─── 落とし穴（誤解） ─── */
.pitfall-card {
  background: #FFF5F5; border: 1px solid #FFCDD2; border-radius: 8px;
  padding: 18px 22px; margin: 14px 0;
}
.pitfall-card .pitfall-title {
  font-size: 18px; font-weight: 700; color: #B71C1C; margin-bottom: 10px;
}
.pitfall-card .pitfall-body { font-size: 16px; line-height: 1.85; color: #333; }
.pitfall-card .pitfall-body u { text-decoration-color: #FF9800; text-underline-offset: 3px; }

/* ─── 関連用語リンク ─── */
.related-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px; margin-top: 12px;
}
.related-card {
  background: #E0F2F1; border: 1px solid #B2DFDB;
  border-radius: 10px; padding: 14px 18px;
  text-decoration: none; color: inherit;
  transition: all 0.2s;
  display: block;
}
.related-card:hover {
  background: #B2DFDB; transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.related-card .term-name { font-size: 17px; font-weight: 700; color: var(--primary-d); margin-bottom: 4px; }
.related-card .term-desc { font-size: 14px; color: #555; line-height: 1.55; }

/* ─── 論文出現例 ─── */
.paper-mention {
  background: #F3E5F5; border-left: 4px solid #6A1B9A;
  border-radius: 8px; padding: 14px 20px; margin: 12px 0;
}
.paper-mention .paper-title {
  font-size: 16px; font-weight: 700; color: #4A148C; margin-bottom: 4px;
}
.paper-mention .paper-context { font-size: 15px; color: #555; line-height: 1.7; }
.paper-mention a { color: #4A148C; font-weight: 600; }

/* ─── レーンガイド（記事内ナビ） ─── */
.lane {
  display: flex; gap: 8px; flex-wrap: wrap; margin: 18px 0;
}
.lane .lane-step {
  background: #E0F2F1; color: var(--primary-d);
  padding: 7px 14px; border-radius: 18px;
  font-size: 14px; font-weight: 600;
  text-decoration: none;
}
.lane .lane-step:hover { background: var(--primary); color: white; }

/* ─── フッター ─── */
footer {
  text-align: center; padding: 36px 16px; font-size: 15px; color: #888;
}

/* ─── 印刷対応 ─── */
@media print {
  body { background: white; font-size: 14px; }
  .top-nav { display: none !important; }
  .container { max-width: 100%; padding: 0; }
  .section { box-shadow: none; border: 1px solid #ccc; page-break-inside: avoid; }
}

/* ─── レスポンシブ ─── */
@media (max-width: 768px) {
  body { font-size: 16px; }
  .hero .term-jp { font-size: 30px; }
  .hero .term-en { font-size: 17px; }
  .section { padding: 22px 20px; }
  .section h2 { font-size: 22px; }
  .formula-box { font-size: 16px; padding: 18px; }
}
