:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-color: #2563eb; /* alias for compatibility */
    --secondary: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --bg: #ffffff;
    --bg2: #f9fafb;
    --text: #111827;
    --text2: #6b7280;
    --border: #e5e7eb;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg2);
}

/*
 * Polished stone sheen — reusable layered highlights (tinted by hue).
 * Put this class on a panel that already has position: relative; overflow: hidden; border-radius.
 *
 * Hue / accent (iridescence):
 *   --stone-hue            unitless 0–360, dominant tint for highlights
 *   --stone-hue-accent     optional second hue (default: calc(var(--stone-hue) + 26))
 *   --stone-sat, --stone-sat-accent   saturation % for each tone in the sheen
 *
 * “Light source” / polish (different stones = different angles + strength):
 *   --stone-light-angle     primary specular band direction (e.g. 118deg)
 *   --stone-light-angle-2   secondary glaze direction (e.g. 44deg)
 *   --stone-shine           0–1 overall specular strength
 *   --stone-depth-gloss     0–1 secondary overlay strength (pools / edge light)
 *
 * Sheen is intentionally soft: wide gradient stops + light blur ≈ cabochon polish, not mirror stripes.
 */
.polished-stone-surface {
    isolation: isolate;
    --stone-hue: 210;
    --stone-hue-accent: calc(var(--stone-hue) + 26);
    --stone-sat: 46%;
    --stone-sat-accent: 58%;
    --stone-light-angle: 126deg;
    --stone-light-angle-2: 48deg;
    --stone-shine: 0.52;
    --stone-depth-gloss: 0.45;
}

.polished-stone-surface > * {
    position: relative;
    z-index: 1;
}

.polished-stone-surface::before,
.polished-stone-surface::after {
    content: "";
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    pointer-events: none;
    z-index: 0;
    /* Soft specular = polished cabochon, not a razor highlight */
    filter: blur(1.1px);
}

.polished-stone-surface::before {
    opacity: calc(0.34 + var(--stone-shine) * 0.52);
    background: linear-gradient(
        var(--stone-light-angle),
        hsla(var(--stone-hue), var(--stone-sat), 16%, 0.26) 0%,
        hsla(var(--stone-hue), var(--stone-sat), 12%, 0.07) 16%,
        hsla(var(--stone-hue-accent), var(--stone-sat-accent), 58%, 0.1) 30%,
        hsla(var(--stone-hue-accent), var(--stone-sat-accent), 72%, 0.2) 40%,
        hsla(var(--stone-hue), calc(var(--stone-sat) + 6%), 90%, 0.26) 50%,
        hsla(var(--stone-hue-accent), var(--stone-sat), 52%, 0.12) 60%,
        hsla(var(--stone-hue), var(--stone-sat), 14%, 0.05) 76%,
        hsla(var(--stone-hue), var(--stone-sat), 8%, 0.3) 100%
    );
    mix-blend-mode: soft-light;
}

.polished-stone-surface::after {
    opacity: calc(var(--stone-depth-gloss) * (0.22 + var(--stone-shine) * 0.46));
    filter: blur(1.35px);
    background: linear-gradient(
        var(--stone-light-angle-2),
        hsla(var(--stone-hue), 26%, 96%, 0.12) 0%,
        hsla(var(--stone-hue), 28%, 62%, 0.06) 22%,
        transparent 42%,
        hsla(var(--stone-hue-accent), 30%, 50%, 0.09) 58%,
        transparent 72%,
        hsla(var(--stone-hue), 24%, 88%, 0.05) 88%,
        transparent 100%
    );
    mix-blend-mode: overlay;
}

@media (prefers-reduced-motion: no-preference) {
    .polished-stone-surface:hover::before {
        opacity: calc(0.42 + var(--stone-shine) * 0.62);
    }
    .polished-stone-surface:hover::after {
        opacity: calc(var(--stone-depth-gloss) * (0.3 + var(--stone-shine) * 0.52));
    }
}

.site-home-bar {
    padding: 0.5rem 1rem;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    max-width: 1200px;
    margin: 0 auto;
}
.site-home-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--primary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
}
.site-home-link:hover {
    text-decoration: underline;
}

.container { max-width: 1200px; margin: 0 auto; padding: 2rem; }
/* Module shell: shared by hyperscale, solana, zk, crypto, evm (body.{track} only styles hub/cards) */
.course-content {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem;
    background: var(--bg);
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}
.course-content.container {
    max-width: 900px;
}

header { text-align: center; margin-bottom: 3rem; padding: 2rem; background: var(--bg); border-radius: 8px; }
h1 { font-size: 2.5rem; color: var(--primary); margin-bottom: 0.5rem; }
h2 { color: var(--primary); margin: 2rem 0 1rem; font-size: 1.5rem; }
h3 { margin-top: 1.5rem; margin-bottom: 0.75rem; font-size: 1.2rem; }

.progress-bar { width: 100%; height: 30px; background: var(--bg2); border-radius: 15px; overflow: hidden; margin: 1rem 0; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--secondary)); transition: width 0.3s; display: flex; align-items: center; justify-content: center; color: white; font-weight: bold; }

.course-header { border-bottom: 2px solid var(--border); padding-bottom: 1rem; margin-bottom: 2rem; }
.course-header h1 { font-size: 2rem; margin-bottom: 0.5rem; }
.course-meta { display: flex; gap: 2rem; color: var(--text2); font-size: 0.9rem; }

/* Tables in modules: default to wrapping (narrower rules like flow-steps col1 override via higher specificity) */
.course-content table th,
.course-content table td {
    white-space: normal;
    overflow-wrap: break-word;
    word-break: break-word;
}
.course-content table td code,
.course-content table th code {
    white-space: normal;
    word-break: break-word;
    overflow-wrap: break-word;
}

.section { margin: 2rem 0; padding: 1.5rem; background: var(--bg2); border-radius: 8px; }
.section h2 { margin-top: 0; }

/*
 * Module pages: single white reading surface (no grey panels / table striping).
 * Sections are dividers only; table cells override global th { bg2 } — see block after th, td rules.
 */
/* All curriculum module pages (Hyperscale, ZK, Crypto, EVM, Solana): white page behind reading card */
body:has(.course-content) {
    background: var(--bg);
}
.course-content .section {
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--border);
    border-radius: 0;
    margin: 0;
    padding: 1.5rem 0;
}
.course-content .section:last-child {
    border-bottom: none;
}
.course-content .section-tight {
    margin-top: 0;
    padding-top: 1rem;
}
.course-content .table-wrap {
    background: var(--bg);
    border-radius: 6px;
}
.course-content .evm-polished-hero.polished-stone-surface::before,
.course-content .evm-polished-hero.polished-stone-surface::after {
    mix-blend-mode: normal;
}
.course-header-lede {
    margin: 0 0 0.75rem;
    font-size: 1.02rem;
    line-height: 1.55;
    max-width: 52rem;
    color: var(--text2);
}
.evm-polished-hero .course-header-lede {
    color: rgba(255, 255, 255, 0.9);
}
.course-content .section .table-wrap > table {
    margin: 0;
}
.course-content blockquote {
    border-left: 4px solid var(--primary);
    padding-left: 1rem;
    margin: 1rem 0;
    color: var(--text2);
}

/* Module page utilities (use classes — avoid inline layout/color on curriculum pages) */
.module-footnote {
    font-size: 0.92rem;
    color: var(--text2);
}
.module-footnote--tight {
    margin-bottom: 0;
}
.module-prose-note {
    margin-bottom: 0.5rem;
}
.module-nav {
    margin-top: 2rem;
}
.module-actions {
    margin-top: 1rem;
}

.module-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }
.module-grid--in-phase {
    margin-top: 0.75rem;
    margin-bottom: 0.25rem;
}

/* Hyperscale tx-flow phase deep-dive modules */
.hs-phase-hero {
    margin: 0 0 1.25rem;
    padding: 1.15rem 1.3rem 1.25rem;
    border-radius: 12px;
    border: 1px solid rgba(99, 102, 241, 0.22);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.09) 0%, rgba(16, 185, 129, 0.05) 55%, rgba(255, 255, 255, 0.4) 100%);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.65) inset;
}
.hs-phase-hero p:last-child {
    margin-bottom: 0;
}
.hs-phase-hero-tag {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--primary);
    margin-bottom: 0.65rem;
}
.hs-phase-scope {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}
.hs-phase-scope-block--out {
    padding-top: 0.15rem;
    border-top: 1px dashed rgba(99, 102, 241, 0.18);
}
.hs-phase-scope-label {
    display: block;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text2);
    margin-bottom: 0.5rem;
}
.hs-phase-flow {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 0;
    list-style: none;
    margin: 0;
    padding: 0;
}
.hs-phase-flow li {
    display: flex;
    align-items: center;
    margin: 0;
    max-width: 100%;
}
.hs-phase-flow li:not(:last-child)::after {
    content: "→";
    margin: 0 0.35rem;
    color: rgba(99, 102, 241, 0.55);
    font-size: 0.8rem;
    font-weight: 700;
    flex-shrink: 0;
}
.hs-phase-flow-chip {
    display: inline-block;
    font-family: inherit;
    font-size: 0.84rem;
    font-weight: 600;
    line-height: 1.35;
    letter-spacing: -0.01em;
    padding: 0.32rem 0.62rem;
    border-radius: 999px;
    background: rgba(99, 102, 241, 0.11);
    border: 1px solid rgba(99, 102, 241, 0.24);
    color: #312e81;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}
.hs-phase-scope-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}
.hs-phase-pipeline {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin: 1rem 0 1.25rem;
    min-width: 0;
    max-width: 100%;
}
.hs-phase-step {
    display: grid;
    grid-template-columns: 3.25rem minmax(0, 1fr);
    gap: 0.75rem 1rem;
    padding: 0.85rem 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    position: relative;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}
