* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    overflow: hidden;
    background: #000;
    font-family: 'Courier New', monospace;
    user-select: none;
}

#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
}

#game-canvas {
    display: block;
    width: 100%;
    height: 100%;
}

#crosshair {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 24px;
    pointer-events: none;
    z-index: 10;
    mix-blend-mode: difference;
    text-shadow:
        0 0 3px #000,
        0 0 6px rgba(0, 0, 0, 0.8);
}

#block-tooltip {
    position: fixed;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(10, 10, 10, 0.82);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    padding: 7px 14px 7px 9px;
    opacity: 0;
    pointer-events: none;
    z-index: 15;
    transition: opacity 0.18s ease;
    font-family: 'Courier New', monospace;
}

#block-tooltip.visible {
    opacity: 1;
}

#tooltip-icon {
    width: 30px;
    height: 30px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    flex-shrink: 0;
    box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.25),
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

#tooltip-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

#tooltip-name {
    color: #fff;
    font-size: 13px;
    font-weight: bold;
    text-shadow: 1px 1px 2px #000;
    white-space: nowrap;
}

#tooltip-sub {
    color: #a0c8f0;
    font-size: 10px;
    text-shadow: 1px 1px 2px #000;
    white-space: nowrap;
}

#debug-info {
    position: fixed;
    top: 8px;
    left: 8px;
    color: #fff;
    font-size: 12px;
    z-index: 10;
    pointer-events: none;
    line-height: 1.6;
    text-shadow:
        1px 1px 2px #000,
        -1px -1px 2px #000,
        1px -1px 2px #000,
        -1px 1px 2px #000,
        0 0 4px rgba(0, 0, 0, 0.8);
}

#minimap-wrap {
    position: fixed;
    top: 8px;
    right: 8px;
    z-index: 10;
    pointer-events: none;
}

#minimap {
    display: block;
    width: 128px;
    height: 128px;
    border: 2px solid rgba(255, 255, 255, 0.7);
    border-radius: 4px;
    background: #87ceeb;
    box-shadow: 0 0 6px rgba(0, 0, 0, 0.5);
}

#minimap-pos {
    margin-top: 4px;
    padding: 3px 6px;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 11px;
    text-align: center;
    border-radius: 3px;
    white-space: nowrap;
    text-shadow:
        1px 1px 2px #000,
        -1px -1px 2px #000,
        1px -1px 2px #000,
        -1px 1px 2px #000;
}

#blocker {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    cursor: pointer;
}

#start-prompt {
    text-align: center;
    color: #fff;
}

#start-prompt h1 {
    font-size: 48px;
    margin-bottom: 16px;
    color: #f0c040;
    text-shadow: 2px 2px 4px #000;
}

#start-prompt p {
    font-size: 18px;
    margin-bottom: 8px;
}

.controls-hint {
    font-size: 13px !important;
    color: #aaa;
    margin-top: 16px !important;
    line-height: 1.8;
}

.hidden {
    display: none !important;
}

/* HOTBAR */
#hotbar-wrap {
    position: fixed;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 6px;
    z-index: 20;
}

#hotbar {
    display: flex;
    gap: 2px;
    background: rgba(0, 0, 0, 0.5);
    padding: 4px;
    border-radius: 4px;
}

#inv-bottom {
    display: flex;
    justify-content: center;
    padding-top: 8px;
}

#crafting-btn {
    padding: 8px 20px;
    background: rgba(60, 60, 60, 0.85);
    border: 2px solid #8B6914;
    border-radius: 4px;
    color: #f0c040;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s;
}

#crafting-btn:hover {
    background: rgba(90, 90, 90, 0.9);
    border-color: #f0c040;
}

.hotbar-slot {
    width: 48px;
    height: 48px;
    border: 2px solid #555;
    background: rgba(30, 30, 30, 0.85);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
    transition: border-color 0.1s;
}

.hotbar-slot.selected {
    border-color: #fff;
    background: rgba(60, 60, 60, 0.9);
}

.hotbar-slot:hover {
    border-color: #aaa;
}

.slot-count {
    font-size: 10px;
    color: #fff;
    position: absolute;
    bottom: 2px;
    right: 4px;
    text-shadow: 1px 1px 1px #000;
}

