:root {
    --color-primary: #FF6B35;
    --color-secondary: #FFC947;
    --color-accent: #FF006E;
    --color-success: #06FFA5;
    --color-dark: #230338;
    --color-light: #FFF8F0;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Fredoka', sans-serif;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-accent) 50%, var(--color-dark) 100%);
    background-attachment: fixed;
    min-height: 100vh;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1vh;
    overflow-x: hidden;
}

/* Animated background shapes */
body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background:
        radial-gradient(circle at 20% 50%, rgba(255, 199, 71, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 50%, rgba(6, 255, 165, 0.15) 0%, transparent 50%);
    animation: float 20s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(30px, -30px) rotate(120deg); }
    66% { transform: translate(-20px, 20px) rotate(240deg); }
}

#app {
    width: 100%;
    max-width: 500px;
    height: 98vh;
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
}

.screen {
    display: none;
}

.screen.active {
    display: flex;
    flex-direction: column;
    height: 100%;
    animation: slideIn 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.container {
    background: var(--color-light);
    border-radius: 20px;
    padding: 12px;
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.3),
        0 0 0 6px rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 8px;
    background: linear-gradient(90deg,
        var(--color-primary) 0%,
        var(--color-secondary) 25%,
        var(--color-success) 50%,
        var(--color-accent) 75%,
        var(--color-primary) 100%);
    animation: rainbow 3s linear infinite;
    background-size: 200% 100%;
}

@keyframes rainbow {
    0% { background-position: 0% 0%; }
    100% { background-position: 200% 0%; }
}

