/* style.css - 学習コンテンツ用メインスタイル */

/* ========================================
   リセット・ベース
   ======================================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

/* アンカーリンクのスクロール位置調整（固定ヘッダー対応） */
:target {
    scroll-margin-top: 70px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Yu Gothic', sans-serif;
    line-height: 1.8;
    color: var(--color-text-primary);
    background-color: var(--color-bg-page);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

body.has-fixed-header {
    padding-top: 56px;
}

/* ========================================
   ヘッダ（ページレベル）
   ======================================== */
body > header {
    background-color: var(--color-header-bg);
    color: var(--color-header-text);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    box-shadow: var(--shadow-md);
}

body > header h1 {
    font-size: 1.5rem;
    margin: 0;
    padding: 0.75rem 1.5rem;
    color: var(--color-header-text) !important;
    border: none;
}

body > header p {
    font-size: 0.9rem;
    margin: 0;
    padding: 0 1.5rem 0.75rem;
    opacity: 0.9;
    color: var(--color-header-text) !important;
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    height: 56px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.4rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo a {
    color: inherit;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: opacity 0.3s;
}

.logo a:hover {
    opacity: 0.8;
}

.logo i {
    font-size: 1.2rem;
}

nav ul {
    display: flex;
    list-style: none;
    gap: 1.5rem;
}

nav a {
    color: var(--color-header-text);
    text-decoration: none;
    font-size: 0.95rem;
    transition: opacity 0.3s;
}

nav a:hover {
    opacity: 0.8;
}

/* ========================================
   メインコンテンツ
   ======================================== */
main {
    flex: 1;
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    width: 100%;
}

/* ========================================
   記事スタイル
   ======================================== */
article {
    background: var(--color-bg-base);
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    padding: 2.5rem;
    margin-bottom: 2rem;
}

article h1 {
    font-size: 2rem;
    color: var(--color-text-primary);
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 3px solid var(--color-primary);
}

article h2 {
    font-size: 1.5rem;
    color: var(--color-text-primary);
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    padding-left: 0.75rem;
    border-left: 4px solid var(--color-primary);
}

article h3 {
    font-size: 1.25rem;
    color: var(--color-text-secondary);
    margin-top: 2rem;
    margin-bottom: 0.75rem;
}

article h4 {
    font-size: 1.15rem;
    color: var(--color-text-secondary);
    margin-top: 1.75rem;
    margin-bottom: 0.6rem;
}

article h5 {
    font-size: 1.1rem;
    color: var(--color-text-secondary);
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
}

article h6 {
    font-size: 1.05rem;
    color: var(--color-text-secondary);
    margin-top: 1.25rem;
    margin-bottom: 0.4rem;
}

article p {
    margin-bottom: 1.25rem;
    text-align: justify;
}

article ul, article ol {
    margin-left: 1.5rem;
    margin-bottom: 1.25rem;
}

article li {
    margin-bottom: 0.5rem;
}

article a {
    color: var(--color-link);
    text-decoration: none;
    transition: color 0.2s;
}

article a:hover {
    color: var(--color-link-hover);
    text-decoration: underline;
}

/* ========================================
   数式ブロック
   ======================================== */
.math-block {
    background: var(--color-math-bg);
    border-radius: 8px;
    padding: 1.5rem;
    margin: 1.5rem 0;
    overflow-x: auto;
    overflow-y: hidden;
}

/* MathJax調整 */
.MathJax_Display {
    overflow-x: auto;
    overflow-y: hidden;
}

/* ========================================
   コードブロック
   ======================================== */
pre {
    background: var(--color-code-bg);
    color: var(--color-code-text);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    margin: 1.25rem 0;
    overflow-x: auto;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
}

code {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    background: var(--color-bg-subtle);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-size: 0.9em;
}

pre code {
    background: none;
    padding: 0;
}

/* ========================================
   カードグリッド（トップページ用）
   ======================================== */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.card {
    background: var(--color-card-bg);
    border: 1px solid var(--color-card-border);
    border-radius: 12px;
    padding: 1.5rem;
    transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
    text-decoration: none;
    color: inherit;
    display: block;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    background: var(--color-card-hover);
}

.card h3 {
    font-size: 1.1rem;
    color: var(--color-text-primary);
    margin-bottom: 0.5rem;
}

.card p {
    font-size: 0.9rem;
    color: var(--color-text-secondary);
    margin-bottom: 0;
}

.card .tag {
    display: inline-block;
    background: var(--color-info);
    color: var(--color-info-dark);
    font-size: 0.75rem;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    margin-top: 0.75rem;
}

/* ========================================
   ヒーローセクション
   ======================================== */
.hero {
    background: var(--gradient-brand);
    color: var(--color-text-white);
    padding: 3rem 1.5rem;
    text-align: center;
    margin-bottom: 2rem;
}

.hero h1 {
    font-size: 2.2rem;
    margin-bottom: 0.75rem;
    border: none;
    padding: 0;
}

.hero p {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-bottom: 0;
}

/* ========================================
   パンくずリスト
   ======================================== */
.breadcrumb {
    padding: 1rem 0;
    font-size: 0.9rem;
}

.breadcrumb ol {
    display: flex;
    flex-wrap: wrap;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 0.5rem;
}

.breadcrumb li {
    display: flex;
    align-items: center;
    margin: 0;
}

.breadcrumb li:not(:last-child)::after {
    content: '>';
    margin-left: 0.5rem;
    color: var(--color-text-muted);
}

.breadcrumb a {
    color: var(--color-link);
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

/* ========================================
   フッタ
   ======================================== */
footer {
    background-color: var(--color-footer-bg);
    color: var(--color-footer-text);
    padding: 2rem 1rem;
    margin-top: auto;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.footer-links {
    display: flex;
    gap: 1.5rem;
}

.footer-links a {
    color: var(--color-footer-text);
    text-decoration: none;
    font-size: 0.9rem;
    opacity: 0.9;
    transition: opacity 0.3s;
}

.footer-links a:hover {
    opacity: 1;
}

.copyright {
    font-size: 0.85rem;
    opacity: 0.8;
}

/* ========================================
   目次（Table of Contents）
   ======================================== */
.toc {
    background: var(--color-bg-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 1.25rem 1.5rem;
    margin: 1.5rem 0;
}

.toc h4 {
    font-size: 1rem;
    margin-bottom: 0.75rem;
    color: var(--color-text-secondary);
}

.toc ul {
    display: block;
    list-style: disc;
    margin: 0;
    padding-left: 1.25rem;
}

.toc li {
    margin-bottom: 0.4rem;
}

.toc a {
    color: var(--color-link);
    text-decoration: none;
    font-size: 0.95rem;
}

.toc a:hover {
    text-decoration: underline;
}

/* ========================================
   補足ボックス
   ======================================== */
.note {
    background: linear-gradient(135deg, var(--color-info) 0%, #e8f4fc 100%);
    border-left: 4px solid var(--color-info-dark);
    border-radius: 0 8px 8px 0;
    padding: 1rem 1.25rem;
    margin: 1.5rem 0;
}

.note-title {
    font-weight: bold;
    color: var(--color-info-dark);
    margin-bottom: 0.5rem;
}

.warning {
    background: linear-gradient(135deg, var(--color-warning) 0%, #fcf4e8 100%);
    border-left: 4px solid var(--color-warning-dark);
    border-radius: 0 8px 8px 0;
    padding: 1rem 1.25rem;
    margin: 1.5rem 0;
}

.warning-title {
    font-weight: bold;
    color: var(--color-warning-dark);
    margin-bottom: 0.5rem;
}

/* ========================================
   テーブル
   ======================================== */
.data-table {
    border-collapse: collapse;
    width: 100%;
    margin: 1rem 0;
    font-size: 0.95rem;
}

/* 数式を含む幅広の表（列幅固定） */
.data-table.formula-table-wide {
    table-layout: fixed;
}

.data-table.formula-table-wide td {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.data-table th,
.data-table td {
    border: 1px solid var(--color-border);
    padding: 0.75rem 1rem;
    text-align: left;
}

.data-table th {
    background: var(--color-bg-subtle);
    font-weight: 600;
    color: var(--color-text-primary);
}

/* レイアウト別の色分け */
.data-table tr.layout-numerator {
    background: #fff0f3;  /* 薄いピンク - 分子レイアウト */
}

.data-table tr.layout-denominator {
    background: #f0f8ff;  /* 薄い水色 - 分母レイアウト */
}

.data-table tr.layout-mixed {
    background: #f5f5f5;  /* 薄い灰色 - 混在・その他 */
}

.data-table tbody tr:hover {
    filter: brightness(0.95);
}

/* ダークモード対応 */
@media (prefers-color-scheme: dark) {
    .data-table tr.layout-numerator {
        background: #3d2a2e;  /* 暗いピンク - 分子レイアウト */
    }

    .data-table tr.layout-denominator {
        background: #2a3340;  /* 暗い水色 - 分母レイアウト */
    }

    .data-table tr.layout-mixed {
        background: #2d2d2d;  /* 暗い灰色 - 混在・その他 */
    }

    .data-table tbody tr:hover {
        filter: brightness(1.1);
    }
}

[data-theme="dark"] .data-table tr.layout-numerator {
    background: #3d2a2e;
}

[data-theme="dark"] .data-table tr.layout-denominator {
    background: #2a3340;
}

[data-theme="dark"] .data-table tr.layout-mixed {
    background: #2d2d2d;
}

[data-theme="dark"] .data-table tbody tr:hover {
    filter: brightness(1.1);
}

/* レスポンシブテーブル */
@media (max-width: 768px) {
    .data-table {
        font-size: 0.85rem;
    }

    .data-table th,
    .data-table td {
        padding: 0.5rem 0.75rem;
    }
}

/* ========================================
   参考文献
   ======================================== */
.references {
    background: var(--color-bg-subtle);
    border-radius: 8px;
    padding: 1.25rem 1.5rem;
    margin-top: 2rem;
}

.references h3 {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
    margin-top: 0;
}

.references ul {
    margin: 0;
    padding-left: 1.25rem;
}

.references li {
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

/* ========================================
   レスポンシブ
   ======================================== */
@media (max-width: 768px) {
    body.has-fixed-header {
        padding-top: 52px;
    }

    .header-container {
        height: 52px;
    }

    .logo {
        font-size: 1.2rem;
    }

    nav ul {
        gap: 1rem;
    }

    nav a {
        font-size: 0.85rem;
    }

    main {
        padding: 1rem;
    }

    article {
        padding: 1.5rem;
        border-radius: 8px;
    }

    article h1 {
        font-size: 1.5rem;
    }

    article h2 {
        font-size: 1.25rem;
    }

    .hero {
        padding: 2rem 1rem;
    }

    .hero h1 {
        font-size: 1.6rem;
    }

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

    .footer-container {
        flex-direction: column;
        text-align: center;
    }
}

/* ========================================
   印刷スタイル
   ======================================== */
@media print {
    header, footer, .toc {
        display: none;
    }

    body {
        background: white;
        color: black;
        padding-top: 0 !important;
        font-size: 20pt;
        line-height: 1.7;
    }

    body.has-fixed-header {
        padding-top: 0 !important;
    }

    main {
        max-width: 100%;
        padding: 0;
    }

    article {
        box-shadow: none;
        padding: 8mm 12mm;
        margin: 0;
    }

    article h1 {
        font-size: 32pt;
        margin-bottom: 1rem;
    }

    article h2 {
        font-size: 26pt;
        margin-top: 1.5rem;
    }

    article h3 {
        font-size: 22pt;
    }

    article p {
        font-size: 20pt;
        margin-bottom: 0.8rem;
    }

    a {
        color: black;
        text-decoration: underline;
    }

    /* 数式ブロック：スクロールバーを無効化し、折り返しを許可 */
    .math-block {
        overflow: visible !important;
        overflow-x: visible !important;
        page-break-inside: avoid;
        background: none;
        padding: 0.8rem 0;
        margin: 0.8rem 0;
    }

    /* MathJax の印刷対応 */
    .MathJax_Display {
        overflow: visible !important;
        overflow-x: visible !important;
    }

    .MathJax {
        font-size: 150% !important;
    }

    /* 長い数式は縮小して収める */
    mjx-container {
        overflow: visible !important;
        max-width: 100% !important;
    }

    /* コードブロック */
    pre {
        overflow: visible !important;
        white-space: pre-wrap;
        word-wrap: break-word;
        background: #f5f5f5;
        color: black;
        page-break-inside: avoid;
    }

    /* セクションの改ページ制御 */
    h2, h3 {
        page-break-after: avoid;
    }

    p, .math-block {
        orphans: 3;
        widows: 3;
    }

    /* 参考文献は改ページを避ける */
    .references {
        page-break-inside: avoid;
    }
}

/* ========================================
   ページヘッダー内のパンくずリスト等
   ======================================== */
body > header .header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.5rem 1rem;
}

body > header .breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    padding: 0;
    margin: 0;
}

body > header .breadcrumb a {
    color: var(--color-header-text);
    text-decoration: none;
    opacity: 0.9;
    transition: opacity 0.2s;
}

body > header .breadcrumb a:hover {
    opacity: 1;
}

body > header .breadcrumb .separator {
    opacity: 0.6;
}

body > header .breadcrumb .current {
    opacity: 0.8;
}

/* ========================================
   記事ヘッダー
   ======================================== */
.article-header {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid var(--color-primary);
}

.article-header h1 {
    font-size: 2rem;
    color: var(--color-primary);
    margin-bottom: 0.5rem;
    padding: 0;
    border: none;
}

.article-header .subtitle {
    font-size: 1.1rem;
    color: var(--color-text-secondary);
    margin: 0;
}

/* ========================================
   チャプターリスト（目次ページ用）
   ======================================== */
.chapter-list {
    display: grid;
    gap: 1rem;
    margin: 1.5rem 0;
}

.chapter-item {
    background: var(--color-bg-surface);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    transition: all 0.2s ease;
    overflow: hidden;
}

.chapter-item:hover {
    border-color: var(--color-primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.chapter-item a {
    display: block;
    padding: 1.25rem 1.5rem;
    text-decoration: none;
    color: inherit;
}

.chapter-item h3 {
    font-size: 1.1rem;
    color: var(--color-primary);
    margin: 0 0 0.5rem 0;
}

.chapter-item p {
    font-size: 0.9rem;
    color: var(--color-text-secondary);
    margin: 0;
    line-height: 1.5;
}

/* ========================================
   前提知識ボックス
   ======================================== */
.prerequisites {
    background: linear-gradient(135deg, #f0f8ff 0%, #e6f3ff 100%);
    border-left: 4px solid var(--color-primary);
    border-radius: 0 8px 8px 0;
    padding: 1rem 1.5rem;
    margin: 1.5rem 0;
}

.prerequisites h3 {
    font-size: 1rem;
    color: var(--color-primary);
    margin: 0 0 0.75rem 0;
}

.prerequisites ul {
    margin: 0;
    padding-left: 1.25rem;
}

.prerequisites li {
    margin-bottom: 0.25rem;
    color: var(--color-text-secondary);
}

/* ========================================
   チャプターナビゲーション
   ======================================== */
.chapter-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--color-border);
}

.chapter-nav a {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: var(--color-bg-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    color: var(--color-primary);
    text-decoration: none;
    font-size: 0.95rem;
    transition: all 0.2s;
}

.chapter-nav a:hover {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

.chapter-nav .prev {
    margin-right: auto;
}

.chapter-nav .next {
    margin-left: auto;
}

/* ========================================
   セクションナビゲーション（既存ページ用）
   ======================================== */
.section-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--color-border);
    flex-wrap: wrap;
    gap: 1rem;
}

.section-nav a {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: var(--color-bg-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    color: var(--color-primary);
    text-decoration: none;
    font-size: 0.95rem;
    transition: all 0.2s;
}

.section-nav a:hover {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

/* ========================================
   学習コンテンツボックス類
   ======================================== */
.definition-box,
.theorem-box,
.example-box,
.proof-box,
.solution,
.summary-box,
.goal-box {
    border-radius: 8px;
    padding: 1.25rem 1.5rem;
    margin: 1.5rem 0;
}

.definition-box {
    background: linear-gradient(135deg, #f0f4ff 0%, #e8eeff 100%);
    border-left: 4px solid #4f46e5;
}

.definition-box h3 {
    color: #4f46e5;
    font-size: 1rem;
    margin: 0 0 0.75rem 0;
}

.theorem-box {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-left: 4px solid #d97706;
}

.theorem-box h3 {
    color: #b45309;
    font-size: 1rem;
    margin: 0 0 0.75rem 0;
}

.example-box {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    border-left: 4px solid #059669;
}

.example-box h3 {
    color: #047857;
    font-size: 1rem;
    margin: 0 0 0.75rem 0;
}

.proof-box {
    background: linear-gradient(135deg, #fdf4ff 0%, #fae8ff 100%);
    border-left: 4px solid #a855f7;
}

.proof-box h3 {
    color: #7c3aed;
    font-size: 1rem;
    margin: 0 0 0.75rem 0;
}

.solution {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-left: 4px solid #64748b;
    font-size: 0.95rem;
}

.solution .answer {
    font-weight: bold;
    color: var(--color-primary);
    margin-top: 1rem;
}

.summary-box {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border: 2px solid #3b82f6;
}

.summary-box ul {
    margin: 0;
    padding-left: 1.25rem;
}

.summary-box li {
    margin-bottom: 0.5rem;
}

.goal-box {
    background: linear-gradient(135deg, #fefce8 0%, #fef9c3 100%);
    border: 2px solid #eab308;
}

.goal-box h3 {
    color: #a16207;
    font-size: 1rem;
    margin: 0 0 0.75rem 0;
}

.goal-box ul {
    margin: 0;
    padding-left: 1.25rem;
}

/* ========================================
   目次コンテナ（index用）
   ======================================== */
.toc-container {
    margin: 1rem 0;
}

.toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.toc-list li {
    margin-bottom: 0.75rem;
}

.toc-list a {
    display: block;
    padding: 1rem 1.25rem;
    background: var(--color-bg-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.2s;
}

.toc-list a:hover {
    border-color: var(--color-primary);
    box-shadow: var(--shadow-sm);
    transform: translateX(4px);
}

.toc-list .chapter-num {
    display: inline-block;
    color: var(--color-primary);
    font-weight: bold;
    margin-right: 0.5rem;
}

.toc-list .chapter-title {
    color: var(--color-text-primary);
    font-weight: 600;
}

.toc-list .chapter-desc {
    font-size: 0.85rem;
    color: var(--color-text-secondary);
    margin: 0.25rem 0 0 0;
}

/* ========================================
   ダークモード対応（学習コンテンツ）
   ======================================== */
@media (prefers-color-scheme: dark) {
    .definition-box {
        background: linear-gradient(135deg, #1e1b4b 0%, #312e81 100%);
    }

    .theorem-box {
        background: linear-gradient(135deg, #451a03 0%, #78350f 100%);
    }

    .example-box {
        background: linear-gradient(135deg, #022c22 0%, #064e3b 100%);
    }

    .proof-box {
        background: linear-gradient(135deg, #2e1065 0%, #4c1d95 100%);
    }

    .solution {
        background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    }

    .prerequisites {
        background: linear-gradient(135deg, #0c4a6e 0%, #075985 100%);
    }
}

/* ========================================
   証明カード（proofs.html用）
   ======================================== */
.proof-card {
    background: var(--color-card-bg);
    border: 1px solid var(--color-card-border);
    border-radius: 12px;
    padding: 1.5rem 2rem;
    margin: 1.5rem 0;
    box-shadow: var(--shadow-sm);
}

.proof-card-header {
    border-bottom: 2px solid var(--color-primary);
    padding-bottom: 1rem;
    margin-bottom: 1rem;
}

.proof-card-header h4 {
    color: var(--color-primary);
    margin: 0 0 0.5rem 0;
    font-size: 1.15rem;
}

.proof-card-formula {
    background: linear-gradient(135deg, #f8f9ff 0%, #eef1ff 100%);
    border-left: 4px solid var(--color-primary);
    border-radius: 0 8px 8px 0;
    padding: 1rem 1.5rem;
    margin: 1rem 0;
}

.proof-card-conditions {
    background: linear-gradient(135deg, #fff8e6 0%, #fff3d4 100%);
    border-left: 4px solid #f0a500;
    border-radius: 0 8px 8px 0;
    padding: 0.8rem 1.2rem;
    margin: 1rem 0;
    font-size: 0.95rem;
}

.proof-card-conditions strong {
    color: #c08000;
}

.proof-card-body {
    margin-top: 1rem;
}

.proof-card-body h5 {
    color: var(--color-text-secondary);
    font-size: 1rem;
    margin: 1.5rem 0 0.5rem 0;
}

.proof-card-notes {
    background: linear-gradient(135deg, #f0fff0 0%, #e0f8e0 100%);
    border-left: 4px solid #2e8b57;
    border-radius: 0 8px 8px 0;
    padding: 0.8rem 1.2rem;
    margin-top: 1.5rem;
    font-size: 0.95rem;
}

.proof-card-notes strong {
    color: #1e6b47;
}

.proof-card-terms {
    background: linear-gradient(135deg, #f5f0ff 0%, #ebe0ff 100%);
    border-left: 4px solid #7c3aed;
    border-radius: 0 8px 8px 0;
    padding: 0.8rem 1.2rem;
    margin-top: 1.5rem;
    font-size: 0.95rem;
}

.proof-card-terms strong {
    color: #5b21b6;
}

/* 印刷時のカードスタイル */
@media print {
    .proof-card {
        box-shadow: none;
        border: 1px solid #ccc;
        page-break-inside: avoid;
    }
}

/* ========================================
   レベルカード（トップページ用）
   ======================================== */
.level-card {
    position: relative;
    background: var(--color-bg-surface);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    transition: all 0.2s ease;
    cursor: pointer;
}

.level-card:hover {
    border-color: var(--color-primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.level-card h3 {
    font-size: 1.3rem;
    margin: 0 0 0.5rem 0;
}

.level-card h3 a {
    color: var(--color-primary);
    text-decoration: none;
}

/* ::after でカード全体をクリック可能にする */
.level-card h3 a::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2;
}

.level-card h3 a:hover {
    text-decoration: underline;
}

.level-card h3 i {
    margin-right: 0.5rem;
}

.level-subtitle {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin-bottom: 0.75rem;
}

.topic-list {
    columns: 2;
    column-gap: 2rem;
    margin: 1rem 0;
    padding-left: 1.25rem;
}

.topic-list li {
    margin-bottom: 0.25rem;
    font-size: 0.9rem;
}

.chapter-count {
    font-size: 0.85rem;
    color: var(--color-text-secondary);
    margin: 0;
}

/* ========================================
   ロードマップ
   ======================================== */
.roadmap {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 1.5rem 0;
    padding: 1.5rem;
    background: var(--color-bg-surface);
    border-radius: 12px;
}

.roadmap-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--color-bg-base);
    border: 1px solid var(--color-border);
    border-radius: 8px;
}

.roadmap-icon {
    font-size: 1.5rem;
    color: var(--color-primary);
}

.roadmap-content h4 {
    font-size: 0.95rem;
    margin: 0;
    color: var(--color-text-primary);
}

.roadmap-content p {
    font-size: 0.8rem;
    margin: 0;
    color: var(--color-text-secondary);
}

.roadmap-arrow {
    font-size: 1.5rem;
    color: var(--color-text-muted);
}

/* ========================================
   公式ボックス
   ======================================== */
.formula-box {
    background: var(--color-bg-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 1.25rem 1.5rem;
    margin: 1rem 0;
}

.formula-box h3 {
    font-size: 1rem;
    color: var(--color-primary);
    margin: 0 0 0.75rem 0;
    padding: 0;
    border: none;
}

.formula-box ul {
    margin: 0;
    padding-left: 1.25rem;
}

.formula-box li {
    margin-bottom: 0.5rem;
}

/* ========================================
   レスポンシブ（レベルカード・ロードマップ）
   ======================================== */
@media (max-width: 768px) {
    .topic-list {
        columns: 1;
    }

    .roadmap {
        flex-direction: column;
    }

    .roadmap-arrow {
        transform: rotate(90deg);
    }
}

/* ========================================
   印刷用スタイル
   ======================================== */
@media print {
    /* 基本設定 - 本文 11pt */
    body {
        font-size: 11pt !important;
        line-height: 1.4 !important;
        padding: 0 !important;
        margin: 0 !important;
        background: white !important;
        color: black !important;
    }

    body.has-fixed-header {
        padding-top: 0 !important;
    }

    /* ヘッダー・ナビゲーション・広告非表示（フッターは印刷） */
    body > header,
    nav.breadcrumb,
    .toc,
    .ad-container,
    .chapter-nav,
    ins.adsbygoogle,
    [class*="adsbygoogle"] {
        display: none !important;
    }

    /* フッター（印刷時も表示 - 薄い背景に黒字） */
    body > footer {
        display: block !important;
        margin-top: 20pt !important;
        padding: 8pt !important;
        border-top: 0.5pt solid #ccc !important;
        font-size: 6pt !important;
        text-align: center !important;
        color: #000 !important;
        background: #f5f5f5 !important;
    }

    body > footer .footer-container {
        display: block !important;
        background: transparent !important;
    }

    body > footer .footer-links {
        display: none !important;
    }

    body > footer .copyright {
        display: block !important;
        margin: 0 !important;
        padding: 0 !important;
        color: #000 !important;
    }

    /* メインコンテンツ */
    main {
        max-width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    article {
        max-width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
        box-shadow: none !important;
        border: none !important;
    }

    /* 見出し */
    h1 {
        font-size: 18pt !important;
        margin-bottom: 12pt !important;
    }

    h2 {
        font-size: 14pt !important;
        margin-top: 18pt !important;
        margin-bottom: 6pt !important;
    }

    h3 {
        font-size: 12pt !important;
    }

    /* 本文 11pt */
    p {
        font-size: 11pt !important;
        margin-bottom: 5pt !important;
        orphans: 3;
        widows: 3;
    }

    li {
        font-size: 11pt !important;
    }

    /* 数式共通 */
    .math-block,
    .MathJax,
    .MathJax_Display,
    mjx-container {
        overflow: visible !important;
        max-width: 100% !important;
    }

    /* ディスプレイ数式（ブロック数式）- scaleなしで式番号を右端に */
    .math-block mjx-container[jax="SVG"],
    mjx-container[jax="SVG"][display="true"] {
        width: 100% !important;
        font-size: 0.81em !important;
    }

    /* インライン数式 - 小さめに */
    p mjx-container[jax="SVG"],
    li mjx-container[jax="SVG"] {
        font-size: 0.6em !important;
    }

    /* 改ページ制御は削除（空白が発生するため） */

    /* リンクのURL表示抑制 */
    a[href]::after {
        content: none !important;
    }

    a {
        color: black;
        text-decoration: none;
    }

    /* 背景色を白に */
    .note,
    .warning,
    .tip-box,
    .formula-box,
    code,
    pre {
        background: #f5f5f5 !important;
        border: 1px solid #ccc !important;
    }

    /* 余白調整 */
    @page {
        margin: 10mm;
    }
}

/* ========================================
   無効化リンク（未公開ページ用）
   ======================================== */
.disabled-link {
    color: #999 !important;
    pointer-events: none;
    cursor: default;
    text-decoration: none;
}

.disabled-link:hover {
    color: #999 !important;
}

.toc-list .disabled-link .chapter-title,
.toc-list .disabled-link .chapter-num {
    color: #999 !important;
}

/* 無効化カード（未公開コンテンツ用） */
.level-card.disabled,
.card.disabled {
    opacity: 0.5;
    pointer-events: none;
    cursor: default;
    filter: grayscale(30%);
}

.level-card.disabled:hover,
.card.disabled:hover {
    transform: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
