/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Orbitron', monospace;
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 50%, #16213e 100%);
    color: #fff;
    overflow-x: hidden;
    min-height: 100vh;
    position: relative;
}

/* Casino background effects */
.casino-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.stars {
    position: absolute;
    width: 100%;
    height: 100%;
    background: radial-gradient(2px 2px at 20px 30px, #eee, transparent),
                radial-gradient(2px 2px at 40px 70px, rgba(255,255,255,0.8), transparent),
                radial-gradient(1px 1px at 90px 40px, #fff, transparent),
                radial-gradient(1px 1px at 130px 80px, rgba(255,255,255,0.6), transparent),
                radial-gradient(2px 2px at 160px 30px, #eee, transparent);
    background-repeat: repeat;
    background-size: 200px 100px;
    animation: sparkle 3s linear infinite;
}

.casino-lights {
    position: absolute;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, 
        rgba(255, 215, 0, 0.1) 0%, 
        rgba(255, 0, 150, 0.1) 25%, 
        rgba(0, 255, 255, 0.1) 50%, 
        rgba(255, 215, 0, 0.1) 75%, 
        rgba(255, 0, 150, 0.1) 100%);
    animation: casinoLights 4s ease-in-out infinite alternate;
}

@keyframes sparkle {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

@keyframes casinoLights {
    0% { opacity: 0.3; }
    100% { opacity: 0.7; }
}

/* Game container */
.game-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    position: relative;
    z-index: 1;
}

/* Header */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.logo {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 2.5rem;
    font-weight: 900;
    color: #ffd700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.logo i {
    color: #ff6b6b;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.header-controls {
    display: flex;
    gap: 10px;
}

.control-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    padding: 10px 15px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.control-btn.active {
    background: rgba(255, 215, 0, 0.3);
    border-color: #ffd700;
}

/* Game info */
.game-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.player-info, .opponent-info {
    text-align: center;
}

.player-name, .opponent-name {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 5px;
    color: #ffd700;
}

.player-cards, .opponent-cards {
    font-size: 0.9rem;
    color: #ccc;
}

.card-count {
    font-weight: 700;
    color: #fff;
}

.game-status {
    text-align: center;
}

.trump-suit {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 10px;
    font-weight: 700;
}

.trump-card {
    width: 30px;
    height: 40px;
    background: linear-gradient(145deg, #fff, #f0f0f0);
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #333;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.current-turn {
    font-size: 0.9rem;
    color: #4ecdc4;
    font-weight: 700;
}

/* Game board */
.game-board {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 30px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    min-height: 500px;
    position: relative;
}

.opponent-area {
    height: 120px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 40px;
}

.opponent-cards-display {
    display: flex;
    gap: 5px;
}

.card-back {
    width: 60px;
    height: 80px;
    background: linear-gradient(145deg, #ff6b6b, #ee5a52);
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    animation: float 2s ease-in-out infinite;
    animation-delay: calc(var(--delay) * 0.2s);
    border: 2px solid #fff;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

.battle-area {
    height: 150px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 40px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    border: 2px dashed rgba(255, 255, 255, 0.3);
}

.battle-cards {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
}

.player-area {
    height: 120px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.player-cards-display {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

/* Card styles */
.card {
    width: 70px;
    height: 95px;
    background: linear-gradient(145deg, #fff, #f8f8f8);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    border: 1px solid #ddd;
    position: relative;
    user-select: none;
}

.card:hover {
    transform: translateY(-10px) scale(1.05);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

.card.selected {
    transform: translateY(-15px) scale(1.1);
    border: 2px solid #ffd700;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
}

.card-value {
    font-weight: 700;
    font-size: 1rem;
}

.card-suit {
    font-size: 1.5rem;
    text-align: center;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card.red {
    color: #e74c3c;
}

.card.black {
    color: #2c3e50;
}

.card.trump {
    border: 2px solid #ffd700;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.3);
}

/* Action buttons */
.action-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 30px;
}

.action-btn {
    padding: 15px 30px;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    backdrop-filter: blur(10px);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.attack-btn {
    background: linear-gradient(145deg, #e74c3c, #c0392b);
    color: #fff;
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.3);
}

.attack-btn:hover:not(:disabled) {
    background: linear-gradient(145deg, #c0392b, #a93226);
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(231, 76, 60, 0.4);
}

.take-btn {
    background: linear-gradient(145deg, #f39c12, #e67e22);
    color: #fff;
    box-shadow: 0 4px 15px rgba(243, 156, 18, 0.3);
}

.take-btn:hover:not(:disabled) {
    background: linear-gradient(145deg, #e67e22, #d35400);
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(243, 156, 18, 0.4);
}

.pass-btn {
    background: linear-gradient(145deg, #27ae60, #229954);
    color: #fff;
    box-shadow: 0 4px 15px rgba(39, 174, 96, 0.3);
}

.pass-btn:hover:not(:disabled) {
    background: linear-gradient(145deg, #229954, #1e8449);
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(39, 174, 96, 0.4);
}

.action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* Game messages */
.game-messages {
    text-align: center;
    padding: 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.message {
    font-size: 1.1rem;
    color: #4ecdc4;
    font-weight: 600;
    animation: messagePulse 2s ease-in-out infinite;
}

@keyframes messagePulse {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 1; }
}

/* Modal styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
}

.modal-content {
    background: linear-gradient(145deg, #1a1a2e, #16213e);
    margin: 10% auto;
    padding: 0;
    border-radius: 15px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-header h3 {
    color: #ffd700;
    font-size: 1.5rem;
}

.close-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 2rem;
    cursor: pointer;
    transition: color 0.3s ease;
}

.close-btn:hover {
    color: #ff6b6b;
}

.modal-body {
    padding: 20px;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.setting-item label {
    font-weight: 600;
    color: #fff;
}

.setting-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: #ffd700;
}

.setting-item select {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    padding: 8px 12px;
    border-radius: 5px;
    font-family: 'Orbitron', monospace;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .game-container {
        padding: 10px;
    }

    .game-header {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }

    .logo {
        font-size: 2rem;
    }

    .game-info {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }

    .game-board {
        padding: 20px;
        min-height: 400px;
    }

    .card {
        width: 60px;
        height: 80px;
        font-size: 0.9rem;
    }

    .card-suit {
        font-size: 1.2rem;
    }

    .action-buttons {
        flex-direction: column;
        gap: 15px;
    }

    .action-btn {
        padding: 12px 25px;
        font-size: 1rem;
    }

    .opponent-cards-display {
        gap: 3px;
    }

    .card-back {
        width: 50px;
        height: 70px;
    }

    .player-cards-display {
        gap: 5px;
    }
}

@media (max-width: 480px) {
    .logo {
        font-size: 1.5rem;
    }

    .card {
        width: 50px;
        height: 70px;
        font-size: 0.8rem;
    }

    .card-suit {
        font-size: 1rem;
    }

    .action-btn {
        padding: 10px 20px;
        font-size: 0.9rem;
    }

    .modal-content {
        margin: 5% auto;
        width: 95%;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .card:hover {
        transform: none;
    }

    .card.selected {
        transform: translateY(-10px) scale(1.05);
    }

    .action-btn:hover:not(:disabled) {
        transform: none;
    }

    .control-btn:hover {
        transform: none;
    }
}

/* Animation classes */
.card-deal {
    animation: dealCard 0.5s ease-out;
}

@keyframes dealCard {
    0% {
        transform: translateY(-100px) rotate(180deg);
        opacity: 0;
    }
    100% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }
}

.card-play {
    animation: playCard 0.3s ease-out;
}

@keyframes playCard {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

.shake {
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* AI Badge */
.ai-badge {
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: bold;
    margin-left: 8px;
}

/* Player Item */
.player-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    margin: 5px 0;
    backdrop-filter: blur(10px);
}

.player-name {
    font-weight: bold;
    color: #fff;
}

.player-status {
    color: #4ecdc4;
    font-size: 0.9rem;
}

/* Waiting Room */
.waiting-room {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.waiting-content {
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.waiting-content h3 {
    color: #4ecdc4;
    margin-bottom: 20px;
    font-size: 2rem;
}

.room-info {
    margin: 20px 0;
    color: #fff;
}

.room-info p {
    margin: 10px 0;
    font-size: 1.1rem;
}

.players-list {
    margin: 20px 0;
    max-height: 200px;
    overflow-y: auto;
}

.waiting-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 20px;
}

/* Casino Effects */
@keyframes casinoPop {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }
    50% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.2);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(1);
    }
}

.casino-effect {
    font-family: 'Orbitron', monospace;
    text-transform: uppercase;
    letter-spacing: 2px;
}

/* Action Button Enhancements */
.action-btn.my-turn {
    background: linear-gradient(45deg, #4ecdc4, #44a08d);
    box-shadow: 0 0 20px rgba(78, 205, 196, 0.5);
    animation: buttonPulse 2s infinite;
}

@keyframes buttonPulse {
    0%, 100% {
        box-shadow: 0 0 20px rgba(78, 205, 196, 0.5);
    }
    50% {
        box-shadow: 0 0 30px rgba(78, 205, 196, 0.8);
    }
}

.action-btn:not(.my-turn) {
    opacity: 0.6;
    filter: grayscale(50%);
}

.action-btn:not(.my-turn):hover {
    opacity: 0.8;
    filter: grayscale(30%);
}

.action-btn:not(:disabled) {
    cursor: pointer;
    transform: scale(1);
    transition: all 0.2s ease;
}

.action-btn:not(:disabled):hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.action-btn:disabled {
    cursor: not-allowed;
    opacity: 0.4;
    transform: scale(0.95);
    filter: grayscale(80%);
}

/* Card Selection Effects */
.card.selected {
    transform: translateY(-20px) scale(1.1);
    box-shadow: 0 10px 30px rgba(78, 205, 196, 0.6);
    border: 2px solid #4ecdc4;
    z-index: 10;
}

.card:hover {
    transform: translateY(-10px) scale(1.05);
    transition: all 0.3s ease;
}

/* Battle Area Effects */
.battle-area.battle-active {
    background: radial-gradient(circle, rgba(255, 107, 107, 0.2) 0%, transparent 70%);
    animation: battleGlow 1s ease-out;
}

@keyframes battleGlow {
    0% {
        background: radial-gradient(circle, rgba(255, 107, 107, 0.4) 0%, transparent 70%);
    }
    100% {
        background: radial-gradient(circle, rgba(255, 107, 107, 0.1) 0%, transparent 70%);
    }
}

/* Enhanced Card Styles */
.card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.card::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;
}

.card:hover::before {
    left: 100%;
}

/* Trump Card Special Effects */
.card.trump {
    border: 2px solid #ffd93d;
    box-shadow: 0 0 15px rgba(255, 217, 61, 0.5);
}

.card.trump.selected {
    box-shadow: 0 10px 30px rgba(255, 217, 61, 0.8);
    border-color: #ffd93d;
}

/* Game Messages Enhancement */
.message {
    background: linear-gradient(45deg, rgba(78, 205, 196, 0.1), rgba(255, 107, 107, 0.1));
    border: 1px solid rgba(78, 205, 196, 0.3);
    padding: 15px 25px;
    border-radius: 25px;
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}

.message::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    animation: messageShine 3s infinite;
}

@keyframes messageShine {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

/* Enhanced Action Buttons */
.action-btn {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.action-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;
}

.action-btn:hover::before {
    left: 100%;
}

.action-btn:active {
    transform: scale(0.95);
}

/* Card Back Animation */
.card-back {
    animation: cardFloat 3s ease-in-out infinite;
}

@keyframes cardFloat {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* Enhanced Game Container */
.game-container {
    position: relative;
    overflow: hidden;
}

.game-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 20% 80%, rgba(78, 205, 196, 0.1) 0%, transparent 50%),
                radial-gradient(circle at 80% 20%, rgba(255, 107, 107, 0.1) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

/* Game ID Display */
.game-id {
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 0.8rem;
    color: #4ecdc4;
    text-align: center;
    margin-top: 10px;
    padding: 10px;
    background: rgba(78, 205, 196, 0.1);
    border-radius: 8px;
    border: 1px solid rgba(78, 205, 196, 0.3);
}

.game-id span {
    font-family: 'Orbitron', monospace;
    font-weight: 600;
}

.turn-info {
    font-weight: bold;
    padding: 5px 10px;
    border-radius: 15px;
    text-align: center;
    background: rgba(0, 255, 0, 0.2);
    border: 1px solid rgba(0, 255, 0, 0.5);
    color: #00ff00;
}

.turn-info.ai-turn {
    background: rgba(255, 165, 0, 0.3);
    border: 1px solid rgba(255, 165, 0, 0.6);
    color: #ffa500;
    animation: aiTurnPulse 2s infinite;
}

@keyframes aiTurnPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Debug Button */
#debug-btn {
    background: linear-gradient(45deg, #ff6b6b, #ff8e8e);
}

#debug-btn:hover {
    background: linear-gradient(45deg, #ff5252, #ff7979);
    box-shadow: 0 0 20px rgba(255, 107, 107, 0.5);
}