/* IPL Cricket Game Styles */
:root {
    --primary: #1a237e;
    --secondary: #ff6f00;
    --accent: #00c853;
    --danger: #d50000;
    --bg-dark: #0d1b2a;
    --bg-light: #1b263b;
    --text-light: #e0e1dd;
    --text-muted: #778da9;
    --gradient-primary: linear-gradient(135deg, #1a237e 0%, #3949ab 100%);
    --gradient-secondary: linear-gradient(135deg, #ff6f00 0%, #ff9800 100%);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.5);
}

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

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

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

.screen.active {
    display: flex;
    flex-direction: column;
}

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

/* Main Menu */
#main-menu {
    background: linear-gradient(135deg, #0d1b2a 0%, #1b263b 50%, #415a77 100%);
    position: relative;
    overflow: hidden;
}

.menu-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
    position: relative;
    z-index: 2;
}

.stadium-bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(ellipse at 50% 100%, rgba(0, 200, 83, 0.1) 0%, transparent 50%),
        repeating-linear-gradient(90deg, transparent, transparent 50px, rgba(255,255,255,0.02) 50px, rgba(255,255,255,0.02) 51px);
    z-index: 1;
}

.logo {
    text-align: center;
    margin-bottom: 3rem;
    animation: pulse 2s ease-in-out infinite;
}

.logo h1 {
    font-family: 'Teko', sans-serif;
    font-size: 5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #ff6f00, #ff9800, #ffc107);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 60px rgba(255, 111, 0, 0.5);
    letter-spacing: 4px;
}

.logo h2 {
    font-family: 'Teko', sans-serif;
    font-size: 2.5rem;
    color: var(--text-light);
    letter-spacing: 8px;
    margin-top: -10px;
    opacity: 0.9;
}

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

/* Buttons */
.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
    max-width: 320px;
}

.btn {
    padding: 1rem 2rem;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-family: 'Teko', sans-serif;
}

.btn-primary {
    background: var(--gradient-secondary);
    color: white;
    box-shadow: 0 4px 15px rgba(255, 111, 0, 0.4);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(255, 111, 0, 0.5);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-light);
    border: 2px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
}

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

.btn-large {
    padding: 1.2rem 3rem;
    font-size: 1.3rem;
}

