/* ============================
   RoyBall - Geometry Dash Style
   Modern Neon Theme
   ============================ */

:root {
    --neon-cyan: #00f5ff;
    --neon-pink: #ff00ff;
    --neon-green: #00ff88;
    --neon-yellow: #ffff00;
    --neon-orange: #ff6600;
    --neon-purple: #9d00ff;
    --bg-dark: #0a0a1a;
    --bg-darker: #050510;
    --text-primary: #ffffff;
    --text-secondary: #aaaacc;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'Orbitron', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, system-ui, sans-serif;
    background: var(--bg-darker);
    color: var(--text-primary);
    user-select: none;
    -webkit-user-select: none;
}

/* ============================
   Screens
   ============================ */

.screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10;
}

.screen.active {
    display: flex;
}

/* ============================
   Animated Background
   ============================ */

.menu-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        linear-gradient(135deg, var(--bg-darker) 0%, var(--bg-dark) 50%, #0f0f2d 100%);
    overflow: hidden;
    pointer-events: none; /* Don't block clicks! */
}

.menu-background::before {
    content: '';
    position: absolute;
    width: 200%;
    height: 200%;
    top: -50%;
    left: -50%;
    background: 
        radial-gradient(circle at 20% 80%, rgba(0, 245, 255, 0.1) 0%, transparent 25%),
        radial-gradient(circle at 80% 20%, rgba(255, 0, 255, 0.1) 0%, transparent 25%),
        radial-gradient(circle at 50% 50%, rgba(0, 255, 136, 0.05) 0%, transparent 35%);
    animation: bgPulse 8s ease-in-out infinite;
}

@keyframes bgPulse {
    0%, 100% { transform: rotate(0deg) scale(1); }
    50% { transform: rotate(180deg) scale(1.1); }
}

/* Floating particles in menu */
.menu-background::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(2px 2px at 20px 30px, var(--neon-cyan), transparent),
        radial-gradient(2px 2px at 40px 70px, var(--neon-pink), transparent),
        radial-gradient(2px 2px at 50px 160px, var(--neon-green), transparent),
        radial-gradient(2px 2px at 90px 40px, var(--neon-yellow), transparent),
        radial-gradient(2px 2px at 130px 80px, var(--neon-purple), transparent),
        radial-gradient(2px 2px at 160px 120px, var(--neon-cyan), transparent);
    background-size: 200px 200px;
    animation: particleFloat 20s linear infinite;
}

@keyframes particleFloat {
    0% { transform: translateY(0); }
    100% { transform: translateY(-200px); }
}

/* ============================
   Main Menu
   ============================ */

.menu-content {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 20px;
}

.game-title {
    font-size: clamp(3rem, 12vw, 6rem);
    font-weight: 900;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.title-roy {
    color: var(--neon-cyan);
    text-shadow: 
        0 0 10px var(--neon-cyan),
        0 0 20px var(--neon-cyan),
        0 0 40px var(--neon-cyan);
    animation: titleGlow 2s ease-in-out infinite alternate;
}

.title-ball {
    color: var(--neon-pink);
    text-shadow: 
        0 0 10px var(--neon-pink),
        0 0 20px var(--neon-pink),
        0 0 40px var(--neon-pink);
    animation: titleGlow 2s ease-in-out infinite alternate-reverse;
}

@keyframes titleGlow {
    0% { filter: brightness(1); }
    100% { filter: brightness(1.3); }
}

.subtitle {
    font-size: clamp(1rem, 4vw, 1.5rem);
    color: var(--text-secondary);
    margin-bottom: 40px;
    animation: subtitlePulse 3s ease-in-out infinite;
}

@keyframes subtitlePulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

/* ============================
   Neon Buttons
   ============================ */

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 30px;
}

.neon-btn {
    position: relative;
    padding: 15px 40px;
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(1rem, 3vw, 1.2rem);
    font-weight: 700;
    color: var(--neon-cyan);
    background: transparent;
    border: 2px solid var(--neon-cyan);
    border-radius: 10px;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.neon-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 245, 255, 0.3), transparent);
    transition: left 0.5s ease;
}

.neon-btn:hover::before,
.neon-btn:active::before {
    left: 100%;
}

