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

@font-face {
    font-family: 'MinecraftFont';
    src: local('Courier New'), local('monospace');
}

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

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

/* ===== START SCREEN ===== */
#start-screen {
    position: fixed;
    top: 0; left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
    background: repeating-linear-gradient(
        0deg,
        #2c2c2c 0px, #2c2c2c 2px,
        #353535 2px, #353535 4px
    );
    background-size: 4px 4px;
    image-rendering: pixelated;
}

#start-screen::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="64" height="64"><rect fill="%234a8c2a" width="32" height="32" opacity="0.1"/><rect fill="%233a7c1a" x="32" y="32" width="32" height="32" opacity="0.1"/></svg>') repeat;
    opacity: 0.3;
    pointer-events: none;
}

.title-container {
    text-align: center;
    margin-bottom: 40px;
    position: relative;
    z-index: 1;
}

.game-title {
    font-size: 72px;
    font-weight: bold;
    letter-spacing: 8px;
    text-shadow:
        4px 4px 0 #000,
        -1px -1px 0 #000,
        1px -1px 0 #000,
        -1px 1px 0 #000,
        0 0 20px rgba(74, 140, 42, 0.5);
    margin-bottom: 10px;
}

.title-word {
    display: inline-block;
    color: #fff;
    margin: 0 10px;
}

.title-word.accent {
    color: #4a8c2a;
}

.subtitle {
    color: #aaa;
    font-size: 16px;
    letter-spacing: 4px;
}

.splash-text {
    position: absolute;
    top: 25%;
    right: 20%;
    color: #ffff00;
    font-size: 20px;
    font-weight: bold;
    transform: rotate(-15deg);
    text-shadow: 2px 2px 0 #000;
    animation: splash-pulse 1s ease-in-out infinite alternate;
    z-index: 2;
    white-space: nowrap;
}

@keyframes splash-pulse {
    from { transform: rotate(-15deg) scale(1); }
    to { transform: rotate(-15deg) scale(1.1); }
}

.menu-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    position: relative;
    z-index: 1;
}

.menu-btn {
    width: 340px;
    height: 44px;
    background: #555;
    border: 3px solid #000;
    color: #fff;
    font-family: 'Courier New', monospace;
    font-size: 16px;
    cursor: pointer;
    position: relative;
    text-shadow: 2px 2px 0 #3f3f3f;
    transition: background 0.1s;
    image-rendering: pixelated;
}

.menu-btn::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 50%;
    background: rgba(255,255,255,0.08);
    pointer-events: none;
}

.menu-btn::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0;
    width: 100%; height: 50%;
    background: rgba(0,0,0,0.15);
    pointer-events: none;
}

.menu-btn:hover {
    background: #6a6a9a;
}

.menu-btn:active {
    background: #4a4a6a;
}

.menu-btn.primary {
    background: #4a8c2a;
    height: 52px;
    font-size: 18px;
}

.menu-btn.primary:hover {
    background: #5a9c3a;
}

.menu-btn.small {
    width: 165px;
    height: 38px;
    font-size: 14px;
}

.settings-row {
    display: flex;
    gap: 10px;
    margin-top: 4px;
}

.btn-text {
    position: relative;
    z-index: 1;
}

#start-screen.hidden { display: none; }

.version-text {
    position: absolute;
    bottom: 10px;
    left: 10px;
    color: #666;
    font-size: 11px;
    z-index: 1;
}

/* ===== MODALS ===== */
.modal {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.7);
    z-index: 200;
}

.modal.hidden { display: none; }

.modal-content {
    background: #2c2c2c;
    border: 3px solid #000;
    padding: 30px;
    min-width: 380px;
    max-width: 500px;
    text-align: center;
    color: #fff;
}

.modal-content h2 {
    font-size: 22px;
    margin-bottom: 20px;
    text-shadow: 2px 2px 0 #000;
}

.modal-desc {
    color: #aaa;
    margin-bottom: 15px;
    font-size: 14px;
}

.text-input {
    width: 100%;
    padding: 10px;
    background: #000;
    border: 2px solid #555;
    color: #fff;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    margin-bottom: 15px;
}

.text-input:focus {
    outline: none;
    border-color: #4a8c2a;
}

.modal-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.setting-group {
    margin-bottom: 15px;
    text-align: left;
    color: #ccc;
    font-size: 14px;
}

.setting-group label {
    display: block;
    margin-bottom: 5px;
}

.setting-group input[type="range"] {
    width: 100%;
    accent-color: #4a8c2a;
}

/* ===== GAME HUD ===== */
#game-hud {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    pointer-events: none;
    z-index: 50;
}

#game-hud.hidden { display: none; }

/* Crosshair */
#crosshair {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.crosshair-h, .crosshair-v {
    position: absolute;
    background: #fff;
    mix-blend-mode: difference;
}

.crosshair-h {
    width: 24px; height: 2px;
    top: -1px; left: -12px;
}

.crosshair-v {
    width: 2px; height: 24px;
    top: -12px; left: -1px;
}

