body {
    margin: 0;
}

canvas {
    position: absolute;
    image-rendering: -moz-crisp-edges; /* Firefox */
    image-rendering: -webkit-crisp-edges; /* Webkit (Safari) */
    image-rendering: pixelated; /* Chrome */
}

#background {
    background-image: url(src/resources/gui/title/splash.png);
    background-repeat: no-repeat;
    background-size: contain;
    background-position: center;
    image-rendering: -moz-crisp-edges; /* Firefox */
    image-rendering: -webkit-crisp-edges; /* Webkit (Safari) */
    image-rendering: pixelated; /* Chrome */
}

.fullscreen {
    position: absolute;
    float: left;
    display: block;
    width: 100%;
    height: 100%;
    white-space: nowrap;
    overflow: hidden;
}

.mobile-controls {
    position: absolute;
    bottom: 8%;
    left: 3%;
    width: 40%;
    max-width: 320px;
    display: none;
    user-select: none;
    touch-action: none;
    pointer-events: auto;
}
.mobile-controls.visible {
    display: block;
}
.mobile-dpad {
    width: 100%;
    aspect-ratio: 1 / 1;
    position: relative;
}
.mobile-dpad .btn {
    position: absolute;
    width: 34%;
    height: 34%;
    background: rgba(0,0,0,0.5);
    border-radius: 12px;
    display:flex;
    align-items:center;
    justify-content:center;
    color: white;
    font-weight: bold;
    -webkit-tap-highlight-color: transparent;
}
.mobile-dpad .btn.up { left: 33%; top: 2%; }
.mobile-dpad .btn.left { left: 2%; top: 33%; }
.mobile-dpad .btn.down { left: 33%; top: 62%; }
.mobile-dpad .btn.right { left: 62%; top: 33%; }
.mobile-action {
    position: absolute;
    right: 3%;
    bottom: 12%;
    display: none;
}
.mobile-action.visible {
    display: block;
}
.mobile-action .btn {
    width: 64px;
    height: 64px;
    margin: 6px;
    background: rgba(0,0,0,0.5);
    border-radius: 50%;
    display:flex;
    align-items:center;
    justify-content:center;
    color: white;
    font-weight: bold;
    -webkit-tap-highlight-color: transparent;
}

/* New styling for gear group placed top-left on the screen */
.mobile-gears {
    position: absolute;
    top: 3%;
    left: 3%;
    display: flex;
    gap: 8px;
    z-index: 30;
    background: rgba(0,0,0,0.55);
    padding: 6px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.35);
}
.mobile-gears .btn {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    font-size: 18px;
    display:flex;
    align-items:center;
    justify-content:center;
    background: rgba(255,255,255,0.04);
    -webkit-tap-highlight-color: transparent;
    touch-action: none;
}
.mobile-gears .btn:active {
    transform: translateY(1px);
    background: rgba(255,255,255,0.08);
}

/* When low textures mode is enabled, force HTML/touch buttons to black for visibility */
.low-textures .mobile-gears .btn,
.low-textures .mobile-action .btn,
.low-textures .mobile-dpad .btn {
    background: #000000 !important;
    color: #ffffff !important;
    box-shadow: none !important;
    border: 1px solid rgba(255,255,255,0.05) !important;
}

/* New top-center esc / F5 button */
.esc-f5 {
    position: absolute;
    top: 3%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 60;
    background: rgba(0,0,0,0.6);
    color: #fff;
    padding: 8px 12px;
    border-radius: 10px;
    font-weight: bold;
    min-width: 88px;
    text-align: center;
    box-shadow: 0 6px 18px rgba(0,0,0,0.35);
    -webkit-tap-highlight-color: transparent;
    touch-action: none;
    pointer-events: auto;
    user-select: none;
}

/* When low textures mode is enabled, ensure the esc-f5 button stays clearly visible */
.low-textures .esc-f5 {
    background: #000 !important;
    color: #fff !important;
    border: 1px solid rgba(255,255,255,0.05) !important;
}

/* Steve preview button styling (placed near gear controls) */
.steve-preview {
    position: absolute;
    top: 3%;
    left: calc(3% + 150px); /* sit next to gear group without overlapping */
    z-index: 70;
    /* make the button visually transparent and borderless */
    background: transparent;
    color: #fff;
    padding: 8px 10px;
    border-radius: 0;
    border: none;
    font-weight: bold;
    min-width: 64px;
    text-align: center;
    box-shadow: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: none;
    user-select: none;
}

/* Centered virtual button with a dot */
.center-dot {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    /* Make the button size follow the image size exactly and keep it square */
    padding: 0;
    border: none;
    background: transparent;
    display: inline-block;
    z-index: 80;
    -webkit-tap-highlight-color: transparent;
    touch-action: none;
}
.center-dot img {
    display: block;
    /* Use the image's intrinsic dimensions (button will size to image) */
    width: auto;
    height: auto;
    max-width: none;
    max-height: none;
    /* Ensure pixel art remains crisp and not blurred when scaled */
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;

    /* Double the visible size while keeping the image centered and crisp */
    transform: scale(2);
    transform-origin: center center;
}
/* Make dot visually smaller on very small screens */
@media (max-width: 360px) {
    /* On very small screens, scale the image down but keep crisp rendering */
    .center-dot img { width: 48px; height: 48px; }
}

/* Modal panel for rendering the GLB */
#steve-modal {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%,-50%);
    width: 86%;
    max-width: 420px;
    height: 56%;
    max-height: 520px;
    /* Make the modal visually borderless and backgroundless as requested */
    background: transparent;
    border-radius: 0;
    z-index: 200;
    display: none;
    box-shadow: none;
    overflow: hidden;
}

/* Modal visible state */
#steve-modal.visible {
    display: block;
}

/* Close button inside modal */
#steve-modal .close-btn {
    position: absolute;
    right: 8px;
    top: 8px;
    /* Make the close control minimal and borderless to match the transparent panel */
    background: transparent;
    color: #fff;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 0;
    display:flex;
    align-items:center;
    justify-content:center;
    z-index: 210;
    -webkit-tap-highlight-color: transparent;
}

/* Canvas that will host the 3D model */
#steve-modal canvas {
    width: 100%;
    height: 100%;
    display: block;
}

#canvas-container {
    touch-action: none;
}