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

/* Allow text selection only in panels */
#infoPanel, #welcomeOverlay, .panel-content {
    -webkit-user-select: text;
    user-select: text;
}

html, body {
    overflow: hidden;
    background: #87CEEB;
    font-family: Arial, sans-serif;
    width: 100%;
    height: 100%;
    overscroll-behavior: none;
    touch-action: none;
}

.webgl {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    outline: none;
    display: block;
    touch-action: none;
}

/* ===================== */
/* CSS CUSTOM PROPERTIES */
/* ===================== */

:root {
    --ui-gap: clamp(8px, 2vw, 20px);

    --profile-img-w: clamp(28px, 5vw, 40px);
    --profile-img-h: clamp(42px, 7.5vw, 60px);
    --profile-name-size: clamp(10px, 2vw, 15px);
    --profile-sub-size: clamp(8px, 1.4vw, 11px);

    --btn-font: clamp(11px, 2vw, 15px);
    --btn-pad-v: clamp(8px, 1.5vw, 12px);
    --btn-pad-h: clamp(10px, 2vw, 20px);

    --spd-font: clamp(12px, 3vw, 18px);
    --spd-val-font: clamp(22px, 6vw, 38px);

    --touch-min: 44px;

    /* Height of the top-right controls block — used to push speedometer below */
    --controls-h: calc(
        var(--touch-min) * 2
        + clamp(70px, 16vw, 90px)
        + var(--ui-gap) * 3
    );
}

/* ===================== */
/* WELCOME OVERLAY       */
/* ===================== */

#welcomeOverlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9000;
    transition: opacity 0.4s ease;
    padding: 16px;
    overflow-y: auto;
    touch-action: auto;
}

#welcomeOverlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.welcome-box {
    background: rgba(20, 20, 40, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 20px;
    padding: clamp(16px, 4vw, 40px) clamp(14px, 4vw, 48px);
    width: 90%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    color: #ffffff;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    text-align: center;
    touch-action: auto;
    -webkit-user-select: text;
    user-select: text;
}

.welcome-box h2 {
    font-size: clamp(14px, 3.5vw, 20px);
    font-weight: 600;
    color: #fff;
    line-height: 1.4;
    margin-bottom: clamp(12px, 3vw, 20px);
}

.welcome-box input[type="text"] {
    width: 100%;
    padding: clamp(12px, 3vw, 16px) clamp(12px, 3vw, 20px);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    font-size: clamp(15px, 4vw, 17px);
    font-family: inherit;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.2s;
    touch-action: auto;
    -webkit-user-select: text;
    user-select: text;
    min-height: var(--touch-min);
}

.welcome-box input[type="text"]::placeholder { color: rgba(255, 255, 255, 0.45); }
.welcome-box input[type="text"]:focus { border-color: rgba(76, 175, 80, 0.7); }

.section-label {
    font-size: clamp(12px, 3vw, 16px);
    color: rgba(255, 255, 255, 0.65);
    margin: clamp(12px, 3vw, 20px) 0 clamp(8px, 2vw, 12px);
}

.emoji-picker {
    display: flex;
    justify-content: center;
    gap: clamp(6px, 2vw, 10px);
    flex-wrap: wrap;
    margin-bottom: clamp(12px, 3vw, 20px);
}

.emoji-btn {
    font-size: clamp(22px, 6vw, 28px);
    width: clamp(44px, 11vw, 56px);
    height: clamp(44px, 11vw, 56px);
    border-radius: 12px;
    border: 2px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.07);
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, transform 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    touch-action: manipulation;
}

.emoji-btn:active { background: rgba(255, 255, 255, 0.2); transform: scale(0.95); }
.emoji-btn.selected { border-color: #4CAF50; background: rgba(76, 175, 80, 0.2); }

.char-picker {
    display: flex;
    justify-content: center;
    gap: clamp(10px, 3vw, 16px);
    margin-bottom: clamp(12px, 3vw, 20px);
}

.char-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: clamp(10px, 2.5vw, 14px) clamp(16px, 4vw, 24px);
    border-radius: 12px;
    border: 2px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.07);
    color: #fff;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    min-width: clamp(70px, 18vw, 100px);
    min-height: var(--touch-min);
    touch-action: manipulation;
}

