/* Curiosity — by Ade
   Aesthetic: Warm Editorial — a beautifully typeset learning journal
   Typography: Instrument Serif (display) + DM Sans (body)
   Palette: Deep navy base, warm amber accent, coral highlights

   Fonts loaded via <link> in base.html with media="print" swap trick
   to avoid render-blocking @import (bundle-defer-third-party).
*/

:root {
    --bg: #0c0e14;
    --bg-warm: #100f16;
    --surface: #17161f;
    --surface-hover: #1e1d28;
    --surface-raised: #222131;
    --border: #3d3b4d;
    --border-subtle: #1f1e2a;
    --text: #ede9e3;
    --text-secondary: #c4bfb6;
    --text-muted: #908a83;
    --accent: #e8a44a;
    --accent-hover: #d4923d;
    --accent-glow: rgba(232, 164, 74, 0.15);
    --accent-subtle: rgba(232, 164, 74, 0.08);
    --coral: #e07a5f;
    --coral-subtle: rgba(224, 122, 95, 0.12);
    --green: #81b29a;
    --green-subtle: rgba(129, 178, 154, 0.12);
    --yellow: #f2cc8f;
    --yellow-subtle: rgba(242, 204, 143, 0.12);
    --red: #e07a5f;
    --red-subtle: rgba(224, 122, 95, 0.12);
    --font-display: 'Instrument Serif', Georgia, serif;
    --font-body: 'DM Sans', -apple-system, sans-serif;
    --radius: 16px;
    --radius-sm: 10px;
    --radius-xs: 6px;
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.15);
    --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.2);
    --shadow-glow: 0 0 40px var(--accent-glow);
}

/* ── RESET & BASE ──────────────────────────────────────────────────── */

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

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    line-height: 1.65;
    min-height: 100vh;
    font-weight: 400;
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* Subtle grain texture */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 9999;
}

::selection { background: var(--accent); color: var(--bg); }

a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent-hover); }

/* Accessible focus indicators (#2) */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
:focus:not(:focus-visible) { outline: none; }

h1, h2, h3, h4 {
    font-family: var(--font-display);
    font-weight: 400;
    line-height: 1.2;
    color: var(--text);
}

/* ── ENTRANCE ANIMATIONS ───────────────────────────────────────────── */

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-16px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes shimmer {
    0% { background-position: -200% center; }
    100% { background-position: 200% center; }
}

@keyframes pulse-dot {
    0%, 100% { box-shadow: 0 0 0 0 rgba(129, 178, 154, 0.4); }
    50% { box-shadow: 0 0 0 6px rgba(129, 178, 154, 0); }
}

/* ── NAV ───────────────────────────────────────────────────────────── */

.nav {
    background: rgba(16, 15, 22, 0.85);
    backdrop-filter: blur(20px) saturate(1.2);
    -webkit-backdrop-filter: blur(20px) saturate(1.2);
    border-bottom: 1px solid var(--border-subtle);
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-inner {
    max-width: 920px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
    color: var(--text);
    font-family: var(--font-display);
    font-size: 1.3rem;
    letter-spacing: -0.01em;
    transition: opacity var(--transition);
}
.nav-brand:hover { opacity: 0.8; color: var(--text); }
.nav-brand svg { flex-shrink: 0; }

.nav-links { display: flex; gap: 0.25rem; align-items: center; }
.nav-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0.4rem 0.85rem;
    border-radius: var(--radius-xs);
    transition: all var(--transition);
    letter-spacing: 0.01em;
}
.nav-links a:hover { color: var(--text); background: var(--accent-subtle); }
.nav-user {
    background: var(--accent-subtle);
    color: var(--accent) !important;
}

/* ── Hamburger toggle (hidden on desktop) ──────────────────────── */
.nav-toggle {
    display: none;
    background: transparent;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xs);
    width: 38px;
    height: 38px;
    padding: 0;
    cursor: pointer;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: border-color var(--transition);
    -webkit-tap-highlight-color: transparent;
}
.nav-toggle:hover { border-color: var(--accent); }
.nav-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.nav-toggle-bar {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: transform 0.2s ease, opacity 0.2s ease;
}
.nav-toggle.open .nav-toggle-bar:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-toggle.open .nav-toggle-bar:nth-child(2) { opacity: 0; }
.nav-toggle.open .nav-toggle-bar:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ── Mobile nav: collapse links into a dropdown ────────────────── */
@media (max-width: 720px) {
    .nav { padding: 0 1rem; }
    .nav-toggle { display: flex; }
    .nav-links {
        display: none;
        position: absolute;
        top: 60px;
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 0.6rem 1rem 0.9rem;
        background: rgba(16, 15, 22, 0.97);
        backdrop-filter: blur(20px) saturate(1.2);
        -webkit-backdrop-filter: blur(20px) saturate(1.2);
        border-bottom: 1px solid var(--border-subtle);
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    }
    .nav-links.open { display: flex; }
    .nav-links a {
        padding: 0.75rem 0.9rem;
        font-size: 0.95rem;
        border-radius: var(--radius-xs);
    }
    .nav-links .nav-streak {
        align-self: flex-start;
        margin: 0.4rem 0.9rem 0.2rem;
    }
}

