/* ─── Reset ─── */
*, *::before, *::after {
    margin: 0; padding: 0; box-sizing: border-box;
}

/* ─── Tokens ─── */
:root {
    --bg:       #0f0f11;
    --surface:  #1a1a1e;
    --surface2: #222228;
    --surface3: #2a2a32;
    --border:   #2e2e38;
    --border-hover: #3e3e48;
    --text:     #e8e8f0;
    --muted:    #888899;
    --dim:      #555566;

    --accent1:  #7c6af7;
    --accent2:  #e8764a;
    --accent3:  #4ab3a0;

    --green:  #3ecf8e;
    --red:    #f16060;
    --yellow: #f0c040;

    --font-display: 'DM Serif Display', Georgia, serif;
    --font-body:    'DM Sans', system-ui, sans-serif;
    --font-mono:    'DM Mono', monospace;

    --radius: 12px;
    --radius-sm: 8px;
    --trans:  0.2s ease;
    --trans-slow: 0.3s ease;

    --touch-target: 44px;
    --focus-ring: 0 0 0 3px rgba(124,106,247,0.3);
}

[data-theme="light"] {
    --bg:       #f5f5f7;
    --surface:  #ffffff;
    --surface2: #f0f0f5;
    --surface3: #e8e8f0;
    --border:   #e0e0ea;
    --border-hover: #d0d0da;
    --text:     #1a1a28;
    --muted:    #666680;
    --dim:      #9999aa;
    --focus-ring: 0 0 0 3px rgba(124,106,247,0.2);
}

/* ─── Skip Link ─── */
.skip-link {
    position: absolute;
    top: -100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--accent1);
    color: white;
    padding: 12px 24px;
    border-radius: 0 0 var(--radius) var(--radius);
    text-decoration: none;
    font-weight: 500;
    z-index: 10000;
    transition: top 0.2s ease;
}

.skip-link:focus {
    top: 0;
}

/* ─── Base ─── */
body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    transition: background var(--trans), color var(--trans);
}

html {
    overflow-x: clip;
}

html.panel-scroll-locked {
    overflow: hidden;
}

body.panel-scroll-locked {
    position: fixed;
    inset-inline: 0;
    width: 100%;
    overflow: hidden;
    overscroll-behavior: none;
}

/* ─── Focus Styles (Accessibility) ─── */
*:focus {
    outline: none;
}

*:focus-visible {
    outline: 2px solid var(--accent1);
    outline-offset: 2px;
}

button:focus-visible,
input:focus-visible,
[tabindex]:focus-visible {
    box-shadow: var(--focus-ring);
}

/* ─── Topbar ─── */
.topbar {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 0 32px;
    height: 52px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--bg);
    z-index: 100;
}

.topbar-brand {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text);
    text-decoration: none;
    letter-spacing: 0.04em;
    opacity: 0.8;
}

.topbar-links {
    display: flex;
    gap: 20px;
    margin-right: auto;
}

.topbar-links a {
    font-size: 0.82rem;
    color: var(--muted);
    text-decoration: none;
    letter-spacing: 0.02em;
    transition: color var(--trans);
}

.topbar-links a:hover { color: var(--text); }

.theme-toggle {
    background: none;
    border: 1px solid var(--border);
    color: var(--muted);
    width: 36px; height: 36px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.9rem;
    display: flex; align-items: center; justify-content: center;
    transition: all var(--trans);
}

.theme-toggle:hover { 
    color: var(--text); 
    border-color: var(--dim); 
}

.theme-toggle:focus-visible {
    box-shadow: var(--focus-ring);
}

/* ─── Container ─── */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 48px 24px 80px;
}

/* ─── Header ─── */
header {
    margin-bottom: 56px;
}

.header-label {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--accent1);
    margin-bottom: 14px;
}

header h1 {
    font-family: var(--font-display);
    font-size: clamp(2.2rem, 5vw, 3.4rem);
    font-weight: 400;
    line-height: 1.1;
    color: var(--text);
    margin-bottom: 14px;
}

header h1 em {
    font-style: italic;
    color: var(--accent1);
}

.header-sub {
    font-size: 1rem;
    color: var(--muted);
    max-width: 520px;
    margin-bottom: 36px;
}

