/* ==========================================================================
   PlayPoint Lab. - Premium Common Article Stylesheet (ABC Integrated)
   ========================================================================== */

/* --- CSS Variables & Design Tokens --- */
:root {
    --bg: #f8f9fa;
    --card: #ffffff;
    --text: #2d3748;
    --muted: #718096;
    --accent: #16a34a; /* Emerald Accent */
    --accent-gradient: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    --accent-light: #f0fdf4;
    --gold: #f59e0b;
    --gold-gradient: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    --border-color: #edf2f7;
    --radius: 24px;
    --radius-sm: 12px;
    --max-width: 820px;
    
    /* Glassmorphism Defaults */
    --glass-bg: rgba(255, 255, 255, 0.75);
    --glass-border: rgba(255, 255, 255, 0.6);
    --glass-shadow: 0 10px 40px rgba(0, 0, 0, 0.03);
}

/* --- Dark Theme Tokens --- */
body[data-theme="dark"] {
    --bg: #0b0f17;
    --card: #161b22;
    --text: #c9d1d9;
    --muted: #8b949e;
    --accent: #4ade80;
    --accent-gradient: linear-gradient(135deg, #4ade80 0%, #22c55e 100%);
    --accent-light: rgba(34, 197, 94, 0.08);
    --gold: #fbbf24;
    --gold-gradient: linear-gradient(135deg, #fef08a 0%, #f59e0b 100%);
    --border-color: #21262d;
    
    /* Glassmorphism Dark */
    --glass-bg: rgba(22, 27, 34, 0.8);
    --glass-border: rgba(240, 246, 252, 0.06);
    --glass-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

/* --- Base Reset & Elements --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Noto Sans JP', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    min-height: 100vh;
    color: var(--text);
    line-height: 1.9;
    display: flex;
    flex-direction: column;
    transition: background-color 0.3s, color 0.3s;
    -webkit-font-smoothing: antialiased;
}

/* --- Premium Layout (Glassmorphism Main Card) --- */
.main-card {
    max-width: var(--max-width);
    margin: 2.5rem auto;
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--glass-shadow);
    border: 1px solid var(--border-color);
    overflow: hidden;
    width: 92%;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

@media (max-width: 600px) {
    .main-card {
        width: 100%;
        margin: 1rem auto;
        border-radius: 18px;
        border-left: none;
        border-right: none;
    }
}

/* --- Common Header --- */
.header {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    padding: 1.1rem 1.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--glass-border);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.02);
}

.header-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    color: var(--text);
    text-decoration: none;
    font-weight: 800;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    letter-spacing: -0.02em;
}

.nav a {
    color: var(--muted);
    text-decoration: none;
    margin-left: 1.2rem;
    font-size: 0.92rem;
    font-weight: 600;
    transition: color 0.2s, opacity 0.2s;
}

.nav a:hover {
    color: var(--accent);
}

/* --- Breadcrumb Navigation --- */
.breadcrumb {
    max-width: var(--max-width);
    margin: 1.5rem auto 0;
    padding: 0 1.5rem;
    font-size: 0.85rem;
    color: var(--muted);
}
@media (max-width: 600px) {
    .breadcrumb {
        padding: 0 1rem;
        margin-top: 1rem;
    }
}
.breadcrumb a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}
.breadcrumb a:hover {
    text-decoration: underline;
}
.breadcrumb span.separator {
    margin: 0 0.5rem;
    color: var(--border-color);
}

/* --- Common Footer --- */
.site-footer {
    text-align: center;
    padding: 2.5rem;
    color: var(--muted);
    font-size: 0.85rem;
    background: var(--card);
    border-top: 1px solid var(--border-color);
    margin-top: auto;
}

.site-footer a {
    color: var(--muted);
    text-decoration: none;
    transition: color 0.2s;
}

.site-footer a:hover {
    color: var(--accent);
}

/* --- Article Hero Section (Visual Rich) --- */
.hero {
    background: var(--hero);
    padding: 3.5rem 2.5rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, rgba(0,0,0,0) 40%, rgba(0,0,0,0.15) 100%);
    pointer-events: none;
}

.hero-badge {
    display: inline-block;
    background: rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #fff;
    padding: 0.45rem 1.2rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 1.2rem;
    border: 1px solid rgba(255, 255, 255, 0.25);
    letter-spacing: 0.02em;
}

.hero h1 {
    color: #fff;
    font-size: 1.8rem;
    font-weight: 800;
    line-height: 1.45;
    text-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    max-width: 740px;
    margin: 0 auto;
}