.nav-admin { border-bottom-color: var(--accent); }
.nav-admin-badge {
    font-family: var(--font-body);
    font-size: 0.6rem;
    color: var(--accent);
    background: var(--accent-subtle);
    padding: 0.2rem 0.55rem;
    border-radius: var(--radius-xs);
    margin-left: 0.35rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    vertical-align: middle;
}

/* Skip-to-content link (#10) */
.skip-link {
    position: absolute;
    top: -100%;
    left: 1rem;
    background: var(--accent);
    color: var(--bg);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-xs);
    font-size: 0.85rem;
    font-weight: 600;
    z-index: 200;
    transition: top 0.2s;
}
.skip-link:focus {
    top: 0.5rem;
    color: var(--bg);
}

/* ── LAYOUT ────────────────────────────────────────────────────────── */

.main {
    max-width: 920px;
    margin: 0 auto;
    padding: 2.5rem 2rem;
    min-height: calc(100vh - 130px);
}

.container { max-width: 760px; }

/* ── HERO (Home) ───────────────────────────────────────────────────── */

.hero {
    text-align: center;
    padding: 5rem 0 4rem;
    animation: fadeUp 0.35s ease-out;
}

.hero h1 {
    font-size: 3.2rem;
    font-weight: 400;
    letter-spacing: -0.02em;
    margin-bottom: 0.6rem;
    background: linear-gradient(135deg, var(--text) 0%, var(--text-secondary) 60%, var(--accent) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-sub {
    color: var(--text-muted);
    font-size: 1.1rem;
    margin-bottom: 2.5rem;
    font-weight: 300;
    letter-spacing: 0.01em;
}

.topic-form { max-width: 580px; margin: 0 auto; }

.input-group {
    display: flex;
    gap: 0.6rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.35rem;
    transition: border-color var(--transition), box-shadow var(--transition);
}
.input-group:focus-within {
    border-color: var(--accent);
    box-shadow: var(--shadow-glow);
}

.topic-input {
    flex: 1;
    padding: 0.75rem 1rem;
    background: transparent;
    border: none;
    color: var(--text);
    font-family: var(--font-body);
    font-size: 0.95rem;
    outline: none;
    font-weight: 400;
}
.topic-input::placeholder { color: var(--text-muted); font-weight: 300; }

/* ── BUTTONS ───────────────────────────────────────────────────────── */

.btn {
    padding: 0.65rem 1.5rem;
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all var(--transition);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    letter-spacing: 0.01em;
}

.btn-primary {
    background: var(--accent);
    color: var(--bg);
}
.btn-primary:hover {
    background: var(--accent-hover);
    box-shadow: var(--shadow-glow);
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}
.btn-outline:hover {
    border-color: var(--text-muted);
    color: var(--text);
    background: var(--surface);
}

.btn-sm { padding: 0.45rem 0.85rem; font-size: 0.78rem; min-height: 44px; }
.btn-large { padding: 0.8rem 2.2rem; font-size: 0.95rem; margin-top: 1.5rem; }

/* ── SECTIONS ──────────────────────────────────────────────────────── */

.section { margin-top: 3.5rem; }
.section h2 {
    font-size: 1.6rem;
    margin-bottom: 1.2rem;
    letter-spacing: -0.01em;
}

/* ── TOPIC GRID ────────────────────────────────────────────────────── */

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

.topic-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.4rem;
    text-decoration: none;
    color: var(--text);
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
    animation: fadeUp 0.3s ease-out both;
}
.topic-card:nth-child(1) { animation-delay: 0.05s; }
.topic-card:nth-child(2) { animation-delay: 0.1s; }
.topic-card:nth-child(3) { animation-delay: 0.15s; }
.topic-card:nth-child(4) { animation-delay: 0.2s; }

.topic-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: var(--accent);
    opacity: 0;
    transition: opacity var(--transition);
}

