/* ==========================================================================
   Clavier Phonétique (Type Métalo) - Pleine Page
   École de l'Enfant-Jésus Morlanwelz
   ========================================================================== */

:root {
    --fonetico-primary: #d97706;
    --fonetico-primary-dark: #b45309;
    --fonetico-bg: #fffbeb;
    --fonetico-card-bg: #ffffff;
    --fonetico-border: #fde68a;
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    min-height: 100vh;
    background-color: var(--fonetico-bg);
    font-family: 'Fredoka', 'Comic Neue', 'Nunito', 'Chalkboard SE', cursive, sans-serif;
    color: #1e293b;
    box-sizing: border-box;
}

*, *:before, *:after {
    box-sizing: inherit;
}

/* Wrapper pleine page */
.fonetico-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    width: 100%;
    background-color: var(--fonetico-bg);
}

/* --------------------------------------------------------------------------
   Bannière supérieure (Top Bar)
   -------------------------------------------------------------------------- */
.fonetico-top-bar {
    flex-shrink: 0;
    background: linear-gradient(135deg, #b45309 0%, #d97706 100%);
    padding: 10px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    box-shadow: 0 4px 15px rgba(180, 83, 9, 0.25);
    z-index: 100;
}

.fonetico-title-group {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

/* Bouton Retour au site / aux outils */
.btn-back-site {
    background: rgba(255, 255, 255, 0.95) !important;
    color: #92400e !important;
    font-weight: 800 !important;
    border: 1px solid white !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
    text-decoration: none !important;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.btn-back-site:hover {
    background: white !important;
    color: #78350f !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.fonetico-logo-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.2);
    border: 1.5px solid rgba(255, 255, 255, 0.4);
    padding: 5px 14px;
    border-radius: 20px;
    color: white;
    font-weight: 900;
    font-size: 15px;
    letter-spacing: 0.5px;
}

.fonetico-tagline {
    color: #fef3c7;
    font-size: 14px;
    font-weight: 600;
}

.fonetico-top-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.fonetico-pill-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.22);
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: white;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.fonetico-pill-btn:hover {
    background: rgba(255, 255, 255, 0.35);
    transform: translateY(-1px);
}

/* Zone principale de travail */
.fonetico-main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-width: 1280px;
    width: 100%;
    margin: 0 auto;
    padding: 15px 20px;
}

.clavier-metalo-container {
    padding: 15px;
    font-family: inherit;
    width: 100% !important;
    max-width: 100%;
    height: auto !important;
    float: none !important;
    margin: 0 auto !important;
    background-color: #ffffff;
    border-radius: 20px;
    border: 3px solid #fde68a;
    box-shadow: 0 6px 20px rgba(217, 119, 6, 0.08);
}

.clavier-display-area {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fffdf5;
    border: 2px solid #fcd34d;
    border-radius: 16px;
    padding: 8px 16px;
    margin-bottom: 12px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.04);
}

.clavier-display-input {
    min-height: 35px;
    font-size: 22px;
    font-weight: bold;
    color: #333;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.clavier-phoneme-badge {
    background: #bbdefb;
    border: 2px solid #2196f3;
    color: #0d47a1;
    padding: 3px 10px;
    border-radius: 12px;
}

.clavier-btn-action {
    background: #ff5252;
    color: white;
    border: 3px solid #d32f2f;
    padding: 8px 15px;
    font-size: 16px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: bold;
    font-family: inherit;
    box-shadow: 0 4px 0px #b71c1c;
    transition: transform 0.1s, box-shadow 0.1s;
}

.clavier-btn-action:active {
    transform: translateY(4px);
    box-shadow: 0 0px 0px #b71c1c;
}

.clavier-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
    min-height: 40px;
}

.clavier-suggestion-word {
    background: #81c784;
    color: #1b5e20;
    border: 2px solid #388e3c;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 3px 0px #2e7d32;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    line-height: 1.1;
}