.hero-meta {
    margin-top: 1.2rem;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9rem;
    font-weight: 500;
}

@media (max-width: 600px) {
    .hero {
        padding: 2.5rem 1.5rem;
    }
    .hero h1 {
        font-size: 1.4rem;
    }
}

/* --- Breadcrumb (Glass Style) --- */
.article-breadcrumb {
    max-width: var(--max-width);
    margin: 1.2rem auto 0;
    padding: 0 1.5rem;
    color: var(--muted);
    font-size: 0.88rem;
    font-weight: 500;
}

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

.article-breadcrumb a:hover {
    color: var(--accent);
}

.article-breadcrumb-separator {
    margin: 0 0.5rem;
    color: var(--muted);
    opacity: 0.4;
}

/* --- Reading Progress Bar --- */
.progress-container {
    position: fixed;
    top: 59px; /* Sync with header height */
    left: 0;
    width: 100%;
    height: 4px;
    background: rgba(0,0,0,0.03);
    z-index: 101;
}

.progress-bar {
    height: 100%;
    background: var(--gold-gradient);
    width: 0%;
    border-radius: 0 2px 2px 0;
    transition: width 0.1s ease-out;
}

/* --- Article Content Structure --- */
.content {
    padding: 2.5rem;
}

@media (max-width: 600px) {
    .content {
        padding: 1.6rem;
    }
}

.intro {
    font-size: 1.08rem;
    text-align: left;
    padding: 1.6rem;
    background: var(--accent-light);
    border-radius: 18px;
    margin-bottom: 2.5rem;
    border-left: 4px solid var(--accent);
    color: var(--text);
    box-shadow: 0 4px 15px rgba(0,0,0,0.01);
}

.section {
    margin-bottom: 2.8rem;
}

.section h2 {
    font-size: 1.32rem;
    color: var(--text);
    margin-bottom: 1.2rem;
    padding-bottom: 0.6rem;
    border-bottom: 3px solid var(--accent-light);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section h2::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 1.2em;
    background: var(--accent-gradient);
    border-radius: 99px;
}

.section p {
    margin-bottom: 1.2rem;
    font-size: 1rem;
    color: var(--text);
    text-justify: inter-word;
}

.section ul, .section ol {
    padding-left: 1.6rem;
    margin-bottom: 1.5rem;
}

.section li {
    margin-bottom: 0.6rem;
    font-size: 1rem;
}

code {
    background: var(--accent-light);
    color: var(--accent);
    padding: 0.15rem 0.45rem;
    border-radius: 6px;
    font-size: 0.9em;
    font-family: Consolas, Monaco, 'Andale Mono', monospace;
    font-weight: 600;
}

/* --- Callout Box UI (Premium decoration) --- */
.callout {
    padding: 1.4rem 1.6rem;
    margin: 2rem 0;
    border-radius: 18px;
    border-left: 5px solid;
    line-height: 1.8;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.01);
}

.callout::after {
    position: absolute;
    top: 1rem;
    right: 1.2rem;
    font-size: 2rem;
    opacity: 0.08;
    font-weight: 800;
}

.callout-tip {
    background: rgba(34, 197, 94, 0.04);
    border-color: #22c55e;
}
.callout-tip::after {
    content: '💡';
}
body[data-theme="dark"] .callout-tip {
    background: rgba(74, 222, 128, 0.05);
    border-color: #4ade80;
}

.callout-warning {
    background: rgba(239, 68, 68, 0.04);
    border-color: #ef4444;
}
.callout-warning::after {
    content: '⚠️';
}
body[data-theme="dark"] .callout-warning {
    background: rgba(248, 113, 113, 0.05);
    border-color: #f87171;
}

.callout-info {
    background: rgba(59, 130, 246, 0.04);
    border-color: #3b82f6;
}
.callout-info::after {
    content: '📋';
}
body[data-theme="dark"] .callout-info {
    background: rgba(96, 165, 250, 0.05);
    border-color: #60a5fa;
}

.callout-summary {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
    border-color: #667eea;
}
.callout-summary::after {
    content: '🎯';
}
body[data-theme="dark"] .callout-summary {
    background: linear-gradient(135deg, rgba(88, 166, 255, 0.08) 0%, rgba(186, 104, 200, 0.08) 100%);
    border-color: #58a6ff;
}

/* --- Table of Contents (TOC) Glass Style --- */
.toc-box {
    background: var(--glass-bg);
    border: 2px solid var(--border-color);
    border-radius: 20px;
    margin: 2.2rem 0;
    overflow: hidden;
    box-shadow: var(--glass-shadow);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: all 0.3s ease;
}