.topic-card:hover {
    border-color: var(--accent);
    background: var(--surface-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
.topic-card:hover::before { opacity: 1; }

.topic-card h3 {
    font-family: var(--font-display);
    font-size: 1.1rem;
    margin-bottom: 0.6rem;
    font-weight: 400;
}

.topic-date, .topic-meta {
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 400;
}

/* ── SCOPE PAGE ────────────────────────────────────────────────────── */

.scope-page {
    max-width: 680px;
    animation: fadeUp 0.3s ease-out;
}

.scope-intro { margin-bottom: 2.5rem; }

.scope-intro h1 {
    font-size: 2.4rem;
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
    line-height: 1.15;
}

.intro-text {
    font-size: 1.02rem;
    line-height: 1.85;
    color: var(--text-secondary);
}
.intro-text strong { color: var(--text); font-weight: 600; }
.intro-text em { color: var(--accent); font-style: italic; }

/* Path selection */
.path-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.75rem;
}

.path-item { cursor: pointer; }
.path-item input { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.path-item-inner {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.15rem 1.35rem;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}

.path-item-inner::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: var(--accent);
    opacity: 0;
    transition: opacity var(--transition);
}

.path-item:hover .path-item-inner {
    border-color: rgba(232, 164, 74, 0.4);
    background: var(--surface-hover);
}
.path-item:hover .path-item-inner::before { opacity: 0.5; }

.path-item input:checked + .path-item-inner {
    border-color: var(--accent);
    background: var(--accent-subtle);
    box-shadow: 0 0 0 1px var(--accent), var(--shadow-glow);
}
.path-item input:checked + .path-item-inner::before { opacity: 1; }

.path-item input:checked + .path-item-inner .path-radio {
    background: var(--accent);
    border-color: var(--accent);
}
.path-item input:checked + .path-item-inner .path-radio::after {
    content: "";
    display: block;
    width: 6px;
    height: 6px;
    background: var(--bg);
    border-radius: 50%;
}

.path-item input:focus-visible + .path-item-inner {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.path-number {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--bg);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-muted);
    flex-shrink: 0;
    margin-top: 0.1rem;
    transition: all var(--transition);
}
.path-item input:checked + .path-item-inner .path-number {
    background: var(--accent);
    color: var(--bg);
    border-color: var(--accent);
}

.path-body { flex: 1; }

.path-title {
    display: block;
    font-size: 1rem;
    margin-bottom: 0.3rem;
    line-height: 1.4;
    font-weight: 500;
}
.path-title strong { font-weight: 700; }
.path-title em { color: var(--accent); }

.path-desc {
    display: block;
    font-size: 0.87rem;
    color: var(--text-muted);
    line-height: 1.55;
}
.path-desc em { color: var(--accent); font-style: italic; }

.path-radio {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid var(--border);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    margin-top: 0.25rem;
}

.scope-question {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-style: italic;
    margin-bottom: 1.5rem;
    color: var(--text-secondary);
}

.scope-actions { display: flex; gap: 0.75rem; }

/* Staggered path animation */
.path-item { animation: fadeUp 0.25s ease-out both; }
.path-item:nth-child(1) { animation-delay: 0.1s; }
.path-item:nth-child(2) { animation-delay: 0.2s; }
.path-item:nth-child(3) { animation-delay: 0.3s; }

/* ── QUIZ / DIAGNOSTIC ─────────────────────────────────────────────── */

.quiz-form { margin-top: 1.5rem; }

.question-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.6rem;
    margin-bottom: 1.5rem;
    animation: fadeUp 0.25s ease-out both;
}
.question-card:nth-child(1) { animation-delay: 0.05s; }
.question-card:nth-child(2) { animation-delay: 0.1s; }
.question-card:nth-child(3) { animation-delay: 0.15s; }

.question-number {
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-bottom: 0.6rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.question-text {
    font-size: 1rem;
    font-weight: 400;
    margin-bottom: 1rem;
    line-height: 1.5;
}

.question-concept {
    color: var(--text-muted);
    font-size: 0.78rem;
    margin-bottom: 0.85rem;
}

.subtitle {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    font-weight: 300;
}

.options { display: flex; flex-direction: column; gap: 0.45rem; }

.option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 1rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
}
.option:hover {
    border-color: rgba(232, 164, 74, 0.4);
    background: var(--surface);
}
.option input { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.option input:checked + .option-label {
    background: var(--accent);
    color: var(--bg);
    border-color: var(--accent);
}

.option input:focus-visible + .option-label {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.option-label {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--surface);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    font-weight: 600;
    flex-shrink: 0;
    transition: all var(--transition);
}

.option-text { font-size: 0.92rem; }

/* ── STUDY PAGE ────────────────────────────────────────────────────── */

.study-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 0.75rem;
    animation: fadeUp 0.3s ease-out;
}

