:root {
    --bg-color: #0f172a;
    --text-color: #ffffff;
    --glass-bg: rgba(255, 255, 255, 0.08);
    --glass-border: rgba(255, 255, 255, 0.15);
    --primary-color: #3b82f6;
    --primary-glow: rgba(59, 130, 246, 0.4);
    --accent-color: #f43f5e;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
}

* {
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
}

body {
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-color);
    background-image:
        radial-gradient(at 0% 0%, hsla(253, 16%, 7%, 1) 0, transparent 50%),
        radial-gradient(at 50% 0%, hsla(225, 39%, 30%, 1) 0, transparent 50%),
        radial-gradient(at 100% 0%, hsla(339, 49%, 30%, 1) 0, transparent 50%);
    background-attachment: fixed;
    color: var(--text-color);
    overflow-x: hidden;
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior-y: none;
    min-height: 100vh;
}

/* ===== ANIMATED BACKGROUND ORBS ===== */
.bg-orbs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
    animation: orbFloat 20s infinite ease-in-out;
}

.orb-1 {
    width: 300px;
    height: 300px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    top: -100px;
    left: -100px;
}

.orb-2 {
    width: 400px;
    height: 400px;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    top: 50%;
    right: -150px;
    animation-delay: -5s;
}

.orb-3 {
    width: 250px;
    height: 250px;
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    bottom: -50px;
    left: 30%;
    animation-delay: -10s;
}

@keyframes orbFloat {

    0%,
    100% {
        transform: translate(0, 0) scale(1);
    }

    25% {
        transform: translate(30px, -30px) scale(1.05);
    }

    50% {
        transform: translate(-20px, 20px) scale(0.95);
    }

    75% {
        transform: translate(20px, 10px) scale(1.02);
    }
}

/* ===== CONFETTI ===== */
#confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
}

.confetti {
    position: absolute;
    top: -10px;
    width: 10px;
    height: 10px;
    animation: confettiFall 4s linear forwards;
}

@keyframes confettiFall {
    0% {
        transform: translateY(-10px) rotate(0deg);
        opacity: 1;
    }

    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

.tear {
    position: absolute;
    top: -20px;
    font-size: 24px;
    animation: tearFall 4s linear forwards;
}

@keyframes tearFall {
    0% {
        transform: translateY(-20px);
        opacity: 1;
    }

    100% {
        transform: translateY(100vh);
        opacity: 0;
    }
}

/* ===== GLASS PANEL ===== */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 24px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    position: relative;
    z-index: 1;
}

.card-hover {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card-hover:hover {
    transform: translateY(-2px);
}

/* ===== BUTTONS ===== */
.btn {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
    border: 1px solid var(--glass-border);
    color: white;
    padding: 14px 28px;
    border-radius: 14px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
    backdrop-filter: blur(4px);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    width: 100%;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.btn:hover::before {
    left: 100%;
}

.btn:hover {
    transform: translateY(-2px);
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, #2563eb 100%);
    border: none;
}

.btn-glow {
    box-shadow: 0 0 20px var(--primary-glow);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger-color) 0%, #dc2626 100%);
    border: none;
}

.btn-sm {
    padding: 10px 20px;
    font-size: 12px;
    width: auto;
    margin: 0;
}

.btn-large {
    padding: 18px 32px;
    font-size: 16px;
}

.btn-icon {
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 12px;
    font-size: 20px;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* ===== CONTAINER ===== */
.container {
    max-width: 480px;
    margin: 0 auto;
    padding: 20px;
    padding-top: 70px;
    padding-bottom: 40px;
    width: 100%;
    position: relative;
    z-index: 1;
}

/* ===== TYPOGRAPHY ===== */
h1,
h2,
h3 {
    text-align: center;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-bottom: 16px;
}

.gradient-text {
    background: linear-gradient(135deg, #fff 0%, #a5b4fc 50%, #f9a8d4 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.app-title {
    font-size: 2.2rem;
    margin-bottom: 8px;
}

.subtitle {
    text-align: center;
    opacity: 0.6;
    font-size: 14px;
    margin-bottom: 30px;
}

.section-header {
    margin: 25px 0 15px;
}

.section-title {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    opacity: 0.5;
    margin: 0;
    text-align: left;
}

/* ===== HERO SECTION PREMIUM ===== */
.hero-section {
    text-align: center;
    margin-bottom: 25px;
    position: relative;
}

.logo-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 150px;
    height: 150px;
    background: radial-gradient(circle, var(--primary-glow) 0%, transparent 70%);
    opacity: 0.5;
    animation: logoGlow 3s infinite ease-in-out;
}

@keyframes logoGlow {

    0%,
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.5;
    }

    50% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 0.3;
    }
}

