/* ── Dark theme (default) ─────────────────────────────────────────────────── */
:root,
[data-theme="dark"] {
    --bg:        #0d1117;
    --bg2:       #161b27;
    --bg3:       #1f2937;
    --border:    #2d3d52;
    --text:      #f0f6ff;
    --muted:     #8fafc8;        /* 5.1:1 on --bg2, 4.6:1 on --bg3 ✓ */
    --sub:       #c4d6e8;        /* body text on dark bg — 7.2:1 on --bg2 ✓ */
    --primary:   #38bdf8;
    --primary-d: #0ea5e9;
    --success:   #34d399;
    --error:     #f87171;
    --warning:   #fbbf24;
    --purple:    #a78bfa;
    --card-glow: rgba(56,189,248,.06);
}

/* ── Light theme ──────────────────────────────────────────────────────────── */
[data-theme="light"] {
    --bg:        #f0f4f8;
    --bg2:       #ffffff;
    --bg3:       #e8eef5;
    --border:    #c4d0dc;
    --text:      #0d1b2a;        /* 19:1 on white ✓ */
    --muted:     #3d5a73;        /* 6.5:1 on white ✓ */
    --sub:       #1a3348;        /* 12:1 on white ✓ */
    --primary:   #0369a1;        /* 5.2:1 on white ✓ */
    --primary-d: #025e8e;
    --success:   #06764e;
    --error:     #b91c1c;
    --warning:   #b45309;
    --purple:    #5b21b6;
    --card-glow: rgba(3,105,161,.04);
}

/* ── Reset ────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    min-height: 100vh;
    transition: background .25s, color .25s;
}

/* ── Navbar ───────────────────────────────────────────────────────────────── */
.navbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0 1.5rem;
    height: 54px;
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 200;
}

.nav-logo {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--primary);
    text-decoration: none;
    letter-spacing: -.02em;
    margin-right: auto;
}

.nav-links { display: flex; gap: .25rem; align-items: center; }

.nav-links a {
    color: var(--muted);
    text-decoration: none;
    padding: .35rem .7rem;
    border-radius: 6px;
    font-size: .875rem;
    font-weight: 500;
    transition: color .15s, background .15s;
}
.nav-links a:hover { color: var(--text); background: var(--bg3); }
.nav-links a.active { color: var(--primary); background: var(--bg3); }

.nav-right { display: flex; align-items: center; gap: .5rem; }
.nav-user { color: var(--muted); font-size: .8rem; white-space: nowrap; }

.btn-ghost {
    background: none;
    border: 1px solid var(--border);
    color: var(--muted);
    padding: .3rem .7rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: .8rem;
    font-weight: 500;
    transition: color .15s, border-color .15s;
}
.btn-ghost:hover { color: var(--error); border-color: var(--error); }

/* Theme toggle */
#themeBtn {
    background: var(--bg3);
    border: 1px solid var(--border);
    color: var(--text);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background .15s;
}
#themeBtn:hover { background: var(--bg); }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: .6rem 1.25rem;
    font-size: .9rem;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    transition: background .15s, opacity .15s;
}
[data-theme="dark"] .btn-primary { color: #0d1117; }
.btn-primary:hover { background: var(--primary-d); }

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--bg3);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: .6rem 1.25rem;
    font-size: .9rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background .15s;
}
.btn-secondary:hover { background: var(--bg); }

/* ── Auth page ────────────────────────────────────────────────────────────── */
.auth-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 2rem;
    background: var(--bg);
}

.auth-container {
    width: 100%;
    max-width: 400px;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 2rem;
    box-shadow: 0 4px 32px var(--card-glow);
}

.logo { text-align: center; margin-bottom: 2rem; }
.logo-icon { font-size: 2.5rem; display: block; }
.logo h1 { font-size: 2rem; font-weight: 800; color: var(--primary); margin-top: .25rem; }
.tagline { color: var(--muted); font-size: .9rem; margin-top: .25rem; }