.study-header h1 {
    font-size: 2rem;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.study-actions { display: flex; gap: 0.5rem; }

/* Knowledge bar (collapsible) */
.knowledge-bar {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    margin-bottom: 2rem;
    animation: fadeUp 0.3s ease-out 0.1s both;
}
.knowledge-bar summary {
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.knowledge-bar summary::before {
    content: "";
    width: 0;
    height: 0;
    border-left: 5px solid var(--text-muted);
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
    transition: transform 0.2s;
    flex-shrink: 0;
}
.knowledge-bar summary::-webkit-details-marker { display: none; }
.knowledge-bar summary::marker { display: none; }
.knowledge-bar[open] summary::before { transform: rotate(90deg); }
.knowledge-bar summary h3 {
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.knowledge-bar[open] .confidence-bars { margin-top: 1rem; }

.confidence-bars { display: flex; flex-direction: column; gap: 0.55rem; }

.confidence-row { display: flex; align-items: center; gap: 0.75rem; }

.concept-label {
    font-size: 0.82rem;
    min-width: 150px;
    color: var(--text-muted);
    font-weight: 400;
}

.bar-track {
    flex: 1;
    height: 6px;
    background: var(--bg);
    border-radius: 3px;
    overflow: hidden;
}
.bar-track.bar-large { height: 10px; border-radius: 5px; }

.bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
.bar-strong { background: var(--green); }
.bar-medium { background: var(--yellow); }
.bar-weak { background: var(--coral); }

.confidence-pct {
    font-size: 0.78rem;
    color: var(--text-muted);
    min-width: 35px;
    text-align: right;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

/* ── LESSON PROGRESS BAR ───────────────────────────────────────────── */

.lesson-progress {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 2rem;
    animation: fadeIn 0.5s ease-out;
}
.progress-track {
    flex: 1;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 2px;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
.progress-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* ── LESSON FLOW (step-by-step progressive reveal) ─────────────────── */

.lesson-flow { margin-top: 0; }

/* Steps: hidden by default, revealed one at a time */
.lesson-step {
    display: none;
    margin-bottom: 1rem;
}
.lesson-step.step-visible {
    display: block;
    animation: fadeUp 0.3s ease-out;
    /* Skip layout for offscreen steps already read (rendering-content-visibility) */
    content-visibility: auto;
    contain-intrinsic-size: auto 400px;
}

/* Continue button between steps */
.step-nav {
    margin-top: 1.5rem;
    padding-top: 1rem;
}
.step-nav-hidden { display: none; }
.step-nav .step-continue {
    padding: 0.6rem 2rem;
}

/* Answered check question option highlights */
.option-correct {
    border-color: var(--green) !important;
    background: var(--green-subtle) !important;
}
.option-incorrect {
    border-color: var(--coral) !important;
    background: var(--red-subtle) !important;
    opacity: 0.7;
}
.option input:disabled ~ .option-label { opacity: 0.6; }

.lesson-section {
    margin-bottom: 1.5rem;
    padding-left: 1.5rem;
    border-left: 2px solid var(--border-subtle);
}

.lesson-section h2 {
    font-size: 1.5rem;
    margin-bottom: 0.6rem;
    letter-spacing: -0.01em;
}

.lesson-content {
    color: var(--text-secondary);
    line-height: 1.85;
    font-size: 0.95rem;
}
.lesson-content strong { color: var(--text); font-weight: 600; }
.lesson-content em { color: var(--accent); }
.lesson-content code {
    background: var(--surface-raised);
    padding: 0.15rem 0.45rem;
    border-radius: var(--radius-xs);
    font-size: 0.88em;
    font-family: 'DM Mono', 'Fira Code', monospace;
    color: var(--accent);
}

/* Fenced code blocks */
.code-block {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin: 1.25rem 0;
    overflow: hidden;
    position: relative;
}
.code-lang {
    background: var(--surface-hover);
    color: var(--text-muted);
    font-family: var(--font-body);
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.35rem 0.85rem;
    border-bottom: 1px solid var(--border);
}
.code-lang:empty { display: none; }
.code-block pre {
    padding: 1rem 1.15rem;
    margin: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.code-block code {
    font-family: 'DM Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
    font-size: 0.85rem;
    line-height: 1.65;
    color: var(--text);
    background: none;
    padding: 0;
    border-radius: 0;
    white-space: pre;
    display: block;
}

/* Override inline code style inside code blocks */
.code-block code strong,
.code-block code em { color: inherit; font-style: normal; font-weight: normal; }

.lesson-content ul, .lesson-content ol {
    padding-left: 1.25rem;
    margin: 0.75rem 0;
}
.lesson-content li { margin-bottom: 0.35rem; }

.lesson-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.25rem 0;
    font-size: 0.88rem;
}
.lesson-content th, .lesson-content td {
    padding: 0.6rem 0.85rem;
    border: 1px solid var(--border);
    text-align: left;
}
.lesson-content th {
    background: var(--surface);
    font-weight: 600;
    color: var(--text);
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.lesson-content td { color: var(--text-secondary); }

.depth-badge {
    font-family: var(--font-body);
    font-size: 0.65rem;
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-left: 0.5rem;
    vertical-align: middle;
}
.badge-deep { background: var(--accent-subtle); color: var(--accent); }
.badge-review { background: var(--yellow-subtle); color: var(--yellow); }

/* ── CHECK QUESTIONS (inline, margin-note style) ───────────────────── */

.check-question {
    background: var(--surface);
    border: 1px solid rgba(232, 164, 74, 0.25);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius);
    padding: 1.35rem 1.5rem;
    margin: 1.75rem 0 2.25rem;
    position: relative;
    animation: fadeUp 0.25s ease-out both;
}

.check-question::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: var(--radius);
    background: linear-gradient(135deg, var(--accent-subtle) 0%, transparent 60%);
    pointer-events: none;
}

.check-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.8rem;
    font-weight: 600;
    color: var(--accent);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    position: relative;
}

.check-icon {
    font-size: 0.85rem;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    color: var(--bg);
    border-radius: 50%;
    font-weight: 700;
}

.check-question .question-text {
    font-size: 1rem;
    margin-bottom: 0.85rem;
    position: relative;
}
.check-question .question-text p { margin-bottom: 0.5rem; }
.check-question .question-text p:last-child { margin-bottom: 0; }

/* Code blocks inside questions — slightly smaller */
.question-text .code-block { margin: 0.75rem 0; }
.question-text .code-block code { font-size: 0.82rem; }

/* Inline code in option text */
.option-text code {
    background: var(--surface-raised);
    padding: 0.1rem 0.35rem;
    border-radius: var(--radius-xs);
    font-size: 0.84em;
    font-family: 'DM Mono', 'Fira Code', monospace;
    color: var(--accent);
}

.check-question .options { position: relative; gap: 0.4rem; }
.check-question .option { font-size: 0.88rem; }

/* ── ANSWER RESULTS ────────────────────────────────────────────────── */

.answer-result { margin-top: 0.85rem; }

.result {
    padding: 0.8rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    animation: fadeUp 0.3s ease-out;
}
.result-correct {
    background: var(--green-subtle);
    border: 1px solid rgba(129, 178, 154, 0.3);
}
.result-incorrect {
    background: var(--red-subtle);
    border: 1px solid rgba(224, 122, 95, 0.3);
}
.confidence-update {
    display: block;
    margin-top: 0.3rem;
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* ── REVISION CARDS ────────────────────────────────────────────────── */

.revision-section {
    margin-top: 1rem;
    padding-top: 0;
    animation: fadeUp 0.3s ease-out;
}

.revision-section h2 {
    font-size: 1.5rem;
    margin-bottom: 0.35rem;
}

.revision-intro {
    color: var(--text-muted);
    font-size: 0.88rem;
    margin-bottom: 1.25rem;
    font-weight: 300;
}

.cards-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
    gap: 1rem;
}

.flip-card {
    perspective: 1000px;
    height: 190px;
    cursor: pointer;
    animation: fadeUp 0.25s ease-out both;
}
.flip-card:nth-child(1) { animation-delay: 0.05s; }
.flip-card:nth-child(2) { animation-delay: 0.1s; }
.flip-card:nth-child(3) { animation-delay: 0.15s; }
.flip-card:nth-child(4) { animation-delay: 0.2s; }

.flip-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
}
.flipped .flip-inner { transform: rotateY(180deg); }

.flip-front, .flip-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: var(--radius);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.flip-front {
    background: var(--surface);
    border: 1px solid var(--border);
}
.flip-front:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-sm);
}