.neon-btn:hover,
.neon-btn:active {
    background: rgba(0, 245, 255, 0.1);
    box-shadow: 
        0 0 20px rgba(0, 245, 255, 0.5),
        inset 0 0 20px rgba(0, 245, 255, 0.1);
    transform: scale(1.05);
}

.neon-btn.primary {
    color: var(--neon-green);
    border-color: var(--neon-green);
    animation: primaryPulse 2s ease-in-out infinite;
}

.neon-btn.primary::before {
    background: linear-gradient(90deg, transparent, rgba(0, 255, 136, 0.3), transparent);
}

.neon-btn.primary:hover,
.neon-btn.primary:active {
    background: rgba(0, 255, 136, 0.1);
    box-shadow: 
        0 0 20px rgba(0, 255, 136, 0.5),
        inset 0 0 20px rgba(0, 255, 136, 0.1);
}

@keyframes primaryPulse {
    0%, 100% { box-shadow: 0 0 5px rgba(0, 255, 136, 0.3); }
    50% { box-shadow: 0 0 20px rgba(0, 255, 136, 0.6); }
}

.back-btn {
    margin-top: 30px;
    color: var(--neon-pink);
    border-color: var(--neon-pink);
}

.back-btn:hover {
    background: rgba(255, 0, 255, 0.1);
    box-shadow: 0 0 20px rgba(255, 0, 255, 0.5);
}

/* ============================
   High Score Display
   ============================ */

.high-score {
    display: flex;
    justify-content: center;
    gap: 10px;
    font-size: clamp(1rem, 3vw, 1.3rem);
    color: var(--neon-yellow);
    text-shadow: 0 0 10px var(--neon-yellow);
}

/* Ensure numbers display correctly with system fonts as fallback */
.high-score span,
#menuHighScore,
#currentScore,
#finalScore,
#completeScore {
    font-family: 'Orbitron', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, system-ui, sans-serif;
    font-variant-numeric: tabular-nums;
}

/* ============================
   Global Game Counter (v179)
   ============================ */
.global-counter {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 20px;
    font-size: clamp(0.9rem, 2.5vw, 1.1rem);
    color: var(--neon-cyan);
    text-shadow: 0 0 10px var(--neon-cyan);
    animation: pulse-glow 3s ease-in-out infinite;
}

.global-counter .counter-icon {
    font-size: 1.2em;
    animation: bounce 2s ease-in-out infinite;
}

.global-counter .counter-label {
    font-weight: 400;
}

.global-counter .counter-value {
    font-family: 'Orbitron', monospace;
    font-weight: 700;
    font-size: 1.2em;
    color: var(--neon-green);
    text-shadow: 0 0 15px var(--neon-green);
    min-width: 60px;
    text-align: center;
    transition: all 0.3s ease;
}

.global-counter .counter-value.counting {
    animation: counter-pop 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes counter-pop {
    0%, 100% { transform: scale(1); }
    50% { 
        transform: scale(1.3);
        color: var(--neon-yellow);
        text-shadow: 0 0 20px var(--neon-yellow);
    }
}

@keyframes pulse-glow {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 1; }
}

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

/* ============================
   Version Display
   ============================ */

.version-display {
    position: fixed !important;
    bottom: 15px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    font-size: 1rem !important;
    font-weight: bold !important;
    color: #00f5ff !important;
    text-shadow: 0 0 15px #00f5ff, 0 0 30px #00f5ff !important;
    z-index: 999999 !important;
    pointer-events: none !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    background: rgba(0,0,0,0.5) !important;
    padding: 5px 15px !important;
    border-radius: 10px !important;
    border: 1px solid #00f5ff !important;
}

/* ============================
   Level Select
   ============================ */

.level-content {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 20px;
    max-height: 90vh;
    overflow-y: auto;
}

.level-content h2 {
    font-size: 2rem;
    margin-bottom: 30px;
    color: var(--neon-cyan);
    text-shadow: 0 0 20px var(--neon-cyan);
}

.level-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
    max-width: 500px;
    margin: 0 auto;
}

.level-card {
    position: relative;
    aspect-ratio: 1;
    background: linear-gradient(135deg, rgba(20, 20, 40, 0.8), rgba(10, 10, 30, 0.9));
    border: 2px solid var(--neon-cyan);
    border-radius: 15px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: all 0.3s ease;
}

