/* Game Styles - Mobile First */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    overflow: hidden;
    font-family: 'Segoe UI', Arial, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    height: 100%;
    touch-action: none;
}

/* ==================== */
/* MOBILE STYLES (Default) */
/* ==================== */

#mobile-container {
    display: block;
    width: 100vw;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
}

#TutContainerMobile {
    width: 100%;
    height: 100%;
}

#TutContainerMobile canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}

#iphone-frame {
    display: none;
}

/* ==================== */
/* DESKTOP STYLES - iPhone Frame */
/* ==================== */

@media (min-width: 768px) {
    #mobile-container {
        display: none;
    }

    #iphone-frame {
        display: block;
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%) scale(0.85);
        width: 320px;
        height: 660px;
        background: linear-gradient(145deg, #1c1c1e 0%, #2c2c2e 50%, #1c1c1e 100%);
        border-radius: 45px;
        padding: 10px;
        box-shadow:
            0 0 0 3px #3a3a3c,
            0 0 0 6px #1c1c1e,
            0 25px 50px rgba(0, 0, 0, 0.5),
            inset 0 0 20px rgba(255, 255, 255, 0.05);
    }

    .iphone-notch {
        position: absolute;
        top: 12px;
        left: 50%;
        transform: translateX(-50%);
        width: 150px;
        height: 35px;
        background: #1c1c1e;
        border-radius: 0 0 20px 20px;
        z-index: 10;
    }

    .iphone-notch::before {
        content: '';
        position: absolute;
        top: 10px;
        left: 50%;
        transform: translateX(-50%);
        width: 60px;
        height: 6px;
        background: #3a3a3c;
        border-radius: 3px;
    }

    .iphone-notch::after {
        content: '';
        position: absolute;
        top: 8px;
        right: 25px;
        width: 12px;
        height: 12px;
        background: radial-gradient(circle, #3a3a3c 40%, #2a2a2c 60%);
        border-radius: 50%;
    }

    .iphone-screen {
        width: 100%;
        height: calc(100% - 20px);
        background: #000;
        border-radius: 38px;
        overflow: hidden;
        position: relative;
    }

    #TutContainer {
        width: 100%;
        height: 100%;
    }

    #TutContainer canvas {
        display: block;
        width: 100% !important;
        height: 100% !important;
        border-radius: 38px;
    }

    .iphone-home-bar {
        position: absolute;
        bottom: 20px;
        left: 50%;
        transform: translateX(-50%);
        width: 130px;
        height: 5px;
        background: #fff;
        border-radius: 3px;
        opacity: 0.8;
    }

    /* Side buttons */
    #iphone-frame::before {
        content: '';
        position: absolute;
        right: -3px;
        top: 180px;
        width: 4px;
        height: 80px;
        background: #3a3a3c;
        border-radius: 0 2px 2px 0;
    }

    #iphone-frame::after {
        content: '';
        position: absolute;
        left: -3px;
        top: 150px;
        width: 4px;
        height: 35px;
        background: #3a3a3c;
        border-radius: 2px 0 0 2px;
        box-shadow: 0 55px 0 #3a3a3c, 0 100px 0 #3a3a3c;
    }

    /* Desktop instruction */
    body::after {
        content: 'Swipe/Drag: ↑ Jump | ← → Move | Arrow Keys also work';
        position: fixed;
        bottom: 30px;
        left: 50%;
        transform: translateX(-50%);
        color: rgba(255, 255, 255, 0.5);
        font-size: 14px;
        letter-spacing: 1px;
    }
}

/* ==================== */
/* UI ELEMENTS */
/* ==================== */

/* Score Display */
.score-text {
    position: absolute;
    top: 60px;
    left: 15px;
    font-size: 22px;
    font-weight: bold;
    color: #fff;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    z-index: 100;
}

/* High Score Display */
.high-score-text {
    position: absolute;
    top: 90px;
    left: 15px;
    font-size: 14px;
    font-weight: bold;
    color: rgba(255, 255, 255, 0.7);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    z-index: 100;
}

/* Coins Collected Display */
.coins-text {
    position: absolute;
    top: 115px;
    left: 15px;
    font-size: 16px;
    font-weight: bold;
    color: #ffd700;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    z-index: 100;
}

/* Lives Display */
.lives-display {
    position: absolute;
    top: 60px;
    right: 15px;
    font-size: 22px;
    z-index: 100;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

/* Info Text */
.info-text {
    position: absolute;
    top: 15px;
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 20px;
    background: rgba(255, 215, 0, 0.95);
    border-radius: 25px;
    font-size: 12px;
    font-weight: bold;
    color: #333;
    z-index: 100;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    white-space: nowrap;
    max-width: 90%;
    text-align: center;
}

/* Mobile-specific info text */
@media (max-width: 767px) {
    .info-text {
        font-size: 11px;
        padding: 6px 15px;
    }
}

/* ==================== */
/* TOUCH CONTROLS OVERLAY */
/* ==================== */

.touch-hint {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 40px;
    z-index: 100;
    opacity: 0.6;
    pointer-events: none;
}

.touch-hint-arrow {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: rgba(255, 255, 255, 0.7);
}

@media (min-width: 768px) {
    .touch-hint {
        display: none;
    }
}

/* ==================== */
/* GAME OVER SCREEN */
/* ==================== */

.game-over-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.5s ease-in;
}

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

.game-over-content {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    padding: 30px 40px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    border: 3px solid #ffd700;
    animation: scaleIn 0.3s ease-out;
    max-width: 90%;
}

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

.game-over-content h1 {
    color: #ff4444;
    font-size: 36px;
    margin-bottom: 15px;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.5);
    letter-spacing: 2px;
}

.game-over-content p {
    color: #ffffff;
    font-size: 20px;
    margin: 8px 0;
}

.game-over-content p:nth-child(2) {
    color: #ffd700;
    font-size: 28px;
    font-weight: bold;
}

.game-over-content p:nth-child(3) {
    color: #aaa;
    font-size: 16px;
}

.game-over-content .restart-text {
    color: #4CAF50;
    font-size: 14px;
    margin-top: 20px;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Mobile game over adjustments */
@media (max-width: 767px) {
    .game-over-content h1 {
        font-size: 28px;
    }
    .game-over-content p {
        font-size: 16px;
    }
    .game-over-content p:nth-child(2) {
        font-size: 22px;
    }
    .game-over-content .restart-text {
        font-size: 13px;
    }
}
