/* ===== CSS Variables / Theme System ===== */
:root {
    --bg-primary: #121213;
    --bg-secondary: #1a1a1b;
    --bg-tertiary: #2c2c2e;
    --text-primary: #d7dadc;
    --text-secondary: #818384;
    --border-color: #3a3a3c;
    --border-filled: #565758;
    --tile-green: #538d4e;
    --tile-yellow: #b59f3b;
    --tile-grey: #3a3a3c;
    --key-bg: #818384;
    --key-text: #ffffff;
    --nav-bg: #1a1a1b;
    --modal-bg: #1e1e1e;
    --modal-text: #d7dadc;
}

[data-theme="light"] {
    --bg-primary: #ffffff;
    --bg-secondary: #f5f5f5;
    --bg-tertiary: #e9e9e9;
    --text-primary: #1a1a1b;
    --text-secondary: #787c7e;
    --border-color: #d3d6da;
    --border-filled: #878a8c;
    --tile-green: #6aaa64;
    --tile-yellow: #c9b458;
    --tile-grey: #787c7e;
    --key-bg: #d3d6da;
    --key-text: #1a1a1b;
    --nav-bg: #ffffff;
    --modal-bg: #ffffff;
    --modal-text: #1a1a1b;
}

h1 {
    font-size: 1.25rem;
}
.navbar {
    flex-wrap: nowrap;
}

/* ===== Theme Toggle ===== */
.theme-toggle {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
}

.theme-toggle:hover {
    color: var(--text-primary);
    background: rgba(255,255,255,0.1);
}

[data-theme="light"] .theme-toggle:hover {
    background: rgba(0,0,0,0.05);
}

/* ===== Body & Global ===== */
body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    padding-bottom: 280px;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* ===== Bottom Navigation ===== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: var(--nav-bg);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 8px 0 12px 0;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    border-top: 1px solid var(--border-color);
    transition: background-color 0.3s ease;
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    padding: 4px 12px;
    min-width: 60px;
}

.bottom-nav-item i {
    font-size: 1.5rem;
    margin-bottom: 4px;
}

.bottom-nav-item span {
    font-size: 0.7rem;
    font-weight: 500;
}

.bottom-nav-item:hover {
    color: var(--text-primary);
    transform: translateY(-2px);
}

.bottom-nav-item:active {
    transform: translateY(0);
}

/* ===== Game Title ===== */
.game-title {
    text-align: center;
    font-size: 1.2rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    letter-spacing: 0.5px;
}

/* ===== Badge VIP ===== */
.vip-badge {
    text-align: center;
    font-size: 1rem;
    font-weight: 600;
    color: #ffd700;
    margin-bottom: 0.5rem;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

/* ===== Legend ===== */
.legend-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
}

.legend-square {
    width: 30px;
    height: 30px;
    border-radius: 6px;
    border: 2px solid transparent;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* ===== Tiles / Squares ===== */
.square {
    width: 50px;
    height: 50px;
    border: 2px solid var(--border-color);
    margin-right: 5px;
    margin-bottom: 5px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2rem;
    font-weight: bold;
    border-radius: 8px;
    transition: border-color 0.15s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    color: var(--text-primary);
    perspective: 600px;
}

.square.has-letter {
    border-color: var(--border-filled);
}

/* Animation pulse pour le logo globe */
.navbar .square.green {
    animation: pulse-logo 3s ease-in-out infinite;
}

@keyframes pulse-logo {
    0%, 100% {
        box-shadow: 0 0 10px rgba(106, 170, 100, 0.3);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 20px rgba(106, 170, 100, 0.6);
        transform: scale(1.05);
    }
}

/* ===== Keyboard ===== */
#keyboard {
    position: fixed;
    bottom: 90px;
    left: 0;
    right: 0;
    background: linear-gradient(to bottom, transparent 0%, var(--bg-primary) 20%, var(--bg-primary) 100%);
    padding: 20px 5px 15px 5px;
    z-index: 999;
    transition: background 0.3s ease;
}

