* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

@font-face {
    font-family: 'Arial Rounded MT';
    src: url('../fonts/ArialRoundedMT-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
}

@font-face {
    font-family: 'Arial Rounded MT';
    src: url('../fonts/ArialRoundedMT-Bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
}

:root {
    --primary-bg: #0a0e27;
    --text-white: #ffffff;
    --text-gray: #b8c1db;
    --font-family: 'Arial Rounded MT', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --gradient-blue: linear-gradient(135deg, #2b3a87 0%, #4a6fa5 100%);
    --card-bg: rgba(20, 26, 55, 0.6);
    --card-border: rgba(184, 193, 219, 0.12);
    --accent: #72a4f2;
}

body {
    font-family: var(--font-family);
    background: var(--primary-bg);
    color: var(--text-white);
    min-height: 100vh;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

/* Navbar */
.navbar {
    background: rgba(10, 14, 39, 0.95);
    padding: 1rem 2rem;
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: inherit;
    text-decoration: none;
    cursor: pointer;
    transition: opacity 0.3s ease;
}

.nav-logo:hover {
    opacity: 0.8;
}

.nav-logo img {
    width: 40px;
    height: 40px;
}

.lang-switcher {
    position: absolute;
    right: 0;
}

.lang-toggle {
    background: rgba(74, 111, 165, 0.15);
    border: 1px solid rgba(74, 111, 165, 0.3);
    border-radius: 8px;
    color: var(--text-white);
    cursor: pointer;
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-family);
    font-size: 0.9rem;
    font-weight: 500;
}

.lang-toggle:hover {
    background: rgba(74, 111, 165, 0.25);
    border-color: rgba(74, 111, 165, 0.5);
}

.globe-icon {
    width: 18px;
    height: 18px;
    filter: brightness(0) invert(1);
}

.lang-toggle-text {
    min-width: 60px;
    text-align: left;
}

.lang-chevron {
    width: 10px;
    height: 10px;
    opacity: 0.7;
    transition: transform 0.2s ease;
}

.lang-switcher.open .lang-chevron {
    transform: rotate(180deg);
}

.lang-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    display: none;
    flex-direction: column;
    min-width: 130px;
    margin-top: 0.5rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.lang-switcher.open .lang-dropdown {
    display: flex;
}

.lang-btn {
    background: transparent;
    border: none;
    color: var(--text-gray);
    cursor: pointer;
    padding: 0.5rem 0.75rem;
    font-family: var(--font-family);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.lang-btn:hover {
    background: rgba(74, 111, 165, 0.2);
    color: var(--text-white);
}

.lang-btn.active {
    background: rgba(74, 111, 165, 0.3);
    color: var(--text-white);
}

.flag-icon {
    width: 20px;
    height: 14px;
    border-radius: 2px;
    object-fit: cover;
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-gray);
    font-size: 1.1rem;
    font-weight: 400;
    position: relative;
    z-index: 2;
    margin-top: auto;
    opacity: 40%;
}

footer a {
    color: inherit;
    text-decoration: none;
    transition: opacity 0.2s;
}

footer a:hover {
    opacity: 0.75;
    text-decoration: underline;
}

/* Neige */
#snow {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 1;
}

.game-wrapper {
    flex: 1;
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2.5rem;
    padding: 6rem 1rem 2rem;
}

.game-title {
    font-size: 4rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 0.25rem;
}

.game-subtitle {
    font-size: 1.2rem;
    color: var(--text-gray);
    text-align: center;
    opacity: 40%;
    margin-top: -1.5rem;
}

.game-subtitle a {
    color: inherit;
    text-decoration: none;
    font-style: italic;
    transition: color 0.2s ease;
}

.game-subtitle a:hover {
    color: var(--text-white);
}

.score-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    align-items: stretch;
}

.score-section {
    display: flex;
    gap: 1.5rem;
    align-items: stretch;
}

.score-card,
.best-card {
    flex: 1;
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 1rem 2rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    transition: border-color 0.3s;
}

.score-card {
    border-color: rgba(114, 164, 242, 0.25);
}

.score-label,
.best-label {
    font-size: 0.85rem;
    font-weight: 400;
    color: var(--text-gray);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.score-value {
    font-size: 3.5rem;
    font-weight: 700;
    color: var(--text-white);
    line-height: 1;
    transition: transform 0.15s ease;
}

.score-value.pop {
    transform: scale(1.25);
    color: var(--accent);
}

.best-value {
    font-size: 3.5rem;
    font-weight: 700;
    color: var(--text-gray);
    line-height: 1;
}

.global-stats {
    display: flex;
    gap: 0.75rem;
}

.stat-item {
    flex: 1;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 14px;
    padding: 0.55rem 1.1rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.stat-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-white);
    line-height: 1;
}

.stat-label {
    font-size: 0.68rem;
    font-weight: 400;
    color: var(--text-gray);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.spin-area,
.score-section,
.hint {
    user-select: none;
}

.spin-area {
    position: relative;
    width: 260px;
    height: 260px;
    cursor: grab;
    display: flex;
    align-items: center;
    justify-content: center;
    perspective: 600px;
}

.spin-area.dragging {
    cursor: grabbing;
}

.aiko-glow {
    position: absolute;
    inset: -20px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(114, 164, 242, 0.18) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.aiko-glow.active {
    opacity: 1;
}

#aiko {
    width: 240px;
    height: 240px;
    object-fit: contain;
    transition: filter 0.2s;
    will-change: transform;
}

.hint {
    font-size: 1rem;
    color: var(--text-gray);
    text-align: center;
    opacity: 1;
    transition: opacity 0.5s ease;
}

.hint.hidden {
    opacity: 0;
}

.discord-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

#discord-login {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.discord-btn {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: #5865F2;
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 0.65rem 1.4rem;
    font-family: var(--font-family);
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.discord-btn:hover {
    background: #4752c4;
}

.discord-btn:active {
    transform: scale(0.97);
}

.discord-icon {
    width: 20px;
    height: 20px;
    filter: brightness(0) invert(1);
    flex-shrink: 0;
}

.auth-hint {
    font-size: 0.8rem;
    color: var(--text-gray);
    opacity: 0.6;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 0.5rem 1rem 0.5rem 0.6rem;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.user-name {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-white);
}

.logout-btn {
    background: transparent;
    border: none;
    color: var(--text-gray);
    cursor: pointer;
    font-size: 0.75rem;
    padding: 0.2rem 0.3rem;
    border-radius: 4px;
    line-height: 1;
    transition: color 0.2s;
    margin-left: 0.2rem;
}

.logout-btn:hover {
    color: var(--text-white);
}

.mode-greeting {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: -0.25rem;
    margin-bottom: -0.25rem;
}

.mode-greeting-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.greeting-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    opacity: 0.85;
}

.greeting-text {
    font-size: 1.15rem;
    color: var(--text-gray);
}

.greeting-logout-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 6px;
    display: flex;
    align-items: center;
    transition: background 0.2s;
    margin-left: 0.1rem;
}

