/* === DESIGN TOKENS — Lo-Fi PostHog Style === */
:root {
    /* Colors — warm paper palette */
    --accent: #F54E00;
    --accent-15: rgba(245, 78, 0, 0.12);
    --accent-30: rgba(245, 78, 0, 0.25);
    --bg-primary: #EEEFE9;
    --bg-surface: #FFFFFF;
    --bg-inset: #E5E7E0;
    --divider: #D0D1C9;
    --text-primary: #1D1F27;
    --text-secondary: #4B4D58;
    --text-tertiary: #6E7079;
    --text-muted: #9D9FA8;
    --text-inverted: #FFFFFF;
    --error: #EF4444;
    --warning: #F59E0B;
    --success: #30A46C;

    /* Lo-fi extras */
    --ink: #1D1F27;
    --border-sketch: 2px solid var(--ink);
    --yellow-highlight: #FFE17D;
    --blue-pop: #3F8CFF;

    /* Text on the always-yellow flashcard face — stays dark in every theme */
    --card-ink: #1D1F27;
    --card-muted: #6E7079;

    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-hand: 'Patrick Hand', cursive;
    --font-mono: 'JetBrains Mono', monospace;

    /* Radii — rounder, friendlier */
    --radius-pill: 100px;
    --radius-card: 16px;
    --radius-btn: 12px;
    --radius-progress: 6px;

    /* Layout */
    --tab-bar-height: 62px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* === DARK THEME ===
   Tokens are redefined so every rule using var(--*) adapts automatically.
   --ink flips to a light value so borders/offset-shadows stay visible. */
:root[data-theme="dark"] {
    --accent: #FF6A2B;
    --accent-15: rgba(255, 106, 43, 0.16);
    --accent-30: rgba(255, 106, 43, 0.30);
    --bg-primary: #14151A;
    --bg-surface: #1F2027;
    --bg-inset: #26272F;
    --divider: #33353F;
    --text-primary: #ECECE6;
    --text-secondary: #B4B6BE;
    --text-tertiary: #9A9DA6;
    --text-muted: #83868F;
    --text-inverted: #FFFFFF;
    --ink: #ECECE6;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --accent: #FF6A2B;
        --accent-15: rgba(255, 106, 43, 0.16);
        --accent-30: rgba(255, 106, 43, 0.30);
        --bg-primary: #14151A;
        --bg-surface: #1F2027;
        --bg-inset: #26272F;
        --divider: #33353F;
        --text-primary: #ECECE6;
        --text-secondary: #B4B6BE;
        --text-tertiary: #9A9DA6;
        --text-muted: #83868F;
        --text-inverted: #FFFFFF;
        --ink: #ECECE6;
    }
}

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

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    overflow-x: hidden;
    -webkit-user-select: none;
    user-select: none;
    -webkit-font-smoothing: antialiased;
}

#app {
    min-height: 100vh;
    min-height: 100dvh;
    position: relative;
}

/* === SCREENS === */
.screen {
    display: none;
    padding: 16px 20px;
    padding-bottom: calc(var(--tab-bar-height) + var(--safe-bottom) + 32px);
    animation: fadeIn 0.25s ease;
}

.screen.active { display: block; }

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

/* === SCREEN HEADERS === */
.screen-header {
    margin-bottom: 24px;
}

.screen-header .header-label {
    font-family: var(--font-hand);
    font-size: 14px;
    color: var(--text-tertiary);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    display: block;
    margin-bottom: 4px;
}

.screen-header .header-title {
    font-family: var(--font-hand);
    font-size: 28px;
    font-weight: 400;
    color: var(--text-primary);
}

/* Header row: back + title + actions */
.screen-header-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.screen-header-row .header-title {
    font-family: var(--font-hand);
    font-size: 24px;
    font-weight: 400;
    flex: 1;
}

.screen-header-row .header-actions {
    display: flex;
    gap: 8px;
}

/* Back button */
.back-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    border-radius: var(--radius-btn);
    transition: background 0.2s;
    flex-shrink: 0;
}

.back-btn:active { background: var(--bg-surface); }
.back-btn svg { width: 20px; height: 20px; }

/* Action button (in header) */
.action-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    border-radius: var(--radius-btn);
    transition: opacity 0.2s;
    flex-shrink: 0;
}

.action-btn svg { width: 18px; height: 18px; }

.action-btn-surface {
    background: var(--bg-surface);
    color: var(--text-secondary);
}

