* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    /* Disable text selection and dragging globally */
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    -webkit-user-drag: none;
    -webkit-touch-callout: none;
}

@font-face {
    font-family: 'Vietnamese_Pixel';
    src: url('/Vietnamese_Pixel.ttf') format('truetype');
}

body {
    /* Background is now drawn on the canvas */
    background: #000;
    overflow: hidden;
    font-family: 'Vietnamese_Pixel', Arial, sans-serif;
    /* Additional selection and drag prevention */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

body.inventory-open #gameCanvas {
    cursor: default;
    filter: blur(2px); /* Add blur effect when inventory is open */
}

body.game-paused #gameCanvas {
    cursor: default;
    filter: blur(2px);
}

#gameCanvas {
    display: block;
    background: transparent;
    cursor: crosshair;
    transition: filter 0.25s ease-out; /* Smooth transition for blur */
    /* Prevent canvas dragging */
    -webkit-user-drag: none;
    pointer-events: auto;
    outline: none; /* Remove focus outline */
}

#inventory-ui-container {
    position: fixed;
    bottom: 3vh; /* Changed from 1.5vh */
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    display: flex;
    flex-direction: column-reverse; /* Inventory on top of hotbar */
    align-items: center;
    transition: opacity 0.5s ease-in-out; /* Add transition for fade-in */
    pointer-events: none; /* Pass clicks through the container by default */
}

body.inventory-open #inventory-ui-container {
    pointer-events: auto; /* Allow clicks when inventory is open */
}

#inventory-hotbar,
#inventory-main {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5vmin; /* Changed from 0.75vmin */
    border: 0px solid #555;
    padding: 1.5vmin; /* Changed from 0.75vmin */
}

#inventory-hotbar {
    background-image: url('/hotbar.png');
    background-size: 100% 100%; /* Scale to fit exact dimensions */
    background-repeat: no-repeat;
    background-position: center;
    border: none;
    padding: 1.5vmin; /* Changed from 0.75vmin */
    border-radius: 0;
    z-index: 2; /* Ensure hotbar is on top of the main inventory */
    position: relative; /* Needed for z-index to work */
    pointer-events: auto; /* Hotbar is always clickable */
}

#inventory-hotbar .inventory-slot {
    width: 8vmin; /* Changed from 4vmin */
    height: 8vmin; /* Changed from 4vmin */
    background-image: url('/slot.png');
    background-size: 100% 100%;
    background-repeat: no-repeat;
    background-position: center;
    border: none; /* Remove border since slot.png provides the visual */
}

#inventory-hotbar .block-preview {
    width: 4vmin; /* Changed from 2vmin */
    height: 4vmin; /* Changed from 2vmin */
    margin-bottom: 0.3vmin; /* Changed from 0.15vmin */
    /* Ensure pixelated rendering for textures */
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: -webkit-crisp-edges;
}

#inventory-hotbar .block-count {
    font-size: 1.8vmin; /* Changed from 0.9vmin */
    color: white;
    position: absolute;
    bottom: 0.3vmin; /* Changed from 0.15vmin */
    right: 0.6vmin; /* Changed from 0.3vmin */
    text-shadow: 
        -1px -1px 0 #000,  
         1px -1px 0 #000,
        -1px  1px 0 #000,
         1px  1px 0 #000;
}

#inventory-main {
    width: calc(6 * (9vmin + 1.5vmin) + 3vmin); /* Adjusted calculation - doubled all values */
    margin-bottom: 1.5vmin; /* Changed from 0.75vmin */
    background-image: url('/inv.png');
    background-size: 100% 100%; /* Scale to fit exact dimensions */
    background-repeat: no-repeat;
    background-position: center;
    border: none;
    border-radius: 0;
    visibility: hidden; /* Use visibility to prevent interaction when hidden */
    opacity: 0;
    overflow: hidden;
    transition: opacity 0.3s ease-out, transform 0.3s ease-out, visibility 0.3s;
    transform: translateY(3vmin); /* Changed from 1.5vmin */
    padding-left: 1.8vmin; /* Changed from 0.9vmin */
}

#inventory-main.visible,
#crafting-ui.visible {
    visibility: visible;
    opacity: 1;
    transform: translateY(0); /* Slide up to natural position */
}

#crafting-ui {
    width: calc(6 * (9vmin + 1.5vmin) + 3vmin); /* Adjusted calculation - doubled all values */
    margin-bottom: 1.5vmin; /* Changed from 0.75vmin */
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s ease-out, transform 0.3s ease-out, visibility 0.3s;
    transform: translateY(3vmin); /* Changed from 1.5vmin */
    display: flex;
    flex-direction: column;
}

