* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    position: fixed;
}

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #1a0033 0%, #330033 50%, #1a0033 100%);
    color: #fff;
    touch-action: none;
}

#game-container {
    position: relative;
    width: 100%;
    height: 100%;
    max-width: 1000px;
    max-height: 600px;
    background: linear-gradient(180deg, #0a0015 0%, #1a0a2e 100%);
    border: 4px solid #8b0000;
    border-radius: 20px;
    box-shadow: 0 0 40px rgba(139, 0, 0, 0.6),
        inset 0 0 60px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    margin: auto;
}

@media (max-width: 768px),
(max-height: 600px) {
    body {
        display: block;
    }

    #game-container {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw !important;
        height: 100vh !important;
        max-width: none !important;
        max-height: none !important;
        border-radius: 0 !important;
        border: none !important;
        margin: 0 !important;
    }
}

/* Screens */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 40px;
    background: radial-gradient(ellipse at center, rgba(26, 0, 51, 0.8) 0%, rgba(10, 0, 21, 0.95) 100%);
    backdrop-filter: blur(10px);
    overflow-y: auto;
    overflow-x: hidden;
}

@media (max-width: 768px) {
    .screen {
        padding: 20px 10px;
        justify-content: flex-start;
        padding-top: 10vh;
    }
}

.screen.active {
    display: flex;
}

/* Title Screen */
.title-container {
    text-align: center;
    margin-bottom: 40px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-10px);
    }
}

.game-title {
    font-size: 4rem;
    font-weight: bold;
    color: #ff0000;
    text-shadow: 0 0 20px #ff0000,
        0 0 40px #8b0000,
        0 5px 10px rgba(0, 0, 0, 0.8);
    letter-spacing: 5px;
    margin-bottom: 10px;
}

.game-subtitle {
    font-size: 1.2rem;
    color: #cccccc;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
}

.controls-info {
    background: rgba(139, 0, 0, 0.2);
    padding: 20px 30px;
    border-radius: 15px;
    border: 2px solid #8b0000;
    margin-top: 30px;
    text-align: center;
}

.controls-info h3 {
    color: #ff6666;
    margin-bottom: 10px;
    font-size: 1.3rem;
}

.controls-info p {
    margin: 5px 0;
    color: #ffffff;
}

/* Buttons */
.game-btn {
    padding: 15px 40px;
    font-size: 1.3rem;
    font-weight: bold;
    color: #fff;
    background: linear-gradient(135deg, #8b0000 0%, #ff0000 100%);
    border: 3px solid #ff6666;
    border-radius: 12px;
    cursor: pointer;
    margin: 10px;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 2px;
    box-shadow: 0 5px 15px rgba(255, 0, 0, 0.4);
}

.game-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(255, 0, 0, 0.6);
    background: linear-gradient(135deg, #ff0000 0%, #ff3333 100%);
}

.game-btn:active {
    transform: translateY(0);
    box-shadow: 0 3px 10px rgba(255, 0, 0, 0.4);
}

.game-btn-small {
    padding: 10px 20px;
    font-size: 1rem;
    font-weight: bold;
    color: #fff;
    background: rgba(139, 0, 0, 0.8);
    border: 2px solid #ff6666;
    border-radius: 8px;
    cursor: pointer;
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 100;
    transition: all 0.3s ease;
}

.game-btn-small:hover {
    background: rgba(255, 0, 0, 0.9);
    transform: scale(1.05);
}

/* HUD */
#hud {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: space-around;
    padding: 15px 20px;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.8) 0%, transparent 100%);
    z-index: 10;
}

.hud-item {
    font-size: 1.2rem;
    font-weight: bold;
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.8);
}

.hud-label {
    color: #ff6666;
    margin-right: 8px;
}

#score,
#timer {
    color: #ffff00;
}

#lives {
    color: #ff0000;
    font-size: 1.4rem;
}

/* Canvas */
#game-canvas {
    display: block;
    width: 100%;
    height: 100%;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

