/* ==================== STATS LAYOUT ==================== */
.stats-layout {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Stats Card Title */
.stats-card-title {
    margin: 0 0 14px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* 1. Top Row: Streak + Goal */
.stats-top-row {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 12px;
}

.stats-streak-widget {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 24px !important;
    background: var(--gradient-warm) !important;
    color: white;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.stats-streak-widget::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.15) 0%, transparent 60%);
    animation: shimmer 4s infinite;
}

@keyframes shimmer {
    0%, 100% { transform: translate(-10%, -10%) rotate(0deg); }
    50% { transform: translate(10%, 10%) rotate(180deg); }
}

.stats-streak-fire {
    font-size: 1.5rem;
    position: relative;
    z-index: 1;
}

.stats-streak-number {
    font-size: 2.2rem;
    font-weight: 800;
    line-height: 1;
    position: relative;
    z-index: 1;
}

.stats-streak-label {
    font-size: 0.75rem;
    opacity: 0.9;
    position: relative;
    z-index: 1;
}

.stats-goal-widget {
    padding: 16px 20px !important;
}

.stats-goal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.stats-goal-visual {
    display: flex;
    justify-content: center;
    align-items: center;
}

.stats-goal-ring {
    position: relative;
    width: 80px;
    height: 80px;
}

.stats-goal-ring svg {
    width: 100%;
    height: 100%;
}

.stats-goal-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    line-height: 1.1;
}