.crafting-tabs {
    display: flex;
}

.crafting-tab {
    padding: 1.2vmin 2.4vmin; /* Changed from 0.6vmin 1.2vmin */
    background: #1c1c1c;
    border: 0.3vmin solid #555; /* Changed from 0.15vmin */
    border-bottom: none;
    border-top-left-radius: 1.2vmin; /* Changed from 0.6vmin */
    border-top-right-radius: 1.2vmin; /* Changed from 0.6vmin */
    color: #aaa;
    cursor: pointer;
    font-size: 2.1vmin; /* Changed from 1.05vmin */
    margin-right: 0.75vmin; /* Changed from 0.375vmin */
    transform: translateY(0.3vmin); /* Changed from 0.15vmin */
    transition: background-color 0.2s, color 0.2s;
}

.crafting-tab.active {
    background: #2a2a2a;
    color: #fff;
    border-color: #555;
}

.crafting-tab:not(.active):hover {
    background: #333;
}

.crafting-body {
    background: #2a2a2a;
    border: 0.3vmin solid #555; /* Changed from 0.15vmin */
    padding: 1.5vmin; /* Changed from 0.75vmin */
    border-radius: 0;
    border-top-left-radius: 0;
    min-height: 24vmin; /* Changed from 12vmin */
    display: flex;
}

.crafting-content {
    display: none;
    width: 100%;
}

.crafting-content.active {
    display: flex; /* All active panels are flex containers */
    flex-direction: column;
}

#crafting-panel.active {
    justify-content: space-between; /* Pushes children to top and bottom */
    align-items: center;
    padding-top: 2.25vmin; /* Changed from 1.125vmin */
}

#recipes-panel.active {
    height: 21vmin; /* Changed from 10.5vmin */
}

#recipe-list {
    flex-grow: 1; /* Make the list fill the panel's height */
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 1.5vmin; /* Changed from 0.75vmin */
}

#recipe-list.empty {
    display: flex;
    justify-content: center;
    align-items: center;
    padding-right: 0; /* No scrollbar when empty */
}

.no-recipes-message {
    color: #999;
    font-size: 2.1vmin; /* Changed from 1.05vmin */
    text-align: center;
    font-style: italic;
    padding: 0 3vmin; /* Changed from 0 1.5vmin */
    line-height: 1.4;
}

#recipe-list::-webkit-scrollbar {
    width: 1.2vmin; /* Changed from 0.6vmin */
}
#recipe-list::-webkit-scrollbar-track {
    background: #1c1c1c;
}
#recipe-list::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 4px;
}
#recipe-list::-webkit-scrollbar-thumb:hover {
    background: #777;
}

.recipe-entry {
    display: flex;
    flex-direction: column; /* This is correct, stacks visual row and flavor text */
    padding: 1.5vmin 0.75vmin; /* Changed from 0.75vmin 0.375vmin */
    border-bottom: 0.15vmin solid #444; /* Changed from 0.075vmin */
    gap: 1.2vmin; /* Changed from 0.6vmin */
}

.recipe-visual-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 1.5vmin;
}

.recipe-entry:last-child {
    border-bottom: none;
}

.recipe-pattern-display {
    display: grid;
    grid-template-columns: repeat(2, 6vmin); /* Changed from 3vmin */
    grid-template-rows: repeat(2, 6vmin); /* Changed from 3vmin */
    gap: 0.6vmin; /* Changed from 0.3vmin */
    flex-shrink: 0;
}

.recipe-slot-display {
    width: 6vmin; /* Changed from 3vmin */
    height: 6vmin; /* Changed from 3vmin */
    background: #1c1c1c;
    border: 0.15vmin solid #333; /* Changed from 0.075vmin */
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.recipe-slot-display .block-preview {
    width: 3.6vmin; /* Changed from 1.8vmin */
    height: 3.6vmin; /* Changed from 1.8vmin */
    transform: scale(1);
    margin: 0;
}

.recipe-slot-display .block-count {
    font-size: 1.65vmin; /* Changed from 0.825vmin */
    bottom: 0.15vmin; /* Changed from 0.075vmin */
    right: 0.3vmin; /* Changed from 0.15vmin */
}

.recipe-arrow-display {
    width: 3.6vmin; /* Changed from 1.8vmin */
    height: 3.6vmin; /* Changed from 1.8vmin */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23cccccc'%3E%3Cpath d='M16.172 11l-5.364-5.364 1.414-1.414L20 12l-7.778 7.778-1.414-1.414L16.172 13H4v-2z'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    margin: 0 1.5vmin; /* Changed from 0 0.75vmin */
    flex-shrink: 0;
}

.recipe-output-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 15vmin; /* Changed from 7.5vmin */
    flex-shrink: 0;
}

