* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: 'Baloo 2', cursive, sans-serif;
    background: #1a1a2e;
    color: white;
    min-height: 100vh;
    overflow-x: hidden;
}
h1, h2, h3 { font-family: 'Fredoka', sans-serif; }
.back-link {
    position: fixed; top: 12px; left: 12px;
    color: rgba(255,255,255,0.6); text-decoration: none;
    font-size: 0.9rem; z-index: 200;
}
.back-link:hover { color: white; }
.screen { display: none; }
.screen.active { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100vh; }

/* Setup */
.setup-card {
    background: rgba(255,255,255,0.08); border-radius: 24px;
    padding: 36px 32px; max-width: 440px; width: 90%;
    text-align: center; border: 2px solid rgba(255,255,255,0.1);
}
.setup-card h1 { font-size: 2rem; margin-bottom: 4px; }
.subtitle { opacity: 0.6; margin-bottom: 24px; font-size: 1rem; }
.setup-section { margin-bottom: 18px; text-align: left; }
.setup-section label { display: block; font-size: 0.85rem; opacity: 0.6; margin-bottom: 6px; text-transform: uppercase; letter-spacing: 1px; }
.setup-section input {
    width: 100%; padding: 10px 14px; border-radius: 10px;
    border: 2px solid rgba(255,255,255,0.2); background: rgba(255,255,255,0.08);
    color: white; font-family: 'Baloo 2', sans-serif; font-size: 1rem; outline: none;
}
.setup-section input:focus { border-color: rgba(255,255,255,0.5); }
.btn-group { display: flex; gap: 8px; }
.opt-btn {
    flex: 1; padding: 8px 12px; border-radius: 10px; border: 2px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.06); color: white; font-family: 'Fredoka', sans-serif;
    font-size: 0.9rem; cursor: pointer; transition: all 0.2s;
}
.opt-btn:hover { background: rgba(255,255,255,0.12); }
.opt-btn.active { background: rgba(108,92,231,0.4); border-color: #6c5ce7; }
.big-btn {
    margin-top: 16px; padding: 12px 40px; background: linear-gradient(135deg, #6c5ce7, #a29bfe);
    color: white; border: none; border-radius: 14px; font-family: 'Fredoka', sans-serif;
    font-size: 1.2rem; font-weight: 600; cursor: pointer; transition: transform 0.2s;
    box-shadow: 0 4px 15px rgba(108,92,231,0.4);
}
.big-btn:hover { transform: scale(1.05); }

/* Scoreboard */
.scoreboard {
    position: fixed; top: 0; left: 0; right: 0; z-index: 100;
    background: rgba(20,20,40,0.95); backdrop-filter: blur(10px);
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 16px; border-bottom: 1px solid rgba(255,255,255,0.1);
}
.sb-team { display: flex; align-items: center; gap: 10px; }
.sb-name { font-size: 0.85rem; opacity: 0.7; }
.sb-score { font-family: 'Fredoka', sans-serif; font-size: 1.4rem; font-weight: 700; }
.sb-info { font-size: 0.85rem; opacity: 0.7; }
.sb-separator { margin: 0 6px; opacity: 0.3; }
.sb-innings { font-size: 0.75rem; opacity: 0.5; background: rgba(255,255,255,0.1); padding: 3px 10px; border-radius: 10px; }

/* Power-up Banner */
.powerup-banner {
    position: fixed; top: 44px; left: 50%; transform: translateX(-50%);
    z-index: 99; font-family: 'Fredoka', sans-serif; font-size: 0.9rem;
    padding: 6px 20px; border-radius: 20px; display: none;
    animation: pulseBanner 1s ease-in-out infinite alternate;
}
.powerup-banner.show { display: block; }
@keyframes pulseBanner { from { opacity: 0.8; } to { opacity: 1; transform: translateX(-50%) scale(1.02); } }
.powerup-banner.power-over { background: linear-gradient(90deg, #e17055, #d63031); }
.powerup-banner.no-fielder { background: linear-gradient(90deg, #00b894, #55efc4); color: #1a1a2e; }
.powerup-banner.target-shot { background: linear-gradient(90deg, #6c5ce7, #a29bfe); }
.powerup-banner.magnet-ball { background: linear-gradient(90deg, #fdcb6e, #f9ca24); color: #1a1a2e; }

/* Canvas */
#game-canvas {
    width: 100%; max-width: 800px; height: 400px;
    margin-top: 48px; background: #1a472a; border-radius: 12px;
    border: 2px solid rgba(255,255,255,0.1);
}

/* Commentary */
.commentary {
    max-width: 800px; width: 90%; text-align: center;
    padding: 10px; font-size: 1rem; opacity: 0.8;
    min-height: 36px; margin-top: 6px;
}

/* Ball Ticker */
.ball-ticker {
    display: flex; gap: 6px; justify-content: center; flex-wrap: wrap;
    max-width: 800px; padding: 4px 8px;
}
.ball-pip {
    width: 28px; height: 28px; border-radius: 50%; display: flex;
    align-items: center; justify-content: center; font-size: 0.7rem;
    font-family: 'Fredoka', sans-serif; font-weight: 600;
}
.ball-pip.dot { background: rgba(255,255,255,0.15); color: rgba(255,255,255,0.5); }
.ball-pip.runs1 { background: rgba(116,185,255,0.3); color: #74b9ff; }
.ball-pip.runs2 { background: rgba(116,185,255,0.4); color: #74b9ff; }
.ball-pip.runs3 { background: rgba(116,185,255,0.5); color: #74b9ff; }
.ball-pip.four { background: rgba(0,184,148,0.4); color: #55efc4; }
.ball-pip.six { background: rgba(255,234,167,0.4); color: #ffeaa7; }
.ball-pip.wicket { background: rgba(214,48,49,0.4); color: #ff7675; }
.ball-pip.wide { background: rgba(253,203,110,0.3); color: #fdcb6e; }
.ball-pip.noball { background: rgba(253,203,110,0.3); color: #fdcb6e; }
.ball-pip.separator { background: none; width: 8px; }

/* Action Panel */
.action-panel {
    max-width: 800px; width: 90%; padding: 10px 0 20px;
}

/* Batting */
.timing-bar-container {
    display: flex; align-items: center; gap: 10px; margin-bottom: 12px;
}
.timing-label { font-size: 0.8rem; opacity: 0.6; text-transform: uppercase; letter-spacing: 1px; width: 60px; }
.timing-bar {
    flex: 1; height: 32px; border-radius: 16px; display: flex;
    overflow: hidden; position: relative; border: 2px solid rgba(255,255,255,0.15);
}
.timing-zone { flex: 1; display: flex; align-items: center; justify-content: center; font-size: 0.7rem; font-family: 'Fredoka', sans-serif; }
.timing-early { background: rgba(214,48,49,0.3); color: #ff7675; }
.timing-perfect { background: rgba(0,184,148,0.4); color: #55efc4; }
.timing-late { background: rgba(214,48,49,0.3); color: #ff7675; }
.timing-needle {
    position: absolute; top: 0; left: 0; width: 4px; height: 100%;
    background: white; border-radius: 2px; transition: none;
    box-shadow: 0 0 6px rgba(255,255,255,0.6);
}
.shot-buttons { display: flex; gap: 8px; }
.shot-btn {
    flex: 1; padding: 12px 8px; border-radius: 12px;
    border: 2px solid rgba(255,255,255,0.2); background: rgba(255,255,255,0.08);
    color: white; font-family: 'Fredoka', sans-serif; font-size: 0.95rem;
    cursor: pointer; transition: all 0.15s;
}
.shot-btn:hover { background: rgba(108,92,231,0.3); border-color: #6c5ce7; }
.shot-btn:active { transform: scale(0.95); }
.shot-btn.restricted { opacity: 0.4; pointer-events: none; }

/* Bowling */
.bowl-type-buttons { display: flex; gap: 8px; margin-bottom: 10px; }
.bowl-btn {
    flex: 1; padding: 12px 8px; border-radius: 12px;
    border: 2px solid rgba(255,255,255,0.2); background: rgba(255,255,255,0.08);
    color: white; font-family: 'Fredoka', sans-serif; font-size: 0.95rem;
    cursor: pointer; transition: all 0.15s;
}
.bowl-btn:hover { background: rgba(225,112,85,0.3); border-color: #e17055; }
.bowl-btn.restricted { opacity: 0.4; pointer-events: none; }
.line-selector { display: flex; align-items: center; gap: 10px; }
.line-selector label { font-size: 0.8rem; opacity: 0.6; }
.btn-group-sm { display: flex; gap: 6px; }
.opt-btn-sm {
    padding: 6px 14px; border-radius: 8px; border: 2px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.06); color: white; font-family: 'Fredoka', sans-serif;
    font-size: 0.8rem; cursor: pointer; transition: all 0.2s;
}
.opt-btn-sm.active { background: rgba(108,92,231,0.4); border-color: #6c5ce7; }

.wait-msg {
    text-align: center; padding: 16px; opacity: 0.6; font-size: 1.1rem;
}

/* Break Screen */
.break-card {
    background: rgba(255,255,255,0.08); border-radius: 24px;
    padding: 40px 32px; max-width: 440px; width: 90%; text-align: center;
    border: 2px solid rgba(255,255,255,0.1);
}
.break-card h2 { font-size: 1.8rem; margin-bottom: 16px; }
.break-score { font-family: 'Fredoka', sans-serif; font-size: 3rem; font-weight: 700; color: #ffeaa7; margin-bottom: 8px; }
.break-info { opacity: 0.7; margin-bottom: 20px; font-size: 1.1rem; }

/* Result Screen */
.result-card {
    background: rgba(255,255,255,0.08); border-radius: 24px;
    padding: 36px 28px; max-width: 500px; width: 90%; text-align: center;
    border: 2px solid rgba(255,255,255,0.1);
}
.result-emoji { font-size: 4rem; margin-bottom: 8px; }
.result-card h2 { font-size: 1.6rem; margin-bottom: 8px; }
.result-card > p { opacity: 0.7; margin-bottom: 20px; }
.result-summary {
    display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; margin-bottom: 20px;
}
.result-inn {
    background: rgba(255,255,255,0.08); border-radius: 12px; padding: 12px 20px;
    min-width: 140px;
}
.result-inn .ri-label { font-size: 0.75rem; opacity: 0.5; text-transform: uppercase; }
.result-inn .ri-score { font-family: 'Fredoka', sans-serif; font-size: 1.6rem; font-weight: 700; }
.result-inn .ri-overs { font-size: 0.8rem; opacity: 0.5; }

/* Game screen layout */
#game-screen.active {
    justify-content: flex-start; padding-top: 0; min-height: 100vh;
}

@media (max-width: 600px) {
    #game-canvas { height: 280px; }
    .shot-buttons, .bowl-type-buttons { flex-wrap: wrap; }
    .shot-btn, .bowl-btn { flex: 1 1 45%; }
    .setup-card { padding: 24px 20px; }
    .setup-card h1 { font-size: 1.6rem; }
    .sb-score { font-size: 1.1rem; }
}