.tabs { display: flex; gap: .5rem; margin-bottom: 1.5rem; }
.tab {
    flex: 1;
    padding: .5rem;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--muted);
    cursor: pointer;
    font-size: .875rem;
    font-weight: 600;
    transition: all .15s;
}
.tab.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}
[data-theme="dark"] .tab.active { color: #0d1117; }

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

.form-group { display: flex; flex-direction: column; gap: .35rem; }
.form-group label { font-size: .8rem; font-weight: 600; color: var(--sub); letter-spacing: .02em; }
.form-group input {
    background: var(--bg3);
    border: 1.5px solid var(--border);
    border-radius: 8px;
    padding: .6rem .85rem;
    color: var(--text);
    font-size: .95rem;
    outline: none;
    transition: border-color .15s;
}
.form-group input:focus { border-color: var(--primary); }
.form-group input::placeholder { color: var(--muted); }

.cheh-banner {
    background: color-mix(in srgb, var(--error) 12%, var(--bg2));
    border: 1px solid var(--error);
    color: var(--error);
    border-radius: 8px;
    padding: .65rem 1rem;
    font-size: .88rem;
    font-weight: 600;
    text-align: center;
    margin-bottom: 1rem;
}

.form-error { color: var(--error); font-size: .82rem; min-height: 1.1em; font-weight: 500; }
.form-success { color: var(--success); font-size: .82rem; font-weight: 500; }

/* ── Stat boxes ───────────────────────────────────────────────────────────── */
.stat-box {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: .9rem 1.6rem;
    text-align: center;
    min-width: 100px;
    box-shadow: 0 2px 8px var(--card-glow);
}
.stat-value {
    display: block;
    font-size: 1.9rem;
    font-weight: 800;
    color: var(--primary);
    font-variant-numeric: tabular-nums;
    line-height: 1;
}
.stat-value.danger { color: var(--error); }
#timerBox .stat-value.danger { animation: blink .5s ease-in-out infinite; }
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:.4} }
.stat-label { color: var(--muted); font-size: .75rem; font-weight: 600; margin-top: .3rem; text-transform: uppercase; letter-spacing: .06em; }


/* ── Word display TFF style ──────────────────────────────────────────────── */
.words-wrapper {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 10px;
    height: 155px;
    overflow: hidden;
    margin-bottom: .85rem;
    position: relative;
}

.words-scroll {
    height: 100%;
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.words-scroll::-webkit-scrollbar { display: none; }

.words-inner {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem .65rem;
    padding: .9rem 1.4rem;
    font-size: 1.2rem;
    line-height: 1.8;
}

.word { color: var(--muted); border-radius: 3px; white-space: nowrap; cursor: default; }
.word.current { color: var(--text); border-bottom: 2px solid var(--primary); }
.word.done.ok { color: var(--success); }
.word.done.err { color: var(--error); text-decoration: line-through; text-decoration-color: var(--error); }
.word .correct { color: var(--success); }
.word .wrong { color: var(--error); }
.word .pending { color: var(--muted); }
.word .extra { color: var(--error); font-style: italic; opacity: .8; }

/* ── Game input ───────────────────────────────────────────────────────────── */
.game-input.input-flash-error {
    border-color: var(--error) !important;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--error) 20%, transparent) !important;
    animation: flashErr .3s ease;
}
@keyframes flashErr {
    0%   { border-color: var(--error); }
    100% { border-color: var(--border); }
}

/* ── Ban overlay ──────────────────────────────────────────────────────────── */
.ban-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.88);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 500;
}
.ban-overlay.hidden { display: none; }

.ban-card {
    background: var(--bg2);
    border: 2px solid var(--error);
    border-radius: 18px;
    padding: 2.5rem 3rem;
    text-align: center;
    max-width: 460px;
    width: 90%;
    box-shadow: 0 8px 48px color-mix(in srgb, var(--error) 30%, transparent);
    animation: banPop .3s cubic-bezier(.34,1.56,.64,1);
}
@keyframes banPop { from { transform: scale(.7); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.ban-emoji { font-size: 3.5rem; margin-bottom: .75rem; }
.ban-card h2 { color: var(--error); font-size: 1.25rem; font-weight: 800; margin-bottom: .6rem; line-height: 1.3; }
.ban-card p  { color: var(--sub); margin-bottom: 1rem; }
#banTimer    { font-size: 3rem; font-weight: 800; color: var(--error); display: block; margin-bottom: 1rem; font-variant-numeric: tabular-nums; }

.ban-progress-track {
    background: var(--bg3);
    border-radius: 99px;
    height: 7px;
    overflow: hidden;
}
.ban-progress-bar {
    height: 100%;
    background: var(--error);
    border-radius: 99px;
    transition: width 1s linear;
}

.game-input {
    width: 100%;
    background: var(--bg2);
    border: 2px solid var(--border);
    border-radius: 10px;
    padding: .85rem 1.2rem;
    color: var(--text);
    font-size: 1.05rem;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
    font-family: inherit;
}
.game-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 15%, transparent); }
.game-input:disabled { opacity: .45; cursor: not-allowed; }
.game-input::placeholder { color: var(--muted); }

