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

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #0f1419 0%, #1a2332 100%);
    color: #fff;
    min-height: 100vh;
    overflow-x: hidden;
}

.screen {
    display: none;
    width: 100%;
    min-height: 100vh;
    animation: fadeIn 0.5s ease-in;
}

.screen.active {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Back to Lobby Button */
.back-to-lobby {
    background: transparent;
    padding: 1rem;
    text-align: left;
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 2000;
}

.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: #000;
    text-decoration: none;
    font-weight: bold;
    font-size: 0.95rem;
    padding: 12px 24px;
    border-radius: 30px;
    border: 2px solid #FFD700;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.4), 0 0 20px rgba(255, 215, 0, 0.2);
    transition: all 0.3s ease;
    cursor: pointer;
}

.back-btn:hover {
    transform: translateX(-5px) scale(1.05);
    box-shadow: 0 6px 25px rgba(255, 215, 0, 0.6), 0 0 30px rgba(255, 215, 0, 0.4);
    background: linear-gradient(135deg, #FFA500, #FFD700);
}

.back-btn:active {
    transform: translateX(-3px) scale(0.98);
}

/* ===== Welcome Screen ===== */
#welcomeScreen {
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #0f1419 0%, #1a2332 50%, #2d3e50 100%);
    padding: 20px;
}

.welcome-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 40px;
    max-width: 600px;
}

.logo {
    text-align: center;
    animation: slideDown 0.8s ease-out;
}

.logo h1 {
    font-size: 72px;
    font-weight: bold;
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 30px rgba(255, 215, 0, 0.5);
    margin-bottom: 10px;
}

.logo p {
    font-size: 18px;
    letter-spacing: 3px;
    color: #ffd700;
    margin: 5px 0;
}

.logo .brand {
    font-size: 16px;
    color: #ff6b9d;
    font-weight: bold;
}

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

.welcome-box {
    background: rgba(20, 30, 48, 0.9);
    border: 2px solid #ffd700;
    border-radius: 15px;
    padding: 40px;
    backdrop-filter: blur(10px);
    animation: slideUp 0.8s ease-out;
}

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

.welcome-box h2 {
    font-size: 28px;
    color: #ffd700;
    margin-bottom: 15px;
    text-align: center;
}

.welcome-box p {
    text-align: center;
    color: #b0b0b0;
    margin-bottom: 30px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #ffd700;
    font-weight: bold;
}

.form-group select {
    width: 100%;
    padding: 12px;
    background: rgba(255, 215, 0, 0.1);
    border: 2px solid #ffd700;
    border-radius: 8px;
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.form-group select:hover {
    background: rgba(255, 215, 0, 0.2);
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.3);
}

.form-group select option {
    background: #1a2332;
    color: #fff;
}

.btn-primary {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    border: none;
    border-radius: 8px;
    color: #000;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 2px;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.4);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.6);
}

.btn-primary:active {
    transform: translateY(-1px);
}

.btn-secondary {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #4a90e2, #357abd);
    border: none;
    border-radius: 8px;
    color: #fff;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 2px;
    box-shadow: 0 0 20px rgba(74, 144, 226, 0.4);
}

.btn-secondary:hover {
    transform: translateY(-3px);
    box-shadow: 0 0 30px rgba(74, 144, 226, 0.6);
}

.company-info {
    text-align: center;
    font-size: 12px;
    color: #888;
    margin-top: 20px;
}

/* ===== Shuffle Screen ===== */
#shuffleScreen {
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #0f1419 0%, #1a2332 100%);
}

.shuffle-container {
    text-align: center;
}

.shuffle-container h2 {
    font-size: 48px;
    color: #ffd700;
    margin-bottom: 50px;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
}

.card-stack-wrapper {
    margin-bottom: 50px;
    display: flex;
    justify-content: center;
}

.card-stack {
    width: 150px;
    height: 200px;
    background: linear-gradient(135deg, #1a3a52 0%, #2d5a7b 100%);
    border: 3px solid #ffd700;
    border-radius: 15px;
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.4);
    animation: float 3s ease-in-out infinite;
}

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

.card-stack.shuffling {
    animation: shuffle 0.8s ease-in-out;
}