h1 {
    font-size: 2.2em;
    font-weight: 700;
    text-align: center;
    margin-bottom: 8px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: bounce 0.6s ease-out;
    letter-spacing: -1px;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

h2 {
    font-size: 1.5em;
    font-weight: 700;
    color: var(--color-dark);
    text-align: center;
    margin-bottom: 12px;
    animation: slideDown 0.5s ease-out;
}

h3 {
    font-size: 1.3em;
    font-weight: 700;
    margin: 0;
}

h4 {
    font-size: 1em;
    font-weight: 700;
    color: var(--color-dark);
    margin: 0;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

h3 {
    font-size: 1.6em;
    font-weight: 600;
    color: white;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

h4 {
    font-size: 1.1em;
    font-weight: 600;
    color: var(--color-dark);
    margin-bottom: 15px;
}

.subtitle {
    text-align: center;
    color: var(--color-dark);
    font-size: 1.1em;
    margin-bottom: 30px;
    font-weight: 500;
    opacity: 0.8;
}

.instruction {
    text-align: center;
    color: var(--color-dark);
    font-size: 1em;
    margin-bottom: 20px;
    opacity: 0.8;
}

/* Timer styles */
.timer-container {
    width: 100px;
    height: 100px;
    margin: 10px auto;
    position: relative;
    animation: pulse 2s ease-in-out infinite;
    flex-shrink: 0;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.timer-svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.timer-circle-bg {
    fill: none;
    stroke: rgba(255, 107, 53, 0.2);
    stroke-width: 8;
}

.timer-circle {
    fill: none;
    stroke: var(--color-primary);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 283;
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 1s linear;
    filter: drop-shadow(0 0 8px var(--color-primary));
}

.timer-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2.5em;
    font-weight: 700;
    color: var(--color-primary);
    text-shadow: 0 2px 10px rgba(255, 107, 53, 0.3);
}

/* Input styles */
input[type="text"] {
    width: 100%;
    padding: 14px 16px;
    font-size: 16px;
    font-family: 'Fredoka', sans-serif;
    font-weight: 500;
    border: 3px solid var(--color-dark);
    border-radius: 16px;
    margin-bottom: 10px;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    background: white;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

input[type="text"]:focus {
    outline: none;
    border-color: var(--color-primary);
    transform: scale(1.02);
    box-shadow: 0 6px 20px rgba(255, 107, 53, 0.3);
}

/* Button styles */
.btn-primary, .btn-danger {
    width: 100%;
    padding: 14px 20px;
    font-size: 16px;
    font-weight: 700;
    font-family: 'Fredoka', sans-serif;
    border: none;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
    color: white;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-primary:active::before {
    width: 300px;
    height: 300px;
}

.btn-primary:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 25px rgba(255, 107, 53, 0.4);
}

.btn-primary:active {
    transform: translateY(0) scale(0.98);
}

.btn-danger {
    background: linear-gradient(135deg, var(--color-accent), var(--color-primary));
    color: white;
    margin-top: 20px;
}

.btn-danger:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 25px rgba(255, 0, 110, 0.4);
}

.btn-danger:active {
    transform: translateY(0) scale(0.98);
}

/* Players list */
.players-list {
    background: white;
    border-radius: 16px;
    padding: 10px;
    margin-bottom: 12px;
    max-height: 120px;
    overflow-y: auto;
    border: 3px solid var(--color-dark);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.players-list::-webkit-scrollbar {
    width: 6px;
}

.players-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 10px;
}

.players-list::-webkit-scrollbar-thumb {
    background: var(--color-primary);
    border-radius: 10px;
}

.player-item {
    background: linear-gradient(135deg, var(--color-secondary), var(--color-success));
    padding: 10px 14px;
    border-radius: 12px;
    margin-bottom: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
    border: 2.5px solid var(--color-dark);
    animation: popIn 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    transition: transform 0.2s ease;
}

.player-item:last-child {
    margin-bottom: 0;
}

.player-item:hover {
    transform: translateX(3px) scale(1.02);
}

@keyframes popIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.player-name {
    font-weight: 700;
    color: var(--color-dark);
    font-size: 0.95em;
}

.player-score {
    background: var(--color-dark);
    color: var(--color-secondary);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: 700;
    min-width: 50px;
    text-align: center;
}

.info-text {
    text-align: center;
    color: var(--color-dark);
    margin: 15px 0;
    opacity: 0.7;
    font-weight: 500;
}

.success-text {
    text-align: center;
    color: var(--color-success);
    font-weight: 700;
    margin: 15px 0;
    font-size: 1.2em;
    animation: pulse 1s ease-in-out infinite;
    text-shadow: 0 2px 10px rgba(6, 255, 165, 0.3);
}

/* Word display */
/* Mime container optimization */
.mime-container {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.mime-header {
    flex-shrink: 0;
    text-align: center;
}

.mime-header h2 {
    margin-bottom: 4px;
}

.mime-header .instruction {
    margin-bottom: 10px;
    font-size: 0.9em;
}

#word-input-section {
    flex-shrink: 0;
}

.miming-section-flex {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.word-display {
    background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
    color: white;
    padding: 15px;
    border-radius: 16px;
    text-align: center;
    margin-bottom: 10px;
    border: 3px solid var(--color-dark);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
    animation: bounceIn 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    flex-shrink: 0;
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.word-display p {
    font-size: 0.9em;
    opacity: 0.9;
    margin-bottom: 8px;
    font-weight: 500;
}

/* Guesses container */
.guesses-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    margin-bottom: 10px;
}

.guesses-container h4 {
    margin-bottom: 8px;
    flex-shrink: 0;
    font-size: 1em;
}

#guesses-list {
    background: white;
    border-radius: 16px;
    padding: 12px;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    border: 3px solid var(--color-dark);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

#guesses-list::-webkit-scrollbar {
    width: 8px;
}

#guesses-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 10px;
}

#guesses-list::-webkit-scrollbar-thumb {
    background: var(--color-primary);
    border-radius: 10px;
}

.guess-item {
    background: white;
    padding: 10px 12px;
    border-radius: 12px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    border: 2.5px solid var(--color-dark);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
    animation: slideInRight 0.3s ease-out;
}

.guess-item:last-child {
    margin-bottom: 0;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.guess-item:hover {
    transform: translateX(5px) scale(1.02);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
}

.guess-item.selected {
    border-color: var(--color-success);
    background: linear-gradient(135deg, rgba(6, 255, 165, 0.2), rgba(255, 199, 71, 0.2));
    transform: scale(1.05);
    box-shadow: 0 8px 20px rgba(6, 255, 165, 0.3);
}

.guess-player {
    font-weight: 700;
    color: var(--color-primary);
    margin-bottom: 5px;
    font-size: 0.9em;
}

.guess-text {
    color: var(--color-dark);
    font-size: 1.2em;
    font-weight: 600;
}

/* Results container optimization */
.results-container {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.results-container h2 {
    flex-shrink: 0;
    margin-bottom: 8px;
}

.results-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    gap: 12px;
}

/* Word reveal */
.word-reveal {
    background: linear-gradient(135deg, var(--color-accent), var(--color-primary));
    color: white;
    padding: 12px 15px;
    border-radius: 16px;
    text-align: center;
    margin-bottom: 8px;
    border: 3px solid var(--color-dark);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
    animation: tada 0.8s ease-out;
    flex-shrink: 0;
}

@keyframes tada {
    0% { transform: scale(1) rotate(0deg); }
    10%, 20% { transform: scale(0.9) rotate(-3deg); }
    30%, 50%, 70%, 90% { transform: scale(1.1) rotate(3deg); }
    40%, 60%, 80% { transform: scale(1.1) rotate(-3deg); }
    100% { transform: scale(1) rotate(0deg); }
}

.word-reveal p {
    font-size: 0.9em;
    opacity: 0.9;
    margin-bottom: 8px;
    font-weight: 500;
}

/* Winner announcement */
#winner-announcement {
    text-align: center;
    padding: 10px;
    margin-bottom: 8px;
    flex-shrink: 0;
}

.winner-text {
    font-size: 1.5em;
    color: var(--color-success);
    font-weight: 700;
    animation: winnerPulse 1s ease-in-out infinite;
    text-shadow: 0 4px 15px rgba(6, 255, 165, 0.5);
}

@keyframes winnerPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* All guesses & scoreboard */
.all-guesses, .scoreboard {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.all-guesses h4, .scoreboard h4 {
    margin-bottom: 8px;
    flex-shrink: 0;
    font-size: 1em;
}

#all-guesses-list, #scoreboard-list {
    background: white;
    border-radius: 16px;
    padding: 12px;
    border: 3px solid var(--color-dark);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

#all-guesses-list::-webkit-scrollbar,
#scoreboard-list::-webkit-scrollbar {
    width: 6px;
}

#all-guesses-list::-webkit-scrollbar-track,
#scoreboard-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 10px;
}