.recipe-output-name {
    color: #ccc;
    font-size: 1.8vmin; /* Changed from 0.9vmin */
    margin-top: 0.6vmin; /* Changed from 0.3vmin */
    white-space: normal;
    line-height: 1.2;
}

.recipe-flavor-text {
    font-size: 1.8vmin; /* Changed from 0.9vmin */
    color: #999;
    font-style: italic;
    text-align: center;
    padding: 0 1.5vmin; /* Changed from 0 0.75vmin */
    white-space: normal;
    line-height: 1.3;
}

#recipe-display {
    color: #ccc;
    font-size: 2.4vmin; /* Changed from 1.2vmin */
    text-align: center;
    margin-top: 1.5vmin; /* Changed from 0.75vmin */
    height: 3vmin; /* Changed from 1.5vmin */
}

.crafting-area-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2.25vmin; /* Changed from 1.125vmin */
}

#crafting-grid {
    display: grid;
    gap: 0.75vmin; /* Changed from 0.375vmin */
}

#crafting-grid.crafting-2x2 {
    grid-template-columns: repeat(2, 9vmin); /* Changed from 4.5vmin */
    grid-template-rows: repeat(2, 9vmin); /* Changed from 4.5vmin */
}

.crafting-arrow {
    width: 4.8vmin; /* Changed from 2.4vmin */
    height: 4.8vmin; /* Changed from 2.4vmin */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23cccccc'%3E%3Cpath d='M16.172 11l-5.364-5.364 1.414-1.414L20 12l-7.778 7.778-1.414-1.414L16.172 13H4v-2z'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

#crafting-output-slot {
    width: 9vmin; /* Changed from 4.5vmin */
    height: 9vmin; /* Changed from 4.5vmin */
}

.crafting-slot {
    width: 9vmin; /* Changed from 4.5vmin */
    height: 9vmin; /* Changed from 4.5vmin */
    background: #1c1c1c;
    border: 0.3vmin solid #333; /* Changed from 0.15vmin */
    border-radius: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    transition: background-color 0.2s, border-color 0.2s;
}

.crafting-slot:hover {
    background: #2a2a2a;
    border-color: #555;
}

.output-slot {
    width: 9vmin; /* Changed from 4.5vmin */
    height: 9vmin; /* Changed from 4.5vmin */
    background: #2a2a2a;
    border: 0.3vmin solid #666; /* Changed from 0.15vmin */
    border-radius: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    transition: background-color 0.2s, border-color 0.2s;
}

.output-slot:hover {
    background: #3a3a3a;
    border-color: #777;
}

.inventory-slot {
    width: 9vmin; /* Changed from 4.5vmin */
    height: 9vmin; /* Changed from 4.5vmin */
    background-image: url('/slot.png');
    background-size: 100% 100%;
    background-repeat: no-repeat;
    background-position: center;
    border: none; /* Remove border since slot.png provides the visual */
    border-radius: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    transition: background-color 0.2s, border-color 0.2s;
}

.inventory-slot.selected {
    /* Old border style is removed. The outline is now a pseudo-element,
       which keeps the slot background and adds an inner border. */
}

.inventory-slot.selected::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0.52vmin solid white; /* Changed from 0.26vmin */
    box-sizing: border-box; /* To ensure border is inside the element */
    pointer-events: none; /* So it doesn't interfere with clicks */
}

.durability-bar {
    position: absolute;
    bottom: 0.75vmin; /* Changed from 0.375vmin */
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    height: 0.6vmin; /* Changed from 0.3vmin */
    background-color: rgba(0, 0, 0, 0.7);
    border: 0.15vmin solid #111; /* Changed from 0.075vmin */
    border-radius: 0.3vmin; /* Changed from 0.15vmin */
    display: none; /* Hidden by default */
}

.durability-bar-inner {
    height: 100%;
    width: 100%;
    background-color: #66cc66; /* Default green */
    border-radius: 0.15vmin; /* Changed from 0.075vmin */
    transition: width 0.2s ease-out, background-color 0.2s ease-out;
}

