/* CSS Variables — KnowledgeApp branding */
:root {
    --app-primary: #003087;
    --app-secondary: #4A93B7;
    --app-dark: #1a1f2e;
    --app-light-accent: rgba(0, 48, 135, 0.08);
    --app-accent: #FFB800;
    --app-primary-light: #0050AA;
    --success: #28a745;
    --danger: #dc3545;
    --warning: #FF9800;
    --bg-color: white;
    --card-bg: white;
    --text-color: var(--app-dark);
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --border-color: var(--app-secondary);
}

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

body {
    font-family: 'Open Sans', Arial, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #dce4f0 100%);
    color: var(--app-dark);
    min-height: 100vh;
    position: relative;
}

/* Background color themes for light mode */
body[data-bg="white"] {
    --bg-color: white;
    --card-bg: white;
}

body[data-bg="cream"] {
    --bg-color: #FFF8DC;
    --card-bg: #FFF8DC;
}

body[data-bg="lightblue"] {
    --bg-color: #E6F3FF;
    --card-bg: #E6F3FF;
}

body[data-bg="lightgreen"] {
    --bg-color: #E8F5E9;
    --card-bg: #E8F5E9;
}

body[data-bg="lightyellow"] {
    --bg-color: #FFFDE7;
    --card-bg: #FFFDE7;
}

body[data-bg="lightpink"] {
    --bg-color: #FCE4EC;
    --card-bg: #FCE4EC;
}

body[data-bg="lightgray"] {
    --bg-color: #F5F5F5;
    --card-bg: #F5F5F5;
}

body[data-bg="beige"] {
    --bg-color: #F5F5DC;
    --card-bg: #F5F5DC;
}

/* Dark Mode Variables */
body.dark-mode {
    --app-primary: #4A93B7;
    --app-secondary: #6BAED6;
    --app-dark: #E0E0E0;
    --app-light-accent: rgba(0, 48, 135, 0.2);
    --app-accent: #FFCA28;
    --app-primary-light: #5BA3C7;
    --bg-color: #1a1a1a;
    --card-bg: #2d2d2d;
    --text-color: #E0E0E0;
    --border-color: #4A93B7;

    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    color: var(--text-color);
}

/* Dyslexia-friendly text settings */
.dyslexia-mode {
    font-size: 1.1em;
    line-height: 1.8;
    letter-spacing: 0.05em;
    word-spacing: 0.1em;
}

/* Header */
.header {
    background: linear-gradient(135deg, #003087 0%, #0050AA 100%);
    color: white;
    padding: 1rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo {
    width: 220px;
    height: 45px;
    background: transparent;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: white;
    overflow: visible;
    padding: 0;
}

.logo-image {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

.app-title {
    font-size: 1.5rem;
    font-weight: 600;
}

.settings-btn {
    background: var(--app-secondary);
    border: none;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.3s;
}

.settings-btn:hover {
    background: var(--app-dark);
}

/* Header actions and user dropdown */
.header-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.user-dropdown {
    position: relative;
}

.user-dropdown-trigger {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(0, 0, 0, 0.2);
    border: none;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.3s;
}

.user-dropdown-trigger:hover {
    background: rgba(0, 0, 0, 0.3);
}

.user-dropdown-chevron {
    font-size: 0.65rem;
    opacity: 0.9;
    transition: transform 0.2s;
}

.user-dropdown.open .user-dropdown-chevron {
    transform: rotate(180deg);
}

.user-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    min-width: 200px;
    background: var(--card-bg);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 0.5rem 0;
    z-index: 1100;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.user-dropdown.open .user-dropdown-menu {
    display: block;
}

.user-dropdown-item {
    display: block;
    width: 100%;
    padding: 0.6rem 1rem;
    border: none;
    background: none;
    text-align: left;
    font-size: 0.95rem;
    color: var(--text-color);
    cursor: pointer;
    transition: background 0.15s;
}

.user-dropdown-item:hover {
    background: rgba(0, 48, 135, 0.08);
}

.user-dropdown-item--logout:hover {
    background: rgba(200, 50, 50, 0.1);
}

.notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    font-size: 0.7rem;
    font-weight: 700;
    background: #e8720c;
    color: white;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Notifications centre modal */
.notifications-actions {
    margin-bottom: 1rem;
}

.notifications-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 400px;
    overflow-y: auto;
}

.notification-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--card-bg);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 8px;
    text-align: left;
}

.notification-item__content {
    flex: 1;
    min-width: 0;
}

.notification-item__title {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
}