.logo-container {
    margin-bottom: 10px;
    position: relative;
    z-index: 1;
}

.logo-icon {
    font-size: 60px;
    display: inline-block;
    animation: logoFloat 3s infinite ease-in-out;
}

@keyframes logoFloat {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

/* ===== LOGIN BOX ===== */
.login-box {
    margin-bottom: 25px;
}

.input-group {
    margin-bottom: 16px;
}

.input-group:last-child {
    margin-bottom: 0;
}

.input-group label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.5;
    margin-bottom: 8px;
}

input[type="text"] {
    width: 100%;
    padding: 14px 16px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    color: white;
    font-size: 16px;
    transition: all 0.3s ease;
}

input[type="text"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

input[type="text"]::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.shake {
    animation: shake 0.4s ease;
    border-color: var(--accent-color) !important;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    20%,
    60% {
        transform: translateX(-5px);
    }

    40%,
    80% {
        transform: translateX(5px);
    }
}

/* ===== LANGUAGE SELECTOR ===== */
.lang-selector {
    position: fixed;
    top: 15px;
    right: 15px;
    display: flex;
    gap: 8px;
    z-index: 100;
}

.lang-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid transparent;
    background: rgba(0, 0, 0, 0.3);
    cursor: pointer;
    opacity: 0.6;
    transition: all 0.3s ease;
    padding: 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lang-btn img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.lang-btn.active,
.lang-btn:hover {
    opacity: 1;
    transform: scale(1.1);
    border-color: white;
}

/* ===== GAMES GRID PREMIUM ===== */
.games-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 25px;
}

.game-card-premium {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.game-card-premium .game-card-glow {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 50% 0%, var(--primary-glow), transparent 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.game-card-premium:hover .game-card-glow,
.game-card-premium.selected .game-card-glow {
    opacity: 1;
}

.game-card-premium:hover,
.game-card-premium.selected {
    border-color: var(--primary-color);
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(59, 130, 246, 0.2);
}

.game-card-premium.selected {
    box-shadow: 0 0 30px var(--primary-glow);
}

.game-card-premium .game-card-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.6);
    padding: 4px 8px;
    border-radius: 8px;
    font-size: 10px;
    font-weight: 600;
    z-index: 2;
}

.game-card-premium .game-card-img {
    width: 100%;
    aspect-ratio: 1 / 1;
    background-size: cover;
    background-position: center;
    border-radius: 12px;
    margin-bottom: 12px;
    position: relative;
    z-index: 1;
}

.game-card-content {
    flex: 1;
    position: relative;
    z-index: 1;
}

.game-card-premium .game-card-name {
    font-size: 16px;
    font-weight: 700;
    display: block;
    margin-bottom: 4px;
}

.game-card-desc {
    font-size: 10px;
    opacity: 0.5;
    margin: 0;
}

.game-card-rules-btn {
    margin-top: 10px;
    padding: 8px 12px;
    font-size: 11px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    z-index: 2;
}

.game-card-rules-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: var(--primary-color);
}

/* ===== UPCOMING SECTION ===== */
.upcoming-section {
    padding: 20px;
}

.upcoming-title {
    font-size: 13px;
    opacity: 0.6;
    margin-bottom: 15px;
    text-align: left;
}

.upcoming-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.upcoming-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    opacity: 0.4;
    text-align: center;
    transition: opacity 0.3s ease;
}

.upcoming-card:hover {
    opacity: 0.6;
}

.upcoming-img {
    width: 45px;
    height: 45px;
    background-size: cover;
    background-position: center;
    border-radius: 12px;
    margin-bottom: 6px;
    filter: grayscale(100%);
}

.upcoming-card span:last-child {
    font-size: 10px;
}

