:root {
    --primary: #1a1a1a;
    --secondary: #f5f5f0;
    --accent: #1a5fa8;
    --accent-dark: #144d8a;
    --text: #2a2a2a;
    --text-light: #666;
    --border: #e0e0d8;
    --success: #6aaa3a;
    --danger: #b8463f;
    --warning: #d4a574;
    --card-bg: #fafaf8;
}

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

body {
    font-family: 'Crimson Pro', serif;
    background: linear-gradient(135deg, #fafaf8 0%, #f0f0e8 100%);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

/* Navigation - Sidebar */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    width: 250px;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    border-right: 1px solid var(--border);
    padding: 2rem 0;
    transition: all 0.3s ease;
    z-index: 1000;
    overflow-y: auto;
}

.sidebar.collapsed {
    width: 70px;
}

.sidebar-header {
    padding: 0 1.5rem;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar.collapsed .sidebar-header {
    justify-content: center;
    padding: 0 1rem;
}

.sidebar-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    color: var(--text);
    font-size: 1.5rem;
    transition: transform 0.3s ease;
}

.sidebar.collapsed .sidebar-toggle {
    transform: rotate(180deg);
}

.sidebar-logo {
    display: flex;
    align-items: center;
}

.sidebar-brand {
    font-family: 'Crimson Pro', serif;
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--accent);
    letter-spacing: 0.01em;
    margin-left: 0.6rem;
}

.sidebar-logo img {
    height: 48px;
    width: auto;
    object-fit: contain;
}

.sidebar.collapsed .sidebar-logo {
    display: none;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0 1rem;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.9rem 1rem;
    color: var(--text);
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.3s ease;
    font-size: 1rem;
    position: relative;
    cursor: pointer;
}

.sidebar.collapsed .sidebar-nav a {
    justify-content: center;
    padding: 0.9rem 0.5rem;
}

.sidebar-nav a:hover {
    background: var(--secondary);
    color: var(--accent-dark);
}

.sidebar-nav a.active {
    background: rgba(106, 170, 58, 0.12);
    color: var(--accent-dark);
    font-weight: 500;
}

.sidebar-nav a.active:before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 3px;
    background: var(--success);
    border-radius: 0 2px 2px 0;
}

.sidebar-icon {
    min-width: 24px;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.sidebar-icon svg {
    width: 20px;
    height: 20px;
    stroke-width: 2px;
}

.sidebar-text {
    white-space: nowrap;
}

.sidebar.collapsed .sidebar-text {
    display: none;
}

/* Main content area adjustment for sidebar */
.main-content {
    margin-left: 250px;
    transition: margin-left 0.3s ease;
    min-height: 100vh;
}

.main-content.expanded {
    margin-left: 70px;
}

/* View toggle and filters */
.view-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.view-toggle {
    display: flex;
    gap: 0.5rem;
    background: var(--secondary);
    padding: 0.3rem;
    border-radius: 4px;
}

.view-btn {
    padding: 0.6rem 1rem;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 2px;
    transition: all 0.3s ease;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    color: var(--text);
}

.view-btn.active {
    background: white;
    color: var(--accent-dark);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.part-filters {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.part-filter {
    padding: 0.6rem 1.2rem;
    border: 1px solid var(--border);
    background: white;
    cursor: pointer;
    border-radius: 20px;
    transition: all 0.3s ease;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.part-filter:hover {
    border-color: var(--accent);
}

.part-filter.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

/* List view styles */
.chapters-list {
    display: none;
    flex-direction: column;
    gap: 1rem;
}

.chapters-list.active {
    display: flex;
}

.chapters-grid.active {
    display: grid;
}

.chapters-grid.inactive,
.chapters-list.inactive {
    display: none;
}

.chapter-list-item {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--border);
    padding: 1.5rem 2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 2px;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.chapter-list-item:hover {
    border-color: var(--accent);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    transform: translateX(4px);
}

.chapter-list-info {
    flex: 1;
}

.chapter-list-title {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
    color: var(--primary);
}

.chapter-list-part {
    font-size: 0.85rem;
    color: var(--accent-dark);
    font-family: 'JetBrains Mono', monospace;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.chapter-list-stats {
    display: flex;
    gap: 2rem;
    align-items: center;
}

/* Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 3rem 2rem;
    animation: fadeIn 0.6s ease-out 0.2s both;
}

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

/* Login Page */
.login-container {
    max-width: 480px;
    margin: 8rem auto;
    padding: 3rem;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 2px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.08);
    border: 1px solid var(--border);
}

.login-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 2rem;
    gap: 0.4rem;
}

.login-logo {
    height: 56px;
    width: auto;
    object-fit: contain;
    margin-bottom: 0.4rem;
}

.login-brand-name {
    font-family: 'Crimson Pro', serif;
    font-size: 2rem;
    font-weight: 600;
    color: var(--accent);
    letter-spacing: 0.01em;
    line-height: 1;
}

.login-brand-sub {
    font-size: 0.85rem;
    color: var(--text-light);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.login-title {
    font-size: 2.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--primary);
    text-align: center;
}

.login-subtitle {
    display: none;
}

.mobile-topbar {
    display: none;
}

.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text);
    font-weight: 400;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-family: 'JetBrains Mono', monospace;
}

input[type="text"],
input[type="password"],
input[type="email"],
select {
    width: 100%;
    padding: 0.9rem 1rem;
    border: 1px solid var(--border);
    background: var(--secondary);
    font-size: 1rem;
    font-family: 'Crimson Pro', serif;
    transition: all 0.3s ease;
    border-radius: 2px;
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--accent);
    background: white;
    box-shadow: 0 0 0 3px rgba(199, 169, 107, 0.1);
}