.action-btn-accent {
    background: var(--accent);
    color: var(--text-inverted);
}

/* Progress label in header */
.header-progress {
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 600;
    color: var(--accent);
}

/* === TAB BAR === */
.tab-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(var(--tab-bar-height) + var(--safe-bottom));
    background: var(--bg-surface);
    border-top: var(--border-sketch);
    display: flex;
    align-items: flex-start;
    justify-content: space-around;
    padding-top: 8px;
    padding-bottom: var(--safe-bottom);
    z-index: 100;
}

.tab-bar.hidden { display: none; }

.tab-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 500;
    cursor: pointer;
    padding: 6px 16px;
    border-radius: var(--radius-pill);
    transition: color 0.2s;
}

.tab-item svg { width: 22px; height: 22px; }

.tab-item.active {
    color: var(--accent);
}

.tab-item span {
    pointer-events: none;
}

/* === BUTTON PRIMARY === */
.btn-primary {
    background: var(--accent);
    color: #fff;
    border: 2px solid var(--ink);
    border-radius: var(--radius-btn);
    padding: 10px 20px;
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: transform 0.1s;
    box-shadow: 3px 3px 0 var(--ink);
}

.btn-primary:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.btn-primary svg { width: 16px; height: 16px; }

.btn-primary-full {
    background: var(--accent);
    color: #fff;
    border: 2px solid var(--ink);
    border-radius: var(--radius-btn);
    padding: 14px 20px;
    font-family: var(--font-sans);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    transition: transform 0.1s;
    box-shadow: 3px 3px 0 var(--ink);
}

.btn-primary-full:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.btn-primary-full svg { width: 18px; height: 18px; }

/* === BUTTON OUTLINE === */
.btn-outline {
    background: var(--bg-surface);
    color: var(--text-primary);
    border: 2px solid var(--ink);
    border-radius: var(--radius-btn);
    padding: 10px 20px;
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: transform 0.1s;
    box-shadow: 2px 2px 0 var(--ink);
}

.btn-outline:active { transform: translate(1px, 1px); box-shadow: 1px 1px 0 var(--ink); }
.btn-outline svg { width: 16px; height: 16px; }

/* === TAG CHIP === */
.tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: var(--bg-inset);
    border-radius: var(--radius-pill);
    border: none;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 500;
    color: var(--text-tertiary);
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    white-space: nowrap;
}

.tag-chip svg { width: 12px; height: 12px; }

.tag-chip.active {
    background: var(--accent-15);
    color: var(--accent);
}

.tag-chip-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* === DECK CARD COMPONENT === */
.deck-card {
    background: var(--bg-surface);
    border: 2px solid var(--ink);
    border-radius: var(--radius-card);
    padding: 14px 16px;
    cursor: pointer;
    transition: transform 0.1s;
    box-shadow: 3px 3px 0 var(--ink);
}

.deck-card:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }

.deck-card-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

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

.deck-card-title {
    font-family: var(--font-sans);
    font-size: 18px;
    font-weight: 400;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.deck-card-sub {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-tertiary);
    display: block;
    margin-top: 2px;
}

.deck-card-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    flex-shrink: 0;
}

.deck-card-pct {
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 600;
    color: var(--accent);
}

.deck-card-progress-mini {
    width: 48px;
    height: 4px;
    background: var(--bg-inset);
    border-radius: var(--radius-progress);
    overflow: hidden;
}

.deck-card-progress-mini-fill {
    height: 100%;
    background: var(--accent);
    border-radius: var(--radius-progress);
    transition: width 0.3s ease;
}

/* Language badge */
.lang-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px 8px;
    background: var(--accent-15);
    border-radius: 6px;
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 600;
    color: var(--accent);
    white-space: nowrap;
    flex-shrink: 0;
}

.dot-new { background: var(--accent); }
.dot-review { background: var(--warning); }
.dot-learning { background: var(--success); }

.stat-new { color: var(--accent); }
.stat-review { color: var(--warning); }
.stat-learning { color: var(--success); }

/* === RATING BUTTONS === */
.rating-buttons {
    display: flex;
    gap: 8px;
    justify-content: center;
    padding: 0 4px;
}

.rating-buttons.hidden { display: none; }

.rating-btn {
    flex: 1;
    max-width: 80px;
    background: var(--bg-surface);
    border: 2px solid var(--ink);
    border-radius: var(--radius-btn);
    padding: 12px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    transition: transform 0.1s;
    box-shadow: 2px 2px 0 var(--ink);
}