.flip-back {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
    color: var(--bg);
    transform: rotateY(180deg);
}

.flip-front p, .flip-back p {
    font-size: 0.92rem;
    line-height: 1.5;
}
.flip-front p { font-family: var(--font-display); font-size: 1rem; }
.flip-back p { font-weight: 500; }

.card-concept {
    color: var(--text-muted);
    font-size: 0.72rem;
    margin-top: auto;
    padding-top: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 500;
}

/* ── DASHBOARD ─────────────────────────────────────────────────────── */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 2.5rem;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.4rem;
    text-align: center;
    animation: fadeUp 0.3s ease-out both;
    transition: all var(--transition);
}
.stat-card:nth-child(1) { animation-delay: 0.05s; }
.stat-card:nth-child(2) { animation-delay: 0.1s; }
.stat-card:nth-child(3) { animation-delay: 0.15s; }
.stat-card:nth-child(4) { animation-delay: 0.2s; }

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.stat-number {
    font-family: var(--font-display);
    font-size: 2.4rem;
    font-weight: 400;
}
.stat-label {
    color: var(--text-muted);
    font-size: 0.78rem;
    margin-top: 0.3rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 500;
}

.stat-strong .stat-number { color: var(--green); }
.stat-medium .stat-number { color: var(--yellow); }
.stat-weak .stat-number { color: var(--coral); }