.char-btn.selected { border-color: #4CAF50; background: rgba(76, 175, 80, 0.2); }
.char-icon { font-size: clamp(24px, 6vw, 32px); }
.char-label { font-size: clamp(12px, 3vw, 15px); font-weight: 600; }

#startExploreBtn {
    width: 100%;
    padding: clamp(12px, 3vw, 16px);
    background: #4CAF50;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: clamp(15px, 4vw, 18px);
    font-weight: bold;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
    letter-spacing: 0.5px;
    min-height: var(--touch-min);
    touch-action: manipulation;
}

#startExploreBtn:active { background: #388e3c; transform: scale(0.98); }

/* ===================== */
/* AUTHOR PROFILE        */
/* ===================== */

#authorProfile {
    position: fixed;
    top: var(--ui-gap);
    left: var(--ui-gap);
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: clamp(8px, 2vw, 14px);
    background: rgba(15, 15, 30, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: clamp(8px, 2vw, 14px) clamp(10px, 2.5vw, 16px);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    pointer-events: none;
    max-width: min(calc(100vw - clamp(140px, 32vw, 200px) - var(--ui-gap) * 3), 400px);
}

#authorProfile > div {
    min-width: 0;
    display: flex;
    flex-direction: column;
    flex: 1;
}

#authorProfile img {
    width: var(--profile-img-w);
    height: var(--profile-img-h);
    border-radius: 8px;
    object-fit: cover;
    border: 2px solid rgba(76, 175, 80, 0.7);
    display: block;
    flex-shrink: 0;
}

#authorProfile span {
    font-size: var(--profile-name-size);
    font-weight: 600;
    color: #ffffff;
    word-break: break-word;
    overflow-wrap: break-word;
    line-height: 1.2;
}

#authorProfile small {
    display: block;
    font-size: var(--profile-sub-size);
    color: rgba(255, 255, 255, 0.5);
    letter-spacing: 0.5px;
    margin-top: 2px;
    transition: text-shadow 1.5s ease, color 1.5s ease;
}

/* ===================== */
/* TOP-RIGHT CONTROLS    */
/* ===================== */

#topRightControls {
    position: fixed;
    top: var(--ui-gap);
    right: var(--ui-gap);
    z-index: 600;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    width: clamp(140px, 30vw, 180px);
}

#modeToggle,
#torchToggle {
    padding: var(--btn-pad-v) var(--btn-pad-h);
    background: rgba(20, 20, 40, 0.82);
    color: #fff;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    font-size: var(--btn-font);
    font-family: inherit;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, transform 0.15s;
    white-space: nowrap;
    min-height: var(--touch-min);
    touch-action: manipulation;
    backdrop-filter: blur(6px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    text-align: center;
}

#modeToggle:hover,
#torchToggle:hover {
    background: rgba(40, 40, 80, 0.9);
    border-color: rgba(255, 255, 255, 0.6);
}

#modeToggle:active,
#torchToggle:active { transform: scale(0.97); }

#torchToggle.active {
    border-color: rgba(255, 200, 100, 0.7);
    background: rgba(255, 180, 50, 0.15);
}

#torchAngleControl {
    background: rgba(20, 20, 40, 0.82);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    padding: clamp(8px, 2vw, 12px) clamp(10px, 2vw, 14px);
    display: flex;
    flex-direction: column;
    gap: 8px;
    backdrop-filter: blur(6px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

#torchAngleControl label {
    color: #fff;
    font-size: var(--btn-font);
    font-family: inherit;
    font-weight: bold;
}

#torchAngleControl input[type="range"] {
    width: 100%;
    accent-color: #ffffff;
    cursor: pointer;
    height: 20px;
    touch-action: none;
}