/* Hotbar */
#hotbar {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 2px;
    background: rgba(0,0,0,0.4);
    padding: 4px;
    border: 2px solid rgba(255,255,255,0.2);
}

.hotbar-slot {
    width: 48px;
    height: 48px;
    background: rgba(0,0,0,0.5);
    border: 2px solid #555;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    pointer-events: auto;
}

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

.slot-block {
    width: 32px;
    height: 32px;
    image-rendering: pixelated;
    border: 1px solid rgba(0,0,0,0.3);
}

.slot-label {
    position: absolute;
    bottom: 1px; right: 3px;
    color: #aaa;
    font-size: 10px;
    text-shadow: 1px 1px 0 #000;
}

/* Debug Info */
#debug-info {
    position: absolute;
    top: 10px; left: 10px;
    color: #fff;
    font-size: 12px;
    text-shadow: 1px 1px 0 #000;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* ===== SURVIVAL HUD ===== */
#survival-hud {
    position: absolute;
    bottom: 76px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 3px;
}

#survival-hud.hidden { display: none; }

.bar-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.bar-container {
    width: 300px;
    height: 18px;
    background: rgba(0,0,0,0.7);
    border: 2px solid rgba(255,255,255,0.15);
    position: relative;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    transition: width 0.3s;
}

.health-bar-container .bar-fill {
    background: linear-gradient(to bottom, #e83030, #a01818);
    width: 100%;
}

.hunger-bar-container .bar-fill {
    background: linear-gradient(to bottom, #d4a030, #a07820);
    width: 100%;
}

.xp-bar-container {
    width: 340px;
    height: 10px;
}

.xp-bar-container .bar-fill {
    background: linear-gradient(to bottom, #7dff00, #4aaa00);
    width: 0%;
}

.bar-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 11px;
    text-shadow: 1px 1px 0 #000;
    z-index: 1;
}

.bar-icon {
    font-size: 18px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
}

.health-icon { color: #e02020; }
.hunger-icon { color: #c89030; }

#xp-level {
    color: #7dff00;
    font-size: 11px;
    text-shadow: 1px 1px 0 #000;
}

/* Creative mode indicator */
#mode-indicator {
    position: absolute;
    top: 10px;
    right: 10px;
    color: #fff;
    font-size: 14px;
    text-shadow: 1px 1px 0 #000;
    padding: 4px 12px;
    background: rgba(0,0,0,0.4);
    border: 1px solid rgba(255,255,255,0.2);
}

#mode-indicator.creative { color: #7dff00; }
#mode-indicator.survival { color: #e02020; }

/* Creative mode button */
.menu-btn.creative-btn {
    background: #2a6a8c;
}

.menu-btn.creative-btn:hover {
    background: #3a7a9c;
}

/* ===== BOSS BAR ===== */
#boss-bar-container {
    position: absolute;
    top: 30px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
}

#boss-bar-container.hidden { display: none; }

#boss-name {
    color: #fff;
    font-size: 16px;
    text-shadow: 2px 2px 0 #000;
    display: block;
    margin-bottom: 4px;
}

#boss-bar-outer {
    width: 300px;
    height: 14px;
    background: #000;
    border: 2px solid #555;
}

#boss-bar-inner {
    width: 100%;
    height: 100%;
    background: #8b00ff;
    transition: width 0.2s;
}

/* ===== DEATH SCREEN ===== */
#death-screen {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(120, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    z-index: 60;
}

#death-screen.hidden { display: none; }

.death-title {
    color: #ff4444;
    font-size: 56px;
    text-shadow: 3px 3px 0 #000;
    margin-bottom: 15px;
}

.death-message {
    color: #ccc;
    font-size: 18px;
    margin-bottom: 30px;
    text-shadow: 2px 2px 0 #000;
}

#death-screen .menu-btn {
    margin: 6px;
    display: inline-block;
    pointer-events: auto;
}

/* Pause Overlay */
#pause-overlay {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
}

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

.pause-menu {
    text-align: center;
}

.pause-menu h2 {
    color: #fff;
    font-size: 28px;
    margin-bottom: 20px;
    text-shadow: 2px 2px 0 #000;
}

.pause-menu .menu-btn {
    margin: 8px auto;
    display: block;
}

/* Loading Screen */
#loading-screen {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    background: #2c2c2c;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 300;
}

#loading-screen.hidden { display: none; }

.loading-content {
    text-align: center;
    color: #fff;
}

.loading-content h2 {
    font-size: 24px;
    margin-bottom: 20px;
    text-shadow: 2px 2px 0 #000;
}

.loading-bar-container {
    width: 400px;
    height: 20px;
    background: #000;
    border: 2px solid #555;
    margin-bottom: 10px;
}

.loading-bar {
    width: 0%;
    height: 100%;
    background: #4a8c2a;
    transition: width 0.3s;
}

#loading-text {
    color: #aaa;
    font-size: 13px;
}

/* Scrollbar */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #1a1a1a; }
::-webkit-scrollbar-thumb { background: #555; }