.rating-btn:active { transform: translate(1px, 1px); box-shadow: 1px 1px 0 var(--ink); }

.rating-btn .time {
    font-family: var(--font-mono);
    font-size: 11px;
    color: #fff;
    opacity: 0.85;
}

.rating-btn .label {
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 600;
    color: #fff;
}

/* Semantic fills so ratings read at a glance */
.rating-btn.again { background: var(--error); }
.rating-btn.hard  { background: var(--warning); }
.rating-btn.good  { background: var(--accent); }
.rating-btn.easy  { background: var(--success); }

/* === FLASHCARD (real 3D flip) === */
.flashcard-container {
    perspective: 1200px;
    margin: 16px 0;
    position: relative;      /* anchor for .swipe-overlay */
    touch-action: pan-y;     /* let us own horizontal swipes, keep vertical scroll */
}

.flashcard {
    min-height: 280px;
    position: relative;
    cursor: pointer;
    background: transparent;
    touch-action: pan-y;
    perspective: 1200px;   /* must sit on the direct parent of .flashcard-inner */
}

.flashcard-inner {
    position: relative;
    width: 100%;
    min-height: 280px;
    transform-style: preserve-3d;
    transition: transform 0.55s cubic-bezier(.2, .7, .2, 1);
    will-change: transform;
}

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

.flashcard-face {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 32px 24px;
    background: var(--yellow-highlight);
    border: 2px solid var(--ink);
    border-radius: var(--radius-card);
    box-shadow: 4px 4px 0 var(--ink);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    overflow-y: auto;
}

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

@media (prefers-reduced-motion: reduce) {
    .flashcard-inner { transition: none; }
}

.flashcard-label {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--card-muted);
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 12px;
}

.flashcard-front-text {
    font-family: var(--font-sans);
    font-size: 34px;
    font-weight: 700;
    color: var(--card-ink);
    margin-bottom: 8px;
    word-break: break-word;
}

.flashcard-transliteration {
    font-family: var(--font-mono);
    font-size: 16px;
    font-weight: 500;
    color: var(--card-muted);
}

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

.flashcard-back-text {
    font-family: var(--font-sans);
    font-size: 26px;
    font-weight: 600;
    color: var(--card-ink);
    margin-bottom: 12px;
    word-break: break-word;
}

.flashcard-example {
    margin-top: 8px;
}

.flashcard-example .example-line {
    font-family: var(--font-sans);
    font-size: 13px;
    color: var(--card-muted);
    font-style: italic;
    padding: 2px 0;
    line-height: 1.5;
}

/* Tap hint */
.flashcard-hint {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--card-muted);
    position: absolute;
    bottom: 12px;
}

.flashcard.revealed .flashcard-hint { display: none; }

/* Swipe-to-rate overlay hint */
.swipe-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 64px;
    font-weight: 800;
    border-radius: var(--radius-card);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
    z-index: 3;
}
.swipe-overlay.good { background: rgba(48, 164, 108, 0.25); color: var(--success); }
.swipe-overlay.again { background: rgba(239, 68, 68, 0.25); color: var(--error); }

/* TTS (Text-to-Speech) button */
.flashcard-text-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.tts-btn {
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 50%;
    background: var(--bg-surface);
    border: 2px solid var(--ink);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, transform 0.2s;
    flex-shrink: 0;
}
.tts-btn svg { width: 16px; height: 16px; }
.tts-btn:active { background: var(--accent-15); color: var(--accent); }
.tts-btn.speaking {
    color: var(--accent);
    animation: ttsPulse 1s ease-in-out infinite;
}
@keyframes ttsPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.15); opacity: 0.7; }
}

/* Keyboard shortcut hints on rating buttons */
.rating-btn .key-hint {
    font-family: var(--font-mono);
    font-size: 9px;
    color: #fff;
    opacity: 0.65;
}

/* Session complete overlay */
.session-complete {
    text-align: center;
    padding: 32px 20px;
}

.session-complete-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--yellow-highlight);
    border: 2px solid var(--ink);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.session-complete-icon svg { width: 32px; height: 32px; color: var(--accent); }

.session-complete h2 {
    font-family: var(--font-sans);
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 8px;
}

.session-complete p {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.session-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 24px;
}

.session-stat {
    background: var(--bg-surface);
    border: 2px solid var(--ink);
    border-radius: var(--radius-btn);
    padding: 12px;
    text-align: center;
}