/* ===== ACTIVE GAME PANEL ===== */
.active-game-panel {
    margin-top: 20px;
    border: 2px solid var(--success-color);
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), var(--glass-bg));
}

.active-game-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.active-game-header h3 {
    margin: 0;
    font-size: 14px;
    text-align: left;
}

.active-game-pulse {
    width: 10px;
    height: 10px;
    background: var(--success-color);
    border-radius: 50%;
    animation: pulseDot 1.5s infinite;
}

@keyframes pulseDot {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.5;
        transform: scale(1.3);
    }
}

.active-game-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    cursor: pointer;
}

.active-game-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.active-game-status {
    font-size: 10px;
    padding: 4px 10px;
    border-radius: 10px;
    text-transform: uppercase;
    font-weight: 700;
}

.active-game-status.playing {
    background: var(--success-color);
    color: black;
}

.active-game-status.waiting {
    background: var(--warning-color);
    color: black;
}

.active-game-meta {
    font-size: 12px;
    opacity: 0.6;
}

/* ===== GAME HEADER ===== */
.game-header {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 10px;
}

.btn-rules-game {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: white;
}

.btn-rules-game:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.1);
}

/* ===== LOBBY ===== */
.lobby-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.lobby-header h2 {
    margin: 0;
    font-size: 1.3rem;
}

.divider {
    display: flex;
    align-items: center;
    margin: 20px 0;
    opacity: 0.4;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--glass-border);
}

.divider span {
    padding: 0 15px;
    font-size: 12px;
    text-transform: uppercase;
}

.empty-state {
    text-align: center;
    padding: 30px;
    opacity: 0.5;
}

.room-item {
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-radius: 16px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    transition: all 0.3s ease;
}

.room-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.room-info strong {
    display: block;
    margin-bottom: 4px;
}

.room-meta {
    font-size: 11px;
    opacity: 0.5;
}

/* ===== WAITING ROOM ===== */
.waiting-header {
    text-align: center;
    margin-bottom: 25px;
}

.room-status-badge {
    display: inline-block;
    background: var(--warning-color);
    color: black;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.players-list {
    margin: 25px 0;
}

.player-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 14px;
    margin-bottom: 10px;
    border: 1px solid transparent;
    transition: all 0.3s ease;
}

.animate-slide-in {
    animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.player-item.admin {
    border-color: var(--warning-color);
    background: rgba(245, 158, 11, 0.1);
}

/* Player Avatar Styles */
.player-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.player-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 3px solid;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.player-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.player-avatar .avatar-emoji {
    font-size: 20px;
}

.player-name {
    flex: 1;
    font-weight: 600;
}

.player-badge {
    font-size: 16px;
}

/* Menu avatar styles */
.menu-user-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 3px solid;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
}

.menu-user-avatar .avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.menu-user-avatar .avatar-placeholder {
    font-size: 24px;
}

.hint-text {
    text-align: center;
    font-size: 12px;
    opacity: 0.5;
    margin-top: -5px;
}

.waiting-animation {
    text-align: center;
    padding: 20px;
}

.waiting-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 15px;
}

.waiting-dots span {
    width: 10px;
    height: 10px;
    background: var(--primary-color);
    border-radius: 50%;
    animation: dotPulse 1.4s infinite ease-in-out;
}

.waiting-dots span:nth-child(1) {
    animation-delay: 0s;
}

