/* ========================================
   CRICKET CHAMPIONSHIP GAME STYLES
   Created by Shivanya
   ======================================== */

/* CSS Variables - Easy to change colors! */
:root {
    --bg-color: #2d5a27;           /* Cricket green */
    --text-color: #ffffff;         /* White text */
    --accent-color: #f472b6;       /* Pink accent */
    --button-color: #8b5cf6;       /* Purple buttons */
    --gold-color: #fbbf24;         /* Gold for wins */
}

/* Reset default styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Make icons filled instead of outlined */
.material-symbols-rounded {
    font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

/* Body styling - Cricket Stadium feel */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(180deg, #1a4314 0%, #2d5a27 50%, #1a4314 100%);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    position: relative;
    overflow-x: hidden;
}

/* Stadium lights effect */
body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background:
        radial-gradient(circle at 20% 20%, rgba(255,255,255,0.1) 0%, transparent 30%),
        radial-gradient(circle at 80% 20%, rgba(255,255,255,0.1) 0%, transparent 30%),
        radial-gradient(circle at 50% 0%, rgba(255,255,255,0.15) 0%, transparent 40%);
    pointer-events: none;
    z-index: -1;
}

/* Main container */
.game-container {
    text-align: center;
    max-width: 520px;
    width: 100%;
    position: relative;
    z-index: 1;
}

/* Header styles */
header {
    margin-bottom: 15px;
}

/* Back button */
.back-button {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: white;
    text-decoration: none;
    font-size: 14px;
    margin-bottom: 10px;
    transition: transform 0.2s;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

.back-button:hover {
    transform: translateX(-5px);
}

/* Main title */
header h1 {
    font-size: 1.8rem;
    color: white;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 5px;
}

header h1 .material-symbols-rounded {
    color: var(--gold-color);
    font-size: 32px;
}

/* Subtitle */
.subtitle {
    color: rgba(255,255,255,0.9);
    font-size: 1rem;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.2);
}

/* Score board */
.score-board {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 10px;
    font-size: 1.1rem;
    flex-wrap: wrap;
}

.team-score, .overs, .target-display {
    display: flex;
    align-items: center;
    gap: 5px;
    background: rgba(0,0,0,0.3);
    padding: 8px 15px;
    border-radius: 20px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

.team-score {
    color: var(--gold-color);
    font-weight: bold;
    font-size: 1.3rem;
}

.overs {
    color: #60a5fa;
}

.target-display {
    color: #f472b6;
}

.hidden {
    display: none !important;
}

/* Phase indicator */
.phase-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 10px;
    padding: 8px 20px;
    background: linear-gradient(135deg, #ec4899, #f472b6);
    border-radius: 25px;
    font-weight: bold;
    font-size: 1rem;
    box-shadow: 0 4px 15px rgba(236, 72, 153, 0.4);
}

/* Main game area */
main {
    position: relative;
    display: inline-block;
    z-index: 2;
}

/* Make sure canvas doesn't block button clicks */
#game-canvas {
    pointer-events: auto;
}

/* The canvas */
#game-canvas {
    background: linear-gradient(180deg, #87CEEB 0%, #87CEEB 40%, #2d5a27 40%);
    border-radius: 15px;
    display: block;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    cursor: pointer;
    max-width: 100%;
}

/* Overlay screens */
.overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border-radius: 15px;
    gap: 12px;
    padding: 20px;
}

.overlay h2 {
    font-size: 2rem;
    color: var(--gold-color);
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    gap: 10px;
}

.overlay p {
    color: #94a3b8;
    font-size: 1.1rem;
}

/* Difficulty buttons */
.difficulty-buttons {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    flex-wrap: wrap;
    justify-content: center;
}

.difficulty-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 15px 20px;
    font-size: 1rem;
    font-weight: bold;
    color: white;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.difficulty-btn .material-symbols-rounded {
    font-size: 32px;
}

.difficulty-btn:hover {
    transform: scale(1.1);
}

/* Easy - Green */
.difficulty-btn.easy {
    background: linear-gradient(135deg, #4ade80, #22c55e);
    box-shadow: 0 4px 15px rgba(74, 222, 128, 0.4);
}

/* Medium - Orange */
.difficulty-btn.medium {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    box-shadow: 0 4px 15px rgba(251, 191, 36, 0.4);
}

/* Hard - Red */
.difficulty-btn.hard {
    background: linear-gradient(135deg, #f87171, #ef4444);
    box-shadow: 0 4px 15px rgba(248, 113, 113, 0.4);
}

/* Controls overlay (batting, bowling, keeping) */
.controls-overlay {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.75);
    border-radius: 15px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    z-index: 150;
    pointer-events: auto;
    touch-action: auto;
    border: 2px solid #a78bfa;
}

.instruction {
    color: white;
    font-size: 1.2rem;
    font-weight: bold;
    transition: all 0.2s;
}

#batting-instruction {
    font-size: 1.4rem;
    min-width: 200px;
    text-align: center;
}