/* Grid text column: minmax(0,1fr) alone is not enough — child needs min-width:0 to wrap */
.hs-phase-step > :not(.hs-phase-step-num) {
    min-width: 0;
    max-width: 100%;
    overflow-wrap: break-word;
}
.hs-phase-step + .hs-phase-step {
    margin-top: 0.5rem;
}
.hs-phase-step-num {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.95rem;
    color: #fff;
    background: var(--primary);
    flex-shrink: 0;
}
.hs-phase-step.outside .hs-phase-step-num {
    background: var(--text2);
}
.hs-phase-step h3 {
    margin: 0 0 0.35rem;
    font-size: 1.05rem;
}
.hs-phase-step p {
    margin: 0;
    font-size: 0.95rem;
    color: var(--text2);
    line-height: 1.5;
    overflow-wrap: break-word;
    word-break: break-word;
}
.hs-phase-step h3 code,
.hs-phase-step p code,
.hs-phase-step li code {
    font-size: 0.88em;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}
.hs-phase-step a {
    overflow-wrap: anywhere;
    word-break: break-word;
}
.hs-phase-step .info p {
    overflow-wrap: break-word;
    word-break: break-word;
}
.hs-phase-step ul {
    margin: 0.5rem 0 0.75rem;
    padding-left: 1.25rem;
    color: var(--text2);
    font-size: 0.95rem;
    line-height: 1.5;
}
.hs-phase-step ul li {
    margin-bottom: 0.35rem;
}
.hs-phase-proof {
    margin: 0.85rem 0 0;
    padding-top: 0.5rem;
    border-top: 1px dashed var(--border);
}
.hs-phase-proof-caption {
    margin: 0 0 0.4rem;
    font-size: 0.88rem;
    color: var(--text2);
}
.hs-phase-proof .code-block {
    margin: 0;
    font-size: 0.82rem;
    line-height: 1.45;
}
.hs-gotcha {
    margin: 1rem 0;
    padding: 0.85rem 1rem;
    border-radius: 8px;
    border-left: 4px solid #d97706;
    background: rgba(217, 119, 6, 0.08);
}
.hs-gotcha strong {
    color: #b45309;
}
.hs-debate {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin: 1rem 0;
}
@media (max-width: 640px) {
    .hs-debate {
        grid-template-columns: 1fr;
    }
}
.hs-debate-col {
    padding: 0.85rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--border);
}
.hs-debate-col h4 {
    margin: 0 0 0.5rem;
    font-size: 0.92rem;
}
.hs-debate-col.pro {
    background: rgba(16, 185, 129, 0.06);
}
.hs-debate-col.con {
    background: rgba(239, 68, 68, 0.05);
}
.hs-qa-item {
    margin: 1rem 0;
    padding: 0.75rem 0 0.75rem 1rem;
    border-left: 3px solid var(--primary);
}
.hs-qa-item .hs-qa-q {
    font-weight: 700;
    margin: 0 0 0.4rem;
}
.hs-qa-item p {
    margin: 0.25rem 0 0;
}
.hs-phase-roadmap {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
    gap: 0.65rem;
    margin: 1rem 0 1.25rem;
    padding-bottom: 1px; /* avoid subpixel clip on card borders */
}
.hs-phase-roadmap a {
    display: block;
    box-sizing: border-box;
    padding: 0.65rem 0.75rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    text-decoration: none;
    font-size: 0.9rem;
    line-height: 1.4;
    font-weight: 500;
    color: var(--text);
    transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.hs-phase-roadmap a:hover {
    border: 1px solid var(--primary);
    border-bottom: 1px solid var(--primary);
    background: rgba(99, 102, 241, 0.06);
    color: var(--primary);
}
.hs-phase-roadmap a.is-current {
    border: 1px solid var(--primary);
    border-bottom: 1px solid var(--primary);
    background: rgba(99, 102, 241, 0.1);
    font-weight: 600;
    color: var(--primary);
}
.hs-phase-roadmap .phase-num {
    display: block;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--primary);
    margin-bottom: 0.2rem;
}
.hs-scope-pill {
    display: inline-block;
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.35;
    padding: 0.28rem 0.6rem;
    border-radius: 999px;
    margin: 0;
    border: 1px solid var(--border);
    text-decoration: none;
    color: inherit;
    transition: border-color 0.15s, background 0.15s;
}
a.hs-scope-pill:hover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.08);
    color: var(--primary);
}
.hs-scope-pill.in {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.35);
    color: #065f46;
}
.hs-scope-pill.out {
    background: rgba(148, 163, 184, 0.12);
    border-color: rgba(148, 163, 184, 0.35);
    color: var(--text2);
}

/*
 * Hub module cards (Hyperscale, Solana, ZK/crypto/EVM index grids): same vertical rhythm.
 * Solana was shorter because it omitted module-meta + shorter blurbs — flex + min-height aligns rows.
 */
.module-grid .module-card {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    min-height: 18.5rem;
    box-sizing: border-box;
}
.module-grid .module-card > p {
    flex: 1 1 auto;
    margin-top: 0;
    margin-bottom: 0.75rem;
    color: var(--text2);
    font-size: 0.95rem;
    line-height: 1.5;
}
.module-grid .module-card > .module-time-estimate {
    margin-top: auto;
}
.module-grid .module-card > .module-meta {
    flex-shrink: 0;
}

/* Global course levels (1…N) on index; palette cycles every 5 levels via --1…--5 */
.course-level-band {
    margin: 1.5rem 0 2rem;
    padding: 1rem 1.25rem 1.25rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    border-left-width: 5px;
    background: var(--bg);
}
.course-level-band-header {
    margin-bottom: 0.35rem;
}
.course-level-band-title {
    margin: 0 0 0.35rem;
    font-size: 1.15rem;
    color: var(--text);
    font-weight: 700;
    letter-spacing: -0.02em;
}
.course-level-band-desc {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.5;
    color: var(--text2);
}
.course-level-band--1 {
    border-left-color: #0d9488;
    background: linear-gradient(135deg, #f0fdfa 0%, #ecfeff 45%, var(--bg) 100%);
    box-shadow: 0 1px 6px rgba(13, 148, 136, 0.08);
}
.course-level-band--1 .course-level-band-title {
    color: #0f766e;
}
.course-level-band--2 {
    border-left-color: #2563eb;
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 40%, var(--bg) 100%);
    box-shadow: 0 1px 6px rgba(37, 99, 235, 0.08);
}
.course-level-band--2 .course-level-band-title {
    color: #1d4ed8;
}
.course-level-band--3 {
    border-left-color: #4f46e5;
    background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 40%, var(--bg) 100%);
    box-shadow: 0 1px 6px rgba(79, 70, 229, 0.09);
}
.course-level-band--3 .course-level-band-title {
    color: #4338ca;
}
.course-level-band--4 {
    border-left-color: #7c3aed;
    background: linear-gradient(135deg, #faf5ff 0%, #f3e8ff 42%, var(--bg) 100%);
    box-shadow: 0 1px 6px rgba(124, 58, 237, 0.09);
}
.course-level-band--4 .course-level-band-title {
    color: #6d28d9;
}
.course-level-band--5 {
    border-left-color: #047857;
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 38%, var(--bg) 100%);
    box-shadow: 0 1px 6px rgba(4, 120, 87, 0.08);
}
.course-level-band--5 .course-level-band-title {
    color: #047857;
}