.waiting-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.waiting-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes dotPulse {

    0%,
    80%,
    100% {
        transform: scale(0.6);
        opacity: 0.5;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ===== MODAL ===== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
}

.modal-content {
    position: relative;
    width: 90%;
    max-width: 400px;
    max-height: 85vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-header h3 {
    margin: 0;
    text-align: left;
}

.modal-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-message {
    text-align: center;
    opacity: 0.8;
    margin-bottom: 20px;
    line-height: 1.6;
}

.modal-actions {
    display: flex;
    gap: 10px;
}

.modal-actions .btn {
    flex: 1;
    margin: 0;
}

/* ===== DICE MODE SELECTOR ===== */
.dice-mode-selector {
    display: flex;
    gap: 10px;
}

.dice-mode-btn {
    flex: 1;
    padding: 16px;
    border-radius: 14px;
    border: 2px solid var(--glass-border);
    background: rgba(0, 0, 0, 0.2);
    color: white;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.dice-mode-btn.active {
    border-color: var(--primary-color);
    background: rgba(59, 130, 246, 0.2);
}

.mode-icon {
    font-size: 28px;
}

/* ===== RULES MODAL ===== */
.rules-modal {
    max-height: 80vh;
    overflow-y: auto;
}

.rules-content {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    line-height: 1.6;
    max-height: 50vh;
    overflow-y: auto;
}

.rules-content h4 {
    color: var(--primary-color);
    margin-top: 20px;
    margin-bottom: 10px;
    font-size: 14px;
}

.rules-content h4:first-child {
    margin-top: 0;
}

.rules-content ul {
    margin: 0;
    padding-left: 20px;
    line-height: 1.8;
}

.rules-content li {
    margin-bottom: 8px;
}

.rules-content p {
    margin: 10px 0;
}

/* ===== NUMPAD ===== */
.numpad-modal {
    text-align: center;
}

.numpad-display {
    font-size: 48px;
    font-weight: 800;
    padding: 20px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 16px;
    margin-bottom: 20px;
}

.numpad-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 15px;
}

.numpad-btn {
    padding: 20px;
    font-size: 24px;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 14px;
    color: white;
    cursor: pointer;
    transition: all 0.2s;
}

.numpad-btn:active {
    transform: scale(0.95);
}

.numpad-clear {
    background: rgba(239, 68, 68, 0.3);
}

.numpad-confirm {
    background: rgba(16, 185, 129, 0.3);
}

/* ===== GAME END MODAL ===== */
.game-end-modal {
    text-align: center;
}

.game-end-icon {
    font-size: 80px;
    margin-bottom: 15px;
    animation: logoFloat 1s infinite;
}

.game-end-title {
    font-size: 2rem;
    margin-bottom: 10px;
}

.game-end-message {
    opacity: 0.7;
    margin-bottom: 20px;
}

.game-end-scores {
    margin-bottom: 20px;
}

.final-scores {
    text-align: left;
}

.final-score-item {
    padding: 10px 15px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    margin-bottom: 8px;
}

.final-score-item.me {
    background: rgba(59, 130, 246, 0.2);
    border: 1px solid var(--primary-color);
}

/* ===== ANIMATIONS ===== */
.hidden {
    display: none !important;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    animation: fadeIn 0.5s ease-out forwards;
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.animate-scale-in {
    animation: scaleIn 0.3s ease-out forwards;
}

/* ===== MOBILE HEADER ===== */
.mobile-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 1000;
}

.header-left {
    display: flex;
    align-items: center;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: white;
}

.header-logo .logo-img {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.header-logo .logo-text {
    font-weight: 800;
    font-size: 18px;
    background: linear-gradient(135deg, #fff 0%, #a5b4fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-lang {
    display: flex;
    gap: 6px;
}

.header-lang .lang-btn {
    width: 30px;
    height: 30px;
    position: static;
}

/* ===== BURGER MENU ===== */
.burger-menu {
    width: 36px;
    height: 36px;
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    padding: 0;
    z-index: 1001;
}

.burger-menu span {
    display: block;
    width: 22px;
    height: 2px;
    background: white;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.burger-menu.open span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.burger-menu.open span:nth-child(2) {
    opacity: 0;
}

.burger-menu.open span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* ===== MOBILE MENU SLIDE ===== */
.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 999;
}

.mobile-menu-overlay.open {
    opacity: 1;
    visibility: visible;
}

.mobile-menu {
    position: fixed;
    top: 0;
    right: -280px;
    width: 280px;
    height: 100%;
    background: rgba(15, 23, 42, 0.98);
    backdrop-filter: blur(20px);
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    transition: right 0.3s ease;
    z-index: 1000;
}

.mobile-menu.open {
    right: 0;
}

.mobile-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.mobile-menu-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.menu-user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    background: rgba(255, 255, 255, 0.1);
}

.menu-user-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.menu-user-name {
    font-weight: 600;
    font-size: 14px;
}

.menu-user-badge {
    font-size: 10px;
    padding: 2px 6px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border-radius: 4px;
    width: fit-content;
}

.mobile-menu-close {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mobile-menu-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.mobile-menu-list {
    list-style: none;
    padding: 15px 0;
    margin: 0;
    flex: 1;
}

.mobile-menu-list li a {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 20px;
    color: white;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
}

.mobile-menu-list li a:hover {
    background: rgba(255, 255, 255, 0.05);
}

.mobile-menu-list .menu-icon {
    font-size: 20px;
}

.mobile-menu-debug {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 14px;
}

.debug-switch {
    position: relative;
    width: 44px;
    height: 24px;
}

.debug-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.debug-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    transition: 0.3s;
}

.debug-slider::before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: 0.3s;
}

.debug-switch input:checked+.debug-slider {
    background: #10b981;
}

.debug-switch input:checked+.debug-slider::before {
    transform: translateX(20px);
}

.debug-status {
    margin-left: auto;
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.1);
}

.mobile-menu-footer {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-logout-menu {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px;
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.4);
    border-radius: 12px;
    color: #fca5a5;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-logout-menu:hover {
    background: rgba(239, 68, 68, 0.3);
}

/* ===== BOTTOM NAVIGATION ===== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 70px;
    background: rgba(15, 23, 42, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 0 10px;
    padding-bottom: env(safe-area-inset-bottom, 0);
    z-index: 900;
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    text-decoration: none;
    color: rgba(255, 255, 255, 0.5);
    padding: 8px 16px;
    border-radius: 12px;
    transition: all 0.2s ease;
}

.bottom-nav-item.active,
.bottom-nav-item:hover {
    color: white;
    background: rgba(255, 255, 255, 0.1);
}

.bottom-nav-item.active {
    color: var(--primary-color);
}

.bottom-nav-icon {
    font-size: 22px;
}

.bottom-nav-label {
    font-size: 10px;
    font-weight: 600;
}

/* ===== BODY STATES ===== */
body.logged-in .container {
    padding-top: 80px;
    padding-bottom: 90px;
}

body.menu-open {
    overflow: hidden;
}

/* En mode jeu : on cache le header principal mais on affiche le header de jeu */
body.in-game #main-header {
    display: none;
}