.btn {
    padding: 1rem 2rem;
    border: none;
    background: var(--primary);
    color: white;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'JetBrains Mono', monospace;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: 2px;
}

.btn:hover {
    background: var(--accent-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    width: 100%;
    background: var(--accent);
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary);
}

.btn-secondary:hover {
    background: var(--primary);
    color: white;
}

.btn-link {
    background: none;
    border: none;
    padding: 0.3rem 0.6rem;
    cursor: pointer;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    text-decoration: underline;
    transition: all 0.2s ease;
}

.btn-link:hover {
    opacity: 0.7;
}

.btn-outline {
    background: transparent;
    color: var(--accent-dark);
    border: 2px solid var(--accent-dark);
}

.btn-outline:hover {
    background: var(--accent-dark);
    color: white;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.modal.hidden {
    display: none;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

#feedbackModal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    position: relative;
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 640px;
    width: 92%;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease;
}

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

.modal-header {
    padding: 1.25rem 1.5rem 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.modal-title {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--primary);
    margin: 0;
    flex: 1;
}

.modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--text-light);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: var(--border);
    color: var(--primary);
}

.modal-body {
    padding: 1rem 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.modal-subtitle {
    color: var(--text-light);
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
}

.status-filter-section {
    margin-bottom: 0.75rem;
    padding: 0.6rem 0.9rem;
    background: linear-gradient(135deg, #fefefe 0%, #f8f6f0 100%);
    border-radius: 8px;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
}

.status-filter-title {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0;
    white-space: nowrap;
}

.status-filter-options {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    flex: 1;
}

.status-filter-label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text);
    transition: color 0.2s ease;
}

.status-filter-label:hover {
    color: var(--accent-dark);
}

.status-filter-label input[type="checkbox"] {
    width: 14px;
    height: 14px;
    cursor: pointer;
    accent-color: var(--accent-dark);
}

.filter-quick-btns {
    display: flex;
    gap: 0.3rem;
    margin-left: auto;
}

.filter-quick-btn {
    font-size: 0.72rem;
    padding: 0.15rem 0.45rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: none;
    color: var(--text-light);
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
}

.filter-quick-btn:hover {
    border-color: var(--accent-dark);
    color: var(--accent-dark);
}

.concepts-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.concepts-header-label {
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-light);
}

