/* ============================================================================
   Soroban Testkit — Modern Cosmic Developer Theme
   Inspired by Stellar, Soroban, Linear & Vercel aesthetics
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

/* ----------------------------------------------------------------------------
   1. Design Tokens & CSS Variables
   -------------------------------------------------------------------------- */
:root {
    /* Layout */
    --content-max-width: 1100px;
    --page-padding: 36px;
    --menu-bar-height: 60px;
    --sidebar-target-width: 300px;
    --code-font-size: 0.88em;

    /* Typography */
    --tk-font-sans: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --tk-font-display: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --tk-font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

    /* Brand & Accent Palettes */
    --tk-brand: #6366f1;
    --tk-brand-light: #818cf8;
    --tk-brand-deep: #4338ca;
    --tk-purple: #a855f7;
    --tk-cyan: #06b6d4;
    --tk-teal: #14b8a6;
    --tk-emerald: #10b981;
    --tk-amber: #f59e0b;
    --tk-rose: #f43f5e;

    /* Radii & Shadows */
    --tk-radius-sm: 8px;
    --tk-radius: 14px;
    --tk-radius-lg: 20px;
    --tk-radius-full: 9999px;
    --tk-border-width: 1px;
    
    --tk-shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --tk-shadow: 0 12px 32px -4px rgba(0, 0, 0, 0.25), 0 4px 12px -2px rgba(0, 0, 0, 0.12);
    --tk-shadow-glow: 0 0 30px rgba(99, 102, 241, 0.25);
    --tk-shadow-cyan: 0 0 30px rgba(6, 182, 212, 0.25);

    /* Gradients */
    --tk-gradient-primary: linear-gradient(135deg, #6366f1 0%, #a855f7 50%, #06b6d4 100%);
    --tk-gradient-cosmic: linear-gradient(135deg, #38bdf8 0%, #818cf8 50%, #c084fc 100%);
    --tk-gradient-glass: linear-gradient(180deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.02) 100%);
    --tk-gradient-dark-glass: linear-gradient(180deg, rgba(30, 41, 59, 0.7) 0%, rgba(15, 23, 42, 0.8) 100%);

    /* Chrome Sidebar (Universal Cosmic Nav) */
    --sidebar-bg: #0b0f19;
    --sidebar-fg: #94a3b8;
    --sidebar-non-existant: #475569;
    --sidebar-active: #38bdf8;
    --sidebar-spacer: rgba(255, 255, 255, 0.06);
    --sidebar-header-border-color: rgba(255, 255, 255, 0.06);
    --icons: #94a3b8;
    --icons-hover: #f8fafc;
    --scrollbar: #1e293b;
    --searchbar-bg: #111827;
    --searchbar-border-color: rgba(255, 255, 255, 0.12);
    --searchbar-fg: #f1f5f9;
    --searchbar-shadow-color: rgba(0, 0, 0, 0.5);
    --searchresults-header-fg: #94a3b8;
    --searchresults-border-color: rgba(255, 255, 255, 0.1);
    --searchresults-li-bg: #111827;
    --search-mark-bg: #38bdf8;
    --overlay-bg: rgba(3, 7, 18, 0.8);
}

/* ----------------------------------------------------------------------------
   2. Dark Mode (Default / Navy / Coal / Ayu)
   -------------------------------------------------------------------------- */
.navy,
.coal,
.ayu,
html:not(.light) {
    --bg: #090d16;
    --fg: #e2e8f0;
    --fg-muted: #94a3b8;
    --links: #38bdf8;
    --links-hover: #7dd3fc;
    --inline-code-color: #38bdf8;
    --quote-bg: rgba(30, 41, 59, 0.5);
    --quote-border: #6366f1;
    --table-border-color: rgba(255, 255, 255, 0.08);
    --table-header-bg: #0f172a;
    --table-alternate-bg: rgba(255, 255, 255, 0.02);
    --theme-popup-bg: #0f172a;
    --theme-popup-border: rgba(255, 255, 255, 0.12);
    --theme-hover: #1e293b;
    --color-scheme: dark;
    --tk-surface: #0f172a;
    --tk-surface-alt: #141e33;
    --tk-surface-border: rgba(255, 255, 255, 0.08);
    --tk-surface-border-hover: rgba(99, 102, 241, 0.5);
    --tk-muted: #94a3b8;
    --tk-code-bg: #080d1a;
    --tk-code-border: rgba(255, 255, 255, 0.09);
    --sidebar-bg: #070a12;
}

/* ----------------------------------------------------------------------------
   3. Light Mode (Linear / Stripe aesthetic)
   -------------------------------------------------------------------------- */
.light {
    --bg: #f8fafc;
    --fg: #0f172a;
    --fg-muted: #475569;
    --links: #4f46e5;
    --links-hover: #6366f1;
    --inline-code-color: #6366f1;
    --quote-bg: #f1f5f9;
    --quote-border: #6366f1;
    --table-border-color: #e2e8f0;
    --table-header-bg: #f1f5f9;
    --table-alternate-bg: #f8fafc;
    --theme-popup-bg: #ffffff;
    --theme-popup-border: #e2e8f0;
    --theme-hover: #f1f5f9;
    --color-scheme: light;
    --tk-surface: #ffffff;
    --tk-surface-alt: #f1f5f9;
    --tk-surface-border: #e2e8f0;
    --tk-surface-border-hover: rgba(99, 102, 241, 0.4);
    --tk-muted: #64748b;
    --tk-code-bg: #f1f5f9;
    --tk-code-border: #e2e8f0;
    --sidebar-bg: #0f172a;
}

/* ----------------------------------------------------------------------------
   4. Base HTML & Global Styling
   -------------------------------------------------------------------------- */
html {
    font-family: var(--tk-font-sans);
    font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    background-color: var(--bg);
    background-image: 
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(99, 102, 241, 0.15), transparent),
        radial-gradient(ellipse 60% 40% at 90% 10%, rgba(6, 182, 212, 0.08), transparent);
    background-attachment: fixed;
    color: var(--fg);
    overflow-x: hidden;
}