.keyboard-letter {
    width: 10vw;
    height: 30px;
    margin: 1px;
    border: none;
    text-align: center;
    border-radius: 6px;
    background-color: var(--key-bg);
    color: var(--key-text);
    cursor: pointer;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    transition: all 0.1s ease;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.keyboard-letter:hover {
    transform: scale(1.05);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
}
.suppr {
    color: white;
    background-color: #c00202;
}
.enter {
    color: white;
    background-color: #037e03;
}
.pressed {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    transform: scale(0.95);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3) inset;
}
.blue {
    background-color: var(--tile-grey);
    color: #8a8a8c;
    opacity: 1;
    border-color: var(--tile-grey);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5);
    transform: scale(0.95);
}
.yellow {
    background-color: var(--tile-yellow);
    color: white;
    opacity: 1;
    border-color: var(--tile-yellow);
}

.green {
    background-color: var(--tile-green);
    color: white;
    opacity: 1;
    border-color: var(--tile-green);
    box-shadow: 0 0 10px rgba(83, 141, 78, 0.4);
}

[data-theme="light"] .green {
    box-shadow: 0 0 10px rgba(106, 170, 100, 0.4);
}

.hint-letter {
    color: var(--tile-green);
    opacity: 0.3;
    font-size: 2rem;
    font-weight: bold;
    pointer-events: none;
    position: absolute;
}
#victory {
    display: none;
}

#session-color {
    display: none;
}

#defeat {
    display: none;
}

.line, .line-session {
    display: flex;
    justify-content: center;
    align-items: center;
}
#invalid-word {
    position: absolute;
    margin-left: auto;
    margin-right: auto;
    left: 0;
    right: 0;
    width: 50vw;
    z-index: 2;
}

/* ===== Toast Notification ===== */
.toast-notification {
    position: fixed;
    top: 60px;
    left: 50%;
    transform: translateX(-50%) translateY(-120%);
    background-color: var(--text-primary);
    color: var(--bg-primary);
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    z-index: 2000;
    opacity: 0;
    transition: all 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
    pointer-events: none;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.toast-notification.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}
.title-squares {
    max-width: 45vw;
}
.title-squares > .square {
    width: 30px;
    height: 30px;
    font-size: 1.5rem;
}
.cursor-pointer {
    cursor: pointer;
}

.fa-coffee {
    color: #6f4e37;
}

.fa-twitter {
    color: #1DA1F2;
}

.error {
    text-align: center;
    margin-top: 10rem;
}

/* Animations */
.shake {
    -webkit-animation-name: shake;
    animation-name: shake;
    -webkit-animation-duration: 1s;
    animation-duration: 1s;
    -webkit-animation-fill-mode: both;
    animation-fill-mode: both;
}
@-webkit-keyframes shake {
    0%, 100% {
        -webkit-transform: translate3d(0, 0, 0);
        transform: translate3d(0, 0, 0);
    }
    10%, 30%, 50%, 70%, 90% {
        -webkit-transform: translate3d(-10px, 0, 0);
        transform: translate3d(-10px, 0, 0);
    }
    20%, 40%, 60%, 80% {
        -webkit-transform: translate3d(10px, 0, 0);
        transform: translate3d(10px, 0, 0);
    }
}
@keyframes shake {
    0%, 100% {
        -webkit-transform: translate3d(0, 0, 0);
        transform: translate3d(0, 0, 0);
    }
    10%, 30%, 50%, 70%, 90% {
        -webkit-transform: translate3d(-10px, 0, 0);
        transform: translate3d(-10px, 0, 0);
    }
    20%, 40%, 60%, 80% {
        -webkit-transform: translate3d(10px, 0, 0);
        transform: translate3d(10px, 0, 0);
    }
}