.stats-goal-number {
    display: block;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stats-goal-divider {
    display: block;
    font-size: 0.7rem;
    color: var(--text-secondary);
}

/* 2. Summary Cards */
.stats-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.stats-summary-card {
    text-align: center;
    padding: 16px 8px !important;
    border-top: 3px solid transparent;
    transition: transform 0.2s;
}

.stats-summary-card:hover {
    transform: translateY(-2px);
}

.stats-summary-total { border-top-color: var(--accent); }
.stats-summary-correct { border-top-color: var(--success); }
.stats-summary-wrong { border-top-color: var(--error); }
.stats-summary-rate { border-top-color: var(--warning); }

.stats-summary-value {
    display: block;
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
}

.stats-summary-total .stats-summary-value { color: var(--accent); }
.stats-summary-correct .stats-summary-value { color: var(--success); }
.stats-summary-wrong .stats-summary-value { color: var(--error); }
.stats-summary-rate .stats-summary-value { color: var(--warning); }

.stats-summary-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* 3. Weekly Chart */
.stats-weekly-chart {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    height: 100px;
    gap: 8px;
    margin-bottom: 8px;
    padding-top: 20px;
}

.stats-chart-bar {
    flex: 1;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    height: 100%;
}

.stats-bar-fill {
    background: linear-gradient(to top, var(--accent), var(--accent-hover));
    border-radius: 4px 4px 0 0;
    transition: height 0.4s ease;
    min-height: 4px;
}

.stats-chart-bar.today .stats-bar-fill {
    background: linear-gradient(to top, var(--success), #66bb6a);
}

.stats-chart-bar.empty .stats-bar-fill {
    background: var(--border);
    opacity: 0.4;
}

.stats-bar-value {
    position: absolute;
    top: -18px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stats-weekly-labels {
    display: flex;
    justify-content: space-between;
    color: var(--text-secondary);
    font-size: 0.75rem;
}

.stats-weekly-labels span {
    flex: 1;
    text-align: center;
}

/* 4. Category Stats */
.stats-category-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.stats-cat-item {
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.stats-cat-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.stats-cat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.stats-cat-name {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
}

.stats-cat-pct {
    font-size: 0.85rem;
    font-weight: 700;
}

.stats-cat-pct.high { color: var(--success); }
.stats-cat-pct.mid { color: var(--warning); }
.stats-cat-pct.low { color: var(--error); }

.stats-cat-bar {
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
}

.stats-cat-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.4s ease;
}

.stats-cat-fill.high {
    background: linear-gradient(90deg, var(--success), #66bb6a);
}

.stats-cat-fill.mid {
    background: linear-gradient(90deg, var(--warning), #ffb74d);
}

.stats-cat-fill.low {
    background: linear-gradient(90deg, var(--error), #ef5350);
}

.stats-cat-detail {
    font-size: 0.72rem;
    color: var(--text-secondary);
    margin-top: 3px;
}

/* 5. Danger Zone */
.stats-danger-zone {
    display: flex;
    gap: 10px;
    justify-content: center;
    padding: 8px 0;
}

.btn-outline-danger {
    background: transparent;
    color: var(--error);
    border: 1px solid var(--error);
    opacity: 0.7;
    transition: all 0.2s;
}

.btn-outline-danger:hover {
    background: var(--error);
    color: white;
    opacity: 1;
}

.btn-outline-secondary {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    opacity: 0.7;
    transition: all 0.2s;
}

.btn-outline-secondary:hover {
    background: var(--option-bg);
    color: var(--text-primary);
    opacity: 1;
}

/* Mobile responsive */
@media (max-width: 500px) {
    .stats-top-row {
        grid-template-columns: 1fr 1fr;
    }
    
    .stats-summary-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Goal setting modal (kept for reuse) */
.goal-setting {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.goal-setting input {
    padding: 12px;
    font-size: 1.2rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--option-bg);
    color: var(--text-primary);
    text-align: center;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Exam Simulation Styles */
.exam-description {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.exam-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.exam-option-card {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    padding: 24px 20px;
    border-radius: var(--radius);
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 10px;
    border: 1px solid var(--glass-border);
    transition: all 0.3s ease;
}

@media (hover: hover) {
    .exam-option-card:hover {
        transform: translateY(-4px);
        box-shadow: var(--shadow-glow);
        border-color: var(--accent);
    }
}

.exam-option-icon {
    font-size: 2rem;
}

.exam-option-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.exam-option-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.exam-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 8px;
}

.exam-timer {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.3rem;
    font-weight: 700;
    padding: 8px 16px;
    background: var(--option-bg);
    border-radius: var(--radius-sm);
}

.exam-timer.warning {
    background: var(--warning);
    color: #1a1a2e;
}

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

.exam-progress-info {
    font-size: 1.1rem;
    font-weight: 600;
}

.question-nav-grid {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 6px;
    margin-bottom: 24px;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
}

.q-nav-btn {
    width: 100%;
    aspect-ratio: 1;
    border: 2px solid var(--border);
    background: var(--option-bg);
    color: var(--text-primary);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s;
}

.q-nav-btn:hover {
    border-color: var(--accent);
}

.q-nav-btn.current {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.q-nav-btn.answered {
    background: var(--success);
    border-color: var(--success);
    color: white;
}

.q-nav-btn.flagged {
    border-color: var(--warning);
    box-shadow: 0 0 0 2px var(--warning);
}

.exam-nav-buttons {
    display: flex;
    justify-content: space-between;
    margin-top: 24px;
}

.exam-results-summary {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 48px;
    margin: 32px 0;
}

.exam-result-big {
    text-align: center;
}

.exam-score {
    font-size: 4rem;
    font-weight: 800;
    color: var(--accent);
}

.exam-score-label {
    font-size: 1.5rem;
    color: var(--text-secondary);
}

.exam-result-percentage {
    text-align: center;
}

.exam-result-percentage span:first-child {
    display: block;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--success);
}

.exam-result-percentage .label {
    color: var(--text-secondary);
}

.exam-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 32px;
}

.exam-stat {
    background: var(--option-bg);
    padding: 16px;
    border-radius: var(--radius-sm);
    text-align: center;
}

.exam-stat .value {
    display: block;
    font-size: 1.8rem;
    font-weight: 700;
}

.exam-stat .value.correct {
    color: var(--success);
}

.exam-stat .value.wrong {
    color: var(--error);
}

.exam-stat .label {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.category-results {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 24px;
}

.category-result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--option-bg);
    border-radius: var(--radius-sm);
}

.category-result-item .name {
    font-weight: 500;
}

.category-result-item .score {
    font-weight: 600;
}

.exam-result-actions {
    display: flex;
    justify-content: center;
    gap: 16px;
}

@media (max-width: 600px) {
    .exam-options {
        grid-template-columns: 1fr;
    }
    
    .question-nav-grid {
        grid-template-columns: repeat(5, 1fr);
    }
    
    .exam-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Mobile Touch Improvements */
@media (max-width: 768px) {
    /* Larger touch targets */
    .option {
        padding: 16px 18px;
        min-height: 56px;
    }
    
    .option:active:not(.disabled) {
        transform: scale(0.98);
        transition-duration: 0.1s;
    }
    
    .option-select-btn {
        width: 44px;
        height: 44px;
        font-size: 1.2rem;
    }
    
    .btn {
        padding: 14px 24px;
        font-size: 1rem;
        min-height: 48px;
    }
    
    .btn:active:not(:disabled) {
        transform: scale(0.96);
        transition-duration: 0.1s;
    }
    
    .btn-small {
        padding: 10px 16px;
        font-size: 0.95rem;
        min-height: 44px;
    }
    
    /* Tabs: horizontal scroll instead of wrap */
    .tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
        gap: 6px;
        padding: 8px;
        scroll-snap-type: x mandatory;
    }
    
    .tabs::-webkit-scrollbar {
        display: none;
    }
    
    .tab {
        padding: 12px 16px;
        min-height: 44px;
        white-space: nowrap;
        flex-shrink: 0;
        scroll-snap-align: start;
        font-size: 0.85rem;
    }
    
    /* Swipe hint */
    .swipe-hint {
        text-align: center;
        color: var(--text-secondary);
        font-size: 0.85rem;
        margin-top: 16px;
        opacity: 0.7;
    }
    
    /* Question container: allow both scroll and swipe */
    .question-container {
        touch-action: manipulation;
    }
    
    /* Flashcard touch improvements */
    .flashcard {
        height: 260px;
    }
    
    .flashcard-word {
        font-size: 1.8rem;
    }
    
    .flashcard-actions {
        flex-direction: column;
        gap: 12px;
    }
    
    .flashcard-actions .btn {
        width: 100%;
    }
    
    /* ===== QUIZ-ACTIVE: HIDE HEADER & TABS TO MAXIMIZE QUIZ AREA ===== */
    body.quiz-active .header {
        display: none !important;
    }
    
    body.quiz-active .tabs {
        display: none !important;
    }
    
    /* ===== VIEWPORT-FIT QUIZ LAYOUT FOR MOBILE ===== */
    /* Uses --vh from JS for real viewport height on mobile browsers */
    
    /* Quiz card: flex column, fill viewport minus container padding only */
    #quiz-area.card,
    #exam-area.card,
    #challenge-game.card {
        display: flex;
        flex-direction: column;
        /* Header & tabs hidden when quiz-active, so only subtract container padding */
        max-height: calc(var(--app-height, 100vh) - 20px);
        padding: 10px 10px 0;
        overflow: hidden;
        position: relative;
    }
    
    /* Quiz header compact */
    .quiz-header {
        flex-wrap: wrap;
        gap: 4px;
        padding: 8px 10px;
        margin-bottom: 6px;
        flex-shrink: 0;
    }
    
    .quiz-progress {
        font-size: 0.82rem;
        padding: 3px 8px;
    }
    
    .quiz-score {
        gap: 6px;
    }
    
    .quiz-score .correct,
    .quiz-score .wrong {
        padding: 3px 6px;
        font-size: 0.78rem;
    }
    
    .timer-display {
        order: -1;
        width: 100%;
        justify-content: center;
        font-size: 0.95rem;
        padding: 3px 8px;
    }
    
    /* Progress bar compact */
    .progress-bar {
        height: 4px;
        margin-bottom: 6px;
        flex-shrink: 0;
    }
    
    /* Question container: scrollable area */
    .question-container {
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        margin-bottom: 0;
        min-height: 0;
    }
    
    .question-text {
        font-size: 0.92rem;
        padding: 10px 12px;
        line-height: 1.65;
        margin-bottom: 6px;
    }
    
    .question-text::before {
        display: none;
    }
    
    .question-header {
        gap: 6px;
    }
    
    .favorite-btn {
        width: 34px;
        height: 34px;
        font-size: 1.1rem;
    }
    
    /* Options compact */
    .options-container {
        gap: 6px;
        margin-top: 6px;
    }
    
    .option {
        padding: 10px 12px;
        min-height: 40px;
        gap: 8px;
    }
    
    .option-select-btn {
        width: 32px;
        height: 32px;
        font-size: 0.95rem;
    }
    
    .option .text {
        font-size: 0.88rem;
        padding-top: 2px;
    }
    
    /* Feedback compact — inside scrollable question-container */
    .feedback {
        padding: 10px 12px;
        margin-top: 8px;
        margin-bottom: 4px;
    }
    
    .feedback.correct p,
    .feedback.wrong p {
        font-size: 0.9rem;
    }
    
    .feedback .gpt-explain-inline-btn {
        padding: 8px 12px;
        font-size: 0.82rem;
        margin-top: 6px;
    }
    
    /* Hint area compact */
    .hint-area {
        margin-bottom: 4px;
    }
    
    .btn-hint {
        padding: 5px 10px;
        font-size: 0.82rem;
    }
    
    .hint-content {
        padding: 8px;
        font-size: 0.82rem;
    }
    
    /* Quiz actions - fixed at card bottom, never scrolls away */
    .quiz-actions {
        flex-shrink: 0;
        background: var(--bg-primary);
        padding: 8px 0;
        margin: 0 -10px;
        padding: 8px 10px;
        border-top: 1px solid var(--border);
    }
    
    .quiz-actions .btn {
        flex: 1;
        padding: 10px 14px;
        font-size: 0.9rem;
        min-height: 42px;
    }
    
    /* Exam nav buttons - same fixed bottom pattern */
    .exam-nav-buttons {
        flex-shrink: 0;
        background: var(--bg-primary);
        padding: 8px 10px;
        margin: 0 -10px;
        border-top: 1px solid var(--border);
    }
    
    .exam-nav-buttons .btn {
        padding: 10px 14px;
        font-size: 0.9rem;
    }
    
    /* DB Explanation compact */
    .db-explanation {
        padding: 8px;
        margin-top: 6px;
    }
    
    .db-explanation p {
        font-size: 0.82rem;
        margin: 3px 0;
    }
    
    /* Exam question container also scrollable */
    #examQuestionContainer {
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        min-height: 0;
    }
    
    /* Larger category buttons */
    .category-btn {
        padding: 16px 14px;
        font-size: 0.95rem;
    }
    
    .category-btn:active {
        transform: scale(0.96);
        transition-duration: 0.1s;
    }
    
    /* Fix header on mobile */
    .header {
        flex-direction: column;
        gap: 12px;
        text-align: center;
        padding: 16px 18px;
    }
    
    .header h1 {
        font-size: 1.4rem;
    }
    
    .header-actions {
        width: 100%;
        justify-content: center;
    }
    
    /* Improve question readability */
    .question-text {
        font-size: 1.1rem;
        padding: 18px;
        line-height: 1.8;
    }
    
    .question-text::before {
        font-size: 2rem;
        top: 8px;
        left: 14px;
    }
    
    .option .text {
        font-size: 1rem;
        padding-top: 6px;
    }
    
    /* Card padding reduction */
    .card {
        padding: 20px 16px;
        border-radius: var(--radius);
    }
    
    /* Results summary */
    .results-summary {
        gap: 16px;
    }
    
    .result-stat {
        min-width: 90px;
        padding: 18px 14px;
    }
    
    .result-number {
        font-size: 2.2rem;
    }
    
    /* Auth screen */
    .auth-container {
        padding: 28px 20px;
    }
    
    .auth-header h1 {
        font-size: 1.6rem;
    }
    
    /* Filter controls */
    .filter-controls {
        flex-wrap: wrap;
        width: 100%;
    }
    
    .filter-controls select,
    .filter-controls input {
        flex: 1;
        min-width: 0;
    }
    
    /* Section header */
    .section-header {
        gap: 12px;
    }
    
    .section-header h2 {
        font-size: 1.2rem;
    }
    
    /* Exam header */
    .exam-header {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .exam-timer {
        font-size: 1.1rem;
        padding: 6px 12px;
    }
    
    .exam-progress-info {
        font-size: 0.95rem;
    }
    
    /* Exam results */
    .exam-results-summary {
        flex-direction: column;
        gap: 20px;
    }
    
    .exam-score {
        font-size: 3rem;
    }
    
    /* GPT toggle safe area */
    .gpt-panel-toggle {
        bottom: calc(24px + env(safe-area-inset-bottom));
    }
    
    /* Streak/Goal */
    .streak-card {
        padding: 20px;
    }
    
    .streak-value {
        font-size: 2.2rem;
    }
    
    .goal-card {
        padding: 20px;
    }
    
    /* Stats grid */
    .stat-card {
        padding: 18px 14px;
    }
    
    .stat-value {
        font-size: 1.8rem;
    }
    
    /* hover effects handled by @media (hover: hover) globally */
    
    /* Challenge mode */
    .challenge-mode-selector {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Flashcard Styles */
.flashcard-area {
    text-align: center;
}

.flashcard-progress {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    font-size: 1.1rem;
}

.flashcard-score {
    color: var(--text-secondary);
}

.flashcard-container {
    perspective: 1000px;
    margin-bottom: 24px;
}

.flashcard {
    width: 100%;
    max-width: 400px;
    height: 250px;
    margin: 0 auto;
    cursor: pointer;
    position: relative;
}

.flashcard-inner {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.flashcard.flipped .flashcard-inner {
    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: 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    gap: 16px;
}

.flashcard-front {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 15px 40px var(--accent-glow);
}

.flashcard-back {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 2px solid var(--glass-border);
    transform: rotateY(180deg);
    box-shadow: var(--shadow);
}

.flashcard-word {
    font-size: 2.5rem;
    font-weight: 700;
    text-transform: capitalize;
}

.flashcard-hint {
    font-size: 0.9rem;
    opacity: 0.8;
}

.flashcard-turkish {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 8px;
    min-height: 1.5em;
}

.flashcard-meaning {
    font-size: 1.1rem;
    line-height: 1.6;
    color: var(--text-secondary);
}

.flashcard-actions {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-bottom: 16px;
}

.flashcard-nav {
    display: flex;
    justify-content: center;
    gap: 12px;
}

.btn-success {
    background: var(--gradient-success);
    color: white;
    box-shadow: 0 4px 15px var(--success-glow);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--success-glow);
}

.btn-success.ready-active {
    animation: readyPulse 2s ease-in-out infinite;
}

@keyframes readyPulse {
    0%, 100% { box-shadow: 0 4px 15px var(--success-glow); }
    50% { box-shadow: 0 4px 25px var(--success-glow), 0 0 0 4px rgba(0, 206, 201, 0.2); }
}

.flashcard-complete {
    text-align: center;
    padding: 40px;
}

.flashcard-complete h3 {
    font-size: 1.8rem;
    margin-bottom: 12px;
}

.flashcard-summary {
    display: flex;
    justify-content: center;
    gap: 32px;
    margin: 24px 0;
    font-size: 1.2rem;
}

.flashcard-summary .known {
    color: var(--success);
}

.flashcard-summary .unknown {
    color: var(--error);
}

/* Dictionary Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    border: none;
    background: transparent;
    margin: 0;
    padding: 20px;
    max-width: none;
    max-height: none;
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.modal-overlay:not([open]) {
    display: none;
}

.modal-overlay[open] {
    display: flex;
}

.modal-overlay::backdrop {
    background: rgba(0, 0, 0, 0.7);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
}

.modal {
    background: var(--glass-bg);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border-radius: var(--radius-lg);
    padding: 28px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow), var(--shadow-glow);
}

.modal-overlay[open] .modal {
    transform: scale(1);
}

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

.modal-header h3 {
    margin: 0;
}

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

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

.dictionary-results {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.dictionary-item {
    padding: 12px;
    background: var(--option-bg);
    border-radius: var(--radius-sm);
}

.dictionary-item .type {
    font-size: 0.8rem;
    color: var(--accent);
    text-transform: uppercase;
    margin-bottom: 4px;
}

.dictionary-item .meaning {
    color: var(--text-primary);
}

/* GPT Explanation Modal */
.gpt-modal {
    max-width: 600px;
}

.gpt-modal-body {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.gpt-question-section {
    background: var(--option-bg);
    border-radius: var(--radius-sm);
    padding: 16px;
    border-left: 4px solid var(--accent);
}

.gpt-question-text {
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.gpt-answers {
    display: flex;
    gap: 16px;
    font-size: 0.9rem;
    flex-wrap: wrap;
}

.gpt-answers .your-answer {
    color: var(--error);
    font-weight: 500;
}

.gpt-answers .correct-answer {
    color: var(--success);
    font-weight: 500;
}

.gpt-cache-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--success-bg);
    color: var(--success);
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    width: fit-content;
}

.gpt-explanation-content {
    background: var(--option-bg);
    border-radius: var(--radius-sm);
    padding: 20px;
    line-height: 1.7;
    font-size: 0.95rem;
    max-height: 400px;
    overflow-y: auto;
}

.gpt-explanation-content p {
    margin-bottom: 8px;
}

.gpt-explanation-content p:last-child {
    margin-bottom: 0;
}

.gpt-explanation-content strong {
    color: var(--accent);
}

.gpt-explanation-content em {
    color: var(--text-secondary);
    font-style: italic;
}

/* GPT Section Styling */
.gpt-section {
    margin-bottom: 16px;
    padding: 14px;
    border-radius: var(--radius-sm);
    border-left: 4px solid var(--border);
}

.gpt-section:last-child {
    margin-bottom: 0;
}

.gpt-section h4 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.gpt-section p {
    margin-bottom: 6px;
    font-size: 0.9rem;
}

.gpt-section.correct-section {
    background: var(--success-bg);
    border-left-color: var(--success);
}

.gpt-section.correct-section h4 {
    color: var(--success);
}

.gpt-section.wrong-section {
    background: var(--error-bg);
    border-left-color: var(--error);
}

.gpt-section.wrong-section h4 {
    color: var(--error);
}

.gpt-section.grammar-section {
    background: rgba(108, 92, 231, 0.1);
    border-left-color: var(--accent);
}

.gpt-section.grammar-section h4 {
    color: var(--accent);
}

.gpt-section.tip-section {
    background: rgba(253, 203, 110, 0.1);
    border-left-color: var(--warning);
}

.gpt-section.tip-section h4 {
    color: var(--warning);
}

.gpt-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 40px 20px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.gpt-error {
    color: var(--error);
    text-align: center;
    padding: 20px;
}

.gpt-ask-btn {
    background: var(--gradient-primary) !important;
}