/* ─── Stats bar ─── */
.stats-bar {
    display: flex;
    align-items: center;
    gap: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 28px;
    width: fit-content;
    margin-bottom: 24px;
    gap: 4px;
}

.stat-pill {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 24px;
    gap: 2px;
}

.stat-val {
    font-family: var(--font-mono);
    font-size: 1.4rem;
    font-weight: 500;
    color: var(--text);
}

.stat-lbl {
    font-size: 0.72rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.stat-divider {
    width: 1px;
    height: 36px;
    background: var(--border);
}

/* ─── Progress ─── */
.progress-wrap {
    display: flex;
    align-items: center;
    gap: 14px;
    max-width: 420px;
    margin-bottom: 16px;
}

.reset-progress-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--muted);
    font-size: 0.85rem;
    font-family: var(--font-body);
    cursor: pointer;
    transition: all var(--trans);
    margin-bottom: 24px;
}

.reset-progress-btn:hover {
    color: var(--red);
    border-color: var(--red);
    background: rgba(241,96,96,0.08);
}

.reset-progress-btn:focus-visible {
    box-shadow: 0 0 0 3px rgba(241,96,96,0.2);
    outline: none;
}

.reset-progress-btn svg {
    transition: transform 0.2s ease;
}

.reset-progress-btn:hover svg {
    transform: rotate(15deg);
}

.progress-track {
    flex: 1;
    height: 4px;
    background: var(--border);
    border-radius: 99px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: var(--accent1);
    border-radius: 99px;
    transition: width 0.5s ease;
}

.progress-label {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--muted);
    min-width: 32px;
}

/* ─── Phase sections ─── */
.phase-section {
    margin-bottom: 48px;
}

.phase-header {
    display: flex;
    align-items: baseline;
    gap: 16px;
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}

.phase-num {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--muted);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.phase-title {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 400;
    color: var(--text);
}

.phase-count {
    font-size: 0.75rem;
    color: var(--dim);
    margin-left: auto;
}

/* ─── Category Grid ─── */
.category-grid-inner {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
}

/* ─── Category Card ─── */
.category-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    cursor: pointer;
    transition: transform var(--trans), border-color var(--trans), box-shadow var(--trans);
    position: relative;
    overflow: hidden;
}

.category-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 3px;
    height: 100%;
    background: var(--phase-color, var(--accent1));
    transition: width var(--trans);
}

.category-card:hover {
    transform: translateY(-2px);
    border-color: var(--dim);
    box-shadow: 0 8px 24px rgba(0,0,0,0.25);
}

.category-card:hover::before {
    width: 5px;
}

.category-card:focus-visible {
    box-shadow: var(--focus-ring);
    border-color: var(--accent1);
}

.category-card.completed {
    border-color: var(--green);
    opacity: 0.85;
}

.category-card.completed::before {
    background: var(--green);
}

.category-card.completed .category-title {
    color: var(--green);
}

.category-card.in-progress::after {
    content: '⏳';
    position: absolute;
    top: 14px; right: 14px;
    font-size: 0.85rem;
}

/* Checkmark */
.card-check {
    position: absolute;
    top: 14px; right: 14px;
    width: 20px; height: 20px;
    background: var(--green);
    color: white;
    border-radius: 50%;
    font-size: 0.65rem;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700;
    opacity: 0;
    transition: opacity var(--trans);
}

.category-card.completed .card-check { opacity: 1; }

.category-num {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    color: var(--muted);
    letter-spacing: 0.1em;
    margin-bottom: 10px;
}

.category-icon {
    font-size: 1.5rem;
    margin-bottom: 10px;
    display: block;
    line-height: 1;
}

.category-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
    transition: color var(--trans);
}

.category-subtitle {
    font-size: 0.78rem;
    color: var(--muted);
    margin-bottom: 16px;
    line-height: 1.4;
}

.category-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.difficulty {
    font-size: 0.68rem;
    padding: 3px 9px;
    border-radius: 99px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.difficulty.easy   { background: rgba(62,207,142,0.12); color: var(--green); }
.difficulty.medium { background: rgba(240,192,64,0.12);  color: var(--yellow); }
.difficulty.hard   { background: rgba(241,96,96,0.12);   color: var(--red); }

.question-count {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--dim);
}