.suggestion-word-text {
    font-size: 18px;
    font-weight: bold;
}

.suggestion-word-nature {
    font-size: 11px;
    font-weight: normal;
    opacity: 0.85;
    margin-top: 1px;
    font-family: inherit;
}

.clavier-suggestion-word:hover {
    transform: translateY(1px);
    box-shadow: 0 2px 0px #2e7d32;
}

/* Couleurs des mots selon leur nature */
/* Vert pour les noms (comportement par défaut jusqu'ici) */
.clavier-suggestion-word.nature-nom {
    background: #81c784;
    color: #1b5e20;
    border-color: #388e3c;
    box-shadow: 0 3px 0px #2e7d32;
}
.clavier-suggestion-word.nature-nom:hover {
    box-shadow: 0 2px 0px #2e7d32;
}

/* Rouge pour les verbes */
.clavier-suggestion-word.nature-verbe {
    background: #ff8a80;
    color: #b71c1c;
    border-color: #d32f2f;
    box-shadow: 0 3px 0px #b71c1c;
}
.clavier-suggestion-word.nature-verbe:hover {
    box-shadow: 0 2px 0px #b71c1c;
}

/* Jaune pour les adjectifs */
.clavier-suggestion-word.nature-adjectif {
    background: #fff59d;
    color: #f57f17;
    border-color: #fbc02d;
    box-shadow: 0 3px 0px #f57f17;
}
.clavier-suggestion-word.nature-adjectif:hover {
    box-shadow: 0 2px 0px #f57f17;
}

/* Mauve pour les adverbes */
.clavier-suggestion-word.nature-adverbe {
    background: #e1bee7;
    color: #4a148c;
    border-color: #8e24aa;
    box-shadow: 0 3px 0px #4a148c;
}
.clavier-suggestion-word.nature-adverbe:hover {
    box-shadow: 0 2px 0px #4a148c;
}

/* Orange pour les pronoms */
.clavier-suggestion-word.nature-pronom {
    background: #ffcc80;
    color: #e65100;
    border-color: #f57c00;
    box-shadow: 0 3px 0px #e65100;
}
.clavier-suggestion-word.nature-pronom:hover {
    box-shadow: 0 2px 0px #e65100;
}

/* Bleu pour les déterminants */
.clavier-suggestion-word.nature-determinant {
    background: #90caf9;
    color: #0d47a1;
    border-color: #1976d2;
    box-shadow: 0 3px 0px #0d47a1;
}
.clavier-suggestion-word.nature-determinant:hover {
    box-shadow: 0 2px 0px #0d47a1;
}

/* Gris pour les autres mots */
.clavier-suggestion-word.nature-autre {
    background: #e0e0e0;
    color: #424242;
    border-color: #9e9e9e;
    box-shadow: 0 3px 0px #616161;
}
.clavier-suggestion-word.nature-autre:hover {
    box-shadow: 0 2px 0px #616161;
}

.clavier-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
    /* Plus compact ! */
}

.clavier-row {
    display: flex;
    flex-direction: row;
    justify-content: center;
    gap: 8px;
    /* Plus compact ! */
}

.clavier-key {
    flex: 1;
    min-width: 0;
    background: #ffffff;
    border: 3px solid #ddd;
    border-radius: 15px;
    /* Plus rond */
    padding: 5px 2px;
    text-align: center;
    cursor: pointer;
    transition: all 0.1s;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 75px;
    /* Moins haut pour gagner de la place */
    box-shadow: 0 4px 0px #cccccc;
}

.clavier-key:hover {
    background: #fffde7;
    transform: translateY(2px);
    box-shadow: 0 2px 0px #cccccc;
}

.clavier-key:active {
    transform: translateY(4px);
    box-shadow: 0 0px 0px #cccccc;
}

.clavier-key-symbol {
    font-size: 20px; /* Réduit (était 26px) */
    font-weight: bold;
    color: #424242;
}

.clavier-key-example {
    font-size: 11px;
    /* Ajusté */
    color: #757575;
    margin-top: 2px;
}