#muteToggle {
    padding: var(--btn-pad-v) var(--btn-pad-h);
    background: rgba(20, 20, 40, 0.82);
    color: #fff;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    font-size: var(--btn-font);
    font-family: inherit;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, transform 0.15s;
    white-space: nowrap;
    min-height: var(--touch-min);
    touch-action: manipulation;
    backdrop-filter: blur(6px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    text-align: center;
}

#muteToggle:hover {
    background: rgba(40, 40, 80, 0.9);
    border-color: rgba(255, 255, 255, 0.6);
}

#muteToggle:active { transform: scale(0.97); }

#muteToggle.muted {
    border-color: rgba(255, 100, 100, 0.6);
    background: rgba(255, 50, 50, 0.12);
}


/* ===================== */
/* SPEEDOMETER           */
/* ===================== */

#speedometerTopRight {
    position: fixed;
    top: calc(var(--ui-gap) + var(--controls-h));
    right: var(--ui-gap);
    background: rgba(0, 0, 0, 0.6);
    color: white;
    padding: clamp(6px, 1.5vw, 12px) clamp(10px, 2.5vw, 16px);
    border-radius: 12px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    font-size: var(--spd-font);
    pointer-events: none;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: baseline;
    gap: 6px;
    z-index: 500;
}

#speedValue {
    font-size: var(--spd-val-font);
    font-weight: bold;
    color: #4CAF50;
    text-shadow: 0 0 8px rgba(76, 175, 80, 0.8);
    font-family: 'Courier New', Courier, monospace;
}

.unit { color: #ccc; font-weight: 500; }

/* ===================== */
/* MOVEMENT BUTTONS      */
/* ===================== */

.move-btn {
    width: clamp(60px, 14vw, 80px);
    height: clamp(60px, 14vw, 80px);
    border-radius: 10px;
    background: rgba(40, 40, 40, 0.65);
    border: 2px solid rgba(255, 255, 255, 0.4);
    color: white;
    font-size: clamp(24px, 6vw, 32px);
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    user-select: none;
    -webkit-user-select: none;
    outline: none;
    touch-action: none;
    transition: background 0.15s, transform 0.1s;
}

.move-btn:active {
    background: rgba(100, 100, 100, 0.85);
    transform: scale(0.94);
}

/* Left-Right Buttons — bottom-left */
#leftRightControls {
    position: fixed;
    bottom: calc(var(--ui-gap) + 30px);
    left: var(--ui-gap);
    z-index: 500;
    display: flex;
    gap: clamp(8px, 2vw, 12px);
    pointer-events: auto;
}

/* Forward-Backward Buttons — bottom-right */
#forwardBackwardControls {
    position: fixed;
    bottom: calc(var(--ui-gap) + 30px);
    right: var(--ui-gap);
    z-index: 500;
    display: flex;
    flex-direction: column;
    gap: clamp(8px, 2vw, 12px);
    pointer-events: auto;
}

/* Brake Button — bottom-middle */
#brakeButtonContainer {
    position: fixed;
    bottom: calc(var(--ui-gap) + 30px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 500;
    pointer-events: auto;
}

.brake-btn {
    width: clamp(70px, 16vw, 90px);
    height: clamp(70px, 16vw, 90px);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.72);
    border: 3px solid rgba(255, 255, 255, 0.45);
    color: #222;
    font-size: clamp(24px, 6vw, 36px);
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    user-select: none;
    -webkit-user-select: none;
    outline: none;
    touch-action: none;
    transition: background 0.15s, transform 0.1s;
}

.brake-btn:active {
    background: rgba(200, 200, 200, 0.9);
    transform: scale(0.95);
}

/* ===================== */
/* INTERACTION PROMPT    */
/* ===================== */

#interactionPrompt {
    position: fixed;
    bottom: 22%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.72);
    color: white;
    padding: clamp(8px, 2vw, 12px) clamp(14px, 3.5vw, 22px);
    border-radius: 20px;
    font-size: clamp(12px, 3vw, 17px);
    font-weight: bold;
    border: 1px solid rgba(255, 255, 255, 0.4);
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    z-index: 1000;
    text-align: center;
    white-space: nowrap;
    max-width: 80vw;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ===================== */