body.in-game #game-header {
    display: flex !important;
}

body.in-game .bottom-nav {
    display: none;
}

body.in-game .container {
    padding-top: 80px;
    padding-bottom: 20px;
}

/* ===== GAME HEADER BAR ===== */
.game-header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
}

.game-header-bar .header-center {
    flex: 1;
    text-align: center;
}

.game-room-title {
    font-weight: 700;
    font-size: 16px;
    color: white;
}

.btn-leave-game {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.4);
    border-radius: 10px;
    color: #fca5a5;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-leave-game:hover {
    background: rgba(239, 68, 68, 0.3);
}

.btn-leave-game span:first-child {
    font-size: 16px;
}

.btn-rules-header {
    width: 40px;
    height: 40px;
    font-size: 18px;
}

/* ===== CONTAINER MARGINS FIX ===== */
.container {
    padding-left: 16px;
    padding-right: 16px;
}

/* Fix lang selector when header is present */
body.logged-in .lang-selector {
    position: static;
}

/* Hide original lang selector when using header */
body.has-header .lang-selector:not(.header-lang) {
    display: none;
}

/* ===== RESPONSIVE ADJUSTMENTS ===== */
@media (max-width: 380px) {
    .mobile-header {
        padding: 0 12px;
    }

    .header-logo .logo-text {
        font-size: 16px;
    }

    .container {
        padding-left: 12px;
        padding-right: 12px;
    }

    .glass-panel {
        padding: 18px;
        border-radius: 20px;
    }

    .games-grid {
        gap: 10px;
    }

    .btn-leave-game {
        padding: 6px 10px;
        font-size: 12px;
    }
}

@media (min-width: 481px) {
    .bottom-nav {
        max-width: 480px;
        left: 50%;
        transform: translateX(-50%);
        border-radius: 20px 20px 0 0;
    }
}

/* ===== PLAYER TOOLTIP ON AVATAR CLICK ===== */
.player-tooltip {
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    z-index: 9999;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    white-space: nowrap;
}

.player-tooltip.show {
    opacity: 1;
}

.player-tooltip::before {
    content: '';
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 6px solid rgba(0, 0, 0, 0.9);
}