.notification-item__body {
    font-size: 0.9rem;
    color: var(--text-secondary, #6b7280);
    margin-bottom: 0.35rem;
}

.notification-item__time {
    font-size: 0.75rem;
    color: var(--text-muted, #9ca3af);
}

.notification-item__clear {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    padding: 0;
    border: none;
    background: rgba(0, 0, 0, 0.06);
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    color: var(--text-muted, #9ca3af);
    transition: background 0.15s, color 0.15s;
}

.notification-item__clear:hover {
    background: rgba(200, 50, 50, 0.15);
    color: #c0392b;
}

.notifications-empty {
    padding: 2rem;
    text-align: center;
    color: var(--text-muted, #9ca3af);
    font-size: 0.95rem;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
}

/* Selection Panel */
.selection-panel {
    background: var(--card-bg);
    border-radius: 10px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

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

.selection-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--app-primary);
}

.selection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.5rem;
}

.selection-btn {
    padding: 0.5rem;
    border: 2px solid var(--app-secondary);
    background: var(--card-bg);
    color: var(--text-color);
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 1rem;
    min-height: 3.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1.2;
    word-wrap: break-word;
    white-space: normal;
}

.selection-btn:hover {
    background: var(--app-light-accent);
}

.selection-btn.selected {
    background: var(--app-primary);
    color: white;
}

.year-toggle {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.year-btn {
    padding: 0.5rem 1.5rem;
    border: 2px solid var(--app-secondary);
    background: var(--card-bg);
    color: var(--text-color);
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 1rem;
}

.year-btn.selected {
    background: var(--app-primary);
    color: white;
}

/* Mode Tabs */
.mode-tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.mode-tab {
    padding: 1rem 2rem;
    background: var(--card-bg);
    color: var(--text-color);
    border: none;
    border-radius: 5px 5px 0 0;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    color: var(--app-dark);
    transition: all 0.3s;
}

.mode-tab.active {
    background: var(--app-primary);
    color: white;
}

/* Content Area */
.content-area {
    background: var(--card-bg);
    border-radius: 10px;
    padding: 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    min-height: 400px;
}

/* Vocabulary Cards */
.vocab-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.vocab-card {
    background: var(--card-bg);
    color: var(--text-color);
    border: 2px solid var(--app-secondary);
    border-radius: 10px;
    padding: 1.5rem;
    transition: all 0.3s;
    position: relative;
    display: flex;
    flex-direction: column;
}

.vocab-card:hover {
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.vocab-card.hidden {
    opacity: 0.3;
}

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

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

.control-btn {
    background: var(--app-secondary);
    border: none;
    color: white;
    padding: 0.3rem 0.6rem;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.control-btn:hover {
    background: var(--app-primary);
}

.word {
    font-size: 1.3rem;
    font-weight: bold;
    color: var(--app-primary);
    margin-bottom: 0.5rem;
}

.definition {
    font-size: 1rem;
    line-height: 1.5;
    color: var(--app-dark);
}

.definition.hidden {
    filter: blur(5px);
    user-select: none;
}

.card-image {
    width: 100%;
    height: 150px;
    object-fit: contain;
    border-radius: 5px;
    margin-bottom: 1rem;
    background-color: var(--app-light-accent);
    border: 1px solid var(--border-color);
}

/* Controls Bar */
.controls-bar {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-bottom: 1rem;
}

.controls-bar-primary {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.controls-more-wrapper {
    position: relative;
    display: inline-block;
}

.controls-more-btn {
    white-space: nowrap;
}

.controls-overflow-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    background: var(--card-bg);
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    padding: 0.4rem;
    z-index: 100;
    min-width: 200px;
}

.controls-overflow-item {
    display: block;
    width: 100%;
    padding: 0.55rem 0.9rem;
    background: none;
    border: none;
    text-align: left;
    font-size: 0.88rem;
    color: var(--text-color);
    cursor: pointer;
    border-radius: 7px;
    font-family: inherit;
    transition: background 0.1s ease;
    white-space: nowrap;
}

.controls-overflow-item:hover {
    background: var(--app-light-accent, #eaf4fb);
    color: var(--app-primary);
}

/* Dark mode */
body.dark-mode .controls-overflow-menu {
    background: var(--card-bg);
    border-color: var(--border-color);
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

body.dark-mode .controls-overflow-item:hover {
    background: rgba(74, 147, 183, 0.12);
}

/* Phase 5: .selection-summary removed — replaced by .search-selection-bar + .selection-count-compact */

.control-button {
    padding: 0.5rem 1rem;
    background: var(--app-secondary);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.3s;
    min-width: 120px;
    white-space: nowrap;
}

.control-button:hover {
    background: var(--app-primary);
}

.search-bar {
    flex: 1;
    min-width: 200px;
    padding: 0.5rem 1rem;
    border: 2px solid var(--app-secondary);
    border-radius: 5px;
    font-size: 1rem;
}

/* Word Selection */
.word-selector {
    margin-right: 0.5rem;
    transform: scale(1.2);
    cursor: pointer;
}

.known-word {
    opacity: 0.6;
    border-color: var(--success) !important;
}

.known-word .word {
    color: var(--success);
    text-decoration: line-through;
}

.known-btn {
    background: var(--success) !important;
    color: white !important;
}

/* Flashcard Mode */
.flashcard-container {
    max-width: 600px;
    margin: 0 auto;
    perspective: 1000px;
}

.flashcard {
    background: var(--card-bg);
    color: var(--text-color);
    border: 3px solid var(--app-primary);
    border-radius: 15px;
    padding: 3rem;
    min-height: 300px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    cursor: pointer;
    transition: transform 0.6s;
    transform-style: preserve-3d;
    position: relative;
}

.flashcard.flipped {
    transform: rotateY(180deg);
}

.flashcard-front,
.flashcard-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    overflow-y: auto;
    /* Allow scrolling if content is too tall */
}

/* Landscape layout for larger screens when image is present */
@media (min-width: 768px) {
    .flashcard-back.has-image {
        flex-direction: row;
        gap: 2rem;
        text-align: left;
    }

    .flashcard-back.has-image .flashcard-image {
        max-width: 40%;
        max-height: 200px;
        margin-bottom: 0;
    }

    .flashcard-back.has-image .flashcard-text {
        flex: 1;
    }
}

.flashcard-back {
    transform: rotateY(180deg);
}

.flashcard-text {
    font-size: 1.5rem;
    line-height: 1.6;
}

.flashcard-image {
    max-width: 100%;
    max-height: 150px;
    /* Reduced for mobile */
    object-fit: contain;
    margin-bottom: 1rem;
    border-radius: 5px;
}

.flashcard-controls {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 2rem;
}

.flashcard-btn {
    padding: 0.75rem 1.5rem;
    background: var(--app-primary);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.3s;
}

.flashcard-btn:hover {
    background: var(--app-dark);
}

.flashcard-btn--home {
    background: transparent;
    color: var(--text-color, #374151);
    border: 1px solid var(--border-color, #d1d5db);
}
.flashcard-btn--home:hover {
    background: rgba(0, 0, 0, 0.05);
}

/* Quiz Mode */
.quiz-container {
    max-width: 700px;
    margin: 0 auto;
}

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

.quiz-progress {
    font-size: 1.1rem;
    color: var(--app-primary);
}

.quiz-score {
    font-size: 1.1rem;
    font-weight: bold;
}

.quiz-abandon-btn {
    background: transparent;
    border: 1px solid var(--border-color, #d1d5db);
    color: var(--text-color, #6b7280);
    border-radius: 6px;
    padding: 0.3rem 0.7rem;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}

.quiz-abandon-btn:hover {
    background: var(--danger, #ef4444);
    border-color: var(--danger, #ef4444);
    color: #fff;
}

.question-container {
    background: var(--app-light-accent);
    color: var(--text-color);
    border-radius: 10px;
    padding: 2rem;
    margin-bottom: 2rem;
}

.question-text {
    font-size: 1.3rem;
    margin-bottom: 1.5rem;
    color: var(--app-primary);
}

.question-image {
    max-width: 100%;
    max-height: 200px;
    object-fit: contain;
    margin-bottom: 1rem;
    border-radius: 5px;
    display: block;
    cursor: zoom-in;
    background-color: white;
    border: 1px solid var(--border-color);
}

.answer-input {
    width: 100%;
    padding: 1rem;
    font-size: 1.1rem;
    border: 2px solid var(--app-secondary);
    border-radius: 5px;
    margin-bottom: 1rem;
}

.answer-options {
    display: grid;
    gap: 1rem;
}

.answer-option {
    padding: 1rem;
    background: var(--card-bg);
    color: var(--text-color);
    border: 2px solid var(--app-secondary);
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 1rem;
}

.answer-option:hover {
    background: var(--app-light-accent);
    border-color: var(--app-primary);
}

.answer-option.selected {
    background: var(--app-primary);
    color: white;
}

.answer-option.correct {
    background: var(--success);
    color: white;
    border-color: var(--success);
}

.answer-option.incorrect {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
}

.feedback {
    padding: 1rem;
    border-radius: 5px;
    margin-top: 1rem;
    font-weight: 600;
}

.feedback.correct {
    background: rgba(40, 167, 69, 0.1);
    color: var(--success);
}

.feedback.incorrect {
    background: rgba(220, 53, 69, 0.1);
    color: var(--danger);
}

/* Results Screen */
.results-container {
    text-align: center;
    padding: 2rem;
}

.results-title {
    font-size: 2rem;
    color: var(--app-primary);
    margin-bottom: 1rem;
}

.results-score {
    font-size: 3rem;
    font-weight: bold;
    color: var(--app-primary);
    margin-bottom: 2rem;
}

.mistakes-review {
    text-align: left;
    max-width: 600px;
    margin: 2rem auto;
}

.mistake-item {
    background: var(--card-bg);
    color: var(--text-color);
    border-left: 4px solid var(--danger);
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 5px;
}

.mistake-word {
    font-weight: bold;
    color: var(--danger);
}

.correct-answer {
    color: var(--success);
    margin-top: 0.5rem;
}

/* Settings Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--card-bg);
    color: var(--text-color);
    border-radius: 10px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-content--tall {
    height: 80vh;
    max-height: 80vh;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem 1rem;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

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

/* Scrollable content area for modals that have a body wrapper (tall modals only) */
.modal-content--tall > .modal-body,
.modal-content--tall > .privacy-content {
    flex: 1 1 0;
    min-height: 0;
    overflow-y: auto;
}

/* Non-tall modals: body sizes to content so modal doesn't clip */
.modal-content:not(.modal-content--tall) > .modal-body,
.modal-content:not(.modal-content--tall) > .privacy-content {
    flex: 0 0 auto;
}

.modal-title {
    font-size: 1.5rem;
    color: var(--app-primary);
}

.close-modal {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: var(--text-color);
}

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

.confirm-modal-message {
    color: var(--text-color);
}

.confirm-modal-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.confirm-modal-primary {
    background: var(--app-primary);
    color: white;
}

.confirm-modal-primary:hover {
    background: var(--app-dark);
    color: white;
}

.settings-section {
    margin-bottom: 1.75rem;
}

.settings-section-header {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--app-secondary);
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.setting-item {
    margin-bottom: 1.5rem;
}

.setting-label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.setting-hint {
    font-size: 0.82rem;
    color: var(--text-secondary, #6b7280);
    margin: 0.2rem 0 0.6rem;
    line-height: 1.4;
}

.toggle-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.25rem;
}

.toggle-state-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary, #6b7280);
    min-width: 2.5rem;
    transition: color 0.2s;
}

.toggle-state-label.on {
    color: var(--app-primary);
}

.toggle-switch {
    position: relative;
    width: 48px;
    height: 26px;
    background: #cbd5e1;
    border-radius: 13px;
    cursor: pointer;
    transition: background 0.25s ease;
    flex-shrink: 0;
}

.toggle-switch.active {
    background: var(--app-primary);
}

.toggle-slider {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: transform 0.25s ease;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

.toggle-switch.active .toggle-slider {
    transform: translateX(22px);
}

.theme-selector {
    display: flex;
    gap: 0;
    margin-top: 0.25rem;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid var(--app-secondary);
    width: fit-content;
}

.theme-option {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    border: none;
    background: var(--bg-color);
    color: var(--text-color);
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.theme-option:not(:last-child) {
    border-right: 1px solid var(--app-secondary);
}

.theme-option:hover {
    background: var(--app-light-accent);
}

.theme-option.active {
    background: var(--app-primary);
    color: white;
}

body.dark-mode .theme-option {
    background: var(--card-bg);
}

body.dark-mode .theme-option:hover {
    background: rgba(74, 147, 183, 0.2);
}

body.dark-mode .theme-option.active {
    background: var(--app-primary);
    color: white;
}

.year-select {
    width: 100%;
    padding: 0.8rem;
    border: 2px solid var(--app-secondary);
    border-radius: 5px;
    font-size: 1rem;
    background: var(--bg-color);
    color: var(--text-color);
    cursor: pointer;
}

.year-select:focus {
    border-color: var(--app-primary);
    outline: none;
}

/* Cookie Notice */
.cookie-notice {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--card-bg);
    color: var(--text-color);
    border-top: 3px solid var(--app-primary);
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.15);
    z-index: 3000;
    transform: translateY(100%);
    transition: transform 0.3s ease-in-out;
}

.cookie-notice.show {
    transform: translateY(0);
}

/* Feature 4: Practice Today */
.practice-today-hero {
    background: linear-gradient(135deg, var(--app-primary) 0%, var(--app-secondary) 100%);
    color: #fff;
    border-radius: 16px;
    padding: 1.75rem 2rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.practice-today-hero__title {
    font-size: 1.4rem;
    font-weight: 700;
    margin: 0 0 0.25rem;
}

.practice-today-hero__subtitle {
    font-size: 0.9rem;
    opacity: 0.85;
    margin: 0 0 1rem;
}

.btn-practice-today {
    background: #fff;
    color: var(--app-primary);
    border: none;
    border-radius: 8px;
    padding: 0.65rem 1.5rem;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.btn-practice-today:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-practice-today:active {
    transform: translateY(0);
}

.practice-progress-container {
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.practice-progress-bar {
    flex: 1;
    height: 8px;
    background: var(--border-color, #e5e7eb);
    border-radius: 999px;
    overflow: hidden;
}

.practice-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--app-primary), var(--app-secondary));
    border-radius: 999px;
    transition: width 0.3s ease;
}

.practice-progress-label {
    font-size: 0.8rem;
    color: var(--text-color, #6b7280);
    white-space: nowrap;
}

.practice-summary {
    text-align: center;
    padding: 2rem 1rem;
    max-width: 400px;
    margin: 0 auto;
}

.practice-summary__icon {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.practice-summary__title {
    font-size: 1.6rem;
    font-weight: 700;
    margin: 0 0 0.25rem;
}

.practice-summary__reviewed {
    color: var(--text-color, #6b7280);
    font-size: 1rem;
    margin: 0 0 1rem;
}

.summary-highlight {
    font-size: 0.95rem;
    margin: 0.25rem 0;
    font-weight: 600;
}

.summary-highlight--good {
    color: var(--success, #22c55e);
}

.summary-highlight--warn {
    color: var(--warning, #f59e0b);
}

.practice-summary__divider {
    height: 1px;
    background: var(--border-color, #e5e7eb);
    margin: 1rem 0;
}

.summary-tomorrow {
    font-size: 0.9rem;
    color: var(--text-color, #6b7280);
    margin: 0;
}

/* Phase 3: Quiz options panel */
.quiz-options-panel {
    max-width: 700px;
    margin: 0 auto 1.5rem;
    padding: 2rem;
    background: var(--card-bg, #ffffff);
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 16px;
}
.quiz-options-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 1.5rem;
    color: var(--text-primary, #111827);
    text-align: center;
}
.quiz-mode-cards {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}
.quiz-mode-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 2rem 1.5rem;
    border: 2px solid var(--border-color, #e5e7eb);
    border-radius: 12px;
    background: var(--card-bg, #ffffff);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}
.quiz-mode-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.quiz-mode-card--active {
    border-color: #4f46e5;
    background: #eef2ff;
}
.quiz-mode-icon {
    font-size: 2.5rem;
    line-height: 1;
    margin-bottom: 0.5rem;
}
.quiz-mode-label {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-primary, #111827);
}
.quiz-mode-desc {
    font-size: 0.78rem;
    color: var(--text-secondary, #6b7280);
}
.quiz-options-row {
    margin-bottom: 1rem;
}
.quiz-toggle-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary, #6b7280);
    cursor: pointer;
}
.btn-start-quiz {
    width: 100%;
    padding: 0.75rem;
    background: #4f46e5;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s ease;
}
.btn-start-quiz:hover {
    background: #4338ca;
}

/* Phase 3: Free-recall card and reveal */
.free-recall-card {
    max-width: 520px;
    margin: 0 auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.free-recall-prompt-label {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary, #6b7280);
    margin: 0;
}
.free-recall-prompt {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-primary, #111827);
    margin: 0;
}
.free-recall-answer-label {
    font-size: 0.9rem;
    color: var(--text-secondary, #6b7280);
    margin: 0.5rem 0 0;
}
.free-recall-textarea {
    width: 100%;
    padding: 0.75rem;
    font-size: 1rem;
    border: 2px solid var(--border-color, #e5e7eb);
    border-radius: 10px;
    resize: vertical;
    background: var(--input-bg, #fff);
    color: var(--text-primary, #111827);
    font-family: inherit;
    transition: border-color 0.15s ease;
    box-sizing: border-box;
}
.free-recall-textarea:focus {
    outline: none;
    border-color: #4f46e5;
}
.btn-free-recall-submit {
    padding: 0.7rem 1.5rem;
    background: #4f46e5;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    align-self: flex-start;
    transition: background 0.15s ease;
}
.btn-free-recall-submit:hover {
    background: #4338ca;
}
.free-recall-reveal {
    max-width: 520px;
    margin: 0 auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.free-recall-reveal__yours,
.free-recall-reveal__correct {
    padding: 1rem;
    border-radius: 10px;
    border: 1px solid var(--border-color, #e5e7eb);
}
.free-recall-reveal__correct {
    background: #f0fdf4;
    border-color: #22c55e;
}
.free-recall-reveal__label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-secondary, #6b7280);
    margin: 0 0 0.4rem;
}
.free-recall-reveal__text {
    font-size: 0.95rem;
    color: var(--text-primary, #111827);
    margin: 0;
    line-height: 1.5;
}
.free-recall-reveal__text--empty {
    color: var(--text-secondary, #9ca3af);
    font-style: italic;
}
.free-recall-reveal__prompt {
    font-weight: 600;
    font-size: 0.95rem;
    margin: 0;
    color: var(--text-primary, #111827);
}
.free-recall-rating-buttons {
    display: flex;
    gap: 0.75rem;
}
.btn-self-rate {
    flex: 1;
    padding: 0.7rem 0.5rem;
    border: none;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.15s ease, transform 0.1s ease;
}
.btn-self-rate:hover {
    opacity: 0.88;
    transform: translateY(-1px);
}
.btn-self-rate--hard    { background: #fee2e2; color: #b91c1c; }
.btn-self-rate--got-it  { background: #fef9c3; color: #92400e; }
.btn-self-rate--easy    { background: #dcfce7; color: #15803d; }

/* Phase 3: Session summary additions */
.summary-accuracy {
    font-size: 0.95rem;
    color: var(--text-secondary, #6b7280);
    margin: 0.25rem 0 0.5rem;
}
.summary-accuracy strong {
    color: var(--text-primary, #111827);
}
.summary-tip {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 10px;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    color: #92400e;
    line-height: 1.5;
    text-align: left;
}
.summary-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
    justify-content: center;
}
.btn-summary-home {
    padding: 0.65rem 1.25rem;
    background: #4f46e5;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s ease;
}
.btn-summary-home:hover {
    background: #4338ca;
}
.btn-summary-mistakes {
    padding: 0.65rem 1.25rem;
    background: transparent;
    color: #4f46e5;
    border: 2px solid #4f46e5;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}
.btn-summary-mistakes:hover {
    background: #eef2ff;
}

#due-count-badge {
    display: inline-block;
    background: #ef4444;
    color: #fff;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 1px 7px;
    margin-left: 6px;
    vertical-align: middle;
}

.bucket-summary {
    margin-top: 1.5rem;
}

.bucket-bars {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

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

.bucket-label {
    width: 80px;
    font-size: 0.85rem;
    color: var(--text-color, #6b7280);
}

.bucket-track {
    flex: 1;
    height: 10px;
    background: var(--border-color, #e5e7eb);
    border-radius: 999px;
    overflow: hidden;
}

.bucket-fill {
    height: 100%;
    border-radius: 999px;
    transition: width 0.4s ease;
}

.bucket-fill--learning {
    background-color: #f59e0b;
}

.bucket-fill--reviewing {
    background-color: #3b82f6;
}

.bucket-fill--mastered {
    background-color: #22c55e;
}

.bucket-count {
    width: 30px;
    text-align: right;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-color, #111827);
}

.cookie-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem;
    display: flex;
    gap: 2rem;
    align-items: flex-start;
    flex-wrap: wrap;
}

.cookie-text {
    flex: 1;
    min-width: 300px;
}

.cookie-text h3 {
    color: var(--app-primary);
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
}

.cookie-text p {
    margin-bottom: 0.5rem;
    line-height: 1.5;
    color: var(--text-color);
}

.cookie-text ul {
    margin: 0.5rem 0 0.5rem 1.5rem;
    padding: 0;
}

.cookie-text li {
    margin-bottom: 0.25rem;
    color: var(--text-color);
}

.cookie-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: flex-start;
}

.cookie-btn {
    padding: 0.75rem 1.25rem;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: all 0.3s;
    white-space: nowrap;
}

.cookie-accept {
    background: var(--app-primary);
    color: white;
}

.cookie-accept:hover {
    background: var(--app-dark);
}

.cookie-decline {
    background: var(--app-secondary);
    color: white;
}

.cookie-decline:hover {
    background: var(--app-primary);
}

.cookie-learn {
    background: transparent;
    color: var(--app-primary);
    border: 2px solid var(--app-primary);
}

.cookie-learn:hover {
    background: var(--app-light-accent);
}

/* Privacy Modal Content */
.privacy-content {
    max-height: 60vh;
    overflow-y: auto;
    padding: 1.5rem 2rem 2rem;
}

.privacy-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.privacy-section:last-child {
    border-bottom: none;
}

.privacy-section h4 {
    color: var(--app-primary);
    margin-bottom: 0.5rem;
}

.privacy-section p {
    color: var(--text-color);
}

.privacy-section ul {
    margin: 0.5rem 0 0.5rem 1.5rem;
    padding: 0;
}

.privacy-section li {
    margin-bottom: 0.25rem;
    line-height: 1.4;
    color: var(--text-color);
}

.privacy-section a {
    color: var(--app-primary);
    text-decoration: none;
}

.privacy-section a:hover {
    text-decoration: underline;
}

/* Toast Notifications */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }

    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 1rem 1.5rem;
    border-radius: 5px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 4000;
    font-weight: 600;
    max-width: 300px;
    word-wrap: break-word;
    animation: slideInRight 0.3s ease-out;
}

.toast-success {
    background: var(--success);
    color: white;
}

.toast-error {
    background: var(--danger);
    color: white;
}

.toast-info {
    background: var(--app-primary);
    color: white;
}

/* Loading Screen */
.loading {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.loading.active {
    display: block;
}

.spinner {
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-top: 4px solid var(--app-primary);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-color);
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state-text {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.empty-state-subtext {
    color: var(--text-color);
    opacity: 0.7;
}

/* Cookie Notice Responsive */
@media (max-width: 768px) {
    .cookie-content {
        flex-direction: column;
        gap: 1rem;
    }

    .cookie-actions {
        width: 100%;
        flex-direction: column;
    }

    .cookie-btn {
        width: 100%;
        text-align: center;
    }

    .cookie-text h3 {
        font-size: 1.1rem;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        text-align: center;
    }

    .app-title {
        font-size: 1.2rem;
    }

    .selection-grid {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    }

    .vocab-grid {
        grid-template-columns: 1fr;
    }

    .mode-tabs {
        flex-direction: column;
    }

    .mode-tab {
        background: var(--card-bg);
        color: var(--text-color);
        width: 100%;
        text-align: center;
    }

    .flashcard {
        padding: 2rem 1rem;
        min-height: 250px;
    }

    .flashcard-text {
        font-size: 1.2rem;
    }

    .quiz-header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .controls-bar,
    .controls-bar-primary {
        align-items: stretch;
    }

    .control-button,
    .search-bar {
        width: 100%;
        margin-bottom: 0.5rem;
    }

    .toast {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
}



/* Color Picker Grid */
.color-picker-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.color-option {
    width: 100%;
    aspect-ratio: 1;
    border: 3px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.color-option:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.color-option.selected {
    border-color: var(--app-primary);
    box-shadow: 0 0 0 2px white, 0 0 0 4px var(--app-primary);
}

/* Dark mode styles for specific elements */
body.dark-mode .header {
    background: #1a1f2e;
    border-bottom: 2px solid var(--app-secondary);
}

body.dark-mode .settings-btn {
    background: var(--app-secondary);
}

body.dark-mode .user-dropdown-menu {
    background: #1f1f1f;
    border-color: rgba(255, 255, 255, 0.1);
}

body.dark-mode .user-dropdown-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

body.dark-mode .notification-item {
    background: #252525;
    border-color: rgba(255, 255, 255, 0.08);
}

body.dark-mode .notification-item__clear:hover {
    background: rgba(200, 50, 50, 0.25);
}

body.dark-mode .empty-state {
    color: var(--text-color);
}

body.dark-mode .toast {
    background: #2d2d2d;
    color: var(--text-color);
    border: 1px solid var(--app-primary);
}

body.dark-mode input,
body.dark-mode select {
    background: #3d3d3d;
    color: var(--text-color);
    border-color: var(--border-color);
}

/* Hide background color setting in dark mode */
body.dark-mode #bgColorSetting {
    display: none;
}

/* Additional dark mode refinements */
body.dark-mode .cookie-notice {
    background: #2d2d2d;
    border-top: 2px solid var(--app-primary);
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.5);
}

body.dark-mode .privacy-section {
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

body.dark-mode .setting-item p {
    color: var(--text-color);
    opacity: 0.8;
}

/* Ensure search bar is readable in dark mode */
body.dark-mode .search-bar {
    background: #3d3d3d;
    color: var(--text-color);
    border-color: var(--border-color);
}

body.dark-mode .search-bar::placeholder {
    color: rgba(224, 224, 224, 0.5);
}

/* Group Filter Styles */
#groupFilterContainer {
    border-top: 1px solid var(--border-color);
    padding-top: 1.5rem;
    margin-top: 1.5rem;
}

.group-checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.75rem;
    max-height: 200px;
    overflow-y: auto;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    background-color: var(--app-light-accent);
}

.group-checkbox-item {
    display: flex;
    align-items: center;
    background-color: var(--card-bg);
    padding: 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.group-checkbox-item:hover {
    background-color: rgba(0, 48, 135, 0.1);
}

.group-checkbox-item input[type="checkbox"] {
    margin-right: 0.75rem;
    transform: scale(1.1);
    cursor: pointer;
}

.group-checkbox-item label {
    font-weight: normal;
    margin-bottom: 0;
    color: var(--text-color);
    cursor: pointer;
    flex-grow: 1;
}

.clear-groups-btn {
    background-color: var(--app-secondary);
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
    min-width: auto;
}

.clear-groups-btn:hover {
    background-color: var(--app-primary);
}

/* Dark mode adjustments for group filter */
body.dark-mode .group-checkbox-grid {
    background-color: rgba(74, 147, 183, 0.1);
    border-color: var(--border-color);
}

body.dark-mode .group-checkbox-item {
    background-color: var(--card-bg);
}

body.dark-mode .group-checkbox-item:hover {
    background-color: rgba(74, 147, 183, 0.2);
}

body.dark-mode .group-checkbox-item label {
    color: var(--text-color);
}

/* =========================================
   NEW STYLES FOR V2 (LOGIN & ADMIN)
   ========================================= */

/* Auth Pages (Login/Signup) */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 80px);
    /* Minus header height */
    padding: 2rem;
}

.auth-card {
    background: var(--card-bg);
    padding: 2.5rem;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 450px;
    text-align: center;
    border-top: 5px solid var(--app-primary);
}

.auth-title {
    color: var(--app-primary);
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
}

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

.form-group {
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-color);
}

.form-control {
    width: 100%;
    padding: 0.8rem;
    border: 2px solid var(--app-secondary);
    border-radius: 5px;
    font-size: 1rem;
    background: var(--bg-color);
    color: var(--text-color);
}

.form-control:focus {
    border-color: var(--app-primary);
    outline: none;
}

.auth-btn {
    background: var(--app-primary);
    color: white;
    border: none;
    padding: 1rem;
    border-radius: 5px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s;
    margin-top: 1rem;
}

.auth-btn:hover {
    background: var(--app-dark);
}

.auth-divider {
    margin: 2rem 0;
    border-top: 1px solid var(--border-color);
    position: relative;
}

.auth-divider span {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--card-bg);
    padding: 0 1rem;
    color: var(--text-color);
    font-size: 0.9rem;
}

.auth-footer {
    margin-top: 1.5rem;
    font-size: 0.9rem;
    color: var(--text-color);
}

.auth-link {
    color: var(--app-primary);
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
}

.auth-link:hover {
    text-decoration: underline;
}

/* Admin Dashboard */
.admin-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 2rem;
}

.admin-sidebar {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    height: fit-content;
}

.admin-nav {
    list-style: none;
}

.admin-nav li {
    margin-bottom: 0.5rem;
}

.admin-nav a {
    display: block;
    padding: 0.8rem 1rem;
    color: var(--text-color);
    text-decoration: none;
    border-radius: 5px;
    transition: all 0.2s;
}

.admin-nav a:hover,
.admin-nav a.active {
    background: var(--app-light-accent);
    color: var(--app-primary);
    font-weight: 600;
}

.admin-content {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

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

.admin-title {
    font-size: 1.8rem;
    color: var(--app-primary);
}

/* Upload Form */
.upload-area {
    border: 2px dashed var(--app-secondary);
    padding: 2rem;
    text-align: center;
    border-radius: 10px;
    margin-bottom: 2rem;
    background: var(--bg-color);
    cursor: pointer;
    transition: all 0.3s;
}

.upload-area:hover {
    background: var(--app-light-accent);
    border-color: var(--app-primary);
}

.file-input {
    display: none;
}

.preview-image {
    max-width: 200px;
    max-height: 200px;
    margin-top: 1rem;
    border-radius: 5px;
    display: none;
}

/* Admin Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

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

.data-table th {
    background: var(--app-light-accent);
    color: var(--app-primary);
    font-weight: 600;
}

.data-table tr:hover {
    background: rgba(0, 0, 0, 0.02);
}

.action-btn {
    padding: 0.4rem 0.8rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    margin-right: 0.5rem;
}

.btn-edit {
    background: var(--warning);
    color: #333;
}

.btn-delete {
    background: var(--danger);
    color: white;
}

/* Responsive Admin */
@media (max-width: 900px) {
    .admin-container {
        grid-template-columns: 1fr;
    }

    .admin-sidebar {
        margin-bottom: 1rem;
    }

    .admin-nav {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .admin-nav li {
        margin-bottom: 0;
    }
}

/* Lightbox Styles */
.lightbox-modal {
    display: none;
    position: fixed;
    z-index: 5000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.9);
    align-items: center;
    justify-content: center;
}

.lightbox-modal.active {
    display: flex;
}

.lightbox-content {
    margin: auto;
    display: block;
    max-width: 90%;
    max-height: 90vh;
    border-radius: 5px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    animation: zoomIn 0.3s;
}

.lightbox-close {
    position: absolute;
    top: 15px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
    cursor: pointer;
}

.lightbox-close:hover,
.lightbox-close:focus {
    color: #bbb;
    text-decoration: none;
    cursor: pointer;
}

@keyframes zoomIn {
    from {
        transform: scale(0)
    }

    to {
        transform: scale(1)
    }
}

/* === V3 RESTRUCTURE STYLES === */

.main-nav {
    display: flex;
    gap: 0.25rem;
}

.nav-btn {
    padding: 0.4rem 1rem;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: rgba(255, 255, 255, 0.65);
    font-size: 0.85rem;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: white;
}

.nav-btn.active {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    font-weight: 700;
}

.app-section {
    display: none;
}

.app-section.active {
    display: block;
}

.home-cta-card {
    background: linear-gradient(135deg, #006490 0%, #004f73 100%);
    border-radius: 16px;
    padding: 2rem;
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1.5rem;
    box-shadow: 0 8px 24px rgba(0, 48, 135, 0.3);
    margin-bottom: 1.5rem;
}

.home-cta-card.completed {
    background: linear-gradient(135deg, #28a745 0%, #218838 100%);
}

.home-cta-label {
    font-size: 0.8rem;
    opacity: 0.75;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.4rem;
}

.home-cta-heading {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.home-cta-btn {
    background: #e8720c;
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(232, 114, 12, 0.4);
    transition: transform 0.1s, box-shadow 0.1s;
}

.home-cta-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(232, 114, 12, 0.5);
}

.home-cta-btn.completed {
    background: white;
    color: #28a745;
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.4);
}

.home-cta-btn.completed:hover {
    box-shadow: 0 6px 16px rgba(40, 167, 69, 0.5);
}

.home-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.home-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.07);
    border: 1px solid rgba(0, 0, 0, 0.06);
}

/* Short full-width Overall Mastery bar between streak/goal grid and Progress by Subject */
.home-card-mastery-bar {
    padding: 0.75rem 1.5rem;
    margin-bottom: 1.5rem;
}

.home-mastery-bar-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1.5rem;
}

.home-mastery-bar-head {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.home-card-mastery-bar .home-card-label {
    margin-bottom: 0;
}

.home-mastery-bar-stat .home-card-value {
    font-size: 1.4rem;
    margin-bottom: 0;
}

.home-mastery-bar-legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1rem;
    font-size: 0.8rem;
    color: #555;
}

.home-mastery-bar-legend .legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.home-mastery-bar-legend .legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

/* Subtle "see more" link on Progress by Subject card */
.home-progress-more {
    margin-top: 1rem;
    margin-bottom: 0;
    font-size: 0.75rem;
}

.home-progress-more-link {
    color: #999;
    text-decoration: none;
}

.home-progress-more-link:hover {
    color: #666;
    text-decoration: underline;
}

.home-card-label {
    font-size: 0.75rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.home-card-value {
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.streak-week {
    display: flex;
    gap: 0.4rem;
    margin-top: 0.5rem;
}

.daily-goal-bar-track {
    height: 8px;
    background: var(--border-color, #e5e7eb);
    border-radius: 999px;
    overflow: hidden;
}

.daily-goal-bar-fill {
    height: 100%;
    background: var(--app-primary);
    border-radius: 999px;
    transition: width 0.4s ease;
}

.daily-goal-bar-fill.complete {
    background: #22c55e;
}

.streak-day {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
}

.streak-dot {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 50%;
    background: #f0f0f0;
}

.streak-dot.active {
    background: #e8720c;
}

.streak-dot.missed {
    background: var(--app-secondary);
}

.streak-day-label {
    font-size: 0.6rem;
    color: #aaa;
}

.goal-week-dot {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 50%;
    background: #f0f0f0;
    box-sizing: border-box;
}
.goal-week-dot.hit { background: #22c55e; }
.goal-week-dot.today { border: 2px solid #22c55e; }

.progress-bar-track {
    display: flex;
    border-radius: 4px;
    overflow: hidden;
    background: #e9ecef;
}

.progress-bar-segment {
    transition: width 0.4s ease;
}

.bucket-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.bucket-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.rating-buttons {
    display: flex;
    gap: 0.35rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    justify-content: flex-end;
}

.rating-btn {
    font-size: 0.72rem;
    padding: 3px 9px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.15s;
}

.rating-hard {
    border: 1px solid rgba(220, 53, 69, 0.3);
    background: rgba(220, 53, 69, 0.08);
    color: #dc3545;
}

.rating-ok {
    border: 1px solid rgba(240, 165, 0, 0.4);
    background: rgba(240, 165, 0, 0.12);
    color: #b07800;
}

.rating-easy {
    border: 1px solid rgba(40, 167, 69, 0.4);
    background: rgba(40, 167, 69, 0.1);
    color: #28a745;
}

.flashcard-rating {
    display: none;
    gap: 1rem;
    justify-content: center;
    margin-top: 1rem;
}

.flashcard-rating .rating-btn {
    font-size: 0.9rem;
    padding: 0.6rem 1.5rem;
}

.mode-tabs-v2 {
    display: flex;
    flex-wrap: nowrap;
    gap: 0;
    border-bottom: 2px solid #eee;
    margin-bottom: 1.5rem;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.mode-tabs-v2::-webkit-scrollbar {
    display: none;
}

.mode-tab-v2 {
    padding: 0.65rem 1.3rem;
    border: none;
    background: none;
    font-size: 0.9rem;
    font-weight: 400;
    color: #888;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: all 0.15s;
    flex-shrink: 0;
}

.mode-tab-v2:hover {
    color: var(--app-primary);
}

.mode-tab-v2.active {
    font-weight: 700;
    color: var(--app-primary);
    border-bottom-color: var(--app-primary);
}

/* Mobile: icons only, hide labels, ensure touch targets (WCAG 44×44px) */
@media (max-width: 480px) {
    .mode-tabs-v2 .nav-label {
        display: none;
    }

    .mode-tab-v2 {
        min-width: 44px;
        min-height: 44px;
        padding: 0.65rem 0.75rem;
        box-sizing: border-box;
    }
}

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

.progress-stat-tile {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1.25rem;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.07);
    border: 1px solid rgba(0, 0, 0, 0.06);
    text-align: center;
}

.progress-stat-value {
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 0.25rem;
}

.progress-stat-label {
    font-size: 0.72rem;
    color: #888;
}

.struggled-word-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    border-radius: 8px;
    background: rgba(220, 53, 69, 0.04);
    border: 1px solid rgba(220, 53, 69, 0.12);
    margin-bottom: 0.5rem;
}

.mistake-count-badge {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--danger);
    background: rgba(220, 53, 69, 0.1);
    border-radius: 10px;
    padding: 1px 8px;
}

/* ===== Phase 1: Persistent Mistake History ===== */

.review-header {
    margin-bottom: 1rem;
}

.review-header h3 {
    margin: 0 0 0.25rem;
    font-size: 1.1rem;
    font-weight: 600;
}

.review-subhead {
    font-size: 0.8rem;
    color: #888;
}

/* Mistake frequency badge on review list items */
.mistake-badge {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    margin-left: 0.5rem;
    vertical-align: middle;
}

.mistake-badge--high {
    background: rgba(220, 53, 69, 0.15);
    color: var(--danger);
}

.mistake-badge--mid {
    background: rgba(255, 193, 7, 0.2);
    color: #b38600;
}

.mistake-badge--low {
    background: rgba(0, 0, 0, 0.07);
    color: #888;
}

/* No mistakes message */
.no-mistakes-msg {
    text-align: center;
    padding: 2rem 1rem;
    color: #888;
}

.no-mistakes-msg p {
    margin: 0.25rem 0;
}

/* Struggled word rows in My Progress section */
.struggled-word-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.07);
    gap: 1rem;
}

.struggled-word-row:last-child {
    border-bottom: none;
}

.struggled-word-info {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    flex: 1;
    min-width: 0;
}

.struggled-word-term {
    font-weight: 600;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.struggled-word-def {
    font-size: 0.78rem;
    color: #888;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.struggled-word-count {
    font-weight: 700;
    font-size: 0.85rem;
    white-space: nowrap;
    flex-shrink: 0;
}

.struggled-word-count[data-severity="high"] {
    color: var(--danger);
}

.struggled-word-count[data-severity="mid"] {
    color: var(--warning);
}

.struggled-word-count[data-severity="low"] {
    color: #aaa;
}

/* Dark mode adjustments */
body.dark-mode .struggled-word-row {
    border-bottom-color: rgba(255, 255, 255, 0.08);
}

body.dark-mode .mistake-badge--low {
    background: rgba(255, 255, 255, 0.1);
}

/* ===== Phase 1: Flashcard Self-Rating ===== */

/* Rating button row on flashcards */
.flashcard-rating-row {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    margin: 1.25rem 0 0.5rem;
    flex-wrap: wrap;
}

.rating-btn {
    padding: 0.6rem 1.4rem;
    border: 2px solid transparent;
    border-radius: 2rem;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
    min-width: 100px;
}

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

.rating-btn:active,
.rating-btn--selected {
    transform: scale(0.95);
    opacity: 0.75;
}

.rating-btn--hard {
    background: rgba(220, 53, 69, 0.1);
    border-color: var(--danger);
    color: var(--danger);
}

.rating-btn--hard:hover {
    background: var(--danger);
    color: #fff;
}

.rating-btn--ok {
    background: rgba(255, 193, 7, 0.12);
    border-color: var(--warning);
    color: #b38600;
}

.rating-btn--ok:hover {
    background: var(--warning);
    color: #333;
}

.rating-btn--easy {
    background: rgba(40, 167, 69, 0.1);
    border-color: var(--success);
    color: var(--success);
}

.rating-btn--easy:hover {
    background: var(--success);
    color: #fff;
}

/* Word rating badge on study cards */
.word-rating-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.word-rating-badge--hard {
    background: rgba(220, 53, 69, 0.12);
    color: var(--danger);
}

.word-rating-badge--ok {
    background: rgba(255, 193, 7, 0.18);
    color: #b38600;
}

.word-rating-badge--easy {
    background: rgba(40, 167, 69, 0.12);
    color: var(--success);
}

/* Flashcard completion screen */
.flashcard-complete {
    text-align: center;
    padding: 3rem 1.5rem;
    max-width: 480px;
    margin: 0 auto;
}

.flashcard-complete-icon {
    font-size: 3rem;
    margin-bottom: 0.75rem;
}

.flashcard-complete h2 {
    font-size: 1.5rem;
    margin: 0 0 0.5rem;
}

.flashcard-complete-stats {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin: 1rem 0;
}

.rating-summary {
    font-size: 0.9rem;
    font-weight: 600;
    padding: 0.3rem 0.75rem;
    border-radius: 2rem;
}

.rating-summary--easy {
    background: rgba(40, 167, 69, 0.12);
    color: var(--success);
}

.rating-summary--ok {
    background: rgba(255, 193, 7, 0.15);
    color: #b38600;
}

.rating-summary--hard {
    background: rgba(220, 53, 69, 0.12);
    color: var(--danger);
}

.flashcard-complete-tip {
    font-size: 0.85rem;
    color: #888;
    font-style: italic;
    margin-bottom: 1.25rem;
}

/* Dark mode adjustments */
body.dark-mode .rating-btn--ok {
    color: #e0a800;
}

body.dark-mode .word-rating-badge--ok {
    color: #e0a800;
}

body.dark-mode .flashcard-complete h2 {
    color: #f0f0f0;
}

body.dark-mode .flashcard-btn--home {
    color: var(--text-color);
    border-color: rgba(255, 255, 255, 0.2);
}
body.dark-mode .flashcard-btn--home:hover {
    background: rgba(255, 255, 255, 0.08);
}

/* Mobile: stack rating buttons if needed */
@media (max-width: 480px) {
    .rating-btn {
        min-width: 80px;
        padding: 0.55rem 1rem;
        font-size: 0.85rem;
    }
}

/* ── Phase 4: Progress Dashboard ───────────────────────── */

.progress-dashboard {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
    padding: 1rem 0;
}

.progress-top-row {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 1rem;
}

.progress-card {
    background: var(--card-bg, #ffffff);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.07);
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.progress-card__title {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary, #6b7280);
    margin: 0 0 0.75rem;
}

.streak-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 100px;
    text-align: center;
    gap: 0.1rem;
}

.streak-flame {
    font-size: 2rem;
    line-height: 1;
    transition: opacity 0.2s ease;
}

.streak-number {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--text-primary, #111827);
    line-height: 1;
}

.streak-label {
    font-size: 0.8rem;
    color: var(--text-secondary, #6b7280);
    font-weight: 600;
}

.streak-best {
    font-size: 0.75rem;
    color: var(--text-secondary, #6b7280);
    margin-top: 0.25rem;
}

.activity-card {
    display: flex;
    flex-direction: column;
}

.activity-week {
    display: flex;
    gap: 0.4rem;
    align-items: flex-end;
    flex-wrap: nowrap;
}

.activity-day {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    flex: 1;
}

.activity-circle {
    width: 100%;
    max-width: 40px;
    aspect-ratio: 1;
    height: auto;
    border-radius: 50%;
    background: var(--border-color, #e5e7eb);
    transition: background 0.15s ease;
}

.activity-circle--active {
    background: #e8720c;
}

.activity-circle--today {
    background: var(--border-color, #e5e7eb);
    outline: 2px solid #e8720c;
    outline-offset: 1px;
}

.activity-circle--future {
    background: transparent;
    border: 2px dashed var(--border-color, #e5e7eb);
}

.activity-circle--small {
    max-width: 16px;
    aspect-ratio: 1;
}

.activity-circle--goal {
    background: #22c55e; /* green */
}

.activity-circle--mini {
    display: inline-block;
    width: 10px;
    height: 10px;
    max-width: none;
    border-radius: 50%;
    /* no background so --active / --goal apply in legend */
}

.activity-week-legend {
    display: flex;
    gap: 1rem;
    margin-top: 0.75rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-color);
}

.activity-legend-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.72rem;
    color: var(--text-secondary, #6b7280);
}

.activity-day-label {
    font-size: 0.65rem;
    color: var(--text-secondary, #6b7280);
    font-weight: 600;
}

/* History calendar (collapsible) */
.history-calendar-card {
    margin-top: 1.5rem;
}

.history-calendar-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    background: none;
    border: none;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    cursor: pointer;
    padding: 0;
    font-family: inherit;
}

.history-calendar-chevron {
    font-size: 1rem;
    color: var(--text-secondary);
    transition: transform 0.2s;
}

.history-calendar-body {
    margin-top: 1rem;
}

.history-calendar-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.history-month-label {
    font-weight: 700;
    font-size: 0.95rem;
}

.history-nav-btn {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.2rem 0.6rem;
    cursor: pointer;
    font-size: 1.1rem;
    color: var(--text-secondary);
    line-height: 1;
}

.history-nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.history-calendar-legend {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.cal-header-row,
.cal-body {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.cal-header-cell {
    text-align: center;
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-secondary);
    padding-bottom: 0.25rem;
}

.cal-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.25rem 0;
    border-radius: 6px;
    min-height: 44px;
    gap: 0.15rem;
}

.cal-cell--today {
    background: var(--app-light-accent);
    outline: 1px solid var(--app-secondary);
}

.cal-cell--future {
    opacity: 0.35;
}

.cal-cell--empty {
    min-height: 44px;
}

.cal-day-number {
    font-size: 0.72rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.cal-dots {
    display: flex;
    gap: 3px;
}

.cal-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--border-color, #e5e7eb);
}

.cal-dot--practice {
    background: #e8720c;
}

.cal-dot--goal {
    background: #22c55e;
}

.cal-dot--future {
    background: transparent;
    border: 1px dashed var(--border-color);
}

.bucket-bar-container .bucket-bar {
    display: flex;
    height: 20px;
    border-radius: 999px;
    overflow: hidden;
    background: var(--border-color, #e5e7eb);
    width: 100%;
}

.bucket-bar--slim {
    height: 12px;
}

.bucket-bar__segment {
    height: 100%;
    transition: width 0.3s ease;
}

.bucket-bar__segment--mastered { background: #22c55e; }
.bucket-bar__segment--reviewing { background: #3b82f6; }
.bucket-bar__segment--learning { background: #f59e0b; }
.bucket-bar__segment--unseen { background: var(--border-color, #e5e7eb); }

.bucket-bar-summary {
    font-size: 0.8rem;
    color: var(--text-secondary, #6b7280);
    margin: 0.5rem 0 0;
}

.bucket-bar-empty {
    font-size: 0.875rem;
    color: var(--text-secondary, #6b7280);
    margin: 0;
}

.bucket-legend {
    display: flex;
    gap: 1rem;
    margin-top: 0.75rem;
    flex-wrap: wrap;
}

.bucket-legend-item {
    font-size: 0.78rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.bucket-legend-item::before {
    content: '';
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.bucket-legend-item--learning::before { background: #f59e0b; }
.bucket-legend-item--reviewing::before { background: #3b82f6; }
.bucket-legend-item--mastered::before { background: #22c55e; }

/* Subject Row Layout Updates */
.subject-row {
    display: block; /* Changed from grid to block to allow stacking */
    margin-bottom: 0.6rem;
}

.subject-row__main {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.subject-row__top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.2rem;
}

.subject-row__name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary, #111827);
    display: flex;
    align-items: center;
}

.subject-row__bar-wrap {
    /* No flex needed here as it's full width in block layout */
}

.subject-row__pct {
    font-size: 0.8rem;
    font-weight: 700;
    color: #22c55e;
    min-width: 36px;
    text-align: right;
}

.most-improved-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--border-color, #e5e7eb);
}

.most-improved-item:last-child {
    border-bottom: none;
}

.most-improved-item__word {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary, #111827);
}

.most-improved-item__badge,
.badge-mastered {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
    font-weight: 600;
}

/* Phase 4: Header streak badge */
.header-streak-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    background: rgba(255, 184, 0, 0.12);
    color: #b07800;
    border: 1px solid rgba(255, 184, 0, 0.3);
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 3px 10px;
    cursor: default;
    user-select: none;
}

body.dark-mode .header-streak-badge {
    background: rgba(255, 202, 40, 0.15);
    color: #FFCA28;
    border-color: rgba(255, 184, 0, 0.35);
}

/* Phase 4: Milestone modal */
.milestone-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeInOverlay 0.2s ease;
}

.milestone-modal-overlay--hiding {
    animation: fadeOutOverlay 0.3s ease forwards;
}

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

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

.milestone-modal {
    background: var(--card-bg, #ffffff);
    border-radius: 20px;
    padding: 2rem 1.5rem;
    text-align: center;
    max-width: 320px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    animation: popIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes popIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.milestone-modal__emoji {
    font-size: 3.5rem;
    line-height: 1;
    margin-bottom: 0.5rem;
}

.milestone-modal__title {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text-primary, #111827);
    margin: 0 0 0.5rem;
}

.milestone-modal__message {
    font-size: 0.95rem;
    color: var(--text-secondary, #6b7280);
    margin: 0 0 1.25rem;
    line-height: 1.5;
}

.milestone-modal__btn {
    padding: 0.65rem 1.5rem;
    background: #4f46e5;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s ease;
}

.milestone-modal__btn:hover {
    background: #4338ca;
}

/* Phase 4: At-risk toast */
.at-risk-toast {
    position: fixed;
    bottom: 1.25rem;
    left: 50%;
    transform: translateX(-50%);
    background: #fff7ed;
    border: 1px solid #fed7aa;
    color: #92400e;
    border-radius: 12px;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.875rem;
    font-weight: 600;
    max-width: 420px;
    width: calc(100% - 2rem);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
    z-index: 900;
    animation: slideUpToast 0.25s ease;
}

@keyframes slideUpToast {
    from { opacity: 0; transform: translateX(-50%) translateY(12px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.at-risk-toast__icon {
    font-size: 1.1rem;
    flex-shrink: 0;
}

.at-risk-toast__message {
    flex: 1;
    line-height: 1.4;
}

.at-risk-toast__close {
    background: none;
    border: none;
    color: #92400e;
    font-size: 0.9rem;
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
    opacity: 0.7;
}

.at-risk-toast__close:hover {
    opacity: 1;
}

body.dark-mode .at-risk-toast {
    background: rgba(194, 65, 12, 0.15);
    border-color: #c2410c;
    color: #fdba74;
}

body.dark-mode .at-risk-toast__close {
    color: #fdba74;
}

/* Phase 4: Subject Accordions */
.subject-group {
    margin-bottom: 0.6rem;
}

.subject-header {
    transition: background-color 0.2s;
    border-radius: 8px;
    padding: 0.25rem 0.5rem;
    margin: 0 -0.5rem;
}

.subject-header:hover {
    background-color: rgba(0, 0, 0, 0.03);
}

.subject-chevron {
    display: inline-block;
    font-size: 0.7rem;
    color: var(--text-secondary, #6b7280);
    margin-right: 0.25rem;
    transition: transform 0.2s ease;
    width: 12px;
    text-align: center;
}

.subject-details {
    margin-top: 0.5rem;
    padding-left: 1.5rem;
    border-left: 2px solid var(--border-color, #e5e7eb);
    margin-left: 0.5rem;
}

/* Subgroup Row Layout Updates */
.subgroup-row {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    margin-bottom: 1rem;
    padding-bottom: 0.8rem;
    border-bottom: 1px dashed var(--border-color, #e5e7eb);
}

.subgroup-row:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.subgroup-row__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.subgroup-row__name {
    font-size: 0.85rem;
    font-weight: 600;
}

.subgroup-row__bar-wrap {
    /* Full width */
}

.subgroup-row__pct {
    font-size: 0.75rem;
    color: var(--text-secondary, #6b7280);
    min-width: 30px;
    text-align: right;
}

.bucket-bar--micro {
    height: 6px;
}

/* Phase 4: Detailed Stats */
.stats-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    margin-top: 0.4rem;
    font-size: 0.72rem;
    color: var(--text-secondary, #6b7280);
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.stat-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
}

.stat-dot--mastered { background-color: #22c55e; }
.stat-dot--reviewing { background-color: #3b82f6; }
.stat-dot--learning { background-color: #f59e0b; }

.stat-label {
    font-weight: 400;
}

.stat-value {
    font-weight: 700;
    color: var(--text-primary, #111827);
}

/* Subject Row Layout Updates */
.subject-row {
    display: block; /* Changed from grid to block to allow stacking */
    margin-bottom: 0.6rem;
}

.subject-row__main {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.subject-row__top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.2rem;
}

.subject-row__name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary, #111827);
    display: flex;
    align-items: center;
}

/* Subgroup Row Layout Updates */
.subgroup-row {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    margin-bottom: 1rem;
    padding-bottom: 0.8rem;
    border-bottom: 1px dashed var(--border-color, #e5e7eb);
}

.subgroup-row:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.subgroup-row__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.subgroup-row__name {
    font-size: 0.85rem;
    font-weight: 600;
}

/* Dark mode adjustments */
body.dark-mode .stat-value {
    color: var(--text-primary);
}

body.dark-mode .subject-header:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

body.dark-mode .subject-details {
    border-left-color: rgba(255, 255, 255, 0.1);
}

/* Selection Panel Collapsible Styles */
.selection-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.selection-header h3 {
    margin: 0;
    font-size: 1.2rem;
    color: var(--app-primary);
}

.selection-summary-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin: 0.2rem 0 0 0;
}

.selection-toggle-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--app-primary);
    cursor: pointer;
    transition: transform 0.3s;
}

.selection-panel.collapsed .selection-toggle-btn {
    transform: rotate(-90deg);
}

.selection-panel.collapsed #selectionContent {
    display: none;
}

.selection-panel.collapsed .selection-header {
    margin-bottom: 0;
    border-bottom: none;
}

.selection-panel.collapsed .selection-summary-text {
    display: block !important;
}

.selection-panel.collapsed .selection-collapse-hint {
    display: none !important;
}

.selection-collapse-hint {
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.selection-collapse-hint-btn {
    margin-left: 0.5rem;
    padding: 0.25rem 0.6rem;
    font-size: 0.85rem;
    background: var(--app-primary, #1a365d);
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

.selection-collapse-hint-btn:hover {
    opacity: 0.9;
}

/* ===== Phase 5: Example sentences (Feature 9) ===== */

.example-sentence-wrapper {
    margin-top: 0.75rem;
}

.example-sentence-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: none;
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 20px;
    padding: 0.3rem 0.75rem;
    font-size: 0.82rem;
    color: var(--text-secondary, #6b7280);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.example-sentence-toggle:hover {
    background: var(--card-bg, #f9fafb);
    color: var(--text-primary, #111827);
}

.example-toggle-icon {
    font-size: 0.9rem;
}

.example-toggle-label {
    font-weight: 600;
}

.example-toggle-chevron {
    font-size: 0.7rem;
    line-height: 1;
}

.example-sentence-body {
    margin-top: 0.6rem;
    padding: 0.65rem 0.9rem;
    background: var(--card-bg, #f9fafb);
    border-left: 3px solid #4f46e5;
    border-radius: 0 8px 8px 0;
}

.example-sentence-body[hidden] {
    display: none;
}

.example-sentence-text {
    margin: 0;
    font-size: 0.9rem;
    font-style: italic;
    color: var(--text-primary, #111827);
    line-height: 1.5;
}

.flashcard-example {
    margin: 0.75rem 0 0;
    padding: 0.65rem 0.9rem;
    background: rgba(79, 70, 229, 0.06);
    border-radius: 8px;
    text-align: left;
    width: 100%;
    box-sizing: border-box;
}

.flashcard-example-label {
    display: block;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #4f46e5;
    margin-bottom: 0.3rem;
}

.flashcard-example-text {
    margin: 0;
    font-size: 0.88rem;
    font-style: italic;
    color: var(--text-primary, #111827);
    line-height: 1.5;
}

.quiz-hint-wrapper {
    margin: 0.75rem 0 0;
    text-align: center;
}

.btn-quiz-hint {
    background: none;
    border: 1px dashed var(--border-color, #d1d5db);
    border-radius: 20px;
    padding: 0.3rem 0.85rem;
    font-size: 0.82rem;
    color: var(--text-secondary, #6b7280);
    cursor: pointer;
    transition: border-color 0.15s ease, color 0.15s ease;
}

.btn-quiz-hint:hover {
    border-color: #4f46e5;
    color: #4f46e5;
}

.quiz-hint-body {
    margin-top: 0.6rem;
    padding: 0.65rem 0.9rem;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 8px;
    text-align: left;
}

.quiz-hint-body[hidden] {
    display: none;
}

.quiz-hint-label {
    display: block;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #92400e;
    margin-bottom: 0.3rem;
}

.quiz-hint-sentence {
    margin: 0;
    font-size: 0.9rem;
    font-style: italic;
    color: #78350f;
    line-height: 1.5;
}

/* ===== Phase 5: Personal definitions (Feature 10) ===== */

.personal-def-wrapper {
    margin-top: 1rem;
    border-top: 1px solid var(--border-color, #e5e7eb);
    padding-top: 0.75rem;
}

.personal-def-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: none;
    border: none;
    padding: 0;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary, #6b7280);
    cursor: pointer;
    transition: color 0.15s ease;
}

.personal-def-toggle:hover {
    color: #4f46e5;
}

.personal-def-toggle-icon {
    font-size: 0.9rem;
}

.personal-def-chevron {
    font-size: 0.7rem;
    line-height: 1;
}

.personal-def-body {
    margin-top: 0.65rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.personal-def-body[hidden] {
    display: none;
}

.personal-def-textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--border-color, #d1d5db);
    border-radius: 8px;
    background: var(--card-bg, #ffffff);
    color: var(--text-primary, #111827);
    font-size: 0.9rem;
    font-family: inherit;
    line-height: 1.5;
    resize: vertical;
    transition: border-color 0.15s ease;
}

.personal-def-textarea:focus {
    outline: none;
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.personal-def-saved-at {
    font-size: 0.75rem;
    color: var(--text-secondary, #9ca3af);
}

.personal-def-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.btn-personal-def-save {
    padding: 0.4rem 1rem;
    background: #4f46e5;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s ease;
    flex-shrink: 0;
}

.btn-personal-def-save:hover {
    background: #4338ca;
}

.personal-def-status {
    font-size: 0.82rem;
    font-weight: 600;
    color: #16a34a;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.personal-def-status--visible {
    opacity: 1;
}

.personal-def-comparison {
    margin-top: 0.5rem;
    padding: 0.65rem 0.9rem;
    background: var(--card-bg, #f9fafb);
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 8px;
}

.personal-def-comparison-label {
    display: block;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary, #6b7280);
    margin-bottom: 0.3rem;
}

.personal-def-comparison-text {
    margin: 0;
    font-size: 0.88rem;
    color: var(--text-primary, #111827);
    line-height: 1.5;
}

/* ===== Daily Focus Feature ===== */

.focus-strip {
    background: var(--card-bg);
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 10px;
    padding: 0.65rem 1rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

.focus-chip-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.focus-chip-label {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-secondary, #6b7280);
    text-transform: uppercase;
    letter-spacing: 0.07em;
    white-space: nowrap;
}

.focus-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    flex: 1;
}

.focus-chip {
    background: rgba(0, 48, 135, 0.1);
    color: var(--app-primary);
    border: 1px solid rgba(0, 48, 135, 0.25);
    border-radius: 20px;
    padding: 0.2rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 600;
}

.focus-set-btn {
    background: none;
    border: 1.5px dashed var(--app-secondary, #4A93B7);
    color: var(--app-secondary, #4A93B7);
    border-radius: 20px;
    padding: 0.2rem 0.9rem;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.focus-set-btn:hover { background: rgba(74, 147, 183, 0.1); }

.focus-edit-btn {
    background: none;
    border: none;
    color: var(--text-secondary, #9ca3af);
    font-size: 0.82rem;
    cursor: pointer;
    padding: 0.2rem 0.5rem;
    border-radius: 5px;
    margin-left: auto;
    transition: color 0.15s ease;
    white-space: nowrap;
}

.focus-edit-btn:hover { color: var(--app-primary); }

#focusModal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: flex-end;
    justify-content: center;
}

#focusModal.active { display: flex; }

.focus-modal-sheet {
    background: var(--card-bg);
    border-radius: 20px 20px 0 0;
    width: 100%;
    max-width: 680px;
    max-height: 85vh;
    overflow-y: auto;
    padding: 1.5rem;
    box-shadow: 0 -4px 30px rgba(0,0,0,0.2);
    animation: slideUp 0.2s ease;
}

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

.focus-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
}

.focus-modal-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--app-primary);
}

.focus-modal-close {
    background: none;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    color: var(--text-secondary, #6b7280);
    line-height: 1;
    padding: 0.2rem;
}

.focus-modal-section-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary, #6b7280);
    margin-bottom: 0.6rem;
}

.focus-modal-subject-row {
    display: flex;
    align-items: center;
    padding: 0.65rem 0.9rem;
    border-radius: 8px;
    cursor: pointer;
    border: 1.5px solid var(--border-color, #e5e7eb);
    margin-bottom: 0.45rem;
    transition: all 0.12s ease;
    background: var(--card-bg);
}

.focus-modal-subject-row:hover {
    border-color: var(--app-secondary);
    background: rgba(74, 147, 183, 0.05);
}

.focus-modal-subject-row.selected {
    border-color: var(--app-primary);
    background: rgba(0, 48, 135, 0.07);
}

.focus-modal-subject-name {
    flex: 1;
    font-weight: 600;
    font-size: 0.95rem;
}

.focus-modal-group-count {
    font-size: 0.78rem;
    color: var(--app-secondary);
    font-weight: 600;
    margin-right: 0.5rem;
}

.focus-modal-group-count.muted {
    color: var(--text-secondary, #9ca3af);
    font-weight: 400;
}

.focus-modal-tick {
    color: var(--app-primary);
    font-weight: 700;
    font-size: 1rem;
}

.focus-modal-divider {
    border: none;
    border-top: 1px solid var(--border-color, #e5e7eb);
    margin: 1.1rem 0;
}

.focus-modal-group-section { margin-bottom: 1rem; }

.focus-modal-group-heading {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-secondary, #6b7280);
    text-transform: uppercase;
    letter-spacing: 0.07em;
    margin-bottom: 0.5rem;
}

.focus-modal-group-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.focus-group-chip {
    background: var(--card-bg);
    border: 1.5px solid var(--border-color, #d1d5db);
    color: var(--text-color);
    border-radius: 20px;
    padding: 0.3rem 0.85rem;
    font-size: 0.82rem;
    cursor: pointer;
    transition: all 0.12s ease;
    font-family: inherit;
}

.focus-group-chip:hover {
    border-color: var(--app-secondary);
    background: rgba(74, 147, 183, 0.08);
}

.focus-group-chip.selected {
    background: var(--app-primary);
    border-color: var(--app-primary);
    color: white;
}

.focus-modal-hint {
    font-size: 0.88rem;
    color: var(--text-secondary, #9ca3af);
    font-style: italic;
    margin: 0;
}

.focus-modal-footer {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.focus-save-btn {
    flex: 1;
    background: var(--app-primary);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 0.85rem;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s ease;
}

.focus-save-btn:hover { background: var(--app-dark, #003087); }

.focus-clear-btn {
    background: none;
    border: 1.5px solid var(--border-color, #d1d5db);
    color: var(--text-secondary, #6b7280);
    border-radius: 10px;
    padding: 0.85rem 1.2rem;
    font-size: 0.9rem;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s ease;
}

.focus-clear-btn:hover { border-color: #e74c3c; color: #e74c3c; }

body.dark-mode .focus-strip { background: var(--card-bg); border-color: var(--border-color); }
body.dark-mode .focus-chip { background: rgba(74, 147, 183, 0.15); border-color: rgba(74, 147, 183, 0.3); }
body.dark-mode .focus-modal-sheet { background: var(--card-bg); }
body.dark-mode .focus-modal-subject-row { background: var(--card-bg); border-color: var(--border-color); }
body.dark-mode .focus-modal-subject-row.selected { background: rgba(74, 147, 183, 0.15); }
body.dark-mode .focus-group-chip { background: var(--card-bg); border-color: var(--border-color); }
body.dark-mode .focus-group-chip.selected { background: var(--app-secondary); border-color: var(--app-secondary); }

/* ===== Session Configurator ===== */

.session-subject-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.session-subject-chip {
    padding: 0.5rem 1.2rem;
    border: 2px solid var(--app-secondary);
    background: var(--card-bg);
    color: var(--text-color);
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
}

.session-subject-chip:hover {
    background: var(--app-light-accent);
    border-color: var(--app-primary);
}

.session-subject-chip.selected {
    background: var(--app-primary);
    color: white;
    border-color: var(--app-primary);
}

.session-group-section {
    margin-bottom: 1rem;
}

.session-group-heading {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-secondary, #6b7280);
    text-transform: uppercase;
    letter-spacing: 0.07em;
    margin-bottom: 0.5rem;
}

.session-group-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.session-status-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
    font-size: 0.85rem;
}

.session-status-label {
    color: var(--text-secondary, #6b7280);
    font-weight: 600;
}

.session-reset-btn {
    background: none;
    border: none;
    color: var(--app-secondary);
    cursor: pointer;
    font-size: 0.85rem;
    text-decoration: underline;
    font-family: inherit;
    padding: 0;
}

.session-reset-btn:hover {
    color: var(--app-primary);
}

/* ===== Study Mode Tabs ===== */

.study-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    border-bottom: 2px solid var(--border-color, #e5e7eb);
    padding-bottom: 0;
}

.study-tab {
    padding: 0.6rem 1.2rem;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--text-secondary, #6b7280);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    margin-bottom: -2px;
}

.study-tab:hover {
    color: var(--app-primary);
}

.study-tab.active {
    color: var(--app-primary);
    border-bottom-color: var(--app-primary);
}

.study-tab-count {
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--text-secondary, #9ca3af);
    margin-left: 0.3rem;
}

.study-tab.active .study-tab-count {
    color: var(--app-secondary);
}

body.dark-mode .session-subject-chip {
    background: var(--card-bg);
    border-color: var(--border-color);
}

body.dark-mode .session-subject-chip.selected {
    background: var(--app-secondary);
    border-color: var(--app-secondary);
}

body.dark-mode .study-tab {
    color: var(--text-color);
}

body.dark-mode .study-tab.active {
    color: var(--app-secondary);
    border-bottom-color: var(--app-secondary);
}

.study-tab-unseen {
    display: inline-block;
    margin-left: 0.4rem;
    padding: 0.05rem 0.45rem;
    font-size: 0.7rem;
    font-weight: 700;
    border-radius: 999px;
    background: rgba(240, 165, 0, 0.15);
    color: #b07800;
    vertical-align: middle;
    white-space: nowrap;
}

.study-tab.active .study-tab-unseen {
    background: rgba(255, 184, 0, 0.15);
    color: #b07800;
}

body.dark-mode .study-tab-unseen {
    background: rgba(255, 184, 0, 0.15);
    color: var(--app-accent);
}

/* ===== Study Group Sections (Phase B) ===== */

.study-group-section {
    margin-bottom: 1.5rem;
}

.study-group-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0.8rem;
    background: var(--app-light-accent, #eaf4fb);
    border-radius: 8px;
    cursor: pointer;
    margin-bottom: 0.75rem;
    transition: background 0.15s ease;
    user-select: none;
}

.study-group-header:hover {
    background: rgba(0, 48, 135, 0.12);
}

.study-group-chevron {
    font-size: 0.85rem;
    color: var(--app-primary);
    width: 1rem;
    text-align: center;
    flex-shrink: 0;
}

.study-group-name {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--app-primary);
}

.study-group-count {
    font-size: 0.82rem;
    color: var(--text-secondary, #6b7280);
    font-weight: 400;
}

.study-group-cards {
    transition: max-height 0.3s ease, opacity 0.2s ease;
    overflow: hidden;
}

.study-group-cards.collapsed {
    max-height: 0;
    opacity: 0;
    margin: 0;
    overflow: hidden;
}

/* Show More Button */
.study-show-more-btn {
    display: block;
    width: 100%;
    padding: 0.75rem;
    margin-top: 0.75rem;
    background: var(--card-bg);
    border: 2px dashed var(--border-color, #d1d5db);
    border-radius: 8px;
    color: var(--app-secondary);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.study-show-more-btn:hover {
    border-color: var(--app-primary);
    color: var(--app-primary);
    background: var(--app-light-accent, #eaf4fb);
}

/* ===== Flashcard & Quiz Badges ===== */

.flashcard-badge,
.quiz-subject-badge {
    display: inline-block;
    background: rgba(0, 48, 135, 0.1);
    color: var(--app-primary);
    border: 1px solid rgba(0, 48, 135, 0.2);
    border-radius: 20px;
    padding: 0.15rem 0.7rem;
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.quiz-subject-badge {
    margin-bottom: 1rem;
}

/* Dark mode */
body.dark-mode .study-group-header {
    background: rgba(74, 147, 183, 0.1);
}

body.dark-mode .study-group-header:hover {
    background: rgba(74, 147, 183, 0.18);
}

body.dark-mode .study-show-more-btn {
    background: var(--card-bg);
    border-color: var(--border-color);
}

body.dark-mode .flashcard-badge,
body.dark-mode .quiz-subject-badge {
    background: rgba(74, 147, 183, 0.15);
    border-color: rgba(74, 147, 183, 0.3);
    color: var(--app-secondary);
}

/* ===== Phase C: Session Insights ===== */

.session-insights {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    padding: 0.65rem 1rem;
    background: linear-gradient(135deg, rgba(0, 48, 135, 0.06), rgba(74, 147, 183, 0.06));
    border: 1px solid rgba(0, 48, 135, 0.12);
    border-radius: 10px;
    margin-bottom: 1rem;
    font-size: 0.88rem;
    color: var(--text-color);
    line-height: 1.5;
}

.session-insight-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
}

.session-insights-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.session-insight-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.65rem;
    border-radius: 8px;
    background: rgba(0, 48, 135, 0.08);
    border: 1px solid rgba(0, 48, 135, 0.15);
    font-size: 0.85rem;
    white-space: nowrap;
    color: var(--text-color);
}

/* ===== Quick Study Presets ===== */

.quick-study-presets {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.quick-preset-btn {
    padding: 0.4rem 0.9rem;
    border: 1.5px solid var(--border-color, #d1d5db);
    background: var(--card-bg);
    color: var(--text-color);
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.quick-preset-btn:hover {
    border-color: var(--app-secondary);
    background: rgba(74, 147, 183, 0.06);
}

.quick-preset-btn.active {
    background: var(--app-primary);
    border-color: var(--app-primary);
    color: white;
}

.quick-preset-clear {
    border-style: dashed;
    color: var(--text-secondary, #9ca3af);
}

.quick-preset-clear:hover {
    border-color: #e74c3c;
    color: #e74c3c;
}

/* ===== Combined Search + Selection Bar (Phase 5) ===== */

.search-selection-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.search-bar--inline {
    flex: 1;
    min-width: 0; /* Prevents flex overflow */
}

.selection-count-compact {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    white-space: nowrap;
    flex-shrink: 0;
}

.selection-count-hint {
    font-size: 0.82rem;
    color: var(--text-secondary, #9ca3af);
}

.selection-count-number {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--app-primary);
}

.selection-use-btn {
    padding: 0.4rem 0.85rem;
    background: var(--app-primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s ease;
    white-space: nowrap;
}

.selection-use-btn:hover {
    background: var(--app-secondary);
}

/* Inline presets inside study mode */
.quick-study-presets--inline {
    margin-bottom: 0.85rem;
}

/* Dark mode */
body.dark-mode .selection-use-btn {
    background: var(--app-secondary);
}

body.dark-mode .selection-use-btn:hover {
    background: var(--app-primary);
}

@media (max-width: 600px) {
    .search-selection-bar {
        flex-direction: column;
        align-items: stretch;
    }
    .selection-count-compact {
        justify-content: flex-end;
    }
}

/* ===== Per-Tab Progress Bars ===== */

.study-tab {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: 0.5rem 1.2rem 0.4rem;
    min-width: 100px;
}

.study-tab-label {
    font-size: 0.95rem;
    font-weight: 600;
    text-align: center;
    margin-bottom: 0.3rem;
}

.study-tab-progress {
    display: flex;
    height: 3px;
    border-radius: 3px;
    background: var(--border-color, #e5e7eb);
    overflow: hidden;
}

.study-tab-bar {
    height: 100%;
    transition: width 0.3s ease;
}

.study-tab-bar--mastered {
    background: #28a745;
}

.study-tab-bar--reviewing {
    background: #4A93B7;
}

.study-tab-bar--learning {
    background: var(--app-accent);
}

/* ===== Group Mastery Badges ===== */

.study-group-header-spacer {
    flex: 1;
}

.study-group-mastery {
    display: flex;
    gap: 0.4rem;
    align-items: center;
    flex-shrink: 0;
}

.gm-dot {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.1rem 0.4rem;
    border-radius: 10px;
    line-height: 1;
}

.gm-mastered {
    background: rgba(40, 167, 69, 0.15);
    color: #28a745;
}

.gm-reviewing {
    background: rgba(74, 147, 183, 0.15);
    color: #4A93B7;
}

.gm-learning {
    background: rgba(240, 165, 0, 0.15);
    color: #c88a00;
}

.gm-unseen {
    background: rgba(156, 163, 175, 0.15);
    color: #9ca3af;
}

/* Phase C dark mode */
body.dark-mode .session-insights {
    background: rgba(74, 147, 183, 0.08);
    border-color: rgba(74, 147, 183, 0.2);
}

body.dark-mode .session-insight-chip {
    background: rgba(74, 147, 183, 0.12);
    border-color: rgba(74, 147, 183, 0.25);
}

body.dark-mode .quick-preset-btn {
    background: var(--card-bg);
    border-color: var(--border-color);
}

body.dark-mode .quick-preset-btn.active {
    background: var(--app-secondary);
    border-color: var(--app-secondary);
}

body.dark-mode .study-tab-progress {
    background: var(--border-color);
}

/* ===== Phase D: Search Results, Study Group Action, Session Continuity ===== */

.search-result-count {
    font-size: 0.88rem;
    color: var(--text-secondary, #6b7280);
    margin: 0 0 1rem;
    font-weight: 600;
}

.study-group-action-btn {
    background: none;
    border: 1px solid var(--app-secondary);
    color: var(--app-secondary);
    padding: 0.2rem 0.6rem;
    border-radius: 5px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
    white-space: nowrap;
    margin-left: 0.5rem;
    flex-shrink: 0;
}

.study-group-action-btn:hover {
    background: var(--app-secondary);
    color: white;
}

@media (hover: none) {
    .study-group-action-btn {
        opacity: 1;
    }
}

.group-study-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.6rem 1rem;
    background: rgba(79, 70, 229, 0.08);
    border: 1px solid rgba(79, 70, 229, 0.2);
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.88rem;
    color: var(--text-color);
}

.group-study-back-btn {
    background: none;
    border: 1px solid var(--app-secondary);
    color: var(--app-secondary);
    padding: 0.3rem 0.8rem;
    border-radius: 5px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
    transition: all 0.15s ease;
}

.group-study-back-btn:hover {
    background: var(--app-secondary);
    color: white;
}

.session-continuity-banner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1rem;
    background: rgba(0, 48, 135, 0.06);
    border: 1px solid rgba(0, 48, 135, 0.12);
    border-radius: 10px;
    margin-bottom: 1rem;
    font-size: 0.85rem;
    color: var(--text-color);
    transition: opacity 0.3s ease;
}

.session-continuity-banner > span {
    flex: 1;
}

.session-continuity-change-btn {
    background: none;
    border: none;
    color: var(--app-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
    font-family: inherit;
    padding: 0;
    white-space: nowrap;
}

.session-continuity-change-btn:hover {
    color: var(--app-primary);
}

.session-continuity-dismiss-btn {
    background: none;
    border: none;
    color: var(--text-secondary, #9ca3af);
    font-size: 1rem;
    cursor: pointer;
    padding: 0 0.2rem;
    line-height: 1;
}

.session-continuity-dismiss-btn:hover {
    color: var(--text-color);
}

body.dark-mode .group-study-banner {
    background: rgba(79, 70, 229, 0.12);
    border-color: rgba(79, 70, 229, 0.25);
}

body.dark-mode .session-continuity-banner {
    background: rgba(74, 147, 183, 0.08);
    border-color: rgba(74, 147, 183, 0.2);
}

body.dark-mode .study-group-action-btn {
    border-color: var(--app-secondary);
    color: var(--app-secondary);
}

/* ===== Quick Practice Tab ===== */

.quick-practice-panel {
    max-width: 700px;
    margin: 0 auto;
    padding: 2rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
    align-items: stretch;
}

.qp-count-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary, #6b7280);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.6rem;
    display: block;
}

.qp-count-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.qp-count-pill {
    padding: 0.45rem 1.1rem;
    border: 2px solid var(--border-color, #d1d5db);
    background: var(--card-bg);
    color: var(--text-color);
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
}

.qp-count-pill:hover {
    border-color: var(--app-secondary);
    color: var(--app-secondary);
}

.qp-count-pill.active {
    background: var(--app-primary);
    border-color: var(--app-primary);
    color: #fff;
}

.qp-launch-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: stretch;
}

.qp-launch-btn {
    flex: 1;
    min-width: 140px;
    min-height: 180px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    padding: 1.5rem 1rem;
    border: none;
    border-radius: 14px;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
    font-family: inherit;
    text-align: center;
}

.qp-launch-btn:hover:not(.qp-launch-btn--disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);
}

.qp-launch-btn--flashcard {
    background: var(--app-primary, #003087);
    color: #fff;
}

.qp-launch-btn--quiz {
    background: #4f46e5;
    color: #fff;
}

.qp-launch-btn--due {
    background: #0d9488;
    color: #fff;
}

.qp-launch-btn--disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.qp-launch-icon {
    font-size: 2rem;
    line-height: 1;
}

.qp-launch-label {
    font-size: 1.1rem;
    font-weight: 700;
}

.qp-launch-sub {
    font-size: 0.78rem;
    opacity: 0.85;
}

.qp-context-line {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-secondary, #6b7280);
    margin: 0;
}

/* Dark mode */
body.dark-mode .qp-count-pill {
    background: var(--card-bg);
    border-color: var(--border-color);
}

body.dark-mode .qp-count-pill.active {
    background: var(--app-secondary);
    border-color: var(--app-secondary);
}

@media (max-width: 600px) {
    .qp-launch-row {
        flex-direction: column;
    }
    .qp-launch-btn {
        flex-direction: row;
        justify-content: flex-start;
        padding: 1rem 1.25rem;
        gap: 1rem;
        min-width: unset;
    }
    .qp-launch-icon { font-size: 1.5rem; }
    .qp-launch-label { font-size: 1rem; }
}

/* Quick Practice — quiz options row (below cards, above context line) */

.qp-quiz-options {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 0.5rem 0.25rem;
    font-size: 0.82rem;
}

.qp-quiz-mode-pills {
    display: flex;
    gap: 0.4rem;
}

.qp-quiz-mode-pill {
    padding: 0.25rem 0.5rem;
    border: 1.5px solid var(--border-color, #d1d5db);
    background: var(--card-bg);
    color: var(--text-secondary, #6b7280);
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
    text-align: center;
    white-space: nowrap;
}

.qp-quiz-mode-pill:hover {
    border-color: #4f46e5;
    color: #4f46e5;
}

.qp-quiz-mode-pill.active {
    background: #eef2ff;
    border-color: #4f46e5;
    color: #4f46e5;
}

.qp-reverse-label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.82rem;
    color: var(--text-secondary, #6b7280);
    cursor: pointer;
    user-select: none;
}

.qp-reverse-label input[type="checkbox"] {
    width: 14px;
    height: 14px;
    cursor: pointer;
    flex-shrink: 0;
}

/* Dark mode */
body.dark-mode .qp-quiz-mode-pill {
    background: var(--card-bg);
    border-color: var(--border-color);
    color: var(--text-color);
}

body.dark-mode .qp-quiz-mode-pill.active {
    background: rgba(79, 70, 229, 0.2);
    border-color: #818cf8;
    color: #818cf8;
}