.level-card:hover {
    transform: scale(1.1);
    box-shadow: 0 0 30px rgba(0, 245, 255, 0.5);
}

.level-card.locked {
    border-color: #444;
    opacity: 0.5;
    cursor: not-allowed;
}

.level-card.locked:hover {
    transform: none;
    box-shadow: none;
}

.level-number {
    font-size: 2rem;
    font-weight: 900;
    color: var(--neon-cyan);
    font-family: 'Orbitron', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, system-ui, sans-serif;
}

.level-stars {
    font-size: 0.8rem;
    margin-top: 5px;
}

.level-card.locked .level-number {
    color: #444;
}

/* ============================
   Settings
   ============================ */

.settings-content {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 20px;
    width: 90%;
    max-width: 400px;
}

.settings-content h2 {
    font-size: 2rem;
    margin-bottom: 30px;
    color: var(--neon-purple);
    text-shadow: 0 0 20px var(--neon-purple);
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    margin-bottom: 15px;
    background: rgba(20, 20, 40, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.setting-item label {
    font-size: 1rem;
    color: var(--text-primary);
}

.setting-item input[type="range"] {
    width: 120px;
    height: 8px;
    -webkit-appearance: none;
    background: linear-gradient(90deg, var(--neon-cyan), var(--neon-pink));
    border-radius: 4px;
    outline: none;
}

.setting-item input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: var(--text-primary);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 10px var(--neon-cyan);
}

.setting-item input[type="checkbox"] {
    width: 24px;
    height: 24px;
    accent-color: var(--neon-green);
    cursor: pointer;
}

/* ============================
   Game Canvas
   ============================ */

#gameScreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

#gameCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
    touch-action: none;
    -webkit-touch-callout: none;
}

#playerCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

/* ============================
   HUD
   ============================ */

#hud {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: linear-gradient(180deg, rgba(0,0,0,0.5) 0%, transparent 100%);
    z-index: 5;
    transition: opacity 0.3s ease;
}

.hud-left, .hud-right {
    flex: 0 0 80px;
}

.hud-center {
    flex: 1;
    padding: 0 20px;
}

.score-display {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

#currentScore {
    font-size: 1.8rem;
    font-weight: 900;
    color: var(--neon-yellow);
    text-shadow: 0 0 10px var(--neon-yellow);
    font-family: 'Orbitron', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, system-ui, sans-serif;
}

.score-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
}

/* Badge Counter */
.badge-counter {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    padding: 4px 10px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 15px;
    border: 1px solid var(--neon-green);
}

.badge-icon {
    font-size: 1.2rem;
    animation: badgePulse 2s ease-in-out infinite;
}

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

#badgeCount {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--neon-green);
    text-shadow: 0 0 8px var(--neon-green);
    font-family: 'Orbitron', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, system-ui, sans-serif;
}

.badge-counter.collected {
    animation: badgeCollect 0.3s ease-out;
}

@keyframes badgeCollect {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); background: rgba(0, 255, 136, 0.3); }
    100% { transform: scale(1); }
}

.badge-requirement {
    font-size: 1rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.5);
    font-family: 'Orbitron', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, system-ui, sans-serif;
}

.badge-counter.warning {
    animation: badgeWarning 0.5s ease-in-out infinite;
    border-color: #ff0044;
}

.badge-counter.warning #badgeCount,
.badge-counter.warning .badge-requirement {
    color: #ff0044;
    text-shadow: 0 0 10px #ff0044;
}

@keyframes badgeWarning {
    0%, 100% { background: rgba(255, 0, 68, 0.2); }
    50% { background: rgba(255, 0, 68, 0.5); }
}

.progress-bar {
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--neon-green), var(--neon-cyan));
    border-radius: 4px;
    transition: width 0.3s ease;
    box-shadow: 0 0 10px var(--neon-green);
}

.hud-btn {
    width: 50px;
    height: 50px;
    font-size: 1.5rem;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid var(--neon-cyan);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.hud-btn:hover,
.hud-btn:active {
    background: rgba(0, 245, 255, 0.2);
    transform: scale(1.1);
}

/* ============================
   Overlays
   ============================ */

.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 20;
    animation: fadeIn 0.3s ease;
}