.btn-back {
    background: transparent;
    color: var(--text-light);
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

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

/* Screen Headers */
.screen-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.screen-header h2 {
    font-family: 'Teko', sans-serif;
    font-size: 2rem;
    color: var(--text-light);
}

/* Team Selection */
.teams-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.team-card {
    background: linear-gradient(145deg, rgba(27, 38, 59, 0.9), rgba(13, 27, 42, 0.9));
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.team-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-secondary);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.team-card:hover {
    transform: translateY(-5px);
    border-color: rgba(255, 111, 0, 0.5);
    box-shadow: var(--shadow-lg);
}

.team-card:hover::before {
    transform: scaleX(1);
}

.team-logo {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Teko', sans-serif;
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0 auto 1rem;
    color: white;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.team-logo.csk { background: linear-gradient(135deg, #FDB913, #008ECE); }
.team-logo.mi { background: linear-gradient(135deg, #004BA0, #D1AB3E); }
.team-logo.rcb { background: linear-gradient(135deg, #EC1C24, #000000); }
.team-logo.kkr { background: linear-gradient(135deg, #3A225D, #D4AF37); }
.team-logo.srh { background: linear-gradient(135deg, #FF822A, #000000); }
.team-logo.dc { background: linear-gradient(135deg, #0078BC, #EF1B23); }
.team-logo.rr { background: linear-gradient(135deg, #254AA5, #FFC0CB); }
.team-logo.pbks { background: linear-gradient(135deg, #D71920, #F2F2F2); color: #D71920; }

.team-card h3 {
    font-family: 'Teko', sans-serif;
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-light);
}

.team-card p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Match Setup */
.setup-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    max-width: 800px;
    margin: 0 auto;
}

.team-vs {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 3rem;
    flex-wrap: wrap;
}

.selected-team, .opponent-team {
    text-align: center;
}

.team-logo-large {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Teko', sans-serif;
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: white;
    box-shadow: var(--shadow);
}

.vs-text {
    font-family: 'Teko', sans-serif;
    font-size: 3rem;
    color: var(--secondary);
    font-weight: 700;
}

.match-settings {
    display: flex;
    gap: 2rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    justify-content: center;
}

.setting {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.setting label {
    color: var(--text-muted);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.setting select {
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    background: rgba(0, 0, 0, 0.3);
    color: var(--text-light);
    font-size: 1rem;
    cursor: pointer;
    min-width: 150px;
}

/* Game Screen */
#game-screen {
    background: linear-gradient(180deg, #87CEEB 0%, #98FB98 100%);
    position: relative;
}

.game-header {
    background: rgba(0, 0, 0, 0.85);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 3px solid var(--secondary);
}

.match-info {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.match-info span {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.match-info span:first-child {
    color: var(--text-light);
    font-size: 1.1rem;
    font-weight: 600;
}

.score-display {
    text-align: right;
}

.runs {
    font-family: 'Teko', sans-serif;
    font-size: 3rem;
    color: var(--secondary);
    font-weight: 700;
    line-height: 1;
}

.overs {
    color: var(--text-muted);
    font-size: 1.1rem;
}

/* Game Field */
.game-field {
    flex: 1;
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 400px;
}

.pitch {
    flex: 1;
    background: linear-gradient(180deg, #8B4513 0%, #A0522D 50%, #8B4513 100%);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    border-top: 4px solid #654321;
    border-bottom: 4px solid #654321;
}

.wickets {
    position: absolute;
    bottom: 20%;
    left: 50%;
    transform: translateX(-50%);
}

.stumps {
    display: flex;
    gap: 3px;
    position: relative;
}

.stump {
    width: 8px;
    height: 60px;
    background: linear-gradient(90deg, #DEB887, #F5DEB3, #DEB887);
    border-radius: 2px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.bails {
    position: absolute;
    top: -8px;
    left: 5px;
    right: 5px;
    height: 6px;
    display: flex;
    justify-content: space-between;
}

.bails::before, .bails::after {
    content: '';
    width: 20px;
    height: 6px;
    background: linear-gradient(90deg, #DEB887, #F5DEB3);
    border-radius: 3px;
}

.bails.fallen {
    display: none;
}

.batsman {
    position: absolute;
    bottom: 25%;
    left: 40%;
    font-size: 4rem;
    transform: scaleX(-1);
    animation: batsmanIdle 2s ease-in-out infinite;
}

@keyframes batsmanIdle {
    0%, 100% { transform: scaleX(-1) translateY(0); }
    50% { transform: scaleX(-1) translateY(-5px); }
}

.bowler {
    position: absolute;
    top: 10%;
    left: 50%;
    transform: translateX(-50%);
    font-size: 3rem;
    animation: bowlerRun 2s ease-in-out infinite;
}

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

.ball {
    position: absolute;
    width: 20px;
    height: 20px;
    background: radial-gradient(circle at 30% 30%, #ff4444, #cc0000);
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
    display: none;
    z-index: 10;
}

.ball.visible {
    display: block;
}

/* Field Positions */
.field-positions {
    height: 200px;
    background: linear-gradient(180deg, #228B22 0%, #32CD32 100%);
    position: relative;
    border-top: 2px solid rgba(255,255,255,0.2);
}

.fielder {
    position: absolute;
    font-size: 2rem;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

#fielder1 { top: 20%; left: 10%; }
#fielder2 { top: 10%; left: 30%; }
#fielder3 { top: 5%; left: 50%; }
#fielder4 { top: 10%; left: 70%; }
#fielder5 { top: 20%; left: 90%; }
#fielder6 { top: 50%; left: 15%; }
#fielder7 { top: 60%; left: 50%; }
#fielder8 { top: 50%; left: 85%; }
#fielder9 { top: 80%; left: 50%; }

/* Game Controls */
.game-controls {
    background: rgba(0, 0, 0, 0.95);
    padding: 1.5rem;
    border-top: 3px solid var(--secondary);
}

.game-controls h3 {
    font-family: 'Teko', sans-serif;
    font-size: 1.5rem;
    color: var(--text-light);
    margin-bottom: 1rem;
    text-align: center;
}

.shot-buttons, .delivery-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.8rem;
    max-width: 800px;
    margin: 0 auto;
}

.delivery-buttons {
    grid-template-columns: repeat(3, 1fr);
}

.shot-btn, .delivery-btn {
    background: linear-gradient(145deg, rgba(255,255,255,0.1), rgba(255,255,255,0.05));
    border: 2px solid rgba(255,255,255,0.2);
    border-radius: 12px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-light);
}

.shot-btn:hover, .delivery-btn:hover {
    background: linear-gradient(145deg, rgba(255,111,0,0.3), rgba(255,111,0,0.1));
    border-color: var(--secondary);
    transform: translateY(-2px);
}

.shot-btn.six {
    background: linear-gradient(145deg, rgba(0,200,83,0.3), rgba(0,200,83,0.1));
    border-color: var(--accent);
}

.shot-btn.six:hover {
    background: linear-gradient(145deg, rgba(0,200,83,0.5), rgba(0,200,83,0.2));
    box-shadow: 0 0 20px rgba(0, 200, 83, 0.4);
}

.shot-icon {
    font-size: 1.5rem;
}

.shot-btn span:last-child, .delivery-btn span {
    font-size: 0.85rem;
    font-weight: 500;
}

/* Commentary Box */
.commentary-box {
    background: rgba(0, 0, 0, 0.9);
    padding: 1rem 1.5rem;
    border-top: 2px solid rgba(255, 255, 255, 0.1);
    min-height: 60px;
    display: flex;
    align-items: center;
}

.commentary-box p {
    color: var(--text-light);
    font-size: 1rem;
    line-height: 1.5;
}

.commentary-box p::before {
    content: '🎙️ ';
    margin-right: 0.5rem;
}

/* Match Stats */
.match-stats {
    background: rgba(0, 0, 0, 0.9);
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.stat-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.stat-row:last-child {
    border-bottom: none;
}

.stat-row span {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.stat-row strong {
    color: var(--text-light);
}

/* Innings Break */
#innings-break {
    background: linear-gradient(135deg, #0d1b2a 0%, #1b263b 100%);
    align-items: center;
    justify-content: center;
}

.break-container {
    text-align: center;
    padding: 3rem;
    max-width: 600px;
}

.break-container h2 {
    font-family: 'Teko', sans-serif;
    font-size: 3rem;
    color: var(--secondary);
    margin-bottom: 2rem;
}

.innings-summary {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    padding: 2rem;
    margin-bottom: 2rem;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.innings-summary h3 {
    font-size: 1.5rem;
    color: var(--text-light);
    margin-bottom: 1rem;
}

.big-score {
    font-family: 'Teko', sans-serif;
    font-size: 5rem;
    color: var(--secondary);
    font-weight: 700;
    line-height: 1;
}

.innings-stats {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-top: 1rem;
    color: var(--text-muted);
}

.target-text {
    font-size: 1.5rem;
    color: var(--accent);
    margin-bottom: 2rem;
    font-weight: 600;
}

/* Match Result */
#match-result {
    background: linear-gradient(135deg, #0d1b2a 0%, #1b263b 100%);
    align-items: center;
    justify-content: center;
}

.result-container {
    text-align: center;
    padding: 3rem;
    max-width: 700px;
}

.result-container h2 {
    font-family: 'Teko', sans-serif;
    font-size: 3rem;
    color: var(--secondary);
    margin-bottom: 2rem;
}

.trophy {
    font-size: 6rem;
    margin-bottom: 1rem;
    animation: trophyBounce 1s ease-in-out infinite;
}

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

.result-team h3 {
    font-family: 'Teko', sans-serif;
    font-size: 2.5rem;
    color: var(--text-light);
    margin-bottom: 0.5rem;
}

.result-team p {
    color: var(--accent);
    font-size: 1.2rem;
    margin-bottom: 2rem;
}

.match-summary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    margin: 2rem 0;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 16px;
}

.summary-team h4 {
    font-family: 'Teko', sans-serif;
    font-size: 2rem;
    color: var(--text-light);
}

.summary-team p {
    color: var(--text-muted);
    font-size: 1rem;
}

.summary-vs {
    font-family: 'Teko', sans-serif;
    font-size: 1.5rem;
    color: var(--secondary);
    font-weight: 700;
}

.top-performers {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.top-performers h4 {
    color: var(--secondary);
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.top-performers p {
    color: var(--text-light);
    margin: 0.5rem 0;
}

.result-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

/* Instructions */
.instructions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.instruction-card {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 2rem;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.instruction-card h3 {
    font-family: 'Teko', sans-serif;
    font-size: 1.8rem;
    color: var(--secondary);
    margin-bottom: 1rem;
}

.instruction-card ul {
    list-style: none;
    padding: 0;
}

.instruction-card li {
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-light);
}

.instruction-card li:last-child {
    border-bottom: none;
}

.instruction-card li strong {
    color: var(--secondary);
}

.instruction-card p {
    color: var(--text-light);
    line-height: 1.6;
}

/* Tournament */
.tournament-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    text-align: center;
}

.tournament-info p {
    color: var(--text-muted);
    font-size: 1.2rem;
    margin-bottom: 2rem;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Responsive */
@media (max-width: 768px) {
    .logo h1 {
        font-size: 3rem;
    }
    
    .logo h2 {
        font-size: 1.5rem;
    }
    
    .teams-grid {
        grid-template-columns: 1fr;
        padding: 1rem;
    }
    
    .team-vs {
        flex-direction: column;
        gap: 1rem;
    }
    
    .vs-text {
        font-size: 2rem;
    }
    
    .shot-buttons {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .delivery-buttons {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .runs {
        font-size: 2rem;
    }
    
    .match-summary {
        flex-direction: column;
        gap: 1rem;
    }
}

/* Animations */
@keyframes ballBowled {
    0% { top: 10%; left: 50%; transform: translateX(-50%) scale(1); }
    50% { top: 50%; left: 50%; transform: translateX(-50%) scale(0.8); }
    100% { top: 80%; left: 50%; transform: translateX(-50%) scale(0.6); }
}

@keyframes ballHit {
    0% { top: 80%; left: 50%; transform: translateX(-50%) scale(0.6); }
    100% { top: -10%; left: var(--hit-x, 80%); transform: scale(0.4); }
}

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

.celebrating {
    animation: celebrate 0.5s ease-in-out;
}