:root {
    --bg-color: #084c61;
    --grid-border: #ffffff;

    --tile-correct: #f33f48;  /* rouge */
    --tile-present: #f4b602;  /* jaune cercle */
    --tile-absent: #0089be;   /* bleu */
    --tile-given: #00a3b8;    /* première lettre */

    --logo-red: #f33f48;
    --logo-yellow: #f4b602;
    --shadow-dark: #003049;

    --font-main: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* Reset minimal */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
}

body {
    background-color: var(--bg-color);
    color: #ffffff;
    font-family: var(--font-main);
    display: flex;
    justify-content: center;
    align-items: stretch;
}

.app {
    width: 100%;
    max-width: 900px;
    padding: 16px 16px 24px;
    display: flex;
    flex-direction: column;
}

/* ───────────────── HEADER / LOGO ───────────────── */

.top-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
    position: relative;
}

.top-bar-home {
    margin-top: 16px;
}

/* Bouton maison (page de jeu) */

.home-button {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background-color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 0 var(--shadow-dark);
    text-decoration: none;
}

.home-icon {
    width: 20px;
    height: 20px;
    position: relative;
}

.home-icon::before {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 2px;
    transform: translateX(-50%) rotate(45deg);
    width: 13px;
    height: 13px;
    border-left: 3px solid #0b5067;
    border-top: 3px solid #0b5067;
}

.home-icon::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 2px;
    transform: translateX(-50%);
    width: 14px;
    height: 6px;
    border-radius: 3px 3px 0 0;
    border: 3px solid #0b5067;
    border-bottom: none;
}

/* Logo TUSMO */

.logo {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 6px;
}

.logo-tile,
.logo-circle {
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 2.4rem;
    color: #ffffff;
    box-shadow: 0 8px 0 var(--shadow-dark);
}

.logo-tile {
    border-radius: 10px;
    background-color: var(--logo-red);
}

.logo-circle {
    border-radius: 50%;
    background-color: var(--logo-yellow);
}

/* ───────────────── MENU PRINCIPAL ───────────────── */

.page-home .main-menu {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    margin-top: 10px;
}

.menu-item {
    width: 100%;
    max-width: 420px;
    background-color: #ffffff;
    color: #084c61;
    border-radius: 14px;
    display: flex;
    align-items: stretch;
    text-decoration: none;
    box-shadow: 0 6px 0 #333333;
    overflow: hidden;
    font-weight: 600;
}

.menu-item-main {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 18px;
}

.menu-item-label {
    letter-spacing: 0.04em;
}

/* Colonne étoile (pour mot / suite du jour) */

.menu-item-star .menu-item-main {
    border-right: 2px solid #dddddd;
}

.menu-item-right {
    width: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.menu-item-star-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: 2px solid #0ea3a3;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #0ea3a3;
    font-size: 1.2rem;
}

/* Icône checkbox */

.menu-icon-check {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    border: 2px solid #084c61;
    position: relative;
}

.menu-icon-check::after {
    content: "";
    position: absolute;
    left: 4px;
    top: 3px;
    width: 12px;
    height: 8px;
    border-left: 3px solid #084c61;
    border-bottom: 3px solid #084c61;
    transform: rotate(-35deg);
}

/* Icônes user / group */

.menu-icon {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 2px solid #084c61;
    position: relative;
}

.menu-icon-user::before,
.menu-icon-group::before,
.menu-icon-group::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    border: 2px solid #084c61;
}

.menu-icon-user::before {
    width: 9px;
    height: 9px;
    top: 1px;
    left: 50%;
    transform: translateX(-50%);
}

.menu-icon-user::after {
    width: 14px;
    height: 8px;
    bottom: 2px;
    left: 50%;
    transform: translateX(-50%);
    border-bottom: none;
    border-radius: 999px 999px 0 0;
}

.menu-icon-group::before {
    width: 8px;
    height: 8px;
    top: 3px;
    left: 3px;
}

.menu-icon-group::after {
    width: 8px;
    height: 8px;
    top: 3px;
    right: 3px;
}

/* Barre du bas (icônes) */

.bottom-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 30px;
    padding: 0 30px;
}

.bottom-bar-group {
    display: flex;
    gap: 16px;
}

.bottom-btn {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    border: none;
    background-color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 0 var(--shadow-dark);
    cursor: pointer;
}

/* Icônes simples */

.bottom-icon {
    width: 22px;
    height: 22px;
    position: relative;
}

/* Règles / livre */
.bottom-icon-rules::before,
.bottom-icon-rules::after {
    content: "";
    position: absolute;
    border-radius: 3px;
}

.bottom-icon-rules::before {
    inset: 2px 3px;
    border: 2px solid #084c61;
}