::selection {
    background: rgba(99, 102, 241, 0.35);
    color: #ffffff;
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(99, 102, 241, 0.4);
}

/* Content Container */
.content {
    max-width: var(--content-max-width);
    margin: 0 auto;
    padding: 0 var(--page-padding) 64px;
    line-height: 1.78;
    letter-spacing: -0.01em;
}

.content main {
    padding-top: 20px;
}

/* Headers */
.content h1 {
    font-family: var(--tk-font-display);
    font-size: 2.35rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    margin: 0 0 0.8em;
    padding-bottom: 0.4em;
    border-bottom: 1px solid var(--tk-surface-border);
    color: var(--fg);
}

.content h2 {
    font-family: var(--tk-font-display);
    font-size: 1.55rem;
    font-weight: 750;
    letter-spacing: -0.025em;
    margin-top: 2.6em;
    margin-bottom: 0.8em;
    color: var(--fg);
}

.content h3 {
    font-family: var(--tk-font-display);
    font-size: 1.25rem;
    font-weight: 650;
    letter-spacing: -0.015em;
    margin-top: 2.2em;
    margin-bottom: 0.6em;
    color: var(--fg);
}

.content h2::before,
.content h3::before {
    content: "";
    display: block;
    width: 28px;
    height: 3px;
    border-radius: var(--tk-radius-full);
    margin-bottom: 0.6em;
    background: var(--tk-gradient-primary);
}

.content p {
    color: var(--fg);
    margin: 0 0 1.3em;
    font-size: 1rem;
}

.content a {
    color: var(--links);
    text-decoration: none;
    font-weight: 500;
    transition: color 150ms ease, text-decoration-color 150ms ease;
    border-bottom: 1px solid transparent;
}

.content a:hover {
    color: var(--links-hover);
    border-bottom-color: var(--links-hover);
}

.content strong {
    font-weight: 700;
    color: var(--fg);
}

.content hr {
    border: none;
    height: 1px;
    background: var(--tk-surface-border);
    margin: 2.5em 0;
}

/* ----------------------------------------------------------------------------
   5. Chrome: Top Navigation & Sidebar
   -------------------------------------------------------------------------- */
#mdbook-menu-bar,
.menu-bar {
    background: color-mix(in srgb, var(--bg) 80%, transparent);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--tk-surface-border);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
    height: var(--menu-bar-height);
    position: sticky;
    top: 0;
    z-index: 100;
}

