/* 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;
    }
}

/* ==================== */
/* CASTROL CTA SCREEN  */
/* ==================== */

.castrol-cta {
    position: absolute;
    inset: 0;
    background: linear-gradient(175deg, #001a0d 0%, #003318 55%, #001a0d 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: ctaFadeIn 0.4s ease-out;
}

@keyframes ctaFadeIn {
    from { opacity: 0; transform: scale(1.03); }
    to   { opacity: 1; transform: scale(1); }
}

.cta-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 24px 20px;
    width: 100%;
    max-width: 320px;
}

.cta-logo {
    font-family: 'Segoe UI', Arial, sans-serif;
    font-size: 13px;
    font-weight: 900;
    letter-spacing: 0.35em;
    color: #00A651;
    text-transform: uppercase;
    border-bottom: 2px solid #00A651;
    padding-bottom: 6px;
}

.cta-poster {
    width: 86%;
    max-width: 260px;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 166, 81, 0.25);
    display: block;
}

.cta-score-row {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.cta-score-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.22em;
    color: rgba(255,255,255,0.45);
    text-transform: uppercase;
}

.cta-score-value {
    font-size: 38px;
    font-weight: 900;
    color: #fff;
    line-height: 1;
    letter-spacing: -1px;
}

.cta-btn-primary {
    display: block;
    width: 100%;
    padding: 14px 0;
    background: #00A651;
    color: #fff;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.18em;
    text-align: center;
    text-decoration: none;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
}

.cta-btn-primary:hover,
.cta-btn-primary:active {
    background: #008f44;
    transform: translateY(1px);
}

.cta-btn-secondary {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.2);
    color: rgba(255,255,255,0.5);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.1em;
    padding: 9px 24px;
    border-radius: 4px;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
}

.cta-btn-secondary:hover {
    border-color: rgba(255,255,255,0.45);
    color: rgba(255,255,255,0.85);
}