.concept-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.concept-item {
    padding: 0.65rem 0.9rem;
    background: white;
    border: 1.5px solid var(--border);
    border-radius: 7px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.concept-item:hover {
    border-color: var(--accent);
    background: #fdfaf5;
}

.concept-item.selected {
    border-color: var(--accent-dark);
    background: linear-gradient(135deg, #fefefe 0%, #f8f6f0 100%);
}

.concept-checkbox {
    width: 17px;
    height: 17px;
    min-width: 17px;
    border: 1.5px solid var(--border);
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.concept-item.selected .concept-checkbox {
    background: var(--accent-dark);
    border-color: var(--accent-dark);
}

.concept-checkbox::after {
    content: '✓';
    color: white;
    font-size: 0.7rem;
    font-weight: bold;
    opacity: 0;
    transform: scale(0);
    transition: all 0.15s ease;
}

.concept-item.selected .concept-checkbox::after {
    opacity: 1;
    transform: scale(1);
}

.concept-info {
    flex: 1;
    min-width: 0;
}

.concept-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 0;
}

.concept-description {
    font-size: 0.82rem;
    color: var(--text-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.modal-footer {
    padding: 0.85rem 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    align-items: center;
}

.modal-footer .btn-outline {
    font-size: 0.85rem;
    padding: 0.5rem 1rem;
}

.auth-toggle {
    text-align: center;
    margin-top: 1.5rem;
    color: var(--text-light);
}

.auth-toggle a {
    color: var(--accent-dark);
    cursor: pointer;
    text-decoration: none;
}

/* Chapters Grid */
.page-header {
    margin-bottom: 3rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 1.5rem;
}

.page-title {
    font-size: 3rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.page-subtitle {
    color: var(--text-light);
    font-size: 1.2rem;
}

.chapters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.chapter-card {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--border);
    padding: 2rem;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    border-radius: 2px;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.chapter-card:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--accent);
    transform: scaleY(0);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.chapter-card:hover:before {
    transform: scaleY(1);
}

.chapter-card:hover {
    transform: translateX(8px);
    box-shadow: -8px 12px 40px rgba(0,0,0,0.08);
    border-color: var(--accent);
}

.chapter-number {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    color: var(--accent);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.chapter-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--primary);
}

.chapter-stats {
    display: flex;
    gap: 1.5rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.stat {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
}

.stat-value {
    font-weight: 600;
    color: var(--accent-dark);
}

.stat-label {
    color: var(--text-light);
}

/* MCQ Display */
.mcq-container {
    max-width: 900px;
    margin: 0 auto;
}

.mcq-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.mcq-progress {
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-light);
}

.difficulty-badge {
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    font-family: 'JetBrains Mono', monospace;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.difficulty-easy { background: #e8f5e9; color: #2e7d32; }
.difficulty-medium { background: #fff3e0; color: #e65100; }
.difficulty-hard { background: #ffebee; color: #c62828; }

.question-card {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid var(--border);
    padding: 2.5rem;
    margin-bottom: 2rem;
    border-radius: 2px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
}

.concept-tag {
    display: inline-block;
    background: var(--secondary);
    padding: 0.3rem 0.8rem;
    font-size: 0.85rem;
    margin-bottom: 1.5rem;
    font-family: 'JetBrains Mono', monospace;
    color: var(--accent-dark);
    border-left: 3px solid var(--accent);
}

.question-text {
    font-size: 1.25rem;
    margin-bottom: 2rem;
    line-height: 1.8;
    color: var(--primary);
}

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

.option {
    padding: 1.2rem 1.5rem;
    border: 2px solid var(--border);
    background: var(--card-bg);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    border-radius: 2px;
}

.option:hover {
    border-color: var(--accent);
    background: white;
    transform: translateX(4px);
}

.option.selected {
    border-color: var(--accent);
    background: rgba(199, 169, 107, 0.1);
}

.option.correct {
    border-color: var(--success);
    background: rgba(74, 124, 89, 0.1);
}

.option.incorrect {
    border-color: var(--danger);
    background: rgba(184, 70, 63, 0.1);
}

.option-label {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
    color: var(--accent-dark);
    min-width: 30px;
    flex-shrink: 0;
}

.option-text {
    font-size: 1.05rem;
    flex: 1;
}

.explanation-box {
    margin-top: 2rem;
    padding: 1.5rem;
    background: #f0f7ff;
    border-left: 4px solid var(--accent);
    border-radius: 2px;
}

.explanation-title {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--accent-dark);
    font-family: 'JetBrains Mono', monospace;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.9rem;
}

.mcq-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    justify-content: space-between;
}

/* Stats Page */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.stat-card {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--border);
    padding: 2rem;
    text-align: center;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.08);
    border-color: var(--accent);
}

.stat-number {
    font-size: 3rem;
    font-weight: 600;
    color: var(--success);
    font-family: 'JetBrains Mono', monospace;
    margin-bottom: 0.5rem;
}

.stat-title {
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 0.9rem;
    font-family: 'JetBrains Mono', monospace;
}

.chart-container {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid var(--border);
    padding: 2rem;
    margin-bottom: 2rem;
    border-radius: 2px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
}

.chart-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--primary);
}

.progress-section {
    margin-top: 3rem;
}

.chapter-progress {
    background: white;
    border: 1px solid var(--border);
    padding: 1.5rem;
    margin-bottom: 1rem;
    border-radius: 2px;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.progress-bar-container {
    height: 8px;
    background: var(--secondary);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--success), #4e8a25);
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Test Creation */
.test-config {
    max-width: 700px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid var(--border);
    padding: 3rem;
    border-radius: 2px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.08);
}

.checkbox-group {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 1rem;
    background: var(--card-bg);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 2px;
}

.checkbox-label:hover {
    border-color: var(--accent);
    background: white;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--accent);
}