@keyframes shuffle {
    0%, 100% { transform: rotateZ(0deg) scale(1); }
    25% { transform: rotateZ(-10deg) scale(1.05); }
    50% { transform: rotateZ(10deg) scale(1.05); }
    75% { transform: rotateZ(-5deg) scale(1.02); }
}

/* ===== Game Screen ===== */
#gameScreen {
    flex-direction: column;
    background: linear-gradient(135deg, #0f1419 0%, #1a2332 100%);
    padding: 20px;
    overflow-y: auto;
}

.game-container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(20, 30, 48, 0.9);
    border: 2px solid #ffd700;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 30px;
    backdrop-filter: blur(10px);
}

.header-left, .header-right {
    display: flex;
    gap: 30px;
    align-items: center;
}

.round-info {
    font-size: 18px;
    font-weight: bold;
    color: #ffd700;
}

.turn-info {
    font-size: 16px;
    color: #90ee90;
}

.timer-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.timer-display {
    font-size: 32px;
    font-weight: bold;
    color: #ffd700;
    min-width: 80px;
    text-align: center;
}

.timer-display.warning {
    color: #ff4444;
    animation: pulse 0.5s ease-in-out infinite;
}

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

.timer-bar {
    width: 200px;
    height: 8px;
    background: rgba(100, 100, 100, 0.5);
    border-radius: 4px;
    overflow: hidden;
}

.timer-fill {
    height: 100%;
    background: linear-gradient(90deg, #90ee90, #ffd700);
    width: 100%;
    transition: width 1s linear;
}

.timer-fill.warning {
    background: linear-gradient(90deg, #ff4444, #ff6666);
}

.deck-info {
    font-size: 16px;
    color: #ffd700;
    font-weight: bold;
}

/* Players Section */
.players-section {
    display: flex;
    justify-content: space-around;
    gap: 20px;
    margin-bottom: 30px;
}

.player-box {
    background: rgba(20, 30, 48, 0.9);
    border: 2px solid #ffd700;
    border-radius: 10px;
    padding: 20px;
    flex: 1;
    max-width: 300px;
    backdrop-filter: blur(10px);
}

.player-header {
    margin-bottom: 20px;
}

.player-header h3 {
    font-size: 20px;
    color: #ffd700;
    margin-bottom: 10px;
}

.player-stats {
    display: flex;
    gap: 15px;
    font-size: 14px;
}

.stat-item {
    color: #b0b0b0;
}

.stat-item span {
    color: #ffd700;
    font-weight: bold;
}

.card-placeholder {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
}

.card-back {
    width: 120px;
    height: 160px;
    background: linear-gradient(135deg, #1a3a52 0%, #2d5a7b 100%);
    border: 3px solid #ffd700;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: #ffd700;
    font-weight: bold;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
}

/* Battle Area */
.battle-area {
    background: rgba(20, 30, 48, 0.9);
    border: 2px solid #ffd700;
    border-radius: 10px;
    padding: 30px;
    margin-bottom: 30px;
    min-height: 300px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(10px);
}

.played-cards-container {
    display: flex;
    justify-content: center;
    gap: 40px;
    flex-wrap: wrap;
    width: 100%;
}

.played-card {
    position: relative;
    width: 150px;
    background: rgba(30, 40, 60, 0.8);
    border: 2px solid #ffd700;
    border-radius: 10px;
    overflow: hidden;
    animation: cardAppear 0.5s ease-out;
}

@keyframes cardAppear {
    from {
        opacity: 0;
        transform: scale(0.5) rotateY(90deg);
    }
    to {
        opacity: 1;
        transform: scale(1) rotateY(0deg);
    }
}

.played-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.played-card.winner {
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.8), inset 0 0 30px rgba(255, 215, 0, 0.4);
    animation: glow 0.6s ease-in-out infinite;
}

@keyframes glow {
    0%, 100% { box-shadow: 0 0 30px rgba(255, 215, 0, 0.8), inset 0 0 30px rgba(255, 215, 0, 0.4); }
    50% { box-shadow: 0 0 50px rgba(255, 215, 0, 1), inset 0 0 50px rgba(255, 215, 0, 0.6); }
}

.card-info {
    padding: 10px;
    background: rgba(0, 0, 0, 0.8);
    font-size: 12px;
}

.player-name {
    color: #ffd700;
    font-weight: bold;
    margin-bottom: 3px;
}

.player-role {
    color: #90ee90;
    font-size: 11px;
    margin-bottom: 5px;
}

.stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3px;
}

.stat {
    background: rgba(255, 215, 0, 0.1);
    padding: 3px;
    border-radius: 3px;
    color: #b0b0b0;
    font-size: 10px;
}

.stat.highlight {
    background: rgba(255, 215, 0, 0.3);
    color: #ffd700;
    font-weight: bold;
}

.label {
    color: #ffd700;
    font-weight: bold;
}

/* Stat Selector */
.stat-selector {
    background: rgba(20, 30, 48, 0.95);
    border: 2px solid #ffd700;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    text-align: center;
    backdrop-filter: blur(10px);
}

.stat-selector p {
    color: #ffd700;
    font-weight: bold;
    margin-bottom: 15px;
    font-size: 16px;
}

.stat-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
}