/* ─── Exercise Panel (Drawer/BottomSheet) ─── */
.exercise-panel {
    position: fixed;
    inset: 0;
    z-index: 1000;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.exercise-panel.active {
    visibility: visible;
    opacity: 1;
}

.panel-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.exercise-panel.active .panel-backdrop {
    opacity: 1;
}

.panel-content {
    position: absolute;
    background: var(--surface);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Desktop: Drawer lateral */
@media (min-width: 1024px) {
    .panel-content {
        right: 0;
        top: 0;
        bottom: 0;
        width: 480px;
        max-width: 90vw;
        transform: translateX(100%);
        border-left: 1px solid var(--border);
    }
    
    .exercise-panel.active .panel-content {
        transform: translateX(0);
    }
    
    .panel-handle {
        display: none;
    }
}

/* Tablet: Drawer mais largo */
@media (min-width: 768px) and (max-width: 1023px) {
    .panel-content {
        right: 0;
        top: 0;
        bottom: 0;
        width: 60%;
        max-width: 600px;
        transform: translateX(100%);
        border-left: 1px solid var(--border);
    }
    
    .exercise-panel.active .panel-content {
        transform: translateX(0);
    }
    
    .panel-handle {
        display: none;
    }
}

/* Mobile: Bottom Sheet */
@media (max-width: 767px) {
    .panel-content {
        left: 0;
        right: 0;
        bottom: 0;
        top: auto;
        height: 85vh;
        max-height: 600px;
        border-radius: 20px 20px 0 0;
        transform: translateY(100%);
    }
    
    .exercise-panel.active .panel-content {
        transform: translateY(0);
    }
    
    .panel-handle {
        display: flex;
        justify-content: center;
        padding: 12px 0 4px;
        cursor: grab;
    }
    
    .panel-handle:active {
        cursor: grabbing;
    }
    
    .handle-bar {
        width: 36px;
        height: 4px;
        background: var(--border);
        border-radius: 2px;
    }
}

/* ─── Panel Header ─── */
.panel-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.panel-back-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: 1px solid var(--border);
    color: var(--muted);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all var(--trans);
    flex-shrink: 0;
}

.panel-back-btn:hover {
    color: var(--text);
    border-color: var(--dim);
    background: var(--surface2);
}

.panel-title-group {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.panel-num {
    font-family: var(--font-mono);
    font-size: 1.5rem;
    font-weight: 500;
    color: var(--dim);
    line-height: 1;
}

.panel-title-wrap {
    min-width: 0;
    overflow: hidden;
}

.panel-title {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 400;
    color: var(--text);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.panel-subtitle {
    font-size: 0.8rem;
    color: var(--muted);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.panel-close-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--muted);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--trans);
    flex-shrink: 0;
}

.panel-close-btn:hover {
    color: var(--text);
    border-color: var(--dim);
}

/* ─── Panel Progress ─── */
.panel-progress {
    padding: 16px 20px;
    background: var(--surface2);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.progress-text {
    font-size: 0.85rem;
    color: var(--text);
    font-weight: 500;
}

.progress-percent {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--accent1);
}

.progress-track-sm {
    height: 6px;
    background: var(--bg);
    border-radius: 99px;
    overflow: hidden;
}

.progress-fill-sm {
    height: 100%;
    background: linear-gradient(90deg, var(--accent1), #9a8cf9);
    border-radius: 99px;
    transition: width 0.3s ease;
}

/* ─── Draft Indicator ─── */
.draft-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    background: rgba(62,207,142,0.1);
    border-bottom: 1px solid rgba(62,207,142,0.2);
    font-size: 0.75rem;
    color: var(--green);
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    flex-shrink: 0;
}

.draft-indicator.visible {
    opacity: 1;
    transform: translateY(0);
}

.draft-icon {
    font-size: 0.85rem;
}

/* ─── Question Container ─── */
.question-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    scroll-behavior: smooth;
}

/* ─── Question Block ─── */
.question-block {
    animation: fadeInUp 0.3s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.question-context {
    display: inline-block;
    background: rgba(124,106,247,0.1);
    border: 1px solid rgba(124,106,247,0.2);
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 0.8rem;
    color: var(--accent1);
    font-style: italic;
}

.question-number {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--muted);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 12px;
}