/* ── Test page ── */
.test-empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-light);
    font-size: 1rem;
    border: 1px dashed var(--border);
    border-radius: 2px;
    margin-bottom: 1.5rem;
}

.test-section-heading {
    font-size: 0.75rem;
    font-family: 'JetBrains Mono', monospace;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-light);
    margin: 1.5rem 0 0.5rem;
}

.test-section-heading:first-child {
    margin-top: 0;
}

.test-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: 2px;
    padding: 1rem 1.25rem;
    margin-bottom: 0.5rem;
    transition: border-color 0.2s;
}

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

.test-card-main {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
    gap: 1rem;
}

.test-card-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.2rem;
}

.test-card-meta {
    font-size: 0.8rem;
    color: var(--text-light);
    font-family: 'JetBrains Mono', monospace;
}

.test-card-score {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.1rem;
    font-weight: 600;
    flex-shrink: 0;
}

.test-card-badge {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--warning);
    border: 1px solid var(--warning);
    padding: 0.2rem 0.5rem;
    border-radius: 10px;
    flex-shrink: 0;
}

.test-card-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.test-card-btn {
    padding: 0.4rem 1rem;
    font-size: 0.8rem;
}

.test-card-delete {
    background: none;
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.4rem 0.5rem;
    cursor: pointer;
    color: var(--text-light);
    display: flex;
    align-items: center;
    transition: all 0.2s;
    margin-left: auto;
}

.test-card-delete:hover {
    border-color: var(--danger);
    color: var(--danger);
    background: rgba(184, 70, 63, 0.05);
}

#createTestBtnWrapper {
    margin: 1.5rem 0;
}

.test-form-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.test-form-title {
    font-size: 1.3rem;
    font-weight: 600;
}

.test-form-close {
    background: none;
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    color: var(--text-light);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: all 0.2s;
}

.test-form-close:hover {
    background: var(--border);
    color: var(--text);
}

/* ── Question count stepper ── */
.stepper {
    display: flex;
    align-items: center;
    gap: 0;
    border: 1px solid var(--border);
    border-radius: 4px;
    overflow: hidden;
    width: fit-content;
}

.stepper-btn {
    width: 44px;
    height: 44px;
    background: var(--card-bg);
    border: none;
    font-size: 1.4rem;
    font-weight: 300;
    color: var(--text);
    cursor: pointer;
    transition: background 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stepper-btn:hover {
    background: var(--border);
}

.stepper-btn:active {
    background: var(--accent);
    color: #fff;
}

.stepper input[type="number"] {
    width: 70px;
    height: 44px;
    border: none;
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    text-align: center;
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.1rem;
    color: var(--accent-dark);
    font-weight: 600;
    background: white;
    outline: none;
    -moz-appearance: textfield;
}

.stepper input[type="number"]::-webkit-inner-spin-button,
.stepper input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
}

