/* === CISSP Compendium — mobile-first wiki styles === */

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

:root {
    --primary: #3B5998;
    --primary-light: #4A6FB5;
    --primary-dark: #2D4373;
    --bg: #F8F9FA;
    --bg-card: #FFFFFF;
    --bg-elevated: #FFFFFF;
    --text: #2D3436;
    --text-light: #636E72;
    --text-muted: #95A5A6;
    --link: #3B5998;
    --link-hover: #2D4373;
    --green: #27AE60;
    --green-light: #E8F8F0;
    --red: #E74C3C;
    --red-light: #FDE8E6;
    --gold: #F39C12;
    --gold-light: #FEF5E7;
    --purple: #8E44AD;
    --purple-light: #F4ECF7;
    --border: #DFE6E9;
    --border-light: #ECF0F1;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.12);
    --shadow-xl: 0 8px 32px rgba(0,0,0,0.16);
    --radius: 8px;
    --radius-lg: 12px;
    --radius-sm: 4px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, SFMono-Regular, "SF Mono", Consolas, monospace;
    --transition: 0.18s ease;
    --topbar-h: 56px;
    --sidebar-w: 280px;
}

html, body {
    height: 100%;
    background: var(--bg);
}

body {
    font-family: var(--font);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overscroll-behavior-y: contain;
}

#app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.hidden { display: none !important; }

/* === Loader === */
.loader {
    position: fixed;
    inset: 0;
    background: var(--bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    z-index: 1000;
}
.loader p { color: var(--text-light); font-size: 14px; }
.loader-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* === Top bar === */
.top-bar {
    position: sticky;
    top: 0;
    z-index: 50;
    height: var(--topbar-h);
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    padding: 0 8px;
    box-shadow: var(--shadow);
}
.home-link {
    flex: 1;
    text-align: center;
    color: white;
    text-decoration: none;
    font-weight: 600;
    font-size: 16px;
    padding: 0 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.icon-btn {
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    border-radius: var(--radius);
    font-size: 22px;
    transition: background var(--transition);
}
.icon-btn:active { background: rgba(255,255,255,0.15); }
.search-icon { display: inline-block; transform: rotate(-45deg); font-size: 22px; }

.hamburger,
.hamburger::before,
.hamburger::after {
    display: block;
    width: 22px;
    height: 2px;
    background: white;
    border-radius: 2px;
    transition: transform var(--transition);
}
.hamburger {
    position: relative;
}
.hamburger::before,
.hamburger::after {
    content: '';
    position: absolute;
    left: 0;
}
.hamburger::before { top: -7px; }
.hamburger::after  { top:  7px; }

/* === Sidebar === */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-w);
    max-width: 86vw;
    background: var(--bg-card);
    box-shadow: var(--shadow-xl);
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 200;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.sidebar.open { transform: translateX(0); }

.sidebar-header {
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    background: var(--primary);
    color: white;
    flex-shrink: 0;
}
.sidebar-header h2 { font-size: 18px; font-weight: 600; }
.sidebar-header .icon-btn { font-size: 28px; }

.domain-nav {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}
.domain {
    border-bottom: 1px solid var(--border-light);
}
.domain-header {
    width: 100%;
    text-align: left;
    background: transparent;
    border: none;
    padding: 14px 16px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    transition: background var(--transition);
}
.domain-header:active { background: var(--border-light); }
.domain-header .chevron {
    width: 10px;
    height: 10px;
    border-right: 2px solid var(--text-light);
    border-bottom: 2px solid var(--text-light);
    transform: rotate(-45deg);
    transition: transform var(--transition);
}
.domain.open .domain-header .chevron { transform: rotate(45deg); }
.domain-number {
    display: inline-block;
    width: 24px;
    height: 24px;
    line-height: 24px;
    text-align: center;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    font-size: 12px;
    margin-right: 8px;
    flex-shrink: 0;
}
.domain-title { flex: 1; line-height: 1.3; }
.domain-count {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
    background: var(--bg);
    padding: 2px 8px;
    border-radius: 10px;
}

.topic-list {
    list-style: none;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
    background: var(--bg);
}
.domain.open .topic-list { max-height: 2000px; }
.topic-list li a {
    display: block;
    padding: 10px 16px 10px 48px;
    color: var(--text);
    text-decoration: none;
    font-size: 14px;
    border-left: 3px solid transparent;
    transition: background var(--transition), border-color var(--transition);
}
.topic-list li a:active,
.topic-list li a.active {
    background: var(--bg-card);
    border-left-color: var(--primary);
    color: var(--primary);
    font-weight: 500;
}
.topic-list .category-label {
    padding: 8px 16px 4px 48px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    font-weight: 600;
}

.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    background: var(--bg);
    flex-shrink: 0;
}
.filter-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-light);
    cursor: pointer;
}
.filter-toggle input { width: 16px; height: 16px; }
.filter-toggle + .filter-toggle { margin-top: 8px; }
.reset-btn {
    display: block;
    width: 100%;
    margin-top: 10px;
    padding: 8px 10px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-muted);
    font-size: 12px;
    cursor: pointer;
    transition: all var(--transition);
}
.reset-btn:active { background: var(--bg-card); }

.backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 150;
    opacity: 0;
    transition: opacity 0.25s ease;
}
.backdrop:not(.hidden) { opacity: 1; }

/* === Search overlay === */
.overlay {
    position: fixed;
    inset: 0;
    background: var(--bg);
    z-index: 300;
    display: flex;
    flex-direction: column;
}
.overlay-header {
    height: var(--topbar-h);
    padding: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-card);
}
.overlay-header input {
    flex: 1;
    height: 40px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 16px;
    font-family: var(--font);
    background: var(--bg);
}
.overlay-header input:focus { outline: none; border-color: var(--primary); background: white; }
.overlay-header .icon-btn { color: var(--text); }

.search-results {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}
.search-result {
    display: block;
    padding: 12px 16px;
    color: var(--text);
    text-decoration: none;
    border-bottom: 1px solid var(--border-light);
}
.search-result:active { background: var(--bg-card); }
.search-result-title {
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 2px;
}
.search-result-meta {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    gap: 8px;
    align-items: center;
}
.search-result-snippet {
    margin-top: 4px;
    font-size: 13px;
    color: var(--text-light);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.search-empty {
    padding: 32px 16px;
    text-align: center;
    color: var(--text-muted);
}

/* === Content === */
.content {
    flex: 1;
    padding: 16px;
    padding-bottom: 64px;
    max-width: 760px;
    margin: 0 auto;
    width: 100%;
}

.topic-page { background: var(--bg-card); border-radius: var(--radius-lg); padding: 20px; box-shadow: var(--shadow); position: relative; }
.understood-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: var(--radius);
    border: 1.5px solid var(--border);
    background: var(--bg-card);
    color: var(--text-light);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    margin: 0 0 14px;
    width: 100%;
    justify-content: center;
}
.understood-btn:active { transform: scale(0.98); }
.understood-btn.is-understood {
    background: var(--green-light);
    color: var(--green);
    border-color: var(--green);
}
.understood-btn::before {
    content: '○';
    font-size: 16px;
    line-height: 1;
}
.understood-btn.is-understood::before { content: '✓'; }

.topic-check {
    display: inline-block;
    width: 16px;
    color: var(--green);
    font-weight: 700;
    margin-left: 4px;
    flex-shrink: 0;
}
.topic-list li a {
    display: flex;
    align-items: center;
    gap: 4px;
    justify-content: space-between;
}
.topic-list li a > span:first-child { flex: 1; }

.understood-meta {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--green);
    font-weight: 600;
}

@media (min-width: 700px) {
    .understood-btn {
        position: absolute;
        top: 20px;
        right: 20px;
        width: auto;
        margin: 0;
    }
}
.topic-breadcrumb {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.topic-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
    line-height: 1.25;
}
.topic-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 16px;
}
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.badge-category { background: var(--bg); color: var(--text-light); border: 1px solid var(--border); }
.badge-covered  { background: var(--green-light); color: var(--green); }
.badge-partial  { background: var(--gold-light); color: var(--gold); }
.badge-beyond   { background: var(--purple-light); color: var(--purple); }
.badge-sybex    { background: var(--bg); color: var(--text-light); border: 1px solid var(--border); font-weight: 500; text-transform: none; }
.badge-exam-critical {
    background: #FFEEEC;
    color: #C0392B;
    border: 1px solid #F5B7B1;
    font-weight: 700;
}