.overlay.hidden {
    display: none;
}

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

.pause-content,
.gameover-content,
.complete-content {
    text-align: center;
    padding: 30px;
    background: linear-gradient(135deg, rgba(20, 20, 50, 0.95), rgba(10, 10, 30, 0.95));
    border: 2px solid var(--neon-cyan);
    border-radius: 20px;
    box-shadow: 0 0 50px rgba(0, 245, 255, 0.3);
    animation: popIn 0.3s ease;
}

@keyframes popIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.pause-content h2,
.gameover-content h2,
.complete-content h2 {
    font-size: 2rem;
    margin-bottom: 25px;
    color: var(--neon-cyan);
    text-shadow: 0 0 20px var(--neon-cyan);
}

.gameover-content h2 {
    color: var(--neon-pink);
    text-shadow: 0 0 20px var(--neon-pink);
}

.complete-content h2 {
    color: var(--neon-green);
    text-shadow: 0 0 20px var(--neon-green);
}

.pause-content .neon-btn,
.gameover-content .neon-btn,
.complete-content .neon-btn {
    display: block;
    width: 100%;
    margin-bottom: 10px;
}

.final-score {
    display: flex;
    justify-content: center;
    gap: 10px;
    font-size: 1.5rem;
    margin-bottom: 15px;
    color: var(--neon-yellow);
    text-shadow: 0 0 10px var(--neon-yellow);
    font-family: 'Orbitron', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, system-ui, sans-serif;
}

.new-record {
    font-size: 1.2rem;
    color: var(--neon-green);
    text-shadow: 0 0 20px var(--neon-green);
    margin-bottom: 20px;
    animation: recordPulse 0.5s ease infinite alternate;
}

@keyframes recordPulse {
    from { transform: scale(1); }
    to { transform: scale(1.1); }
}

.stars {
    margin-bottom: 20px;
}

.star {
    font-size: 3rem;
    opacity: 0.3;
    transition: all 0.3s ease;
}

.star.active {
    opacity: 1;
    animation: starPop 0.5s ease;
}

@keyframes starPop {
    0% { transform: scale(0); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

/* ============================
   Tap Hint
   ============================ */

.tap-hint {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.2rem;
    color: var(--text-secondary);
    animation: tapBounce 1s ease-in-out infinite;
    z-index: 15;
}

.tap-hint.hidden {
    display: none;
}

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

/* ============================
   Responsive
   ============================ */

@media (max-width: 480px) {
    .neon-btn {
        padding: 12px 30px;
    }
    
    #hud {
        padding: 10px 15px;
    }
    
    #currentScore {
        font-size: 1.4rem;
    }
    
    .hud-btn {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }
    
    .pause-content,
    .gameover-content,
    .complete-content {
        padding: 20px;
        margin: 10px;
    }
}

@media (min-width: 768px) {
    .menu-buttons {
        flex-direction: row;
        justify-content: center;
    }
}

/* ============================
   Landscape Mode Support
   ============================ */

@media (orientation: landscape) and (max-height: 500px) {
    #hud {
        padding: 5px 15px;
    }
    
    #currentScore {
        font-size: 1.2rem;
    }
    
    .progress-bar {
        height: 6px;
    }
    
    .pause-content,
    .gameover-content,
    .complete-content {
        padding: 15px 25px;
        max-height: 90vh;
        overflow-y: auto;
    }
    
    .pause-content h2,
    .gameover-content h2,
    .complete-content h2 {
        font-size: 1.5rem;
        margin-bottom: 15px;
    }
    
    .final-score {
        font-size: 1.2rem;
        margin-bottom: 10px;
    }
    
    .neon-btn {
        padding: 10px 25px;
        font-size: 0.9rem;
    }
    
    .stars {
        margin-bottom: 10px;
    }
    
    .star {
        font-size: 2rem;
    }
    
    .tap-hint {
        bottom: 50px;
        font-size: 1rem;
    }
}