/* ── Game page ────────────────────────────────────────────────────────────── */
.game-main { padding: 1.75rem 1.5rem; display: flex; justify-content: center; }
.game-container { width: 100%; max-width: 840px; }
.game-header { display: flex; gap: 1rem; margin-bottom: 1.5rem; justify-content: center; flex-wrap: wrap; }

/* ── Result panel ─────────────────────────────────────────────────────────── */
.result-panel {
    margin-top: 1.5rem;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 2rem;
    text-align: center;
    box-shadow: 0 4px 24px var(--card-glow);
}
.result-panel.hidden { display: none; }
.result-panel h2 { font-size: 1.4rem; font-weight: 800; margin-bottom: 1.5rem; color: var(--primary); }
.result-grid { display: flex; gap: 2rem; justify-content: center; margin-bottom: 1.75rem; flex-wrap: wrap; }
.result-item { display: flex; flex-direction: column; align-items: center; gap: .3rem; }
.result-value { font-size: 2.1rem; font-weight: 800; color: var(--text); line-height: 1; }
.result-item.result-global .result-value { color: var(--purple); font-size: 2.5rem; }
.result-label { color: var(--muted); font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.result-actions { display: flex; gap: .75rem; justify-content: center; flex-wrap: wrap; }

/* ── Leaderboard ──────────────────────────────────────────────────────────── */
.leaderboard-main, .profile-main, .reference-main { padding: 1.75rem 1.5rem; max-width: 900px; margin: 0 auto; }

.page-title { font-size: 1.5rem; font-weight: 800; margin-bottom: 1.25rem; color: var(--text); }
.page-subtitle { color: var(--muted); font-size: .9rem; margin-bottom: 1.75rem; }
.highlight { color: var(--primary); }

.lb-tabs { display: flex; gap: .5rem; margin-bottom: 1.25rem; }
.lb-tab {
    padding: .45rem 1.1rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg2);
    color: var(--muted);
    cursor: pointer;
    font-size: .85rem;
    font-weight: 600;
    transition: all .15s;
}
.lb-tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }
[data-theme="dark"] .lb-tab.active { color: #0d1117; }

.lb-table-container { background: var(--bg2); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.lb-table { width: 100%; border-collapse: collapse; }
.lb-table th {
    background: var(--bg3);
    color: var(--sub);
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    padding: .75rem 1.1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
.lb-table td {
    padding: .7rem 1.1rem;
    border-top: 1px solid var(--border);
    font-size: .9rem;
    color: var(--text);
}
.lb-table tr.is-me td { background: color-mix(in srgb, var(--primary) 8%, transparent); }
.lb-table .rank { font-weight: 800; width: 56px; color: var(--muted); }
.lb-table .val { color: var(--primary); font-weight: 700; text-align: right; }
.lb-table .empty { text-align: center; color: var(--muted); padding: 2rem; }
.you-badge {
    background: var(--primary);
    color: #fff;
    font-size: .65rem;
    padding: .1rem .4rem;
    border-radius: 4px;
    font-weight: 800;
    margin-left: .4rem;
    vertical-align: middle;
}
[data-theme="dark"] .you-badge { color: #0d1117; }
.loading { text-align: center; color: var(--muted); padding: 2rem; }

/* ── Profile ──────────────────────────────────────────────────────────────── */
.stats-summary { display: flex; gap: 1rem; margin-bottom: 1.75rem; flex-wrap: wrap; }
.stat-card {
    flex: 1;
    min-width: 110px;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: .25rem;
    box-shadow: 0 2px 8px var(--card-glow);
}
.stat-card span:first-child { font-size: 1.5rem; font-weight: 800; color: var(--primary); }
.stat-card span:last-child { color: var(--muted); font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }

.charts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; margin-bottom: 1.75rem; }
.chart-wide { grid-column: 1 / -1; }
.chart-box {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.1rem;
    box-shadow: 0 2px 8px var(--card-glow);
}
.chart-box h3 { font-size: .72rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .07em; margin-bottom: .9rem; }

.history-box {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
}
.history-box h3 {
    padding: .9rem 1.1rem;
    font-size: .72rem;
    color: var(--muted);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    border-bottom: 1px solid var(--border);
}
.empty { text-align: center; color: var(--muted); padding: 2.5rem; }

/* ── Reference page ───────────────────────────────────────────────────────── */
.reference-layout { display: flex; flex-direction: column; gap: 2rem; }

.ref-section-title {
    font-size: .78rem;
    color: var(--muted);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    margin-bottom: 1rem;
    padding-bottom: .5rem;
    border-bottom: 1px solid var(--border);
}

.ref-keyboard-section {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px var(--card-glow);
}
.ref-keyboard-section .keyboard-visual { border: none; background: transparent; padding: 0; }

.home-row-note {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-left: 3px solid var(--primary);
    border-radius: 8px;
    padding: .8rem 1rem;
    font-size: .85rem;
    color: var(--sub);
    margin-top: 1rem;
    line-height: 1.6;
}

.legend-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); gap: .6rem; }
.legend-item {
    display: flex;
    align-items: center;
    gap: .7rem;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: .55rem .8rem;
}
.legend-dot { width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0; }
.legend-item strong { display: block; font-size: .82rem; color: var(--text); font-weight: 700; }
.legend-item span { font-size: .72rem; color: var(--muted); }

.tips-list {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem 1.4rem;
    display: flex;
    flex-direction: column;
    gap: .6rem;
    list-style: none;
}
.tips-list li {
    font-size: .88rem;
    color: var(--sub);
    padding-left: 1.3rem;
    position: relative;
    line-height: 1.55;
}
.tips-list li::before { content: '→'; position: absolute; left: 0; color: var(--primary); font-weight: 700; }
.tips-list a { color: var(--primary); text-decoration: none; font-weight: 600; }
.tips-list strong { color: var(--text); }

/* ── Training page ────────────────────────────────────────────────────────── */
.training-main { padding: 1.5rem; display: flex; justify-content: center; }
.training-container { width: 100%; max-width: 860px; }
.training-header {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    justify-content: center;
    flex-wrap: wrap;
    align-items: center;
}
.training-controls { display: flex; gap: .75rem; justify-content: center; margin-top: 1.25rem; }

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
    .navbar { padding: 0 1rem; }
    .nav-user { display: none; }
    .game-header { gap: .6rem; }
    .stat-box { padding: .7rem 1rem; min-width: 80px; }
    .stat-value { font-size: 1.5rem; }
    .charts-grid { grid-template-columns: 1fr; }
    .chart-wide { grid-column: auto; }
    .result-grid { gap: 1.25rem; }
}