.overall-confidence { margin-bottom: 2.5rem; }
.overall-confidence h3 {
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 0.6rem;
    color: var(--text-secondary);
}

/* ── REVIEW LIST ───────────────────────────────────────────────────── */

.review-list { display: flex; flex-direction: column; gap: 0.5rem; }

.review-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1.15rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text);
    transition: all var(--transition);
}
.review-card:hover {
    border-color: var(--accent);
    background: var(--surface-hover);
    transform: translateX(4px);
}

.review-topic { color: var(--text-muted); font-size: 0.82rem; flex: 1; }
.review-confidence { font-size: 0.85rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.review-overdue { color: var(--coral); font-size: 0.8rem; font-weight: 500; }

/* ── CONCEPT CHIPS ─────────────────────────────────────────────────── */

.concept-list { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 1.5rem 0; }
.concept-chip {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
}
.concept-chip strong { display: block; font-size: 0.92rem; }
.concept-desc { color: var(--text-muted); font-size: 0.8rem; }

/* ── FORMS (scope) ─────────────────────────────────────────────────── */

.scope-form { margin-top: 1.5rem; }
.scope-form label { display: block; margin-bottom: 0.5rem; color: var(--text-muted); font-size: 0.85rem; }

.scope-input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 0.92rem;
    resize: vertical;
    margin-bottom: 1rem;
    transition: border-color var(--transition);
}
.scope-input:focus { border-color: var(--accent); outline: none; }

/* ── TABS (kept for diagnostic/legacy) ─────────────────────────────── */

.tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1.5rem;
}
.tab {
    padding: 0.75rem 1.5rem;
    background: none;
    border: none;
    color: var(--text-muted);
    font-family: var(--font-body);
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all var(--transition);
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── AUTH PAGES ───────────────────────────────────────────────────── */

.auth-page {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 3rem;
    min-height: calc(100vh - 200px);
}

.auth-card {
    width: 100%;
    max-width: 420px;
    animation: fadeUp 0.3s ease-out;
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-header h1 {
    font-size: 2rem;
    letter-spacing: -0.02em;
    margin-bottom: 0.4rem;
}

.auth-sub {
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 300;
}

.auth-error {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--red-subtle);
    border: 1px solid rgba(224, 122, 95, 0.3);
    border-radius: var(--radius-sm);
    color: var(--coral);
    font-size: 0.88rem;
    margin-bottom: 1.5rem;
    animation: fadeUp 0.25s ease-out;
}

.auth-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1.75rem;
}

.auth-tab {
    flex: 1;
    text-align: center;
    padding: 0.75rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    border-bottom: 2px solid transparent;
    transition: all var(--transition);
}
.auth-tab:hover { color: var(--text); }
.auth-tab-active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.form-group label {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-input {
    padding: 0.75rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 0.95rem;
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
}
.form-input::placeholder { color: var(--text-muted); font-weight: 300; }
.form-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

/* Password show/hide toggle */
.password-field {
    position: relative;
    display: block;
}
.password-field .form-input {
    width: 100%;
    box-sizing: border-box;
    padding-right: 2.8rem;
}
.password-toggle {
    position: absolute;
    top: 50%;
    right: 0.5rem;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    transition: color var(--transition), background-color var(--transition);
}
.password-toggle:hover { color: var(--text); }
.password-toggle:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
    color: var(--text);
}
.password-toggle svg { width: 18px; height: 18px; display: block; }
.password-toggle .icon-eye-off { display: none; }
.password-toggle[aria-pressed="true"] .icon-eye { display: none; }
.password-toggle[aria-pressed="true"] .icon-eye-off { display: block; }

.auth-submit {
    width: 100%;
    justify-content: center;
    margin-top: 0.5rem;
}

/* Social login */
.social-logins {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.social-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    width: 100%;
    padding: 0.72rem 1rem;
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    border: 1px solid var(--border);
    transition: all var(--transition);
    cursor: pointer;
    min-height: 44px;
}
.social-btn svg { flex-shrink: 0; }

