
:root {
    --primary: #1a73e8;
    --primary-dark: #1557b0;
    --bg: #f8f9fa;
    --sidebar-bg: #fff;
    --card-bg: #fff;
    --text: #202124;
    --text-secondary: #5f6368;
    --border: #dadce0;
    --accent: #ea4335;
    --success: #34a853;
    --pdf-color: #d93025;
    --zip-color: #1a73e8;
    --xlsx-color: #0f9d58;
    --img-color: #f9ab00;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

/* Mobile safety net: nothing may force horizontal page scroll */
html, body { overflow-x: hidden; width: 100%; }
img, video, iframe { max-width: 100%; height: auto; }

body {
    font-family: 'Segoe UI', Roboto, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    background: var(--primary);
    color: #fff;
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.header-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-inner h1 {
    font-size: 1.3rem;
    font-weight: 500;
    letter-spacing: -0.01em;
}

.header-inner h1 a {
    color: #fff;
    text-decoration: none;
}

.menu-toggle {
    display: none;
    background: transparent;
    border: 1px solid rgba(255,255,255,0.4);
    color: #fff;
    font-size: 1.2rem;
    line-height: 1;
    min-width: 44px;
    min-height: 44px;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
}

.layout {
    display: flex;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    flex: 1;
}

/* Sidebar */
.sidebar {
    width: 280px;
    min-width: 280px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    padding: 16px 0;
    overflow-y: auto;
    max-height: calc(100vh - 60px);
    position: sticky;
    top: 60px;
}

.sidebar-section { margin-bottom: 4px; }

.sidebar-section-title {
    display: flex;
    align-items: center;
    padding: 8px 24px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
    text-decoration: none;
}

.sidebar-section-title:hover { background: #f1f3f4; }

.sidebar-section-title.active {
    color: var(--primary);
    background: #e8f0fe;
}

.sidebar-section-title .arrow {
    margin-right: 8px;
    font-size: 0.7rem;
    transition: transform 0.2s;
}

.sidebar-section-title.expanded .arrow {
    transform: rotate(90deg);
}

.sidebar-items {
    display: none;
    padding: 0;
}

.sidebar-items.open { display: block; }

.sidebar-item {
    display: block;
    padding: 6px 24px 6px 48px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: background 0.15s;
}

.sidebar-item:hover {
    background: #f1f3f4;
    color: var(--text);
}

.sidebar-item.active {
    color: var(--primary);
    background: #e8f0fe;
    font-weight: 500;
}

.sidebar-extra {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.sidebar-extra a {
    display: block;
    padding: 8px 24px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: background 0.15s;
}

.sidebar-extra a:hover {
    background: #f1f3f4;
    color: var(--text);
}

/* Main content */
.content {
    flex: 1;
    padding: 32px 40px;
    max-width: 900px;
}

.content h2 {
    font-size: 1.6rem;
    font-weight: 400;
    margin-bottom: 24px;
    color: var(--text);
}

.content h3 {
    font-size: 1.1rem;
    font-weight: 500;
    margin: 24px 0 12px;
    color: var(--text);
}

/* File cards */
.file-list { display: flex; flex-direction: column; gap: 8px; }

.file-card {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    text-decoration: none;
    color: var(--text);
    transition: box-shadow 0.2s, border-color 0.2s;
}

.file-card:hover {
    border-color: var(--primary);
    box-shadow: 0 1px 6px rgba(26, 115, 232, 0.15);
}

.file-icon {
    width: 40px; height: 40px;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.75rem; font-weight: 700; color: #fff;
    margin-right: 14px; flex-shrink: 0;
}

.file-icon.pdf { background: var(--pdf-color); }
.file-icon.zip { background: var(--zip-color); }
.file-icon.xlsx { background: var(--xlsx-color); }
.file-icon.img { background: var(--img-color); }

.file-info { flex: 1; min-width: 0; }
.file-name { font-size: 0.9rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-meta { font-size: 0.8rem; color: var(--text-secondary); margin-top: 2px; }
.file-download { color: var(--primary); font-size: 0.85rem; font-weight: 500; white-space: nowrap; margin-left: 12px; }

/* Variant grid on year pages */
.variant-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.variant-card {
    display: flex; align-items: center;
    padding: 16px 20px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    text-decoration: none; color: var(--text);
    font-weight: 500;
    transition: box-shadow 0.2s, border-color 0.2s;
}

.variant-card:hover {
    border-color: var(--primary);
    box-shadow: 0 1px 6px rgba(26, 115, 232, 0.15);
}

.variant-card .badge {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px;
    border-radius: 50%;
    background: #e8f0fe; color: var(--primary);
    font-size: 0.8rem; font-weight: 600;
    margin-right: 12px; flex-shrink: 0;
}

.variant-card { flex-wrap: wrap; gap: 6px; }
.vc-name { flex: 1 1 100%; }
.vc-badges { display: flex; flex-wrap: wrap; gap: 4px; }
.badge-mini {
    display: inline-block; padding: 2px 8px; border-radius: 10px;
    background: #e8f0fe; color: var(--primary);
    font-size: 0.7rem; font-weight: 600; letter-spacing: 0.02em;
}

.year-note {
    font-size: 0.92rem; color: var(--text-secondary);
    margin: -12px 0 18px; max-width: 75ch; line-height: 1.5;
}

/* Home hero */
.hero {
    background: linear-gradient(135deg, #1a73e8, #4285f4);
    color: #fff;
    padding: 48px 40px;
    border-radius: 12px;
    margin-bottom: 32px;
}

.hero h2 { font-size: 1.8rem; color: #fff; margin-bottom: 8px; }
.hero p { font-size: 1.05rem; opacity: 0.95; }
.hero .exam-date { font-size: 0.92rem; opacity: 0.88; margin-top: 10px; }

.stats { display: flex; gap: 24px; margin-top: 20px; }
.stat { text-align: center; }
.stat-num { font-size: 2rem; font-weight: 700; }
.stat-label { font-size: 0.85rem; opacity: 0.8; }

/* Intro cards (Despre / Competente / Rezolvari) */
.intro-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin: 0 0 32px;
}

.intro-card {
    display: block;
    padding: 20px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
    border-radius: 10px;
    text-decoration: none;
    color: var(--text);
    transition: box-shadow 0.2s, transform 0.15s;
}

.intro-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    transform: translateY(-2px);
}

.intro-card .intro-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 6px;
}

.intro-card .intro-teaser {
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Year cards */
.year-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.year-card {
    display: block;
    padding: 20px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    text-decoration: none; color: var(--text);
    transition: box-shadow 0.2s, transform 0.15s;
}

.year-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    transform: translateY(-2px);
}

.year-card .year-label { font-size: 1.3rem; font-weight: 600; color: var(--primary); }
.year-card .year-count { font-size: 0.85rem; color: var(--text-secondary); margin-top: 4px; }

/* Footer */
footer {
    text-align: center;
    padding: 24px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    border-top: 1px solid var(--border);
    margin-top: auto;
}

/* Mobile */
@media (max-width: 768px) {
    .menu-toggle { display: inline-block; }
    .layout { flex-direction: column; }
    .sidebar {
        display: none;
        width: 100%;
        min-width: 100%;
        max-height: none;
        position: static;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
    .sidebar.open { display: block; }
    .content { padding: 20px 16px; }
    .hero { padding: 32px 20px; }
    .hero h2 { font-size: 1.4rem; }
    .stats { flex-wrap: wrap; gap: 16px; }
    .year-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    /* Wide tables scroll inside themselves, not the whole page */
    .cheatsheet, .exam-structure, .cert-levels {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .site-search-hints button { padding: 8px 14px; font-size: 0.82rem; }
    .sidebar a { padding-top: 10px; padding-bottom: 10px; }
}

/* ===== Variant study panel (Cum tratezi acest subiect) ===== */
.study-panel {
    margin: 22px 0 8px;
    padding: 16px 18px;
    background: #f8f9fa;
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
    border-radius: 8px;
}
.study-panel h3 {
    margin: 0 0 6px;
    font-size: 1.02rem;
    color: var(--text);
}
.study-panel p {
    margin: 0 0 10px;
    font-size: 0.93rem;
    color: #5f6368;
}
.study-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 0 0 6px;
}
.study-links.secondary {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px dashed var(--border);
}
.study-link {
    display: inline-block;
    padding: 8px 14px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.9rem;
    color: var(--text);
    text-decoration: none;
    transition: border-color .15s, box-shadow .15s;
}
.study-link:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(26,115,232,0.10);
}
.study-link.primary {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    font-weight: 600;
}
.study-link.primary:hover {
    box-shadow: 0 3px 10px rgba(26,115,232,0.30);
}
.study-skills {
    margin: 10px 0 2px;
}
.study-skills-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}
.skill-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.chip {
    display: inline-block;
    padding: 4px 12px;
    background: #e8f0fe;
    color: var(--primary);
    border-radius: 999px;
    font-size: 0.84rem;
    font-weight: 500;
    text-decoration: none;
    transition: background .15s;
}
.chip:hover {
    background: #d2e3fc;
}

/* ===== Wave-2 content classes (despre-examen, competente, rezolvari) ===== */
.exam-explainer, .skill-page, .walkthrough {
    line-height: 1.65;
}
.exam-explainer h2, .skill-page h2, .walkthrough h2 {
    margin-top: 28px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 6px;
}
.exam-explainer h3, .skill-page h3, .walkthrough h3 {
    margin-top: 22px;
    color: var(--text);
    font-size: 1.05rem;
}
.exam-structure, .cert-levels {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0 18px;
    font-size: 0.92rem;
}
.exam-structure th, .exam-structure td,
.cert-levels th, .cert-levels td {
    border: 1px solid var(--border);
    padding: 8px 12px;
    text-align: left;
    vertical-align: top;
}
.exam-structure thead, .cert-levels thead {
    background: #f1f3f4;
}
.exam-structure thead th, .cert-levels thead th {
    font-weight: 600;
    color: var(--text);
}
.next-step-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin: 16px 0 24px;
}
.next-step-card {
    display: block;
    padding: 16px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    text-decoration: none;
    transition: border-color .15s, box-shadow .15s, transform .15s;
}
.next-step-card:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(26,115,232,0.08);
    transform: translateY(-1px);
}
.exam-pitfalls, .skill-areas-list {
    padding-left: 22px;
}
.exam-pitfalls li, .skill-areas-list li {
    margin: 6px 0;
}
.micro-steps {
    counter-reset: micro;
    padding-left: 0;
    list-style: none;
}
.micro-steps > li {
    padding: 10px 12px 10px 44px;
    position: relative;
    border-left: 3px solid var(--primary);
    background: #f8f9fa;
    margin: 8px 0;
    border-radius: 0 6px 6px 0;
}
.micro-steps > li::before {
    counter-increment: micro;
    content: counter(micro);
    position: absolute;
    left: 12px;
    top: 10px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-weight: 600;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
}
.pitfalls, .practice-list, .next-skill {
    padding-left: 22px;
}
.pitfalls li {
    margin: 6px 0;
    color: #5f6368;
}
.skill-page code, .walkthrough code, .exam-explainer code {
    background: #f1f3f4;
    color: #d93025;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.9em;
    font-family: Consolas, 'Courier New', monospace;
}
.skill-page pre, .walkthrough pre {
    background: #202124;
    color: #e8eaed;
    padding: 12px 14px;
    border-radius: 6px;
    overflow-x: auto;
    font-size: 0.86rem;
    line-height: 1.5;
    margin: 10px 0;
}
.skill-page pre code, .walkthrough pre code {
    background: transparent;
    color: inherit;
    padding: 0;
}
.meta-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    padding: 12px 14px;
    background: #f1f3f4;
    border-radius: 6px;
    margin: 10px 0 20px;
    font-size: 0.9rem;
}
.meta-bar > * { display: inline-block; }
.pdf-link {
    background: var(--pdf-color);
    color: #fff !important;
    padding: 4px 10px;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 500;
}
.pdf-link:hover { opacity: .9; }
.walkthrough .steps {
    counter-reset: step;
    padding-left: 0;
    list-style: none;
}
.walkthrough .steps > li {
    counter-increment: step;
    margin: 18px 0;
    padding: 14px 16px 14px 56px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    position: relative;
}
.walkthrough .steps > li::before {
    content: counter(step);
    position: absolute;
    left: 14px;
    top: 14px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}
