* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    overflow: hidden;
    background: #8B6914;
    font-family: 'Patrick Hand', cursive;
    cursor: crosshair;
    user-select: none;
}

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

#scene-container canvas {
    display: block;
}

/* ===== START SCREEN ===== */
#start-screen {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    background: linear-gradient(135deg, #C4A265 0%, #8B6914 50%, #6B4F10 100%);
}

.cardboard-sign {
    background: linear-gradient(145deg, #D2B48C 0%, #C4A265 40%, #B8956A 100%);
    border: 4px solid #5C3D0E;
    border-radius: 6px;
    padding: 40px 50px;
    max-width: 520px;
    width: 90%;
    text-align: center;
    position: relative;
    box-shadow:
        inset 0 0 60px rgba(139,105,20,0.2),
        8px 8px 0 rgba(0,0,0,0.15),
        0 0 0 2px #7A5A1A;
    /* Corrugated texture via repeating gradient */
    background-image:
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 4px,
            rgba(139,105,20,0.08) 4px,
            rgba(139,105,20,0.08) 5px
        );
}

.tape-strip {
    position: absolute;
    width: 80px;
    height: 24px;
    background: rgba(255, 245, 200, 0.5);
    border: 1px solid rgba(180, 160, 100, 0.3);
    z-index: 2;
}

.tape-top-left {
    top: -10px;
    left: 20px;
    transform: rotate(-15deg);
}

.tape-top-right {
    top: -10px;
    right: 20px;
    transform: rotate(12deg);
}

.doodle {
    position: absolute;
    font-size: 28px;
    opacity: 0.3;
}

.star1 { top: 15px; left: 15px; color: #E63946; transform: rotate(-20deg); }
.star2 { top: 20px; right: 20px; color: #457B9D; transform: rotate(15deg); }
.star3 { bottom: 80px; left: 30px; color: #2A9D8F; transform: rotate(30deg); font-size: 20px; }

.title-text {
    font-family: 'Permanent Marker', cursive;
    font-size: clamp(36px, 8vw, 64px);
    color: #2C1810;
    text-shadow: 3px 3px 0 rgba(0,0,0,0.1);
    letter-spacing: 3px;
    line-height: 1.1;
    margin-bottom: 4px;
}

.subtitle-text {
    font-family: 'Patrick Hand', cursive;
    font-size: clamp(18px, 4vw, 28px);
    color: #5C3D0E;
    margin-bottom: 20px;
}

.instructions {
    font-size: 16px;
    color: #4A3520;
    line-height: 1.5;
    margin-bottom: 16px;
    padding: 10px;
    border: 2px dashed rgba(92,61,14,0.3);
    border-radius: 4px;
}

.best-time-display {
    font-size: 14px;
    color: #7A5A1A;
    margin-bottom: 16px;
    min-height: 20px;
}

.cardboard-btn {
    font-family: 'Permanent Marker', cursive;
    font-size: clamp(20px, 4vw, 28px);
    color: #2C1810;
    background: linear-gradient(180deg, #DEC89A 0%, #C4A265 100%);
    border: 3px solid #5C3D0E;
    border-radius: 4px;
    padding: 14px 40px;
    cursor: pointer;
    position: relative;
    transition: all 0.15s;
    box-shadow: 4px 4px 0 rgba(0,0,0,0.2);
}

.cardboard-btn:hover {
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0 rgba(0,0,0,0.2);
}

.cardboard-btn:active {
    transform: translate(2px, 2px);
    box-shadow: 1px 1px 0 rgba(0,0,0,0.2);
}

.btn-tape {
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 14px;
    background: rgba(255,245,200,0.5);
    border: 1px solid rgba(180,160,100,0.3);
}

.controls-info {
    display: flex;
    gap: 16px;
    justify-content: center;
    margin-top: 20px;
    font-size: 13px;
    color: #7A5A1A;
    flex-wrap: wrap;
}

/* ===== HUD ===== */
#hud {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 50;
}

.hud-element {
    pointer-events: none;
    font-family: 'Permanent Marker', cursive;
    position: fixed;
    padding: 8px 16px;
    background: linear-gradient(180deg, #D2B48C, #C4A265);
    border: 2px solid #5C3D0E;
    border-radius: 3px;
    color: #2C1810;
    font-size: 20px;
    box-shadow: 3px 3px 0 rgba(0,0,0,0.15);
}

#hud-found {
    top: 16px;
    left: 16px;
}

#hud-timer {
    top: 16px;
    right: 16px;
}

#crosshair {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 28px;
    color: #2C1810;
    opacity: 0.7;
    text-shadow: 0 0 4px rgba(255,255,255,0.5);
    font-family: 'Patrick Hand', cursive;
}

.hint-tag {
    pointer-events: all;
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Patrick Hand', cursive;
    font-size: 18px;
    color: #2C1810;
    background: linear-gradient(180deg, #DEC89A, #C4A265);
    border: 2px solid #5C3D0E;
    border-radius: 4px;
    padding: 8px 24px;
    cursor: pointer;
    box-shadow: 2px 2px 0 rgba(0,0,0,0.15);
    transition: all 0.15s;
}

.hint-tag:hover {
    transform: translateX(-50%) translateY(-2px);
    box-shadow: 4px 4px 0 rgba(0,0,0,0.2);
}

#hint-display {
    position: fixed;
    bottom: 70px;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Permanent Marker', cursive;
    font-size: 24px;
    color: #E63946;
    text-shadow: 1px 1px 0 rgba(0,0,0,0.2);
    opacity: 0;
    transition: opacity 0.5s;
    pointer-events: none;
}

#hint-display.show {
    opacity: 1;
}

