/* ==========================================================================
   FLASHCARD — Nihongo AI Coach
   Premium Minimalist Design System
   ========================================================================== */

/* === Design Tokens === */
:root {
    --fc-bg:              #f8fafc;
    --fc-card-bg:         #ffffff;
    --fc-card-shadow:     0 4px 24px rgba(15, 23, 42, 0.06), 0 1px 4px rgba(15, 23, 42, 0.04);
    --fc-card-shadow-lg:  0 12px 40px rgba(15, 23, 42, 0.1), 0 2px 8px rgba(15, 23, 42, 0.05);
    --fc-text-primary:    #0f172a;
    --fc-text-secondary:  #475569;
    --fc-text-soft:       #94a3b8;
    --fc-accent:          #10b981;
    --fc-accent-light:    #ecfdf5;
    --fc-accent-dark:     #059669;
    --fc-border:          rgba(15, 23, 42, 0.06);
    --fc-radius:          24px;
    --fc-radius-sm:       16px;
    --fc-transition:      cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
    --fc-face-bg: #ffffff;
    --fc-face-back-bg: #f8fafc;
    --fc-text-primary: #0f172a;
    --fc-text-secondary: #475569;
    --fc-text-soft: #64748b;
    --fc-border: rgba(15, 23, 42, 0.10);
}

[data-theme="dark"] {
    --fc-bg: #0b1120;
    --fc-card-bg: #111827;
    --fc-face-bg: #111827;
    --fc-face-back-bg: #0f172a;
    --fc-text-primary: #f8fafc;
    --fc-text-secondary: #cbd5e1;
    --fc-text-soft: #94a3b8;
    --fc-border: rgba(255, 255, 255, 0.12);
}

/* === Flashcard Shell === */
.flashcard-shell {
    background: var(--fc-card-bg);
    border-radius: 28px;
    padding: 24px;
    box-shadow: var(--fc-card-shadow);
    border: 1px solid var(--fc-border);
    max-width: 820px !important;
    margin: 0 auto;
    width: 100%;
}

/* === Topbar === */
.fc-topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 0 16px;
}

.fc-exit-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--fc-bg);
    color: var(--fc-text-secondary);
    border: none;
    cursor: pointer;
    transition: all 0.2s var(--fc-transition);
    flex-shrink: 0;
}

.fc-exit-btn:hover {
    background: #e2e8f0;
    color: var(--fc-text-primary);
}

.fc-progress-counter {
    font-weight: 700;
    font-size: 0.82rem;
    color: var(--fc-text-soft);
    white-space: nowrap;
    flex-shrink: 0;
    letter-spacing: -0.01em;
}

.fc-progress-counter .fc-current {
    color: var(--fc-text-primary);
    font-size: 0.88rem;
    font-weight: 800;
}

/* Progress track in topbar */
.fc-topbar .fc-progress-track {
    flex: 1;
    height: 4px;
    border-radius: 999px;
    background: #e2e8f0;
    overflow: hidden;
}

.fc-progress-track {
    flex: 1;
    height: 4px;
    border-radius: 999px;
    background: #e2e8f0;
    overflow: hidden;
}

.fc-progress-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--fc-accent), var(--fc-accent-dark));
    transition: width 0.5s var(--fc-transition);
    width: 0%;
}

/* === Card Stage === */
.fc-stage {
    position: relative;
    width: 100%;
}