.menu-title {
    font-family: var(--tk-font-display);
    font-weight: 750;
    font-size: 1.12rem;
    letter-spacing: -0.02em;
    background: var(--tk-gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

#mdbook-menu-bar .icon-button {
    color: var(--icons);
    transition: color 150ms ease, transform 150ms ease;
    padding: 6px;
    border-radius: 8px;
}

#mdbook-menu-bar .icon-button:hover {
    color: var(--icons-hover);
    background: rgba(255, 255, 255, 0.06);
    transform: scale(1.08);
}

/* Sidebar navigation */
.sidebar {
    background: var(--sidebar-bg);
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.25);
}

.sidebar .sidebar-scrollbox {
    padding: 24px 18px 48px;
}

.sidebar .chapter {
    padding: 0;
}

.sidebar .chapter li {
    margin: 3px 0;
}

.chapter li.part-title {
    font-size: 0.72rem;
    font-weight: 750;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #64748b;
    margin: 2em 0 0.6em 12px;
}

.sidebar .chapter .chapter-link-wrapper > a {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: var(--tk-radius-sm);
    color: #94a3b8;
    font-size: 0.88rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 140ms ease;
}

.sidebar .chapter .chapter-link-wrapper > a:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #f8fafc;
    transform: translateX(3px);
}

.sidebar .chapter .chapter-link-wrapper > a.active {
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.22) 0%, rgba(6, 182, 212, 0.12) 100%);
    color: #38bdf8;
    font-weight: 650;
    box-shadow: inset 3px 0 0 #38bdf8;
}

/* Search bar & modal */
#searchbar {
    border-radius: var(--tk-radius-full);
    padding: 10px 18px;
    font-size: 0.88rem;
    border: 1px solid var(--searchbar-border-color);
    background: var(--searchbar-bg);
    color: var(--searchbar-fg);
    transition: border-color 150ms ease, box-shadow 150ms ease;
}

#searchbar:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
    outline: none;
}

#searchresults {
    margin-top: 16px;
}

#searchresults li {
    background: var(--tk-surface);
    border: 1px solid var(--tk-surface-border);
    border-radius: var(--tk-radius-sm);
    margin-bottom: 10px;
    padding: 12px 16px;
    transition: all 140ms ease;
}

#searchresults li:hover,
#searchresults li.focus {
    border-color: #6366f1;
    background: rgba(99, 102, 241, 0.08);
    transform: translateX(4px);
}

#searchresults a {
    color: var(--fg);
    font-weight: 600;
    text-decoration: none;
}

#searchresults p {
    font-size: 0.88rem;
    color: var(--tk-muted);
    margin: 4px 0 0;
}

mark, .search-mark {
    background: rgba(56, 189, 248, 0.25);
    color: #38bdf8;
    padding: 1px 4px;
    border-radius: 4px;
    font-weight: 600;
}

/* Theme picker popup */
.theme-popup {
    background: var(--theme-popup-bg);
    border: 1px solid var(--theme-popup-border);
    border-radius: var(--tk-radius-sm);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    padding: 6px;
    margin-top: 8px;
}

.theme-popup .theme {
    border-radius: 6px;
    padding: 8px 14px;
    font-family: var(--tk-font-sans);
    font-size: 0.86rem;
    font-weight: 500;
    color: var(--fg);
    transition: all 120ms ease;
    border: none;
    width: 100%;
    text-align: left;
}

.theme-popup .theme:hover {
    background: rgba(99, 102, 241, 0.18);
    color: #38bdf8;
}

/* ----------------------------------------------------------------------------
   6. Code Blocks & Terminal Aesthetics
   -------------------------------------------------------------------------- */
.content pre {
    position: relative;
    background: var(--tk-code-bg);
    border: 1px solid var(--tk-code-border);
    border-radius: var(--tk-radius);
    padding: 22px 22px 20px;
    margin: 1.8em 0;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
    overflow-x: auto;
}

.content pre::before {
    content: "";
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #6366f1 0%, #06b6d4 100%);
    border-top-left-radius: var(--tk-radius);
    border-top-right-radius: var(--tk-radius);
}

.content pre code {
    font-family: var(--tk-font-mono);
    font-size: var(--code-font-size);
    line-height: 1.7;
    tab-size: 4;
}