/* Mobile landscape - extra small height */
@media (orientation: landscape) and (max-height: 400px) {
    #hud {
        padding: 3px 10px;
    }
    
    #currentScore {
        font-size: 1rem;
    }
    
    .hud-btn {
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }
    
    .progress-bar {
        height: 4px;
    }
    
    .pause-content,
    .gameover-content,
    .complete-content {
        padding: 10px 20px;
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
    }
    
    .pause-content h2,
    .gameover-content h2,
    .complete-content h2 {
        width: 100%;
        font-size: 1.3rem;
        margin-bottom: 10px;
    }
    
    .final-score {
        font-size: 1rem;
    }
    
    .neon-btn {
        padding: 8px 20px;
        font-size: 0.85rem;
    }
    
    .tap-hint {
        bottom: 30px;
    }
}

/* Tablet landscape */
@media (orientation: landscape) and (min-width: 768px) and (max-width: 1024px) {
    .menu-content {
        max-width: 600px;
    }
    
    .menu-buttons {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }
}

/* ============================
   Safe Area Support (iPhone X+)
   ============================ */

@supports (padding: env(safe-area-inset-bottom)) {
    #hud {
        padding-left: max(15px, env(safe-area-inset-left));
        padding-right: max(15px, env(safe-area-inset-right));
        padding-top: max(10px, env(safe-area-inset-top));
    }
    
    .menu-content,
    .level-content,
    .settings-content {
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }
    
    .tap-hint {
        bottom: max(100px, calc(100px + env(safe-area-inset-bottom)));
    }
}

/* ============================
   Rotate Screen (Mobile Portrait)
   ============================ */

.rotate-screen {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, var(--bg-darker) 0%, var(--bg-dark) 50%, #0f0f2d 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100000;
    animation: fadeIn 0.3s ease;
}

.rotate-screen.hidden {
    display: none;
}

.rotate-content {
    text-align: center;
    padding: 30px;
}

.rotate-icon {
    font-size: 5rem;
    animation: rotatePhone 2s ease-in-out infinite;
    margin-bottom: 10px;
}

@keyframes rotatePhone {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-15deg); }
    75% { transform: rotate(90deg); }
}

.rotate-arrow {
    font-size: 3rem;
    margin-bottom: 20px;
    animation: pulseArrow 1.5s ease-in-out infinite;
}

@keyframes pulseArrow {
    0%, 100% { opacity: 0.5; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.2); }
}

.rotate-content h2 {
    font-size: 1.8rem;
    color: var(--neon-cyan);
    text-shadow: 0 0 20px var(--neon-cyan);
    margin-bottom: 15px;
}

.rotate-content p {
    font-size: 1rem;
    color: var(--text-secondary);
}

/* ============================
   DOM Player (v150) - Mobile Fix
   ============================ */

#playerDiv {
    position: absolute;
    left: 0;
    top: 0;
    width: 60px;
    height: 80px;
    pointer-events: none;
    z-index: 20;
    will-change: transform;
    transform: translate3d(0, 0, 0);
}

/* Player name "רוי" with cyan glow */
.player-name {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-family: Arial, sans-serif;
    font-size: 16px;
    font-weight: bold;
    color: #00f5ff;
    text-shadow: 
        0 0 10px #00f5ff,
        0 0 20px #00f5ff;
    white-space: nowrap;
}

/* Player body container */
.player-body {
    position: relative;
    width: 40px;
    height: 56px;
    margin-left: 5px;
}

/* Head - circle with skin color */
.player-head {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 18px;
    height: 18px;
    background: #a67c52;
    border-radius: 50%;
}

/* Hair - fuckboy style swept right */
.player-hair {
    position: absolute;
    top: -3px;
    left: 50%;
    transform: translateX(-50%);
    width: 18px;
    height: 10px;
    background: #111111;
    border-radius: 50% 50% 0 0;
}

.player-hair-top {
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-40%) rotate(15deg);
    width: 14px;
    height: 8px;
    background: #111111;
    border-radius: 50%;
}

.player-hair-fade-left {
    position: absolute;
    top: 3px;
    left: 0;
    width: 3px;
    height: 6px;
    background: #222222;
}

.player-hair-fade-right {
    position: absolute;
    top: 3px;
    right: 0;
    width: 3px;
    height: 6px;
    background: #222222;
}

/* Eyes */
.player-eye {
    position: absolute;
    top: 8px;
    width: 3px;
    height: 3px;
    background: #000000;
    border-radius: 50%;
}