/* === Individual Card === */
.fc-card {
    position: relative;
    width: 100%;
    min-height: 480px !important;
    perspective: 1200px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: pan-y;
    transform-style: preserve-3d !important;
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.fc-card.is-flipped {
    transform: rotateY(180deg) !important;
}

.fc-card.swiping {
    transition: none !important;
}

.fc-card.swipe-out-right {
    animation: fcSwipeOutRight 0.4s var(--fc-transition) forwards;
}

.fc-card.swipe-out-left {
    animation: fcSwipeOutLeft 0.4s var(--fc-transition) forwards;
}

.fc-card.slide-in {
    animation: fcSlideIn 0.4s var(--fc-transition);
}

@keyframes fcSwipeOutRight {
    to { transform: translateX(120%) rotate(12deg); opacity: 0; }
}

@keyframes fcSwipeOutLeft {
    to { transform: translateX(-120%) rotate(-12deg); opacity: 0; }
}

@keyframes fcSlideIn {
    from { transform: translateX(30px); opacity: 0; }
    to   { transform: translateX(0);    opacity: 1; }
}

/* === Card Face (shared) === */
.fc-face {
    width: 100%;
    min-height: 480px !important;
    padding: 40px 28px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    border-radius: var(--fc-radius);
    background: var(--fc-face-bg, var(--bg-card, var(--fc-card-bg))) !important;
    box-shadow: var(--shadow-card, var(--fc-card-shadow)) !important;
    border: 1px solid var(--border-soft, var(--fc-border)) !important;
    backface-visibility: hidden !important;
    -webkit-backface-visibility: hidden !important;
    transition: background 0.35s ease, border-color 0.35s ease, transform 0.6s var(--fc-transition);
    overflow: hidden !important;
    scrollbar-width: none !important;
}

.fc-back {
    background: var(--fc-face-back-bg, var(--fc-face-bg, var(--bg-card, var(--fc-card-bg)))) !important;
}

.fc-face::-webkit-scrollbar {
    display: none;
}

/* Front face — normal flow, determines card height */
.fc-front {
    position: relative;
    z-index: 2;
    transform: rotateY(0deg) !important;
}

/* Back face — absolute overlay */
.fc-back {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform: rotateY(180deg) !important;
    z-index: 1;
}

/* === Type Label (badge) === */
.fc-type-label {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 24px;
    position: relative;
    z-index: 1;
}

.fc-type-label-vocab {
    background: var(--fc-accent-light);
    color: var(--fc-accent-dark);
}

.fc-type-label-kanji {
    background: #eff6ff;
    color: #2563eb;
}

.fc-type-label-meaning {
    background: #f0fdf4;
    color: var(--fc-accent-dark);
}

/* === Front Content — Vocabulary Word === */
.fc-word-reading {
    font-size: clamp(1.2rem, 2.5vw, 1.8rem);
    font-weight: 600;
    color: var(--text-soft, var(--fc-text-secondary));
    margin-bottom: 12px;
    font-family: 'Noto Sans JP', 'Inter', sans-serif;
    text-align: center;
    position: relative;
    z-index: 1;
}

.fc-word-reading.is-hidden {
    display: none;
}

.fc-reading-toggle {
    margin-top: 18px;
    padding: 7px 12px;
    border: 1px solid var(--border-soft, var(--fc-border));
    border-radius: 999px;
    background: var(--bg-soft, var(--fc-bg));
    color: var(--text-main, var(--fc-text-secondary));
    font-size: 0.82rem;
    font-weight: 800;
    cursor: pointer;
    position: relative;
    z-index: 2;
    transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.fc-reading-toggle:hover {
    transform: translateY(-1px);
    background: rgba(16, 185, 129, 0.12);
    color: var(--accent-green, var(--fc-accent-dark));
}

.fc-word-main {
    font-family: 'Zen Maru Gothic', 'Noto Sans JP', sans-serif;
    font-size: clamp(2.4rem, 6vw, 4.2rem);
    font-weight: 800;
    line-height: 1.2;
    color: var(--text-main, var(--fc-text-primary));
    text-align: center;
    word-break: keep-all;
    white-space: normal;
    max-width: 100%;
    position: relative;
    z-index: 1;
    transition: font-size 0.2s ease;
}

/* Auto-shrink for long phrases */
.fc-word-main[data-length="long"] {
    font-size: clamp(1.8rem, 5vw, 2.8rem);
}

.fc-word-main[data-length="xlong"] {
    font-size: clamp(1.4rem, 4vw, 2.2rem);
}

/* Kanji character (large) */
.fc-kanji-char {
    font-family: 'Zen Maru Gothic', 'Noto Sans JP', serif;
    font-size: clamp(3.5rem, 14vw, 7rem);
    font-weight: 700;
    line-height: 1.1;
    color: var(--text-main, var(--fc-text-primary)) !important;
    text-align: center;
}

/* Flip hint */
.fc-flip-hint,
.flashcard-flip-hint {
    margin-top: 28px;
    font-weight: 600;
    font-size: 0.78rem;
    color: var(--text-muted, var(--fc-text-soft)) !important;
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.fc-flip-hint .fc-hint-icon,
.flashcard-flip-hint span {
    display: inline-flex;
    width: 20px;
    height: 20px;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: var(--bg-soft, var(--fc-bg));
    font-size: 0.65rem;
    color: var(--text-muted, var(--fc-text-soft));
}

/* === Back Content — Meaning === */
.fc-meaning {
    font-size: clamp(1.1rem, 3vw, 1.5rem);
    font-weight: 700;
    text-align: center;
    word-break: break-word;
    max-width: 100%;
    color: var(--success-text, var(--primary, var(--fc-accent-dark))) !important;
    margin-bottom: 16px;
    position: relative;
    z-index: 1;
    line-height: 1.4;
}

.fc-back-term {
    font-family: 'Zen Maru Gothic', 'Noto Sans JP', sans-serif;
    font-size: clamp(2.4rem, 6vw, 4.2rem);
    font-weight: 800;
    color: var(--text-main, var(--fc-text-primary));
    line-height: 1.2;
    margin-bottom: 10px;
}

.fc-back-reading {
    font-family: 'Noto Sans JP', sans-serif;
    font-size: clamp(1rem, 2.2vw, 1.5rem);
    font-weight: 700;
    color: var(--text-soft, var(--fc-text-secondary));
    margin-bottom: 12px;
}

/* Meta pills (JLPT, part of speech) */
.fc-meta-pills {
    display: flex;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    position: relative;
    z-index: 1;
}

.fc-pill {
    display: inline-flex;
    padding: 3px 10px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.68rem;
    letter-spacing: 0.02em;
}

.fc-pill-jlpt {
    background: var(--fc-accent-light);
    color: var(--fc-accent-dark);
}

.fc-pill-pos {
    background: #eff6ff;
    color: #2563eb;
}

.fc-pill-reading {
    background: var(--fc-accent-light);
    color: var(--fc-accent-dark);
}

.fc-pill-study {
    background: #f5f3ff;
    color: #7c3aed;
}

.fc-pill-grade {
    background: #eff6ff;
    color: #2563eb;
}

/* Example sentence */
.fc-example {
    background: var(--bg-soft, var(--fc-bg)) !important;
    border-radius: var(--fc-radius-sm);
    padding: 14px 18px;
    margin-top: 10px;
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 440px;
    border: 1px solid var(--border-soft, transparent) !important;
}

.fc-example-jp {
    font-family: 'Noto Sans JP', sans-serif;
    font-weight: 700;
    font-size: 0.88rem;
    margin-bottom: 4px;
    color: var(--text-main, var(--fc-text-primary)) !important;
    line-height: 1.5;
    word-break: break-word;
}

.fc-example-vi {
    font-size: 0.8rem;
    color: var(--text-muted, var(--fc-text-soft)) !important;
    line-height: 1.4;
}

/* === SRS Action Buttons === */
.fc-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 16px;
}

.fc-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 10px 16px;
    border-radius: 14px;
    font-weight: 700;
    font-size: 0.78rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s var(--fc-transition);
    white-space: nowrap;
    min-width: 72px;
}

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

.fc-action-btn:active {
    transform: translateY(0) scale(0.97);
}

.fc-action-btn .fc-btn-interval {
    font-size: 0.6rem;
    font-weight: 600;
    opacity: 0.6;
}

/* Button variants */
.fc-btn-again {
    background: #fef2f2;
    color: #dc2626;
}
.fc-btn-again:hover {
    background: #fee2e2;
}

.fc-btn-hard {
    background: #fff7ed;
    color: #d97706;
}
.fc-btn-hard:hover {
    background: #ffedd5;
}

.fc-btn-good {
    background: #eff6ff;
    color: #2563eb;
}
.fc-btn-good:hover {
    background: #dbeafe;
}

.fc-btn-easy {
    background: var(--fc-accent-light);
    color: var(--fc-accent-dark);
}
.fc-btn-easy:hover {
    background: #d1fae5;
}

/* Rating pulse */
@keyframes fcRatingPulse {
    0%  { transform: scale(1); }
    40% { transform: scale(0.93); }
    100% { transform: scale(1); }
}

.fc-rating-pulse {
    animation: fcRatingPulse 0.3s ease-in-out;
}

/* === Swipe Indicators === */
.fc-swipe-indicator {
    position: absolute;
    top: 16px;
    padding: 6px 16px;
    border-radius: 10px;
    font-weight: 800;
    font-size: 0.85rem;
    opacity: 0;
    transition: opacity 0.15s ease;
    z-index: 10;
    pointer-events: none;
}

.fc-swipe-right-indicator {
    right: 16px;
    background: rgba(16, 185, 129, 0.9);
    color: #fff;
}

.fc-swipe-left-indicator {
    left: 16px;
    background: rgba(239, 68, 68, 0.9);
    color: #fff;
}

/* === Completion Card === */
.fc-completion {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 360px;
    text-align: center;
    padding: 40px 24px;
}

.fc-completion-icon {
    font-size: 3.5rem;
    margin-bottom: 16px;
    animation: fcBounceIn 0.6s var(--fc-transition);
}

@keyframes fcBounceIn {
    0%  { transform: scale(0.3); opacity: 0; }
    50% { transform: scale(1.08); }
    100% { transform: scale(1); opacity: 1; }
}

.fc-completion h2 {
    font-weight: 800;
    font-size: 1.5rem;
    color: var(--fc-text-primary);
    margin-bottom: 6px;
}

.fc-completion-stats {
    font-size: 0.9rem;
    color: var(--fc-text-soft);
    margin-bottom: 4px;
}

.fc-completion-stats strong {
    color: var(--fc-accent);
}

.fc-completion-summary {
    font-size: 0.82rem;
    color: var(--fc-text-soft);
    margin-bottom: 20px;
}

.fc-completion-actions {
    display: flex;
    gap: 10px;
}

.fc-completion-btn {
    padding: 10px 24px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s var(--fc-transition);
    border: none;
}

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

.fc-completion-btn-retry {
    background: var(--fc-accent);
    color: #fff;
}
.fc-completion-btn-retry:hover {
    background: var(--fc-accent-dark);
}

.fc-completion-btn-exit {
    background: var(--fc-bg);
    color: var(--fc-text-secondary);
}
.fc-completion-btn-exit:hover {
    background: #e2e8f0;
}

/* === Toast Notification === */
.fc-toast {
    position: fixed;
    right: 20px;
    bottom: 20px;
    background: var(--fc-card-bg);
    border: 1px solid var(--fc-border);
    border-radius: 14px;
    padding: 12px 18px;
    box-shadow: var(--fc-card-shadow-lg);
    font-weight: 700;
    font-size: 0.82rem;
    color: var(--fc-text-primary);
    z-index: 9999;
    transform: translateY(16px);
    opacity: 0;
    transition: all 0.3s var(--fc-transition);
    pointer-events: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.fc-toast.show {
    transform: translateY(0);
    opacity: 1;
}

.fc-toast-xp {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 8px;
    border-radius: 8px;
    background: var(--fc-accent-light);
    color: var(--fc-accent-dark);
    font-size: 0.72rem;
    font-weight: 800;
}

/* === Responsive === */
@media (max-width: 768px) {
    .flashcard-shell {
        padding: 14px;
        border-radius: 22px;
    }

    .fc-face {
        padding: 32px 20px;
        border-radius: 20px;
        min-height: 300px;
    }

    .fc-card {
        min-height: 300px;
    }

    .fc-actions {
        gap: 6px;
    }

    .fc-action-btn {
        padding: 9px 12px;
        min-width: 64px;
        border-radius: 12px;
        font-size: 0.74rem;
    }

    .fc-completion {
        min-height: 300px;
        padding: 28px 16px;
    }
}

@media (max-width: 480px) {
    .fc-topbar {
        gap: 8px;
    }

    .fc-action-btn .fc-btn-interval {
        display: none;
    }

    .fc-action-btn {
        min-width: 56px;
        padding: 8px 10px;
    }

    .fc-word {
        font-size: clamp(1.4rem, 5vw, 2rem);
    }

    .fc-word[data-length="long"] {
        font-size: clamp(1.2rem, 4vw, 1.6rem);
    }

    .fc-word[data-length="xlong"] {
        font-size: clamp(1rem, 3.5vw, 1.4rem);
    }

    .fc-kanji-char {
        font-size: clamp(3rem, 18vw, 5.5rem);
    }
}

/* ==========================================================================
   REFRACTORED FLASHCARD PLAYER STYLES (WCAG AA Contrast Compliant)
   ========================================================================== */

/* Progress Row styling */
.fc-progress-row-new {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
    width: 100%;
}

.fc-back-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid var(--border-soft);
    background: var(--bg-card);
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: var(--shadow-sm);
    line-height: 1;
}

.fc-back-btn:hover {
    background: var(--bg-card-hover);
    color: var(--primary);
    transform: scale(1.08);
    border-color: var(--border-strong);
    box-shadow: var(--shadow-md);
}

.fc-counter-new {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--text-soft);
    white-space: nowrap;
}