.session-stat-value {
    font-family: var(--font-sans);
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.session-stat-label {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-top: 4px;
}

/* End session button */
.end-session-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 11px;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: var(--radius-btn);
    transition: color 0.2s;
}

.end-session-btn:active { color: var(--text-secondary); }

/* === STUDY PROGRESS BAR === */
.study-progress-bar {
    height: 8px;
    background: var(--bg-inset);
    border: 1px solid var(--ink);
    border-radius: var(--radius-progress);
    margin-bottom: 16px;
    overflow: hidden;
}

.study-progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: var(--radius-progress);
    transition: width 0.3s ease;
}

/* === SEARCH BAR === */
.search-bar {
    height: 44px;
    background: var(--bg-surface);
    border: 2px solid var(--ink);
    border-radius: var(--radius-btn);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 14px;
    margin-bottom: 16px;
}

.search-bar svg {
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.search-bar input {
    background: none;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 13px;
    width: 100%;
}

.search-bar input::placeholder {
    color: var(--text-muted);
}

/* === SECTION HEADERS === */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    margin-top: 24px;
}

.section-label {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    letter-spacing: 1px;
    text-transform: uppercase;
}

.section-count {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 600;
    color: var(--accent);
}

/* === SEGMENT CONTROL === */
.segment-control {
    display: flex;
    height: 44px;
    background: var(--bg-surface);
    border: 2px solid var(--ink);
    border-radius: var(--radius-btn);
    padding: 4px;
    gap: 4px;
    margin-bottom: 20px;
}

.segment-btn {
    flex: 1;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.segment-btn.active {
    background: var(--accent);
    color: var(--text-inverted);
    border: 2px solid var(--ink);
}

/* === METRICS GRID === */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 24px;
}

.metric-card {
    background: var(--bg-surface);
    border: 2px solid var(--ink);
    border-radius: var(--radius-card);
    padding: 16px;
    text-align: center;
}

.metric-label {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 500;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.metric-value {
    font-family: var(--font-sans);
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.metric-sub {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-tertiary);
    margin-top: 4px;
}

.metric-sub.positive { color: var(--accent); }

/* === WEEKLY ACTIVITY === */
.week-card {
    background: var(--bg-surface);
    border: 2px solid var(--ink);
    border-radius: var(--radius-card);
    padding: 16px;
    margin-bottom: 24px;
}

.week-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.week-row:last-child { margin-bottom: 0; }

.week-day {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-tertiary);
    width: 16px;
    text-align: center;
    flex-shrink: 0;
}

.week-bar-track {
    flex: 1;
    height: 8px;
    background: var(--bg-inset);
    border-radius: 4px;
    overflow: hidden;
}

.week-bar-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.week-count {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-secondary);
    width: 24px;
    text-align: right;
    flex-shrink: 0;
}

/* === ANSWER DISTRIBUTION === */
.answer-dist-card {
    background: var(--bg-surface);
    border: 2px solid var(--ink);
    border-radius: var(--radius-card);
    padding: 16px;
}

.answer-dist-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.answer-dist-row:last-child { margin-bottom: 0; }

.answer-dist-label {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 600;
    width: 50px;
    flex-shrink: 0;
}

.answer-dist-bar-track {
    flex: 1;
    height: 8px;
    background: var(--bg-inset);
    border-radius: 4px;
    overflow: hidden;
}

.answer-dist-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s ease;
}

.answer-dist-pct {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-tertiary);
    width: 32px;
    text-align: right;
    flex-shrink: 0;
}

.dist-again .answer-dist-label { color: var(--error); }
.dist-again .answer-dist-bar-fill { background: var(--error); }
.dist-hard .answer-dist-label { color: var(--warning); }
.dist-hard .answer-dist-bar-fill { background: var(--warning); }
.dist-good .answer-dist-label { color: var(--accent); }
.dist-good .answer-dist-bar-fill { background: var(--accent); }
.dist-easy .answer-dist-label { color: var(--success); }
.dist-easy .answer-dist-bar-fill { background: var(--success); }

/* === FORMS === */
.form-label {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-secondary);
    letter-spacing: 1px;
    text-transform: uppercase;
    display: block;
    margin-bottom: 8px;
}

.form-field {
    width: 100%;
    background: var(--bg-surface);
    border: 2px solid var(--ink);
    border-radius: var(--radius-btn);
    padding: 12px 16px;
    font-family: var(--font-sans);
    font-size: 14px;
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.2s;
    resize: none;
}