/* ZK track — jade accents (hub + module pages); other tracks keep default / violet contribution styling */
body.zk-track .module-card.available:not(.completed):not(.in-progress) {
    border-color: #10b981;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.1);
}
body.zk-track .module-card.available:not(.completed):not(.in-progress):hover {
    border-color: #059669;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.18);
    background: #ecfdf5;
}
body.zk-track .module-card.available:not(.completed):not(.in-progress) h3 {
    color: #047857;
}
body.zk-track .module-card.available:not(.completed):not(.in-progress) .module-time-estimate {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    border-color: rgba(5, 150, 105, 0.22);
}
body.zk-track .module-card.available:not(.completed):not(.in-progress) .module-time-value {
    color: #059669;
}
body.zk-track .module-card--contribution.available:not(.completed):not(.in-progress) {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 52%, #a7f3d0 100%);
    border-color: #34d399;
    box-shadow: 0 2px 10px rgba(5, 150, 105, 0.14);
}
body.zk-track .module-card--contribution.available:not(.completed):not(.in-progress):hover {
    border-color: #059669;
    box-shadow: 0 4px 14px rgba(4, 120, 87, 0.2);
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 48%, #6ee7b7 100%);
}
body.zk-track .module-card--contribution.unavailable {
    border-color: #a7f3d0;
    background: #ecfdf5;
}
body.zk-track .module-card--contribution.available:not(.completed):not(.in-progress) h3 {
    color: #065f46;
}
body.zk-track .badge-contribution {
    background: linear-gradient(135deg, #d1fae5, #a7f3d0);
    color: #065f46;
    border-color: #6ee7b7;
}
body.zk-track .progress-fill {
    background: linear-gradient(90deg, #059669, #34d399);
}

/* EVM / Ethereum track — aquamarine polished stone (hub + module pages) */
body.evm-track .module-card.available:not(.completed):not(.in-progress) {
    border-color: #14b8a6;
    box-shadow: 0 2px 8px rgba(20, 184, 166, 0.12);
}
body.evm-track .module-card.available:not(.completed):not(.in-progress):hover {
    border-color: #0d9488;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(13, 148, 136, 0.2);
    background: #f0fdfa;
}
body.evm-track .module-card.available:not(.completed):not(.in-progress) h3 {
    color: #0f766e;
}
body.evm-track .module-card.available:not(.completed):not(.in-progress) .module-time-estimate {
    background: linear-gradient(135deg, #f0fdfa 0%, #ccfbf1 100%);
    border-color: rgba(13, 148, 136, 0.22);
}
body.evm-track .module-card.available:not(.completed):not(.in-progress) .module-time-value {
    color: #0d9488;
}
body.evm-track .progress-fill {
    background: linear-gradient(90deg, #0d9488, #2dd4bf);
}

/* Syllabus hero: aquamarine “polished stone” card (matches landing EVM gem) */
.evm-polished-hero.course-header {
    border-bottom: none;
    padding: 1.5rem 1.35rem 1.35rem;
    margin-bottom: 1.75rem;
    border-radius: 14px;
    color: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.2),
        inset 0 -1px 0 rgba(0, 0, 0, 0.18),
        0 12px 40px rgba(0, 0, 0, 0.12);
    background: linear-gradient(145deg, #5eead4 0%, #0d9488 42%, #115e59 100%);
    --stone-hue: 173;
    --stone-hue-accent: 195;
    --stone-sat: 72%;
    --stone-sat-accent: 58%;
    --stone-light-angle: 122deg;
    --stone-light-angle-2: 38deg;
    --stone-shine: 0.56;
    --stone-depth-gloss: 0.52;
}
.evm-polished-hero.course-header h1 {
    color: rgba(255, 255, 255, 0.98) !important;
    border-bottom: none;
}
.evm-polished-hero .course-meta {
    color: rgba(255, 255, 255, 0.82);
}

/* Cryptography track — coral orange accents (hub + module pages) */
body.crypto-track .module-card.available:not(.completed):not(.in-progress) {
    border-color: #fb923c;
    box-shadow: 0 2px 8px rgba(234, 88, 12, 0.12);
}
body.crypto-track .module-card.available:not(.completed):not(.in-progress):hover {
    border-color: #ea580c;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(234, 88, 12, 0.2);
    background: #fff7ed;
}
body.crypto-track .module-card.available:not(.completed):not(.in-progress) h3 {
    color: #c2410c;
}
body.crypto-track .module-card.available:not(.completed):not(.in-progress) .module-time-estimate {
    background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 100%);
    border-color: rgba(234, 88, 12, 0.28);
}
body.crypto-track .module-card.available:not(.completed):not(.in-progress) .module-time-value {
    color: #ea580c;
}
body.crypto-track .module-card--contribution.available:not(.completed):not(.in-progress) {
    background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 52%, #fed7aa 100%);
    border-color: #fb923c;
    box-shadow: 0 2px 10px rgba(234, 88, 12, 0.14);
}
body.crypto-track .module-card--contribution.available:not(.completed):not(.in-progress):hover {
    border-color: #ea580c;
    box-shadow: 0 4px 14px rgba(194, 65, 12, 0.22);
    background: linear-gradient(135deg, #ffedd5 0%, #fed7aa 48%, #fdba74 100%);
}
body.crypto-track .module-card--contribution.unavailable {
    border-color: #fed7aa;
    background: #fff7ed;
}
body.crypto-track .module-card--contribution.available:not(.completed):not(.in-progress) h3 {
    color: #9a3412;
}
body.crypto-track .badge-contribution {
    background: linear-gradient(135deg, #ffedd5, #fed7aa);
    color: #9a3412;
    border-color: #fb923c;
}
body.crypto-track .progress-fill {
    background: linear-gradient(90deg, #ea580c, #fb923c);
}

.level-heading { margin-top: 2rem; color: var(--primary); }
.module-card { background: var(--bg2); border: 2px solid var(--border); border-radius: 8px; padding: 1.5rem; transition: all 0.3s; cursor: pointer; text-decoration: none; color: inherit; display: block; }
.module-card.available { background: var(--bg); border: 2px solid var(--primary); box-shadow: 0 2px 8px rgba(37, 99, 235, 0.1); }
.module-card.available:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2); background: #eff6ff; }
.module-card.unavailable { background: #f9fafb; border: 2px solid #e5e7eb; opacity: 0.6; cursor: not-allowed; }
.module-card.completed { border-color: var(--secondary); background: #f0fdf4; }
.module-card.in-progress { border-color: var(--warning); background: #fffbeb; }
.module-card h3 { color: var(--primary); margin-bottom: 0.5rem; font-size: 1.2rem; }
.module-title-with-badges { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.badge-hyperscale, .badge-available, .badge-coming, .badge-project, .badge-lab {
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    white-space: nowrap;
    display: inline-block;
    flex-shrink: 0;
}
.badge-lab {
    background: #ecfdf5;
    color: #047857;
    font-weight: 600;
    border: 1px solid #a7f3d0;
}
.badge-project { background: #ede9fe; color: #5b21b6; font-weight: 600; }
.badge-hyperscale { background: #fef3c7; color: #92400e; }
.badge-available { background: #10b981; color: white; font-weight: bold; }
.badge-coming { background: #9ca3af; color: white; }
/* Time estimate: read, understand & complete */
.module-time-estimate {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.6rem;
    margin-top: 0.75rem;
    padding: 0.4rem 0.65rem;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 1px solid rgba(37, 99, 235, 0.2);
    border-radius: 6px;
    font-size: 0.85rem;
}
.module-time-icon {
    font-size: 1rem;
    line-height: 1;
    opacity: 0.9;
}
.module-time-value {
    font-weight: 600;
    color: var(--primary);
    letter-spacing: 0.02em;
}
.module-time-label {
    width: 100%;
    font-size: 0.75rem;
    color: var(--text2);
    font-style: italic;
}
.module-card.completed .module-time-estimate { background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%); border-color: rgba(16, 185, 129, 0.25); }
.module-card.completed .module-time-value { color: var(--secondary); }
.module-card.in-progress .module-time-estimate { background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%); border-color: rgba(245, 158, 11, 0.25); }
.module-card.in-progress .module-time-value { color: var(--warning); }

/* Hands-on project cards (intermediate): distinct violet theme */
.module-card--project.available {
    border-color: #7c3aed;
    background: linear-gradient(135deg, #faf5ff 0%, #f5f3ff 100%);
    box-shadow: 0 2px 10px rgba(124, 58, 237, 0.12);
}
.module-card--project.available:hover {
    border-color: #6d28d9;
    transform: translateY(-2px);
    background: linear-gradient(135deg, #f3e8ff 0%, #ede9fe 100%);
    box-shadow: 0 4px 14px rgba(124, 58, 237, 0.22);
}
.module-card--contribution.available {
    background: linear-gradient(135deg, #faf5ff 0%, #f3e8ff 55%, #ede9fe 100%);
    border-color: #a78bfa;
    box-shadow: 0 2px 10px rgba(109, 40, 217, 0.12);
}
.module-card--contribution.available:hover {
    border-color: #7c3aed;
    box-shadow: 0 4px 14px rgba(109, 40, 217, 0.22);
    background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 50%, #e9d5ff 100%);
}
.module-card--contribution.unavailable {
    border-color: #ddd6fe;
    background: #faf5ff;
}
.module-card--contribution.available h3 {
    color: #5b21b6;
}
.badge-contribution {
    display: inline-block;
    margin-left: 0.35rem;
    padding: 0.15rem 0.5rem;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-radius: 4px;
    background: linear-gradient(135deg, #ede9fe, #ddd6fe);
    color: #5b21b6;
    border: 1px solid #c4b5fd;
}
.section-oss-contribution {
    margin-top: 2rem;
    padding: 1.25rem 1.35rem;
    border-radius: 8px;
    border: 1px solid #c4b5fd;
    background: linear-gradient(135deg, #faf5ff 0%, #f5f3ff 100%);
}
.section-oss-contribution h2 {
    margin-top: 0;
    color: #5b21b6;
    font-size: 1.15rem;
}
.section-oss-contribution .oss-issue-link {
    font-weight: 600;
}

/* OSS contribution journeys: explicit steps + “expected result” (handholding) */
.oss-path-intro {
    background: linear-gradient(135deg, #fefce8 0%, #fffbeb 100%);
    border: 1px solid #fcd34d;
    border-radius: 8px;
    padding: 1rem 1.25rem;
    margin-bottom: 0.25rem;
}
.oss-path-intro p {
    margin: 0;
    line-height: 1.55;
}
.oss-journey-welcome {
    margin: 0 0 1rem;
    padding: 0.85rem 1rem;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 6px;
    border: 1px solid #e9d5ff;
    font-size: 0.98rem;
    line-height: 1.55;
}
.section-oss-contribution .oss-journey-welcome {
    background: rgba(255, 255, 255, 0.85);
}
.oss-contrib-step {
    margin: 1.1rem 0;
    padding: 0.85rem 1rem 1rem;
    border-left: 4px solid #a78bfa;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 0 8px 8px 0;
}
.oss-contrib-step h3 {
    margin-top: 0;
    margin-bottom: 0.5rem;
    font-size: 1.02rem;
    color: #5b21b6;
    font-weight: 650;
}
.oss-contrib-step p {
    margin: 0.35rem 0 0;
    line-height: 1.5;
}
.oss-expected {
    margin-top: 0.65rem;
    padding: 0.5rem 0.75rem;
    background: #ecfdf5;
    border-radius: 6px;
    border: 1px solid #a7f3d0;
    font-size: 0.94rem;
    line-height: 1.45;
}
.oss-expected strong {
    color: #047857;
}
.oss-payoff {
    margin-top: 1.15rem;
    padding: 0.85rem 1.1rem;
    background: linear-gradient(135deg, #fefce8 0%, #fef3c7 100%);
    border: 1px solid #fbbf24;
    border-radius: 8px;
    font-size: 0.96rem;
    line-height: 1.5;
}
.oss-payoff strong {
    color: #92400e;
}

.course-level-band-career {
    margin: 0.35rem 0 0.75rem;
    font-size: 0.88rem;
    color: #3730a3;
    font-weight: 600;
}

.elite-course-banner {
    border-left: 4px solid #2563eb;
    background: linear-gradient(90deg, rgba(239, 246, 255, 0.95), rgba(255, 255, 255, 0.98));
}
.elite-ladder-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: 0.92rem;
}
.elite-ladder-table th,
.elite-ladder-table td {
    border: 1px solid rgba(148, 163, 184, 0.45);
    padding: 0.45rem 0.65rem;
    text-align: left;
}
.elite-ladder-table th {
    background: rgba(241, 245, 249, 0.95);
    font-weight: 600;
}
.elite-ladder-table tbody tr:nth-child(even) {
    background: rgba(248, 250, 252, 0.8);
}

/* Module prose: short paragraph stacks (e.g. first-contribution module) */
.module-tight-prose p {
    margin: 0 0 0.85rem;
    line-height: 1.55;
}
.module-tight-prose p:last-child {
    margin-bottom: 0;
}
.module-prose-prompt {
    margin-top: 1rem;
    padding: 0.65rem 0.85rem;
    background: var(--bg2, #f1f5f9);
    border-radius: 6px;
    font-size: 0.96rem;
}

/* Assignment progress — persisted checkboxes (first-contribution module) */
.assignment-checklist {
    margin: 1rem 0 1.25rem;
    padding: 0;
    list-style: none;
}
.assignment-check-card {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    margin: 0.5rem 0;
    padding: 0.65rem 0.85rem;
    border-radius: 8px;
    border: 1px solid rgba(124, 58, 237, 0.22);
    background: linear-gradient(135deg, #faf5ff 0%, #fff 100%);
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.assignment-check-card:hover {
    border-color: rgba(124, 58, 237, 0.45);
    box-shadow: 0 2px 8px rgba(109, 40, 217, 0.08);
}
.assignment-check-card input[type="checkbox"] {
    width: 1.15rem;
    height: 1.15rem;
    margin-top: 0.15rem;
    flex-shrink: 0;
    accent-color: #7c3aed;
    cursor: pointer;
}
.assignment-check-card .assignment-check-label {
    flex: 1;
    font-weight: 600;
    color: #5b21b6;
    font-size: 0.95rem;
}
.assignment-check-card input:checked ~ .assignment-check-label {
    color: #065f46;
}
.assignment-check-card:has(input:checked) {
    border-color: rgba(5, 150, 105, 0.35);
    background: linear-gradient(135deg, #ecfdf5 0%, #fff 100%);
}
.assignment-step-block {
    margin: 1.35rem 0;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid rgba(226, 232, 240, 0.9);
}
.assignment-step-block:last-of-type {
    border-bottom: none;
}
.assignment-step-block h4 {
    margin: 0 0 0.5rem;
    font-size: 1.05rem;
    color: #1e293b;
}

/* First-contribution module: timed segments + trace lab layout */
.assignment-segment-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem 1rem;
    margin-bottom: 0.35rem;
}
.assignment-segment-head h4 {
    margin: 0;
    flex: 1 1 12rem;
}
.assignment-time-pill {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text2);
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(148, 163, 184, 0.45);
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    white-space: nowrap;
}
.assignment-outcome {
    margin: 0 0 0.85rem;
    padding: 0.65rem 0.85rem;
    background: rgba(255, 255, 255, 0.65);
    border-radius: 6px;
    border-left: 3px solid #94a3b8;
    font-size: 0.95rem;
    line-height: 1.5;
}
.assignment-outcome strong {
    color: #0f172a;
}
.assignment-trace-steps {
    margin: 0.5rem 0 1rem;
    padding-left: 1.35rem;
    line-height: 1.55;
}
.assignment-trace-steps li {
    margin-bottom: 0.45rem;
}
.assignment-run-note {
    margin: 0.65rem 0 0.35rem;
    font-size: 0.92rem;
    color: var(--text2);
}

.module-card--project.available h3 { color: #5b21b6; }
.module-card--project.completed {
    border-color: #059669;
    background: linear-gradient(135deg, #f5f3ff 0%, #ecfdf5 100%);
}
.module-card--project.in-progress {
    border-color: #c4b5fd;
    background: linear-gradient(135deg, #fffbeb 0%, #faf5ff 100%);
}
.module-card--project.unavailable {
    border-color: #ddd6fe;
    background: #faf5ff;
    opacity: 0.7;
}

/* Project module page: callout + step list */
.project-hero {
    background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%);
    border: 2px solid rgba(124, 58, 237, 0.25);
    border-radius: 8px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 0.5rem;
}
.project-hero h2 { margin-top: 0; color: #5b21b6; font-size: 1.15rem; }
.project-step { margin: 1.25rem 0; padding-left: 0.25rem; border-left: 3px solid #a78bfa; padding-left: 1rem; }
.project-step h3 { margin-top: 0; color: #5b21b6; font-size: 1.05rem; }

/* Hands-on module pages: subtle violet shell (index cards use .module-card--project) */
body.module-page--hands-on .course-header {
    border-bottom: 2px solid rgba(124, 58, 237, 0.2);
    padding-bottom: 1rem;
    margin-bottom: 0.5rem;
}
body.module-page--hands-on .course-header h1 {
    color: #5b21b6;
}
body.module-page--hands-on .course-meta span {
    background: #ede9fe;
    color: #5b21b6;
    border: 1px solid #c4b5fd;
}

.module-meta { display: flex; justify-content: space-between; margin-top: 1rem; font-size: 0.9rem; color: var(--text2); }
.module-status { padding: 0.25rem 0.75rem; border-radius: 12px; font-size: 0.8rem; font-weight: bold; }
.status-pending { background: var(--bg2); color: var(--text2); }
.status-in-progress { background: #fef3c7; color: #92400e; }
.status-completed { background: #d1fae5; color: #065f46; }

/* Resources section: card grid */
.resources { margin: 2.5rem 0; }
.resources h2 { margin-bottom: 1.25rem; }
.resource-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.25rem; }
.resource-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 1.5rem;
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: 10px;
    text-decoration: none;
    color: inherit;
    transition: all 0.25s ease;
    position: relative;
}
.resource-card:hover {
    border-color: var(--primary);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.12);
    background: #fafbff;
}
.resource-card:hover .resource-arrow { transform: translateX(4px); opacity: 1; }
.resource-icon { font-size: 2rem; margin-bottom: 0.75rem; line-height: 1; }
.resource-title { margin: 0 0 0.5rem 0; font-size: 1.15rem; color: var(--primary); font-weight: 700; }
.resource-desc { margin: 0; font-size: 0.9rem; color: var(--text2); line-height: 1.45; }
.resource-card .resource-desc .glossary-term { color: var(--primary); }
.resource-arrow { position: absolute; top: 1.5rem; right: 1.5rem; font-size: 1.25rem; color: var(--primary); opacity: 0.7; transition: transform 0.2s ease, opacity 0.2s ease; }

.quiz-container { background: var(--bg); border: 2px solid var(--border); border-radius: 8px; padding: 1.5rem; margin: 1.5rem 0; }
.quiz-container .btn { margin-top: 1rem; }
.question { margin-bottom: 1.5rem; }
.question-text { font-weight: bold; margin-bottom: 1rem; }
.option { margin: 0.75rem 0; padding: 0.75rem; background: var(--bg2); border: 2px solid var(--border); border-radius: 6px; cursor: pointer; transition: all 0.2s; position: relative; }
.option:hover { border-color: var(--primary); background: #eff6ff; }
.option.selected { border-color: var(--primary); background: #dbeafe; }
.option.correct { border: 2px solid #059669; background: #d1fae5; }
.option.incorrect { border: 2px solid #dc2626; background: #fee2e2; }
.option-feedback { display: inline-block; margin-left: 0.5rem; font-weight: 600; font-size: 0.9rem; }
.option-feedback-correct { color: #047857; }
.option-feedback-incorrect { color: #b91c1c; }
.question.question-wrong { border-left: 4px solid #dc2626; background: #fef2f2; border-radius: 6px; padding-left: 0.75rem; margin-left: -0.75rem; }
.question.question-wrong .question-text { color: #b91c1c; }
.quiz-results { margin-top: 1.5rem; padding: 1rem; border-radius: 6px; font-weight: bold; }
.quiz-results.passed { background: #d1fae5; color: #065f46; }
.quiz-results.failed { background: #fee2e2; color: #991b1b; }
.quiz-explanations { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid rgba(0,0,0,0.1); font-weight: normal; font-size: 0.95rem; }
.quiz-explanations h4 { margin-bottom: 0.5rem; font-size: 1rem; }
.quiz-explanations ul { margin: 0; padding-left: 1.25rem; }
.quiz-explanations li { margin-bottom: 0.5rem; }

/* Practical / lab assignments — violet (hands-on cue, matches project cards) */
.assignment {
    background: linear-gradient(135deg, #faf5ff 0%, #f5f3ff 100%);
    border: 2px solid rgba(124, 58, 237, 0.22);
    border-left: 4px solid #7c3aed;
    padding: 1.5rem;
    margin: 1.5rem 0;
    border-radius: 8px;
}
.assignment h3,
.assignment h4 { color: #5b21b6; margin-top: 0; }
.assignment > h4:first-of-type { margin-top: 1rem; }

/* Dark code panels (markdown-style Rust snippets) */
.code-block {
    background: #0d1117;
    color: #e6edf3;
    padding: 1rem 1.1rem;
    border-radius: 6px;
    overflow-x: auto;
    font-family: ui-monospace, 'Cascadia Code', 'Source Code Pro', Menlo, monospace;
    font-size: 0.9rem;
    margin: 1rem 0;
    border: 1px solid #30363d;
}
.code-block pre { margin: 0; white-space: pre; }
.code-block code {
    display: block;
    font-family: inherit;
    font-size: inherit;
    color: inherit;
    background: transparent;
}
.rust-hl-comment { color: #8b949e; font-style: italic; }
.rust-hl-keyword { color: #ff7b72; }
.rust-hl-string { color: #a5d6ff; }
.rust-hl-type { color: #79c0ff; }
.rust-hl-path { color: #d2a8ff; }
.rust-hl-fn { color: #d2a8ff; }
.rust-hl-ident { color: #e6edf3; }
.rust-hl-punct { color: #e6edf3; }
/* Light code block (e.g. manifest snippets) */
.code-block-light { background: #f1f5f9; color: var(--text); padding: 1rem; border-radius: 6px; overflow-x: auto; font-size: 0.9rem; margin: 0.75rem 0; }
.code-block-light code { font-family: ui-monospace, monospace; }
/* Section with less top margin */
.section-tight { margin-top: 1.5rem; }
/* Nested list in info/section */
.list-nested { margin: 0.75rem 0 0 1.25rem; padding-left: 0.5rem; }
.info h3 { margin-top: 0; font-size: 1.1rem; }
.info p:last-child { margin-bottom: 0; }

.navigation { display: flex; justify-content: space-between; margin-top: 2rem; padding-top: 2rem; border-top: 2px solid var(--border); gap: 0.75rem; flex-wrap: wrap; }
.navigation .btn { text-align: center; white-space: nowrap; }

.btn { padding: 0.75rem 1.5rem; border: none; border-radius: 6px; font-size: 1rem; font-weight: bold; cursor: pointer; transition: all 0.2s; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: #1d4ed8; transform: translateY(-1px); box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
.btn-secondary { background: var(--bg2); color: var(--text); border: 2px solid var(--border); }
.btn-secondary:hover { background: var(--border); }

/* Curriculum + hubs: narrow screens (one block — mobile-contract.js asserts these exist) */
@media (max-width: 640px) {
    .container,
    .course-content {
        padding: 1rem;
    }
    .course-content {
        border-radius: 0;
        box-shadow: none;
    }
    .site-home-bar {
        padding: 0.5rem 0.75rem;
    }
    .course-header h1 {
        font-size: 1.5rem;
        line-height: 1.25;
    }
    .course-meta {
        flex-wrap: wrap;
        gap: 0.35rem 1rem;
    }
    .module-grid {
        grid-template-columns: 1fr;
    }
    .module-actions .btn {
        width: 100%;
        min-height: 48px;
    }
    .navigation {
        flex-direction: column;
        align-items: stretch;
    }
    .navigation .btn {
        width: 100%;
        min-height: 48px;
        white-space: nowrap;
    }
    .hs-phase-roadmap {
        grid-template-columns: 1fr;
    }
    .hs-phase-step {
        grid-template-columns: 1fr;
        gap: 0.65rem;
    }
    .hs-phase-step-num {
        justify-self: start;
    }
}

/* In-content links (not nav, buttons, or phase roadmap cards) */
.course-content .section a:not(.btn):not(.site-home-link),
.course-content a[href*=".html"]:not(.btn):not(.site-home-link):not(.hs-phase-roadmap a) {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    border-bottom: 1px solid transparent;
    transition: color 0.2s, border-color 0.2s;
}
.course-content .section a:not(.btn):not(.site-home-link):hover,
.course-content a[href*=".html"]:not(.btn):not(.site-home-link):not(.hs-phase-roadmap a):hover {
    color: var(--primary-hover);
    border-bottom-color: var(--primary);
}
.course-content .section a[target="_blank"]:not(.btn)::after {
    content: " ↗";
    font-size: 0.75em;
    opacity: 0.8;
}

.info { background: #dbeafe; border-left: 4px solid var(--primary); padding: 1rem; margin: 1rem 0; border-radius: 4px; }
.warning { background: #fee2e2; border-left: 4px solid var(--danger); padding: 1rem; margin: 1rem 0; border-radius: 4px; }
.success { background: #d1fae5; border-left: 4px solid var(--secondary); padding: 1rem; margin: 1rem 0; border-radius: 4px; }

/* Block Diagram Styles */
.block-diagram {
    margin: 2rem 0;
    padding: 1.5rem;
    background: var(--bg2);
    border-radius: 8px;
    text-align: center;
}

.diagram-block {
    display: inline-block;
    border: 2px solid var(--primary);
    border-radius: 6px;
    background: var(--bg);
    min-width: 280px;
    margin: 0 auto;
    overflow: hidden;
}

.block-header, .block-body {
    padding: 1rem;
}

.block-header {
    background: #eff6ff;
    border-bottom: 2px solid var(--primary);
}

.block-divider {
    height: 2px;
    background: var(--primary);
}

.block-title {
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.block-field {
    text-align: left;
    padding: 0.25rem 0;
    color: var(--text);
    font-size: 0.9rem;
    font-family: ui-monospace, monospace;
}

.diagram-arrow {
    font-size: 1.5rem;
    color: var(--primary);
    margin: 0.75rem 0;
    font-weight: bold;
}

.diagram-label {
    color: var(--text2);
    font-size: 0.9rem;
    margin: 0.5rem 0;
    font-style: italic;
}

/* Glossary Tooltip Styles */
.glossary-term {
    color: var(--primary);
    text-decoration: underline dotted;
    text-underline-offset: 2px;
    cursor: help;
}

.glossary-term:hover {
    color: var(--primary-hover);
    text-decoration-style: solid;
}

.glossary-tooltip {
    display: none;
    position: fixed;
    z-index: 10000;
    background: var(--bg);
    border: 2px solid var(--primary);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    max-width: 350px;
    min-width: 280px;
    font-size: 0.9rem;
    pointer-events: auto;
}

.tooltip-header {
    background: #eff6ff;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    border-radius: 6px 6px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tooltip-header strong { color: var(--primary); font-size: 1rem; }
.tooltip-category { background: var(--primary); color: white; padding: 0.2rem 0.5rem; border-radius: 12px; font-size: 0.7rem; font-weight: 600; }
.tooltip-body { padding: 1rem; color: var(--text); line-height: 1.5; }
.tooltip-footer { padding: 0.75rem 1rem; border-top: 1px solid var(--border); background: var(--bg2); border-radius: 0 0 6px 6px; }
.tooltip-link { color: var(--primary); text-decoration: none; font-size: 0.85rem; font-weight: 600; }
.tooltip-link:hover { text-decoration: underline; }
.tooltip-def { margin: 0 0 0.5rem 0; font-size: 0.9rem; color: #111; }
.tooltip-def strong { color: #000; }
.tooltip-10yo { margin: 0; font-size: 0.85rem; color: #2563eb; }
.tooltip-10yo em { color: #1e3a8a; font-weight: 700; font-style: normal; }
.tooltip-expand { display: inline-block; color: var(--primary); font-weight: 600; font-size: 0.9rem; text-decoration: none; padding: 0.35rem 0.75rem; border: 1px solid var(--primary); border-radius: 6px; }
.tooltip-expand:hover { background: #eff6ff; text-decoration: none; }

/* Glossary full page: by subcategory */
.glossary-category { margin-bottom: 2.5rem; }
.glossary-category-title { margin-bottom: 1rem; padding-bottom: 0.5rem; border-bottom: 2px solid var(--primary); color: var(--primary); }
.glossary-entries { display: flex; flex-direction: column; gap: 1.5rem; }
.glossary-entry { padding: 1.25rem; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; }
.glossary-entry.glossary-highlight { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2); }
.glossary-term-title { margin: 0 0 0.5rem 0; font-size: 1.2rem; color: var(--primary); }
.glossary-meta { margin-bottom: 0.75rem; }
.glossary-tag { display: inline-block; margin-right: 0.5rem; margin-bottom: 0.25rem; padding: 0.2rem 0.5rem; background: #eff6ff; color: var(--primary); border-radius: 4px; font-size: 0.75rem; }
.glossary-full-def { margin: 0.75rem 0; line-height: 1.5; color: #111; }
.glossary-full-def .glossary-technical-label { color: #000; font-weight: 700; }
.glossary-10yo { margin: 0.75rem 0; line-height: 1.5; color: #2563eb; }
.glossary-10yo .glossary-10yo-label { color: #1e3a8a; font-weight: 700; }
.glossary-competing { margin: 0.75rem 0; line-height: 1.5; padding: 0.75rem; background: var(--bg2); border-radius: 6px; font-size: 0.95rem; color: #475569; }
.glossary-competing .glossary-competing-label { color: #334155; font-weight: 700; }

ul, ol { margin: 1rem 0; padding-left: 2rem; }
li { margin: 0.5rem 0; }
p { margin: 1rem 0; }
table { width: 100%; border-collapse: collapse; margin: 1rem 0; min-width: 0; }
th, td { padding: 0.5rem; border: 1px solid var(--border); }
th { background: var(--bg2); }
/* Module card tables: uniform white cells (must follow global th — fixes grey header / white body rows) */
.course-content table th,
.course-content table td,
.course-content .table-wrap th,
.course-content .table-wrap td {
    background-color: var(--bg);
}
/* Table wrapper: default = horizontal scroll if table is wider than container */
.table-wrap { overflow-x: auto; margin: 1rem 0; -webkit-overflow-scrolling: touch; }
.table-wrap > table { margin: 0; min-width: 640px; }

/* Text-heavy tables: reflow inside the column width instead of forcing a wide min-width */
.table-wrap.table-wrap--reflow > table {
    min-width: 0;
    width: 100%;
    table-layout: fixed;
}
.table-wrap.table-wrap--reflow th,
.table-wrap.table-wrap--reflow td {
    white-space: normal;
    overflow-wrap: break-word;
    word-wrap: break-word;
    hyphens: auto;
}
.table-wrap.table-wrap--reflow td code,
.table-wrap.table-wrap--reflow th code {
    white-space: normal;
    overflow-wrap: break-word;
    word-break: break-word;
}

/* Two-column descriptive tables (file | description): stable wrap */
.table-wrap.table-wrap--reflow table.content-table-two-col th:first-child,
.table-wrap.table-wrap--reflow table.content-table-two-col td:first-child {
    width: 32%;
    max-width: 12rem;
}
.table-wrap.table-wrap--reflow table.content-table-two-col th:nth-child(2),
.table-wrap.table-wrap--reflow table.content-table-two-col td:nth-child(2) {
    width: auto;
}

/* Flow-steps: narrow Step column, room for content so text doesn't squeeze or break badly */
.flow-steps { font-size: 0.9rem; table-layout: auto; }
.flow-steps th,
.flow-steps td { padding: 0.6rem 0.75rem; vertical-align: top; }
/* Step column: minimal width so "1" doesn't steal space; content columns get room */
.flow-steps th:first-child,
.flow-steps td:first-child { width: 1%; min-width: 2.5em; white-space: nowrap; }
.flow-steps th:nth-child(2),
.flow-steps td:nth-child(2) { min-width: 10em; }
.flow-steps th:nth-child(3),
.flow-steps td:nth-child(3) { min-width: 14em; }
.flow-steps th:nth-child(4),
.flow-steps td:nth-child(4) { min-width: 16em; }
.flow-steps td { word-break: break-word; overflow-wrap: break-word; }
.flow-steps td code { font-size: 0.85em; white-space: normal; }
/* Step column may stay compact; all content columns must wrap long prose and code */
.flow-steps th:nth-child(n+2),
.flow-steps td:nth-child(n+2) {
    white-space: normal;
    overflow-wrap: break-word;
    word-break: break-word;
}
.flow-steps td:nth-child(n+2) code {
    white-space: normal;
    word-break: break-word;
    overflow-wrap: break-word;
}
/* When first column has long labels (e.g. "Initialized genesis block"), add class flow-steps-wide-first */
.flow-steps-wide-first th:first-child,
.flow-steps-wide-first td:first-child { width: auto; min-width: 11em; white-space: normal; }

/* Messaging inventory (module-01b): six-column flow tables + handler lists */
.messaging-inventory-table.flow-steps th:nth-child(5),
.messaging-inventory-table.flow-steps td:nth-child(5) { min-width: 11em; }
.messaging-inventory-table.flow-steps th:nth-child(6),
.messaging-inventory-table.flow-steps td:nth-child(6) {
    min-width: 17em;
    max-width: 28rem;
    font-size: 0.86rem;
    line-height: 1.45;
}
.messaging-inventory-table .handler-detail-list {
    margin: 0;
    padding-left: 1.15em;
}
.messaging-inventory-table .handler-detail-list li { margin: 0.2em 0; }

.content-table { table-layout: auto; }
.content-table th,
.content-table td {
    vertical-align: top;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: break-word;
}
.content-table td code,
.content-table th code {
    white-space: normal;
    word-break: break-word;
    overflow-wrap: break-word;
}
.content-table th:first-child,
.content-table td:first-child { min-width: 6em; }
.content-table th:nth-child(2),
.content-table td:nth-child(2) { min-width: 8em; }
.content-table th:nth-child(3),
.content-table td:nth-child(3) { min-width: 10em; }
.content-table th:nth-child(4),
.content-table td:nth-child(4) { min-width: 10em; }

/* End-of-module: consolidated repo paths (Hyperscale-rs track) */
.hs-suggested-study-section {
    margin-top: 2rem;
    padding: 1.25rem 1.5rem;
    background: linear-gradient(165deg, var(--bg2) 0%, #f0f4ff 100%);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 1px 2px rgba(37, 99, 235, 0.06);
}
.hs-suggested-study-section > h2 {
    margin-top: 0;
    font-size: 1.25rem;
    color: var(--primary);
}
.hs-suggested-study-lead {
    font-size: 0.9rem;
    color: var(--text2);
    margin: 0.35rem 0 1rem;
    line-height: 1.5;
}
.hs-suggested-study-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
    background: var(--bg);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}
.hs-suggested-study-table thead th {
    background: var(--primary);
    color: #fff;
    font-weight: 600;
    text-align: left;
    padding: 0.55rem 0.75rem;
}
.hs-suggested-study-table tbody td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}
.hs-suggested-study-table tbody tr:last-child td { border-bottom: none; }
.hs-suggested-study-table tbody tr:hover td { background: rgba(37, 99, 235, 0.04); }
.hs-suggested-study-table td:first-child {
    font-weight: 600;
    color: var(--text);
    max-width: 12rem;
}
.hs-suggested-study-table td code { font-size: 0.84em; }

/* Crate groups / numbered first column (e.g. "1. First contact") */
.table-crate-groups th:first-child,
.table-crate-groups td:first-child { min-width: 12em; }
.table-crate-groups th,
.table-crate-groups td {
    vertical-align: top;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: break-word;
}
.table-crate-groups td code { white-space: normal; word-break: break-word; }

/* Transaction flow diagram (shared across modules) */
.tx-flow { --hyperscale-bg: #eff6ff; --hyperscale-border: var(--primary); --outside-bg: #f8fafc; --outside-border: #94a3b8; }
.tx-flow-legend { display: flex; gap: 1.5rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.tx-flow-legend span { display: inline-flex; align-items: center; gap: 0.5rem; font-size: 0.9rem; color: var(--text2); }
.tx-flow-legend .dot-hyperscale { width: 14px; height: 14px; border-radius: 4px; background: var(--hyperscale-bg); border: 2px solid var(--hyperscale-border); }
.tx-flow-legend .dot-outside { width: 14px; height: 14px; border-radius: 4px; background: var(--outside-bg); border: 2px solid var(--outside-border); }
.tx-flow-diagram { display: flex; flex-direction: column; gap: 0; position: relative; }
.flow-step { position: relative; display: flex; align-items: stretch; gap: 0; min-height: 52px; }
.flow-step-lane { width: 4px; flex-shrink: 0; border-radius: 2px; }
.flow-step-lane.hyperscale { background: var(--hyperscale-border); }
.flow-step-lane.outside { background: var(--outside-border); }
.flow-step-body { flex: 1; padding: 0.75rem 1rem; border: 2px solid var(--border); border-radius: 6px; margin-left: 8px; background: var(--bg); cursor: default; }
.flow-step.hyperscale .flow-step-body { border-color: var(--hyperscale-border); background: var(--hyperscale-bg); }
.flow-step.outside .flow-step-body { border-color: var(--outside-border); background: var(--outside-bg); }
.flow-step-arrow { text-align: center; padding: 2px 0; color: var(--text2); font-size: 1.2rem; }
.flow-step-title { font-weight: 700; font-size: 1rem; margin-bottom: 0.25rem; }
.flow-step-desc { font-size: 0.875rem; color: var(--text2); }
.flow-step-body a.crate-link { font-size: 0.8rem; color: var(--primary); }
.flow-step-popup { display: none; position: absolute; left: 100%; top: 50%; transform: translateY(-50%); margin-left: 10px; min-width: 180px; padding: 0.75rem 1rem; background: var(--bg); border: 2px solid var(--hyperscale-border); border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.15); z-index: 10; font-size: 0.875rem; pointer-events: none; }
.flow-step:hover .flow-step-popup { display: block; }
.flow-step-popup h4 { margin: 0 0 0.5rem; font-size: 0.8rem; text-transform: uppercase; color: var(--text2); }
.flow-step-popup ul { margin: 0; padding-left: 1.1rem; }
.flow-step-popup li { margin-bottom: 0.35rem; }
.flow-step-popup a { color: var(--primary); text-decoration: none; }
.flow-step-popup a:hover { text-decoration: underline; }
.flow-step-popup .outside-note { font-style: italic; color: var(--text2); margin-top: 0.5rem; }
@media (max-width: 640px) {
    .flow-step-popup { left: 0; right: 0; margin-left: 0; margin-right: 0; top: 100%; transform: none; margin-top: 6px; }
}

/* BFT step-by-step: JSON + formula blocks (module-04 dry flow) */
.bft-dry { margin-top: 2rem; }
.bft-dry-intro { padding: 1rem 1.25rem; background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%); border: 1px solid rgba(37, 99, 235, 0.3); border-radius: 8px; margin-bottom: 1.5rem; font-size: 0.95rem; }
.bft-dry-intro strong { color: var(--primary); }
.bft-step-card { margin-bottom: 2rem; padding: 1.25rem; background: var(--bg); border: 2px solid var(--border); border-radius: 10px; box-shadow: 0 2px 8px rgba(0,0,0,0.04); }
.bft-step-card:nth-child(even) { border-color: rgba(37, 99, 235, 0.25); background: #fafbff; }
.bft-step-num { display: inline-flex; align-items: center; justify-content: center; width: 2rem; height: 2rem; border-radius: 50%; background: var(--primary); color: white; font-weight: 800; font-size: 1rem; margin-right: 0.5rem; }
.bft-step-title { font-size: 1.15rem; font-weight: 700; color: var(--primary); margin-bottom: 0.5rem; display: flex; align-items: center; }
.bft-step-desc { font-size: 0.9rem; color: var(--text2); margin-bottom: 1rem; line-height: 1.5; }
.bft-json-block { margin: 1rem 0; padding: 1rem 1.25rem; background: #1e293b; color: #e2e8f0; border-radius: 8px; overflow-x: auto; font-family: ui-monospace, monospace; font-size: 0.8rem; line-height: 1.5; }
.bft-json-block code { background: transparent; color: #e2e8f0; padding: 0; }
.bft-json-block .json-key { color: #7dd3fc; }
.bft-json-block .json-str { color: #86efac; }
.bft-json-block .json-num { color: #fcd34d; }
.bft-formula-table { width: 100%; margin: 1rem 0; font-size: 0.9rem; border-collapse: collapse; table-layout: auto; }
.bft-formula-table th, .bft-formula-table td {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: break-word;
}
.bft-formula-table th { background: #eff6ff; color: var(--primary); font-weight: 600; }
.bft-formula-table td:first-child { font-weight: 500; min-width: 8em; }
.bft-formula-table code { font-size: 0.85em; white-space: normal; word-break: break-word; overflow-wrap: break-word; }
.bft-formula-list { margin: 0.5rem 0; padding-left: 1.25rem; }
.bft-summary-box { margin-top: 2rem; padding: 1.25rem; background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%); border: 2px solid rgba(16, 185, 129, 0.35); border-radius: 10px; }
.bft-summary-box h3 { margin: 0 0 0.75rem; font-size: 1.1rem; color: var(--secondary); }
.bft-summary-box .bft-formula-table { margin: 0.5rem 0; }

/* BFT design note / callout: why block-vote first, why cert chain */
.bft-design-callout { margin: 1.5rem 0; padding: 1.25rem 1.5rem; background: linear-gradient(135deg, #fefce8 0%, #fef9c3 100%); border: 2px solid rgba(180, 83, 9, 0.4); border-radius: 10px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.bft-design-callout .callout-label { display: inline-block; margin-bottom: 0.75rem; padding: 0.25rem 0.6rem; background: rgba(180, 83, 9, 0.2); color: #92400e; font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; border-radius: 4px; }
.bft-design-callout h3 { margin: 0 0 0.5rem; font-size: 1.1rem; color: #78350f; }
.bft-design-callout h4 { margin: 1rem 0 0.35rem; font-size: 1rem; color: #92400e; }
.bft-design-callout p { margin: 0 0 0.75rem; font-size: 0.95rem; line-height: 1.55; color: var(--text2); }
.bft-design-callout p:last-child { margin-bottom: 0; }
.bft-design-callout ul { margin: 0.35rem 0 0.75rem 1.25rem; padding: 0; font-size: 0.95rem; line-height: 1.55; color: var(--text2); }
.bft-design-callout li { margin-bottom: 0.25rem; }
.bft-design-callout .cert-chain { margin: 0.75rem 0; padding: 0.75rem 1rem; background: rgba(255,255,255,0.7); border-radius: 6px; font-family: ui-monospace, monospace; font-size: 0.85rem; }
.bft-design-callout .cert-chain strong { color: var(--primary); }

@media (max-width: 640px) {
    .bft-json-block { font-size: 0.75rem; padding: 0.75rem; }
}

/* Test runner page (test-modules.html) */
.test-wrap { background: var(--bg); padding: 1.5rem; margin: 1rem 0; border-radius: 8px; }
.test-pass { background: #d1fae5; padding: 0.75rem; margin: 0.5rem 0; border-radius: 4px; border-left: 4px solid var(--secondary); }
.test-fail { background: #fee2e2; padding: 0.75rem; margin: 0.5rem 0; border-radius: 4px; border-left: 4px solid var(--danger); }
.test-summary { margin-top: 1rem; font-weight: bold; }

/* End-to-end testing module: sim vs prod pillars, pipelines, test cards */
.e2e-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    margin: 1.25rem 0;
}
@media (max-width: 768px) {
    .e2e-split { grid-template-columns: 1fr; }
}
.e2e-pillar {
    border-radius: 12px;
    overflow: hidden;
    min-width: 0; /* grid column may shrink; avoid clipping unwrapped text without code wrap rules below */
    border: 2px solid var(--border);
    background: var(--bg);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}
.e2e-pillar-header {
    padding: 1rem 1.25rem;
    line-height: 1.35;
}
.e2e-pillar-heading {
    font-weight: 800;
    font-size: 1.05rem;
    letter-spacing: 0.02em;
    margin: 0 0 0.4rem;
}
.e2e-pillar-crate {
    margin: 0;
}
.e2e-pillar-crate code {
    display: inline-block;
    font-family: ui-monospace, 'Cascadia Code', 'Source Code Pro', Menlo, monospace;
    font-weight: 700;
    font-size: 0.88rem;
    padding: 0.35rem 0.55rem;
    border-radius: 6px;
    white-space: nowrap;
    vertical-align: middle;
}
.e2e-pillar-sim .e2e-pillar-crate code {
    background: rgba(255, 255, 255, 0.55);
    color: #1e3a8a;
    border: 1px solid rgba(37, 99, 235, 0.2);
}
.e2e-pillar-prod .e2e-pillar-crate code {
    background: rgba(255, 255, 255, 0.55);
    color: #064e3b;
    border: 1px solid rgba(16, 185, 129, 0.25);
}
.e2e-pillar-sim .e2e-pillar-header {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    color: #1e40af;
    border-bottom: 1px solid rgba(37, 99, 235, 0.25);
}
.e2e-pillar-prod .e2e-pillar-header {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: #065f46;
    border-bottom: 1px solid rgba(16, 185, 129, 0.3);
}
.e2e-pillar-body {
    padding: 1rem 1.25rem 1.25rem;
    font-size: 0.95rem;
    color: var(--text2);
    line-height: 1.55;
}
.e2e-pillar-body ul { margin: 0.5rem 0 0; padding-left: 1.2rem; }
.e2e-pillar-body li {
    margin-bottom: 0.35rem;
    overflow-wrap: anywhere;
    word-break: break-word;
}
/* Long identifiers in narrow two-column pillars must wrap; default <code> is often nowrap */
.e2e-pillar-body code {
    font-size: 0.88em;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
}

/* E2E module: short “why this shape” asides (pro / con in one line where useful) */
.e2e-design-note {
    font-size: 0.88rem;
    line-height: 1.52;
    color: var(--text2);
    margin: 0.6rem 0 0;
    padding: 0.45rem 0.65rem 0.5rem 0.75rem;
    border-left: 3px solid #6366f1;
    background: rgba(99, 102, 241, 0.07);
    border-radius: 0 6px 6px 0;
}
.e2e-design-note strong:first-child {
    color: #4338ca;
    font-size: 0.78rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    display: block;
    margin-bottom: 0.2rem;
}

.e2e-inline-why {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.88em;
    font-style: italic;
    color: var(--text2);
    line-height: 1.45;
}

.e2e-code-caption {
    font-size: 0.9rem;
    color: var(--text2);
    margin: 0 0 0.35rem;
}
.e2e-code-reads {
    font-size: 0.95rem;
    line-height: 1.55;
    color: var(--text2);
    padding-left: 1.25rem;
}

/* Production threading: logical CPUs vs io-loop (module-11) */
.hs-thread-cpu-diagram {
    margin: 1.25rem 0 1.5rem;
    padding: 1.25rem 1.25rem 1rem;
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid var(--border);
    border-radius: 12px;
    min-width: 0;
    overflow-x: auto;
}
.hs-diagram-legend {
    margin-bottom: 1.25rem;
}
/* Legend as table: swatch | short role | wrapping description (avoids flex/garbled runs) */
.hs-legend-table {
    width: 100%;
    max-width: 100%;
    margin: 0;
    border-collapse: collapse;
    table-layout: fixed;
    font-size: 0.88rem;
    line-height: 1.5;
}
.hs-legend-caption {
    caption-side: top;
    text-align: left;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text);
    padding: 0 0 0.65rem;
}
.hs-legend-table tbody tr {
    border-bottom: 1px solid rgba(148, 163, 184, 0.45);
}
.hs-legend-table tbody tr:last-child {
    border-bottom: none;
}
.hs-legend-table td,
.hs-legend-table th {
    vertical-align: top;
    padding: 0.55rem 0.5rem 0.6rem 0;
    border: none;
    background: transparent;
}
.hs-legend-swatch-cell {
    width: 2rem;
    padding-right: 0.35rem;
    padding-left: 0;
}
.hs-legend-label {
    width: 28%;
    min-width: 8.5rem;
    max-width: 12rem;
    font-weight: 700;
    font-size: 0.86rem;
    color: var(--text);
    text-align: left;
    line-height: 1.4;
    hyphens: auto;
    overflow-wrap: break-word;
    word-wrap: break-word;
}
.hs-legend-label code {
    font-size: 0.92em;
    word-break: break-word;
}
.hs-legend-desc {
    width: auto;
    color: var(--text2);
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;
    hyphens: auto;
}
.hs-legend-desc code {
    font-size: 0.9em;
    word-break: break-word;
}
@media (max-width: 560px) {
    .hs-legend-table {
        font-size: 0.82rem;
    }
    .hs-legend-label {
        width: 34%;
        min-width: 6.25rem;
        max-width: none;
    }
}
.hs-swatch {
    flex-shrink: 0;
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 4px;
    margin-top: 0.2rem;
    border: 1px solid rgba(0, 0, 0, 0.12);
    vertical-align: middle;
}
.hs-swatch--ioloop {
    background: linear-gradient(135deg, #bbf7d0 0%, #86efac 100%);
}
.hs-swatch--tokio {
    background: linear-gradient(135deg, #bfdbfe 0%, #93c5fd 100%);
}
.hs-swatch--pools {
    background: linear-gradient(135deg, #e9d5ff 0%, #d8b4fe 100%);
}
.hs-swatch--other {
    background: repeating-linear-gradient(
        -45deg,
        #e2e8f0,
        #e2e8f0 4px,
        #f1f5f9 4px,
        #f1f5f9 8px
    );
}
.hs-diagram-cpu-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin-bottom: 1rem;
}
@media (max-width: 900px) {
    .hs-diagram-cpu-row {
        grid-template-columns: 1fr;
    }
}
.hs-cpu {
    border-radius: 10px;
    border: 2px solid var(--border);
    background: var(--bg);
    min-width: 0;
    overflow: hidden;
}
.hs-cpu--affinity {
    border-color: #22c55e;
    box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.2);
}
.hs-cpu-label {
    font-size: 0.8rem;
    font-weight: 700;
    padding: 0.45rem 0.65rem;
    background: #f1f5f9;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
}
.hs-cpu--affinity .hs-cpu-label {
    background: linear-gradient(90deg, #ecfdf5 0%, #f1f5f9 100%);
}
.hs-cpu-badge {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.12rem 0.4rem;
    border-radius: 999px;
    background: #dcfce7;
    color: #166534;
}
.hs-cpu-badge--muted {
    background: #e2e8f0;
    color: #475569;
    font-weight: 600;
}
.hs-cpu-body {
    padding: 0.65rem 0.65rem 0.75rem;
    font-size: 0.82rem;
    line-height: 1.45;
}
.hs-thread-block {
    border-radius: 8px;
    padding: 0.45rem 0.55rem;
    margin-bottom: 0.45rem;
    border: 1px solid rgba(0, 0, 0, 0.08);
}
.hs-thread-block--ioloop {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    border-color: rgba(34, 197, 94, 0.35);
}
.hs-thread-block--tokio {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border-color: rgba(37, 99, 235, 0.25);
}
.hs-thread-block--pools {
    background: linear-gradient(135deg, #faf5ff 0%, #f3e8ff 100%);
    border-color: rgba(124, 58, 237, 0.25);
}
.hs-thread-block--other {
    background: #f8fafc;
    border-style: dashed;
    border-color: #cbd5e1;
    color: var(--text2);
}
.hs-thread-name {
    display: block;
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text);
    font-family: ui-monospace, monospace;
}
.hs-thread-detail {
    display: block;
    font-size: 0.78rem;
    color: var(--text2);
    margin-top: 0.15rem;
}
.hs-cpu-shared {
    font-size: 0.75rem;
    color: var(--text2);
    font-style: italic;
    padding: 0.35rem 0.25rem 0;
    border-top: 1px dashed var(--border);
    margin-top: 0.35rem;
}
.hs-diagram-arrows {
    padding: 0.65rem 0.75rem;
    background: var(--bg);
    border: 1px dashed #94a3b8;
    border-radius: 8px;
    font-size: 0.82rem;
}
.hs-arrow-label {
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.35rem;
    font-size: 0.85rem;
}
.hs-arrow-line {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.5rem;
    color: var(--text2);
}
.hs-arrow-glyph {
    font-size: 1.1rem;
    color: var(--primary);
    font-weight: 700;
}
.hs-arrow-from {
    font-size: 0.8rem;
}
.hs-arrow-to {
    font-size: 0.8rem;
    font-family: ui-monospace, monospace;
}

.e2e-pipeline {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    justify-content: center;
    gap: 0.35rem 0.25rem;
    margin: 1rem 0 1.5rem;
    padding: 1rem;
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 10px;
    border: 1px solid var(--border);
}
.e2e-pipeline-step {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    min-width: 6.5rem;
    max-width: 9rem;
    padding: 0.65rem 0.5rem;
    background: var(--bg);
    border: 2px solid #cbd5e1;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.35;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}
.e2e-pipeline-step .num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.65rem;
    height: 1.65rem;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 800;
    margin-bottom: 0.4rem;
}
.e2e-pipeline-arrow {
    align-self: center;
    color: #94a3b8;
    font-size: 1.25rem;
    font-weight: bold;
    padding: 0 0.15rem;
    user-select: none;
}
@media (max-width: 640px) {
    .e2e-pipeline-arrow { display: none; }
    .e2e-pipeline-step { max-width: none; width: 100%; flex-direction: row; gap: 0.75rem; text-align: left; }
    .e2e-pipeline-step .num { margin-bottom: 0; flex-shrink: 0; }
}

.e2e-test-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
    margin: 1rem 0;
}
.e2e-test-card {
    border: 2px solid var(--border);
    border-radius: 10px;
    padding: 1rem 1.1rem;
    background: var(--bg);
    transition: border-color 0.2s, box-shadow 0.2s;
}
.e2e-test-card:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.12);
}
.e2e-test-card h4 {
    margin: 0 0 0.5rem;
    font-size: 0.88rem;
    line-height: 1.35;
    color: var(--primary);
    font-family: ui-monospace, 'Cascadia Code', 'Source Code Pro', Menlo, monospace;
    font-weight: 700;
    word-break: normal;
    overflow-wrap: anywhere;
    hyphens: none;
}
.e2e-test-card .e2e-card-meta {
    font-size: 0.75rem;
    color: var(--text2);
    margin-bottom: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
}
.e2e-test-card ul {
    margin: 0;
    padding-left: 1.1rem;
    font-size: 0.88rem;
    color: var(--text2);
    line-height: 1.5;
}
.e2e-test-card li { margin-bottom: 0.3rem; }

.e2e-section-label {
    display: inline-block;
    margin: 1.5rem 0 0.5rem;
    padding: 0.3rem 0.65rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.e2e-section-label.sim { background: #dbeafe; color: #1e40af; }
.e2e-section-label.prod { background: #d1fae5; color: #065f46; }
.e2e-section-label.related { background: #fef3c7; color: #92400e; }

.e2e-diagram-box {
    margin: 1rem 0;
    padding: 1rem 1.25rem;
    background: #1e293b;
    color: #e2e8f0;
    border-radius: 10px;
    font-family: ui-monospace, 'Cascadia Code', monospace;
    font-size: 0.78rem;
    line-height: 1.45;
    overflow-x: auto;
    white-space: pre;
    border: 1px solid #334155;
}

.e2e-run-cmds {
    margin: 1rem 0;
    padding: 1rem 1.25rem;
    background: #f8fafc;
    border-radius: 8px;
    border-left: 4px solid var(--primary);
}
.e2e-run-cmds p { margin: 0 0 0.5rem; font-weight: 600; color: var(--text); }
.e2e-run-cmds code {
    display: block;
    margin: 0.35rem 0;
    padding: 0.5rem 0.65rem;
    background: #1e293b;
    color: #e2e8f0;
    border-radius: 6px;
    font-size: 0.85rem;
    overflow-x: auto;
}

/* E2E trace tables: intro card + icon per step + tinted rows */
.e2e-trace-panel {
    margin: 1rem 0 1.25rem;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid var(--border);
    box-shadow:
        0 4px 6px -1px rgba(15, 23, 42, 0.06),
        0 2px 4px -2px rgba(15, 23, 42, 0.05);
    background: var(--bg);
}
.e2e-trace-panel--sim {
    border-color: rgba(37, 99, 235, 0.22);
    box-shadow:
        0 4px 20px rgba(37, 99, 235, 0.08),
        0 1px 3px rgba(15, 23, 42, 0.06);
}
.e2e-trace-panel--prod {
    border-color: rgba(5, 150, 105, 0.28);
    box-shadow:
        0 4px 20px rgba(5, 150, 105, 0.09),
        0 1px 3px rgba(15, 23, 42, 0.06);
}
.e2e-trace-panel > .table-wrap {
    margin: 0;
}
.e2e-trace-intro {
    padding: 1.1rem 1.25rem 1rem;
    border-bottom: 1px solid var(--border);
}
.e2e-trace-intro--sim {
    background: linear-gradient(135deg, #eff6ff 0%, #f0f9ff 45%, #ecfeff 100%);
}
.e2e-trace-intro--prod {
    background: linear-gradient(135deg, #ecfdf5 0%, #f0fdf4 40%, #f7fee7 100%);
}
.e2e-trace-intro-body {
    font-size: 0.95rem;
    line-height: 1.55;
    color: var(--text);
}
.e2e-trace-intro-body p {
    margin: 0 0 0.5rem;
}
.e2e-trace-intro-body p:last-child {
    margin-bottom: 0;
}
.e2e-trace-intro-kicker {
    margin: 0 0 0.45rem !important;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text2);
}
.e2e-trace-intro--sim .e2e-trace-intro-kicker {
    color: #1d4ed8;
}
.e2e-trace-intro--prod .e2e-trace-intro-kicker {
    color: #047857;
}

.e2e-trace-table {
    margin: 0;
    border: none;
    border-radius: 0;
    border-collapse: collapse;
}
.e2e-trace-panel .e2e-trace-table th,
.e2e-trace-panel .e2e-trace-table td {
    border-left: none;
    border-right: none;
}
.e2e-trace-panel .e2e-trace-table thead th {
    border-top: none;
}
.e2e-trace-table thead th {
    padding: 0.75rem 1rem;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 800;
    border-bottom: 2px solid rgba(15, 23, 42, 0.08);
}
.e2e-trace-panel--sim .e2e-trace-table thead {
    background: linear-gradient(180deg, #dbeafe 0%, #bfdbfe 100%);
    color: #1e3a8a;
}
.e2e-trace-panel--sim .e2e-trace-table thead th {
    background: transparent;
    color: #1e3a8a;
}
.e2e-trace-panel--prod .e2e-trace-table thead {
    background: linear-gradient(180deg, #a7f3d0 0%, #6ee7b7 100%);
    color: #064e3b;
}
.e2e-trace-panel--prod .e2e-trace-table thead th {
    background: transparent;
    color: #064e3b;
}
.e2e-trace-table tbody tr {
    transition: background 0.15s ease;
}
.e2e-trace-table tbody tr:nth-child(even) {
    background: rgba(248, 250, 252, 0.85);
}
.e2e-trace-table tbody tr:hover {
    background: rgba(239, 246, 255, 0.95);
}
.e2e-trace-panel--prod .e2e-trace-table tbody tr:hover {
    background: rgba(236, 253, 245, 0.95);
}
.e2e-trace-row td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.25);
}
.e2e-trace-row:last-child td {
    border-bottom: none;
}
.e2e-trace-row {
    --e2e-accent: #64748b;
    box-shadow: inset 4px 0 0 0 var(--e2e-accent);
}
.e2e-trace-panel--sim .e2e-trace-row:nth-child(1) {
    --e2e-accent: #0284c7;
}
.e2e-trace-panel--sim .e2e-trace-row:nth-child(2) {
    --e2e-accent: #16a34a;
}
.e2e-trace-panel--sim .e2e-trace-row:nth-child(3) {
    --e2e-accent: #9333ea;
}
.e2e-trace-panel--sim .e2e-trace-row:nth-child(4) {
    --e2e-accent: #d97706;
}
.e2e-trace-panel--sim .e2e-trace-row:nth-child(5) {
    --e2e-accent: #0891b2;
}
.e2e-trace-panel--sim .e2e-trace-row:nth-child(6) {
    --e2e-accent: #4f46e5;
}
.e2e-trace-panel--sim .e2e-trace-row:nth-child(7) {
    --e2e-accent: #059669;
}
.e2e-trace-panel--sim .e2e-trace-row:nth-child(8) {
    --e2e-accent: #db2777;
}
.e2e-trace-panel--sim .e2e-trace-row:nth-child(9) {
    --e2e-accent: #ea580c;
}
.e2e-trace-panel--sim .e2e-trace-row:nth-child(10) {
    --e2e-accent: #0d9488;
}
.e2e-trace-panel--prod .e2e-trace-row:nth-child(1) {
    --e2e-accent: #57534e;
}
.e2e-trace-panel--prod .e2e-trace-row:nth-child(2) {
    --e2e-accent: #4f46e5;
}
.e2e-trace-panel--prod .e2e-trace-row:nth-child(3) {
    --e2e-accent: #0284c7;
}
.e2e-trace-panel--prod .e2e-trace-row:nth-child(4) {
    --e2e-accent: #7c3aed;
}
.e2e-trace-panel--prod .e2e-trace-row:nth-child(5) {
    --e2e-accent: #15803d;
}
.e2e-trace-panel--prod .e2e-trace-row:nth-child(6) {
    --e2e-accent: #dc2626;
}

.e2e-trace-step-text {
    min-width: 0;
}
.e2e-trace-step-text code {
    font-size: 0.88em;
}

.table-wrap.table-wrap--reflow table.e2e-trace-table.content-table-two-col th:first-child,
.table-wrap.table-wrap--reflow table.e2e-trace-table.content-table-two-col td:first-child {
    width: 38%;
    max-width: 22rem;
    min-width: 13.5rem;
}
@media (max-width: 720px) {
    .table-wrap.table-wrap--reflow table.e2e-trace-table.content-table-two-col th:first-child,
    .table-wrap.table-wrap--reflow table.e2e-trace-table.content-table-two-col td:first-child {
        min-width: 0;
        max-width: none;
        width: auto;
    }
}