:root {
    --bg-color: #0f172a;
    --card-bg: #1e293b;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --primary: #22c55e;
    --primary-hover: #16a34a;
    --success: #10b981;
    --danger: #ef4444;
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; touch-action: manipulation; user-select: none; }

.new-game-wrapper {
    background-color: var(--bg-color); color: var(--text-main);
    display: flex; justify-content: center; align-items: center;
    min-height: 100vh; overflow: hidden;
}

#game-container {
    width: 100%; max-width: 500px; background-color: var(--card-bg);
    border-radius: 16px; padding: 16px; box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
    position: relative;
    min-height: 600px;
    display: flex; flex-direction: column;
}

.screen { display: none; flex-direction: column; align-items: center; text-align: center; animation: fadeIn 0.3s; flex: 1; justify-content: center; }
.screen.active { display: flex; }

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

.game-title { font-size: 2.2rem; font-weight: 800; margin-bottom: 16px; color: #86efac; }
.instructions { color: var(--text-muted); margin-bottom: 32px; line-height: 1.6; padding: 0 20px; font-size: 1.1rem; }
.final-score { font-size: 1.8rem; font-weight: 700; color: #86efac; margin-bottom: 16px; }

.btn {
    border: none; padding: 12px 24px; border-radius: 8px; font-size: 1.1rem; font-weight: 700;
    color: white; cursor: pointer; transition: all 0.2s; width: 100%; max-width: 250px;
}
.btn:active { transform: scale(0.95); }
.btn.primary { background-color: var(--primary); }
.btn.primary:hover { background-color: var(--primary-hover); }

.header { display: flex; justify-content: space-between; flex-wrap: wrap; width: 100%; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid #334155; font-weight: 700; font-size: 1rem; color: #86efac; gap: 8px;}
.stat { flex: 1 1 40%; text-align: left; }

.game-area { width: 100%; display: flex; flex-direction: column; align-items: center; flex: 1; justify-content: center; }

#pitch {
    width: 250px; height: 350px;
    background: #84cc16; /* Grass green */
    border: 4px solid #4d7c0f;
    border-radius: 8px;
    position: relative;
    overflow: hidden;
}

/* Dirt pitch in center */
#pitch::before {
    content: '';
    position: absolute;
    width: 100px; height: 100%;
    left: 75px; top: 0;
    background: #d4d4d8;
    opacity: 0.8;
}

#bowler {
    position: absolute;
    top: 10px; left: 110px;
    font-size: 30px;
}

#batsman {
    position: absolute;
    bottom: 10px; left: 110px;
    font-size: 35px;
    transition: transform 0.1s;
}
#batsman.swing { transform: rotate(-30deg) scaleX(-1); }

#ball {
    position: absolute;
    font-size: 16px;
    left: 117px;
    top: 40px;
    transition: top 1s linear, left 1s linear; /* fallback, mostly controlled via JS */
    z-index: 10;
}
#ball.hidden { display: none; }

#hit-zone {
    position: absolute;
    bottom: 25px; left: 75px;
    width: 100px; height: 40px;
    border: 2px dashed rgba(255, 255, 255, 0.5);
    border-radius: 4px;
    pointer-events: none;
}
#hit-zone.active { border-color: yellow; background: rgba(255, 255, 0, 0.2); }

#shot-result {
    position: absolute;
    top: 40%; left: 0; width: 100%;
    text-align: center;
    font-size: 2.5rem;
    font-weight: 800;
    color: white;
    text-shadow: 0 0 10px black;
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 20;
}
#shot-result.show { opacity: 1; transform: scale(1); }

.controls-area { margin-top: 16px; display: flex; flex-direction: column; align-items: center; width: 100%; padding: 0 20px;}

.btn-action {
    background: #3b82f6; border: none; color: #fff; font-size: 1.5rem; font-weight: 800;
    width: 100%; height: 80px; border-radius: 12px; cursor: pointer;
    box-shadow: 0 6px 0 #2563eb;
    transition: all 0.1s;
}
.btn-action:active { transform: translateY(6px); box-shadow: 0 0 0 #2563eb; }