.toc-box summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.2rem 1.4rem;
    user-select: none;
}

.toc-box summary::-webkit-details-marker {
    display: none;
}

.toc-title {
    font-weight: 800;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 1.05rem;
}

.toc-summary-note {
    font-size: 0.82rem;
    color: var(--muted);
    font-weight: 500;
}

.toc-summary-meta {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    flex-shrink: 0;
}

.toc-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.3rem 0.8rem;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: var(--card);
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 700;
}

.toc-icon {
    color: var(--muted);
    font-weight: bold;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.toc-box[open] .toc-icon {
    transform: rotate(180deg);
}

.toc-box[open] summary {
    border-bottom: 1px solid var(--border-color);
}

.toc-body {
    padding: 1.2rem;
}

.toc-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-bottom: 1.2rem;
}

.toc-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.55rem 1.1rem;
    border-radius: 999px;
    background: var(--card);
    border: 1px solid var(--border-color);
    color: var(--text);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 700;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.02);
}

.toc-action:hover {
    color: var(--accent);
    border-color: var(--accent);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

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

.toc-item {
    margin-bottom: 0.6rem;
    line-height: 1.6;
}

.toc-item a {
    text-decoration: none;
    color: var(--text);
    opacity: 0.85;
    transition: all 0.2s ease;
    font-size: 0.96rem;
    display: block;
    padding: 0.25rem 0.5rem;
    border-radius: 8px;
}

.toc-item a:hover {
    color: var(--accent);
    background: var(--accent-light);
    opacity: 1;
    padding-left: 0.75rem;
}

.toc-h3 {
    padding-left: 1.8rem;
    font-size: 0.9rem;
}

.toc-h3::before {
    content: "└";
    margin-right: 0.5rem;
    color: var(--muted);
    opacity: 0.4;
}

@media (max-width: 600px) {
    .toc-box summary {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    .toc-summary-meta {
        width: 100%;
        justify-content: space-between;
    }
}

/* --- Floating Bottom Sheet / Mobile TOC Popup --- */
.floating-toc-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--accent-gradient);
    color: #fff;
    border: none;
    border-radius: 999px;
    padding: 0.8rem 1.4rem;
    font-weight: 800;
    font-size: 0.95rem;
    box-shadow: 0 8px 30px rgba(22, 163, 74, 0.35);
    z-index: 999;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    user-select: none;
}
.floating-toc-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 35px rgba(22, 163, 74, 0.45);
}
.floating-toc-btn:active {
    transform: translateY(0);
}

@media (min-width: 821px) {
    .floating-toc-btn {
        display: none !important;
    }
}

.mobile-toc-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.4);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s;
    backdrop-filter: blur(4px);
}

.mobile-toc-overlay.show {
    opacity: 1;
    visibility: visible;
}

.mobile-toc-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    max-height: 80%;
    background: var(--card);
    border-radius: 24px 24px 0 0;
    z-index: 1001;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 -10px 40px rgba(0,0,0,0.15);
    overflow-y: auto;
    border-top: 1px solid var(--border-color);
}

.mobile-toc-sheet.show {
    transform: translateY(0);
}

.mobile-toc-header {
    padding: 1.2rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    background: var(--card);
    z-index: 2;
}

.mobile-toc-header h3 {
    font-weight: 800;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.mobile-toc-close {
    background: var(--border-color);
    border: none;
    border-radius: 999px;
    width: 32px;
    height: 32px;
    font-weight: 700;
    cursor: pointer;
    color: var(--text);
}

.mobile-toc-body {
    padding: 1.5rem;
}

/* --- Call to Action (CTA) Box Premium --- */
.cta-box {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border-radius: var(--radius);
    padding: 2.5rem;
    text-align: center;
    color: #fff;
    margin: 2.5rem 0;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.06);
    box-shadow: 0 15px 35px rgba(15, 23, 42, 0.25);
}

.cta-box::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(34, 197, 94, 0.08) 0%, rgba(0,0,0,0) 70%);
    pointer-events: none;
}

.cta-box h3 {
    font-size: 1.4rem;
    font-weight: 800;
    margin-bottom: 0.8rem;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.cta-box p {
    opacity: 0.88;
    margin-bottom: 1.6rem;
    font-size: 0.98rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.7;
}

.cta-btn {
    display: inline-block;
    background: var(--accent-gradient);
    color: #fff;
    padding: 1.1rem 2.6rem;
    border-radius: 999px;
    text-decoration: none;
    font-weight: 800;
    font-size: 1.05rem;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 18px rgba(34, 197, 94, 0.35);
    border: 1px solid rgba(255,255,255,0.1);
}

.cta-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(34, 197, 94, 0.45);
}

