:root {
    --bg-deep: #050505;
    --text-primary: #ffffff;
    --text-secondary: #aaa;
    --accent: #D4AF37;
    --accent-hover: #f1c40f;
    --surface: rgba(22, 22, 28, 0.85);
    --surface-light: rgba(255, 255, 255, 0.05);
    --border: rgba(255, 255, 255, 0.1);
    --success: #2ecc71;
    --error: #e74c3c;
    --font-title: 'Cormorant Garamond', serif;
    --font-ui: 'Montserrat', sans-serif;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    outline: none;
}

body {
    background-color: var(--bg-deep);
    color: var(--text-primary);
    font-family: var(--font-ui);
    margin: 0;
    padding: 0;
    min-height: 100vh;
    overflow-x: hidden;
    /* Centrage global */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* --- BACKGROUND ANIMÉ --- */
.galaxy-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
}

.stars {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('https://s3-us-west-2.amazonaws.com/s.cdpn.io/1231630/stars.png') repeat top center;
    opacity: 0.5;
}

.twinkling {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('https://s3-us-west-2.amazonaws.com/s.cdpn.io/1231630/twinkling.png') repeat top center;
    opacity: 0.3;
    animation: move-twinkle 200s linear infinite;
}

@keyframes move-twinkle {
    from {
        background-position: 0 0;
    }

    to {
        background-position: -10000px 5000px;
    }
}

/* --- CONTENEUR PRINCIPAL (Carte) --- */
.app-container {
    width: 100%;
    /* Sur mobile, on prend tout l'écran, mais on garde le style "verre" */
    min-height: 100vh;

    /* MODIFICATION ICI : On applique le style "Surface" par défaut (Mobile & PC) */

    /* Support Safari */

    display: flex;
    flex-direction: column;
    position: relative;
    padding: 20px;

    /* Animation d'entrée douce */
    animation: fadeIn 0.5s ease-out;

    /* Sur PC uniquement (écrans larges) */
    @media (min-width: 480px) {
        max-width: 450px;
        min-height: auto;
        /* On laisse la hauteur s'adapter au contenu */
        background: var(--surface);
        /* Couleur définie : rgba(22, 22, 28, 0.85) */
        backdrop-filter: blur(10px);
        /* Flou d'arrière-plan pour l'effet verre */
        -webkit-backdrop-filter: blur(10px);
        /* On ajoute des bords arrondis et une ombre plus forte sur PC */
        border-radius: 20px;
        border: 1px solid var(--border);
        box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);

        margin: 20px;
    }
}

/* Ajoute aussi cette petite animation pour que ce soit fluide */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- LOGIN VIEW --- */
.login-header h1 {
    font-family: var(--font-title);
    color: var(--accent);
    font-size: 2.5rem;
    text-align: center;
    margin: 10px 0 30px 0;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.input-group {
    margin-bottom: 20px;
}

.label-text {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    margin-left: 5px;
}

input[type="text"],input[type="number"] {
    width: 100%;
    padding: 15px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border);
    color: #fff;
    border-radius: 12px;
    font-family: var(--font-ui);
    font-size: 1.1rem;
    text-align: center;
    transition: all 0.3s ease;
}

input:focus {
    border-color: var(--accent);
    background: rgba(0, 0, 0, 0.6);
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.2);
}

/* Grilles Avatars & Couleurs */
.avatar-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.av-item {
    background: var(--surface-light);
    border-radius: 10px;
    padding: 10px;
    text-align: center;
    font-size: 1.8rem;
    cursor: pointer;
    border: 1px solid transparent;
    transition: 0.2s;
}

.av-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.av-item.selected {
    border-color: var(--accent);
    background: rgba(212, 175, 55, 0.2);
    transform: scale(1.05);
}

.color-grid {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 30px;
}

.col-item {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid transparent;
    transition: 0.2s;
}

.col-item.selected {
    border-color: #fff;
    transform: scale(1.1);
    box-shadow: 0 0 10px currentColor;
}