.question-text {
    font-size: 1.05rem;
    color: var(--text);
    margin-bottom: 24px;
    line-height: 1.65;
}

/* ─── Options ─── */
.options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.option {
    background: var(--bg);
    border: 2px solid var(--border);
    padding: 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.95rem;
    color: var(--text);
    min-height: var(--touch-target);
}

.option:hover {
    border-color: var(--border-hover);
    background: var(--surface3);
}

.option:focus-within {
    border-color: var(--accent1);
    box-shadow: var(--focus-ring);
}

.option.selected {
    border-color: var(--accent1);
    background: rgba(124,106,247,0.1);
}

.option.correct {
    border-color: var(--green);
    background: rgba(62,207,142,0.1);
    animation: correctPulse 0.4s ease;
}

.option.wrong {
    border-color: var(--red);
    background: rgba(241,96,96,0.1);
    animation: shake 0.4s ease;
}

.option.disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

@keyframes correctPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

.option-marker {
    width: 22px;
    height: 22px;
    border: 2px solid var(--border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--muted);
    flex-shrink: 0;
    transition: all 0.15s ease;
}

.option.selected .option-marker {
    background: var(--accent1);
    border-color: var(--accent1);
    color: white;
}

.option.correct .option-marker {
    background: var(--green);
    border-color: var(--green);
    color: white;
}

.option.wrong .option-marker {
    background: var(--red);
    border-color: var(--red);
    color: white;
}

.option-text {
    flex: 1;
}

.option-icon {
    font-size: 1.1rem;
    opacity: 0;
    transform: scale(0);
    transition: all 0.2s ease;
}

.option.correct .option-icon,
.option.wrong .option-icon {
    opacity: 1;
    transform: scale(1);
}

/* ─── Fill Input ─── */
.fill-input-wrapper {
    margin-bottom: 20px;
}

.fill-input {
    background: var(--bg);
    border: 2px solid var(--border);
    border-bottom-width: 3px;
    border-bottom-color: var(--accent1);
    color: var(--text);
    padding: 14px 18px;
    font-size: 1rem;
    font-family: var(--font-mono);
    border-radius: var(--radius-sm);
    width: 100%;
    max-width: 280px;
    text-align: center;
    transition: all var(--trans);
}

.fill-input:focus {
    outline: none;
    border-color: var(--accent1);
    box-shadow: var(--focus-ring);
}

.fill-input.correct {
    border-color: var(--green);
    background: rgba(62,207,142,0.1);
    color: var(--green);
}

.fill-input.wrong {
    border-color: var(--red);
    background: rgba(241,96,96,0.1);
    color: var(--red);
}

/* ─── Explanation ─── */
.explanation {
    background: rgba(240,192,64,0.08);
    border: 1px solid rgba(240,192,64,0.25);
    padding: 16px;
    margin-top: 20px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    color: var(--yellow);
    line-height: 1.6;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.explanation-icon {
    margin-right: 6px;
}

/* ─── Check Button ─── */
.check-btn-wrapper {
    margin-top: 24px;
    display: flex;
    justify-content: center;
}

.btn {
    padding: 14px 32px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    cursor: pointer;
    font-family: var(--font-body);
    font-weight: 600;
    transition: all 0.15s ease;
    letter-spacing: 0.01em;
    min-height: var(--touch-target);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: var(--accent1);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #8b7af8;
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(124,106,247,0.35);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-secondary {
    background: var(--surface2);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--surface3);
    border-color: var(--border-hover);
}

/* ─── Question Navigation ─── */
.question-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    background: var(--surface);
    flex-shrink: 0;
    gap: 12px;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all var(--trans);
    min-height: var(--touch-target);
}

.nav-btn:hover:not(:disabled) {
    background: var(--surface3);
    border-color: var(--border-hover);
}

.nav-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.nav-btn--prev {
    padding-left: 12px;
}

.nav-btn--next {
    padding-right: 12px;
}

.nav-dots {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
    max-width: 200px;
}

.nav-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border);
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
}

.nav-dot:hover {
    background: var(--dim);
    transform: scale(1.2);
}

.nav-dot.current {
    background: var(--accent1);
    transform: scale(1.3);
}

.nav-dot.answered {
    background: var(--green);
}

.nav-dot.current.answered {
    box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--green);
}