.cta-btn:active {
    transform: translateY(-1px);
}

/* --- Related Links --- */
.related-links-section {
    background: var(--accent-light);
    padding: 1.8rem;
    border-radius: 20px;
    border: 1px solid var(--border-color);
}

.related-links-section h2 {
    font-size: 1.2rem;
    color: var(--text);
    border: none;
    margin-bottom: 1rem;
    padding: 0;
}

.related-links-section h2::before {
    display: none;
}

.related-links-section ul {
    padding-left: 1.2rem;
    margin-bottom: 0;
}

.related-links-section a {
    color: var(--accent);
    font-weight: 600;
    text-decoration: none;
    transition: opacity 0.2s;
}

.related-links-section a:hover {
    text-decoration: underline;
    opacity: 0.8;
}

/* --- Recommended / Related Grid (Static / JS populated) --- */
.recommended-section {
    margin-top: 3.5rem;
    border-top: 1px solid var(--border-color);
    padding-top: 2.5rem;
}

.recommended-section h3 {
    font-size: 1.3rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.recommended-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.6rem;
}

.related-card {
    background: var(--card);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    overflow: hidden;
    text-decoration: none;
    color: var(--text);
    display: flex;
    flex-direction: column;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(0,0,0,0.02);
}

.related-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 28px rgba(0,0,0,0.06);
    border-color: var(--accent);
}

.related-card-thumb {
    aspect-ratio: 16 / 10;
    overflow: hidden;
    position: relative;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
}

.related-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.related-card:hover .related-card-thumb img {
    transform: scale(1.06);
}

.related-card-category {
    position: absolute;
    top: 12px;
    left: 12px;
    background: var(--accent-gradient);
    color: #fff;
    padding: 0.28rem 0.75rem;
    font-size: 0.72rem;
    border-radius: 6px;
    font-weight: 800;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

.related-card-content {
    padding: 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    flex-grow: 1;
}

.related-card-content time {
    font-size: 0.75rem;
    color: var(--muted);
    font-weight: 600;
}

.related-card-content h4 {
    font-size: 0.98rem;
    line-height: 1.45;
    font-weight: 700;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* --- Article Prev/Next Navigation Premium --- */
.article-nav {
    display: flex;
    justify-content: space-between;
    gap: 1.2rem;
    margin: 3.5rem 2.5rem 1.5rem;
    border-top: 1px solid var(--border-color);
    padding-top: 2rem;
}

.article-nav-link {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1.2rem;
    background: var(--glass-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    text-decoration: none;
    color: var(--text);
    transition: all 0.25s ease;
    box-shadow: 0 4px 10px rgba(0,0,0,0.01);
}

.article-nav-link.disabled {
    opacity: 0.4;
    pointer-events: none;
}

.article-nav-link:not(.disabled):hover {
    border-color: var(--accent);
    background: var(--card);
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0,0,0,0.04);
}

.article-nav-link.prev {
    align-items: flex-start;
}

.article-nav-link.next {
    align-items: flex-end;
    text-align: right;
}

.article-nav-label {
    font-size: 0.78rem;
    color: var(--muted);
    font-weight: 700;
    margin-bottom: 0.4rem;
}

.article-nav-title {
    font-size: 0.92rem;
    font-weight: 700;
    line-height: 1.45;
}

@media (max-width: 600px) {
    .article-nav {
        flex-direction: column;
        margin: 2rem 1.6rem 1rem;
        gap: 0.8rem;
    }
}

/* --- Article Footer --- */
.article-footer {
    padding: 1.8rem 2.5rem;
    background: var(--card);
    border-top: 1px solid var(--border-color);
    font-size: 0.88rem;
    color: var(--muted);
}

.article-footer a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}

.article-footer a:hover {
    text-decoration: underline;
}

.small {
    font-size: 0.82rem;
    color: var(--muted);
    opacity: 0.8;
}

@media (max-width: 600px) {
    .article-footer {
        padding: 1.5rem 1.6rem;
    }
}

/* ==========================================================================
   Mobile Bottom Sheet TOC (Floating TOC)
   ========================================================================== */
.floating-toc-btn {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 50px;
    padding: 0.8rem 1.5rem;
    font-weight: 700;
    font-size: 0.95rem;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
    cursor: pointer;
    z-index: 998;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.mobile-toc-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.mobile-toc-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.mobile-toc-sheet {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: var(--card);
    border-radius: 24px 24px 0 0;
    z-index: 1000;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1);
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 -10px 30px rgba(0,0,0,0.1);
}
.mobile-toc-sheet.show {
    transform: translateY(0);
}

.mobile-toc-header {
    padding: 1.5rem 1.5rem 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.mobile-toc-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--text);
}
.mobile-toc-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--muted);
    cursor: pointer;
}