/* ===== Exam-critical highlighting (topic cards, sidebar, inline links) ===== */
.exam-star {
    color: #E74C3C;
    font-weight: 700;
    margin-right: 4px;
    display: inline-block;
    line-height: 1;
}
.topic-link-card.is-exam-critical {
    border-left: 3px solid #E74C3C;
}
.related-card.is-exam-critical {
    border-left: 3px solid #E74C3C;
}
.topic-list li a.is-exam-critical {
    color: #C0392B;
    font-weight: 600;
}
a.topic-link.is-exam-critical {
    color: #C0392B;
    border-bottom-color: #E74C3C;
}
@media (hover: hover) {
    a.topic-link.is-exam-critical:hover { background: #FFEEEC; }
}

.topic-section {
    margin-top: 20px;
}
.topic-section h3 {
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--primary);
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 2px solid var(--border-light);
}
.topic-summary {
    font-size: 17px;
    line-height: 1.65;
    color: var(--text);
    background: var(--bg);
    padding: 14px 16px;
    border-radius: var(--radius);
    border-left: 4px solid var(--primary);
}
.topic-prose {
    font-size: 15px;
    line-height: 1.7;
}
.topic-prose p + p { margin-top: 12px; }
.topic-prose strong { color: var(--text); font-weight: 600; }
.topic-prose ul, .topic-prose ol { margin: 10px 0 10px 22px; }
.topic-prose li { margin: 4px 0; }
.topic-prose em, .topic-summary em, .manager-callout em,
.fact-list em, .trap-list em { font-style: italic; color: var(--text); }
.topic-prose code, .topic-summary code, .manager-callout code,
.fact-list code, .trap-list code {
    font-family: var(--mono);
    font-size: 0.92em;
    background: var(--bg);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 1px 5px;
}

.fact-list, .trap-list { list-style: none; }
.fact-list li, .trap-list li {
    position: relative;
    padding: 8px 8px 8px 28px;
    margin-bottom: 6px;
    border-radius: var(--radius);
    font-size: 15px;
    line-height: 1.5;
}
.fact-list li { background: var(--green-light); }
.fact-list li::before {
    content: '✓';
    position: absolute;
    left: 10px;
    top: 8px;
    color: var(--green);
    font-weight: 700;
}
.trap-list li { background: var(--red-light); }
.trap-list li::before {
    content: '⚠';
    position: absolute;
    left: 10px;
    top: 8px;
    color: var(--red);
    font-weight: 700;
}

.question-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.question-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
}
.question-text {
    font-size: 15px;
    line-height: 1.55;
    margin-bottom: 12px;
    font-weight: 500;
}
.question-choices {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.choice-btn {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    text-align: left;
    font-family: var(--font);
    font-size: 14px;
    color: var(--text);
    cursor: pointer;
    transition: all var(--transition);
    line-height: 1.4;
}
.choice-btn:active { transform: scale(0.99); }
.choice-letter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--bg);
    color: var(--text-light);
    font-weight: 700;
    font-size: 12px;
    flex-shrink: 0;
}
.choice-text { flex: 1; }
.choice-btn.correct {
    background: var(--green-light);
    border-color: var(--green);
    color: var(--green);
}
.choice-btn.correct .choice-letter { background: var(--green); color: white; }
.choice-btn.incorrect {
    background: var(--red-light);
    border-color: var(--red);
    color: var(--red);
}
.choice-btn.incorrect .choice-letter { background: var(--red); color: white; }
.choice-btn:disabled { cursor: default; }
.question-explanation {
    margin-top: 12px;
    padding: 10px 12px;
    background: var(--gold-light);
    border-left: 3px solid var(--gold);
    border-radius: var(--radius-sm);
    font-size: 14px;
    line-height: 1.5;
}

@media (hover: hover) {
    .choice-btn:not(:disabled):hover {
        border-color: var(--primary);
        background: var(--bg-card);
    }
}

.manager-callout {
    background: var(--gold-light);
    border-left: 4px solid var(--gold);
    padding: 14px 16px;
    border-radius: var(--radius);
    font-size: 15px;
    line-height: 1.6;
}
.manager-callout::before {
    content: '👔 Think Like a Manager';
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--gold);
    font-weight: 700;
    margin-bottom: 6px;
}