.tada {
    -webkit-animation-name: tada;
    animation-name: tada;
    -webkit-animation-duration: 1s;
    animation-duration: 1s;
    -webkit-animation-fill-mode: both;
    animation-fill-mode: both;
}
@-webkit-keyframes tada {
    0% {
        -webkit-transform: scale3d(1, 1, 1);
        transform: scale3d(1, 1, 1);
    }
    10%, 20% {
        -webkit-transform: scale3d(.9, .9, .9) rotate3d(0, 0, 1, -3deg);
        transform: scale3d(.9, .9, .9) rotate3d(0, 0, 1, -3deg);
    }
    30%, 50%, 70%, 90% {
        -webkit-transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, 3deg);
        transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, 3deg);
    }
    40%, 60%, 80% {
        -webkit-transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, -3deg);
        transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, -3deg);
    }
    100% {
        -webkit-transform: scale3d(1, 1, 1);
        transform: scale3d(1, 1, 1);
    }
}
@keyframes tada {
    0% {
        -webkit-transform: scale3d(1, 1, 1);
        transform: scale3d(1, 1, 1);
    }
    10%, 20% {
        -webkit-transform: scale3d(.9, .9, .9) rotate3d(0, 0, 1, -3deg);
        transform: scale3d(.9, .9, .9) rotate3d(0, 0, 1, -3deg);
    }
    30%, 50%, 70%, 90% {
        -webkit-transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, 3deg);
        transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, 3deg);
    }
    40%, 60%, 80% {
        -webkit-transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, -3deg);
        transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, -3deg);
    }
    100% {
        -webkit-transform: scale3d(1, 1, 1);
        transform: scale3d(1, 1, 1);
    }
}


/* Pyro */
.heart-solid {
    font-weight: 900;
    color: #E0245E;
}

.circleBlock {
    height: 1.5rem;
    cursor: pointer;
    width: 2rem;
}

.pyro > .before {
    display: block;
    position: relative;
    z-index:1;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    box-shadow: -12px -21.66667px blue, 24px -1.66667px #00ff84, 19px -1.33333px #002bff, -11px -30.66667px #ff009d, -10px -28.66667px #ffb300, -5px -31.66667px #ff006e, 26px -3.66667px #ff4000, 18px -35.66667px #ff00d0, -1px -33.66667px #00f6ff, 22px -38.66667px #99ff00, -6px -2.66667px #ff0400, -11px -33.66667px #6200ff, 15px -23.66667px #00ddff, -15px -38.66667px #00ffd0, -5px -3.66667px #00ffdd, -9px -17.66667px #a6ff00, -8px -1.33333px #0d00ff, 11px -30.66667px #005eff, 6px -41.66667px #ff00a6, 16px -10.66667px #ff004c, -24px -2.33333px #ff6600, 9px -32.66667px #ff0066, -21px -18.66667px #00ffa2, 23px -12.66667px #b700ff, 14px -19.66667px #9000ff, 12px -17.66667px #00bbff, 11px -38.66667px #ff002f, 14px -11.66667px #ffae00, 3px -7.66667px #f600ff, -6px -19.66667px #c800ff, -21px -22.66667px #d4ff00, -13px -37.66667px #ea00ff, -3px -41.66667px #ff00d4, 20px -10.66667px #00fff2, 9px -27.66667px #000dff, -2px -19.66667px #9dff00, 13px -39.66667px #a6ff00, 5px -2.66667px #0099ff, -15px -27.66667px #ea00ff, -16px -23.66667px #00fffb, -23px -36.66667px #00ff73, 6px -36.66667px #0088ff, 24px -17.66667px #0062ff, 22px -14.66667px #b300ff, 14px -20.66667px #9000ff, 21px -25.66667px #ff6600, 11px -18.66667px #1e00ff, 9px -12.66667px #c800ff, 18px -10.33333px #00ffc8, -1px -33.66667px #00ff33, 10px -6.66667px #ff008c;
    animation: 1s bang ease-out 1, gravity 1s ease-in 1;

}

@keyframes bang {
    from {
        box-shadow: 0 0 white, 0 0 white, 0 0 white, 0 0 white, 0 0 white, 0 0 white, 0 0 white, 0 0 white, 0 0 white, 0 0 white, 0 0 white, 0 0 white, 0 0 white, 0 0 white, 0 0 white, 0 0 white, 0 0 white, 0 0 white, 0 0 white, 0 0 white, 0 0 white, 0 0 white, 0 0 white, 0 0 white, 0 0 white, 0 0 white, 0 0 white, 0 0 white, 0 0 white, 0 0 white, 0 0 white, 0 0 white, 0 0 white, 0 0 white, 0 0 white, 0 0 white, 0 0 white, 0 0 white, 0 0 white, 0 0 white, 0 0 white, 0 0 white, 0 0 white, 0 0 white, 0 0 white, 0 0 white, 0 0 white, 0 0 white, 0 0 white, 0 0 white, 0 0 white;
    }
}
@keyframes gravity {
    to {
        transform: translateY(40px);
        opacity: 0;
    }
}