.slot-name {
    font-size: 8px;
    color: #ccc;
    text-align: center;
    text-shadow: 1px 1px 1px #000;
    max-width: 44px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* INVENTORY SCREEN */
#inventory-screen {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.65);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 50;
}

#inventory-panel {
    display: flex;
    background: rgba(20, 20, 20, 0.95);
    border: 2px solid #555;
    border-radius: 6px;
    padding: 16px;
    gap: 0;
    max-width: 800px;
    width: 90%;
}

#inv-left {
    flex: 30;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-right: 12px;
}

#inv-left h3 {
    color: #aaa;
    font-size: 13px;
    margin-bottom: 8px;
}

#inv-divider {
    width: 2px;
    background: #444;
    margin: 0 8px;
}

#inv-right {
    flex: 70;
    display: flex;
    flex-direction: column;
    padding-left: 12px;
}

#inv-right h3 {
    color: #aaa;
    font-size: 13px;
    margin-bottom: 8px;
}

#player-preview {
    width: 80px;
    height: 100px;
    background: rgba(40, 40, 40, 0.8);
    border: 1px solid #444;
    margin-bottom: 8px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    font-size: 11px;
}

#armor-slots {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 8px;
}

#tool-slots {
    display: flex;
    gap: 4px;
}

.inv-slot {
    width: 44px;
    height: 44px;
    border: 2px solid #555;
    background: rgba(30, 30, 30, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
    transition: border-color 0.1s;
    border-radius: 3px;
}

.inv-slot:hover {
    border-color: #aaa;
}

.inv-slot.has-item {
    border-color: #777;
}

.armor-slot {
    border-color: #4a6a8a;
}

.tool-slot {
    border-color: #8a6a4a;
}

#inventory-grid {
    display: grid;
    grid-template-columns: repeat(10, 44px);
    grid-template-rows: repeat(5, 44px);
    gap: 2px;
}

#inv-hotbar {
    display: flex;
    gap: 2px;
    margin-top: 8px;
    padding: 4px;
    background: rgba(20, 20, 20, 0.95);
    border: 2px solid #555;
    border-radius: 6px;
}

.inv-hotbar-slot.selected {
    border-color: #fff;
}

/* Cursor item (dragging) */
#cursor-item {
    position: fixed;
    width: 40px;
    height: 40px;
    border: 2px solid #fff;
    background: rgba(30, 30, 30, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 200;
    border-radius: 3px;
}

/* Block colors in slots */
.block-preview {
    width: 28px;
    height: 28px;
    border-radius: 2px;
}

/* MAIN MENU */
#main-menu {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 200;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

#menu-container {
    position: relative;
    width: 90%;
    max-width: 1000px;
    height: 70vh;
    max-height: 640px;
    display: flex;
    border: 2px solid #333;
    border-radius: 8px;
    overflow: hidden;
    background: rgba(10, 10, 12, 0.95);
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.7);
}

#menu-left {
    flex: 1;
    min-width: 240px;
    padding: 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
}

#menu-right {
    flex: 1;
    min-width: 200px;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
}

.menu-logo h1 {
    color: #f0c040;
    font-size: 42px;
    margin-bottom: 4px;
    text-shadow: 2px 2px 6px #000;
}

.menu-version {
    color: #777;
    font-size: 12px;
    margin-top: 0;
}

#menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.menu-btn {
    font-family: 'Courier New', monospace;
    font-size: 16px;
    color: #fff;
    background: rgba(60, 60, 60, 0.8);
    border: 2px solid #555;
    border-radius: 4px;
    padding: 12px 20px;
    cursor: pointer;
    text-align: left;
    transition: background 0.12s, border-color 0.12s;
}

.menu-btn:hover {
    background: rgba(90, 90, 90, 0.9);
    border-color: #aaa;
}

.menu-btn:active {
    background: rgba(70, 70, 70, 0.9);
}

.menu-btn .nav-hint {
    float: right;
    color: #aaa;
    font-size: 14px;
}

.menu-btn.small {
    font-size: 13px;
    padding: 8px 16px;
}