:not(pre) > code {
    font-family: var(--tk-font-mono);
    font-size: 0.86em;
    background: rgba(99, 102, 241, 0.14);
    color: var(--inline-code-color);
    border: 1px solid rgba(99, 102, 241, 0.24);
    border-radius: 6px;
    padding: 0.15em 0.45em;
    white-space: break-spaces;
}

/* Copy button */
.buttons {
    position: absolute;
    top: 12px;
    right: 14px;
    display: flex;
    gap: 6px;
    z-index: 5;
}

.buttons button,
.copy-button {
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    color: #94a3b8;
    cursor: pointer;
    padding: 4px 8px;
    font-size: 0.8rem;
    transition: all 140ms ease;
    backdrop-filter: blur(4px);
}

.buttons button:hover,
.copy-button:hover {
    background: rgba(99, 102, 241, 0.25);
    border-color: #6366f1;
    color: #ffffff;
}

/* ----------------------------------------------------------------------------
   7. Hero Component (.tk-hero)
   -------------------------------------------------------------------------- */
.tk-hero {
    position: relative;
    overflow: hidden;
    background: radial-gradient(130% 160% at 5% 0%, #1e1b4b 0%, #0f172a 50%, #030712 100%);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: var(--tk-radius-lg);
    color: #f8fafc;
    padding: 52px 46px 44px;
    margin: 10px 0 40px;
    box-shadow: var(--tk-shadow), 0 0 50px rgba(99, 102, 241, 0.18);
}

.tk-hero::before {
    content: "";
    position: absolute;
    top: -120px;
    right: -100px;
    width: 420px;
    height: 420px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(6, 182, 212, 0.32) 0%, rgba(99, 102, 241, 0.16) 50%, transparent 70%);
    filter: blur(45px);
    pointer-events: none;
}

.tk-hero__eyebrow {
    font-family: var(--tk-font-mono);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #38bdf8;
    margin: 0 0 16px;
    display: inline-block;
}

.tk-hero .tk-hero__title {
    font-family: var(--tk-font-display);
    font-size: 2.85rem;
    font-weight: 850;
    letter-spacing: -0.035em;
    line-height: 1.12;
    margin: 0 0 16px;
    border: none;
    padding: 0;
    color: #ffffff;
    background: linear-gradient(135deg, #ffffff 40%, #94a3b8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.tk-hero__lede {
    max-width: 65ch;
    font-size: 1.1rem;
    line-height: 1.74;
    color: #cbd5e1;
    margin: 0 0 28px;
}

.tk-hero__lede a {
    color: #38bdf8;
    text-decoration: underline;
}

.tk-hero__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
}

/* Action Buttons */
.tk-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 24px;
    border-radius: var(--tk-radius-full);
    font-size: 0.92rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 160ms cubic-bezier(0.16, 1, 0.3, 1);
}

.tk-btn:hover {
    transform: translateY(-2px);
    text-decoration: none;
}

.tk-btn--primary {
    background: linear-gradient(135deg, #38bdf8 0%, #6366f1 100%);
    color: #030712;
    font-weight: 700;
    box-shadow: 0 4px 20px rgba(56, 189, 248, 0.4);
}

.tk-btn--primary:hover {
    box-shadow: 0 6px 26px rgba(56, 189, 248, 0.6);
    color: #000000;
}

.tk-btn--ghost {
    background: rgba(255, 255, 255, 0.08);
    color: #f1f5f9;
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.16);
}

.tk-btn--ghost:hover {
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.28);
    color: #ffffff;
}

/* ----------------------------------------------------------------------------
   8. Badges & Chips
   -------------------------------------------------------------------------- */
.tk-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 24px 0 0;
}

.tk-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: var(--tk-radius-full);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #cbd5e1;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-decoration: none;
    transition: all 140ms ease;
}

.tk-badge--brand {
    background: rgba(99, 102, 241, 0.18);
    border-color: rgba(99, 102, 241, 0.4);
    color: #a5b4fc;
}

.tk-badge--accent {
    background: rgba(6, 182, 212, 0.18);
    border-color: rgba(6, 182, 212, 0.4);
    color: #67e8f9;
}

/* ----------------------------------------------------------------------------
   9. Cards & Grids
   -------------------------------------------------------------------------- */