.greeting-logout-btn img {
    width: 16px;
    height: 16px;
    opacity: 1;
    filter: invert(1) opacity(0.2);
}

.greeting-logout-btn:hover {
    background: rgba(255, 80, 80, 0.1);
}

.greeting-logout-btn:hover img {
    filter: invert(40%) sepia(1) saturate(5) hue-rotate(320deg);
}

.leaderboard-section {
    width: 100%;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding-bottom: 1rem;
}

.lb-title {
    font-size: 1.4rem;
    font-weight: 700;
    text-align: center;
    color: var(--text-white);
}

.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.lb-row {
    display: grid;
    grid-template-columns: 2rem 2rem 1fr auto;
    align-items: center;
    gap: 0.6rem;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    padding: 0.55rem 0.9rem;
    transition: border-color 0.2s;
}

.lb-row--me {
    border-color: rgba(114, 164, 242, 0.45);
    background: rgba(114, 164, 242, 0.08);
}

.lb-rank {
    font-size: 1rem;
    text-align: center;
    color: var(--text-gray);
    font-weight: 700;
}

.lb-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
}

.lb-name {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    min-width: 0;
}

.lb-name-text {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-white);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lb-badge {
    flex-shrink: 0;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.lb-badge--admin {
    background: rgba(255, 100, 100, 0.2);
    color: #ff6b6b;
    border: 1px solid rgba(255, 100, 100, 0.4);
}

.lb-spins {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--accent);
    white-space: nowrap;
}

.lb-empty,
.lb-loading {
    text-align: center;
    color: var(--text-gray);
    font-size: 0.9rem;
    padding: 1rem 0;
    opacity: 0.6;
}

.lb-podium {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 0.5rem;
    padding: 0.5rem 0;
}

.lb-podium-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    flex: 1;
    max-width: 110px;
}

.lb-podium-item--me .lb-podium-avatar {
    box-shadow: 0 0 0 2px rgba(114, 164, 242, 0.7);
}

.lb-podium-medal {
    font-size: 1.3rem;
    line-height: 1;
}

.lb-podium-avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid transparent;
}

.lb-podium-item--1 .lb-podium-avatar { border-color: rgba(255, 215, 0, 0.7); }
.lb-podium-item--2 .lb-podium-avatar { border-color: rgba(192, 192, 192, 0.7); }
.lb-podium-item--3 .lb-podium-avatar { border-color: rgba(205, 127, 50, 0.7); }

.lb-podium-name {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.3rem;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-white);
    text-align: center;
    max-width: 100%;
}

