:root {
    --primary-color: #ff007f; /* Neon pink */
    --secondary-color: #00ffff; /* Neon cyan */
    --accent-color: #ffea00; /* Neon yellow/gold */
    --bg-dark: #060214;
    --card-bg: rgba(20, 10, 40, 0.7);
    --border-glow: 0 0 10px rgba(255, 0, 127, 0.5), 0 0 20px rgba(255, 0, 127, 0.3);
    --neon-text: 0 0 5px #fff, 0 0 10px var(--primary-color), 0 0 20px var(--primary-color);
    --cyan-glow: 0 0 10px var(--secondary-color), 0 0 20px var(--secondary-color);
    --gold-glow: 0 0 10px var(--accent-color), 0 0 20px var(--accent-color);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    touch-action: none;
}

body {
    background: radial-gradient(circle at center, #1b0a3a 0%, #060211 100%);
    background-color: var(--bg-dark);
    color: #ffffff;
    font-family: 'Press Start 2P', monospace;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    perspective: 1000px;
    overscroll-behavior: none;
    -webkit-text-size-adjust: none;
    text-size-adjust: none;
}

/* scanline effect overlay */
body::after {
    content: " ";
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
    background-size: 100% 4px, 6px 100%;
    z-index: 10;
    pointer-events: none;
    opacity: 0.45;
}

#arcade-wrapper {
    position: relative;
    padding: 24px;
    background: linear-gradient(180deg, #2a1654 0%, #110729 100%);
    border: 6px solid #48238f;
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8),
                0 0 30px rgba(114, 46, 209, 0.4),
                inset 0 0 15px rgba(255, 255, 255, 0.1);
    transform: rotateX(2deg);
}

#game-container {
    position: relative;
    width: 800px;
    height: 450px;
    background-color: #000000;
    overflow: hidden;
    border: 4px solid #000;
    border-radius: 8px;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 1);
}

/* Canvas styles - Pixelated for retro aesthetic */
#gameCanvas {
    display: block;
    width: 100%;
    height: 100%;
    image-rendering: -moz-crisp-edges;
    image-rendering: -webkit-crisp-edges;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

/* Overlay Screen template */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--card-bg);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 5;
    text-align: center;
    transition: opacity 0.3s ease;
    padding: 20px;
}

.hidden {
    display: none !important;
    opacity: 0;
    pointer-events: none;
}

/* Typography & Text glows */
.game-title {
    font-size: 2.8rem;
    font-weight: 800;
    line-height: 1.2;
    color: #ffffff;
    text-shadow: var(--neon-text);
    margin-bottom: 15px;
    letter-spacing: 2px;
    animation: pulse 2s infinite alternate;
}

.screen-title {
    font-size: 3rem;
    margin-bottom: 20px;
    letter-spacing: 3px;
}

.text-red {
    color: #ff3366;
    text-shadow: 0 0 10px #ff3366, 0 0 25px #ff3366;
}

.text-gold {
    color: var(--accent-color);
    text-shadow: var(--gold-glow);
}

.subtitle {
    font-size: 0.9rem;
    color: var(--secondary-color);
    text-shadow: 0 0 5px rgba(0, 255, 255, 0.5);
    margin-bottom: 30px;
    animation: blink 1.2s infinite;
}

/* Score display in screens */
.score-display {
    font-size: 1.2rem;
    margin-bottom: 25px;
    color: #ffffff;
}

.high-score-notify {
    font-size: 0.9rem;
    color: var(--accent-color);
    text-shadow: var(--gold-glow);
    margin-bottom: 20px;
    animation: bounce 0.6s infinite alternate;
}

/* Controls Guide table on start screen */
.controls-guide {
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid var(--secondary-color);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 30px;
    max-width: 90%;
    box-shadow: var(--cyan-glow) inset;
}

.guide-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.65rem;
    margin: 8px 0;
    text-align: left;
}

.guide-row span:last-child {
    margin-left: 20px;
    color: #bbb;
}

.key {
    background: #444;
    border: 2px solid #888;
    border-bottom: 5px solid #222;
    border-radius: 4px;
    padding: 3px 6px;
    font-size: 0.6rem;
    font-weight: bold;
    color: #fff;
    display: inline-block;
}

/* Buttons */
.btn {
    font-family: 'Press Start 2P', monospace;
    font-size: 1rem;
    padding: 15px 30px;
    color: #ffffff;
    background: rgba(255, 0, 127, 0.2);
    border: 4px solid var(--primary-color);
    border-radius: 4px;
    cursor: pointer;
    box-shadow: var(--border-glow);
    transition: all 0.15s ease;
    position: relative;
    overflow: hidden;
}

.btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: -50%;
    width: 200%;
    height: 100%;
    background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.25), transparent);
    transform: skewX(-30deg);
    transition: 0.75s;
    opacity: 0;
}

.btn:hover {
    background: var(--primary-color);
    box-shadow: 0 0 20px var(--primary-color), 0 0 40px var(--primary-color);
    transform: scale(1.05);
}

.btn:hover::after {
    opacity: 1;
    left: 120%;
}

.btn:active {
    transform: scale(0.95);
    box-shadow: 0 0 10px var(--primary-color);
}

/* Heads-Up Display */
#hud {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0) 100%);
    z-index: 4;
    font-size: 0.75rem;
    letter-spacing: 1px;
    text-shadow: 1px 1px 2px #000;
}

.hud-item {
    display: flex;
    align-items: center;
}

#hud-lives {
    color: #ff3366;
}

#lives-container {
    margin-left: 5px;
    letter-spacing: 3px;
}

#hud-level {
    color: var(--secondary-color);
}

#hud-score {
    color: #ffffff;
}

#hud-highscore {
    color: var(--accent-color);
}

/* Boss Health Bar */
#boss-hud {
    position: absolute;
    top: 45px;
    left: 50%;
    transform: translateX(-50%);
    width: 260px;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(10, 5, 20, 0.85);
    border: 2px solid var(--primary-color);
    border-radius: 4px;
    padding: 6px 10px;
    z-index: 4;
    box-shadow: var(--border-glow);
}

.boss-label {
    font-size: 0.55rem;
    color: var(--primary-color);
    text-shadow: var(--neon-text);
    margin-bottom: 5px;
    letter-spacing: 1px;
}

.boss-bar-outer {
    width: 100%;
    height: 10px;
    background: #18000b;
    border: 1px solid #000;
    border-radius: 2px;
    overflow: hidden;
}

#boss-bar-inner {
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #ff0055, #ff00c8);
    box-shadow: 0 0 6px #ff0055;
    transition: width 0.2s ease-out;
}

/* Mobile Touch Zones Overlay */
#touch-zones {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* Let touches pass through to window handlers */
    display: flex;
    z-index: 3; /* Just under screens, but above canvas */
}

.touch-zone {
    flex: 1;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    padding-bottom: 40px;
    background: rgba(255, 255, 255, 0.01);
    border-right: 1px dashed rgba(255, 255, 255, 0.04);
    transition: background 0.1s ease;
}

#touch-right {
    border-right: none;
    border-left: 1px dashed rgba(255, 255, 255, 0.04);
}

.touch-zone.active {
    background: rgba(0, 255, 255, 0.08); /* Neon cyan glow when held left */
}

#touch-right.active {
    background: rgba(255, 0, 127, 0.08); /* Neon pink glow when held right */
}

.zone-label {
    font-size: 0.55rem;
    color: rgba(255, 255, 255, 0.15);
    letter-spacing: 1.5px;
    font-family: 'Press Start 2P', monospace;
}

#touch-jump-indicator {
    position: absolute;
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    font-size: 1.2rem;
    color: var(--accent-color);
    text-shadow: var(--gold-glow);
    font-family: 'Press Start 2P', monospace;
    opacity: 0;
    pointer-events: none;
    transition: transform 0.15s ease-out, opacity 0.15s ease-out;
}

#touch-jump-indicator.animate {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.2);
}

/* Animations */
@keyframes pulse {
    0% {
        text-shadow: 0 0 5px #fff, 0 0 10px var(--primary-color), 0 0 15px var(--primary-color);
    }
    100% {
        text-shadow: 0 0 10px #fff, 0 0 20px var(--primary-color), 0 0 30px var(--primary-color), 0 0 40px var(--primary-color);
    }
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

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

/* Responsiveness - Scale the entire wrapper */
@media (max-width: 880px) {
    #arcade-wrapper {
        padding: 10px;
        border-width: 4px;
        border-radius: 12px;
        transform: none;
    }
    #game-container {
        width: 100vw;
        height: 56.25vw; /* 16:9 ratio */
        max-width: 800px;
        max-height: 450px;
    }
    .game-title {
        font-size: 1.8rem;
    }
    .screen-title {
        font-size: 2.2rem;
    }
    .btn {
        font-size: 0.8rem;
        padding: 10px 20px;
    }
    .controls-guide {
        display: none; /* Hide keyboard controls guide on mobile-ish widths */
    }
}


