/* Paveometry Dash - Enhanced Styles */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    overflow: hidden;
    background-color: #050505;
    color: white;
    font-family: 'Orbitron', sans-serif;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
}

#game-container {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
    touch-action: none;
}

/* UI Layer */
#ui-layer {
    position: absolute;
    top: 20px;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 0 20px;
    pointer-events: none;
    text-shadow: 0 0 10px rgba(0, 255, 255, 0.8);
    box-sizing: border-box;
    z-index: 10;
}

#score-display {
    font-size: clamp(24px, 6vw, 40px);
    color: #fff;
    font-weight: 900;
}

#level-display {
    font-size: clamp(24px, 6vw, 40px);
    color: #ff00ff;
    font-weight: 900;
    text-shadow: 0 0 15px #ff00ff;
}

/* Skill Bar */
#skill-bar {
    position: absolute;
    bottom: 120px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 20px;
    pointer-events: none;
    z-index: 10;
}

.skill-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: rgba(0, 0, 0, 0.6);
    padding: 8px 16px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(5px);
}

.skill-label {
    font-size: 10px;
    color: #00ffff;
    font-weight: 700;
}

.skill-bar-bg {
    width: 60px;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

.skill-bar-fill {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #00ffff, #ff00ff);
    transition: width 0.1s ease;
}

#shield-count {
    font-size: 14px;
    color: #fff;
    transition: all 0.2s;
}

#shield-count.active {
    color: #00ffff;
    text-shadow: 0 0 10px #00ffff;
    animation: pulse 0.5s infinite;
}

.skill-key {
    font-size: 8px;
    color: rgba(255, 255, 255, 0.5);
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

/* Level Up Overlay */
#level-up-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 50;
    opacity: 0;
    transition: opacity 0.3s;
}

#level-up-overlay.show {
    opacity: 1;
}

#level-up-content {
    text-align: center;
    animation: levelUpBounce 0.5s ease-out;
}

#level-up-text {
    font-size: clamp(48px, 12vw, 100px);
    font-weight: 900;
    color: #fff;
    text-shadow:
        0 0 20px #ff00ff,
        0 0 40px #ff00ff,
        0 0 60px #ff00ff;
    animation: glow 1s ease-in-out infinite alternate;
}

#level-up-sub {
    font-size: clamp(16px, 4vw, 24px);
    color: #00ffff;
    margin-top: 10px;
    text-shadow: 0 0 10px #00ffff;
}

@keyframes levelUpBounce {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }

    50% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes glow {
    from {
        text-shadow: 0 0 20px #ff00ff, 0 0 40px #ff00ff;
    }

    to {
        text-shadow: 0 0 30px #00ffff, 0 0 60px #00ffff, 0 0 80px #00ffff;
    }
}

/* Overlays */
#menu-overlay,
#game-over-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    z-index: 100;
    padding: 20px;
}

h1,
h2 {
    font-size: clamp(40px, 10vw, 80px);
    color: #fff;
    text-transform: uppercase;
    margin-bottom: 10px;
    position: relative;
    text-align: center;
    text-shadow: 0 0 20px #00ffff;
}

.glitch {
    position: relative;
    color: white;
    animation: glitchText 2s infinite;
}

@keyframes glitchText {

    0%,
    90%,
    100% {
        transform: translate(0);
    }

    92% {
        transform: translate(-2px, 2px);
    }

    94% {
        transform: translate(2px, -2px);
    }

    96% {
        transform: translate(-2px, -2px);
    }

    98% {
        transform: translate(2px, 2px);
    }
}

button {
    padding: 15px 40px;
    font-size: clamp(18px, 4vw, 30px);
    font-family: 'Orbitron', sans-serif;
    font-weight: bold;
    color: #fff;
    background: #ff00ff;
    border: none;
    cursor: pointer;
    box-shadow: 0 0 20px #ff00ff;
    transform: skewX(-10deg);
    transition: all 0.1s;
    margin-top: 20px;
    pointer-events: auto;
    border: 2px solid #fff;
    touch-action: manipulation;
}

button:hover,
button:active {
    background: #fff;
    color: #ff00ff;
    box-shadow: 0 0 40px #ff00ff;
    transform: skewX(-10deg) scale(1.05);
}

p {
    font-size: clamp(14px, 3vw, 18px);
    color: #00ffff;
    margin-top: 10px;
    text-align: center;
}

.sub-info {
    font-size: clamp(10px, 2.5vw, 14px);
    color: rgba(255, 255, 255, 0.6);
    margin-top: 5px;
}

#bg-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, #1a0b2e 0%, #000000 90%);
    background-size: cover;
    opacity: 0.3;
    z-index: -1;
    pointer-events: none;
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    #skill-bar {
        bottom: 130px;
        gap: 10px;
    }

    .skill-item {
        padding: 6px 12px;
    }

    .skill-key {
        display: none;
    }

    #ui-layer {
        top: 10px;
        padding: 0 15px;
    }
}

@media (max-height: 500px) {
    #skill-bar {
        bottom: 110px;
    }

    h1,
    h2 {
        font-size: 32px;
    }

    button {
        padding: 10px 30px;
    }
}

/* Landscape phone optimization */
@media (max-height: 450px) and (orientation: landscape) {

    #menu-overlay,
    #game-over-overlay {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 20px;
    }

    h1,
    h2 {
        width: 100%;
        margin-bottom: 0;
    }
}

/* === MOBILE SKILL BUTTONS === */
#mobile-skill-buttons {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
}

.mobile-skill-btn {
    position: absolute;
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    border: 3px solid;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    font-family: 'Orbitron', sans-serif;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.mobile-skill-btn:active {
    transform: scale(0.95);
}

.mobile-skill-btn .btn-icon {
    font-size: 24px;
    margin-bottom: 4px;
}

.mobile-skill-btn .btn-text {
    font-size: 10px;
    font-weight: 700;
}

.dash-btn {
    border-color: #00ffff;
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.5);
}

.dash-btn:active {
    background: rgba(0, 255, 255, 0.3);
    box-shadow: 0 0 25px rgba(0, 255, 255, 0.8);
}

.dash-btn.on-cooldown {
    opacity: 0.4;
    pointer-events: none;
}

.shield-btn {
    border-color: #00ff00;
    box-shadow: 0 0 15px rgba(0, 255, 0, 0.5);
}

.shield-btn:active {
    background: rgba(0, 255, 0, 0.3);
    box-shadow: 0 0 25px rgba(0, 255, 0, 0.8);
}

.shield-btn.no-shield {
    opacity: 0.4;
    pointer-events: none;
    border-color: #555;
    box-shadow: none;
}

#mobile-dash-btn {
    bottom: 30px;
    left: 20px;
}

#mobile-shield-btn {
    top: 80px;
    right: 20px;
}

/* Show mobile buttons only on touch devices */
@media (hover: none) and (pointer: coarse) {
    #mobile-skill-buttons {
        display: flex;
    }

    #skill-bar .skill-key {
        display: none;
        /* Hide keyboard shortcuts on mobile */
    }
}