.social-btn-google {
    background: var(--surface);
    color: var(--text);
}
.social-btn-google:hover {
    background: var(--surface-hover);
    border-color: rgba(66, 133, 244, 0.5);
}

.social-btn-microsoft {
    background: var(--surface);
    color: var(--text);
}
.social-btn-microsoft:hover {
    background: var(--surface-hover);
    border-color: rgba(0, 164, 239, 0.5);
}

.social-btn-apple {
    background: var(--surface);
    color: var(--text);
}
.social-btn-apple:hover {
    background: var(--surface-hover);
    border-color: rgba(255, 255, 255, 0.3);
}

.social-btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.5rem 0;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 400;
    text-transform: lowercase;
}
.auth-divider::before,
.auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* ── EMPTY STATE ───────────────────────────────────────────────────── */

.empty-state {
    text-align: center;
    padding: 5rem 1.5rem;
    animation: fadeUp 0.3s ease-out;
}
.empty-state h2 {
    font-size: 1.8rem;
    margin-bottom: 0.6rem;
}
.empty-state p {
    color: var(--text-muted);
    margin-bottom: 1.75rem;
    font-weight: 300;
    font-size: 1.05rem;
}

/* ── ERROR ─────────────────────────────────────────────────────────── */

.error-card {
    text-align: center;
    padding: 4rem 2rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    animation: fadeUp 0.3s ease-out;
}
.error-card h1 {
    font-size: 2rem;
    color: var(--coral);
    margin-bottom: 0.6rem;
}
.error-card p {
    color: var(--text-muted);
    margin-bottom: 1.75rem;
    font-weight: 300;
}

/* ── FOOTER ────────────────────────────────────────────────────────── */

.footer {
    text-align: center;
    padding: 2.5rem 1.5rem;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 400;
    letter-spacing: 0.03em;
}

/* ── AGENT CONTROL CENTRE ──────────────────────────────────────────── */

.agents-header { margin-bottom: 2.5rem; }
.agents-header h1 { font-size: 2rem; margin-bottom: 0.3rem; }

.agent-stats {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 2.5rem;
    flex-wrap: wrap;
}

.agent-stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.85rem 1.3rem;
    text-align: center;
    min-width: 100px;
    transition: all var(--transition);
}
.agent-stat:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }

.agent-stat-number {
    display: block;
    font-family: var(--font-display);
    font-size: 1.6rem;
}
.agent-stat-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 500;
}
.agent-stat-stub .agent-stat-number { color: var(--yellow); }
.agent-stat-error .agent-stat-number { color: var(--coral); }

.agent-category { margin-bottom: 2.5rem; }

.category-title {
    font-family: var(--font-body);
    font-size: 0.82rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
    margin-bottom: 1rem;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid var(--border);
}

.agent-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1rem;
}

.agent-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.35rem;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}
.agent-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: var(--green);
    opacity: 0.6;
}
.agent-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.agent-card-stub { opacity: 0.6; }
.agent-card-stub::before { background: var(--yellow); opacity: 0.4; }
.agent-card-stub:hover { opacity: 0.85; }

.agent-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}
.agent-name-row { display: flex; align-items: center; gap: 0.5rem; }
.agent-name-row h3 {
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0;
}

.agent-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.dot-active {
    background: var(--green);
    animation: pulse-dot 2s ease-in-out infinite;
}
.dot-stub { background: var(--yellow); }