/* Rendre les avatars cliquables */
.th-avatar {
    cursor: pointer;
    transition: transform 0.2s ease;
}

.th-avatar:hover {
    transform: scale(1.1);
}

/* === MODE ÉDITION ADMIN === */

/* Container du bouton mode édition */
.edit-mode-container {
    display: flex;
    justify-content: center;
    margin-bottom: 10px;
}

/* Bouton mode édition */
.edit-mode-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.2), rgba(251, 191, 36, 0.1));
    border: 2px solid rgba(251, 191, 36, 0.4);
    border-radius: 25px;
    color: #fbbf24;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.edit-mode-btn:hover {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.3), rgba(251, 191, 36, 0.2));
    transform: scale(1.02);
}

.edit-mode-btn.active {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #1e1b4b;
    border-color: #fbbf24;
    box-shadow: 0 0 20px rgba(251, 191, 36, 0.4);
}

.edit-mode-btn .edit-icon {
    font-size: 1.2em;
}

/* Overlay de pause */
/* Overlay de pause */
.game-pause-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1500;
}

.pause-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    padding: 30px 40px;
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(251, 191, 36, 0.3);
    border-radius: 24px;
    text-align: center;
    color: #fbbf24;
    font-size: 1.2rem;
    font-weight: 600;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    max-width: 90%;
    width: 400px;
}

.pause-message .pause-icon {
    font-size: 3rem;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

/* Cases éditables en mode admin */
.score-cell.admin-editable {
    cursor: pointer;
    position: relative;
}

.score-cell.admin-editable::after {
    content: '✏️';
    position: absolute;
    top: 2px;
    right: 2px;
    font-size: 0.6rem;
    opacity: 0.6;
}

/* Cases vides éditables - icône + */
.score-cell.admin-editable-empty::after {
    content: '➕';
}

.score-cell.admin-editable:hover {
    background: rgba(251, 191, 36, 0.2) !important;
    border-color: #fbbf24 !important;
}

/* Options d'édition dans les modals */
.edit-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 20px 0;
}

.edit-info {
    text-align: center;
    margin-bottom: 15px;
    color: #e0e0e0;
}

.edit-info .current-val {
    font-weight: bold;
    color: #fbbf24;
    font-size: 1.2em;
}

/* Boutons de modal spéciaux */
.modal-btn.btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    border-color: #ef4444;
}