.form-field:focus {
    border-color: var(--accent);
}

.form-field::placeholder {
    color: var(--text-muted);
}

.form-field-lg {
    min-height: 120px;
    font-size: 20px;
    font-weight: 600;
}

.form-group {
    margin-bottom: 20px;
}

/* Select dropdown */
.form-select {
    width: 100%;
    height: 48px;
    background: var(--bg-surface);
    border: 2px solid var(--ink);
    border-radius: var(--radius-btn);
    padding: 0 16px;
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%231D1F27' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    cursor: pointer;
    transition: border-color 0.2s;
}

.form-select:focus {
    border-color: var(--accent);
}

.form-select option {
    background: var(--bg-surface);
    color: var(--text-primary);
}

/* Dark-mode chevron: light stroke so the arrow stays visible */
:root[data-theme="dark"] .form-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23ECECE6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .form-select {
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23ECECE6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    }
}

/* AI button */
.ai-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px 16px;
    background: var(--yellow-highlight);
    border: 2px solid var(--ink);
    border-radius: var(--radius-btn);
    color: var(--ink);
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.1s;
    margin-bottom: 20px;
    box-shadow: 2px 2px 0 var(--ink);
}

.ai-btn:active { transform: translate(1px, 1px); box-shadow: 1px 1px 0 var(--ink); }
.ai-btn svg { width: 14px; height: 14px; }

/* Tags row in form */
.tags-form-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.add-tag-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: var(--bg-surface);
    border: 2px dashed var(--ink);
    border-radius: var(--radius-pill);
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-secondary);
    cursor: pointer;
}

.add-tag-btn svg { width: 12px; height: 12px; }

/* === LIST ITEMS (Languages, Tags, Cards) === */
.list-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-surface);
    border: 2px solid var(--ink);
    border-radius: var(--radius-btn);
    transition: background 0.2s;
}

.list-item:active { background: var(--bg-inset); }

.list-item-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.list-item-title {
    font-family: var(--font-sans);
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.list-item-sub {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-tertiary);
}

.list-item-actions {
    display: flex;
    gap: 4px;
    align-items: center;
    flex-shrink: 0;
}

.list-item-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    flex-shrink: 0;
    margin-left: 12px;
}

.list-item-due {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-tertiary);
}

.list-item-status {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-muted);
}

.btn-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-btn);
    transition: color 0.2s, background 0.2s;
}

.btn-icon:active { background: var(--bg-inset); }
.btn-icon svg { width: 16px; height: 16px; }
.btn-icon.danger:active { color: var(--error); }

/* === DECKS SCREEN === */
.decks-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* === CARD LIST IN DECK DETAIL === */
.card-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* === PROFILE SCREEN === */
.profile-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 24px;
}

.profile-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg-surface);
    border: 2px solid var(--ink);
    border-radius: var(--radius-btn);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.1s;
    width: 100%;
    text-align: left;
    box-shadow: 2px 2px 0 var(--ink);
}

.profile-menu-item:active { transform: translate(1px, 1px); box-shadow: 1px 1px 0 var(--ink); }
.profile-menu-item svg { width: 20px; height: 20px; color: var(--text-secondary); }

.profile-menu-item .chevron {
    margin-left: auto;
    color: var(--text-muted);
}

.profile-menu-item .chevron svg { width: 16px; height: 16px; }

/* Settings section */
.settings-section {
    margin-top: 24px;
}

.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: var(--bg-surface);
    border: 2px solid var(--ink);
    border-radius: var(--radius-btn);
    margin-bottom: 8px;
}

.setting-label {
    font-size: 14px;
    color: var(--text-primary);
}

.setting-input {
    width: 70px;
    height: 36px;
    background: var(--bg-surface);
    border: 2px solid var(--ink);
    border-radius: 6px;
    padding: 0 10px;
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
    outline: none;
}

.setting-input:focus { border-color: var(--accent); }

/* Toggle switch */
.toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--text-muted);
    border-radius: 12px;
    transition: background 0.2s;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: transform 0.2s;
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--accent);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(20px);
}

/* === HOME SCREEN === */
.home-section {
    margin-bottom: 24px;
}