.stat-btn {
    padding: 12px;
    background: rgba(255, 215, 0, 0.1);
    border: 2px solid #ffd700;
    border-radius: 8px;
    color: #ffd700;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.stat-btn:hover {
    background: rgba(255, 215, 0, 0.3);
    transform: translateY(-3px);
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.5);
}

/* Player Section */
.player-section {
    background: rgba(20, 30, 48, 0.9);
    border: 2px solid #ffd700;
    border-radius: 10px;
    padding: 20px;
    backdrop-filter: blur(10px);
}

.player-hand {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
    padding: 15px 0;
    max-height: 400px;
    overflow-y: auto;
}

.draw-card-btn {
    background: linear-gradient(135deg, #ff6b6b, #ff8e72);
    color: white;
    border: 2px solid #ffaa44;
    padding: 12px 20px;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    margin-top: 15px;
    transition: all 0.3s ease;
    font-size: 14px;
}

.draw-card-btn:hover {
    background: linear-gradient(135deg, #ff8e72, #ffaa44);
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(255, 170, 68, 0.8);
}

.hand-card {
    width: 100%;
    min-width: 140px;
    max-width: 180px;
    height: 280px;
    background: linear-gradient(135deg, #1a3a52 0%, #2d5a7b 100%);
    border: 3px solid #ffd700;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    animation: cardSlide 0.5s ease-out;
    position: relative;
    display: flex;
    flex-direction: column;
    box-shadow: 0 5px 15px rgba(255, 215, 0, 0.2);
}

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

.hand-card img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    object-position: top;
}

.hand-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 10px 30px rgba(255, 215, 0, 0.3);
    border-color: #ffd700;
}

.hand-card.selected {
    border-color: #ffd700;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.8), inset 0 0 20px rgba(255, 215, 0, 0.3);
    transform: translateY(-15px) scale(1.05);
}

/* Victory Screen */
#victoryScreen {
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #0f1419 0%, #1a2332 100%);
}