.related-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}
.related-card {
    display: block;
    padding: 12px 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text);
    transition: border-color var(--transition), transform var(--transition);
}
.related-card:active {
    transform: scale(0.98);
    border-color: var(--primary);
}
.related-card-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--primary);
    margin-bottom: 2px;
}
.related-card.is-understood {
    border-color: var(--green);
    background: var(--green-light);
}
.related-card.is-understood .related-card-title { color: var(--green); }
.topic-link-card.is-understood .topic-link-card-title { color: var(--green); }
.related-card-summary {
    font-size: 12px;
    color: var(--text-light);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* === Glossary term inline pill === */
.gloss-term {
    color: var(--primary);
    border-bottom: 1px dashed var(--primary-light);
    cursor: help;
    padding: 0 1px;
    transition: background var(--transition);
}
.gloss-term:hover, .gloss-term:focus {
    background: var(--gold-light);
    outline: none;
}
.topic-link {
    color: var(--link);
    text-decoration: none;
    border-bottom: 1px solid var(--link);
}
.topic-link:hover { color: var(--link-hover); }

/* === Tooltip === */
.tooltip {
    position: fixed;
    z-index: 400;
    max-width: 320px;
    background: var(--text);
    color: white;
    padding: 12px 14px;
    border-radius: var(--radius);
    font-size: 13px;
    line-height: 1.5;
    box-shadow: var(--shadow-xl);
    pointer-events: auto;
}
.tooltip::after {
    content: '';
    position: absolute;
    width: 0;
    height: 0;
    border: 6px solid transparent;
}
.tooltip[data-pos="bottom"]::after {
    top: -12px;
    left: var(--arrow-x, 20px);
    border-bottom-color: var(--text);
}
.tooltip[data-pos="top"]::after {
    bottom: -12px;
    left: var(--arrow-x, 20px);
    border-top-color: var(--text);
}
.tooltip-term {
    font-weight: 700;
    margin-bottom: 4px;
    color: #FFD479;
}
.tooltip-link {
    display: inline-block;
    margin-top: 8px;
    color: #82B7FF;
    background: transparent;
    border: none;
    padding: 4px 0;
    font-size: 12px;
    font-family: var(--font);
    text-decoration: none;
    border-bottom: 1px solid #82B7FF;
    cursor: pointer;
}
.tooltip-link:active { color: #B7D1FF; }

/* === Domain index (home) === */
.welcome {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow);
    margin-bottom: 16px;
}
.welcome h1 { font-size: 22px; margin-bottom: 8px; color: var(--primary); }
.welcome p { font-size: 14px; color: var(--text-light); line-height: 1.6; }
.welcome p + p { margin-top: 8px; }

.progress-meter {
    margin-top: 14px;
    background: var(--bg);
    height: 10px;
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}
.progress-meter-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--green) 0%, var(--green) 100%);
    transition: width 0.4s ease;
}
.progress-meter-label {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-light);
}

.domain-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}
.domain-tile {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 16px;
    box-shadow: var(--shadow);
    text-decoration: none;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 14px;
    transition: transform var(--transition);
}
.domain-tile:active { transform: scale(0.98); }
.domain-tile-num {
    width: 40px;
    height: 40px;
    line-height: 40px;
    text-align: center;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    font-weight: 700;
    font-size: 16px;
    flex-shrink: 0;
}
.domain-tile-info { flex: 1; min-width: 0; }
.domain-tile-name { font-weight: 600; font-size: 15px; margin-bottom: 2px; }
.domain-tile-count { font-size: 12px; color: var(--text-muted); }

