/* ========================================
   UNO ONLINE - ENHANCED STYLES
   Custom textures, animations, modern UI
   ======================================== */

:root {
    --uno-red: #E63946;
    --uno-blue: #457B9D;
    --uno-green: #2D6A4F;
    --uno-yellow: #F4A261;
    --uno-black: #1D3557;

    --bg-primary: #0a0a12;
    --bg-secondary: #12121f;
    --bg-card: #1a1a2e;
    --bg-glass: rgba(26, 26, 46, 0.85);
    --text-primary: #f8f9fa;
    --text-secondary: #8b8ba7;
    --accent: #a855f7;
    --accent-glow: rgba(168, 85, 247, 0.4);
    --success: #10b981;
    --error: #ef4444;

    --card-width: 75px;
    --card-height: 110px;
    --card-radius: 12px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Particles background */
.particles {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -1;
    background:
        radial-gradient(ellipse at 20% 20%, rgba(232, 57, 70, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 30%, rgba(69, 123, 157, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 40% 80%, rgba(45, 106, 79, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 70%, rgba(244, 162, 97, 0.08) 0%, transparent 50%);
}

.screen {
    display: none;
    min-height: 100vh;
}

.screen.active {
    display: flex;
}

.hidden {
    display: none !important;
}

/* ========================================
   LOBBY STYLES
   ======================================== */

#lobby {
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.lobby-container {
    background: var(--bg-glass);
    backdrop-filter: blur(30px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 28px;
    padding: 48px 40px;
    width: 100%;
    max-width: 440px;
    box-shadow:
        0 30px 60px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.logo {
    text-align: center;
    margin-bottom: 40px;
}

.uno-card-logo {
    margin-bottom: 16px;
}

.card-stack {
    display: flex;
    justify-content: center;
    gap: -15px;
}

.mini-card {
    width: 30px;
    height: 45px;
    border-radius: 6px;
    margin-left: -12px;
    transform: rotate(-10deg);
    animation: cardFloat 3s ease-in-out infinite;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.mini-card:nth-child(1) {
    animation-delay: 0s;
    transform: rotate(-15deg);
}

.mini-card:nth-child(2) {
    animation-delay: 0.2s;
    transform: rotate(-5deg);
}

.mini-card:nth-child(3) {
    animation-delay: 0.4s;
    transform: rotate(5deg);
}

.mini-card:nth-child(4) {
    animation-delay: 0.6s;
    transform: rotate(15deg);
}

.mini-card.red {
    background: linear-gradient(135deg, var(--uno-red), #c1121f);
}

.mini-card.blue {
    background: linear-gradient(135deg, var(--uno-blue), #1d3557);
}

.mini-card.yellow {
    background: linear-gradient(135deg, var(--uno-yellow), #e76f51);
}

.mini-card.green {
    background: linear-gradient(135deg, var(--uno-green), #1b4332);
}

@keyframes cardFloat {

    0%,
    100% {
        transform: translateY(0) rotate(var(--rotate, -10deg));
    }

    50% {
        transform: translateY(-6px) rotate(var(--rotate, -10deg));
    }
}

.uno-title {
    font-size: 4.5rem;
    font-weight: 800;
    letter-spacing: -3px;
    margin-bottom: 4px;
    text-shadow: 0 0 60px rgba(255, 255, 255, 0.1);
}

.uno-title .letter {
    display: inline-block;
    text-shadow: 0 4px 30px currentColor;
}

.uno-title .letter.red {
    color: var(--uno-red);
}

.uno-title .letter.yellow {
    color: var(--uno-yellow);
}

.uno-title .letter.green {
    color: var(--uno-green);
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 400;
    letter-spacing: 3px;
    text-transform: uppercase;
}

.menu-section {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.input-field {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    padding: 16px 20px;
    font-size: 1rem;
    font-family: inherit;
    color: var(--text-primary);
    transition: all 0.3s ease;
    width: 100%;
}

.input-field:focus {
    outline: none;
    border-color: var(--accent);
    background: rgba(168, 85, 247, 0.05);
    box-shadow: 0 0 30px var(--accent-glow);
}

.input-field::placeholder {
    color: var(--text-secondary);
}

.code-input {
    text-transform: uppercase;
    letter-spacing: 6px;
    text-align: center;
    font-weight: 700;
    font-size: 1.2rem;
}

/* Buttons */
.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px 24px;
    border: none;
    border-radius: 14px;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), transparent);
    opacity: 0;
    transition: opacity 0.3s;
}

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

.btn-primary {
    background: linear-gradient(135deg, var(--accent), #7c3aed);
    color: white;
    box-shadow: 0 4px 25px var(--accent-glow);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 35px var(--accent-glow);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-accent {
    background: linear-gradient(135deg, var(--uno-blue), #1d3557);
    color: white;
}

.btn-small {
    padding: 10px 16px;
    font-size: 0.9rem;
}

.btn-large {
    padding: 18px 32px;
    font-size: 1.1rem;
}

.btn-icon-only {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 10px 14px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s ease;
}

.btn-icon-only:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.05);
}

.pulse-glow {
    animation: pulseGlow 2s ease-in-out infinite;
}

@keyframes pulseGlow {

    0%,
    100% {
        box-shadow: 0 4px 25px var(--accent-glow);
    }

    50% {
        box-shadow: 0 4px 40px var(--accent-glow), 0 0 60px var(--accent-glow);
    }
}

.divider {
    display: flex;
    align-items: center;
    gap: 16px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin: 8px 0;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
}

.join-section {
    display: flex;
    gap: 12px;
}

.join-section .input-field {
    flex: 1;
    min-width: 0;
}

/* Lobby Browser */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.section-header h2 {
    font-size: 1.2rem;
    font-weight: 600;
}

.lobbies-list {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 14px;
    padding: 8px;
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 16px;
}

.lobby-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.lobby-item:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.1);
}

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

.lobby-item .host-name {
    font-weight: 600;
}

.lobby-item .player-count {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.loading {
    text-align: center;
    color: var(--text-secondary);
    padding: 30px;
}

.no-lobbies {
    text-align: center;
    color: var(--text-secondary);
    padding: 30px;
}

/* Room Lobby */
.room-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.room-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.room-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.room-code {
    color: var(--accent);
    font-weight: 700;
    font-size: 1.3rem;
    letter-spacing: 3px;
}

/* Toggle Switch */
.toggle-switch {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.toggle-switch input {
    display: none;
}

.toggle-slider {
    width: 44px;
    height: 24px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    position: relative;
    transition: all 0.3s ease;
}

.toggle-slider::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    background: white;
    border-radius: 50%;
    top: 3px;
    left: 3px;
    transition: all 0.3s ease;
}

.toggle-switch input:checked+.toggle-slider {
    background: var(--success);
}

.toggle-switch input:checked+.toggle-slider::after {
    left: 23px;
}

.toggle-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.players-list {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 14px;
    padding: 12px;
    margin-bottom: 16px;
    max-height: 180px;
    overflow-y: auto;
}

.player-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-radius: 10px;
    margin-bottom: 6px;
    background: rgba(255, 255, 255, 0.03);
}

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

.player-item .name {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
}

.player-item .badge {
    font-size: 0.7rem;
    padding: 3px 8px;
    border-radius: 6px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge.host {
    background: linear-gradient(135deg, var(--uno-yellow), #e76f51);
    color: var(--bg-primary);
}

.badge.bot {
    background: linear-gradient(135deg, var(--uno-blue), #1d3557);
    color: white;
}

.remove-bot-btn {
    background: rgba(239, 68, 68, 0.2);
    border: none;
    color: var(--error);
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s ease;
}

.remove-bot-btn:hover {
    background: var(--error);
    color: white;
}

/* Rules Section */
.rules-section {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 16px;
}

.rules-section h3 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 14px;
    color: var(--text-secondary);
}

.rules-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.rule-toggle {
    display: flex;
    flex-direction: column;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.rule-toggle:hover {
    background: rgba(255, 255, 255, 0.06);
}

.rule-toggle input {
    display: none;
}

.rule-toggle input:checked~.rule-name {
    color: var(--accent);
}

.rule-toggle input:checked~.rule-name::before {
    content: '✓ ';
}

.rule-name {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 2px;
    transition: color 0.2s ease;
}

.rule-desc {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.lobby-controls {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.bot-controls {
    display: flex;
    gap: 10px;
}

.select-field {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 0.9rem;
    font-family: inherit;
    color: var(--text-primary);
    cursor: pointer;
}

.waiting-text {
    text-align: center;
    color: var(--text-secondary);
    font-style: italic;
    padding: 10px;
}

/* ========================================
   GAME SCREEN
   ======================================== */

#game {
    flex-direction: column;
    position: relative;
    padding: 20px;
    min-height: 100vh;
    background:
        radial-gradient(ellipse at center, rgba(26, 26, 46, 0.9) 0%, var(--bg-primary) 70%);
}

.direction-indicator {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-glass);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.direction-arrow {
    font-size: 1.6rem;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.direction-indicator.reversed .direction-arrow {
    transform: scaleX(-1);
}

/* Opponents */
.opponents-area {
    display: flex;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
    padding: 20px 50px;
    margin-bottom: 10px;
}

.opponent {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 20px;
    background: var(--bg-glass);
    backdrop-filter: blur(15px);
    border: 2px solid rgba(255, 255, 255, 0.08);
    border-radius: 18px;
    min-width: 110px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.opponent.active {
    border-color: var(--accent);
    box-shadow:
        0 0 40px var(--accent-glow),
        inset 0 0 20px rgba(168, 85, 247, 0.1);
    transform: scale(1.05);
}

.opponent .opponent-name {
    font-weight: 600;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.opponent .card-count {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 1.6rem;
    font-weight: 700;
}

.opponent .card-count .cards-icon {
    width: 20px;
    height: 28px;
    background: linear-gradient(135deg, #374151, #1f2937);
    border-radius: 4px;
    border: 2px solid #4b5563;
}

.opponent .uno-badge {
    background: linear-gradient(135deg, var(--uno-red), #c1121f);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 1px;
    animation: unoPulse 0.5s ease-in-out infinite alternate;
}

@keyframes unoPulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 15px rgba(230, 57, 70, 0.5);
    }

    100% {
        transform: scale(1.08);
        box-shadow: 0 0 25px rgba(230, 57, 70, 0.7);
    }
}

/* Game Center */
.game-center {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 24px;
}

.deck-area {
    display: flex;
    gap: 50px;
    align-items: center;
}

.deck,
.discard-pile {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.deck {
    cursor: pointer;
}

.deck:hover .deck-card {
    transform: translateY(-5px) rotateY(10deg);
}

.deck-card {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.deck-count {
    position: absolute;
    bottom: -8px;
    background: var(--bg-primary);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.discard-pile {
    perspective: 1000px;
}

.discard-pile .card {
    animation: cardLand 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes cardLand {
    0% {
        transform: translateY(-100px) rotateX(30deg) scale(0.8);
        opacity: 0;
    }

    100% {
        transform: translateY(0) rotateX(0) scale(1);
        opacity: 1;
    }
}

.color-ring {
    position: absolute;
    bottom: -20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 4px solid;
    box-shadow: 0 0 20px currentColor;
    transition: all 0.3s ease;
}

.color-ring.red {
    border-color: var(--uno-red);
    color: var(--uno-red);
}

.color-ring.blue {
    border-color: var(--uno-blue);
    color: var(--uno-blue);
}

.color-ring.green {
    border-color: var(--uno-green);
    color: var(--uno-green);
}

.color-ring.yellow {
    border-color: var(--uno-yellow);
    color: var(--uno-yellow);
}

.game-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

.turn-indicator {
    background: linear-gradient(135deg, var(--accent), #7c3aed);
    padding: 14px 28px;
    border-radius: 30px;
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 30px var(--accent-glow);
    transition: all 0.3s ease;
}

.turn-indicator.waiting {
    background: var(--bg-card);
    box-shadow: none;
}

.draw-stack {
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, var(--uno-red), #c1121f);
    padding: 10px 20px;
    border-radius: 25px;
    font-weight: 700;
    animation: drawStackPulse 0.8s ease-in-out infinite;
}

@keyframes drawStackPulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

.stack-icon {
    font-size: 1.2rem;
}

/* Player Area */
.player-area {
    padding: 20px;
    padding-bottom: 30px;
}

.player-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
}

.player-name {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-secondary);
}

.uno-button {
    position: relative;
    background: linear-gradient(135deg, var(--uno-red), #c1121f);
    border: none;
    color: white;
    padding: 14px 28px;
    border-radius: 30px;
    font-size: 1.1rem;
    font-weight: 800;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 20px rgba(230, 57, 70, 0.4);
    overflow: hidden;
}

.uno-button::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), transparent);
}

.uno-button:hover {
    transform: scale(1.1) rotate(-3deg);
    box-shadow: 0 8px 35px rgba(230, 57, 70, 0.6);
}

.uno-button:active {
    transform: scale(0.95);
}

.uno-text {
    position: relative;
    z-index: 1;
}

.hand-container {
    display: flex;
    justify-content: center;
    padding: 0 20px;
}

.hand {
    display: flex;
    justify-content: center;
    perspective: 1200px;
    max-width: 100%;
    flex-wrap: wrap;
    gap: 0;
}

/* ========================================
   CARDS
   ======================================== */

.card {
    width: var(--card-width);
    height: var(--card-height);
    border-radius: var(--card-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow:
        0 6px 20px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
    user-select: none;
    transform-style: preserve-3d;
}

/* Card inner oval */
.card::before {
    content: '';
    position: absolute;
    width: 70%;
    height: 80%;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 50%;
    transform: rotate(-15deg);
}

/* Card texture overlay */
.card::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--card-radius);
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
        linear-gradient(-135deg, transparent 50%, rgba(0, 0, 0, 0.1) 100%);
    pointer-events: none;
}

.card-back {
    background: linear-gradient(135deg, #2a2a3e, #1a1a2e);
    border: 3px solid #3d3d5c;
}

.card-back .card-pattern {
    position: absolute;
    width: 60%;
    height: 75%;
    background:
        linear-gradient(135deg,
            rgba(230, 57, 70, 0.6) 0%, rgba(230, 57, 70, 0.6) 25%,
            rgba(69, 123, 157, 0.6) 25%, rgba(69, 123, 157, 0.6) 50%,
            rgba(244, 162, 97, 0.6) 50%, rgba(244, 162, 97, 0.6) 75%,
            rgba(45, 106, 79, 0.6) 75%, rgba(45, 106, 79, 0.6) 100%);
    border-radius: 50%;
    transform: rotate(-45deg);
}

.card-back::before {
    display: none;
}

/* Card Colors with Texture */
.card.red {
    background: linear-gradient(160deg, var(--uno-red) 0%, #9d0208 100%);
}

.card.blue {
    background: linear-gradient(160deg, var(--uno-blue) 0%, #1d3557 100%);
}

.card.green {
    background: linear-gradient(160deg, var(--uno-green) 0%, #1b4332 100%);
}

.card.yellow {
    background: linear-gradient(160deg, var(--uno-yellow) 0%, #d4a373 100%);
}

.card.wild {
    background:
        conic-gradient(from 45deg,
            var(--uno-red) 0deg 90deg,
            var(--uno-blue) 90deg 180deg,
            var(--uno-green) 180deg 270deg,
            var(--uno-yellow) 270deg 360deg);
}

.card .card-value {
    font-size: 2.2rem;
    font-weight: 900;
    text-shadow:
        2px 2px 0 rgba(0, 0, 0, 0.3),
        0 0 20px rgba(255, 255, 255, 0.2);
    position: relative;
    z-index: 1;
}

.card.yellow .card-value {
    color: var(--bg-primary);
    text-shadow: 2px 2px 0 rgba(255, 255, 255, 0.3);
}

.card .corner-value {
    position: absolute;
    font-size: 0.9rem;
    font-weight: 800;
    z-index: 1;
}

.card .corner-value.top-left {
    top: 6px;
    left: 8px;
}

.card .corner-value.bottom-right {
    bottom: 6px;
    right: 8px;
    transform: rotate(180deg);
}

.card.yellow .corner-value {
    color: var(--bg-primary);
}

/* Cards in hand */
.hand .card {
    margin-left: -28px;
    transform-origin: bottom center;
}

.hand .card:first-child {
    margin-left: 0;
}

.hand .card:hover {
    transform: translateY(-30px) scale(1.15) rotateX(-5deg);
    z-index: 100;
    box-shadow:
        0 20px 40px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.hand .card.playable {
    cursor: pointer;
}

.hand .card.playable::before {
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.3);
}

.hand .card:not(.playable) {
    filter: brightness(0.6) saturate(0.5);
    cursor: not-allowed;
}

.hand .card:not(.playable):hover {
    transform: none;
}

/* Card play animation */
.card.playing {
    animation: cardPlay 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes cardPlay {
    0% {
        transform: scale(1);
    }

    40% {
        transform: scale(1.2) rotate(10deg) translateY(-20px);
    }

    100% {
        transform: scale(1) rotate(0) translateY(0);
    }
}

/* Card draw animation */
.card.drawing {
    animation: cardDraw 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes cardDraw {
    0% {
        transform: translateX(-200px) translateY(-100px) rotate(-45deg) scale(0.5);
        opacity: 0;
    }

    100% {
        transform: translateX(0) translateY(0) rotate(0) scale(1);
        opacity: 1;
    }
}

/* ========================================
   MODALS
   ======================================== */

.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(10px);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal-content {
    background: var(--bg-secondary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 28px;
    padding: 36px;
    text-align: center;
    animation: slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

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

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.color-picker-content h3 {
    margin-bottom: 24px;
    font-size: 1.2rem;
    font-weight: 600;
}

.color-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.color-btn {
    width: 80px;
    height: 80px;
    border-radius: 20px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
}

.color-btn:hover {
    transform: scale(1.1) rotate(5deg);
    border-color: white;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.color-btn.red {
    background: linear-gradient(135deg, var(--uno-red), #9d0208);
}

.color-btn.blue {
    background: linear-gradient(135deg, var(--uno-blue), #1d3557);
}

.color-btn.green {
    background: linear-gradient(135deg, var(--uno-green), #1b4332);
}

.color-btn.yellow {
    background: linear-gradient(135deg, var(--uno-yellow), #d4a373);
}

.color-icon {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

/* Swap Modal */
.swap-content {
    max-width: 400px;
}

.swap-targets {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}

.swap-target-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 14px 20px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.swap-target-btn:hover {
    background: var(--accent);
    border-color: var(--accent);
}

/* Game Over */
.game-over-content {
    padding: 48px 60px;
    position: relative;
    overflow: hidden;
}

.game-over-content h2 {
    font-size: 2.2rem;
    margin-bottom: 28px;
    background: linear-gradient(135deg, var(--uno-yellow), var(--uno-red));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.confetti-container {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

/* ========================================
   GAME LOG (Minimal)
   ======================================== */

.game-log {
    position: fixed;
    left: 20px;
    bottom: 20px;
    width: 250px;
    max-height: 150px;
    overflow: hidden;
    display: flex;
    flex-direction: column-reverse;
    pointer-events: none;
}

.log-entry {
    padding: 8px 14px;
    background: var(--bg-glass);
    backdrop-filter: blur(10px);
    border-radius: 10px;
    margin-top: 6px;
    font-size: 0.85rem;
    animation: logSlide 0.3s ease;
    opacity: 0.9;
}

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

    to {
        opacity: 0.9;
        transform: translateX(0);
    }
}

/* Rules indicator */
.rules-indicator {
    position: fixed;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    max-width: 200px;
    justify-content: flex-end;
}

.rule-badge {
    background: rgba(168, 85, 247, 0.2);
    border: 1px solid rgba(168, 85, 247, 0.3);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--accent);
}

/* Action popup (for UNO calls, etc) */
.action-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    padding: 20px 40px;
    border-radius: 20px;
    font-size: 1.5rem;
    font-weight: 700;
    z-index: 500;
    animation: popupBounce 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

@keyframes popupBounce {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 0;
    }

    50% {
        transform: translate(-50%, -50%) scale(1.1);
    }

    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
    :root {
        --card-width: 60px;
        --card-height: 88px;
    }

    .lobby-container {
        padding: 32px 24px;
    }

    .uno-title {
        font-size: 3.5rem;
    }

    .opponents-area {
        padding: 10px;
        gap: 10px;
    }

    .opponent {
        min-width: 90px;
        padding: 12px;
    }

    .deck-area {
        gap: 30px;
    }

    .hand .card {
        margin-left: -22px;
    }

    .rules-grid {
        grid-template-columns: 1fr;
    }

    .game-log {
        width: 180px;
        max-height: 100px;
    }
}

@media (max-width: 480px) {
    :root {
        --card-width: 50px;
        --card-height: 73px;
    }

    .card .card-value {
        font-size: 1.6rem;
    }

    .hand .card {
        margin-left: -18px;
    }

    .game-log {
        display: none;
    }

    .rules-indicator {
        display: none;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}