.clavier-key-images {
    display: flex;
    justify-content: center;
    gap: 4px;
    align-items: center;
    margin-top: 2px;
}

.clavier-key-image {
    max-width: 55px; /* Agrandit (était 45px) */
    max-height: 45px; /* Agrandit (était 35px) */
    margin-top: 2px;
    object-fit: contain;
}

/* Couleurs enfantines par type de son */
.clavier-key.voyelle {
    border-color: #ffcc80;
    box-shadow: 0 4px 0px #ef6c00;
}

.clavier-key.voyelle:active {
    box-shadow: 0 0px 0px #ef6c00;
}

.clavier-key.consonne {
    border-color: #a5d6a7;
    box-shadow: 0 4px 0px #2e7d32;
}

.clavier-key.consonne:active {
    box-shadow: 0 0px 0px #2e7d32;
}

.clavier-key.nasale {
    border-color: #ce93d8;
    box-shadow: 0 4px 0px #6a1b9a;
}

.clavier-key.nasale:active {
    box-shadow: 0 0px 0px #6a1b9a;
}

.clavier-key.semi-voyelle {
    border-color: #81d4fa;
    box-shadow: 0 4px 0px #0277bd;
}

.clavier-key.semi-voyelle:active {
    box-shadow: 0 0px 0px #0277bd;
}

/* Légende des natures grammaticales */
.clavier-nature-legend {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
    padding: 6px 12px;
    background: #f8fafc;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.clavier-nature-legend-title {
    font-size: 12px;
    font-weight: 800;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-right: 4px;
}

.legend-badge {
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.legend-badge.nature-nom { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.legend-badge.nature-verbe { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.legend-badge.nature-adjectif { background: #fef9c3; color: #854d0e; border: 1px solid #fde047; }
.legend-badge.nature-pronom { background: #ffedd5; color: #9a3412; border: 1px solid #fdba74; }
.legend-badge.nature-determinant { background: #e0f2fe; color: #075985; border: 1px solid #7dd3fc; }
.legend-badge.nature-adverbe { background: #f3e8ff; color: #6b21a8; border: 1px solid #d8b4fe; }

/* --------------------------------------------------------------------------
   Barre inférieure (Status / Bottom bar)
   -------------------------------------------------------------------------- */
.fonetico-bottom-bar {
    flex-shrink: 0;
    background: #ffffff;
    border-top: 1px solid #fde68a;
    padding: 8px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    font-size: 13px;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.03);
    margin-top: auto;
}

.status-school-brand {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.status-school-logo {
    height: 24px;
    width: auto;
    object-fit: contain;
}

.status-school-copy {
    font-size: 13px;
    font-weight: 700;
    color: #475569;
}

.fonetico-bottom-hint {
    color: #92400e;
    font-weight: 600;
}

/* --------------------------------------------------------------------------
   Modale d'aide
   -------------------------------------------------------------------------- */
.fonetico-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.fonetico-modal-overlay.show {
    display: flex;
}

.fonetico-modal {
    background: white;
    border-radius: 24px;
    max-width: 600px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    padding: 30px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
    border: 3px solid #fde68a;
    position: relative;
    font-family: 'Nunito', sans-serif;
}

.fonetico-modal-close {
    position: absolute;
    top: 18px;
    right: 18px;
    background: #f1f5f9;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    transition: all 0.2s;
}

.fonetico-modal-close:hover {
    background: #fee2e2;
    color: #dc2626;
}

/* Toast de notification */
.fonetico-toast {
    position: fixed;
    bottom: 50px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #1e293b;
    color: white;
    padding: 10px 20px;
    border-radius: 30px;
    font-weight: 700;
    font-size: 14px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s ease;
    box-shadow: 0 8px 20px rgba(0,0,0,0.25);
    z-index: 2000;
    display: flex;
    align-items: center;
    gap: 8px;
}

.fonetico-toast.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}