.study-mode-toggle {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.mode-btn {
    flex: 1;
    padding: 10px 8px;
    border: 2px solid var(--ink);
    border-radius: var(--radius-btn);
    background: var(--bg-surface);
    color: var(--text-tertiary);
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
    box-shadow: 2px 2px 0 var(--ink);
}

.mode-btn.active {
    background: var(--accent);
    color: var(--text-inverted);
}

.mode-btn:active { transform: translate(1px, 1px); box-shadow: 1px 1px 0 var(--ink); }

/* Due summary */
.due-summary {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.due-stat {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-mono);
    font-size: 12px;
}

/* === MODALS === */
.modal {
    position: fixed;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: flex-end;
    z-index: 200;
    padding: 20px;
}

.modal.hidden { display: none; }

.modal-content {
    background: var(--bg-surface);
    border: 2px solid var(--ink);
    border-radius: var(--radius-card) var(--radius-card) 0 0;
    width: 100%;
    max-width: 400px;
    max-height: 80vh;
    overflow-y: auto;
    padding: 24px 20px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-title {
    font-family: var(--font-sans);
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-btn);
}

.modal-close svg { width: 18px; height: 18px; }

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.modal-actions .btn-primary { flex: 1; }
.modal-actions .btn-outline { flex: 1; }

/* === EMPTY STATE === */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: calc(100dvh - var(--tab-bar-height) - var(--safe-bottom) - 180px);
}

.empty-state svg {
    width: 48px;
    height: 48px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.empty-state h3 {
    font-family: var(--font-sans);
    font-size: 16px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 13px;
    color: var(--text-muted);
}

.empty-state .owl-mascot {
    width: 120px;
    height: auto;
    margin-bottom: 12px;
}

/* === TOAST === */
.toast-container {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
}

.toast {
    padding: 12px 24px;
    border-radius: var(--radius-btn);
    color: #fff;
    font-size: 13px;
    font-family: var(--font-mono);
    border: 2px solid var(--ink);
    box-shadow: 3px 3px 0 var(--ink);
    opacity: 0;
    transition: opacity 0.3s;
    max-width: 90vw;
    text-align: center;
}

.toast.success { background: var(--success); }
.toast.error { background: var(--error); }
.toast.celebration {
    background: linear-gradient(135deg, #F59E0B, #EF4444, #8B5CF6);
    font-weight: 600;
    font-size: 14px;
    padding: 14px 28px;
}

/* Achievement popup */
.achievement-popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}
.achievement-popup-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}
.achievement-popup-overlay.hidden { display: none; }
.achievement-popup {
    background: var(--yellow-highlight);
    border: 2px solid var(--ink);
    border-radius: var(--radius-card);
    padding: 32px 40px;
    text-align: center;
    box-shadow: 4px 4px 0 var(--ink);
    animation: achievementBounce 0.5s ease;
}
.achievement-popup-icon {
    font-size: 48px;
    margin-bottom: 12px;
}
.achievement-popup-title {
    font-family: var(--font-mono);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--accent);
    margin-bottom: 8px;
    font-weight: 600;
}
.achievement-popup-name {
    font-family: var(--font-sans);
    font-size: 18px;
    font-weight: 700;
    color: var(--ink);
}
@keyframes achievementBounce {
    0% { transform: scale(0.5); opacity: 0; }
    60% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

/* === ADD LANGUAGE FORM === */
.add-form-row {
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 16px 0;
}

.add-form-row .form-field {
    flex: 1;
}

.add-form-row .form-field-sm {
    width: 60px;
    flex: none;
}

/* === ARCHIVE BUTTON === */
.archive-btn-container {
    text-align: center;
    margin-top: 12px;
}

.archive-btn-container.hidden { display: none; }

/* === GLOBAL SPINNER === */
.global-spinner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(29, 31, 39, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(2px);
}
.global-spinner .spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--bg-surface);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* === DANGER BUTTON === */
.btn-outline.danger,
.btn-icon.danger { color: var(--error); }
.btn-outline.danger:hover { background: rgba(239, 68, 68, 0.1); }

/* === LANGUAGE PICKER === */
.lang-picker-trigger {
    width: 100%;
    height: 48px;
    background: var(--bg-surface);
    border: 2px solid var(--ink);
    border-radius: var(--radius-btn);
    padding: 0 16px;
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    outline: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    text-align: left;
    transition: border-color 0.2s;
}

.lang-picker-trigger:active { border-color: var(--accent); }

