/* style.css – dark mode, notebook aesthetic, responsive */

/* ===== VARIABILE ===== */
:root {
    --bg-dark: #0d0d0d;
    --bg-card: #1a1a1a;
    --bg-sidebar: #1a1a1a;
    --bg-header: #0f0f0fee;
    --accent: #a78bfa;
    --accent-dark: #7c5cc4;
    --success: #1b5e20;
    --success-border: #2e7d32;
    --error: #b71c1c;
    --error-border: #c62828;
    --text-primary: #e8e8e8;
    --text-secondary: #bbbbbb;
    --border-light: #2e2e2e;
    --border-dark: #444;
    --shadow: 0 4px 0 #111;
    --shadow-hover: 0 6px 0 #111;
    --transition: 0.2s;
    --radius-btn: 40px;
    --radius-card: 40px 20px 20px 20px;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;

    /* ── subject accent colors ── */
    --arch-color:  #60a5fa;
    --prog-color:  #4ade80;
    --ment-color:  #fb923c;
    --img-color:   #f472b6;
    --asdn-color:  #2dd4bf;
    --fav-color:   #facc15;
}

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

body {
    font-family: 'Atkinson Hyperlegible', 'Segoe UI', Roboto, system-ui, sans-serif;
    background: var(--bg-dark);
    background-image: 
        linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
    background-size: 40px 40px;
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.5;
    padding: 0 0 2rem 0;
}

/* ===== HEADER ===== */
.header {
    background: var(--bg-header);
    border-bottom: 1px solid #222;
    box-shadow: 0 2px 0 #111;
    padding: 0.8rem 0;
    margin-bottom: 2rem;
    position: sticky;
    top: 0;
    z-index: 50;
}

