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

@font-face {
    font-family: 'Minecraft';
    src: local('Press Start 2P'), local('Courier New');
}

body {
    background: linear-gradient(180deg, #78A7FF 0%, #1E4B8E 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: 'Press Start 2P', 'Courier New', monospace;
    overflow: hidden;
}

#game-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#game-canvas {
    border: 4px solid #2C2C2C;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    background: #87CEEB;
}

#menu {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.85);
    border: 4px solid #555;
    padding: 40px;
    z-index: 100;
    text-align: center;
    image-rendering: pixelated;
}

#menu h1 {
    color: #55FF55;
    font-size: 24px;
    margin-bottom: 30px;
    text-shadow: 3px 3px 0 #003300;
    letter-spacing: 2px;
}

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

#menu button,
#save-btn {
    background: #4A4A4A;
    border: 3px solid #2C2C2C;
    border-bottom-color: #1A1A1A;
    border-right-color: #1A1A1A;
    border-top-color: #6A6A6A;
    border-left-color: #6A6A6A;
    color: #FFFFFF;
    padding: 12px 24px;
    font-family: inherit;
    font-size: 14px;
    cursor: pointer;
    text-shadow: 2px 2px 0 #000;
    transition: all 0.1s;
    image-rendering: pixelated;
}

#menu button:hover,
#save-btn:hover {
    background: #5A5A5A;
    color: #FFFF55;
}

#menu button:active,
#save-btn:active {
    border-top-color: #1A1A1A;
    border-left-color: #1A1A1A;
    border-bottom-color: #6A6A6A;
    border-right-color: #6A6A6A;
    transform: translateY(2px);
}

#save-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 50;
    font-size: 12px;
    padding: 8px 16px;
}

#hud {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

#hotbar {
    display: flex;
    gap: 2px;
    background: rgba(0, 0, 0, 0.6);
    padding: 4px;
    border: 2px solid #1A1A1A;
}

.hotbar-slot {
    width: 48px;
    height: 48px;
    background: #8B8B8B;
    border: 2px solid #373737;
    border-top-color: #FFFFFF;
    border-left-color: #FFFFFF;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    image-rendering: pixelated;
}

.hotbar-slot.active {
    border: 3px solid #FFFFFF;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.hotbar-slot canvas {
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

.hotbar-slot .quantity {
    position: absolute;
    bottom: 2px;
    right: 4px;
    color: #FFFFFF;
    font-size: 10px;
    text-shadow: 1px 1px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000;
    font-family: 'Press Start 2P', 'Courier New', monospace;
}

#controls-hint {
    background: rgba(0, 0, 0, 0.6);
    color: #AAAAAA;
    padding: 6px 12px;
    font-size: 8px;
    border-radius: 2px;
}

.hidden {
    display: none !important;
}

/* Pixel art style for scrollbar */
::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-track {
    background: #2C2C2C;
}

::-webkit-scrollbar-thumb {
    background: #5A5A5A;
    border: 2px solid #2C2C2C;
}

::-webkit-scrollbar-thumb:hover {
    background: #6A6A6A;
}

/* Durability bar in hotbar */
.durability-bar {
    position: absolute;
    bottom: 4px;
    left: 4px;
    height: 3px;
    background: #4CAF50;
    border-radius: 1px;
}

/* ==================== */
/* Guide Modal Styles   */
/* ==================== */

#guide-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 200;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-y: auto;
    padding: 20px;
}

#guide-content {
    background: #2C2C2C;
    border: 4px solid #555;
    max-width: 700px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 20px;
    position: relative;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.8);
}

#guide-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #8B0000;
    border: 2px solid #FF4444;
    color: #FFF;
    font-size: 24px;
    width: 36px;
    height: 36px;
    cursor: pointer;
    font-family: inherit;
    line-height: 1;
}

#guide-close:hover {
    background: #AA0000;
}

#guide-content h2 {
    color: #55FF55;
    font-size: 20px;
    text-align: center;
    margin-bottom: 20px;
    text-shadow: 2px 2px 0 #003300;
}

#guide-content h3 {
    color: #FFAA00;
    font-size: 14px;
    margin: 20px 0 10px 0;
    border-bottom: 2px solid #444;
    padding-bottom: 5px;
}

#guide-content h4 {
    color: #55FFFF;
    font-size: 12px;
    margin: 10px 0 8px 0;
}

/* Tabs */
#guide-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 15px;
    border-bottom: 2px solid #444;
    padding-bottom: 10px;
}

.tab-btn {
    background: #4A4A4A;
    border: 2px solid #333;
    color: #AAA;
    padding: 8px 12px;
    font-family: inherit;
    font-size: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.tab-btn:hover {
    background: #5A5A5A;
    color: #FFF;
}

.tab-btn.active {
    background: #55AA55;
    border-color: #77CC77;
    color: #FFF;
}

/* Tab content */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Tables in guide */
#guide-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0;
    font-size: 10px;
}

#guide-content th,
#guide-content td {
    border: 1px solid #444;
    padding: 8px 10px;
    text-align: left;
}

#guide-content th {
    background: #3A3A3A;
    color: #FFAA00;
}

#guide-content td {
    background: #333;
    color: #DDD;
}

#guide-content tr:nth-child(even) td {
    background: #383838;
}

/* Recipe cards */
.recipe {
    background: #383838;
    border: 2px solid #444;
    padding: 10px;
    margin: 8px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.recipe-name {
    color: #55FF55;
    font-size: 11px;
    font-weight: bold;
}

.recipe-ingredients {
    color: #AAA;
    font-size: 10px;
    text-align: right;
}

.recipe-note {
    color: #888;
    font-size: 9px;
    font-style: italic;
    margin-top: 10px;
}

/* Mob info cards */
.mob-info {
    background: #333;
    border: 2px solid #444;
    padding: 10px;
    margin: 10px 0;
    border-radius: 4px;
}

.mob-info h4 {
    margin-top: 0;
}

.mob-info table {
    margin: 5px 0 0 0;
}