.lang-picker-trigger svg {
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.lang-picker-trigger .lang-picker-label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lang-picker-trigger[data-code=""] .lang-picker-label {
    color: var(--text-muted);
}

.lang-picker-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 300;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.lang-picker-overlay.hidden { display: none; }

.lang-picker-sheet {
    background: var(--bg-primary);
    border: 2px solid var(--ink);
    border-radius: var(--radius-card) var(--radius-card) 0 0;
    width: 100%;
    max-width: 480px;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.25s ease;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.lang-picker-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px 8px;
    flex-shrink: 0;
}

.lang-picker-search {
    height: 44px;
    background: var(--bg-surface);
    border: 2px solid var(--ink);
    border-radius: var(--radius-btn);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 14px;
    margin: 8px 20px 12px;
    flex-shrink: 0;
}

.lang-picker-search svg {
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.lang-picker-search input {
    background: none;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 13px;
    width: 100%;
}

.lang-picker-search input::placeholder {
    color: var(--text-muted);
}

.lang-picker-list {
    overflow-y: auto;
    flex: 1;
    padding: 0 20px 20px;
    -webkit-overflow-scrolling: touch;
}

.lang-picker-section-label {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 500;
    color: var(--text-muted);
    letter-spacing: 1px;
    text-transform: uppercase;
    padding: 12px 0 6px;
    display: block;
}

.lang-picker-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: var(--radius-btn);
    cursor: pointer;
    transition: background 0.15s;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 14px;
}

.lang-picker-item:active { background: var(--bg-surface); }

.lang-picker-item-code {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
    width: 28px;
    text-align: center;
    flex-shrink: 0;
    text-transform: uppercase;
}

.lang-picker-item-name {
    flex: 1;
    min-width: 0;
}

.lang-picker-item-english {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    display: block;
}

.lang-picker-item-native {
    font-size: 12px;
    color: var(--text-tertiary);
    display: block;
}

.lang-picker-item-check {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    color: var(--accent);
    display: none;
}

.lang-picker-item.selected .lang-picker-item-check {
    display: block;
}

/* === UTILITY === */
.hidden { display: none !important; }
.text-accent { color: var(--accent); }
.text-mono { font-family: var(--font-mono); }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.gap-12 { gap: 12px; }

/* Gamification Bar */
.gamification-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  background: var(--bg-surface);
  border: 2px solid var(--ink);
  border-radius: var(--radius-btn);
  margin: 0 16px 16px;
  flex-wrap: wrap;
}

.gamification-stat {
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.gamification-icon {
  font-size: 16px;
}

.daily-progress-bar {
  flex: 1;
  min-width: 60px;
  height: 6px;
  background: var(--bg-inset);
  border-radius: 3px;
  overflow: hidden;
}

.daily-progress-fill {
  height: 100%;
  background: var(--success);
  border-radius: 3px;
  transition: width 0.5s ease;
}

.daily-progress-text {
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--text-tertiary);
  white-space: nowrap;
}

/* Type Answer Mode */
.type-answer-area {
  padding: 0 16px;
  margin-bottom: 16px;
}

.type-answer-area .form-input {
  font-size: 18px;
  text-align: center;
  padding: 16px;
}

.type-answer-result {
  padding: 12px 16px;
  border-radius: var(--radius-btn);
  margin-top: 12px;
  font-size: 15px;
  font-family: var(--font-sans);
  font-weight: 600;
  text-align: center;
}

.type-answer-result.correct {
  background: rgba(48, 164, 108, 0.1);
  color: var(--success);
  border: 2px solid var(--success);
}

.type-answer-result.incorrect {
  background: rgba(239, 68, 68, 0.1);
  color: var(--error);
  border: 2px solid var(--error);
}

.type-answer-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.type-answer-actions .btn-secondary,
.type-answer-actions .btn-primary {
  flex: 1;
}

/* Achievements */
.achievements-list {
  padding: 16px;
}

.achievement-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-surface);
  border: 2px solid var(--ink);
  border-radius: var(--radius-btn);
  margin-bottom: 8px;
}

.achievement-item.locked {
  opacity: 0.5;
}

.achievement-item.unlocked {
  border-left: 4px solid var(--yellow-highlight);
  background: rgba(255, 225, 125, 0.1);
}

.achievement-icon {
  font-size: 28px;
  flex-shrink: 0;
}

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

.achievement-name {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 15px;
  color: var(--text-primary);
}

.achievement-desc {
  font-size: 13px;
  color: var(--text-tertiary);
  margin-top: 2px;
}

.achievement-date {
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--text-tertiary);
  white-space: nowrap;
}

/* Subscription */
.subscription-section {
  padding: 16px;
  background: var(--bg-surface);
  border: 2px solid var(--ink);
  border-radius: var(--radius-btn);
}