.inventory-slot.dragging-from .block-preview,
.inventory-slot.dragging-from .block-count {
    opacity: 0.3; /* Make the original item semi-transparent */
}

#drag-item-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* Allows mouse events to pass through to elements below */
    z-index: 9999;
}

.dragged-item {
    position: absolute; /* Positioned relative to the container */
    width: 9vmin; /* Changed from 4.5vmin */
    height: 9vmin; /* Changed from 4.5vmin */
    background: rgba(28, 28, 28, 0.7); /* Slightly transparent background */
    border: 0.3vmin solid #fff; /* Changed from 0.15vmin */
    border-radius: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transform: scale(1.1); /* Make it slightly larger */
    cursor: grabbing;
}

.stone-block {
    background-image: url('/rock.png');
    background-size: cover;
    border: 1px solid #000; /* Add outline to item previews */
}

.stone_wall-block {
    background-image: url('/rock.png');
    background-size: cover;
    border: 1px solid #000;
    position: relative;
}

.stone_wall-block::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    z-index: 1;
}

.bedrock-block {
    background-image: url('/bedrock.png');
    background-size: cover;
    border: 1px solid #000;
}

.grass-block {
    background-image: url('/grass.png');
    background-size: cover;
    border: 1px solid #000;
}

.dirt-block {
    background-image: url('/dirt.png');
    background-size: cover;
    border: 1px solid #000; /* Add outline to item previews */
}

.stone_slab-block {
    background-image: url('/stslab.png');
    background-size: cover;
    border: 1px solid #000;
}

.wood-block {
    background: #D2691E;
    border: 1px solid #000; /* Add outline to item previews */
}

.stone_brick-block {
    background-image: url('/stone_brick.png');
    background-size: cover;
    border: 1px solid #000;
}

.stone_compost_pile-block {
    background-image: url('/stonecompost.png');
    background-size: cover;
}

.full_stone_compost_pile-block {
    background-image: url('/fullstonecompost.png');
    background-size: cover;
}

.small_stone-block {
    background-image: url('/stone.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    /* No border for non-block items */
    transform: scale(1.2); /* Scale up a bit to not look too small */
}

.blade_of_grass-block {
    background-image: url('/clip.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    /* No border for non-block items */
    transform: scale(1.2); /* Scale up a bit to not look too small */
}

.grass_fiber_cord-block {
    background-image: url('/cord.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    /* No border for non-block items */
    transform: scale(1.2);
}

.stone_rod-block {
    background-image: url('/srod.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    /* No border for non-block items */
    transform: scale(1.2);
}

.crude_stone_knife-block {
    background-image: url('/sknife.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    /* No border for non-block items */
    transform: scale(1.2); /* Scale up a bit to not look too small */
}

.primal_stone_pickaxe-block {
    background-image: url('/stpick.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    /* No border for non-block items */
    transform: scale(1.2);
}

.crude_torch-block {
    background-image: url('/torch.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    /* No border for non-block items */
    transform: scale(1.2);
}

.block-preview {
    width: 4.5vmin; /* Changed from 2.25vmin */
    height: 4.5vmin; /* Changed from 2.25vmin */
    margin-bottom: 0.3vmin; /* Changed from 0.15vmin */
}

.block-count {
    font-size: 2.1vmin; /* Changed from 1.05vmin */
    color: white;
    position: absolute;
    bottom: 0.3vmin; /* Changed from 0.15vmin */
    right: 0.6vmin; /* Changed from 0.3vmin */
    text-shadow: 
        -1px -1px 0 #000,  
         1px -1px 0 #000,
        -1px  1px 0 #000,
         1px  1px 0 #000;
}

#selectedBlock {
    position: fixed;
    top: 3vmin; /* Changed from 1.5vmin */
    left: 3vmin; /* Changed from 1.5vmin */
    color: white;
    font-size: 3.6vmin; /* Changed from 1.8vmin */
    z-index: 100;
    text-shadow: 2px 2px 0 #000; /* Replaced outline with a simple drop shadow */
    transition: opacity 0.5s ease-in-out; /* Add transition for fade-in */
}

#tooltip {
    position: fixed;
    background-color: rgba(20, 20, 20, 0.85);
    border: 1px solid #777;
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    font-family: 'Vietnamese_Pixel', Arial, sans-serif;
    font-size: 2.1vmin;
    pointer-events: none;
    z-index: 10001; /* Above inventory UI */
    white-space: nowrap;
    line-height: 1.4;
    text-shadow: 1px 1px 0 #000;
    transform: translateY(calc(-100% - 8px)); /* Position it just above the cursor */
}

#tooltip.hidden {
    display: none;
}

#pause-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10002;
    color: white;
}

#pause-overlay.hidden {
    display: none;
}

#pause-menu {
    position: relative;
    height: auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

#pause-menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 2vmin;
    width: 100%;
    max-width: 40vmin;
}

.pause-menu-button {
    font-family: 'Vietnamese_Pixel', Arial, sans-serif;
    font-size: 3vmin;
    background: #2a2a2a;
    border: 0.3vmin solid #555;
    color: #fff;
    cursor: pointer;
    padding: 2vmin 3vmin;
    border-radius: 0.5vmin;
    transition: all 0.2s;
    text-align: center;
}

.pause-menu-button:hover:not(:disabled) {
    background: #3a3a3a;
    border-color: #777;
    transform: translateY(-0.2vmin);
}

.pause-menu-button:active:not(:disabled) {
    transform: translateY(0);
    background: #444;
}

.pause-menu-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    color: #888;
}