/* Result Screens */
.result-title {
    font-size: 3.5rem;
    margin-bottom: 20px;
    text-shadow: 0 0 20px currentColor;
}

#gameover-screen .result-title {
    color: #ff0000;
}

#victory-screen .result-title {
    color: #00ff00;
}

.result-message {
    font-size: 1.5rem;
    margin-bottom: 30px;
    color: #cccccc;
}

.final-score {
    font-size: 2rem;
    margin-bottom: 30px;
    padding: 20px 40px;
    background: rgba(139, 0, 0, 0.3);
    border: 2px solid #ff6666;
    border-radius: 15px;
}

.final-score span {
    color: #ffff00;
    font-weight: bold;
}

/* Pause Screen */
#pause-screen h2 {
    font-size: 3rem;
    color: #ff6666;
    margin-bottom: 40px;
    text-shadow: 0 0 20px #ff0000;
}

/* Responsive Design */
@media (max-width: 768px) {
    #game-container {
        max-width: 100%;
        height: 100vh;
        border-radius: 0;
        border: none;
    }

    .game-title {
        font-size: 2rem;
        margin-bottom: 5px;
    }

    .game-subtitle {
        font-size: 0.9rem;
    }

    .controls-info {
        padding: 10px 15px;
        margin-top: 15px;
    }

    .controls-info h3 {
        font-size: 1rem;
    }

    .controls-info p {
        font-size: 0.85rem;
    }

    .game-btn {
        padding: 12px 30px;
        font-size: 1.1rem;
        margin: 5px;
    }

    .result-title {
        font-size: 2rem;
    }

    .result-message {
        font-size: 1.1rem;
    }

    .final-score {
        font-size: 1.3rem;
        padding: 15px 25px;
    }
}

/* ============================================ */
/* MOBILE TOUCH CONTROLS */
/* ============================================ */
.mobile-controls {
    display: none;
    position: fixed;
    bottom: 20px;
    left: 0;
    right: 0;
    width: 100%;
    height: 150px;
    pointer-events: none;
    z-index: 1000;
}

.mobile-controls.visible {
    display: block;
}

.control-btn {
    pointer-events: all;
    position: absolute;
    width: 70px;
    height: 70px;
    border-radius: 50%;
    border: 3px solid #8b0000;
    background: linear-gradient(135deg, rgba(139, 0, 0, 0.8), rgba(80, 0, 0, 0.8));
    color: #fff;
    font-size: 32px;
    font-weight: bold;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    transition: all 0.1s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.control-btn:active {
    transform: scale(0.9);
    background: linear-gradient(135deg, rgba(180, 0, 0, 0.9), rgba(120, 0, 0, 0.9));
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.7);
}

.control-left {
    bottom: 80px;
    left: 20px;
}

.control-right {
    bottom: 80px;
    left: 110px;
}

.control-jump {
    bottom: 80px;
    right: 30px;
}

@media (max-width: 480px) {
    .control-btn {
        width: 60px;
        height: 60px;
        font-size: 28px;
    }

    .control-left {
        left: 15px;
        bottom: 30px;
    }

    .control-right {
        left: 90px;
        bottom: 30px;
    }

    .control-jump {
        right: 20px;
        bottom: 30px;
    }
}

/* Mobile fullscreen fixes */
html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    position: fixed;
    -webkit-overflow-scrolling: touch;
}

body {
    touch-action: none;
}

/* Game container mobile adjustments */
@media (max-width: 768px) {
    #game-container {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw !important;
        height: 100vh !important;
        max-width: 100vw !important;
        border-radius: 0 !important;
        border: none !important;
    }
}

/* Landscape mobile specific */
@media (max-height: 500px) and (orientation: landscape) {
    #hud {
        padding: 5px 10px;
        font-size: 0.9rem;
    }

    .hud-item {
        font-size: 0.9rem;
    }

    #game-btn-small {
        padding: 5px 10px;
        font-size: 0.8rem;
        top: 5px;
        right: 10px;
    }
}