.blink-bulb  {
    animation: boom-boom 15s ease-in-out infinite;
}

@keyframes boom-boom {
    0%, 100% {
        transform: scale(1);
    }
    1% {
        transform: scale(1.2);
    }
    2% {
        transform: scale(1);
    }
    3% {
        transform: scale(1.2);
    }
    4%, 99% {
        transform: scale(1);
    }
}

/* ===== Pop animation pour les lettres à la saisie ===== */
.bounce {
    animation: pop 0.1s ease;
}

@keyframes pop {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.12);
    }
    100% {
        transform: scale(1);
    }
}

/* ===== Flip 3D animation pour la révélation des couleurs ===== */
.flip {
    animation: flip-tile 0.5s ease forwards;
}

@keyframes flip-tile {
    0% {
        transform: rotateX(0deg);
    }
    50% {
        transform: rotateX(90deg);
    }
    100% {
        transform: rotateX(0deg);
    }
}

/* ===== Modals dark mode ===== */
.modal-content {
    background-color: var(--modal-bg);
    color: var(--modal-text);
    border: 1px solid var(--border-color);
    transition: background-color 0.3s ease, color 0.3s ease;
}

.modal-header {
    border-bottom: 1px solid var(--border-color);
}

.modal-header .btn-close {
    filter: var(--btn-close-filter, invert(1));
}

[data-theme="light"] .modal-header .btn-close {
    filter: none;
}

.list-group-item {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    border-color: var(--border-color);
}

/* ===== Confetti CSS plein écran ===== */
.confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 3000;
    overflow: hidden;
}

.confetti-piece {
    position: absolute;
    width: 10px;
    height: 10px;
    top: -10px;
    opacity: 0;
    animation: confetti-fall linear forwards;
}

.confetti-piece:nth-child(odd) {
    border-radius: 50%;
}

.confetti-piece:nth-child(3n) {
    width: 8px;
    height: 14px;
    border-radius: 2px;
}

.confetti-piece:nth-child(4n) {
    width: 6px;
    height: 6px;
}

.confetti-piece:nth-child(5n) {
    width: 12px;
    height: 8px;
    border-radius: 3px;
}

@keyframes confetti-fall {
    0% {
        opacity: 1;
        transform: translateY(0) translateX(0) rotateZ(0deg) rotateX(0deg);
    }
    25% {
        opacity: 1;
        transform: translateY(25vh) translateX(calc(var(--sway) * 0.5)) rotateZ(180deg) rotateX(90deg);
    }
    50% {
        opacity: 0.8;
        transform: translateY(50vh) translateX(var(--sway)) rotateZ(360deg) rotateX(180deg);
    }
    75% {
        opacity: 0.4;
        transform: translateY(75vh) translateX(calc(var(--sway) * 0.7)) rotateZ(540deg) rotateX(270deg);
    }
    100% {
        opacity: 0;
        transform: translateY(105vh) translateX(calc(var(--sway) * 0.3)) rotateZ(720deg) rotateX(360deg);
    }
}

/* ===== Navbar ===== */
.navbar {
    position: relative;
    background-color: var(--nav-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 10px 0;
    transition: background-color 0.3s ease;
}

.navbar h1 {
    color: var(--text-primary);
}

/* Alert overrides for dark mode */
.alert-warning {
    background-color: var(--tile-yellow);
    color: #fff;
    border-color: var(--tile-yellow);
}

.alert-success {
    background-color: var(--tile-green);
    color: #fff;
    border-color: var(--tile-green);
}

[data-theme="light"] .alert-warning {
    background-color: #fff3cd;
    color: #664d03;
    border-color: #ffecb5;
}

[data-theme="light"] .alert-success {
    background-color: #d1e7dd;
    color: #0f5132;
    border-color: #badbcc;
}