.player-eye-left {
    left: 5px;
}

.player-eye-right {
    right: 5px;
}

/* Torso - green jersey */
.player-torso {
    position: absolute;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 18px;
    background: #00aa44;
    display: flex;
    align-items: center;
    justify-content: center;
}

.player-number {
    color: white;
    font-family: Arial, sans-serif;
    font-size: 9px;
    font-weight: bold;
}

/* Arms */
.player-arm {
    position: absolute;
    top: 18px;
    width: 5px;
    height: 12px;
    background: #a67c52;
}

.player-arm-left {
    left: 5px;
}

.player-arm-right {
    right: 5px;
}

/* Shorts */
.player-shorts {
    position: absolute;
    top: 34px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 8px;
    background: #1a1a2e;
}

/* Legs */
.player-leg {
    position: absolute;
    top: 42px;
    width: 6px;
    height: 8px;
    background: #a67c52;
    transition: height 0.05s ease;
}

.player-leg-left {
    left: 12px;
}

.player-leg-right {
    right: 12px;
}

/* Shoes */
.player-shoe {
    position: absolute;
    top: 50px;
    width: 10px;
    height: 4px;
    background: #ffffff;
    transition: top 0.05s ease;
}

.player-shoe-left {
    left: 10px;
}

.player-shoe-right {
    right: 10px;
}

/* Soccer ball */
.player-ball {
    position: absolute;
    top: 46px;
    left: 42px;
    font-size: 16px;
    line-height: 1;
    will-change: transform;
    filter: drop-shadow(1px 1px 1px rgba(0,0,0,0.3));
}

/* Ball pentagons */
.ball-pentagon {
    position: absolute;
    background: #1a1a1a;
}

.ball-pentagon-center {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 6px;
    height: 6px;
    clip-path: polygon(50% 0%, 100% 38%, 82% 100%, 18% 100%, 0% 38%);
}

.ball-pentagon-1,
.ball-pentagon-2,
.ball-pentagon-3,
.ball-pentagon-4,
.ball-pentagon-5 {
    width: 4px;
    height: 4px;
    clip-path: polygon(50% 0%, 100% 38%, 82% 100%, 18% 100%, 0% 38%);
}

.ball-pentagon-1 { top: 1px; left: 50%; transform: translateX(-50%); }
.ball-pentagon-2 { top: 5px; right: 1px; }
.ball-pentagon-3 { bottom: 2px; right: 3px; }
.ball-pentagon-4 { bottom: 2px; left: 3px; }
.ball-pentagon-5 { top: 5px; left: 1px; }

.ball-shine {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 5px;
    height: 5px;
    background: rgba(255,255,255,0.6);
    border-radius: 50%;
}

/* Running animation classes */
#playerDiv.run-frame-1 .player-leg-left { height: 6px; }
#playerDiv.run-frame-1 .player-leg-right { height: 10px; }
#playerDiv.run-frame-1 .player-shoe-left { top: 48px; }
#playerDiv.run-frame-1 .player-shoe-right { top: 52px; }

#playerDiv.run-frame-2 .player-leg-left { height: 8px; }
#playerDiv.run-frame-2 .player-leg-right { height: 8px; }
#playerDiv.run-frame-2 .player-shoe-left { top: 50px; }
#playerDiv.run-frame-2 .player-shoe-right { top: 50px; }

#playerDiv.run-frame-3 .player-leg-left { height: 10px; }
#playerDiv.run-frame-3 .player-leg-right { height: 6px; }
#playerDiv.run-frame-3 .player-shoe-left { top: 52px; }
#playerDiv.run-frame-3 .player-shoe-right { top: 48px; }

/* Ball rotation via CSS animation */
@keyframes ballSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

#playerDiv .player-ball {
    animation: ballSpin 2s linear infinite;
}

/* Hide player when game not active */
#gameScreen:not(.active) #playerDiv {
    display: none;
}

/* ============================
   Touch Optimization
   ============================ */