/* INFO PANEL            */
/* ===================== */

#infoPanel {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 1;
    transition: opacity 0.3s;
    padding: clamp(10px, 2.5vw, 20px);
    touch-action: auto;
    -webkit-overflow-scrolling: touch;
}

#infoPanel.hidden {
    opacity: 0;
    pointer-events: none;
}

.panel-content {
    background: rgba(30, 30, 45, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 20px;
    padding: clamp(40px, 7vw, 56px) clamp(14px, 4vw, 56px) clamp(20px, 4vw, 40px);
    width: 100%;
    max-width: 850px;
    max-height: 85vh;
    overflow-y: auto;
    color: white;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    font-family: Arial, sans-serif;
    position: relative;
    touch-action: auto;
    -webkit-overflow-scrolling: touch;
}

.panel-content h2 {
    margin-bottom: clamp(12px, 3vw, 24px);
    font-size: clamp(18px, 4.5vw, 30px);
    text-align: center;
    font-weight: bold;
}

.panel-content p {
    line-height: 1.6;
    font-size: clamp(13px, 3vw, 18px);
}

#panelBody { font-size: clamp(13px, 3vw, 18px); }
#panelBody ul { font-size: clamp(13px, 3vw, 18px) !important; }
#panelBody li { font-size: inherit !important; }

#closePanel {
    position: absolute;
    top: clamp(10px, 2vw, 18px);
    right: clamp(10px, 2vw, 18px);
    width: clamp(44px, 10vw, 52px);
    height: clamp(44px, 10vw, 52px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.08);
    border-radius: 50%;
    color: #e0e0e0;
    cursor: pointer;
    font-size: clamp(18px, 4vw, 24px);
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
    transition: background 0.2s;
}

#closePanel:active { background: rgba(255, 255, 255, 0.2); }

/* ===================== */
/* MOBILE SAFE AREAS     */
/* ===================== */

@supports (padding: env(safe-area-inset-bottom)) {
    #brakeButtonContainer {
        bottom: calc(var(--ui-gap) + 30px + env(safe-area-inset-bottom));
    }
    #leftRightControls {
        bottom: calc(var(--ui-gap) + 30px + env(safe-area-inset-bottom));
        left: calc(var(--ui-gap) + env(safe-area-inset-left));
    }
    #forwardBackwardControls {
        bottom: calc(var(--ui-gap) + 30px + env(safe-area-inset-bottom));
        right: calc(var(--ui-gap) + env(safe-area-inset-right));
    }
    #authorProfile {
        top: calc(var(--ui-gap) + env(safe-area-inset-top));
        left: calc(var(--ui-gap) + env(safe-area-inset-left));
    }
    #topRightControls {
        top: calc(var(--ui-gap) + env(safe-area-inset-top));
        right: calc(var(--ui-gap) + env(safe-area-inset-right));
    }
    #speedometerTopRight {
        top: calc(var(--ui-gap) + env(safe-area-inset-top) + var(--controls-h));
        right: calc(var(--ui-gap) + env(safe-area-inset-right));
    }
}

/* ===================== */
/* LANDSCAPE TWEAKS      */
/* ===================== */

@media (orientation: landscape) and (max-height: 500px) {
    .move-btn {
        width: clamp(42px, 9vw, 58px);
        height: clamp(42px, 9vw, 58px);
        font-size: clamp(18px, 4vw, 24px);
    }
    .brake-btn {
        width: clamp(52px, 11vw, 68px);
        height: clamp(52px, 11vw, 68px);
        font-size: clamp(18px, 4vw, 28px);
    }
    #authorProfile { padding: 4px 8px; }
    #interactionPrompt { bottom: 30%; }
    #topRightControls { gap: 4px; }
    #modeToggle, #torchToggle { min-height: 36px; padding: 6px 10px; }
}

/*# sourceMappingURL=main.css.map*/