.walkthrough .steps h4 {
    margin: 0 0 6px;
    color: var(--text);
    font-size: 1rem;
}
.screenshot-placeholder {
    background: repeating-linear-gradient(45deg, #f1f3f4 0 8px, #e8eaed 8px 16px);
    border: 1px dashed #9aa0a6;
    padding: 18px;
    margin: 10px 0;
    color: #5f6368;
    font-size: 0.85rem;
    text-align: center;
    border-radius: 6px;
    font-style: italic;
}
.tip {
    background: #fef7e0;
    border-left: 3px solid #f9ab00;
    padding: 8px 12px;
    margin: 8px 0;
    border-radius: 0 4px 4px 0;
    font-size: 0.92rem;
}
.checklist {
    list-style: none;
    padding-left: 0;
}
.checklist li {
    padding: 6px 0;
}
.checklist input[type=checkbox] {
    margin-right: 8px;
    transform: scale(1.15);
    accent-color: var(--primary);
}
@media (max-width: 768px) {
    .next-step-grid { grid-template-columns: 1fr; }
    .walkthrough .steps > li { padding-left: 50px; }
}

/* ===== Wave-3: header search box ===== */
.site-search-wrap {
    margin-left: auto;
    position: relative;
    flex: 0 1 360px;
}
.header-inner { display: flex; align-items: center; gap: 16px; }
#site-search {
    width: 100%;
    padding: 8px 14px;
    border: 1px solid rgba(255,255,255,0.35);
    border-radius: 20px;
    background: rgba(255,255,255,0.15);
    color: #fff;
    font-size: 0.9rem;
    outline: none;
    transition: background .15s, border-color .15s;
}
#site-search::placeholder { color: rgba(255,255,255,0.75); }
#site-search:focus {
    background: #fff;
    color: var(--text);
    border-color: #fff;
}
#site-search:focus::placeholder { color: #9aa0a6; }
.search-results {
    list-style: none;
    margin: 6px 0 0;
    padding: 0;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    max-height: 70vh;
    overflow-y: auto;
    z-index: 100;
}
.search-results li { margin: 0; }
.search-results a {
    display: block;
    padding: 10px 14px;
    color: var(--text);
    text-decoration: none;
    border-bottom: 1px solid #f1f3f4;
}
.search-results a:hover,
.search-results li.active a,
.search-results a[aria-selected=true] { background: #f1f3f4; }
.r-title { display: block; font-weight: 600; font-size: 0.92rem; }
.r-section { display: inline-block; font-size: 0.72rem; color: #5f6368;
    text-transform: uppercase; letter-spacing: 0.05em; margin-right: 8px; }
.r-snippet { display: block; font-size: 0.82rem; color: #5f6368; margin-top: 2px;
    overflow: hidden; text-overflow: ellipsis; display: -webkit-box;
    -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.search-results mark { background: #fff3cd; padding: 0 1px; border-radius: 2px; color: var(--text); }
.search-empty, .search-loading { padding: 14px; color: #5f6368; font-size: 0.88rem; text-align: center; }
@media (max-width: 768px) {
    .site-search-wrap { flex: 1 1 100%; order: 3; margin-left: 0; margin-top: 8px; }
    .header-inner { flex-wrap: wrap; }
}

/* ===== Wave-3: practice (timer + checklist) ===== */
.practice-page .timer {
    background: linear-gradient(135deg, #1a73e8 0%, #4285f4 100%);
    color: #fff;
    border-radius: 12px;
    padding: 24px 20px;
    margin: 18px 0 22px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(26,115,232,0.18);
    transition: background .3s;
}
.practice-page .timer.warning { background: linear-gradient(135deg, #f9ab00 0%, #fbbc04 100%); }
.practice-page .timer.critical {
    background: linear-gradient(135deg, #d93025 0%, #ea4335 100%);
    animation: pulse 1s infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.85; } }
.timer-display {
    font-size: 4rem;
    font-weight: 700;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    margin: 4px 0 8px;
    font-family: Consolas, 'Courier New', monospace;
}
.timer-state {
    font-size: 0.92rem;
    opacity: 0.95;
    margin-bottom: 14px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.timer-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}
.timer-controls button {
    padding: 8px 18px;
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,0.5);
    background: rgba(255,255,255,0.15);
    color: #fff;
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    transition: background .15s;
}
.timer-controls button:hover { background: rgba(255,255,255,0.28); }
.timer-controls button:disabled { opacity: 0.45; cursor: not-allowed; }
.session-status, .level-estimate {
    background: #f8f9fa;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px 16px;
    margin: 16px 0;
}
.level-estimate input[type=range] {
    width: 100%;
    margin: 10px 0;
    accent-color: var(--primary);
}
#level-label {
    font-weight: 600;
    color: var(--primary);
    font-size: 1.05rem;
}

/* ===== Wave-3: mini-project (reuses walkthrough/skill styles) ===== */
.mini-project { line-height: 1.65; }
.mini-project h2 {
    margin-top: 28px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 6px;
}
.mini-project h3 {
    margin-top: 22px;
    color: var(--text);
    font-size: 1.05rem;
}
.mini-project code {
    background: #f1f3f4;
    color: #d93025;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.9em;
    font-family: Consolas, 'Courier New', monospace;
}
.mini-project pre {
    background: #202124;
    color: #e8eaed;
    padding: 12px 14px;
    border-radius: 6px;
    overflow-x: auto;
    font-size: 0.86rem;
    margin: 10px 0;
}
.mini-project pre code { background: transparent; color: inherit; padding: 0; }
.mini-project .steps {
    counter-reset: step;
    padding-left: 0;
    list-style: none;
}
.mini-project .steps > li {
    counter-increment: step;
    margin: 18px 0;
    padding: 14px 16px 14px 56px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    position: relative;
}
.mini-project .steps > li::before {
    content: counter(step);
    position: absolute;
    left: 14px;
    top: 14px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}
.mini-project .steps h4 { margin: 0 0 6px; color: var(--text); font-size: 1rem; }

/* ===== Iteration 1 additions ===== */

/* Lead paragraph */
.lead { font-size: 1.02rem; color: var(--text); margin: 8px 0 18px; padding-left: 12px;
    border-left: 3px solid var(--primary); background: #f8f9fa; padding: 10px 14px; border-radius: 0 6px 6px 0; }

/* Cheatsheet table */
.cheatsheet { width: 100%; border-collapse: collapse; margin: 12px 0 22px; font-size: 0.9rem; }
.cheatsheet th, .cheatsheet td { border: 1px solid var(--border); padding: 8px 12px; vertical-align: top; text-align: left; }
.cheatsheet thead { background: #f1f3f4; }
.cheatsheet thead th { font-weight: 600; }
.cheatsheet td:last-child { color: #d93025; }

/* Side-by-side correct/wrong */
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 14px 0 20px; }
.compare-bad, .compare-good { padding: 12px 14px; border-radius: 8px; border: 1px solid; }
.compare-bad { background: #fce8e6; border-color: #f4c7c3; }
.compare-good { background: #e6f4ea; border-color: #b7e1c2; }
.compare-bad h4, .compare-good h4 { margin: 0 0 6px; font-size: 0.92rem; text-transform: uppercase; letter-spacing: 0.04em; }
.compare-bad h4 { color: #c5221f; }
.compare-good h4 { color: #137333; }
.compare pre { margin: 6px 0; font-size: 0.82rem; }
@media (max-width: 680px) { .compare { grid-template-columns: 1fr; } }

/* Self-test details */
.skill-page details, .walkthrough details, .mini-project details {
    margin: 8px 0; padding: 10px 14px; background: #fff; border: 1px solid var(--border); border-radius: 6px; }
.skill-page details > summary, .walkthrough details > summary {
    cursor: pointer; font-weight: 500; color: var(--primary); list-style: revert; }
.skill-page details[open], .walkthrough details[open] { background: #f8f9fa; }

/* Search hint chips */
.site-search-hints { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 12px 0; align-items: center;
    font-size: 0.78rem; color: rgba(255,255,255,0.85); }
.site-search-hints span { margin-right: 4px; }
.site-search-hints button {
    background: rgba(255,255,255,0.15); border: 1px solid rgba(255,255,255,0.3); color: #fff;
    border-radius: 12px; padding: 2px 10px; font-size: 0.74rem; cursor: pointer; transition: background .12s; }
.site-search-hints button:hover { background: rgba(255,255,255,0.3); }
.site-search-hints.hidden { display: none; }

/* HTML live editor */
.html-live-shell { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 16px 0 24px;
    border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: #f8f9fa; }
.html-live-shell.is-mobile { grid-template-columns: 1fr; }
.html-live-pane { display: flex; flex-direction: column; min-height: 280px; }
.html-live-pane + .html-live-pane { border-left: 1px solid var(--border); }
.html-live-shell.is-mobile .html-live-pane + .html-live-pane { border-left: 0; border-top: 1px solid var(--border); }
.html-live-toolbar { display: flex; justify-content: space-between; align-items: center; padding: 6px 10px;
    background: #fff; border-bottom: 1px solid var(--border); font-size: 0.8rem; }
.html-live-label { font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.04em; }
.html-live-toolbar button { background: var(--primary); color: #fff; border: 0; padding: 4px 10px;
    border-radius: 4px; font-size: 0.78rem; cursor: pointer; margin-left: 6px; }
.html-live-toolbar button.html-live-reset { background: #5f6368; }
.html-live-toolbar button:hover { opacity: 0.9; }
.html-live-textarea { flex: 1; width: 100%; border: 0; padding: 10px 12px; font-family: Consolas, 'Courier New', monospace;
    font-size: 0.85rem; background: #202124; color: #e8eaed; resize: vertical; min-height: 240px; outline: none; }
.html-live-frame { flex: 1; width: 100%; border: 0; background: #fff; min-height: 240px; }
.html-live-saved-hint { color: #137333; font-size: 0.78rem; margin-left: 8px; opacity: 0; transition: opacity .25s; }
.html-live-saved-hint.show { opacity: 1; }
@media (max-width: 720px) { .html-live-shell { grid-template-columns: 1fr; } }

/* Excel formula sandbox */
.fx-shell { margin: 16px 0 24px; padding: 14px; background: #f8f9fa;
    border: 1px solid var(--border); border-radius: 8px; }
.fx-controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 12px; }
.fx-controls label { font-size: 0.85rem; display: flex; align-items: center; gap: 6px; }
.fx-cell, .fx-input { padding: 6px 8px; border: 1px solid var(--border); border-radius: 4px; font-size: 0.85rem;
    font-family: Consolas, 'Courier New', monospace; background: #fff; }
.fx-input { min-width: 220px; flex: 1; }
.fx-run { background: #0f9d58; color: #fff; border: 0; padding: 6px 14px; border-radius: 4px;
    font-weight: 500; cursor: pointer; font-size: 0.85rem; }
.fx-clear { background: #5f6368; color: #fff; border: 0; padding: 6px 14px; border-radius: 4px; cursor: pointer; font-size: 0.85rem; }
.fx-run:hover, .fx-clear:hover { opacity: 0.9; }
.fx-result { font-family: Consolas, 'Courier New', monospace; padding: 8px 10px; background: #fff;
    border: 1px solid var(--border); border-radius: 4px; font-size: 0.88rem; margin-bottom: 10px; min-height: 24px; }
.fx-result.error { background: #fce8e6; color: #c5221f; }
.fx-result.ok { background: #e6f4ea; color: #137333; }
.fx-table-wrap { overflow-x: auto; }
.fx-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; background: #fff; }
.fx-table th, .fx-table td { border: 1px solid var(--border); padding: 6px 10px; min-width: 70px; }
.fx-table thead { background: #f1f3f4; font-weight: 600; }
.fx-table tbody tr:nth-child(even) { background: #fafafa; }
.fx-table td.target { background: #fff3cd; }
.fx-table td.flash { animation: cellFlash 1s ease-out; }
@keyframes cellFlash { 0% { background: #fbbc04; } 100% { background: transparent; } }
.fx-help { margin-top: 10px; font-size: 0.82rem; }
.fx-help summary { cursor: pointer; color: var(--primary); }
.fx-help ul { margin-top: 8px; padding-left: 22px; }

/* Flashcards */
.flashcards-page { line-height: 1.6; }
.flashcards-app { background: #f8f9fa; border: 1px solid var(--border); border-radius: 12px;
    padding: 18px; margin: 16px 0 24px; }
.fc-header { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px;
    padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.fc-category-select, .fc-search { padding: 6px 10px; border: 1px solid var(--border); border-radius: 4px; font-size: 0.88rem; background: #fff; }
.fc-search { min-width: 180px; flex: 1; }
.fc-progress { font-size: 0.85rem; color: var(--text-secondary); margin-left: auto; }
.fc-reset { background: #5f6368; color: #fff; border: 0; padding: 6px 12px; border-radius: 4px; cursor: pointer; font-size: 0.82rem; }
.fc-card { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 28px 22px;
    margin: 14px 0; min-height: 180px; display: flex; flex-direction: column; justify-content: center;
    text-align: center; box-shadow: 0 2px 8px rgba(0,0,0,0.04); transition: transform .2s, box-shadow .2s; }
.fc-card.flipped { background: #e8f0fe; border-color: var(--primary); }
.fc-front { font-size: 1.15rem; font-weight: 500; color: var(--text); }
.fc-back { font-size: 0.96rem; color: var(--text); line-height: 1.55; text-align: left; }
.fc-hint { font-size: 0.85rem; color: #5f6368; font-style: italic; margin-top: 12px; }
.fc-controls { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 14px; }
.fc-controls button { padding: 8px 16px; border-radius: 4px; border: 1px solid var(--border);
    background: #fff; cursor: pointer; font-size: 0.88rem; }
.fc-controls button.fc-reveal { background: var(--primary); color: #fff; border-color: var(--primary); }
.fc-score-buttons { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 12px; }
.fc-score-buttons button { padding: 8px 16px; border-radius: 4px; border: 0; cursor: pointer; font-size: 0.88rem; font-weight: 500; }
.fc-score-buttons button[data-score="-1"] { background: #fce8e6; color: #c5221f; }
.fc-score-buttons button[data-score="0"] { background: #fef7e0; color: #c08600; }
.fc-score-buttons button[data-score="1"] { background: #e6f4ea; color: #137333; }
.fc-stats { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 14px; padding-top: 12px;
    border-top: 1px solid var(--border); font-size: 0.82rem; color: var(--text-secondary); }
.fc-stats span strong { color: var(--text); font-size: 0.92rem; }

/* Practice page polish */
.practice-page .timer-warning-banner { background: #fce8e6; border: 1px solid #f4c7c3; color: #c5221f;
    padding: 10px 14px; border-radius: 6px; margin: 12px 0; font-size: 0.9rem; }

/* Print stylesheet for checklist / walkthrough pages */
@media print {
    header, footer, .sidebar, .menu-toggle, .site-search-wrap, .next-step-grid, .timer, .timer-controls,
    .fc-controls, .fc-score-buttons, .fc-header, .html-live-shell, .fx-shell, script { display: none !important; }
    body { background: #fff; }
    .layout { display: block; }
    .content { max-width: 100%; padding: 0; }
    .checklist { font-size: 1.05rem; }
    .checklist input[type=checkbox] { width: 18px; height: 18px; }
    .walkthrough .steps > li { break-inside: avoid; page-break-inside: avoid; box-shadow: none; }
    a[href]::after { content: ""; }
    .pdf-link { color: var(--text) !important; background: transparent !important; border: 1px solid #000; }
}

/* Breadcrumb (added under content header for orientation) */
.breadcrumb { font-size: 0.82rem; color: var(--text-secondary); margin: 0 0 12px; }
.breadcrumb a { color: var(--text-secondary); text-decoration: none; }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb span.sep { margin: 0 6px; opacity: 0.5; }

/* Mockup image rendering inside step screenshots */
.mockup-img { display: block; max-width: 100%; height: auto; margin: 8px auto; border: 1px solid var(--border);
    border-radius: 6px; background: #fff; }
.mockup-figure { margin: 16px 0 22px; }
.mockup-figure figcaption { font-size: 0.82rem; color: var(--text-secondary); text-align: center;
    margin-top: 6px; font-style: italic; }

/* Visual-note (prose replacement for screenshot mockups we don't have) */
.visual-note {
    background: #eef3fb;
    border-left: 3px solid var(--primary);
    padding: 10px 14px;
    margin: 10px 0;
    border-radius: 0 6px 6px 0;
    font-size: 0.92rem;
    line-height: 1.55;
    color: var(--text);
}
.visual-note strong { color: var(--primary); }