.modal-btn.btn-danger:hover {
    background: linear-gradient(135deg, #f87171, #ef4444);
}

.modal-btn.btn-warning {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    border-color: #f59e0b;
    color: #1e1b4b;
}

.modal-btn.btn-warning:hover {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
}

.modal-btn.btn-success {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    border-color: #22c55e;
}

.modal-btn.btn-success:hover {
    background: linear-gradient(135deg, #4ade80, #22c55e);
}

/* Spinner d'attente */
.waiting-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(251, 191, 36, 0.3);
    border-top-color: #fbbf24;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* === MODALS D'ÉDITION ADMIN === */

/* Override modal-overlay pour les modals d'édition - position fixed plein écran */
.edit-score-modal,
.edit-numpad-modal,
.reset-choice-modal,
.end-game-confirm-modal,
.waiting-admin-modal {
    position: fixed !important;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

/* Container de la modal */
.modal-container {
    background: linear-gradient(135deg, rgba(30, 27, 75, 0.95), rgba(15, 23, 42, 0.95));
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 25px 30px;
    max-width: 90%;
    width: 350px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

/* Titre de la modal */
.modal-title {
    margin: 0 0 20px 0;
    font-size: 1.3rem;
    color: #fbbf24;
}

/* Boutons de modal */
.modal-btn {
    display: block;
    width: 100%;
    padding: 12px 20px;
    margin: 8px 0;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.modal-btn.btn-primary {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: white;
}

.modal-btn.btn-primary:hover {
    background: linear-gradient(135deg, #818cf8, #6366f1);
    transform: translateY(-2px);
}

.modal-btn.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #e0e0e0;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.modal-btn.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Numpad pour édition */
.numpad-display {
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(251, 191, 36, 0.4);
    border-radius: 10px;
    padding: 15px;
    font-size: 2rem;
    color: #fbbf24;
    text-align: center;
    margin-bottom: 15px;
    min-height: 50px;
}

.numpad-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 15px;
}

.numpad-btn {
    padding: 15px;
    font-size: 1.5rem;
    font-weight: bold;
    border: none;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

.numpad-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.numpad-btn.numpad-clear {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    box-shadow: 0 4px 6px -1px rgba(220, 38, 38, 0.3);
}

.numpad-btn.numpad-clear:hover {
    background: linear-gradient(135deg, #f87171, #ef4444);
    transform: translateY(-2px);
}

.numpad-btn.numpad-confirm {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: white;
    box-shadow: 0 4px 6px -1px rgba(22, 163, 74, 0.3);
}

.numpad-btn.numpad-confirm:hover {
    background: linear-gradient(135deg, #4ade80, #22c55e);
    transform: translateY(-2px);
}

/* === BOUTON ÉDITION FLOTTANT (FAB) === */
.edit-mode-fab {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    border: none;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    z-index: 1000;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.edit-mode-fab .edit-icon {
    font-size: 24px;
    transition: transform 0.3s ease;
}

.edit-mode-fab:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 25px rgba(245, 158, 11, 0.6);
}

.edit-mode-fab.active {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
    animation: pulseFab 2s infinite;
}

.edit-mode-fab.active .edit-icon {
    transform: rotate(45deg);
}

@keyframes pulseFab {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
    }

    70% {
        box-shadow: 0 0 0 15px rgba(239, 68, 68, 0);
    }
}

/* Ajustement mobile pour FAB */
@media (max-width: 480px) {
    .edit-mode-fab {
        bottom: 20px;
        right: 20px;
        width: 50px;
        height: 50px;
    }

    .edit-mode-fab .edit-icon {
        font-size: 20px;
    }
}

/* === TOAST DE CHANGEMENT DE TOUR === */
.turn-toast {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background: rgba(30, 41, 59, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 14px 24px;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 1500;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

.turn-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.turn-toast .toast-icon {
    font-size: 24px;
}

.turn-toast .toast-text {
    font-size: 16px;
    font-weight: 600;
    color: #e0e0e0;
}

.turn-toast.my-turn {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.9), rgba(34, 197, 94, 0.8));
    border-color: rgba(34, 197, 94, 0.4);
}

.turn-toast.my-turn .toast-text {
    color: white;
}

/* === INDICATEUR DE TOUR SUR AVATAR === */
.turn-indicator {
    position: absolute;
    top: -6px;
    right: -10px;
    font-size: 18px;
    animation: spinIndicator 4s linear infinite;
    z-index: 20;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
    transform-origin: center center;
    line-height: 1;
    pointer-events: none;
}

/* Conteneur principal positionné mais sans overflow hidden */
.th-avatar-container {
    position: relative;
    width: 32px;
    height: 32px;
    margin: 0 auto;
    cursor: pointer;
}

/* Masque rond pour l'image */
.th-avatar-mask {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    overflow: hidden;
    position: relative;
    border: 2px solid transparent;
    /* Bordure gérée via style inline ou classe */
    box-sizing: border-box;
}

.th-avatar-mask img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Glow appliqué sur le masque */
.th-avatar-container.is-current-turn .th-avatar-mask {
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.8), 0 0 5px rgba(16, 185, 129, 0.5);
    border-color: #10b981 !important;
}

@keyframes spinIndicator {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* Correction Admin Edit : Forcer l'affichage du + sur toutes les cases vides */
.score-cell.admin-editable-empty {
    position: relative;
}

.score-cell.admin-editable-empty::before {
    content: '+';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 18px;
    color: #f59e0b;
    /* Couleur orange style crayon */
    font-weight: bold;
    opacity: 0.9;
    z-index: 5;
    pointer-events: none;
}

/* Forcer l'affichage même si des styles spécifiques existent */
.score-sheet td.score-cell.admin-editable-empty::before {
    display: block !important;
    content: '+' !important;
    position: absolute !important;
    top: 4px !important;
    right: 4px !important;
    left: auto !important;
    bottom: auto !important;
    transform: none !important;
    font-size: 14px !important;
    line-height: 1 !important;
    color: var(--warning-color) !important;
    pointer-events: none !important;
    background: none !important;
    width: auto !important;
    height: auto !important;
}