#resume-button {
    background: #4a7c59;
    border-color: #5a8c69;
}

#resume-button:hover:not(:disabled) {
    background: #5a8c69;
    border-color: #6a9c79;
}

#intro-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #000;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    opacity: 1;
    transition: opacity 0.5s ease-in-out;
    pointer-events: none; /* Allows clicks to go through once faded */
}

#intro-overlay.hidden {
    opacity: 0;
}

#intro-text {
    color: white;
    font-size: 4.8vmin; /* Changed from 2.4vmin */
    opacity: 0;
    transition: opacity 2s ease-in-out;
    text-align: center;
    padding: 3vmin; /* Changed from 1.5vmin */
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

#intro-text.visible {
    opacity: 1;
}

#click-to-begin-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 0;
    transition: opacity 1s ease-in-out;
    pointer-events: none;
}

#click-to-begin-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

#click-to-begin-overlay.hidden {
    display: none;
    pointer-events: none;
}

#click-to-begin-overlay p {
    color: white;
    font-size: 4.8vmin; /* Changed from 2.4vmin */
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
    cursor: pointer;
}

/* New: Class to hide UI during the intro */
body.intro-active #inventory-ui-container,
body.intro-active #selectedBlock,
body.intro-active #tooltip {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* --- MOBILE CONTROLS --- */
#mobile-controls-container {
    position: fixed;
    bottom: 2vh;
    left: 0;
    width: 100vw;
    z-index: 101;
    pointer-events: none;
    display: none; /* Hidden by default */
    justify-content: space-between;
    align-items: flex-end;
    padding: 0 3vw;
}

/* Show controls on touch devices in landscape orientation */
@media (pointer: coarse) and (orientation: landscape) {
    #mobile-controls-container {
        display: flex;
    }
}

#d-pad {
    display: grid;
    grid-template-areas:
        ". up ."
        "left center right"
        ". down .";
    grid-gap: 2px;
    pointer-events: auto;
    width: 30vh; /* Use vh for responsive size */
    height: 30vh;
    opacity: 0.7;
}

.d-pad-button {
    background-image: url('/mbu.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    background-color: transparent;
    border: none;
    border-radius: 0;
    position: relative;
    touch-action: manipulation; /* Prevents double tap to zoom */
}

.d-pad-button::before {
    display: none;
}

#d-pad-up {
    grid-area: up;
}

#d-pad-up::before,
#d-pad-down::before,
#d-pad-left::before,
#d-pad-right::before {
    display: none;
}

#d-pad-down {
    grid-area: down;
    transform: rotate(180deg);
}

#d-pad-left {
    grid-area: left;
    transform: rotate(-90deg);
}

#d-pad-right {
    grid-area: right;
    transform: rotate(90deg);
}

#d-pad-center {
    grid-area: center;
    background-color: transparent;
    background-image: none;
    border: none;
}

#action-buttons {
    display: flex;
    gap: 15px;
    pointer-events: auto;
    opacity: 0.7;
}

.action-button {
    width: 18vh; /* Use vh for responsive size */
    height: 18vh;
    background-image: url('/mj.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    background-color: transparent;
    border: none;
    border-radius: 0;
    position: relative;
    touch-action: manipulation; /* Prevents double tap to zoom */
}

/* Style for when a button is being pressed */
.d-pad-button:active, .action-button:active {
    background-color: transparent; /* Keep transparent on press */
    transform: scale(0.95);
    opacity: 1.0;
}