#all-guesses-list::-webkit-scrollbar-thumb,
#scoreboard-list::-webkit-scrollbar-thumb {
    background: var(--color-primary);
    border-radius: 10px;
}

.empty-state {
    text-align: center;
    color: var(--color-dark);
    padding: 30px 20px;
    font-style: italic;
    opacity: 0.6;
    font-weight: 500;
}

/* Confetti canvas */
#confetti-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
}

/* Mobile optimizations */
@media (max-width: 480px) {
    body {
        padding: 0.5vh;
    }

    #app {
        height: 99vh;
    }

    .container {
        padding: 10px;
        border-radius: 16px;
    }

    h1 {
        font-size: 1.8em;
        margin-bottom: 6px;
    }

    h2 {
        font-size: 1.3em;
        margin-bottom: 8px;
    }

    .timer-container {
        width: 90px;
        height: 90px;
        margin: 12px auto;
    }

    .timer-text {
        font-size: 1.8em;
    }

    input[type="text"] {
        font-size: 16px;
        padding: 12px 14px;
        margin-bottom: 8px;
    }

    .btn-primary, .btn-danger {
        font-size: 15px;
        padding: 10px 16px;
    }

    .lobby-header {
        margin-bottom: 6px;
        gap: 8px;
    }

    .lobby-header h2 {
        font-size: 1em;
    }

    .room-code-compact {
        padding: 5px 8px;
    }

    .room-code-compact #room-code-text {
        font-size: 1.1em;
        letter-spacing: 2px;
    }

    .character-preview {
        margin: 8px 0 6px 0;
    }

    #preview-character {
        width: 75px;
        height: 87px;
    }

    .color-selector {
        gap: 6px;
        margin: 6px 0 10px 0;
    }

    .color-btn {
        width: 34px;
        height: 34px;
    }

    .emote-buttons {
        margin-bottom: 4px;
    }

    /* Optimisations écrans mime et résultats sur mobile */
    .timer-container {
        width: 80px;
        height: 80px;
        margin: 8px auto;
    }

    .word-display,
    .word-reveal {
        padding: 10px 12px;
        margin-bottom: 6px;
    }

    .word-display h3,
    .word-reveal h3 {
        font-size: 1.1em;
    }

    #winner-announcement {
        padding: 6px;
        margin-bottom: 6px;
    }

    .winner-text {
        font-size: 1.2em;
    }

    .mime-header h2,
    .results-container h2 {
        font-size: 1.2em;
    }

    .mime-header .instruction {
        font-size: 0.85em;
        margin-bottom: 8px;
    }

    .guesses-container h4,
    .all-guesses h4,
    .scoreboard h4 {
        font-size: 0.9em;
    }
}