/* Header toggle button (collapse/expand overlay) */
.header-toggle {
    position: fixed;
    top: 10px;
    right: 14px;
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: #252525;
    border: 1px solid #383838;
    color: #aaa;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.75rem;
    z-index: 200;
    transition: color 160ms ease, background 160ms ease, border-color 160ms ease;
}
.header-toggle:hover { background: #333; color: #fff; border-color: #555; }

/* Collapsed state — slightly dimmed, same spot */
.header.header-collapsed .header-toggle {
    color: #666;
}
.header.header-collapsed .header-toggle:hover { color: #fff; }

/* Collapsed header: hide the large header content but keep toggle visible */
.header.header-collapsed {
    padding: 0.28rem 0;
    margin-bottom: 0.5rem;
}
.header.header-collapsed .header-content {
    display: none;
}

.header-content {
    max-width: 1300px;
    margin: 0 auto;
    padding: 0 var(--spacing-md);
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.logo-text {
    font-family: 'Space Mono', monospace;
    font-size: 1.3rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.5px;
}
.logo-text span { color: var(--arch-color); }

.header-subtitle {
    font-size: 0.75rem;
    color: #888;
    background: #1e1e1e;
    padding: 0.2rem 1rem;
    border-radius: var(--radius-btn);
    border: 1px solid #333;
    font-family: 'Space Mono', monospace;
    display: inline-block;
}

/* Make the tiny update link look like plain subtitle text */
.update-link {
    color: inherit;
    text-decoration: none;
}
.update-link:hover {
    color: var(--text-primary);
    text-decoration: underline;
}

/* ===== DASHBOARD ===== */
.dashboard-container {
    max-width: 1300px;
    margin: 0 auto;
    padding: 0 var(--spacing-md);
    position: relative;
}

/* Notificare update (overlay non-intruziv, doar pe dashboard) */
.site-update-overlay {
    position: fixed;
    right: max(0.75rem, env(safe-area-inset-right, 0px));
    bottom: max(0.75rem, env(safe-area-inset-bottom, 0px));
    z-index: 95;
    max-width: min(26rem, calc(100vw - 1.5rem));
    pointer-events: none;
}
.site-update-card {
    pointer-events: auto;
    position: relative;
    background: var(--bg-card);
    border: 1.5px solid rgba(45, 212, 191, 0.35);
    border-radius: 16px;
    padding: 0.85rem 2.25rem 0.85rem 1rem;
    box-shadow:
        0 12px 40px rgba(0, 0, 0, 0.45),
        0 0 0 1px rgba(255, 255, 255, 0.04) inset,
        0 0 18px rgba(45, 212, 191, 0.12);
    color: var(--text-secondary);
    font-size: 0.88rem;
    line-height: 1.45;
}
.site-update-close {
    position: absolute;
    top: 0.35rem;
    right: 0.35rem;
    width: 2rem;
    height: 2rem;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #888;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s, background 0.15s;
}
.site-update-close:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}
.site-update-text {
    margin: 0 0 0.55rem 0;
    color: var(--text-primary);
}
.site-update-card kbd {
    display: inline-block;
    padding: 0.12rem 0.35rem;
    margin: 0 0.05rem;
    font-size: 0.78rem;
    font-family: 'Space Mono', monospace;
    background: #0d0d0d;
    border: 1px solid #444;
    border-radius: 6px;
    color: #e0e0e0;
}
.site-update-meta {
    margin: 0;
    font-size: 0.78rem;
    color: var(--asdn-color);
    line-height: 1.35;
}

/* 'Detalii' button inside the site-update overlay */
.site-update-more {
    border: none;
    background: transparent;
    color: var(--asdn-color);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.78rem;
    margin-left: 0.35rem;
    text-decoration: underline;
    padding: 0 0.15rem;
}
.site-update-more:hover { color: var(--accent); }
.site-update-chip {
    position: fixed;
    right: max(0.5rem, env(safe-area-inset-right, 0px));
    bottom: max(0.5rem, env(safe-area-inset-bottom, 0px));
    z-index: 96;
    max-width: min(20rem, calc(100vw - 1rem));
    appearance: none;
    -webkit-appearance: none;
    margin: 0;
    font: inherit;
    text-align: left;
    cursor: pointer;
    background: linear-gradient(145deg, rgba(45,212,191,0.04) 0%, rgba(20,20,20,0.94) 100%);
    border: 1.5px solid rgba(45, 212, 191, 0.55);
    border-radius: 10px;
    padding: 0.4rem 0.6rem;
    font-size: 0.68rem;
    line-height: 1.35;
    color: #dffaf6;
    box-shadow: 0 0 0 1px rgba(45, 212, 191, 0.12);
    transition: border-color 0.12s, color 0.12s, background 0.12s;
}
.site-update-chip:hover {
    color: #e9fffb;
    border-color: rgba(45, 212, 191, 0.85);
    background: rgba(18, 28, 24, 0.98);
    box-shadow: 0 0 0 1px rgba(45, 212, 191, 0.22);
}
.site-update-chip.solid {
    background: rgba(18, 28, 24, 0.98);
    border-color: rgba(45, 212, 191, 0.85);
    box-shadow: 0 0 0 1px rgba(45, 212, 191, 0.18);
}
.site-update-chip:focus {
    outline: none;
}
.site-update-chip:focus-visible {
    outline: 2px solid rgba(252, 165, 165, 0.9);
    outline-offset: 2px;
}
.site-update-chip-text {
    display: block;
}

.dashboard-header h1 {
    font-size: 2rem;
    font-weight: 800;
    color: #ffffff;
    text-shadow: 4px 4px 0 #3a3a3a;
    margin-bottom: 0.25rem;
    letter-spacing: -1px;
}

.dashboard-subtitle {
    font-size: 1rem;
    color: #dddddd;
    background: #2a2a2a;
    display: inline-block;
    padding: 0.3rem 1.5rem;
    border-radius: 60px;
    border: 2px solid var(--border-light);
    box-shadow: inset 0 -2px 0 #3a3a3a;
}

/* ===== TABS ===== */
.tabs-scroll {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 0.65rem 0.75rem;
    overflow-x: auto;
    padding: 1rem 0.2rem 1.25rem 0.2rem;
    margin-bottom: 1rem;
    scrollbar-width: thin;
    scrollbar-color: #666 #2a2a2a;
    -ms-overflow-style: auto;
}

.tabs-scroll::-webkit-scrollbar {
    height: 6px;
}
.tabs-scroll::-webkit-scrollbar-thumb {
    background: #666;
    border-radius: 20px;
    border: 2px solid #2a2a2a;
}
.tabs-scroll::-webkit-scrollbar-track {
    background: #2a2a2a;
    border-radius: 20px;
}

.mode-btn {
    background: #2d2d2d;
    border: 2px solid var(--border-light);
    color: #dddddd;
    padding: 0.6rem 1.4rem;
    border-radius: var(--radius-btn);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 3px 0 #222;
    white-space: nowrap;
    min-height: 44px; /* touch target */
}

.mode-btn:hover {
    background: #3d3d3d;
    color: #ffffff;
}

.mode-btn.active-tab {
    background: var(--tab-active-bg, var(--accent));
    border-color: var(--tab-active-border, var(--accent-dark));
    color: #000000;
    box-shadow: 0 4px 0 var(--tab-active-shadow, #6a4e9c);
}

/* ── per-subject tab active colors ── */
.mode-btn[data-subject="arch"].active-tab { --tab-active-bg: var(--arch-color); --tab-active-border: #2a70d0; --tab-active-shadow: #1a50aa; }
.mode-btn[data-subject="prog"].active-tab { --tab-active-bg: var(--prog-color); --tab-active-border: #22a050; --tab-active-shadow: #156030; }
.mode-btn[data-subject="ment"].active-tab { --tab-active-bg: var(--ment-color); --tab-active-border: #d07020; --tab-active-shadow: #a05010; }
.mode-btn[data-subject="img"].active-tab  { --tab-active-bg: var(--img-color);  --tab-active-border: #d04090; --tab-active-shadow: #a02070; }
.mode-btn[data-subject="asdn"].active-tab { --tab-active-bg: var(--asdn-color); --tab-active-border: #1aa099; --tab-active-shadow: #0a7070; }
.mode-btn[data-subject="fav"].active-tab  { --tab-active-bg: var(--fav-color);  --tab-active-border: #d0a800; --tab-active-shadow: #a08000; }

/* ===== CARDS ===== */
.cards-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin: 2rem 0;
}

@media (min-width: 600px) {
    .cards-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 900px) {
    .cards-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1200px) {
    .cards-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.eval-card {
    background: var(--bg-card);
    border: 2px solid #444;
    border-radius: var(--radius-card);
    padding: 1.5rem;
    box-shadow: 4px 4px 0 #111;
    transition: border-color 0.15s ease, opacity 0.15s ease;
    cursor: pointer;
    position: relative;
    display: flex;
    flex-direction: column;
    color: var(--text-primary);
    min-height: 250px;
    overflow: hidden;
    animation: cardFadeUp 0.35s ease both;
}

.eval-card:nth-child(1) { animation-delay: 0.04s; }
.eval-card:nth-child(2) { animation-delay: 0.09s; }
.eval-card:nth-child(3) { animation-delay: 0.14s; }
.eval-card:nth-child(4) { animation-delay: 0.19s; }

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

/* top accent strip */
.eval-card::before {
    content: '';
    position: absolute; top: 0; left: 0; right: 0; height: 3px;
    background: var(--card-accent, #444);
    border-radius: 40px 20px 0 0;
    transition: height 0.15s ease;
}
.eval-card:hover::before { height: 5px; }

/* per-subject card accents */
.eval-card[data-subject="arch"] { --card-accent: var(--arch-color); }
.eval-card[data-subject="prog"] { --card-accent: var(--prog-color); }
.eval-card[data-subject="ment"] { --card-accent: var(--ment-color); }
.eval-card[data-subject="img"]  { --card-accent: var(--img-color);  }
.eval-card[data-subject="asdn"] { --card-accent: var(--asdn-color); }

.eval-card:hover {
    box-shadow: 6px 6px 0 #111;
    border-color: var(--card-accent, #444);
}

.eval-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-md);
}

.eval-icon {
    font-size: 3rem;
    line-height: 1;
}

.eval-badge {
    background: #3d3d3d;
    color: #dddddd;
    font-weight: 600;
    padding: 0.3rem 1rem;
    border-radius: var(--radius-btn);
    border: 1px solid var(--border-dark);
    font-size: 0.75rem;
    margin-top: 20px;
}

.eval-card h3 {
    font-size: 1.2rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 0.5rem;
}

.eval-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: var(--spacing-md);
    flex: 1;
}

.eval-footer {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.eval-tag {
    background: #3d3d3d;
    color: #dddddd;
    padding: 0.2rem 0.8rem;
    border-radius: 30px;
    font-size: 0.7rem;
    font-weight: 600;
    border: 1px solid var(--border-dark);
}

/* ===== MODAL ===== */
.modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s;
    padding: var(--spacing-md);
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.72);
}

.modal-content {
    background: #2d2d2d;
    border: 3px solid #666;
    border-radius: 60px 30px 30px 30px;
    padding: 2rem;
    max-width: 700px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 8px 8px 0 #111;
    color: var(--text-primary);
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: #3d3d3d;
    border: 2px solid var(--border-dark);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    color: #ffffff;
    transition: var(--transition);
}

.modal-close:hover {
    background: #555;
    transform: none;
}

.modal-icon {
    font-size: 3.5rem;
    text-align: center;
}

.modal-header h2 {
    font-size: 1.8rem;
    color: #ffffff;
    text-align: center;
    margin-top: 0.5rem;
}

.mode-options {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin-top: 1.5rem;
}

@media (min-width: 600px) {
    .mode-options {
        grid-template-columns: 1fr 1fr;
    }
}

.mode-card {
    background: #3a3a3a;
    border: 3px solid #666;
    border-radius: 40px 20px 20px 20px;
    padding: 1.5rem;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 7px 7px 0 #222;
    color: #eee;
}

.mode-card:hover {
    transform: translate(-3px, -3px);
    box-shadow: 10px 10px 0 #1a1a1a;
}

.mode-card-icon {
    font-size: 2.8rem;
    margin-bottom: 0.5rem;
}

.mode-card h3 {
    font-size: 1.6rem;
    font-weight: 700;
    color: #ffffff;
}

.mode-features {
    list-style: none;
    margin: 1rem 0;
}

.mode-features li {
    font-size: 0.9rem;
    padding: 0.2rem 0;
    color: #cccccc;
}

.mode-btn.special {
    display: inline-block;
    background: var(--accent);
    padding: 0.6rem 2rem;
    border-radius: var(--radius-btn);
    font-weight: 700;
    border: 2px solid var(--accent-dark);
    color: #000000;
    min-height: 44px;
}

.settings-modal-content {
    max-width: 860px;
}

.settings-note {
    margin-top: 0.9rem;
    text-align: center;
    color: #b9b9b9;
    font-size: 0.95rem;
}

.settings-layout {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
    margin-top: 1.4rem;
}

.settings-panel {
    background: #232323;
    border: 1px solid #3a3a3a;
    border-radius: 28px;
    padding: 1.15rem 1.2rem;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}

.settings-panel h3 {
    font-size: 1.05rem;
    color: #fff;
    margin-bottom: 0.35rem;
}

.settings-panel p {
    color: #a8a8a8;
    font-size: 0.88rem;
    margin-bottom: 1rem;
    line-height: 1.55;
}

.settings-switch-list {
    display: grid;
    gap: 0.7rem;
}

.settings-switch {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 18px;
    padding: 0.8rem 0.9rem;
    color: #e8e8e8;
    font-weight: 600;
}

.settings-switch-main {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    min-width: 0;
}

.settings-switch input {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
    flex-shrink: 0;
}

.settings-field {
    display: grid;
    gap: 0.45rem;
    margin-bottom: 0.9rem;
    color: #d7d7d7;
    font-weight: 600;
}

.settings-field-title {
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.settings-field select {
    background: #151515;
    color: #f0f0f0;
    border: 1px solid #333;
    border-radius: 14px;
    padding: 0.7rem 0.85rem;
    min-height: 44px;
}

.settings-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.8rem;
    flex-wrap: wrap;
    margin-top: 1.2rem;
}

.mode-btn[data-subject="all"].active-tab {
    --tab-active-bg: #f8d66d;
    --tab-active-border: #cba21a;
    --tab-active-shadow: #937200;
}

.all-section-dot {
    background: linear-gradient(135deg, var(--arch-color), var(--img-color));

}

.all-section-label {
    background: linear-gradient(90deg, #f8d66d, #7dd3fc, #f472b6);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.all-tab-shell {
    margin-top: 1.35rem;
    padding: 1.2rem;
    border: 1px solid #303030;
    border-radius: 34px;
    background:
        radial-gradient(circle at top right, rgba(244, 114, 182, 0.12), transparent 28%),
        radial-gradient(circle at top left, rgba(96, 165, 250, 0.12), transparent 26%),
        #151515;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.all-tab-hero {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: end;
    margin-bottom: 1rem;
}

.all-tab-hero h2 {
    font-size: 1.6rem;
    color: #fff;
    margin-bottom: 0.25rem;
}

.all-tab-hero p {
    color: #a7a7a7;
    max-width: 720px;
    line-height: 1.6;
}

.all-tab-count {
    white-space: nowrap;
    padding: 0.55rem 0.9rem;
    border-radius: 999px;
    border: 1px solid #333;
    background: rgba(255,255,255,0.04);
    color: #eaeaea;
    font-family: 'Space Mono', monospace;
    font-size: 0.78rem;
}

.all-tab-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.all-view-switch {
    display: inline-flex;
    gap: 0.45rem;
    padding: 0.35rem;
    border-radius: 999px;
    border: 1px solid #333;
    background: rgba(255,255,255,0.04);
}

.all-view-btn {
    border: none;
    background: transparent;
    color: #d0d0d0;
    padding: 0.55rem 0.95rem;
    border-radius: 999px;
    font-weight: 700;
    cursor: pointer;
    min-height: 40px;
}

.all-view-btn.active {
    background: #f8d66d;
    color: #111;
}

.all-search-wrap {
    flex: 1;
    min-width: min(100%, 260px);
}

.all-search-wrap input {
    width: 100%;
    min-height: 44px;
    border-radius: 16px;
    border: 1px solid #333;
    background: #101010;
    color: #f1f1f1;
    padding: 0.8rem 1rem;
    outline: none;
}

.all-search-wrap input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.14);
}

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

.all-card {
    width: 100%;
    text-align: left;
    border: 1px solid #323232;
    background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.01));
    border-radius: 28px;
    padding: 1rem;
    color: #ececec;
    cursor: pointer;
    transition: border-color 0.16s ease;
}

.all-card:hover {
    border-color: var(--all-accent);
}

.all-card-top,
.all-card-foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.6rem;
}

.all-card-icon {
    font-size: 1.8rem;
}

.all-card-badge,
.all-card-subject,
.all-card-foot {
    font-family: 'Space Mono', monospace;
    font-size: 0.72rem;
}

.all-card-badge,
.all-card-tags span {
    background: rgba(255,255,255,0.05);
    border: 1px solid #363636;
    border-radius: 999px;
    padding: 0.3rem 0.65rem;
}

.all-card-subject {
    margin: 0.85rem 0 0.35rem;
    color: var(--all-accent);
}

.all-card h3 {
    font-size: 1.04rem;
    color: #fff;
    margin-bottom: 0.45rem;
}

.all-card p {
    color: #b4b4b4;
    line-height: 1.55;
    min-height: 3.2em;
}

.all-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin: 0.85rem 0;
}

.all-card-foot {
    color: #a4a4a4;
    margin-top: 0.35rem;
}

.all-list {
    display: grid;
    gap: 0.75rem;
}

.all-list-row {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
    text-align: left;
    padding: 0.95rem 1rem;
    border-radius: 24px;
    border: 1px solid #313131;
    background: rgba(255,255,255,0.02);
    color: #ececec;
    cursor: pointer;
    transition: transform 0.14s ease, border-color 0.14s ease, background 0.14s ease;
}

.all-list-row:hover {
    transform: translateX(4px);
    border-color: var(--all-accent);
    background: rgba(255,255,255,0.04);
}

.all-list-main {
    display: flex;
    align-items: start;
    gap: 0.9rem;
    min-width: 0;
}

.all-list-leading {
    width: 46px;
    height: 46px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.05);
    font-size: 1.4rem;
    flex-shrink: 0;
}

.all-list-copy {
    min-width: 0;
}

.all-list-title {
    color: #fff;
    font-weight: 800;
    margin-bottom: 0.28rem;
}

.all-list-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem 0.85rem;
    color: var(--all-accent);
    font-size: 0.76rem;
    font-family: 'Space Mono', monospace;
    margin-bottom: 0.35rem;
}

