@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&family=Rajdhani:wght@500;700&display=swap');

:root {
    --neon-red: #ff2a2a;
    --neon-orange: #ff6b00;
    --neon-yellow: #ffdd00;
    --neon-blue: #00d4ff;
    --neon-green: #00ff88;
    --dark: #050505;
    --panel-bg: rgba(0, 0, 0, 0.75);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    touch-action: none;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--dark);
    font-family: 'Rajdhani', sans-serif;
    color: white;
}

#game-container {
    position: relative;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at center, #1a0a0a 0%, #000000 100%);
}

#game-canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* Loading Screen */
#loading-screen {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(ellipse at center, #2a0a0a 0%, #000000 100%);
    transition: opacity 0.5s ease;
}

.loader-content {
    text-align: center;
    width: 90%;
    max-width: 600px;
}

.logo {
    width: 100%;
    max-width: 500px;
    margin-bottom: 2rem;
    filter: drop-shadow(0 0 20px rgba(255, 42, 42, 0.6));
    animation: logoPulse 2s ease-in-out infinite;
}

@keyframes logoPulse {
    0%, 100% { filter: drop-shadow(0 0 20px rgba(255, 42, 42, 0.6)); }
    50% { filter: drop-shadow(0 0 40px rgba(255, 42, 42, 0.9)); }
}

.loading-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 1rem;
    border: 1px solid rgba(255, 42, 42, 0.3);
}

#loading-progress {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--neon-red), var(--neon-orange), var(--neon-yellow));
    transition: width 0.2s ease;
    box-shadow: 0 0 10px var(--neon-red);
}

#loading-text {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.9rem;
    letter-spacing: 0.1em;
    color: var(--neon-yellow);
    text-shadow: 0 0 10px rgba(255, 221, 0, 0.5);
}

/* HUD */
#hud {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 100;
}

#hud.hidden {
    display: none;
}

.hud-top {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: linear-gradient(180deg, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0) 100%);
}

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

.score-panel.center {
    align-items: center;
}

.score-panel.right {
    align-items: flex-end;
}

.score-panel .label {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.65rem;
    letter-spacing: 0.15em;
    color: var(--neon-orange);
    text-shadow: 0 0 5px rgba(255, 107, 0, 0.5);
}

.score-panel span:last-child {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.5rem;
    font-weight: 900;
    color: white;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

#message-area {
    position: absolute;
    top: 20%;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    font-family: 'Orbitron', sans-serif;
    font-size: 1.4rem;
    font-weight: 900;
    color: var(--neon-yellow);
    text-shadow: 0 0 20px rgba(255, 221, 0, 0.8);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
    white-space: nowrap;
}

#message-area.show {
    opacity: 1;
    animation: messagePop 0.5s ease;
}

@keyframes messagePop {
    0% { transform: translateX(-50%) scale(0.5); }
    50% { transform: translateX(-50%) scale(1.2); }
    100% { transform: translateX(-50%) scale(1); }
}

/* Mobile controls */
.mobile-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 35%;
    display: flex;
    pointer-events: auto;
}

.flipper-zone {
    flex: 1;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 1.5rem;
    background: rgba(255, 255, 255, 0.02);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    transition: background 0.1s ease;
}

.flipper-zone.active {
    background: rgba(255, 42, 42, 0.15);
}

.flipper-zone.left {
    border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.flipper-zone.right {
    border-left: 1px solid rgba(255, 255, 255, 0.05);
}

.plunger-zone {
    width: 80px;
    display: none;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 1.5rem;
    background: rgba(255, 221, 0, 0.05);
    border-left: 1px solid rgba(255, 255, 255, 0.05);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.plunger-zone.active {
    background: rgba(255, 221, 0, 0.2);
}

.zone-label {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.6rem;
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.5);
    text-align: center;
}

/* Show plunger zone only on touch devices in portrait */
@media (hover: none) and (orientation: portrait) {
    .plunger-zone {
        display: flex;
    }
}

/* Overlays */
.overlay {
    position: absolute;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(4px);
    transition: opacity 0.4s ease;
}

.overlay.hidden {
    display: none;
}

.overlay-content {
    text-align: center;
    padding: 2rem;
    max-width: 90%;
    width: 500px;
}

.overlay-logo {
    width: 100%;
    max-width: 400px;
    margin-bottom: 1rem;
    filter: drop-shadow(0 0 30px rgba(255, 42, 42, 0.7));
}

.overlay h1 {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.8rem;
    font-weight: 900;
    color: var(--neon-yellow);
    text-shadow: 0 0 20px rgba(255, 221, 0, 0.6);
    margin-bottom: 0.5rem;
    letter-spacing: 0.05em;
}

.tagline {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 1.5rem;
}

.controls-info {
    background: var(--panel-bg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    font-size: 0.85rem;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.7);
}

.controls-info strong {
    color: var(--neon-blue);
}

.arcade-btn {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.1rem;
    font-weight: 900;
    letter-spacing: 0.1em;
    padding: 1rem 2.5rem;
    border: none;
    border-radius: 4px;
    background: linear-gradient(180deg, var(--neon-red) 0%, #cc0000 100%);
    color: white;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
    box-shadow: 0 0 20px rgba(255, 42, 42, 0.5), inset 0 1px 0 rgba(255,255,255,0.3);
    cursor: pointer;
    transition: transform 0.1s ease, box-shadow 0.2s ease;
    pointer-events: auto;
}

.arcade-btn:hover {
    box-shadow: 0 0 30px rgba(255, 42, 42, 0.8), inset 0 1px 0 rgba(255,255,255,0.3);
    transform: translateY(-2px);
}

.arcade-btn:active {
    transform: translateY(0);
    box-shadow: 0 0 15px rgba(255, 42, 42, 0.5), inset 0 2px 4px rgba(0,0,0,0.3);
}

.final-score {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.5rem;
    color: white;
    margin-bottom: 0.5rem;
}

#new-highscore {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.2rem;
    color: var(--neon-green);
    text-shadow: 0 0 15px rgba(0, 255, 136, 0.6);
    margin-bottom: 1.5rem;
}

#new-highscore.hidden {
    display: none;
}

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

/* Portrait orientation handling */
@media (orientation: landscape) and (max-height: 500px) {
    .hud-top {
        padding: 0.4rem 0.75rem;
    }
    .score-panel span:last-child {
        font-size: 1.1rem;
    }
    .score-panel .label {
        font-size: 0.5rem;
    }
}