.fc-progress-new {
    flex: 1;
    height: 10px;
    background: var(--bg-soft);
    border-radius: 999px;
    overflow: hidden;
    position: relative;
    border: 1px solid var(--border-soft);
}

.fc-progress-bar-new {
    height: 100%;
    border-radius: 999px;
    background: var(--accent-green, #10b981);
    transition: width 0.3s ease;
}

.fc-mastered-new {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--accent-green, #10b981);
    white-space: nowrap;
}

.fc-progress-save-toggle {
    border: 1px solid var(--border-soft, rgba(15, 23, 42, 0.12));
    border-radius: 999px;
    background: var(--bg-soft, #f8fafc);
    color: var(--text-soft, #475569);
    padding: 7px 12px;
    font-size: 0.82rem;
    font-weight: 900;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.fc-progress-save-toggle.is-on {
    background: rgba(16, 185, 129, 0.10);
    border-color: rgba(16, 185, 129, 0.28);
    color: #047857;
}

/* Card face setup and typography */
.flashcard-stage {
    perspective: 1200px;
    min-height: 480px;
    width: 100%;
}

/* SRS Action Buttons styling */
.fc-actions-new {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    width: 100%;
    margin: 20px auto 0 auto;
    max-width: 820px;
}

.btn-srs {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    border-radius: 12px;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: var(--shadow-sm);
    text-align: center;
    border: 2px solid transparent;
    text-decoration: none;
}

.btn-srs:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.btn-srs:active {
    transform: translateY(-1px) scale(0.98);
}

.btn-srs-title {
    font-size: 0.95rem;
    font-weight: 800;
    margin-bottom: 2px;
}

.btn-srs-time {
    font-size: 0.78rem;
    font-weight: 600;
    opacity: 0.85;
}

/* Light Theme overrides for SRS buttons (WCAG AA contrast compliant) */
[data-theme="light"] .btn-srs-again {
    background-color: #fee2e2;
    border-color: #fca5a5;
    color: #991b1b;
}
[data-theme="light"] .btn-srs-again:hover {
    background-color: #dc2626;
    border-color: #dc2626;
    color: #ffffff;
}

[data-theme="light"] .btn-srs-hard {
    background-color: #fef3c7;
    border-color: #fde68a;
    color: #92400e;
}
[data-theme="light"] .btn-srs-hard:hover {
    background-color: #d97706;
    border-color: #d97706;
    color: #ffffff;
}

[data-theme="light"] .btn-srs-good {
    background-color: #dbeafe;
    border-color: #bfdbfe;
    color: #1e40af;
}
[data-theme="light"] .btn-srs-good:hover {
    background-color: #2563eb;
    border-color: #2563eb;
    color: #ffffff;
}

[data-theme="light"] .btn-srs-easy {
    background-color: #dcfce7;
    border-color: #bbf7d0;
    color: #065f46;
}
[data-theme="light"] .btn-srs-easy:hover {
    background-color: #16a34a;
    border-color: #16a34a;
    color: #ffffff;
}

/* Dark Theme overrides for SRS buttons (WCAG AA contrast compliant) */
[data-theme="dark"] .btn-srs-again {
    background-color: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.4);
    color: #fca5a5;
}
[data-theme="dark"] .btn-srs-again:hover {
    background-color: #dc2626;
    border-color: #dc2626;
    color: #ffffff;
}

[data-theme="dark"] .btn-srs-hard {
    background-color: rgba(245, 158, 11, 0.15);
    border-color: rgba(245, 158, 11, 0.4);
    color: #fde68a;
}
[data-theme="dark"] .btn-srs-hard:hover {
    background-color: #d97706;
    border-color: #d97706;
    color: #ffffff;
}

[data-theme="dark"] .btn-srs-good {
    background-color: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.4);
    color: #93c5fd;
}
[data-theme="dark"] .btn-srs-good:hover {
    background-color: #2563eb;
    border-color: #2563eb;
    color: #ffffff;
}

[data-theme="dark"] .btn-srs-easy {
    background-color: rgba(16, 185, 129, 0.15);
    border-color: rgba(16, 185, 129, 0.4);
    color: #a7f3d0;
}
[data-theme="dark"] .btn-srs-easy:hover {
    background-color: #16a34a;
    border-color: #16a34a;
    color: #ffffff;
}

/* Toast styling override */
.fc-toast {
    position: fixed;
    right: 24px;
    bottom: 24px;
    background: var(--bg-card, #ffffff);
    border-radius: 22px;
    padding: 16px 24px;
    box-shadow: var(--shadow-lg, 0 18px 50px rgba(36, 48, 68, 0.16));
    font-weight: 800;
    z-index: 9999;
    display: none;
    border: 1px solid var(--border-soft);
    color: var(--text-main);
    font-size: 0.95rem;
    transition: opacity 0.3s ease;
}

.fc-toast.show {
    display: block;
    animation: slideInUp 0.3s ease;
}

.fc-toast-xp {
    color: var(--accent-green, #10b981);
    font-weight: 900;
    margin-left: 6px;
}

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

/* Button pulse animations */
.fc-rating-pulse {
    animation: ratingPulse 0.35s ease-in-out;
}

/* Responsive Overrides */
@media (max-width: 576px) {
    .fc-actions-new {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    .btn-srs {
        padding: 10px 12px;
        border-radius: 12px;
    }
    .btn-srs-title {
        font-size: 0.95rem;
    }
    .btn-srs-time {
        font-size: 0.8rem;
    }
    .flashcard-stage, .fc-card {
        min-height: 280px !important;
    }
    .fc-face {
        padding: 20px;
        border-radius: 20px;
        min-height: 280px !important;
    }
    .fc-progress-row-new {
        flex-wrap: wrap;
        gap: 12px;
    }
    .fc-progress-new {
        order: 4;
        flex: 0 0 100%;
        margin-top: 4px;
    }
}

/* === Theme hard overrides: keep flashcards readable in both light and dark === */
html[data-theme="light"] .flashcard-shell,
html:not([data-theme="dark"]) .flashcard-shell {
    --fc-bg: #eef2f7;
    --fc-card-bg: #ffffff;
    --fc-face-bg: #ffffff;
    --fc-face-back-bg: #ffffff;
    --fc-text-primary: #0f172a;
    --fc-text-secondary: #334155;
    --fc-text-soft: #475569;
    --fc-border: rgba(15, 23, 42, 0.16);
    background: #ffffff !important;
    color: #0f172a !important;
    border-color: rgba(15, 23, 42, 0.14) !important;
    box-shadow: 0 22px 58px rgba(15, 23, 42, 0.13) !important;
}

html[data-theme="light"] .flashcard-shell .fc-face,
html:not([data-theme="dark"]) .flashcard-shell .fc-face,
html[data-theme="light"] .flashcard-shell .flashcard-face,
html:not([data-theme="dark"]) .flashcard-shell .flashcard-face {
    background: #ffffff !important;
    color: #0f172a !important;
    border-color: rgba(15, 23, 42, 0.18) !important;
    box-shadow: 0 22px 58px rgba(15, 23, 42, 0.13) !important;
}

html[data-theme="light"] .flashcard-shell .fc-back,
html:not([data-theme="dark"]) .flashcard-shell .fc-back,
html[data-theme="light"] .flashcard-shell .flashcard-back,
html:not([data-theme="dark"]) .flashcard-shell .flashcard-back {
    background: #ffffff !important;
}

html[data-theme="light"] .flashcard-shell .fc-word-main,
html:not([data-theme="dark"]) .flashcard-shell .fc-word-main,
html[data-theme="light"] .flashcard-shell .fc-back-term,
html:not([data-theme="dark"]) .flashcard-shell .fc-back-term,
html[data-theme="light"] .flashcard-shell .fc-example-jp,
html:not([data-theme="dark"]) .flashcard-shell .fc-example-jp,
html[data-theme="light"] .flashcard-shell .flashcard-word,
html:not([data-theme="dark"]) .flashcard-shell .flashcard-word,
html[data-theme="light"] .flashcard-shell .flashcard-meaning,
html:not([data-theme="dark"]) .flashcard-shell .flashcard-meaning {
    color: #0f172a !important;
}

html[data-theme="light"] .flashcard-shell .fc-word-reading,
html:not([data-theme="dark"]) .flashcard-shell .fc-word-reading,
html[data-theme="light"] .flashcard-shell .fc-back-reading,
html:not([data-theme="dark"]) .flashcard-shell .fc-back-reading,
html[data-theme="light"] .flashcard-shell .fc-flip-hint,
html:not([data-theme="dark"]) .flashcard-shell .fc-flip-hint,
html[data-theme="light"] .flashcard-shell .flashcard-flip-hint,
html:not([data-theme="dark"]) .flashcard-shell .flashcard-flip-hint {
    color: #64748b !important;
}

html[data-theme="light"] .flashcard-shell .fc-reading-toggle,
html:not([data-theme="dark"]) .flashcard-shell .fc-reading-toggle,
html[data-theme="light"] .flashcard-shell .fc-progress-save-toggle,
html:not([data-theme="dark"]) .flashcard-shell .fc-progress-save-toggle,
html[data-theme="light"] .flashcard-shell .fc-example,
html:not([data-theme="dark"]) .flashcard-shell .fc-example {
    background: #f1f5f9 !important;
    color: #334155 !important;
    border-color: rgba(15, 23, 42, 0.18) !important;
}

html[data-theme="light"] .flashcard-shell .fc-progress-save-toggle.is-on,
html:not([data-theme="dark"]) .flashcard-shell .fc-progress-save-toggle.is-on {
    background: #dcfce7 !important;
    color: #166534 !important;
    border-color: #86efac !important;
}

html[data-theme="light"] .flashcard-shell .fc-progress-new,
html:not([data-theme="dark"]) .flashcard-shell .fc-progress-new,
html[data-theme="light"] .flashcard-shell .fc-progress-track,
html:not([data-theme="dark"]) .flashcard-shell .fc-progress-track {
    background: #dbe3ee !important;
    border-color: rgba(15, 23, 42, 0.14) !important;
}

html[data-theme="light"] .flashcard-shell .fc-progress-bar-new,
html:not([data-theme="dark"]) .flashcard-shell .fc-progress-bar-new,
html[data-theme="light"] .flashcard-shell .fc-progress-fill,
html:not([data-theme="dark"]) .flashcard-shell .fc-progress-fill {
    background: #10b981 !important;
}

html[data-theme="dark"] .flashcard-shell {
    --fc-bg: #0b1120;
    --fc-card-bg: #111827;
    --fc-face-bg: linear-gradient(145deg, #111827 0%, #0f172a 100%);
    --fc-face-back-bg: #111827;
    --fc-text-primary: #f8fafc;
    --fc-text-secondary: #cbd5e1;
    --fc-text-soft: #94a3b8;
    --fc-border: rgba(255, 255, 255, 0.12);
    background: #111827 !important;
    color: #f8fafc !important;
}

html[data-theme="dark"] .flashcard-shell .fc-face,
html[data-theme="dark"] .flashcard-shell .flashcard-face,
html[data-theme="dark"] .flashcard-shell .fc-back,
html[data-theme="dark"] .flashcard-shell .flashcard-back {
    background: linear-gradient(145deg, #111827 0%, #0f172a 100%) !important;
    color: #f8fafc !important;
    border-color: rgba(255, 255, 255, 0.12) !important;
}