/* ── Chapter checklist (list layout) ── */
.chapter-checklist {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 2rem;
}

.chapter-check-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.15s;
    background: white;
}

.chapter-check-item:last-child {
    border-bottom: none;
}

.chapter-check-item:hover {
    background: rgba(199, 169, 107, 0.06);
}

.chapter-check-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    accent-color: var(--accent);
    cursor: pointer;
}

.chapter-check-name {
    flex: 1;
    font-size: 0.95rem;
    color: var(--text);
}

.chapter-check-part {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--accent-dark);
    flex-shrink: 0;
}

/* Activity Table */
.activity-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.activity-table th,
.activity-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.activity-table th {
    background: var(--secondary);
    font-family: 'JetBrains Mono', monospace;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.85rem;
    font-weight: 600;
}

.activity-table tr:hover {
    background: var(--card-bg);
}

/* View Toggle (stats page) */
.view-toggle {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.view-btn {
    padding: 0.75rem 1.5rem;
    border: 2px solid var(--border);
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Crimson Pro', serif;
    font-size: 1rem;
    border-radius: 2px;
    color: var(--text);
}

.view-btn:hover {
    border-color: var(--accent);
    background: rgba(199, 169, 107, 0.05);
}

.view-btn.active {
    border-color: var(--accent);
    background: rgba(199, 169, 107, 0.1);
    color: var(--accent-dark);
    font-weight: 600;
}

/* Hidden class */
.hidden {
    display: none !important;
}

/* Loading */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.error-message {
    background: #ffebee;
    color: #c62828;
    padding: 1rem;
    border-radius: 2px;
    margin-bottom: 1rem;
    border-left: 4px solid #c62828;
}

/* Bottom nav — hidden on desktop */
.bottom-nav {
    display: none;
}

/* ── Multi-chapter selection bar ── */
.chapter-selection-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--primary);
    color: #fff;
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    z-index: 900;
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.15);
}

.chapter-selection-bar.hidden {
    display: none;
}

.selection-bar-info {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 110px;
}

.selection-bar-info #selectionCount {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    font-weight: 500;
}

.selection-q-count {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.65);
    font-family: 'JetBrains Mono', monospace;
}

.selection-bar-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.selection-status-filters {
    display: flex;
    gap: 0.6rem;
}

.sel-filter-label {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.85);
    cursor: pointer;
    white-space: nowrap;
}

.sel-filter-label input[type="checkbox"] {
    accent-color: var(--accent);
    width: 14px;
    height: 14px;
    cursor: pointer;
}

/* ── Chapter card / list item: selected state ── */
.chapter-card.selected {
    border-color: var(--success);
    background: rgba(106, 170, 58, 0.1);
    box-shadow: 0 0 0 2px var(--success);
}

.chapter-list-item.selected {
    background: rgba(106, 170, 58, 0.08);
    border-left: 3px solid var(--success) !important;
}