/* ── Mode selection screen ─────────────────────────────────────────────────── */
.mode-select-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    padding: 3rem 0 2rem;
}

.mode-select-title {
    font-size: .82rem;
    color: var(--muted);
    font-weight: 600;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.mode-cards {
    display: flex;
    gap: 1.25rem;
    width: 100%;
}

.mode-card {
    flex: 1;
    border-radius: 16px;
    padding: 2.5rem 1.75rem 2.25rem;
    cursor: pointer;
    will-change: transform;
    transition: transform .3s ease, box-shadow .3s ease;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    user-select: none;
    border: 2px solid transparent;
}

/* ── Carte Normal : blanc lumineux ── */
.mode-card--normal {
    background: #ffffff;
    border-color: #dde6f0;
    box-shadow: 0 4px 24px rgba(0,0,0,.12);
}
.mode-card--normal .mode-card-icon { color: #0369a1; }
.mode-card--normal .mode-card-name { color: #0f172a; }
.mode-card--normal .mode-card-desc { color: #475569; }
.mode-card--normal .mode-card-tag  { background: #f1f5f9; border: 1px solid #cbd5e1; color: #64748b; }
.mode-card--normal:hover { border-color: #0369a1; box-shadow: 0 16px 48px rgba(3,105,161,.25); }

/* ── Carte Commandes Linux : rouge sombre ── */
.mode-card--cmd {
    background: #180606;
    border-color: #7f1d1d;
    box-shadow: 0 4px 24px rgba(239,68,68,.12);
}
.mode-card--cmd .mode-card-icon { color: #ef4444; }
.mode-card--cmd .mode-card-name { color: #fef2f2; }
.mode-card--cmd .mode-card-desc { color: #fca5a5; }
.mode-card--cmd .mode-card-tag  { background: #2d0a0a; border: 1px solid #991b1b; color: #fca5a5; }
.mode-card--cmd:hover { border-color: #ef4444; box-shadow: 0 16px 48px rgba(239,68,68,.3); }

.mode-card-icon {
    font-size: 2.8rem;
    line-height: 1;
    font-family: 'Consolas', 'Courier New', monospace;
}
.mode-card-name {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -.01em;
}
.mode-card-desc {
    font-size: .875rem;
    line-height: 1.55;
    max-width: 200px;
}
.mode-card-tag {
    display: inline-block;
    border-radius: 6px;
    padding: .22rem .75rem;
    font-size: .75rem;
    font-family: 'Consolas', monospace;
    letter-spacing: .05em;
}
.mode-back-btn {
    align-self: flex-start;
    font-size: .8rem;
    color: var(--muted);
    margin-bottom: .6rem;
    padding: .2rem .5rem;
}
.game-area {
    display: flex;
    flex-direction: column;
}

/* ── Command game — lignes dans words-wrapper ─────────────────────────────── */
/* active via classList.add('active') — pas de flex-direction ambigu */
.cmdlines-inner {
    display: none;
    position: absolute;
    inset: 0;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
}
.cmdlines-inner.active { display: block; }

/* Dégradé bas → fondu sur la 4e ligne (peek) */
.cmdlines-inner::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 28px;
    background: linear-gradient(transparent, var(--bg2));
    pointer-events: none;
    z-index: 2;
}

/* Chaque ligne : height explicite (plus fiable que flex-basis dans un container flex) */
.cmdline {
    height: 46px;
    width: 100%;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    padding: 0 1.4rem;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: .92rem;
    white-space: nowrap;
    border-bottom: 1px solid var(--border);
    overflow-x: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.cmdline::-webkit-scrollbar { display: none; }
.cmdline:last-child { border-bottom: none; }
.cmdline:first-child { overflow-x: auto; }

/* Opacités + flou décroissants : courante → peek */
.cmdline:nth-child(1) { opacity: 1; }
.cmdline:nth-child(2) { opacity: .5;  filter: blur(.4px); }
.cmdline:nth-child(3) { opacity: .25; filter: blur(.9px); }
.cmdline:nth-child(4) { opacity: .12; filter: blur(1.5px); }

/* Caractères */
.cmd-char         { position: relative; white-space: pre; letter-spacing: .01em; cursor: default; }
.cmd-char.pending { color: var(--muted); }
.cmd-char.correct { color: var(--success); }
.cmd-char.wrong   { color: var(--error); }
.cmd-char.extra   { color: var(--error); opacity: .7; }

/* Curseur clignotant — position:absolute pour ne pas décaler les caractères voisins */
.cmd-char.cursor::after {
    content: '';
    position: absolute;
    left: 0;
    top: 10%;
    height: 80%;
    width: 2px;
    background: var(--primary);
    animation: cmdBlink .75s step-end infinite;
    pointer-events: none;
}
@keyframes cmdBlink { 50% { opacity: 0; } }

/* Slide vers le haut lors de la validation d'une ligne */
.cmdlines-inner.slide-up {
    animation: cmdSlideUp .18s cubic-bezier(.4,0,.2,1) forwards;
}
@keyframes cmdSlideUp {
    from { transform: translateY(0); }
    to   { transform: translateY(-46px); }
}

/* Flash validation correcte / incorrecte sur la ligne courante */
.cmdline.flash-ok  { animation: cmdFlashOk  .35s ease; }
.cmdline.flash-err { animation: cmdFlashErr .35s ease; }
@keyframes cmdFlashOk  { 0%{background:transparent} 35%{background:color-mix(in srgb,var(--success) 16%,transparent)} 100%{background:transparent} }
@keyframes cmdFlashErr { 0%{background:transparent} 35%{background:color-mix(in srgb,var(--error)   11%,transparent)} 100%{background:transparent} }