.all-list-copy p {
    color: #b2b2b2;
    line-height: 1.5;
}

.all-list-open {
    color: #8d8d8d;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.all-tree {
    display: grid;
    gap: 0.9rem;
}

.all-tree-group {
    border: 1px solid #323232;
    border-radius: 26px;
    background: rgba(255,255,255,0.02);
    overflow: hidden;
}

.all-tree-group summary {
    list-style: none;
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    align-items: center;
    padding: 0.95rem 1rem;
    cursor: pointer;
    color: #fff;
    font-weight: 800;
    background: linear-gradient(90deg, rgba(255,255,255,0.04), transparent);
}

.all-tree-group summary::-webkit-details-marker {
    display: none;
}

.all-tree-items {
    padding: 0 0.9rem 0.9rem;
    display: grid;
    gap: 0.7rem;
}

.all-tree-item {
    width: 100%;
    display: flex;
    align-items: start;
    gap: 0.8rem;
    text-align: left;
    border: 1px solid #2d2d2d;
    border-radius: 20px;
    background: #121212;
    color: #ececec;
    padding: 0.85rem 0.9rem;
    cursor: pointer;
}

.all-tree-node {
    width: 40px;
    height: 40px;
    border-radius: 14px;
    background: rgba(255,255,255,0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.2rem;
}

.all-tree-copy {
    display: grid;
    gap: 0.2rem;
}

.all-tree-copy strong {
    color: #fff;
}

.all-tree-copy span {
    color: var(--all-accent);
    font-size: 0.76rem;
    font-family: 'Space Mono', monospace;
}

.all-tree-copy p {
    color: #aeaeae;
    line-height: 1.5;
}

.all-empty-state {
    padding: 2rem 1.1rem;
    text-align: center;
    color: #adadad;
    border: 1px dashed #3a3a3a;
    border-radius: 24px;
}

@media (max-width: 700px) {
    .all-tab-shell {
        padding: 1rem;
        border-radius: 26px;
    }

    .all-tab-hero {
        flex-direction: column;
        align-items: start;
    }

    .all-tab-toolbar {
        align-items: stretch;
    }

    .all-view-switch {
        width: 100%;
        justify-content: space-between;
    }

    .all-view-btn {
        flex: 1;
    }

    .all-list-row {
        padding: 0.9rem;
    }

    .all-list-open {
        display: none;
    }
}

.setting-info {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 1px solid #4f4f4f;
    color: #d5d5d5;
    background: #111;
    font-size: 0.75rem;
    font-weight: 700;
    font-family: 'Space Mono', monospace;
    cursor: help;
    flex-shrink: 0;
    transition: border-color 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.setting-info:hover,
.setting-info:focus-visible {
    border-color: var(--accent);
    color: #fff;
    outline: none;
}

.setting-info::after {
    content: attr(data-tooltip);
    position: absolute;
    right: 0;
    bottom: calc(100% + 10px);
    width: min(280px, 65vw);
    background: rgba(10, 10, 10, 0.96);
    color: #f4f4f4;
    border: 1px solid #3f3f3f;
    border-radius: 14px;
    padding: 0.7rem 0.8rem;
    font-size: 0.76rem;
    line-height: 1.5;
    text-align: left;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.16s ease;
    z-index: 15;
}

.setting-info:hover::after,
.setting-info:focus-visible::after {
    opacity: 1;
}

/* ===== QUIZ SECTION — NEW DESIGN ===== */
.quiz-shell {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--spacing-md) 3rem;
    display: grid;
    grid-template-columns: 1fr 290px;
    gap: 1.5rem;
    align-items: start;
}

@media (max-width: 900px) {
    .quiz-shell { grid-template-columns: 1fr; }
}

/* top bar */
.quiz-topbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.2rem;
}

