* { box-sizing: border-box; user-select: none; }
        body, html {
            margin: 0; padding: 0; width: 100%; height: 100%;
            overflow: hidden; background-color: #020208;
            font-family: 'Courier New', Courier, monospace;
        }
        canvas { display: block; width: 100%; height: 100%; }
        #ui-layer { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 5; }
        #fps { position: absolute; top: 10px; left: 10px; color: #fff; text-shadow: 2px 2px 0px #000; font-size: 18px; font-weight: bold; }
        #status-bar { position: absolute; top: 40px; left: 10px; color: #ffeb3b; text-shadow: 2px 2px 0px #000; font-size: 14px; font-weight: bold; }
        #time-of-day { position: absolute; top: 65px; left: 10px; color: #b3e5fc; text-shadow: 2px 2px 0px #000; font-size: 14px; font-weight: bold; }
        #coords { position: absolute; top: 10px; right: 20px; color: #fff; text-shadow: 2px 2px 0px #000; font-size: 16px; font-weight: bold; }
        #crosshair { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); color: rgba(255, 255, 255, 0.8); font-size: 24px; text-shadow: 1px 1px 1px #000; }
        
        #instructions { 
            position: absolute; top: 0; left: 0; width: 100%; height: 100%; 
            background: rgba(8, 8, 15, 0.95); color: #fff; display: flex; 
            flex-direction: column; justify-content: center; align-items: center; 
            text-align: center; padding: 20px; z-index: 10; 
        }
        #instructions h1 { font-size: 36px; margin: 0 0 5px 0; color: #4caf50; text-shadow: 0 0 15px rgba(76,175,80,0.4); }
        .menu-container { background: rgba(20, 20, 30, 0.9); padding: 30px; border-radius: 10px; border: 2px solid #333; max-width: 500px; width: 100%; }
        
        #menu-settings-panel { margin: 20px 0; border-top: 2px solid #444; border-bottom: 2px solid #444; padding: 15px 0; text-align: left; }
        #menu-settings-panel h3 { margin: 0 0 12px 0; font-size: 14px; color: #ffeb3b; text-align: center; letter-spacing: 1px; }
        .setting-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; font-size: 13px; }
        .setting-row select, .setting-row input { background: #252525; color: #fff; border: 1px solid #555; font-size: 12px; padding: 5px; cursor: pointer; border-radius: 4px; }
        
        .start-btn {
            background: #4caf50; color: white; border: none; padding: 14px 40px; 
            font-size: 18px; font-family: monospace; font-weight: bold; cursor: pointer; 
            border-radius: 4px; box-shadow: 0 4px 0 #2e7d32; transition: all 0.05s; width: 100%;
        }
        .start-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #2e7d32; }

        #hotbar {
            position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex;
            background: rgba(0, 0, 0, 0.65); padding: 6px; border-radius: 6px; border: 2px solid #444; pointer-events: auto;
        }
        .slot {
            width: 50px; height: 50px; margin: 0 3px; border: 3px solid #666; background-color: #444;
            display: flex; align-items: center; justify-content: center; position: relative; cursor: pointer; border-radius: 4px;
        }
        .slot.active { border-color: #fff; box-shadow: 0 0 12px #fff; }
        .slot span { color: #fff; font-size: 8px; text-shadow: 1px 1px 0 #000; font-weight: bold; position: absolute; bottom: 2px; text-align: center; width: 100%; }
        #notification { position: absolute; top: 20%; left: 50%; transform: translate(-50%, -50%); color: #ffeb3b; text-shadow: 2px 2px 4px #000; font-size: 20px; font-weight: bold; text-align: center; display: none; pointer-events: none; z-index: 20; }
        
        #inventory-screen, #chest-screen {
            position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 400px;
            background: rgba(20, 20, 20, 0.98); border: 3px solid #555; border-radius: 6px; padding: 15px; display: none; z-index: 15; color: #fff; box-shadow: 0 0 30px rgba(0,0,0,0.9);
        }
        .screen-title { margin-top: 0; font-size: 16px; text-align: center; border-bottom: 2px solid #555; padding-bottom: 6px; color: #ffeb3b; }
        .inv-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 12px; max-height: 220px; overflow-y: auto; }
        .inv-item { height: 50px; border: 2px solid #555; background: #2d2d2d; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: bold; cursor: pointer; text-align: center; border-radius: 4px; }
        .inv-item:hover { border-color: #fff; background: #444; }
        .close-btn { display: block; margin: 12px auto 0 auto; background: #b71c1c; color: white; border: none; padding: 6px 16px; cursor: pointer; font-family: monospace; font-weight: bold; border-radius: 3px; }

        #inventory-screen.storage-screen,#chest-screen.storage-screen,#workbench-screen.storage-screen{width:min(560px,94vw);max-height:88vh;overflow-y:auto;background:rgba(18,22,25,.98);border-color:#87939a}
        .storage-caption{color:#aebbc2;font-size:11px;margin:8px 0;text-align:center}
        .inv-grid{grid-template-columns:repeat(6,minmax(0,1fr));max-height:300px}
        .chest-player-grid{grid-template-columns:repeat(9,minmax(0,1fr))}
        .inv-item{font-size:10px}
        .inv-item{min-width:0;height:54px;position:relative;padding:4px;overflow:hidden;border:1px solid #66747b;background:linear-gradient(145deg,#39454a,#20282c)}
        .inv-item .item-name{font-size:10px;line-height:1.1;color:#f0f3f4}
        .inv-item .item-count{position:absolute;right:4px;bottom:2px;font-size:12px;color:#fff;text-shadow:1px 1px #000}
        .inv-item.selected{outline:2px solid #ffd54f;border-color:#fff}
        .inv-item.empty{opacity:.3;cursor:default}
        .chest-grid,.chest-player-grid{grid-template-columns:repeat(9,minmax(0,1fr));max-height:none}
        #workbench-recipes{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin:12px 0}
        .craft-panel{margin-top:12px;padding-top:8px;border-top:1px solid #59636a}
        .craft-button{margin:3px;padding:7px 10px;border:1px solid #6d858e;background:#293b42;color:#fff;cursor:pointer;border-radius:3px;font:11px monospace}
        .craft-button:disabled{opacity:.35;cursor:not-allowed}

        .world-actions{display:grid;grid-template-columns:1fr;gap:7px;margin:14px 0 4px}
        .world-action-btn{width:100%;padding:9px 12px;border:1px solid #607078;border-radius:4px;background:#29363c;color:#e8eef0;font: bold 12px monospace;cursor:pointer;transition:background .12s,border-color .12s}
        .world-action-btn:hover{background:#3b5059;border-color:#aab8be}
        .world-action-btn.danger{background:#452b2b;border-color:#805050;color:#ffdede}
        .world-action-btn.danger:hover{background:#633535;border-color:#c77b7b}