.keeping-instruction {
    color: #fbbf24;
    font-size: 1.3rem;
    animation: pulse 0.3s infinite;
}

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

/* Timing bar for batting */
.timing-bar {
    width: 100%;
    max-width: 300px;
    height: 30px;
    background: #374151;
    border-radius: 15px;
    position: relative;
    overflow: hidden;
}

.timing-zone {
    position: absolute;
    height: 100%;
}

.timing-zone.good {
    left: 30%;
    width: 40%;
    background: #22c55e;
}

.timing-zone.perfect {
    left: 42%;
    width: 16%;
    background: #fbbf24;
    z-index: 1;
}

.timing-marker {
    position: absolute;
    width: 6px;
    height: 100%;
    background: white;
    border-radius: 3px;
    left: 0;
    transition: none;
    box-shadow: 0 0 10px white;
}

/* Bowling panel - separate from canvas */
.bowling-panel {
    margin-top: 15px;
    background: linear-gradient(135deg, #1e1b4b, #312e81);
    border-radius: 20px;
    padding: 20px;
    border: 3px solid #6366f1;
    box-shadow: 0 5px 20px rgba(99, 102, 241, 0.4);
}

.bowling-title {
    color: #fbbf24;
    font-size: 1.3rem;
    font-weight: bold;
    margin-bottom: 15px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

.bowling-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

.bowl-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 15px 25px;
    font-size: 1.1rem;
    font-weight: bold;
    color: white;
    background: linear-gradient(135deg, #22c55e, #16a34a);
    border: 3px solid #4ade80;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
    box-shadow: 0 4px 15px rgba(34, 197, 94, 0.4);
}

.bowl-btn .material-symbols-rounded {
    font-size: 32px;
}

.bowl-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(34, 197, 94, 0.6);
    background: linear-gradient(135deg, #4ade80, #22c55e);
}

.bowl-btn:active {
    transform: scale(0.95);
    background: linear-gradient(135deg, #16a34a, #15803d);
}

.bowl-btn .material-symbols-rounded {
    font-size: 24px;
}

/* Ball result display */
.result-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.9);
    padding: 20px 40px;
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    animation: popIn 0.3s ease-out;
}

@keyframes popIn {
    0% { transform: translate(-50%, -50%) scale(0); }
    100% { transform: translate(-50%, -50%) scale(1); }
}

.result-icon {
    font-size: 48px;
    color: var(--gold-color);
}

.result-text {
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
}

/* Final scores in game over */
.final-scores {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 15px 0;
}

.final-score-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.2rem;
    color: white;
}

.final-score-item .material-symbols-rounded {
    color: var(--gold-color);
}

/* Play button */
.play-button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 30px;
    font-size: 1.2rem;
    background: linear-gradient(135deg, var(--button-color), #a78bfa);
    color: white;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    margin-top: 10px;
}

.play-button:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 20px rgba(139, 92, 246, 0.5);
}

/* Instructions */
.instructions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 15px;
    color: rgba(255,255,255,0.8);
    font-size: 0.85rem;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.2);
}

/* Footer */
footer {
    margin-top: 15px;
}

.created-by {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: linear-gradient(135deg, var(--accent-color), #ec4899);
    color: white;
    padding: 8px 20px;
    border-radius: 50px;
    font-weight: bold;
    font-size: 0.9rem;
}

/* Responsive design */
@media (max-width: 450px) {
    header h1 {
        font-size: 1.4rem;
    }

    .score-board {
        gap: 10px;
        font-size: 0.9rem;
    }

    .team-score, .overs, .target-display {
        padding: 6px 10px;
    }

    .difficulty-buttons {
        flex-direction: column;
        gap: 8px;
    }

    .difficulty-btn {
        flex-direction: row;
        padding: 12px 20px;
    }

    .bowling-buttons {
        gap: 8px;
    }

    .bowl-btn {
        padding: 10px 15px;
        font-size: 0.9rem;
    }

    .bowling-panel {
        padding: 15px;
    }
}