/* BOUTONS */
.btn-primary {
    width: 100%;
    padding: 18px;
    background: linear-gradient(135deg, var(--accent) 0%, #aa8a2e 100%);
    color: #000;
    border: none;
    border-radius: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    box-shadow: 0 5px 20px rgba(212, 175, 55, 0.2);
    transition: all 0.2s;
    font-family: var(--font-ui);
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-primary:disabled {
    background: #333;
    color: #666;
    cursor: not-allowed;
    box-shadow: none;
}

.btn-secondary {
    width: 100%;
    padding: 12px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #888;
    border-radius: 12px;
    margin-top: 10px;
    cursor: pointer;
    font-family: var(--font-ui);
}

.btn-secondary:hover {
    color: #fff;
    border-color: #fff;
}

/* --- GAME VIEW --- */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
}

.player-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.my-avatar {
    font-size: 1.5rem;
}

.my-name {
    font-weight: bold;
    color: var(--text-primary);
}

.my-score {
    background: rgba(212, 175, 55, 0.1);
    color: var(--accent);
    padding: 5px 12px;
    border-radius: 20px;
    font-weight: bold;
    border: 1px solid var(--accent);
}

.status-box {
    text-align: center;
    margin-bottom: 30px;
    min-height: 80px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.status-indicator {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #666;
    margin-bottom: 5px;
    display: block;
}

.status-text {
    font-family: var(--font-title);
    font-size: 1.8rem;
    line-height: 1.1;
    color: #fff;
    transition: color 0.3s;
}

/* État "À vous de jouer" */
.active-turn .status-text {
    color: var(--accent);
    animation: pulse-text 2s infinite;
}

.active-turn .status-indicator {
    color: var(--success);
}

/* Zone de Dessin */
#draw-area {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 20px;
    position: relative;
    border: 3px solid transparent;
}

.active-turn #draw-area {
    border-color: var(--accent);
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.3);
}

/* --- OVERLAYS & NOTIFS --- */
.login-error {
    color: var(--error);
    background: rgba(231, 76, 60, 0.1);
    border: 1px solid var(--error);
    padding: 10px;
    border-radius: 8px;
    font-size: 0.8rem;
    margin-bottom: 15px;
    text-align: center;
    display: none;
}

.overlay-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(5, 5, 10, 0.95);
    z-index: 1000;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 20px;
}

.overlay-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

/* Notification Toast */
.notif-toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: #111;
    border: 1px solid var(--accent);
    padding: 15px 30px;
    border-radius: 30px;
    display: flex;
    align-items: center;
    gap: 15px;
    z-index: 2000;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.notif-toast.show {
    transform: translateX(-50%) translateY(0);
}

.notif-icon {
    font-size: 1.5rem;
}

.notif-msg {
    font-weight: bold;
    color: #fff;
    font-size: 0.9rem;
}

/* UTILS */
.hidden {
    display: none !important;
}

@keyframes pulse-text {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

/* DANS reponse.css */

.fs-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    /* Au-dessus de tout */
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    backdrop-filter: blur(10px);
    transition: background 0.3s ease, transform 0.3s ease;
}

.fs-overlay.hidden {
    pointer-events: none;
    opacity: 0;
    transform: scale(1.1);
}

/* ÉTATS */
.fs-overlay.pending {
    background: rgba(230, 126, 34, 0.95);
    color: white;
    opacity: 1;
    transform: scale(1);
}

.fs-overlay.success {
    background: rgba(39, 174, 96, 0.95);
    color: white;
    opacity: 1;
    transform: scale(1);
}

.fs-overlay.error {
    background: rgba(192, 57, 43, 0.95);
    color: white;
    opacity: 1;
    transform: scale(1);
}

.fs-overlay.info {
    background: #ff6600;
    color: white;
    opacity: 1;
    transform: scale(1);
}
.fs-icon {
    font-size: 5rem;
    margin-bottom: 20px;
    animation: bounce 1s infinite alternate;
}

#fs-title {
    font-family: 'Montserrat', sans-serif;
    font-weight: 800;
    font-size: 2.5rem;
    margin: 0;
    text-transform: uppercase;
}

#fs-msg {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.5rem;
    margin-top: 10px;
    font-style: italic;
    opacity: 0.9;
}

@keyframes bounce {
    from {
        transform: translateY(0);
    }

    to {
        transform: translateY(-10px);
    }
}

.rating-box {
    margin-bottom: 20px;
    background: rgba(255, 255, 255, 0.05);
    padding: 15px;
    border-radius: 10px;
}