.back-btn {
    background: #1e1e1e;
    border: 1px solid #333;
    color: #666;
    font-size: 0.8rem;
    padding: 0.5rem 1.1rem;
    border-radius: 30px;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: color 0.15s, border-color 0.15s;
    min-height: 36px;
    font-family: 'Space Mono', monospace;
}
.back-btn:hover { color: var(--text-primary); border-color: #555; }

/* segmented progress track */
.quiz-progress-track {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 3px;
    overflow: hidden;
}
.progress-seg {
    flex: 1;
    height: 4px;
    background: #2a2a2a;
    border-radius: 4px;
    transition: background 0.3s ease;
    min-width: 4px;
}
.progress-seg.seg-done    { background: #22c55e; }
.progress-seg.seg-current { background: var(--accent); }
.progress-seg.seg-wrong   { background: #ef4444; }

/* hide old info box - q number is now in card */
#quiz-info { display: none; }

/* ── question card ── */
.question-card {
    background: #1a1a1a;
    border: 1px solid #272727;
    border-radius: 36px;
    padding: 2rem 2rem 1.5rem;
    position: relative;
    overflow: hidden;
    animation: qSlideUp 0.28s cubic-bezier(0.22,1,0.36,1) both;
}
@keyframes qSlideUp {
    from { opacity:0; }
    to   { opacity:1; }
}
.question-card::before {
    /* Removed the decorative left accent bar to simplify question cards */
    display: none;
}

.q-meta {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 1.4rem;
}
.q-number {
    font-family: 'Space Mono', monospace;
    font-size: 0.7rem;
    color: var(--accent);
    background: #111;
    border: 1px solid #2a2a2a;
    padding: 0.25rem 0.8rem;
    border-radius: 30px;
    letter-spacing: 0.05em;
}
.q-type-badge {
    font-family: 'Space Mono', monospace;
    font-size: 0.65rem;
    color: #555;
    padding: 0.2rem 0.7rem;
    border: 1px solid #252525;
    border-radius: 30px;
}
.q-star {
    margin-left: auto;
    background: none;
    border: 1px solid #2a2a2a;
    border-radius: 50%;
    width: 32px; height: 32px;
    font-size: 0.95rem;
    cursor: pointer;
    color: #444;
    display: flex; align-items:center; justify-content:center;
    transition: all 0.15s;
    flex-shrink: 0;
}
.q-star:hover { border-color: #f6e05b; color: #f6e05b; }
.q-star.active { background: #1a1600; border-color: #f6e05b; color: #f6e05b; }

.question-text {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.65;
    margin-bottom: 1.6rem;
    padding-right: 0;
}

/* ── answer options ── */
.answer-option {
    display: flex;
    align-items: flex-start;
    gap: 0.9rem;
    background: #1e1e1e;
    border: 1.5px solid #2a2a2a;
    border-radius: 18px;
    padding: 0;
    margin: 0.5rem 0;
    cursor: pointer;
    transition: border-color 0.12s, background 0.12s, transform 0.1s;
    overflow: hidden;
    min-height: 52px;
    position: relative;
}
.answer-option:hover:not([class*="correct"]):not([class*="incorrect"]) {
    border-color: var(--accent);
    background: #141e2e;
    transform: translateX(3px);
}
.answer-option input {
    margin: 1rem 0 1rem 1.1rem;
    width: 1.1rem; height: 1.1rem;
    flex-shrink: 0;
    cursor: pointer;
    accent-color: var(--accent);
}
.answer-option label {
    flex: 1;
    padding: 0.9rem 1rem 0.9rem 0;
    cursor: pointer;
    font-size: 0.97rem;
    color: var(--text-primary);
    display: block;
    line-height: 1.45;
}
.answer-option input:focus { outline: 2px solid var(--accent); outline-offset: 2px; }

.answer-option.correct {
    background: #0a1f0f;
    border-color: #22c55e;
    animation: flashCorrect 0.4s ease;
}
.answer-option.incorrect {
    background: #1f0a0a;
    border-color: #ef4444;
    animation: shake 0.35s ease;
}
@keyframes flashCorrect {
    0%  { transform: scale(1); }
    40% { transform: scale(1.012); }
    100%{ transform: scale(1); }
}
@keyframes shake {
    0%,100%{ transform: translateX(0); }
    20%    { transform: translateX(-5px); }
    60%    { transform: translateX(4px); }
}
.answer-option.correct label { color: #22c55e; }
.answer-option.incorrect label { color: #ef4444; }

/* ── fill input ── */
.fill-input {
    background: #1e1e1e;
    border: 1.5px solid #2a2a2a;
    border-radius: 18px;
    padding: 0.9rem 1.3rem;
    font-size: 1rem;
    width: 100%;
    margin: 0.5rem 0;
    color: var(--text-primary);
    min-height: 52px;
    transition: border-color 0.15s;
}
.fill-input:focus { outline: none; border-color: var(--accent); }

/* ── fill dropdown ── */
.fill-dropdown-select {
    display: inline-block;
    width: auto;
    min-width: 120px;
    background: #1e1e1e;
    border: 1.5px solid #3a3a3a;
    border-radius: 14px;
    padding: 0.4rem 1.8rem 0.4rem 0.9rem;
    font-size: 0.95rem;
    color: var(--text-primary);
    margin: 0 4px;
    vertical-align: middle;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2"><polyline points="6 9 12 15 18 9"/></svg>');
    background-repeat: no-repeat;
    background-position: right 0.7rem center;
    background-size: 1rem;
    min-height: 40px;
}
.fill-dropdown-select:focus { outline: 2px solid var(--accent); }

.question-text-inline {
    line-height: 2.8;
    margin: 1rem 0;
    font-size: 1rem;
    color: var(--text-primary);
}

/* ── match rows ── */
.match-row {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    background: #1e1e1e;
    border-radius: 16px;
    padding: 0.9rem 1.1rem;
    margin: 0.5rem 0;
    border: 1.5px solid #2a2a2a;
    color: var(--text-primary);
}
@media (min-width: 600px) {
    .match-row { flex-direction: row; align-items: center; gap: 1rem; }
}
.match-row select {
    width: 100%;
    background: #141414;
    border: 1.5px solid #333;
    border-radius: 12px;
    padding: 0.5rem 1rem;
    color: var(--text-primary);
    min-height: 40px;
    cursor: pointer;
}
.match-row.correct { background: #0a1f0f; border-color: #22c55e; }
.match-row.incorrect { background: #1f0a0a; border-color: #ef4444; }

/* ── ordering ── */
.ordering-container { display: flex; flex-direction: column; gap: 0.5rem; margin: 1rem 0; }
.ordering-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #1e1e1e;
    border: 1.5px solid #2a2a2a;
    border-radius: 14px;
    padding: 0.8rem 1rem;
    color: var(--text-primary);
    cursor: grab;
    transition: transform 220ms cubic-bezier(0.2,0,0,1), background 0.15s;
    will-change: transform;
    min-height: 52px;
}
.ordering-item:active { cursor: grabbing; background: #282828; }
.ordering-controls { display: flex; gap: 0.5rem; }
.ordering-btn {
    background: #141414;
    border: 1.5px solid #333;
    border-radius: 50%;
    width: 36px; height: 36px;
    cursor: pointer;
    color: #aaa;
    font-size: 1rem;
    display: flex; align-items:center; justify-content:center;
    transition: all 0.12s;
}
.ordering-btn:hover { background: var(--accent); color: #000; border-color: var(--accent); }
.ordering-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.drop-indicator {
    height: 6px;
    background: var(--accent);
    border-radius: 4px;
    margin: 4px 0;
    transform-origin: left center;
    transform: scaleX(0);
    opacity: 0;
    transition: transform 140ms ease, opacity 140ms ease;
    pointer-events: none;
}

/* ── feedback banner ── */
.feedback-banner {
    border-radius: 16px;
    padding: 1rem 1.3rem;
    display: flex;
    align-items: flex-start;
    gap: 0.8rem;
    margin-top: 0.8rem;
    animation: feedIn 0.22s cubic-bezier(0.22,1,0.36,1) both;
}
@keyframes feedIn {
    from { opacity:0; }
    to   { opacity:1; }
}
.feedback-banner.correct {
    background: #0a1f0f;
    border: 1px solid #15422a;
}
.feedback-banner.incorrect {
    background: #1f0a0a;
    border: 1px solid #3a1212;
}
.fb-icon { font-size: 1.1rem; flex-shrink:0; margin-top:2px; }
.fb-title { font-weight: 700; font-size: 0.9rem; margin-bottom: 0.15rem; }
.feedback-banner.correct .fb-title { color: #22c55e; }
.feedback-banner.incorrect .fb-title { color: #ef4444; }
.fb-text { font-size: 0.82rem; color: #666; line-height: 1.5; }

/* ── explanation box ── */
.explanation-box {
    background: #141414;
    border-left: 3px solid var(--accent);
    border-radius: 0 14px 14px 0;
    padding: 1rem 1.2rem;
    margin-top: 0.8rem;
    color: #888;
    font-size: 0.88rem;
    line-height: 1.6;
    animation: feedIn 0.25s ease both;
}
.explanation-box strong { color: var(--accent); }

/* ── image container ── */
.img-container {
    background: #1e1e1e;
    padding: 1rem;
    border-radius: 20px;
    margin: 1rem 0 1.4rem;
    text-align: center;
    border: 1px solid #2a2a2a;
}
.img-container img { max-width: 100%; height: auto; border-radius: 14px; }

/* ── nav buttons ── */
.quiz-nav {
    display: flex;
    gap: 0.7rem;
    margin-top: 1rem;
}
.quiz-shortcuts {
    margin-top: 0.65rem;
    color: #8a8a8a;
    font-size: 0.78rem;
    font-family: 'Space Mono', monospace;
    text-align: center;
}
.nav-btn {
    padding: 0.85rem 1.4rem;
    border-radius: 50px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    display: flex; align-items:center; justify-content:center; gap:0.4rem;
    transition: all 0.12s;
    border: none;
    min-height: 48px;
    flex: 1;
}
.nav-prev {
    background: #1e1e1e;
    border: 1.5px solid #333 !important;
    color: #666;
    flex: 0 0 auto;
    padding: 0.85rem 1.4rem;
}
.nav-prev:hover { color: var(--text-primary); border-color: #555 !important; }
.nav-prev:disabled { opacity: 0.3; pointer-events: none; }

.nav-next {
    background: #3b82f6;
    color: #fff;
    box-shadow: 0 4px 0 #1d4ed8;
}
.nav-next:hover { filter: brightness(1.1); box-shadow: 0 6px 0 #1d4ed8; }
.nav-next:active { box-shadow: 0 2px 0 #1d4ed8; }
.nav-next:disabled { opacity: 0.4; pointer-events: none; box-shadow: none; transform: none; }

.nav-reveal {
    background: #1e1e1e;
    border: 1.5px solid #333 !important;
    color: #555;
    flex: 0 0 auto;
    font-size: 0.82rem;
    padding: 0.85rem 1.1rem;
}
.nav-reveal:hover { border-color: var(--accent) !important; color: var(--accent); }

/* ── favorite star (inside question card) ── */
.favorite-star {
    margin-left: auto;
    background: none;
    border: 1px solid #2a2a2a;
    border-radius: 50%;
    width: 32px; height: 32px;
    font-size: 0.95rem;
    cursor: pointer;
    color: #444;
    display: flex; align-items:center; justify-content:center;
    transition: all 0.15s;
    flex-shrink: 0;
    z-index: 10;
    box-shadow: none;
}
.favorite-star:hover { border-color: #f6e05b; color: #f6e05b; }
.favorite-star.active { background: #1a1600; border-color: #f6e05b; color: #f6e05b; }

/* ── sidebar ── */
.quiz-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.sidebar-card {
    background: #141414;
    border: 1px solid #272727;
    border-radius: 28px;
    padding: 1.3rem;
    position: sticky;
    top: 80px;
    color: var(--text-primary);
}
.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}
.sidebar-header h3 {
    font-family: 'Space Mono', monospace;
    font-size: 0.65rem;
    color: #444;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-weight: 400;
}
.sidebar-stat {
    font-family: 'Space Mono', monospace;
    font-size: 0.75rem;
    color: var(--accent);
}

/* ── nav grid dots ── */
.sidebar-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 5px;
    margin-bottom: 1.1rem;
}
.question-nav-btn {
    aspect-ratio: 1;
    border-radius: 8px;
    border: 1.5px solid #252525;
    background: #1e1e1e;
    font-family: 'Space Mono', monospace;
    font-size: 0.62rem;
    color: #444;
    cursor: pointer;
    display: flex; align-items:center; justify-content:center;
    transition: all 0.1s;
    min-height: 34px;
    padding: 0;
}
.question-nav-btn:hover { border-color: var(--accent); color: var(--text-primary); }
.question-nav-btn.answered { background: #14532d; border-color: #22c55e; color: #4ade80; }
.question-nav-btn.incorrect{ background: #7f1d1d; border-color: #ef4444; color: #fca5a5; }
/* current always wins — must come AFTER answered/incorrect */
.question-nav-btn.current  { background: var(--accent) !important; border-color: var(--accent) !important; color: #000 !important; font-weight:700; }

/* ── submit button ── */
.submit-btn {
    width: 100%;
    padding: 0.9rem;
    border-radius: 50px;
    border: none;
    background: #03dac6;
    color: #000;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 5px 0 #018786;
    transition: all 0.12s;
    min-height: 52px;
    display: flex; align-items:center; justify-content:center; gap:0.5rem;
}
.submit-btn:hover { filter:brightness(1.08); box-shadow: 0 7px 0 #018786; }
.submit-btn:active { box-shadow: 0 2px 0 #018786; }
.submit-btn:disabled { background: #2a2a2a; box-shadow: 0 2px 0 #1a1a1a; color: #555; pointer-events: none; transform: none; }

/* ── results sidebar ── */
.results-sidebar {
    margin-top: 1.2rem;
    border-top: 1px solid #252525;
    padding-top: 1.2rem;
}
.results-header {
    display: flex; align-items: center; gap: 0.5rem;
    margin-bottom: 0.8rem;
}
.results-header h3 { font-size: 0.9rem; color: var(--text-primary); font-weight: 700; }
.results-icon { font-size: 1.2rem; }
.results-score {
    font-family: 'Space Mono', monospace;
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 0.3rem;
}
.results-grade { font-size: 0.85rem; color: #777; margin-bottom: 0.5rem; line-height: 1.6; }
.results-feedback { font-size: 1.1rem; }

/* ── sidebar toggle (mobile) ── */
.sidebar-toggle {
    display: block;
    width: 100%;
    background: #1e1e1e;
    border: 1.5px solid #333;
    border-radius: 50px;
    padding: 0.7rem;
    margin-bottom: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    color: #888;
    text-align: center;
    font-size: 0.85rem;
}
@media (min-width: 900px) {
    .sidebar-toggle { display: none; }
}
.sidebar-card.collapsed { display: none; }
@media (min-width: 900px) {
    .sidebar-card.collapsed { display: block; }
}

/* ===== UTILITY ===== */
.hidden {
    display: none !important;
}

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

/* ===== RESPONSIVE FONTS ===== */
@media (max-width: 600px) {
    .dashboard-header h1 {
        font-size: 1.8rem;
    }
    .modal-header h2 {
        font-size: 1.5rem;
    }
    .mode-card h3 {
        font-size: 1.4rem;
    }
}
/* ===== SECTION HEADER (subject-colored dot + label) ===== */
.section-header {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    margin-bottom: 0.2rem;
    padding-left: 0.2rem;
}
.section-dot {
    width: 9px; height: 9px;
    border-radius: 50%;
    background: var(--section-color, #555);
    box-shadow: 0 0 8px var(--section-color, #555);
    flex-shrink: 0;
}
.section-label {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--section-color, #555);
}

/* ===== CARD SCORE PROGRESS BAR ===== */
.card-score {
    margin-top: auto;
    padding-top: 0.75rem;
    border-top: 1px solid #333;
}

body.hide-card-scores .card-score {
    display: none;
}
.card-score-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
}
.card-score-label span:last-child { color: var(--text-primary); font-weight: 800; }
.score-track {
    height: 5px;
    background: #333;
    border-radius: 10px;
    overflow: hidden;
}
.score-fill {
    height: 100%;
    border-radius: 10px;
    background: var(--card-accent, #555);
    width: 0%;
    transition: width 1.2s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ===== FAVORITES EMPTY STATE ===== */
.favorites-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 5rem 2rem;
    border: 2px dashed #333;
    border-radius: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}
.fav-star-big {
    font-size: 4rem;
    animation: starPulse 2.4s ease-in-out infinite;
}
@keyframes starPulse {
    0%, 100% { transform: scale(1);    opacity: 0.35; }
    50%       { transform: scale(1.2); opacity: 0.9;  }
}
.favorites-empty h3 { font-size: 1.1rem; color: #555; font-weight: 600; }
.favorites-empty p  { font-size: 0.85rem; color: #3a3a3a; max-width: 320px; line-height: 1.6; }

/* ===== STREAK DISPLAY ===== */
.streak-display {
    font-family: 'Space Mono', monospace;
    font-size: 0.8rem;
    font-weight: 700;
    color: #f6a35b;
    background: rgba(246, 163, 91, 0.08);
    border: 1.5px solid rgba(246, 163, 91, 0.25);
    border-radius: var(--radius-btn);
    padding: 0.25rem 0.9rem;
    margin-left: auto;
    cursor: default;
    user-select: none;
    transition: border-color 0.2s;
}
.streak-display:hover { border-color: rgba(246, 163, 91, 0.5); }

/* ===== QUIZ TIMER ===== */
.quiz-timer {
    font-family: 'Space Mono', monospace;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary);
    background: #1a1a1a;
    border: 2px solid #333;
    border-radius: var(--radius-btn);
    padding: 0.35rem 1rem;
    white-space: nowrap;
    transition: color 0.3s, border-color 0.3s;
    flex-shrink: 0;
}
.quiz-timer.warning {
    color: #f6a35b;
    border-color: #f6a35b;
    box-shadow: 0 0 0 0 rgba(246,163,91,0.06);
}
.quiz-timer.danger {
    color: #cf6679;
    border-color: #cf6679;
    box-shadow: 0 0 0 0 rgba(207,102,121,0.06);
    animation: timerPulse 1100ms ease-in-out infinite;
}

@keyframes timerPulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(207,102,121,0.06); }
    50% { transform: scale(1.03); box-shadow: 0 0 10px 4px rgba(207,102,121,0.04); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(207,102,121,0.06); }
}
@keyframes timerPulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.6; }
}

/* ===== RESUME BANNER ===== */
.resume-banner {
    background: #1e1e1e;
    border: 2px solid var(--accent);
    border-radius: 20px;
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    animation: slideDown 0.3s ease;
}
@keyframes slideDown {
    from { opacity: 0; }
    to   { opacity: 1; }
}
.resume-banner-text {
    flex: 1;
    color: var(--text-secondary);
    font-size: 0.9rem;
    min-width: 200px;
}
.resume-banner-text strong { color: var(--text-primary); }
.resume-banner-btns { display: flex; gap: 0.6rem; flex-shrink: 0; }

/* ===== CARD STATS LINE ===== */
.card-stats-line {
    font-size: 0.72rem;
    color: #666;
    margin-top: 0.35rem;
    font-family: 'Space Mono', monospace;
    letter-spacing: -0.3px;
}

/* ===== RETRY WRONG BUTTON ===== */
.retry-wrong-btn {
    display: block;
    width: 100%;
    margin-top: 0.8rem;
    padding: 0.65rem 1rem;
    background: #cf6679;
    color: #000;
    border: none;
    border-radius: var(--radius-btn);
    font-weight: 700;
    cursor: pointer;
    font-family: 'Syne', sans-serif;
    font-size: 0.85rem;
    box-shadow: 0 4px 0 #8b3a4a;
    transition: transform 0.1s, box-shadow 0.1s;
}
.retry-wrong-btn:hover { box-shadow: 0 5px 0 #8b3a4a; }
.retry-wrong-btn:active { box-shadow: 0 2px 0 #8b3a4a; }
.retry-wrong-btn:disabled {
    background: #3a3a3a;
    color: #666;
    box-shadow: none;
    cursor: default;
    transform: none;
}

/* ===== FAVORITE CARDS (redesign) ===== */
.fav-card {
    background: #1e1e1e;
    border: 2px solid #2e2e2e;
    border-radius: 24px;
    padding: 1.2rem 1.4rem;
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    transition: border-color 0.2s, transform 0.15s;
}
.fav-card:hover {
    border-color: #444;
}
.fav-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}
.fav-subject-tag {
    font-size: 0.7rem;
    font-weight: 700;
    font-family: 'Space Mono', monospace;
    border: 1.5px solid;
    border-radius: 20px;
    padding: 0.15rem 0.7rem;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}
.fav-remove-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    padding: 0.2rem;
    border-radius: 50%;
    transition: transform 0.15s, opacity 0.15s;
    opacity: 0.75;
    flex-shrink: 0;
}
.fav-remove-btn:hover {
    transform: scale(1.25);
    opacity: 1;
}
.fav-card-text {
    font-size: 0.88rem;
    color: var(--text-primary);
    line-height: 1.5;
    flex: 1;
}
.fav-card-media {
    border: 1px solid #303030;
    border-radius: 12px;
    background: #131313;
    padding: 0.45rem;
    display: flex;
    justify-content: center;
    align-items: center;
    max-height: 180px;
    overflow: hidden;
}
.fav-card-media img {
    max-width: 100%;
    max-height: 160px;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
}
.fav-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-top: 0.3rem;
}
.fav-type-tag {
    font-size: 0.68rem;
    color: #666;
    font-family: 'Space Mono', monospace;
    background: #252525;
    border-radius: 20px;
    padding: 0.15rem 0.6rem;
    border: 1px solid #333;
}
.fav-practice-btn {
    background: var(--accent);
    color: #000;
    border: none;
    border-radius: 20px;
    padding: 0.3rem 1rem;
    font-size: 0.78rem;
    font-weight: 700;
    font-family: 'Syne', sans-serif;
    cursor: pointer;
    box-shadow: 0 3px 0 #5a3d8a;
    transition: transform 0.1s, box-shadow 0.1s;
}

/* ===== MOBILE QUIZ FIX =====
   Ensure the quiz UI fits the viewport on phones, prevents
   horizontal overflow/automatic zoom and enables internal scrolling
   so users don't need to pinch/zoom to see the whole interface.
*/
@media (max-width: 700px) {
    html, body, #quiz-section {
        overflow-x: hidden;
    }

    /* Make the quiz area act like a full-screen panel and scroll internally */
    #quiz-section {
        position: fixed;
        inset: 0;
        z-index: 45; /* keep header (z-index:50) above quiz */
        background: var(--bg-dark);
        padding-top: 0;
    }

    .quiz-shell {
        height: 100vh;
        max-height: 100vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 0.75rem;
        margin: 0;
        grid-template-columns: 1fr !important;
        gap: 0.6rem;
    }

    .quiz-main, .quiz-sidebar, .question-card, .sidebar-card {
        min-width: 0;
        box-sizing: border-box;
        max-width: 100%;
    }

    .quiz-sidebar {
        position: relative;
        top: auto;
        width: 100%;
        margin-top: 0.6rem;
    }

    .img-container img,
    .img-choice-item img {
        max-width: 100%;
        height: auto;
    }

    /* Slightly reduce modal paddings on very small screens */
    .modal { padding: 0.5rem; }
    .modal-content { padding: 1rem; border-radius: 18px; max-height: calc(100vh - 2rem); }
}
.fav-practice-btn:hover  { box-shadow: 0 4px 0 #5a3d8a; }
.fav-practice-btn:active { box-shadow: 0 1px 0 #5a3d8a; }

/* Pending removal state for fav-card */
.fav-card {
    transition: border-color 0.2s, transform 0.15s, opacity 0.25s;
}

/* ===== RANDOM SESSION BUILDER ===== */
.random-builder-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 0.8rem;
    margin: 0.9rem 0 1rem 0;
}
.random-label {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.85rem;
    color: #cfcfcf;
}
.random-select {
    background: #1f1f1f;
    border: 1px solid #3a3a3a;
    color: #e6e6e6;
    border-radius: 12px;
    padding: 0.55rem 0.65rem;
    font-size: 0.9rem;
}
.random-sources-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.6rem;
}
.random-sources-list {
    max-height: 260px;
    overflow: auto;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 14px;
    padding: 0.6rem;
}
.random-source-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    border: 1px solid #303030;
    border-radius: 10px;
    padding: 0.45rem 0.55rem;
    margin-bottom: 0.45rem;
    background: #222;
}
.random-source-item small {
    margin-left: auto;
    color: #999;
}

/* ===== SUGGEST BUTTON ===== */
.suggest-btn {
    font-family: 'Space Mono', monospace;
    font-size: 0.75rem;
    font-weight: 700;
    color: #bb86fc;
    background: rgba(187, 134, 252, 0.08);
    border: 1.5px solid rgba(187, 134, 252, 0.3);
    border-radius: var(--radius-btn);
    padding: 0.25rem 0.9rem;
    margin-left: 0.6rem;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s, border-color 0.2s, transform 0.1s;
    white-space: nowrap;
}
.suggest-btn:hover {
    background: rgba(187, 134, 252, 0.18);
    border-color: rgba(187, 134, 252, 0.6);
}
.suggest-btn:active { opacity: 0.8; }

.settings-btn {
    font-family: 'Space Mono', monospace;
    font-size: 0.75rem;
    font-weight: 700;
    color: #8ee7d7;
    background: rgba(45, 212, 191, 0.08);
    border: 1.5px solid rgba(45, 212, 191, 0.3);
    border-radius: var(--radius-btn);
    padding: 0.25rem 0.9rem;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s, border-color 0.2s, transform 0.1s;
    white-space: nowrap;
}

.settings-btn:hover {
    background: rgba(45, 212, 191, 0.18);
    border-color: rgba(45, 212, 191, 0.55);
}

/* ===== SUGGEST MODAL ===== */
.suggest-modal-content {
    max-width: 520px;
    width: 95vw;
}
.suggest-subtitle {
    color: #aaa;
    font-size: 0.85rem;
    margin: -0.5rem 0 1.2rem;
    text-align: center;
}
.suggest-field {
    margin-bottom: 1rem;
}
.suggest-label {
    display: block;
    font-family: 'Space Mono', monospace;
    font-size: 0.75rem;
    color: #bbb;
    margin-bottom: 0.4rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.suggest-textarea {
    width: 100%;
    min-height: 100px;
    background: #1a1a1a;
    border: 1.5px solid #333;
    border-radius: 12px;
    color: var(--text-primary);
    font-family: 'Syne', sans-serif;
    font-size: 0.9rem;
    padding: 0.7rem 1rem;
    resize: vertical;
    box-sizing: border-box;
    transition: border-color 0.2s;
}
.suggest-textarea:focus {
    outline: none;
    border-color: #bb86fc;
}
.suggest-dropzone {
    border: 2px dashed #444;
    border-radius: 12px;
    padding: 1.2rem;
    text-align: center;
    color: #888;
    font-size: 0.85rem;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    background: #1a1a1a;
}
.suggest-dropzone:hover {
    border-color: #bb86fc;
    background: rgba(187, 134, 252, 0.05);
}
.suggest-note {
    font-size: 0.72rem;
    color: #666;
    text-align: center;
    margin-top: 0.8rem;
}

/* ============================================================
   FIXES & IMPROVEMENTS v2
   ============================================================ */

/* FIX: Suggest btn alignment când streak e ascuns (fără script.js) */
.streak-display[style*="display:none"] ~ .suggest-btn,
.header-content:not(:has(.streak-display:not([style*="display:none"]))) .suggest-btn {
    margin-left: auto;
}

/* FIX: Fallback simplu dacă selectorul de mai sus nu e suportat */
@supports not (selector(:has(*))) {
    .suggest-btn { margin-left: auto; }
    .streak-display { margin-left: 0; }
}

/* ── Tab switch animation ─────────────────────────────────── */
.tab-content {
    animation: none;
}
.tab-content:not(.hidden) {
    animation: tabFadeIn 0.22s ease both;
}
@keyframes tabFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ── Card stagger entrance ────────────────────────────────── */
.cards-grid .eval-card {
    will-change: opacity;
    animation: cardSlideIn 0.28s ease both;
}
.cards-grid .eval-card:nth-child(1) { animation-delay: 0s; }
.cards-grid .eval-card:nth-child(2) { animation-delay: 0.04s; }
.cards-grid .eval-card:nth-child(3) { animation-delay: 0.08s; }
.cards-grid .eval-card:nth-child(4) { animation-delay: 0.10s; }
.cards-grid .eval-card:nth-child(5) { animation-delay: 0.12s; }
.cards-grid .eval-card:nth-child(6) { animation-delay: 0.14s; }
@keyframes cardSlideIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ── Active tab pill indicator ────────────────────────────── */
.mode-btn.active-tab {
    background: #2d2d2d !important;
    border-color: var(--accent) !important;
    color: var(--accent) !important;
    box-shadow: 0 0 0 2px rgba(3, 218, 198, 0.18);
    font-weight: 700;
    position: relative;
}
.mode-btn.active-tab::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 50%;
    transform: translateX(-50%);
    width: 28px;
    height: 3px;
    background: var(--accent);
    border-radius: 2px;
    box-shadow: 0 0 8px var(--accent);
}

/* ── Eval card hover glow ─────────────────────────────────── */
.eval-card {
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.eval-card[data-subject="arch"]:hover { border-color: var(--arch-color); box-shadow: 0 6px 24px rgba(56, 189, 248, 0.14); }
.eval-card[data-subject="prog"]:hover  { border-color: var(--prog-color); box-shadow: 0 6px 24px rgba(167, 139, 250, 0.14); }
.eval-card[data-subject="ment"]:hover  { border-color: var(--ment-color); box-shadow: 0 6px 24px rgba(74, 222, 128, 0.14); }
.eval-card[data-subject="img"]:hover   { border-color: var(--img-color);  box-shadow: 0 6px 24px rgba(251, 191, 36, 0.14); }
.eval-card[data-subject="asdn"]:hover  { border-color: var(--asdn-color); box-shadow: 0 6px 24px rgba(248, 113, 113, 0.14); }

/* ── Resume banner ────────────────────────────────────────── */
.resume-banner {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border: 1.5px solid var(--accent);
    border-radius: 14px;
    padding: 1rem 1.4rem;
    margin: 0 0 1.5rem 0;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    animation: resumePulse 0.4s ease;

}
@keyframes resumePulse {
    from { opacity: 0; }
    to   { opacity: 1; }
}
.resume-banner-text {
    flex: 1;
    font-size: 0.88rem;
    color: #ccc;
    min-width: 160px;
}
.resume-banner-text strong { color: #fff; }
.resume-banner-btns {
    display: flex;
    gap: 0.6rem;
    flex-shrink: 0;
}

/* ── Score fill glow on high scores ──────────────────────── */
.score-fill[style*="width: 1"] { box-shadow: 0 0 6px rgba(74, 222, 128, 0.5); }

/* ── Modal entrance ───────────────────────────────────────── */
.modal-content {
    animation: modalPop 0.18s ease both;
}
@keyframes modalPop {
    from { opacity: 0; transform: scale(0.95); }
    to   { opacity: 1; transform: scale(1); }
}

/* ── Sidebar toggle button ────────────────────────────────── */
.sidebar-toggle {
    transition: background 0.15s, color 0.15s;
}

/* ── Quiz progress track pulse ────────────────────────────── */
.quiz-progress-track .progress-seg.correct {
    animation: segAppear 0.2s ease both;
}
@keyframes segAppear {
    from { transform: scaleY(0.5); opacity: 0.5; }
    to   { transform: scaleY(1); opacity: 1; }
}

/* ── Smooth scroll ────────────────────────────────────────── */
html { scroll-behavior: smooth; }


/* ── Image-Choice question type ──────────────────────────── */
.image-choice-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    margin-top: 1rem;
}

.img-choice-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    border: 2.5px solid var(--border);
    border-radius: 10px;
    padding: 0.5rem;
    background: var(--card-bg);
    transition: border-color 0.15s, transform 0.12s, box-shadow 0.15s;
    min-width: 90px;
    max-width: 130px;
}

.img-choice-item img {
    width: 100%;
    max-width: 110px;
    height: 80px;
    object-fit: contain;
    border-radius: 6px;
    background: #1a1a1a;
}

.img-choice-fallback {
    width: 100%;
    max-width: 110px;
    height: 80px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    background: #1a1a1a;
    border-radius: 6px;
    font-size: 1.5rem;
}
.img-choice-fallback small {
    font-size: 0.6rem;
    color: var(--text-secondary);
    text-align: center;
    word-break: break-all;
    padding: 0 4px;
}

.img-choice-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.03em;
}

.img-choice-item:hover {
    border-color: var(--accent);
}

.img-choice-item.selected {
    border-color: var(--accent);
    background: rgba(3, 218, 198, 0.07);
    box-shadow: 0 0 0 3px rgba(3, 218, 198, 0.2);
}
.img-choice-item.selected .img-choice-label {
    color: var(--accent);
}

.img-choice-item.img-correct {
    border-color: #4ade80 !important;
    background: rgba(74, 222, 128, 0.08) !important;
    box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.2);
}
.img-choice-item.img-incorrect {
    border-color: #f87171 !important;
    background: rgba(248, 113, 113, 0.08) !important;
}

/* ── Question image container ─────────────────────────────── */
.img-container {
    margin: 0.75rem 0 1rem 0;
}
.img-container img {
    border-radius: 8px;
    border: 1.5px solid var(--border);
    display: block;
}

/* ── Generic image placeholder (shown when image is missing) ─ */
.img-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    background: #1a1a1a;
    border: 2px dashed #444;
    border-radius: 8px;
    padding: 0.8rem 1rem;
    min-height: 60px;
    text-align: center;
    max-width: 260px;
}
.img-ph-icon   { font-size: 1.6rem; line-height: 1; }
.img-ph-name   { font-size: 0.72rem; font-family: monospace; color: var(--accent); font-weight: 600; word-break: break-all; }
.img-ph-size   { font-size: 0.65rem; color: #888; }
.img-ph-desc   { font-size: 0.68rem; color: var(--text-secondary); text-align: center; line-height: 1.35; }

/* ── Match img: placeholder (inline in match rows) ──────────── */
.match-img-wrap {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
    flex-wrap: wrap;
}
.match-img-slot {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: #2a2a2a;
    border-radius: 10px;
    border: 2px solid #444;
    overflow: hidden;
    box-sizing: border-box;
}
.match-img-wrap:not([class*="match-img-wrap--"]) .match-img-slot {
    width: min(100%, 220px);
    height: 100px;
}
.match-img-wrap--doc .match-img-slot {
    width: min(100%, 280px);
    height: 130px;
}
.match-img-wrap--wide .match-img-slot {
    width: min(100%, min(92vw, 560px));
    height: 52px;
}
.match-img-wrap--tall .match-img-slot {
    width: 96px;
    height: min(42vh, 220px);
}
.match-symbol-img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}
.match-img-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    background: #1a1a1a;
    border: 2px dashed #444;
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    min-width: 120px;
    max-width: 180px;
    text-align: center;
}
.match-img-placeholder .img-ph-icon  { font-size: 1.2rem; }
.match-img-placeholder .img-ph-name  { font-size: 0.65rem; font-family: monospace; color: var(--accent); word-break: break-all; }
.match-img-placeholder .img-ph-desc  { font-size: 0.62rem; color: var(--text-secondary); line-height: 1.3; }


/* ============================================================
   MOBILE RESPONSIVE — refactor complet pentru telefon
   ============================================================ */

/* ── Header pe telefon ── */
@media (max-width: 640px) {
    .header-content {
        flex-wrap: wrap;
        gap: 0.4rem 0.6rem;
        padding: 0 0.75rem;
        /* leave space on the right for the fixed toggle button */
        padding-right: 3rem;
    }

    .logo-text {
        font-size: 1.1rem;
    }

    .header-subtitle {
        display: none;
    }

    /* streak moves to last row on mobile */
    .streak-display {
        order: 99;
        margin-left: 0;
        font-size: 0.7rem;
        padding: 0.2rem 0.65rem;
    }

    .suggest-btn {
        font-size: 0.68rem;
        padding: 0.2rem 0.65rem;
    }

    .settings-btn {
        font-size: 0.68rem;
        padding: 0.2rem 0.65rem;
    }
}

/* ── Dashboard header pe telefon ── */
@media (max-width: 480px) {
    .dashboard-header h1 {
        font-size: 1.4rem;
        text-shadow: 2px 2px 0 #3a3a3a;
        letter-spacing: -0.5px;
    }

    .dashboard-subtitle {
        font-size: 0.85rem;
        padding: 0.25rem 1rem;
    }

    .dashboard-container {
        padding: 0 0.65rem;
    }
}

/* ── Tabs pe telefon: scroll orizontal forțat ── */
@media (max-width: 640px) {
    .tabs-scroll {
        flex-wrap: nowrap;
        justify-content: flex-start;
        overflow-x: auto;
        padding: 0.75rem 0.2rem 1rem;
        gap: 0.5rem;
        -webkit-overflow-scrolling: touch;
    }

    .mode-btn {
        font-size: 0.82rem;
        padding: 0.5rem 1rem;
        white-space: nowrap;
        flex-shrink: 0;
    }
}

/* ── Eval cards pe telefon ── */
@media (max-width: 640px) {
    .eval-card {
        min-height: auto;
        padding: 1.1rem;
        border-radius: 24px 14px 14px 14px;
    }

    .eval-card-header {
        margin-bottom: 0.6rem;
    }

    .eval-icon {
        font-size: 2rem;
    }

    .eval-card h3 {
        font-size: 1rem;
    }

    .eval-description {
        font-size: 0.83rem;
    }

    /* Favorite section inner container */
    .tab-content > div[style*="border-radius:40px"],
    .tab-content > div[style*="border-radius: 40px"] {
        border-radius: 20px !important;
        padding: 1rem !important;
    }
}

/* ── Modal pe telefon ── */
@media (max-width: 640px) {
    .modal {
        padding: 0.45rem;
        align-items: flex-end;
    }

    .modal-content {
        border-radius: 26px 18px 18px 18px;
        padding: 1rem 0.85rem;
        max-height: 94svh;
        width: 100%;
        box-shadow: 0 -4px 16px rgba(0,0,0,0.5);
    }

    .modal-icon {
        font-size: 2rem;
    }

    .modal-header h2 {
        font-size: 1.15rem;
        margin-top: 0.25rem;
    }

    .modal-close {
        width: 34px;
        height: 34px;
        font-size: 1.4rem;
        top: 0.6rem;
        right: 0.6rem;
    }

    .mode-options {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.55rem;
        margin-top: 0.75rem;
    }

    .mode-card {
        padding: 0.75rem;
        border-width: 2px;
        border-radius: 20px 12px 12px 12px;
        box-shadow: 4px 4px 0 #222;
    }

    .mode-card-icon {
        font-size: 1.8rem;
        margin-bottom: 0.25rem;
    }

    .mode-card h3 {
        font-size: 1.05rem;
    }

    .mode-card p {
        font-size: 0.74rem;
        line-height: 1.3;
        margin-top: 0.15rem;
    }

    .mode-features {
        margin: 0.45rem 0;
    }

    .mode-features li {
        font-size: 0.66rem;
        line-height: 1.25;
        padding: 0.08rem 0;
    }

    .mode-btn.special {
        min-height: 36px;
        padding: 0.38rem 0.7rem;
        font-size: 0.72rem;
    }
}

/* ── Quiz pe telefon ── */
@media (max-width: 640px) {
    .quiz-shell {
        padding: 0 0.65rem 2rem;
        gap: 1rem;
    }

    .question-card {
        padding: 1.2rem 1rem 1rem;
        border-radius: 24px;
    }

    .question-text {
        font-size: 0.97rem;
        margin-bottom: 1.2rem;
    }

    .answer-option label {
        font-size: 0.9rem;
        padding: 0.75rem 0.75rem 0.75rem 0;
    }

    .answer-option input {
        margin: 0.75rem 0 0.75rem 0.75rem;
    }

    /* Ascunde shortcuturile de tastatură pe telefon */
    .quiz-shortcuts {
        display: none;
    }

    .nav-btn {
        font-size: 0.74rem;
        padding: 0.56rem 0.5rem;
        min-height: 38px;
        line-height: 1.15;
        border-radius: 24px;
        gap: 0.2rem;
        min-width: 0;
    }

    .quiz-nav {
        display: grid;
        grid-template-columns: 0.86fr 1.2fr 0.94fr;
        gap: 0.38rem;
        align-items: stretch;
    }

    .nav-prev,
    .nav-reveal,
    .nav-next {
        width: 100%;
        flex: initial;
        padding-left: 0.45rem;
        padding-right: 0.45rem;
        white-space: normal;
        text-align: center;
    }

    .quiz-topbar {
        gap: 0.6rem;
        margin-bottom: 0.8rem;
    }

    .back-btn {
        font-size: 0.72rem;
        padding: 0.4rem 0.8rem;
    }

    .q-meta {
        gap: 0.4rem;
        margin-bottom: 1rem;
        flex-wrap: wrap;
    }
}

@media (max-width: 380px) {
    .mode-card {
        padding: 0.6rem;
    }

    .mode-card p {
        font-size: 0.68rem;
    }

    .mode-features li {
        font-size: 0.6rem;
    }

    .mode-btn.special {
        min-height: 32px;
        padding: 0.32rem 0.55rem;
    }

    .nav-btn {
        font-size: 0.66rem;
        padding: 0.48rem 0.35rem;
        min-height: 36px;
    }

    .quiz-nav {
        gap: 0.3rem;
    }
}

/* ── Sidebar pe telefon ── */
@media (max-width: 640px) {
    .sidebar-card {
        border-radius: 20px;
        padding: 1rem;
    }

    .sidebar-grid {
        grid-template-columns: repeat(6, 1fr);
    }

    .question-nav-btn {
        min-height: 38px;
        border-radius: 6px;
        font-size: 0.58rem;
    }

    .submit-btn {
        min-height: 46px;
        font-size: 0.92rem;
    }
}

/* ── Site update overlay pe telefon ── */
@media (max-width: 640px) {
    .site-update-overlay {
        right: 0.5rem;
        bottom: 0.5rem;
        max-width: calc(100vw - 1rem);
        z-index: 97; /* deasupra quiz-section pe telefon */
    }

    .site-update-card {
        font-size: 0.82rem;
        padding: 0.75rem 2rem 0.75rem 0.85rem;
    }

    .site-update-chip {
        font-size: 0.62rem;
        padding: 0.35rem 0.5rem;
        max-width: calc(100vw - 1rem);
        z-index: 98; /* deasupra quiz-section pe telefon */
    }
}

/* ── Favorite filters pe telefon ── */
@media (max-width: 640px) {
    .tab-content #favorites-list {
        grid-template-columns: 1fr !important;
    }
}

/* ── Suggest modal pe telefon ── */
@media (max-width: 640px) {
    .suggest-modal-content {
        width: 100%;
        max-width: 100%;
    }

    .suggest-textarea {
        min-height: 80px;
    }
}

/* ── Random builder pe telefon ── */
@media (max-width: 640px) {
    .random-builder-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.6rem;
    }
}

/* ── Section header pe telefon ── */
@media (max-width: 480px) {
    .section-header {
        margin-top: 0.5rem;
    }
}

/* ── Ensure touch targets ── */
@media (max-width: 640px) {
    button, [role="button"], input[type="checkbox"], select {
        min-height: 44px;
    }

    .mode-btn, .nav-btn, .submit-btn, .back-btn, .suggest-btn {
        -webkit-tap-highlight-color: transparent;
    }
}



/* ── CHANGELOG ─────────────────────────────────────── */

.changelog-fab {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.09);
    background: transparent;
    color: rgba(255,255,255,0.35);
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-left: 6px;
    transition: color 0.18s, background 0.18s, border-color 0.18s;
}
.changelog-fab:hover {
    color: #2dd4bf;
    background: rgba(45,212,191,0.08);
    border-color: rgba(45,212,191,0.3);
}
.changelog-fab:active { opacity: 0.7; }

/* Overlay backdrop */
#changelog-modal .modal-overlay {
    background: rgba(0,0,0,0.55);
}

/* Panel — slides in from right */
.changelog-modal-content {
    position: fixed;
    top: 0;
    right: 0;
    width: min(400px, 100vw);
    height: 100vh;
    background: var(--bg-card, #1a1a1a);
    border-left: 1px solid rgba(255,255,255,0.07);
    z-index: 1001;
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 12px rgba(0,0,0,0.4);
    will-change: transform, opacity;
    animation: clSlide 0.18s ease both;
}
@keyframes clSlide {
    from { transform: translateX(24px); opacity: 0; }
    to   { transform: translateX(0);    opacity: 1; }
}

/* Header */
.changelog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.2rem 1.4rem;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
}
.changelog-title-row { display: flex; align-items: center; gap: 0.65rem; }
.changelog-icon { font-size: 1.3rem; line-height: 1; opacity: 0.85; }
.changelog-title {
    margin: 0 0 1px;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary, #e8e8e8);
    letter-spacing: -0.01em;
}
.changelog-sub {
    margin: 0;
    font-size: 0.7rem;
    color: rgba(255,255,255,0.3);
}
.changelog-close {
    background: none;
    border: none;
    color: rgba(255,255,255,0.3);
    font-size: 1.2rem;
    width: 30px;
    height: 30px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s, background 0.15s;
}
.changelog-close:hover { color: var(--text-primary,#e8e8e8); background: rgba(255,255,255,0.06); }

/* Body */
.changelog-body {
    overflow-y: auto;
    padding: 1.2rem 1.4rem 2rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0;
    position: relative;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.08) transparent;
}
.changelog-body::-webkit-scrollbar { width: 4px; }
.changelog-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 4px; }

/* Timeline line */
.changelog-body::before {
    content: '';
    position: absolute;
    left: calc(1.4rem + 6px);
    top: 1.2rem;
    bottom: 2rem;
    width: 1px;
    background: linear-gradient(to bottom,
        rgba(45,212,191,0.4) 0%,
        rgba(255,255,255,0.06) 60%,
        transparent 100%);
}

/* Entry */
.cl-entry {
    display: flex;
    gap: 1rem;
    padding-bottom: 1.5rem;
}
.cl-entry:last-child { padding-bottom: 0; }

.cl-dot {
    width: 13px;
    height: 13px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 4px;
    position: relative;
    z-index: 1;
    background: var(--bg-card, #1a1a1a);
    border: 1.5px solid rgba(255,255,255,0.18);
    transition: border-color 0.2s;
}
.cl-entry.latest .cl-dot {
    border-color: #2dd4bf;
    background: #2dd4bf;
    box-shadow: 0 0 8px rgba(45,212,191,0.45);
}

.cl-content { flex: 1; min-width: 0; }

.cl-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}
.cl-date {
    font-size: 0.68rem;
    color: rgba(255,255,255,0.28);
    letter-spacing: 0.02em;
}
.cl-badge {
    font-size: 0.58rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    padding: 1px 6px;
    border-radius: 20px;
}
.cl-badge.new {
    background: rgba(45,212,191,0.12);
    color: #2dd4bf;
    border: 1px solid rgba(45,212,191,0.25);
}

.cl-ver {
    margin: 0 0 0.45rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary, #e8e8e8);
}
.cl-entry.latest .cl-ver { color: #2dd4bf; }

.cl-list {
    margin: 0; padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.28rem;
}
.cl-list li {
    font-size: 0.78rem;
    color: rgba(255,255,255,0.42);
    line-height: 1.5;
}
.cl-list li strong { color: rgba(255,255,255,0.65); font-weight: 600; }

@media (max-width: 480px) {
    .changelog-modal-content { width: 100vw; border-left: none; border-top: 1px solid rgba(255,255,255,0.07); top: auto; bottom: 0; height: 75vh; animation: clSlideUp 0.22s ease both; }
    @keyframes clSlideUp { from { opacity:0; } to { opacity:1; } }
}

/* ===== FLOATING QUESTION NAVIGATOR ===== */
#floating-nav-btn {
    position: fixed;
    z-index: 200;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: #1e2830;
    border: 2px solid var(--accent);
    color: var(--accent);
    font-size: 1.1rem;
    font-weight: 700;
    cursor: grab;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(0,0,0,0.5), 0 0 0 1px rgba(139,164,192,0.15);
    transition: box-shadow 0.15s, border-color 0.15s, background 0.15s;
    user-select: none;
    touch-action: none;
    flex-direction: column;
    gap: 1px;
    line-height: 1.1;
}
#floating-nav-btn:active { cursor: grabbing; }
#floating-nav-btn:hover {
    background: #26333f;
    border-color: var(--accent);
    box-shadow: 0 6px 20px rgba(0,0,0,0.6), 0 0 0 1px rgba(139,164,192,0.25);
}
#floating-nav-btn .fnb-icon { font-size: 0.9rem; line-height: 1; }
#floating-nav-btn .fnb-label {
    font-size: 0.48rem;
    font-family: 'Space Mono', monospace;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    line-height: 1;
}

/* Floating nav panel */
#floating-nav-panel {
    position: fixed;
    z-index: 201;
    background: #161816;
    border: 1.5px solid #2e2e2c;
    border-radius: 20px;
    padding: 1rem;
    width: 260px;
    height: 260px;
    min-width: 160px;
    min-height: 140px;
    max-width: min(480px, calc(100vw - 2rem));
    max-height: min(80vh, 600px);
    overflow: hidden;
    box-shadow: 0 16px 48px rgba(0,0,0,0.6), 0 0 0 1px rgba(167,139,250,0.08);
    animation: fnpIn 0.18s cubic-bezier(0.22,1,0.36,1) both;
    /* Allow JS resize via width/height inline styles */
    box-sizing: border-box;
}
#floating-nav-panel::-webkit-scrollbar { width: 4px; }
#floating-nav-panel::-webkit-scrollbar-thumb { background: #333; border-radius: 4px; }
@keyframes fnpIn {
    from { opacity: 0; transform: scale(0.92); }
    to   { opacity: 1; transform: scale(1); }
}

/* Inner scroll area for the grid */
.fnp-inner {
    height: 100%;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #333 transparent;
    padding-top: 1.6rem; /* space for the X button */
    box-sizing: border-box;
}
.fnp-inner::-webkit-scrollbar { width: 4px; }
.fnp-inner::-webkit-scrollbar-thumb { background: #333; border-radius: 4px; }

/* Resize handle in bottom-right corner */
#fnp-resize-handle {
    position: absolute;
    bottom: 4px;
    right: 4px;
    width: 18px;
    height: 18px;
    cursor: nwse-resize;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #444;
    font-size: 0.7rem;
    user-select: none;
    touch-action: none;
    border-radius: 4px;
    transition: color 0.15s;
}
#fnp-resize-handle:hover { color: #888; }

/* X button — absolute top-right, no header bar */
.fnp-close {
    position: absolute;
    top: 5px;
    right: 5px;
    background: none;
    border: none;
    color: #555;
    font-size: 0.8rem;
    cursor: pointer;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 5px;
    transition: color 0.12s, background 0.12s;
    z-index: 1;
}
.fnp-close:hover { color: var(--text-primary); background: #2a2a28; }

.fnp-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(34px, 1fr));
    gap: 5px;
}
.fnp-btn {
    aspect-ratio: 1;
    border-radius: 8px;
    border: 1.5px solid #252523;
    background: #1e1e1c;
    font-family: 'Space Mono', monospace;
    font-size: 0.62rem;
    color: #555;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.1s;
    min-height: 34px;
    padding: 0;
}
.fnp-btn:hover { border-color: var(--accent); color: var(--text-primary); }
.fnp-btn.answered { background: #163322; border-color: #3a7a50; color: #80c098; }
.fnp-btn.incorrect { background: #331616; border-color: #7a3a3a; color: #c08080; }
.fnp-btn.current {
    background: var(--accent) !important;
    border-color: var(--accent) !important;
    color: #0e1620 !important;
    font-weight: 700;
}