.tk-grid {
    display: grid;
    gap: 20px;
    margin: 1.8em 0 2.4em;
}

.tk-grid--2 {
    grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
}

.tk-grid--3 {
    grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
}

.tk-grid--4 {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.tk-card {
    position: relative;
    background: var(--tk-surface);
    border: 1px solid var(--tk-surface-border);
    border-radius: var(--tk-radius);
    box-shadow: var(--tk-shadow-sm);
    padding: 24px;
    transition: transform 180ms cubic-bezier(0.16, 1, 0.3, 1), box-shadow 180ms ease, border-color 180ms ease;
}

.tk-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--tk-shadow-glow), var(--tk-shadow);
    border-color: var(--tk-surface-border-hover);
}

.tk-card__kicker {
    display: inline-block;
    font-family: var(--tk-font-mono);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #38bdf8;
    margin: 0 0 8px;
}

.tk-card h3,
.tk-card__title {
    font-family: var(--tk-font-display);
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.015em;
    margin: 0 0 10px;
    padding: 0;
    border: none;
    color: var(--fg);
}

.tk-card h3::before,
.tk-card__title::before {
    content: none;
}

.tk-card p,
.tk-card__body {
    font-size: 0.92rem;
    line-height: 1.68;
    color: var(--tk-muted);
    margin: 0;
}

.tk-card__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 18px;
}

.tk-card--accent {
    border-left: 3px solid #06b6d4;
}

/* ----------------------------------------------------------------------------
   10. Problems / Solutions Comparison Rows
   -------------------------------------------------------------------------- */
.tk-problems {
    display: grid;
    gap: 14px;
    margin: 1.6em 0 2.2em;
}

.tk-problem {
    display: grid;
    grid-template-columns: 1fr;
    gap: 5px;
    background: var(--tk-surface);
    border: 1px solid var(--tk-surface-border);
    border-left: 3px solid #f59e0b;
    border-radius: var(--tk-radius-sm);
    padding: 16px 20px;
    transition: border-color 150ms ease, transform 150ms ease;
}

.tk-problem:hover {
    border-color: rgba(245, 158, 11, 0.5);
    transform: translateX(3px);
}

.tk-problem__label {
    font-family: var(--tk-font-mono);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #f59e0b;
}

.tk-problem__body {
    font-size: 0.96rem;
    font-weight: 500;
    color: var(--fg);
}

.tk-problem__fix {
    font-size: 0.9rem;
    color: var(--tk-muted);
    margin-top: 2px;
}

.tk-problem__fix b {
    color: #10b981;
}

/* ----------------------------------------------------------------------------
   11. Numbered Steps
   -------------------------------------------------------------------------- */
.tk-steps {
    list-style: none;
    counter-reset: tk-step;
    margin: 1.8em 0 2.4em;
    padding: 0;
}

.tk-steps > li {
    counter-increment: tk-step;
    position: relative;
    margin: 0 0 26px;
    padding: 4px 0 0 60px;
    min-height: 40px;
}

.tk-steps > li::before {
    content: counter(tk-step);
    position: absolute;
    left: 0;
    top: 0;
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1 0%, #38bdf8 100%);
    color: #030712;
    font-family: var(--tk-font-mono);
    font-size: 0.92rem;
    font-weight: 800;
    box-shadow: 0 0 16px rgba(56, 189, 248, 0.4);
}

.tk-steps > li::after {
    content: "";
    position: absolute;
    left: 18px;
    top: 44px;
    bottom: -22px;
    width: 2px;
    background: var(--tk-surface-border);
}

.tk-steps > li:last-child::after {
    content: none;
}

.tk-steps h4 {
    font-family: var(--tk-font-display);
    font-size: 1.05rem;
    font-weight: 700;
    margin: 2px 0 8px;
}

/* ----------------------------------------------------------------------------
   12. Callouts
   -------------------------------------------------------------------------- */
.tk-callout {
    display: block;
    border-radius: var(--tk-radius);
    border: 1px solid var(--tk-surface-border);
    border-left: 4px solid #6366f1;
    background: var(--tk-surface);
    padding: 18px 22px;
    margin: 1.8em 0;
    font-size: 0.95rem;
    box-shadow: var(--tk-shadow-sm);
}