#save-list h3 {
    color: #aaa;
    font-size: 16px;
    margin-bottom: 10px;
}

#save-items {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

.save-item {
    font-family: 'Courier New', monospace;
    font-size: 13px;
    color: #fff;
    background: rgba(60, 60, 60, 0.8);
    border: 1px solid #555;
    border-radius: 3px;
    padding: 10px 12px;
    cursor: pointer;
    transition: background 0.12s;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.save-item:hover {
    background: rgba(90, 90, 90, 0.9);
}

.save-item .save-meta {
    color: #888;
    font-size: 11px;
}

/* SETTINGS MENU */
#settings-menu {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 250;
}

#settings-panel {
    background: rgba(20, 20, 22, 0.97);
    border: 2px solid #555;
    border-radius: 8px;
    padding: 36px 48px;
    width: 80%;
    max-width: 700px;
    text-align: left;
}

#settings-panel h2 {
    color: #f0c040;
    font-size: 32px;
    margin-bottom: 24px;
    text-align: center;
    text-shadow: 2px 2px 4px #000;
}

.settings-row select {
    flex: 1;
    padding: 8px 12px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    color: #fff;
    background: rgba(40, 40, 40, 0.9);
    border: 2px solid #555;
    border-radius: 4px;
    cursor: pointer;
}

.settings-row select:focus {
    border-color: #f0c040;
}

.settings-row.hint {
    margin-bottom: 0;
}

.settings-row.hint small {
    color: #888;
    font-size: 12px;
}

#controls-info {
    margin-top: 28px;
    border-top: 1px solid #333;
    padding-top: 20px;
}

#controls-info h3 {
    color: #f0c040;
    font-size: 18px;
    margin-bottom: 14px;
    text-align: center;
    text-shadow: 1px 1px 2px #000;
}

.controls-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 24px;
}

.control-item {
    color: #ccc;
    font-size: 13px;
    font-family: 'Courier New', monospace;
    display: flex;
    align-items: center;
    gap: 10px;
}

.control-item .key {
    color: #f0c040;
    font-weight: bold;
    min-width: 90px;
    text-align: right;
}

.settings-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.settings-row label {
    color: #aaa;
    font-size: 13px;
    min-width: 110px;
}

#settings-buttons {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

/* keep the existing blocker at lower z-index so menu covers it */
#blocker {
    z-index: 150;
}


/* RELOAD BUTTON (dev) */
#reload-btn {
    position: fixed;
    top: 8px;
    right: 8px;
    z-index: 9;
    width: 30px;
    height: 30px;
    padding: 0;
    font-size: 16px;
    color: #fff;
    background: rgba(0, 0, 0, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    cursor: pointer;
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.6);
}

#reload-btn:hover {
    background: rgba(60, 60, 60, 0.85);
    border-color: #fff;
}


#pause-menu {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 60;
}

#pause-panel {
    background: rgba(20, 20, 20, 0.97);
    border: 2px solid #555;
    border-radius: 6px;
    padding: 28px 40px;
    text-align: center;
    min-width: 300px;
}

#pause-panel h1 {
    color: #f0c040;
    font-size: 32px;
    margin-bottom: 6px;
    text-shadow: 2px 2px 4px #000;
}

.pause-hint {
    color: #888;
    font-size: 11px;
    margin-bottom: 20px;
}

.pause-btn {
    display: block;
    width: 100%;
    margin: 8px 0;
    padding: 10px 16px;
    font-family: 'Courier New', monospace;
    font-size: 15px;
    color: #fff;
    background: rgba(60, 60, 60, 0.8);
    border: 2px solid #666;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s;
}

.pause-btn:hover {
    background: rgba(90, 90, 90, 0.9);
    border-color: #aaa;
}

.pause-btn:active {
    background: rgba(70, 70, 70, 0.9);
}

#save-feedback {
    margin-top: 10px;
    color: #7fd07f;
    font-size: 13px;
    min-height: 18px;
    text-shadow: 1px 1px 2px #000;
}

/* MAP SCREEN */
#map-screen {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: #101418;
    z-index: 55;
}

#map-canvas {
    display: block;
    width: 100vw;
    height: 100vh;
    cursor: crosshair;
    image-rendering: pixelated;
}

