/* --- CONTAINER DE LA PAGE --- */
.test-page-wrapper {
    padding: clamp(20px, 4vw, 40px) clamp(16px, 5vw, 24px);
    margin-top: 20px;
}

.test-header-bar {
    text-align: center;
    margin-bottom: 30px;
}

.test-header-bar h2 {
    font-size: clamp(24px, 4vw, 36px);
    font-weight: 800;
    margin-bottom: 10px;
    color: var(--text-main);
    letter-spacing: -0.02em;
}

.test-header-bar p {
    color: var(--text-muted);
    font-size: 16px;
    max-width: 700px;
    margin: 0 auto;
}

/* --- STATS & OPTIONS --- */
.keyboard-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    background: rgba(15, 23, 42, 0.05);
    border-bottom: 1px solid var(--border);
    padding: 20px;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    flex-wrap: wrap;
}

.stat-box {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.stat-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-main);
}

.stat-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.stat-actions select {
    padding: 8px 12px;
    height: 38px;
    font-size: 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-main);
    cursor: pointer;
}

.stat-actions button {
    height: 38px;
    padding: 0 16px;
    font-size: 14px;
}

/* --- LE CLAVIER VIRTUEL --- */
.keyboard-test-container {
    padding: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    margin-bottom: 40px;
}

.virtual-keyboard {
    padding: 25px;
    background: #0f172a; /* Toujours fond sombre pour faire ressortir les touches */
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.kb-row {
    display: flex;
    gap: 8px;
    justify-content: center;
    width: 100%;
    min-width: 900px; /* Force l'alignement sur mobile avec scrolling horizontal */
}

/* --- LES TOUCHES --- */
.key {
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    color: #94a3b8;
    height: 52px;
    min-width: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    cursor: default;
    transition: background-color 0.08s ease, color 0.08s ease, border-color 0.08s ease, box-shadow 0.08s ease;
    user-select: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* ÉTAT REÇU (SUCCESS/TESTED) */
.key.tested {
    background: rgba(37, 99, 235, 0.25);
    border-color: var(--primary);
    color: #60a5fa;
    box-shadow: 0 0 8px rgba(37, 99, 235, 0.2);
}

/* ÉTAT ACTIF (PRESSE DYNAMIQUE) */
.key.active {
    background: var(--primary);
    border-color: #60a5fa;
    color: white;
    transform: translateY(1px);
    box-shadow: 0 0 15px rgba(37, 99, 235, 0.6);
}

/* --- TAILLES SPÉCIALES DES TOUCHES --- */
.key-spacer {
    width: 30px;
}

.key-spacer-small {
    width: 15px;
}

.key-esc {
    min-width: 55px;
}

.key-backspace {
    flex-grow: 1;
    min-width: 100px;
}

.key-tab {
    min-width: 75px;
}

.key-backslash {
    min-width: 55px;
}

.key-caps {
    min-width: 90px;
}

.key-enter {
    flex-grow: 1;
    min-width: 105px;
}

.key-shift-left {
    min-width: 120px;
}

.key-shift-right {
    flex-grow: 1;
    min-width: 125px;
}

.key-ctrl {
    min-width: 75px;
}

.key-meta {
    min-width: 60px;
}

.key-alt {
    min-width: 60px;
}

.key-space {
    width: 320px;
    flex-shrink: 0;
}

.key-arrow {
    min-width: 52px;
}

.key-arrow-col {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.key-arrow-col .key-arrow {
    height: 24px;
    min-width: 52px;
    font-size: 11px;
}

/* --- LOGIQUE DE CHANGEMENT DE LAYOUT DYNAMIQUE --- */
.virtual-keyboard.azerty .key[data-key-azerty]::before {
    content: attr(data-key-azerty);
}
.virtual-keyboard.azerty .key[data-key-azerty] {
    font-size: 0; /* Cache le texte original QWERTY */
}
.virtual-keyboard.azerty .key[data-key-azerty]::before {
    font-size: 14px; /* Affiche le texte AZERTY */
}

/* --- DICTIONNAIRE i18n POUR LE FORMULAIRE --- */
[data-i18n="keyboard-test-title"] { font-weight: 800; }