.victory-container {
    text-align: center;
    animation: victoryPop 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes victoryPop {
    0% {
        opacity: 0;
        transform: scale(0.5);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.victory-box {
    background: rgba(20, 30, 48, 0.95);
    border: 3px solid #ffd700;
    border-radius: 20px;
    padding: 50px;
    max-width: 600px;
    backdrop-filter: blur(10px);
}

.winadda-text {
    font-size: 72px;
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 40px rgba(255, 215, 0, 0.6);
    margin-bottom: 20px;
    animation: bounce 1s ease-in-out infinite;
}

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

.victory-box h2 {
    font-size: 36px;
    color: #90ee90;
    margin-bottom: 15px;
}

.victory-box p {
    font-size: 18px;
    color: #b0b0b0;
    margin-bottom: 20px;
}

.final-scores {
    background: rgba(255, 215, 0, 0.1);
    border: 1px solid #ffd700;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px;
    text-align: left;
}

.score-line {
    color: #ffd700;
    font-size: 16px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 215, 0, 0.2);
}

.score-line:last-child {
    border-bottom: none;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .players-section {
        flex-direction: column;
    }
    
    .player-box {
        max-width: 100%;
    }
    
    .stat-buttons {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .logo h1 {
        font-size: 48px;
    }
    
    .welcome-box {
        padding: 25px;
    }
    
    .game-header {
        flex-direction: column;
        gap: 15px;
    }
    
    .header-left, .header-right {
        flex-direction: column;
        width: 100%;
    }
    
    .timer-bar {
        width: 100%;
    }
    
    .played-cards-container {
        gap: 20px;
    }
    
    .stat-buttons {
        grid-template-columns: 1fr;
    }
    
    .hand-card {
        width: 100px;
        height: 140px;
    }
}

@media (max-width: 480px) {
    .logo h1 {
        font-size: 36px;
    }
    
    .welcome-box {
        padding: 20px;
    }
    
    .victory-box {
        padding: 30px 20px;
    }
    
    .winadda-text {
        font-size: 48px;
    }
    
    .hand-card {
        width: 80px;
        height: 120px;
    }
}


/* Card Info Overlay */
.card-info {
    padding: 8px;
    background: rgba(0, 0, 0, 0.9);
    flex: 1;
}

.card-name {
    color: #ffd700;
    font-weight: bold;
    font-size: 11px;
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-role {
    font-size: 9px;
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-block;
    margin-bottom: 5px;
    font-weight: bold;
}

.card-role.batsman { background: #ff6b6b; color: white; }
.card-role.bowler { background: #4dabf7; color: white; }
.card-role.allrounder { background: #9775fa; color: white; }
.card-role.wicketkeeper { background: #51cf66; color: white; }

.card-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    font-size: 10px;
    color: #b0b0b0;
}

.card-stats span {
    background: rgba(255, 215, 0, 0.1);
    padding: 2px 4px;
    border-radius: 3px;
}

/* Battle Card Styles */
.battle-card {
    width: 200px;
    background: rgba(30, 40, 60, 0.95);
    border: 3px solid #ffd700;
    border-radius: 12px;
    overflow: hidden;
    margin: 10px;
    animation: cardAppear 0.5s ease-out;
}

.battle-card-header {
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    color: #1a1a2e;
    padding: 8px;
    text-align: center;
    font-weight: bold;
    font-size: 14px;
}

.battle-card img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    object-position: top;
}

.battle-card-info {
    padding: 10px;
}

.battle-card-name {
    color: #ffd700;
    font-weight: bold;
    font-size: 14px;
    margin-bottom: 5px;
}

.battle-card-role {
    font-size: 10px;
    padding: 3px 8px;
    border-radius: 4px;
    display: inline-block;
    margin-bottom: 8px;
    font-weight: bold;
}

.battle-card-stats {
    font-size: 12px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 8px;
    margin: 2px 0;
    border-radius: 4px;
    color: #b0b0b0;
}

.stat-row.highlight {
    background: rgba(255, 215, 0, 0.3);
    color: #ffd700;
    font-weight: bold;
}

.battle-card.winner {
    border-color: #00ff00;
    box-shadow: 0 0 30px rgba(0, 255, 0, 0.8);
}

/* Battle Area Layout */
#battleArea {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-start;
    gap: 20px;
}

/* Score Row */
.score-row {
    padding: 10px 20px;
    margin: 5px 0;
    font-size: 18px;
    color: #b0b0b0;
}

.score-row.winner {
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    color: #1a1a2e;
    font-weight: bold;
    border-radius: 8px;
}

/* Shake Animation for Shuffle */
@keyframes shake {
    0%, 100% { transform: translateX(0) rotate(0); }
    25% { transform: translateX(-10px) rotate(-5deg); }
    50% { transform: translateX(10px) rotate(5deg); }
    75% { transform: translateX(-5px) rotate(-2deg); }
}

/* Compliance Banner */
.compliance-banner {
    background-color: #ff6b6b;
    color: white;
    padding: 15px 20px;
    text-align: center;
    font-weight: bold;
    margin-bottom: 20px;
    border-bottom: 3px solid #cc5555;
}

.compliance-notice {
    background-color: #fff3cd;
    border: 2px solid #ffc107;
    border-radius: 8px;
    padding: 20px;
    margin: 30px 0;
    text-align: center;
}

.notice-box {
    color: #856404;
    font-weight: bold;
}