#map-header {
    position: fixed;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 16px;
    background: rgba(0, 0, 0, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    padding: 6px 14px;
    z-index: 56;
}

#map-header h2 {
    color: #f0c040;
    font-size: 18px;
    text-shadow: 1px 1px 2px #000;
}

#map-hint {
    color: #aaa;
    font-size: 11px;
}

#btn-close-map {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    color: #fff;
    background: rgba(60, 60, 60, 0.8);
    border: 2px solid #666;
    border-radius: 4px;
    padding: 4px 12px;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s;
}

#btn-close-map:hover {
    background: rgba(90, 90, 90, 0.9);
    border-color: #aaa;
}

#map-help {
    position: fixed;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    color: #bbb;
    font-size: 12px;
    background: rgba(0, 0, 0, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    padding: 6px 14px;
    z-index: 56;
    white-space: nowrap;
}

/* WAYPOINT DIALOG */
#waypoint-dialog {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(20, 20, 20, 0.97);
    border: 2px solid #666;
    border-radius: 6px;
    padding: 20px 24px;
    z-index: 58;
    min-width: 280px;
    text-align: left;
}

#waypoint-dialog h3 {
    color: #f0c040;
    font-size: 16px;
    margin-bottom: 14px;
    text-align: center;
    text-shadow: 1px 1px 2px #000;
}

.wp-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.wp-row label {
    color: #aaa;
    font-size: 12px;
    width: 72px;
    text-align: right;
    flex-shrink: 0;
}

.wp-row input[type="text"],
.wp-row input[type="number"] {
    flex: 1;
    padding: 6px 8px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    color: #fff;
    background: rgba(40, 40, 40, 0.9);
    border: 2px solid #555;
    border-radius: 4px;
    outline: none;
}

.wp-row input[type="text"]:focus,
.wp-row input[type="number"]:focus {
    border-color: #f0c040;
}

.wp-row input[type="color"] {
    width: 56px;
    height: 32px;
    padding: 2px;
    background: rgba(40, 40, 40, 0.9);
    border: 2px solid #555;
    border-radius: 4px;
    cursor: pointer;
}

.wp-buttons {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

.wp-buttons .pause-btn {
    margin: 0;
    padding: 8px 10px;
    font-size: 13px;
}

.wp-remove {
    border-color: #a44 !important;
    color: #f88 !important;
    margin-left: auto;
}

.wp-remove:hover {
    background: rgba(120, 40, 40, 0.8) !important;
    border-color: #f66 !important;
}

/* CRAFTING SCREEN */
#crafting-screen {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
}

#crafting-panel {
    background: rgba(20, 20, 20, 0.97);
    border: 2px solid #555;
    border-radius: 6px;
    padding: 24px 32px;
    min-width: 360px;
    max-width: 500px;
    text-align: center;
}

#crafting-panel h2 {
    color: #f0c040;
    font-size: 24px;
    margin-bottom: 18px;
    text-shadow: 2px 2px 4px #000;
}

#crafting-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 18px;
    max-height: 50vh;
    overflow-y: auto;
}

.craft-recipe {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(40, 40, 40, 0.8);
    border: 1px solid #444;
    border-radius: 4px;
    padding: 10px 14px;
    gap: 12px;
}

.craft-recipe:hover {
    border-color: #888;
}

.craft-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    flex: 1;
}

.craft-name {
    color: #fff;
    font-size: 14px;
    font-family: 'Courier New', monospace;
    font-weight: bold;
}

.craft-ingredients {
    color: #aaa;
    font-size: 11px;
    font-family: 'Courier New', monospace;
    margin-top: 2px;
}

.craft-btn {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    color: #fff;
    background: rgba(60, 100, 60, 0.8);
    border: 1px solid #5a8a5a;
    border-radius: 3px;
    padding: 6px 12px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.12s;
}

.craft-btn:hover {
    background: rgba(80, 130, 80, 0.9);
}

.craft-btn:disabled {
    background: rgba(60, 60, 60, 0.5);
    border-color: #555;
    color: #666;
    cursor: default;
}

.craft-count {
    color: #888;
    font-size: 11px;
    font-family: 'Courier New', monospace;
}