.tk-callout__title {
    display: block;
    font-family: var(--tk-font-mono);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #818cf8;
    margin-bottom: 6px;
}

.tk-callout p:last-child {
    margin-bottom: 0;
}

.tk-callout--tip {
    border-left-color: #10b981;
}

.tk-callout--tip .tk-callout__title {
    color: #34d399;
}

.tk-callout--warn {
    border-left-color: #f59e0b;
}

.tk-callout--warn .tk-callout__title {
    color: #fbbf24;
}

/* ----------------------------------------------------------------------------
   13. Spec Grid (Crate References)
   -------------------------------------------------------------------------- */
.tk-spec {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
    margin: 1.6em 0 2.2em;
}

.tk-spec__item {
    background: var(--tk-surface);
    border: 1px solid var(--tk-surface-border);
    border-radius: var(--tk-radius-sm);
    padding: 14px 18px;
    transition: transform 140ms ease, border-color 140ms ease;
}

.tk-spec__item:hover {
    transform: translateY(-2px);
    border-color: var(--tk-surface-border-hover);
}

.tk-spec__key {
    font-family: var(--tk-font-mono);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--tk-muted);
    display: block;
    margin-bottom: 4px;
}

.tk-spec__value {
    font-family: var(--tk-font-mono);
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--fg);
}

/* ----------------------------------------------------------------------------
   14. Tables & Blockquotes
   -------------------------------------------------------------------------- */
.table-wrapper {
    border-radius: var(--tk-radius);
    box-shadow: var(--tk-shadow-sm);
    border: 1px solid var(--tk-surface-border);
    overflow: hidden;
    margin: 1.8em 0;
}

table {
    border-collapse: collapse;
    width: 100%;
    font-size: 0.94em;
}

table thead th {
    background: var(--table-header-bg);
    color: #f1f5f9;
    font-family: var(--tk-font-mono);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 14px 18px;
    border-bottom: 1px solid var(--table-border-color);
    text-align: left;
}

table tbody td {
    padding: 13px 18px;
    border-bottom: 1px solid var(--table-border-color);
}

table tbody tr:nth-child(even) {
    background: var(--table-alternate-bg);
}

blockquote {
    background: var(--quote-bg);
    border-left: 4px solid var(--quote-border);
    border-radius: 0 var(--tk-radius) var(--tk-radius) 0;
    margin: 1.8em 0;
    padding: 16px 22px;
}

/* ----------------------------------------------------------------------------
   15. Previous / Next Chapter Cards
   -------------------------------------------------------------------------- */
.nav-chapters {
    display: flex;
    align-items: center;
    background: var(--tk-surface);
    border: 1px solid var(--tk-surface-border);
    border-radius: var(--tk-radius);
    box-shadow: var(--tk-shadow-sm);
    min-height: 90px;
    padding: 0 24px;
    transition: all 160ms ease;
    text-decoration: none;
}

.nav-chapters:hover {
    transform: translateY(-3px);
    box-shadow: var(--tk-shadow-glow), var(--tk-shadow);
    border-color: var(--tk-surface-border-hover);
    background: var(--tk-surface);
    text-decoration: none;
}

.nav-links {
    font-family: var(--tk-font-display);
    font-size: 1.04rem;
    font-weight: 650;
    color: var(--fg);
}

/* ----------------------------------------------------------------------------
   16. Call to Action (.tk-cta)
   -------------------------------------------------------------------------- */
.tk-cta {
    background: radial-gradient(130% 160% at 5% 0%, #1e1b4b 0%, #0f172a 100%);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: var(--tk-radius);
    padding: 24px 28px;
    margin: 2em 0;
    box-shadow: var(--tk-shadow-sm);
}

.tk-cta p {
    font-size: 1.02rem;
    line-height: 1.7;
    margin: 0 0 16px;
}

/* ----------------------------------------------------------------------------
   17. Responsive Tweaks
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
    :root {
        --page-padding: 18px;
    }

    .tk-hero {
        padding: 34px 24px 28px;
        border-radius: var(--tk-radius);
    }

    .tk-hero .tk-hero__title {
        font-size: 2.1rem;
    }

    .tk-grid--2,
    .tk-grid--3,
    .tk-grid--4 {
        grid-template-columns: 1fr;
    }

    .content h1 {
        font-size: 1.9rem;
    }
}