.mobile-toc-body {
    padding: 1.5rem;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

@media (min-width: 1024px) {
    .floating-toc-btn, .mobile-toc-overlay, .mobile-toc-sheet {
        display: none !important;
    }
}

/* ==========================================================================
   Dynamic Components Styles (Breadcrumb & TOC)
   ========================================================================== */

/* --- Article Breadcrumb --- */
.article-breadcrumb {
    max-width: var(--max-width);
    margin: 1rem auto 0;
    padding: 0 1.5rem;
    font-size: 0.85rem;
    color: var(--muted);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.article-breadcrumb a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    transition: opacity 0.2s;
}

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

.article-breadcrumb-separator {
    color: var(--muted);
    opacity: 0.5;
}

@media (max-width: 600px) {
    .article-breadcrumb {
        padding: 0 1rem;
        font-size: 0.8rem;
    }
}

/* --- Table of Contents (TOC) --- */
.toc-box {
    background: var(--card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    margin: 2.5rem 0;
    box-shadow: var(--glass-shadow);
    overflow: hidden;
}

.toc-box summary {
    padding: 1.2rem 1.5rem;
    cursor: pointer;
    background: var(--bg);
    display: flex;
    justify-content: space-between;
    align-items: center;
    list-style: none; /* Hide default arrow */
    font-weight: 700;
    user-select: none;
}

/* Hide default marker for webkit/safari */
.toc-box summary::-webkit-details-marker {
    display: none;
}

.toc-title {
    color: var(--text);
    font-size: 1.05rem;
}

.toc-summary-note {
    font-size: 0.8rem;
    color: var(--muted);
    font-weight: 400;
    margin-top: 0.2rem;
}

.toc-summary-meta {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.toc-badge {
    background: var(--accent-light);
    color: var(--accent);
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
}

.toc-icon {
    transition: transform 0.3s ease;
    color: var(--muted);
}

.toc-box[open] summary .toc-icon {
    transform: rotate(180deg);
}

.toc-body {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.toc-actions {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.toc-action {
    background: var(--bg);
    color: var(--text);
    text-decoration: none;
    padding: 0.6rem 1.2rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid var(--border-color);
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.toc-action:hover {
    background: var(--accent-light);
    color: var(--accent);
    border-color: var(--accent);
}

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

.toc-item {
    margin-bottom: 0.8rem;
}

.toc-item a {
    color: var(--muted);
    text-decoration: none;
    font-size: 0.95rem;
    transition: color 0.2s, padding-left 0.2s;
    display: block;
    padding: 0.2rem 0;
    padding-left: 0.8rem;
    border-left: 2px solid transparent;
}

.toc-item a:hover {
    color: var(--accent);
    border-left-color: var(--accent);
    background: var(--accent-light);
    border-radius: 0 4px 4px 0;
}

.toc-h3 a {
    padding-left: 1.8rem;
    font-size: 0.88rem;
}

.toc-h3 a:hover {
    padding-left: 2.2rem;
}

/* --- Visual Summary Card (Infographic Style) --- */
.visual-summary {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border: 2px solid #bbf7d0;
    border-radius: 24px;
    padding: 2.5rem 2rem;
    margin: 3rem 0;
    box-shadow: 0 10px 30px rgba(34, 197, 94, 0.1);
    position: relative;
    overflow: hidden;
    color: #166534;
}

body[data-theme="dark"] .visual-summary {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.1) 0%, rgba(21, 128, 61, 0.1) 100%);
    border-color: rgba(74, 222, 128, 0.2);
    color: #e2e8f0;
}

.visual-summary::before {
    content: '📝';
    position: absolute;
    top: -20px;
    right: -20px;
    font-size: 8rem;
    opacity: 0.05;
    transform: rotate(15deg);
    pointer-events: none;
}

.visual-summary-title {
    font-size: 1.4rem;
    font-weight: 800;
    text-align: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px dashed rgba(22, 163, 74, 0.3);
}

.visual-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
}

.visual-summary-item {
    background: rgba(255, 255, 255, 0.6);
    padding: 1.2rem;
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.03);
}

body[data-theme="dark"] .visual-summary-item {
    background: rgba(0, 0, 0, 0.2);
}

.visual-summary-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    display: block;
}

.visual-summary-text {
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.5;
}