.lb-podium-spins {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--accent);
}

.lb-podium-pedestal {
    width: 100%;
    border-radius: 8px 8px 0 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: rgba(255,255,255,0.35);
}

.lb-podium-item--1 .lb-podium-pedestal {
    height: 56px;
    background: linear-gradient(180deg, rgba(255,215,0,0.18) 0%, rgba(255,215,0,0.06) 100%);
    border: 1px solid rgba(255, 215, 0, 0.25);
    border-bottom: none;
}

.lb-podium-item--2 .lb-podium-pedestal {
    height: 40px;
    background: linear-gradient(180deg, rgba(192,192,192,0.15) 0%, rgba(192,192,192,0.05) 100%);
    border: 1px solid rgba(192, 192, 192, 0.2);
    border-bottom: none;
}

.lb-podium-item--3 .lb-podium-pedestal {
    height: 28px;
    background: linear-gradient(180deg, rgba(205,127,50,0.15) 0%, rgba(205,127,50,0.05) 100%);
    border: 1px solid rgba(205, 127, 50, 0.2);
    border-bottom: none;
}

.lb-avatar-wrap {
    position: relative;
    display: inline-flex;
    flex-shrink: 0;
}

.lb-active-dot {
    position: absolute;
    bottom: 1px;
    right: 1px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #4caf50;
    border: 2px solid var(--bg-dark, #0d1117);
}

.lb-podium-item .lb-active-dot {
    width: 12px;
    height: 12px;
    bottom: 2px;
    right: 2px;
}

.lb-champion-bubble {
    position: relative;
    background: rgba(14, 18, 44, 0.92);
    border: 1px solid rgba(255, 215, 0, 0.35);
    border-radius: 10px;
    padding: 0.35rem 0.65rem;
    max-width: 108px;
    text-align: center;
    word-break: break-word;
    margin-bottom: 2px;
}

.lb-champion-bubble::after {
    content: '';
    position: absolute;
    bottom: -7px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 7px solid transparent;
    border-right: 7px solid transparent;
    border-top: 7px solid rgba(255, 215, 0, 0.35);
}

.lb-champion-bubble::before {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid rgba(14, 18, 44, 0.92);
    z-index: 1;
}

.lb-champion-bubble-text {
    font-size: 0.72rem;
    color: var(--text-white);
    line-height: 1.3;
    display: block;
}

.lb-champion-bubble-placeholder {
    color: rgba(184, 193, 219, 0.4);
    font-style: italic;
}

.lb-champion-bubble--editable {
    cursor: pointer;
    transition: border-color 0.2s;
}

.lb-champion-bubble--editable:hover {
    border-color: rgba(255, 215, 0, 0.7);
}

.lb-champion-bubble-input {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-white);
    font-family: var(--font-family);
    font-size: 0.72rem;
    text-align: center;
    width: 100%;
    min-width: 0;
}

.donation-cta {
    margin-top: 0.5rem;
    padding: 1.25rem 1.5rem;
    text-align: center;
    background: linear-gradient(135deg, rgba(114, 164, 242, 0.1) 0%, rgba(74, 111, 165, 0.1) 100%);
    border-radius: 16px;
    border: 1px solid rgba(114, 164, 242, 0.2);
    backdrop-filter: blur(10px);
    max-width: 420px;
    width: 100%;
}

.donation-cta h2 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.3rem;
    color: var(--text-white);
}

.donation-cta p {
    font-size: 0.85rem;
    color: var(--text-gray);
    margin-bottom: 1rem;
}

.kofi-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, #72a4f2 0%, #4a6fa5 100%);
    color: white;
    text-decoration: none;
    padding: 0.65rem 1.5rem;
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(114, 164, 242, 0.3);
}

.kofi-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(114, 164, 242, 0.5);
}

.kofi-icon-svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

@media (max-width: 480px) {
    .navbar {
        padding: 1rem;
    }

    .nav-logo {
        font-size: 1.2rem;
    }

    .nav-logo img {
        width: 35px;
        height: 35px;
    }

    .lang-toggle-text {
        display: none;
    }

    .lang-toggle {
        padding: 0.5rem;
    }

    .game-title {
        font-size: 3rem;
    }

    footer {
        font-size: 0.75rem;
        padding: 1.5rem 1rem;
    }

    .game-wrapper {
        gap: 2rem;
    }

    .score-card,
    .best-card {
        padding: 0.75rem 1.25rem;
    }

    .score-value,
    .best-value {
        font-size: 2.75rem;
    }

    .game-title {
        font-size: 2.5rem;
    }

    .spin-area {
        width: 220px;
        height: 220px;
    }

    #aiko {
        width: 200px;
        height: 200px;
    }

    .hint {
        font-size: 0.9rem;
    }
}