.select-check {
    position: absolute;
    top: 0.6rem;
    right: 0.6rem;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid var(--accent);
    background: var(--accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
}

.chapter-card:not(.selected) .select-check {
    background: transparent;
    color: transparent;
    border-color: rgba(199, 169, 107, 0.5);
}

.select-check-list {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid rgba(199, 169, 107, 0.5);
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    flex-shrink: 0;
}

.chapter-list-item.selected .select-check-list {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

/* ── Long-press hint banner (hidden on desktop) ── */
.multiselect-hint {
    display: none;
}

/* ── Desktop inline select button (shown in view-controls, hidden on mobile) ── */
.multi-select-inline-btn {
    display: inline-flex;
    align-items: center;
    padding: 0.45rem 0.9rem;
    font-size: 0.8rem;
    font-family: 'JetBrains Mono', monospace;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border: 1px solid var(--border);
    background: white;
    color: var(--text);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.multi-select-inline-btn:hover {
    border-color: var(--accent);
    color: var(--accent-dark);
}

.multi-select-inline-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* ── Feedback modal ── */
.feedback-modal {
    max-width: 480px;
}

.feedback-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.feedback-cat-label {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.82rem;
    font-family: 'JetBrains Mono', monospace;
    cursor: pointer;
    padding: 0.35rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: 20px;
    transition: all 0.15s;
    user-select: none;
}

.feedback-cat-label:has(input:checked) {
    border-color: var(--accent);
    background: rgba(199, 169, 107, 0.12);
    color: var(--accent-dark);
}

.feedback-cat-label input[type="radio"] {
    display: none;
}

.feedback-question-context {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.75rem;
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-light);
    margin-bottom: 0.75rem;
    padding: 0.3rem 0.6rem;
    background: rgba(0,0,0,0.03);
    border-radius: 4px;
}

.feedback-textarea {
    width: 100%;
    padding: 0.75rem;
    font-size: 0.9rem;
    font-family: 'Crimson Pro', serif;
    border: 1px solid var(--border);
    border-radius: 4px;
    resize: vertical;
    box-sizing: border-box;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

.feedback-textarea:focus {
    outline: none;
    border-color: var(--accent);
}

/* ── Report question button (in MCQ card header) ── */
.report-question-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.72rem;
    font-family: 'JetBrains Mono', monospace;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-light);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    transition: color 0.15s;
}

.report-question-btn:hover {
    color: var(--danger);
}

/* ── Profile sections (How to Use, Reset Progress) ── */
.profile-section {
    margin-top: 1.5rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

.profile-section-danger {
    border-color: rgba(220, 38, 38, 0.25);
}

.profile-section-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.9rem 1.1rem;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.85rem;
    font-family: 'JetBrains Mono', monospace;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text);
    text-align: left;
    transition: background 0.15s;
}

.profile-section-toggle:hover {
    background: rgba(0,0,0,0.03);
}

.profile-section-danger .profile-section-toggle {
    color: #dc2626;
}

.profile-section-body {
    padding: 0 1.1rem 1.1rem;
    border-top: 1px solid var(--border);
}

.profile-section-danger .profile-section-body {
    border-top-color: rgba(220, 38, 38, 0.15);
}

.how-to-use-list {
    margin: 0.75rem 0 0;
    padding-left: 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    font-size: 0.92rem;
    line-height: 1.55;
    color: var(--text);
}

.how-to-use-list li {
    padding-left: 0.1rem;
}

.reset-warning {
    font-size: 0.85rem;
    color: #dc2626;
    margin: 0.75rem 0;
}

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

.btn-danger-outline {
    display: inline-flex;
    align-items: center;
    padding: 0.55rem 1rem;
    font-size: 0.82rem;
    font-family: 'JetBrains Mono', monospace;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border: 1px solid #dc2626;
    color: #dc2626;
    background: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-danger-outline:hover {
    background: rgba(220, 38, 38, 0.08);
}

/* ── Curated test timer ── */
.curated-timer {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
    padding: 0.3rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    min-width: 60px;
    text-align: center;
}

.curated-timer-warning {
    color: var(--danger);
    border-color: var(--danger);
    animation: timerPulse 1s ease-in-out infinite;
}

@keyframes timerPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* ── Curated test question nav dots ── */
.curated-q-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 1.5rem;
}

.curated-dot {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    border: 1px solid var(--border);
    background: none;
    font-size: 0.78rem;
    font-family: 'JetBrains Mono', monospace;
    cursor: pointer;
    color: var(--text-light);
    transition: all 0.15s;
}

.curated-dot.answered {
    background: rgba(199,169,107,0.15);
    border-color: var(--accent);
    color: var(--accent-dark);
}

.curated-dot.current {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

/* ── Curated selected option (before submit) ── */
.option.curated-selected {
    border-color: var(--accent);
    background: rgba(199,169,107,0.08);
}

/* ── Success button ── */
.btn-success {
    background: var(--success);
    color: #fff;
    border: none;
    padding: 0.7rem 2rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: 4px;
    cursor: pointer;
    transition: opacity 0.15s;
}

.btn-success:hover { opacity: 0.88; }

.btn-outline {
    background: none;
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.6rem 1.2rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-outline:hover {
    border-color: var(--accent);
    color: var(--accent-dark);
}