/* === Domain index page === */
.domain-index { background: var(--bg-card); border-radius: var(--radius-lg); padding: 20px; box-shadow: var(--shadow); }
.domain-index h1 { font-size: 22px; color: var(--primary); margin-bottom: 4px; }
.domain-index .subtitle { color: var(--text-light); font-size: 14px; margin-bottom: 18px; }
.category-block { margin-top: 18px; }
.category-block h3 {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-muted);
    margin-bottom: 8px;
}
.topic-link-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-light);
    text-decoration: none;
    color: var(--text);
}
.topic-link-card:last-child { border-bottom: none; }
.topic-link-card-info { flex: 1; min-width: 0; padding-right: 12px; }
.topic-link-card-title { font-weight: 600; font-size: 15px; margin-bottom: 2px; }
.topic-link-card-summary {
    font-size: 13px;
    color: var(--text-light);
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* === Desktop layout === */
@media (min-width: 900px) {
    :root {
        --topbar-h: 60px;
    }
    .top-bar #menu-btn { display: none; }
    .sidebar {
        transform: translateX(0);
        box-shadow: none;
        border-right: 1px solid var(--border);
        top: var(--topbar-h);
    }
    .backdrop { display: none !important; }
    .content {
        margin-left: var(--sidebar-w);
        padding: 24px 32px;
        max-width: 880px;
    }
    .home-link { text-align: left; padding-left: 20px; }
    .related-grid { grid-template-columns: repeat(2, 1fr); }
    .domain-grid { grid-template-columns: repeat(2, 1fr); }
    .topic-page { padding: 28px 32px; }
    .topic-title { font-size: 28px; }
}

@media (min-width: 1200px) {
    .content { max-width: 960px; }
}

/* Use hover affordances only on real hover devices */
@media (hover: hover) {
    .icon-btn:hover { background: rgba(255,255,255,0.15); }
    .domain-header:hover { background: var(--bg); }
    .topic-list li a:hover {
        background: var(--bg-card);
        border-left-color: var(--primary-light);
    }
    .related-card:hover { border-color: var(--primary); }
    .domain-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
    .gloss-term:hover { background: var(--gold-light); }
    .study-aid-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
}

/* ===== Study aids (cheat sheets + scenarios) ===== */
.study-aids-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin: 16px 0 24px;
}
@media (min-width: 600px) {
    .study-aids-grid { grid-template-columns: repeat(2, 1fr); }
}
.study-aid-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    text-decoration: none;
    color: var(--text);
    transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
    box-shadow: var(--shadow);
}
.study-aid-icon {
    font-size: 28px;
    line-height: 1;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--primary);
    flex-shrink: 0;
}
.study-aid-cheatsheet .study-aid-icon {
    background: var(--gold-light);
    color: var(--gold);
}
.study-aid-scenario .study-aid-icon {
    background: var(--purple-light);
    color: var(--purple);
}
.study-aid-title {
    font-weight: 600;
    font-size: 16px;
    line-height: 1.25;
}
.study-aid-sub {
    font-size: 13px;
    color: var(--text-light);
    margin-top: 2px;
}

/* ===== Cheat sheet page ===== */
.cheatsheet-page {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow);
}
.cheat-subtitle {
    color: var(--text-light);
    font-size: 14px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 16px;
}
.cheat-section {
    margin-bottom: 28px;
    padding-bottom: 4px;
}
.cheat-section + .cheat-section { border-top: 1px solid var(--border-light); padding-top: 20px; }
.cheat-heading {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary-dark);
    margin: 0 0 12px;
    line-height: 1.3;
}
.cheat-body { font-size: 14.5px; line-height: 1.6; }
.cheat-body p, .cheat-body ul, .cheat-body ol { margin: 8px 0; }
.cheat-body ul, .cheat-body ol { padding-left: 22px; }
.cheat-body li + li { margin-top: 4px; }

@media (min-width: 768px) {
    .cheatsheet-page { padding: 28px 32px; }
    .cheat-heading { font-size: 20px; }
}

/* ===== Markdown tables (used inside prose / cheat sheets) ===== */
.md-table-wrap {
    overflow-x: auto;
    margin: 12px 0;
    -webkit-overflow-scrolling: touch;
}
.md-table {
    border-collapse: collapse;
    width: 100%;
    font-size: 13.5px;
}
.md-table th, .md-table td {
    border: 1px solid var(--border);
    padding: 6px 10px;
    text-align: left;
    vertical-align: top;
}
.md-table thead { background: var(--bg); }
.md-table th { font-weight: 600; color: var(--primary-dark); }
.md-table tbody tr:nth-child(even) { background: var(--bg); }

/* ===== Scenario page ===== */
.scenario-page {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow);
}
.scenario-summary {
    font-size: 15px;
    color: var(--text-light);
    font-style: italic;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-light);
}
@media (min-width: 768px) {
    .scenario-page { padding: 28px 32px; }
}