/* Larger touch targets on mobile */
@media (hover: none) and (pointer: coarse) {
    .neon-btn {
        min-height: 48px;
        min-width: 120px;
    }
    
    .hud-btn {
        min-width: 48px;
        min-height: 48px;
    }
    
    .level-card {
        min-width: 100px;
        min-height: 100px;
    }
    
    .setting-item input[type="range"] {
        height: 12px;
    }
    
    .setting-item input[type="checkbox"] {
        width: 28px;
        height: 28px;
    }
}

/* ============================
   Victory Screen - Game Complete
   ============================ */

.victory-content {
    position: relative;
    text-align: center;
    padding: 40px 30px;
    background: linear-gradient(135deg, rgba(30, 20, 50, 0.98), rgba(15, 10, 35, 0.98));
    border: 3px solid var(--neon-yellow);
    border-radius: 25px;
    box-shadow: 
        0 0 60px rgba(255, 215, 0, 0.5),
        0 0 100px rgba(255, 215, 0, 0.3),
        inset 0 0 30px rgba(255, 215, 0, 0.1);
    animation: victoryPop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    max-width: 400px;
    width: 90%;
    overflow: hidden;
}

@keyframes victoryPop {
    0% { transform: scale(0.5) rotate(-5deg); opacity: 0; }
    50% { transform: scale(1.1) rotate(2deg); }
    100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

.victory-title {
    font-size: clamp(2rem, 8vw, 3rem);
    font-weight: 900;
    margin-bottom: 10px;
    background: linear-gradient(90deg, #ffd700, #ffaa00, #ffd700);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: goldShine 2s linear infinite;
    text-shadow: none;
    filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.8));
}

@keyframes goldShine {
    0% { background-position: 0% center; }
    100% { background-position: 200% center; }
}

.victory-subtitle {
    font-size: clamp(1.2rem, 4vw, 1.5rem);
    color: var(--neon-cyan);
    text-shadow: 0 0 15px var(--neon-cyan);
    margin-bottom: 25px;
    animation: subtitleGlow 1.5s ease-in-out infinite alternate;
}

@keyframes subtitleGlow {
    0% { opacity: 0.8; }
    100% { opacity: 1; text-shadow: 0 0 25px var(--neon-cyan); }
}

.victory-stats {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px 25px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 15px;
    border: 1px solid rgba(255, 215, 0, 0.3);
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 900;
    color: var(--neon-yellow);
    text-shadow: 0 0 15px var(--neon-yellow);
    font-family: 'Orbitron', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, system-ui, sans-serif;
}

.coming-soon {
    font-size: 1rem;
    color: var(--neon-pink);
    text-shadow: 0 0 10px var(--neon-pink);
    margin-bottom: 25px;
    animation: comingSoonPulse 2s ease-in-out infinite;
}

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

/* Confetti Animation */
.confetti-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    top: -10px;
    animation: confettiFall 3s linear infinite;
}

@keyframes confettiFall {
    0% { 
        transform: translateY(0) rotate(0deg); 
        opacity: 1;
    }
    100% { 
        transform: translateY(500px) rotate(720deg); 
        opacity: 0;
    }
}

/* Firework effect */
#gameComplete .overlay-fireworks {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.firework {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    animation: fireworkBurst 1s ease-out forwards;
}

@keyframes fireworkBurst {
    0% { 
        transform: scale(0);
        opacity: 1;
    }
    100% { 
        transform: scale(3);
        opacity: 0;
    }
}

/* Responsive Victory Screen */
@media (max-width: 480px) {
    .victory-content {
        padding: 25px 20px;
    }
    
    .victory-stats {
        gap: 15px;
    }
    
    .stat-item {
        padding: 10px 20px;
    }
    
    .stat-value {
        font-size: 1.4rem;
    }
}

@media (orientation: landscape) and (max-height: 500px) {
    .victory-content {
        padding: 15px 25px;
        max-height: 90vh;
        overflow-y: auto;
    }
    
    .victory-title {
        font-size: 1.8rem;
        margin-bottom: 5px;
    }
    
    .victory-subtitle {
        font-size: 1rem;
        margin-bottom: 15px;
    }
    
    .victory-stats {
        margin-bottom: 15px;
    }
    
    .stat-item {
        padding: 8px 15px;
    }
    
    .stat-value {
        font-size: 1.2rem;
    }
    
    .coming-soon {
        margin-bottom: 15px;
        font-size: 0.9rem;
    }
}