.bottom-icon-rules::after {
    left: 6px;
    top: 6px;
    width: 8px;
    height: 2px;
    background-color: #084c61;
}

/* Paramètres */
.bottom-icon-settings::before {
    content: "";
    position: absolute;
    inset: 5px;
    border-radius: 50%;
    border: 2px solid #084c61;
}

/* Café / cœur */
.bottom-icon-coffee::before,
.bottom-icon-coffee::after {
    content: "";
    position: absolute;
}

.bottom-icon-coffee::before {
    left: 5px;
    top: 8px;
    width: 12px;
    height: 8px;
    border-radius: 2px;
    border: 2px solid #084c61;
}

.bottom-icon-coffee::after {
    right: 2px;
    top: 8px;
    width: 6px;
    height: 8px;
    border-radius: 50%;
    border: 2px solid #084c61;
}

/* Drapeau FR simplifié */

.bottom-btn-flag {
    padding: 0;
}

.bottom-icon-flag {
    width: 26px;
    height: 18px;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 0 0 2px #084c61;
    display: flex;
}

.bottom-icon-flag div {
    flex: 1;
}

.bottom-icon-flag .flag-blue {
    background-color: #0052b4;
}
.bottom-icon-flag .flag-white {
    background-color: #ffffff;
}
.bottom-icon-flag .flag-red {
    background-color: #d80027;
}

/* ───────────────── PAGE JEU ───────────────── */

.page-game .game-screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Petite barre d’infos (optionnelle) */

.status-bar {
    width: 100%;
    max-width: 600px;
    display: flex;
    justify-content: flex-start;
    gap: 24px;
    margin: 0 auto 8px;
    font-size: 0.95rem;
}

.status-item {
    display: flex;
    gap: 4px;
}

.status-label {
    font-weight: 600;
}

/* Grille */

.grid-wrapper {
    width: 100%;
    max-width: 520px;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 4px;
}

.grid-meta {
    width: 100%;
    max-width: 520px;
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    font-weight: 700;
}

.game-grid {
    width: 100%;
    max-width: 520px;
    display: grid;
    gap: 0;
}

/* Cases */

.grid-cell {
    border: 3px solid var(--grid-border);
    background-color: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.4rem;
    text-transform: uppercase;
    position: relative;
    aspect-ratio: 1 / 1;
}

.cell-letter {
    position: relative;
    z-index: 1;
}

/* rouge = correct */

.cell-correct {
    background-color: var(--tile-correct);
}

/* bleu = absent */

.cell-absent {
    background-color: var(--tile-absent);
}

/* première lettre donnée */

.cell-given {
    background-color: var(--tile-given);
}

/* cercle jaune = présent */

.cell-present {
    background-color: transparent;
}

.cell-present::before {
    content: "";
    position: absolute;
    inset: 4px;
    border-radius: 50%;
    background-color: var(--tile-present);
    z-index: 0;
}

/* Messages */

.error-message {
    margin-top: 10px;
    max-width: 520px;
    width: 100%;
    background-color: #c0392b;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 0.9rem;
}

.game-result {
    margin-top: 12px;
    max-width: 520px;
    width: 100%;
    background-color: #1e8449;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 0.95rem;
}

.guess-instruction {
    margin-top: 10px;
    max-width: 520px;
    width: 100%;
    font-size: 0.9rem;
    opacity: 0.9;
}

/* Clavier virtuel */

.keyboard {
    width: 100%;
    max-width: 520px;
    margin-top: 18px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.keyboard-row {
    display: flex;
    justify-content: center;
    gap: 6px;
}

.keyboard-spacer {
    flex: 0.5;
}

.key {
    flex: 1;
    min-width: 0;
    padding: 10px 0;
    border-radius: 4px;
    border: 3px solid #ffffff;
    background-color: transparent;
    color: #ffffff;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    text-transform: uppercase;
}

.key-action {
    flex: 1.4;
}

/* ───────────────── RESPONSIVE ───────────────── */

@media (max-width: 768px) {
    .app {
        padding: 12px 10px 18px;
    }

    .logo-tile,
    .logo-circle {
        width: 56px;
        height: 56px;
        font-size: 2rem;
    }

    .game-grid {
        max-width: 100%;
    }

    .grid-cell {
        font-size: 1.2rem;
    }

    .bottom-bar {
        padding: 0 10px;
    }
}

@media (max-width: 480px) {
    .logo-tile,
    .logo-circle {
        width: 48px;
        height: 48px;
        font-size: 1.8rem;
    }

    .menu-item-main {
        padding: 10px 14px;
    }

    .bottom-bar {
        margin-top: 24px;
    }

    .keyboard {
        max-width: 100%;
    }
}