#found-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.popup-text {
    font-family: 'Permanent Marker', cursive;
    font-size: 72px;
    color: #E63946;
    text-shadow: 4px 4px 0 #2C1810;
    animation: popBounce 0.8s ease-out forwards;
}

@keyframes popBounce {
    0% { transform: scale(0) rotate(-15deg); opacity: 0; }
    50% { transform: scale(1.3) rotate(5deg); opacity: 1; }
    100% { transform: scale(1) rotate(0deg); opacity: 0; }
}

/* ===== MOBILE CONTROLS ===== */
#mobile-controls {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    pointer-events: none;
    z-index: 60;
}

#joystick-zone {
    position: fixed;
    bottom: 30px;
    left: 30px;
    pointer-events: all;
    touch-action: none;
}

#joystick-base {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: rgba(210, 180, 140, 0.4);
    border: 3px solid rgba(92, 61, 14, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

#joystick-stick {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(196, 162, 101, 0.7);
    border: 2px solid #5C3D0E;
    position: absolute;
    transition: none;
}

#mobile-look-hint {
    display: none;
}

/* ===== VICTORY SCREEN ===== */
#victory-screen {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    background: rgba(44, 24, 16, 0.6);
    backdrop-filter: blur(4px);
}

.victory-card {
    background: linear-gradient(145deg, #D2B48C, #C4A265);
    border: 4px solid #5C3D0E;
    border-radius: 6px;
    padding: 36px 44px;
    max-width: 480px;
    width: 90%;
    text-align: center;
    position: relative;
    box-shadow: 8px 8px 0 rgba(0,0,0,0.15);
    background-image:
        repeating-linear-gradient(0deg, transparent, transparent 4px, rgba(139,105,20,0.08) 4px, rgba(139,105,20,0.08) 5px);
}

.victory-title {
    font-family: 'Permanent Marker', cursive;
    font-size: clamp(24px, 5vw, 36px);
    color: #2C1810;
    margin-bottom: 20px;
    text-shadow: 2px 2px 0 rgba(0,0,0,0.1);
}

#victory-characters {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-bottom: 20px;
}

.victory-char {
    width: 40px;
    height: 50px;
    border-radius: 4px;
    border: 2px solid #2C1810;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: 2px 2px 0 rgba(0,0,0,0.15);
}

.victory-time {
    font-family: 'Permanent Marker', cursive;
    font-size: 28px;
    color: #2C1810;
    margin-bottom: 8px;
}

.victory-best {
    font-family: 'Patrick Hand', cursive;
    font-size: 16px;
    color: #5C3D0E;
    margin-bottom: 20px;
}

#confetti-container {
    position: fixed;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

.confetti-piece {
    position: absolute;
    width: 12px;
    height: 16px;
    top: -20px;
    animation: confettiFall linear forwards;
}

@keyframes confettiFall {
    0% { transform: translateY(0) rotate(0deg); opacity: 1; }
    100% { transform: translateY(110vh) rotate(720deg); opacity: 0; }
}

/* ===== FOOTER ===== */
#footer {
    position: fixed;
    bottom: 6px;
    right: 10px;
    z-index: 90;
}

#footer a {
    font-family: 'Patrick Hand', cursive;
    font-size: 12px;
    color: rgba(210,180,140,0.5);
    text-decoration: none;
    transition: color 0.2s;
}

#footer a:hover {
    color: rgba(210,180,140,0.9);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
    .cardboard-sign {
        padding: 24px 20px;
    }
    .controls-info {
        font-size: 11px;
        gap: 8px;
    }
    .hud-element {
        font-size: 16px;
        padding: 6px 10px;
    }
    .hint-tag {
        font-size: 15px;
        bottom: 140px;
    }
    #hint-display {
        bottom: 185px;
    }
}