/* Landscape mobile */
@media (max-width: 900px) and (orientation: landscape) {
    body {
        align-items: flex-start;
        padding-top: 20px;
    }

    .container {
        max-height: 90vh;
        overflow-y: auto;
    }
}

/* Prevent text selection on touch */
.btn-primary, .btn-danger, .guess-item {
    -webkit-user-select: none;
    user-select: none;
}

/* Active touch feedback */
.btn-primary:active, .btn-danger:active {
    opacity: 0.9;
}

/* Lobby Interactive Playground */
.lobby-container {
    position: relative;
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Lobby header - titre et code sur même ligne */
.lobby-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    gap: 12px;
    flex-shrink: 0;
}

.lobby-header h2 {
    margin: 0;
    font-size: 1.2em;
    flex-shrink: 0;
}

.room-code-compact {
    display: flex;
    align-items: center;
    gap: 6px;
    background: white;
    padding: 6px 10px;
    border-radius: 10px;
    border: 2.5px solid var(--color-dark);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
}

.room-code-compact #room-code-text {
    font-size: 1.3em;
    font-weight: 700;
    color: var(--color-primary);
    letter-spacing: 3px;
    text-shadow:
        0 2px 8px rgba(255, 107, 53, 0.3);
    font-family: 'Courier New', monospace;
}

#lobby-playground {
    position: relative;
    width: 100%;
    flex: 1;
    min-height: 0;
    background:
        radial-gradient(circle at 20% 30%, rgba(255, 199, 71, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(6, 255, 165, 0.15) 0%, transparent 50%),
        linear-gradient(135deg, rgba(255, 199, 71, 0.08), rgba(6, 255, 165, 0.08));
    border: 3px solid var(--color-dark);
    border-radius: 16px;
    margin-bottom: 6px;
    overflow: hidden;
    box-shadow:
        inset 0 2px 8px rgba(0, 0, 0, 0.05),
        0 4px 15px rgba(0, 0, 0, 0.1);
}

/* Boutons compacts dans les containers optimisés */
.lobby-container .btn-primary,
.mime-container .btn-primary,
.mime-container .btn-danger,
.results-container .btn-primary {
    padding: 12px 18px;
    font-size: 15px;
    flex-shrink: 0;
}

#characters-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

#emotes-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* Character styles */
.lobby-character {
    position: absolute;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
    z-index: 10;
    transition:
        transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1),
        filter 0.2s ease;
    will-change: transform;
}

.lobby-character:active {
    cursor: grabbing;
    transform: scale(1.2) rotate(5deg);
    z-index: 100;
    filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.4));
}

.amongus-character {
    width: 55px;
    height: 66px;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.3));
    animation: bobFloat 2.5s ease-in-out infinite;
    transition: filter 0.3s ease;
}

.lobby-character:hover .amongus-character {
    animation: excitedBounce 0.6s cubic-bezier(0.36, 0, 0.66, -0.56) infinite;
    filter: drop-shadow(0 6px 15px rgba(0, 0, 0, 0.4));
}

@keyframes bobFloat {
    0%, 100% {
        transform: translateY(0px) rotate(-1deg);
    }
    50% {
        transform: translateY(-6px) rotate(1deg);
    }
}

@keyframes excitedBounce {
    0%, 100% {
        transform: translateY(0px) rotate(0deg) scale(1);
    }
    25% {
        transform: translateY(-3px) rotate(-8deg) scale(1.05);
    }
    50% {
        transform: translateY(-8px) rotate(0deg) scale(1.08);
    }
    75% {
        transform: translateY(-3px) rotate(8deg) scale(1.05);
    }
}

@keyframes wobble {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-8deg) scale(1.05); }
    50% { transform: scale(1.1); }
    75% { transform: rotate(8deg) scale(1.05); }
}