.agent-badge {
    font-size: 0.65rem;
    padding: 0.15rem 0.55rem;
    border-radius: var(--radius-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.badge-active { background: var(--green-subtle); color: var(--green); }
.badge-stub { background: var(--yellow-subtle); color: var(--yellow); }

.agent-description {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 0.85rem;
    line-height: 1.55;
}

.agent-meta { margin-bottom: 0.85rem; }
.agent-trigger {
    font-size: 0.72rem;
    color: var(--text-muted);
    background: var(--bg);
    padding: 0.25rem 0.55rem;
    border-radius: var(--radius-xs);
    font-weight: 500;
}

.agent-activity { display: flex; align-items: center; gap: 0.4rem; margin-bottom: 0.85rem; }
.activity-label { font-size: 0.72rem; color: var(--text-muted); font-weight: 500; }
.activity-dot { width: 10px; height: 10px; border-radius: 50%; }
.activity-ok { background: var(--green); }
.activity-fail { background: var(--coral); }

.agent-actions { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.agent-spinner { font-size: 0.8rem; color: var(--accent); font-weight: 500; }

.agent-result { margin-top: 0.85rem; }
.agent-result-inner {
    padding: 0.85rem;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    max-height: 300px;
    overflow-y: auto;
}
.result-success { background: var(--green-subtle); border: 1px solid rgba(129, 178, 154, 0.2); }
.result-error { background: var(--red-subtle); border: 1px solid rgba(224, 122, 95, 0.2); }
.result-header { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; font-size: 0.85rem; }
.result-icon { font-size: 1rem; }
.result-body { font-size: 0.8rem; }
.result-row { display: flex; gap: 0.5rem; padding: 0.18rem 0; }
.result-key { color: var(--text-muted); min-width: 120px; font-weight: 500; }
.result-value { color: var(--text); }
.result-empty { color: var(--text-muted); font-style: italic; }
.result-muted { color: var(--text-muted); }
.result-section { margin: 0.35rem 0; }
.result-nested { padding-left: 1rem; }
.result-list { list-style: none; padding-left: 0.5rem; }
.result-list li { padding: 0.12rem 0; }
.result-list li::before { content: "\2022"; color: var(--text-muted); margin-right: 0.4rem; }
.result-raw { font-family: 'DM Mono', monospace; font-size: 0.75rem; white-space: pre-wrap; word-break: break-all; }

/* Agent logs */
.agent-logs-panel { margin-top: 0.6rem; }
.agent-logs-panel h4 { font-size: 0.88rem; margin-bottom: 0.5rem; }

.logs-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.logs-table th {
    text-align: left;
    color: var(--text-muted);
    font-weight: 600;
    padding: 0.4rem 0.55rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.logs-table td { padding: 0.4rem 0.55rem; border-bottom: 1px solid var(--border-subtle); }
.log-time { color: var(--text-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.log-duration { color: var(--text-muted); font-variant-numeric: tabular-nums; }
.log-status { font-size: 0.65rem; padding: 0.12rem 0.4rem; border-radius: var(--radius-xs); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.log-ok { background: var(--green-subtle); color: var(--green); }
.log-fail { background: var(--red-subtle); color: var(--coral); }
.log-row-error { background: rgba(224, 122, 95, 0.04); }
.logs-empty { color: var(--text-muted); font-size: 0.85rem; font-style: italic; }

/* ── HTMX ──────────────────────────────────────────────────────────── */

.htmx-indicator { display: none; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { display: inline; }

/* Skeleton loading (#11) */
.skeleton {
    background: var(--surface);
    border-radius: var(--radius-sm);
    position: relative;
    overflow: hidden;
}
.skeleton::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.04), transparent);
    animation: shimmer 1.5s infinite;
}
.skeleton-text { height: 1rem; margin-bottom: 0.75rem; }
.skeleton-text:last-child { width: 60%; }
.skeleton-heading { height: 2rem; width: 50%; margin-bottom: 1.25rem; }
.skeleton-block { height: 120px; margin-bottom: 1rem; }

/* Async button states (#12) */
.btn[disabled], .btn.btn-loading {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}
.btn-loading::after {
    content: "";
    width: 14px;
    height: 14px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    display: inline-block;
    animation: spin 0.6s linear infinite;
    margin-left: 0.4rem;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ── RESPONSIVE ────────────────────────────────────────────────────── */

@media (max-width: 640px) {
    body { font-size: 14px; }

    .main { padding: 1.75rem 1.25rem; }

    .hero { padding: 3.5rem 0 2.5rem; }
    .hero h1 { font-size: 2.2rem; }

    .input-group { flex-direction: column; gap: 0.5rem; background: none; border: none; padding: 0; }
    .input-group:focus-within { box-shadow: none; }
    .topic-input {
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: var(--radius);
        padding: 0.85rem 1rem;
    }
    .topic-input:focus { border-color: var(--accent); }

    .scope-intro h1 { font-size: 1.8rem; }

    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .concept-label { min-width: 100px; }
    .study-header { flex-direction: column; align-items: flex-start; }

    .lesson-section { padding-left: 1rem; }

    .agent-grid { grid-template-columns: 1fr; }
    .agent-stats { gap: 0.5rem; }

    .cards-container { grid-template-columns: 1fr; }
}

@media (max-width: 420px) {
    .hero h1 { font-size: 1.8rem; }
    .scope-intro h1 { font-size: 1.5rem; }
    .study-header h1 { font-size: 1.5rem; }
    .stat-card { padding: 1rem; }
    .stat-number { font-size: 1.8rem; }
}

/* Reduced motion support (#9) */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    .flip-inner { transition: none; }
    .bar-fill { transition: none; }
    .progress-fill { transition: none; }
}