.subscription-status {
  font-size: 14px;
  color: var(--text-tertiary);
  margin-bottom: 12px;
}

.subscription-status.premium {
  color: var(--accent);
  font-weight: 600;
}

/* Activity Heatmap */
.activity-heatmap {
  padding: 0 16px;
  overflow-x: auto;
}

.heatmap-grid {
  display: grid;
  grid-template-columns: repeat(52, 12px);
  grid-template-rows: repeat(7, 12px);
  gap: 2px;
  grid-auto-flow: column;
}

.heatmap-cell {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  background: var(--bg-inset);
  border: 1px solid var(--divider);
}

.heatmap-cell.level-1 { background: rgba(48, 164, 108, 0.25); border-color: transparent; }
.heatmap-cell.level-2 { background: rgba(48, 164, 108, 0.5); border-color: transparent; }
.heatmap-cell.level-3 { background: rgba(48, 164, 108, 0.75); border-color: transparent; }
.heatmap-cell.level-4 { background: var(--success); border-color: transparent; }

/* Extract words / AI recommendations */
.modal-content-lg {
    max-height: 85vh;
    overflow-y: auto;
}
.extract-results { margin-top: 16px; }
.extract-words-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 40vh;
    overflow-y: auto;
}
.extract-word-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: var(--bg-inset);
    border-radius: var(--radius-btn);
    cursor: pointer;
}
.extract-word-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    flex: none;
    accent-color: var(--accent);
}
.extract-word-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}
.extract-word-front {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
}
.extract-word-back {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Language stats */
.language-stats-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.language-stat-row {
    background: var(--bg-surface);
    border: 2px solid var(--ink);
    border-radius: var(--radius-card);
    padding: 14px 16px;
}
.language-stat-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.language-stat-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
}
.language-stat-meta {
    font-size: 12px;
    color: var(--text-secondary);
    font-family: var(--font-mono);
}
.language-stat-bar-track {
    height: 6px;
    background: var(--bg-inset);
    border-radius: var(--radius-progress);
    overflow: hidden;
}
.language-stat-bar-fill {
    height: 100%;
    background: var(--accent);
    border-radius: var(--radius-progress);
    transition: width 0.4s ease;
}

/* === IMPORT MODAL === */
.import-drop-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 20px;
    border: 2px dashed var(--ink);
    border-radius: var(--radius-card);
    text-align: center;
    transition: border-color 0.2s, background 0.2s;
}
.import-drop-zone.dragover {
    border-color: var(--accent);
    background: rgba(255, 225, 125, 0.2);
}
.import-drop-zone svg {
    width: 40px;
    height: 40px;
    color: var(--text-muted);
    margin-bottom: 12px;
}
.import-drop-text {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 4px;
}
.import-drop-hint {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
}
.import-summary {
    background: var(--bg-inset);
    border-radius: var(--radius-btn);
    padding: 14px 16px;
    margin-bottom: 16px;
}
.import-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
}
.import-summary-label {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-tertiary);
}
.import-summary-value {
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}
.import-cards-list {
    max-height: 240px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 16px;
    border-radius: var(--radius-btn);
    overflow-x: hidden;
}
.import-card-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: var(--bg-inset);
    min-height: 44px;
}
.import-card-item:first-child { border-radius: var(--radius-btn) var(--radius-btn) 0 0; }
.import-card-item:last-child { border-radius: 0 0 var(--radius-btn) var(--radius-btn); }
.import-card-item:only-child { border-radius: var(--radius-btn); }
.import-card-front {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.import-card-back {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-tertiary);
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: right;
}
.import-card-arrow {
    color: var(--text-muted);
    flex-shrink: 0;
    font-size: 12px;
}

/* === IMAGE UPLOAD === */
.image-upload-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 24px;
    border: 2px dashed var(--ink);
    border-radius: var(--radius-card);
    cursor: pointer;
    color: var(--text-secondary);
    transition: border-color 0.2s, color 0.2s;
}
.image-upload-area:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.card-image-preview {
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.card-image-thumb {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: var(--radius-btn);
}
.btn-sm {
    padding: 4px 10px;
    font-size: 12px;
}
.flashcard-image {
    width: 100%;
    max-height: 180px;
    object-fit: contain;
    border-radius: var(--radius-btn);
    margin-bottom: 8px;
}

/* Owl mascot shared styles */
.owl-mascot {
    width: 100px;
    height: auto;
    margin: 0 auto 12px;
    display: block;
}