.character-name {
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--color-dark);
    color: var(--color-secondary);
    padding: 4px 10px;
    border-radius: 10px;
    font-size: 0.75em;
    font-weight: 700;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Emote buttons */
.emote-buttons {
    display: flex;
    gap: 6px;
    justify-content: center;
    margin-bottom: 6px;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.emote-btn {
    width: 42px;
    height: 42px;
    border: 2.5px solid var(--color-dark);
    border-radius: 12px;
    background: white;
    font-size: 1.5em;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    -webkit-user-select: none;
    position: relative;
    overflow: hidden;
}

.emote-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 199, 71, 0.3), rgba(6, 255, 165, 0.3));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.emote-btn:hover {
    transform: scale(1.15) rotate(8deg);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.25);
}

.emote-btn:hover::before {
    opacity: 1;
}

.emote-btn:active {
    transform: scale(0.9) rotate(-5deg);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

/* Flying emote animation */
.flying-emote {
    position: absolute;
    width: 70px;
    height: 70px;
    pointer-events: none;
    animation: emotePop 2s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
    z-index: 50;
    filter:
        drop-shadow(0 4px 12px rgba(0, 0, 0, 0.4))
        drop-shadow(0 0 8px rgba(255, 199, 71, 0.5));
}

.flying-emote::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255, 199, 71, 0.4) 0%, transparent 70%);
    transform: translate(-50%, -50%);
    animation: emotePulse 0.6s ease-out;
    border-radius: 50%;
    z-index: -1;
}

.flying-emote svg {
    width: 100%;
    height: 100%;
    animation: emoteRotate 2s ease-out forwards;
}

@keyframes emotePop {
    0% {
        opacity: 0;
        transform: translateY(0) scale(0.2);
    }
    15% {
        opacity: 1;
        transform: translateY(-20px) scale(1.4);
    }
    30% {
        transform: translateY(-40px) scale(1.2);
    }
    50% {
        transform: translateY(-60px) scale(1.3);
    }
    70% {
        opacity: 1;
        transform: translateY(-75px) scale(1.1);
    }
    85% {
        opacity: 0.8;
        transform: translateY(-85px) scale(0.9);
    }
    100% {
        opacity: 0;
        transform: translateY(-95px) scale(0.5);
    }
}

@keyframes emoteRotate {
    0% {
        transform: rotate(-30deg);
    }
    20% {
        transform: rotate(15deg);
    }
    40% {
        transform: rotate(-10deg);
    }
    60% {
        transform: rotate(8deg);
    }
    80% {
        transform: rotate(-5deg);
    }
    100% {
        transform: rotate(0deg);
    }
}

@keyframes emotePulse {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
    100% {
        transform: translate(-50%, -50%) scale(2.5);
        opacity: 0;
    }
}

/* Custom emote styles */
.custom-emote {
    animation-duration: 1.5s;
    animation-iteration-count: infinite;
}

.emote-haha {
    animation-name: shake;
}

.emote-rage {
    animation-name: vibrate;
}

.emote-cry {
    animation-name: sob;
}

.emote-oof {
    animation-name: shock;
}

.emote-dab {
    animation-name: dabMove;
}

.emote-gg {
    animation-name: celebrate;
}

.emote-king {
    animation-name: kingLaugh;
}

@keyframes shake {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-5deg) scale(1.05); }
    75% { transform: rotate(5deg) scale(1.05); }
}

@keyframes kingLaugh {
    0%, 100% { transform: rotate(0deg) scale(1); }
    10% { transform: rotate(-3deg) scale(1.02); }
    20% { transform: rotate(3deg) scale(0.98); }
    30% { transform: rotate(-2deg) scale(1.03); }
    40% { transform: rotate(2deg) scale(0.97); }
    50% { transform: rotate(-3deg) scale(1.02); }
    60% { transform: rotate(3deg) scale(0.98); }
    70% { transform: rotate(-2deg) scale(1.01); }
    80% { transform: rotate(2deg) scale(0.99); }
    90% { transform: rotate(-1deg) scale(1.01); }
}

@keyframes vibrate {
    0%, 100% { transform: translate(0, 0); }
    25% { transform: translate(-2px, -2px) scale(1.02); }
    50% { transform: translate(2px, 2px) scale(1.02); }
    75% { transform: translate(-2px, 2px) scale(1.02); }
}