/* ─── Completion Screen ─── */
.completion-screen {
    position: absolute;
    inset: 0;
    background: var(--surface);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.completion-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    animation: bounce 0.6s ease;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

.completion-title {
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 400;
    color: var(--text);
    margin-bottom: 12px;
}

.completion-message {
    color: var(--muted);
    margin-bottom: 24px;
    font-size: 0.95rem;
}

.completion-score {
    font-family: var(--font-mono);
    font-size: 3rem;
    font-weight: 500;
    color: var(--accent1);
    margin-bottom: 32px;
}

.completion-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

/* ─── Skeleton Loading ─── */
.skeleton-container {
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

.skeleton-context {
    height: 32px;
    width: 140px;
    background: linear-gradient(90deg, var(--surface2) 25%, var(--surface3) 50%, var(--surface2) 75%);
    background-size: 200% 100%;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    animation: shimmer 1.5s infinite;
}

.skeleton-text {
    height: 20px;
    background: linear-gradient(90deg, var(--surface2) 25%, var(--surface3) 50%, var(--surface2) 75%);
    background-size: 200% 100%;
    border-radius: 4px;
    margin-bottom: 12px;
    animation: shimmer 1.5s infinite;
}

.skeleton-text--short {
    width: 70%;
}

.skeleton-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 24px;
}

.skeleton-option {
    height: 54px;
    background: linear-gradient(90deg, var(--surface2) 25%, var(--surface3) 50%, var(--surface2) 75%);
    background-size: 200% 100%;
    border-radius: var(--radius-sm);
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ─── Restore Draft Modal ─── */
.restore-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.restore-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
}

.restore-modal-content {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    max-width: 380px;
    width: 100%;
    text-align: center;
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.restore-modal-content h3 {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 400;
    margin-bottom: 12px;
    color: var(--text);
}

.restore-modal-content p {
    color: var(--muted);
    margin-bottom: 24px;
    font-size: 0.95rem;
}

.restore-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

/* ─── Toast Notification ─── */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 24px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    z-index: 3000;
    opacity: 0;
    transition: all 0.3s ease;
}

.toast.visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast-icon {
    font-size: 1.1rem;
}

.toast-message {
    font-size: 0.9rem;
    color: var(--text);
}

/* ─── Animations ─── */
.category-card {
    animation: fadeUp 0.4s ease both;
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ─── Responsive ─── */
@media (max-width: 640px) {
    .container { padding: 32px 16px 60px; }
    header h1 { font-size: 2rem; }
    .stats-bar { 
        padding: 14px 16px;
        width: 100%;
    }
    .stat-pill { padding: 0 14px; }
    .topbar { padding: 0 16px; }
    .category-grid-inner { grid-template-columns: 1fr 1fr; }
    
    .panel-header {
        padding: 12px 16px;
    }
    
    .panel-title {
        font-size: 1.1rem;
    }
    
    .panel-num {
        display: none;
    }
    
    .nav-dots {
        display: none;
    }
    
    .question-container {
        padding: 16px;
    }
    
    .option {
        padding: 14px;
    }
}

@media (max-width: 380px) {
    .category-grid-inner { grid-template-columns: 1fr; }
    
    .completion-score {
        font-size: 2.5rem;
    }
    
    .nav-btn span {
        display: none;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    :root {
        --border: #666;
        --muted: #aaa;
    }
    
    .option:focus-within,
    .fill-input:focus {
        outline: 3px solid var(--accent1);
        outline-offset: 2px;
    }
}

/* ─── Mobile Menu Styles ─── */
.topbar-menu-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 1.1rem;
    cursor: pointer;
    margin-left: auto;
    margin-right: 8px;
}

.topbar-menu-toggle:hover {
    border-color: var(--border-hover);
}

.mobile-menu {
    display: none;
    position: fixed;
    top: 52px;
    left: 0;
    right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    z-index: 99;
    padding: 12px;
    flex-direction: column;
    gap: 8px;
}

.mobile-menu.active {
    display: flex;
}

.mobile-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    transition: background var(--trans);
}

.mobile-menu-item:hover {
    background: var(--surface);
}

@media (max-width: 768px) {
    .topbar-menu-toggle {
        display: inline-flex;
    }
    .topbar-links {
        display: none;
    }
}