.rating-box p {
    margin: 0 0 10px 0;
    font-family: 'Montserrat';
    font-size: 0.9rem;
    color: #aaa;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.stars-input span {
    font-size: 2rem;
    color: #444;
    cursor: pointer;
    transition: 0.2s;
}

.stars-input span.active {
    color: #D4AF37;
    text-shadow: 0 0 10px #D4AF37;
}

/* --- OVERLAY GÉNÉRAL --- */
.fs-overlay {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: opacity 0.3s ease, background 0.3s ease;
    backdrop-filter: blur(15px);
    opacity: 0;
    pointer-events: none; /* On clique au travers si caché */
}

/* Quand il est actif */
.fs-overlay.active {
    opacity: 1;
    pointer-events: auto; /* Bloque les clics */
}

/* CONTENU */
.fs-content {
    text-align: center;
    color: white;
    transform: scale(0.8);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.fs-overlay.active .fs-content { transform: scale(1); }

.fs-icon { font-size: 6rem; margin-bottom: 20px; display: block; }
#fs-title { font-family: 'Montserrat', sans-serif; font-size: 2.5rem; font-weight: 800; margin: 0; text-transform: uppercase; }
#fs-msg { font-family: 'Cormorant Garamond', serif; font-size: 1.5rem; margin-top: 10px; opacity: 0.9; font-style: italic; }

/* --- ÉTAT 1 : EN ATTENTE (Orange/Gris) --- */
.fs-overlay.state-pending {
    background: rgba(255, 102, 0, 1);
}

.fs-overlay.state-pending .fs-icon {
    animation: spin 2s infinite linear;
}

/* --- ÉTAT 2 : SUCCÈS (Vert) --- */
.fs-overlay.state-success {
    background: rgba(39, 174, 96, 0.95); /* Vert émeraude */
}
.fs-overlay.state-success .fs-icon {
    animation: bounce 1s infinite;
}

.fs-overlay.state-info {
    background: #ff6600; /* Vert émeraude */
}
.fs-overlay.state-info .fs-icon {
    animation: bounce 1s infinite;
}

/* --- ÉTAT 3 : ERREUR (Rouge) --- */
.fs-overlay.state-error {
    background: rgba(192, 57, 43, 0.95); /* Rouge sang */
}
.fs-overlay.state-error .fs-icon {
    animation: shake 0.5s;
}

/* --- ANIMATIONS --- */
@keyframes spin { 100% { transform: rotate(360deg); } }
@keyframes bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-20px); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-10px); } 75% { transform: translateX(10px); } }

input[type=number]::-webkit-inner-spin-button, 
input[type=number]::-webkit-outer-spin-button { 
  -webkit-appearance: none; 
  margin: 0; 
}
input[type=number] {
  -moz-appearance: textfield; /* Pour Firefox */
}

/* 2. Style spécifique du bouton ESTIMATE */
.btn-estimate {
    background: linear-gradient(135deg, #f1c40f 0%, #d35400 100%) !important; /* Dégradé Jaune/Orange vif */
    font-size: 1.4rem !important;
    padding: 20px !important;
    border: 2px solid rgba(255, 255, 255, 0.3) !important;
    box-shadow: 0 0 25px rgba(241, 196, 15, 0.4) !important;
    transform: scale(1.02);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.btn-estimate:active {
    transform: scale(0.95);
    box-shadow: 0 0 10px rgba(241, 196, 15, 0.2) !important;
}
.pulse-ring {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(212, 175, 55, 0.2); /* Couleur Or transparent */
    border: 2px solid var(--accent);
    position: relative;
    animation: pulse-ring-anim 2s infinite ease-out;
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.5);
}

.pulse-ring::after {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 40px; height: 40px;
    background: var(--accent);
    border-radius: 50%;
    animation: inner-pulse 2s infinite ease-in-out;
}

@keyframes pulse-ring-anim {
    0% { transform: scale(0.8); opacity: 0.5; }
    100% { transform: scale(1.5); opacity: 0; }
}

@keyframes inner-pulse {
    0%, 100% { transform: translate(-50%, -50%) scale(0.8); }
    50% { transform: translate(-50%, -50%) scale(1.1); }
}