@keyframes sob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

@keyframes shock {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

@keyframes dabMove {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(-10deg); }
}

@keyframes celebrate {
    0%, 100% { transform: rotate(0deg) scale(1); }
    25% { transform: rotate(-10deg) scale(1.1); }
    75% { transform: rotate(10deg) scale(1.1); }
}

/* Mobile adjustments */
@media (max-width: 480px) {
    .amongus-character {
        width: 48px;
        height: 58px;
    }

    .character-name {
        font-size: 0.65em;
        padding: 3px 7px;
        top: -22px;
    }

    .emote-btn {
        width: 38px;
        height: 38px;
        font-size: 1.3em;
    }

    .emote-buttons {
        margin-bottom: 8px;
    }

    .flying-emote {
        width: 60px;
        height: 60px;
    }

    .player-name {
        font-size: 0.85em;
    }

    .player-score {
        font-size: 0.8em;
        padding: 5px 10px;
    }
}

/* Login screen steps */
#name-step, #mode-step, #join-step {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
}

.player-welcome {
    color: var(--color-dark);
    font-size: 1.2em;
    text-align: center;
    margin: 10px 0;
    font-weight: 500;
}

.player-welcome strong {
    color: var(--color-primary);
    font-weight: 700;
    text-shadow: 0 2px 8px rgba(255, 107, 53, 0.3);
}

.btn-secondary {
    background: linear-gradient(135deg, #666 0%, #888 100%);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 50px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.info-text {
    color: var(--color-light);
    text-align: center;
    font-size: 1.1em;
    margin: 5px 0;
}

/* Bouton copier code */
.btn-copy {
    background: var(--color-primary);
    border: 2px solid var(--color-dark);
    border-radius: 8px;
    padding: 5px 8px;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    line-height: 1;
}

.btn-copy:hover {
    background: var(--color-secondary);
    border-color: var(--color-dark);
    transform: scale(1.15) rotate(8deg);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.btn-copy:active {
    transform: scale(0.9) rotate(-5deg);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

/* Error message */
.error-message {
    background: rgba(255, 0, 110, 0.2);
    border: 2px solid var(--color-accent);
    border-radius: 15px;
    padding: 12px 20px;
    color: var(--color-light);
    text-align: center;
    margin: 10px 0;
    animation: shake 0.5s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

/* Character preview on login screen */
.character-preview {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 12px 0 8px 0;
}

#preview-character {
    width: 90px;
    height: 105px;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.3));
    animation: float-character 3s ease-in-out infinite;
}

@keyframes float-character {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-8px); }
}

/* Customization controls */
.customization-controls {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 10px 0;
}

.custom-selector {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: white;
    padding: 8px 12px;
    border-radius: 12px;
    border: 2.5px solid var(--color-dark);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
}

.custom-label {
    font-size: 0.85em;
    font-weight: 600;
    color: var(--color-dark);
    flex: 1;
    text-align: center;
}

.custom-arrow {
    background: var(--color-primary);
    border: 2px solid var(--color-dark);
    border-radius: 8px;
    width: 32px;
    height: 32px;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
}

.custom-arrow:hover {
    background: var(--color-accent);
    transform: scale(1.1);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.custom-arrow:active {
    transform: scale(0.95);
}

/* Color selector */
.color-selector {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin: 8px 0 12px 0;
    flex-wrap: wrap;
}

.color-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.3);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.color-btn:hover {
    transform: scale(1.15);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

.color-btn.active {
    border-color: #FFF;
    border-width: 3px;
    transform: scale(1.25);
    box-shadow:
        0 4px 15px rgba(255, 255, 255, 0.5),
        0 0 20px rgba(255, 255, 255, 0.3);
    animation: colorPulse 1.5s ease-in-out infinite;
}

@keyframes colorPulse {
    0%, 100% {
        box-shadow:
            0 4px 15px rgba(255, 255, 255, 0.5),
            0 0 20px rgba(255, 255, 255, 0.3);
    }
    50% {
        box-shadow:
            0 4px 20px rgba(255, 255, 255, 0.7),
            0 0 30px rgba(255, 255, 255, 0.5);
    }
}
