/* ==========================================================================
   Minecraft Web Edition — UI styles (Minecraft-like GUI)
   ========================================================================== */
:root {
  --gui: 1;
  --mc-font: "Minecraftia", "Monocraft", "Lucida Console", Monaco, "Courier New", monospace;
  --text: #ffffff;
  --shadow: #3f3f3f;
  --panel: #c6c6c6;
  --slot: #8b8b8b;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #000; }
body { font-family: var(--mc-font); color: var(--text); user-select: none; -webkit-user-select: none; }
canvas#game { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; outline: none; image-rendering: pixelated; }
#ui { position: fixed; inset: 0; pointer-events: none; }
#ui > * { pointer-events: auto; }
.hidden { display: none !important; }
img { image-rendering: pixelated; }
.noscript { color: #fff; padding: 40px; }

/* ---------------------------------------------------------------- HUD */
.hud { position: fixed; inset: 0; pointer-events: none !important; }
.hud * { pointer-events: none; }
.crosshair { position: absolute; left: 50%; top: 50%; width: 20px; height: 20px; transform: translate(-50%, -50%); mix-blend-mode: difference; }
.crosshair::before, .crosshair::after { content: ""; position: absolute; background: #fff; }
.crosshair::before { left: 9px; top: 0; width: 2px; height: 20px; }
.crosshair::after { top: 9px; left: 0; height: 2px; width: 20px; }
.vignette { position: absolute; inset: 0; background: radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,.85) 120%); opacity: .25; transition: opacity .3s; }
.vignette.red { background: radial-gradient(ellipse at center, transparent 45%, rgba(160,0,0,.8) 120%); }
.water-overlay { position: absolute; inset: 0; background: rgba(16, 40, 130, .28); opacity: 0; transition: opacity .15s; }
.fire-overlay { position: absolute; left: 0; right: 0; bottom: 0; height: 45%; opacity: 0; background: linear-gradient(to top, rgba(255,120,0,.75), rgba(255,200,40,.35) 40%, transparent); animation: flicker .15s infinite alternate; }
@keyframes flicker { from { filter: brightness(1); } to { filter: brightness(1.3); } }
.hurt-overlay { position: absolute; inset: 0; background: radial-gradient(ellipse at center, transparent 40%, rgba(255,0,0,.6)); opacity: 0; }
.sleep-overlay { position: absolute; inset: 0; background: #000; opacity: 0; }
.click-prompt { position: absolute; left: 50%; top: 58%; transform: translateX(-50%); font-size: 18px; text-shadow: 2px 2px var(--shadow); background: rgba(0,0,0,.4); padding: 8px 18px; }

.hud-bottom { position: absolute; left: 50%; bottom: 4px; width: 364px; transform: translateX(-50%) scale(var(--gui)); transform-origin: bottom center; }
.stats { display: flex; justify-content: space-between; margin-bottom: 2px; }
.stat-col { display: flex; flex-direction: column; gap: 1px; }
.icon-row { display: flex; height: 18px; }
.icon-row .icon { width: 18px; height: 18px; margin-right: -2px; }
.icon-row.rtl { flex-direction: row-reverse; }
.icon-row.rtl .icon { margin-right: 0; margin-left: -2px; }
.xpbar { height: 10px; background: #000a; border: 2px solid #000; margin: 0 0 4px; position: relative; }
.xpfill { height: 100%; width: 0; background: linear-gradient(#b4ff3c, #5aa01a); }
.xplevel { position: absolute; left: 50%; bottom: 48px; transform: translateX(-50%); color: #80ff20; font-size: 16px; font-weight: bold; text-shadow: 2px 0 #000, -2px 0 #000, 0 2px #000, 0 -2px #000; }
.hotbar { position: relative; height: 44px; width: 364px; background: rgba(0,0,0,.45); border: 2px solid #111; box-shadow: inset 0 0 0 2px #8a8a8a, inset 0 0 0 4px #333; display: flex; padding: 2px; }
.hslot { width: 40px; height: 40px; position: relative; display: flex; align-items: center; justify-content: center; box-shadow: inset 0 0 0 1px rgba(255,255,255,.08); }
.hsel { position: absolute; left: -2px; top: -2px; width: 48px; height: 48px; border: 4px solid #fff; box-shadow: 0 0 0 2px #000, inset 0 0 0 2px #000; transition: transform .05s; }
.item-name { position: absolute; left: 50%; bottom: calc(118px * var(--gui)); transform: translateX(-50%); font-size: 16px; text-shadow: 2px 2px var(--shadow); white-space: nowrap; }
.action-bar { position: absolute; left: 50%; bottom: calc(145px * var(--gui)); transform: translateX(-50%); font-size: 16px; text-shadow: 2px 2px var(--shadow); white-space: nowrap; opacity: 0; color: #fff; }
.chat { position: absolute; left: 4px; bottom: calc(160px * var(--gui)); width: min(640px, 70vw); display: flex; flex-direction: column; }
.chat-line { background: rgba(0,0,0,.45); padding: 2px 6px; font-size: 15px; text-shadow: 2px 2px var(--shadow); white-space: pre-wrap; }
.chat-input { position: fixed; left: 4px; right: 4px; bottom: 4px; }
.chat-input input { width: 100%; font: 16px var(--mc-font); color: #fff; background: rgba(0,0,0,.6); border: none; outline: none; padding: 6px 8px; text-shadow: 2px 2px var(--shadow); }
.debug { position: absolute; left: 4px; top: 4px; font-size: 14px; line-height: 18px; text-shadow: 1px 1px #222; background: rgba(40,40,40,.45); padding: 4px 6px; max-width: 70vw; }

/* ---------------------------------------------------------------- slots */
.slot-icon { width: 32px; height: 32px; image-rendering: pixelated; pointer-events: none; }
.slot-count { position: absolute; right: 1px; bottom: -1px; font-size: 16px; font-weight: bold; color: #fff; text-shadow: 2px 2px var(--shadow); pointer-events: none; }
.slot-dur { position: absolute; left: 4px; right: 4px; bottom: 3px; height: 4px; background: #000; pointer-events: none; }
.slot-dur-fill { height: 2px; background: #0f0; }

/* ---------------------------------------------------------------- inventory screens */
.screen { position: fixed; inset: 0; background: rgba(16,16,16,.55); display: flex; align-items: center; justify-content: center; }
.window { background: var(--panel); border: 2px solid #000; box-shadow: inset 2px 2px 0 #fff, inset -2px -2px 0 #555; padding: 10px 14px 14px; color: #404040; zoom: var(--gui); border-radius: 3px; }
.win-title { font-size: 15px; margin: 4px 0 4px 2px; color: #404040; }
.grid9 { display: grid; grid-template-columns: repeat(9, 36px); }
.hotbar-grid { margin-top: 8px; }
.slot { width: 36px; height: 36px; background: var(--slot); border: 2px solid; border-color: #373737 #fff #fff #373737; position: relative; display: flex; align-items: center; justify-content: center; cursor: default; }
.slot:hover { background: #a8a8a8; }
.slot.big { width: 52px; height: 52px; }
.slot.trash { background: #8b4b4b; }
.inv-top { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; min-height: 150px; }
.armor-col { display: flex; flex-direction: column; }
.player-preview { width: 104px; height: 144px; background: #000; border: 2px solid; border-color: #373737 #fff #fff #373737; display: flex; align-items: center; justify-content: center; }
.player-preview canvas { image-rendering: pixelated; }
.craft-wrap { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.craft-grid { display: grid; }
.craft-grid.g2 { grid-template-columns: repeat(2, 36px); }
.craft-grid.g3 { grid-template-columns: repeat(3, 36px); }
.window.crafting .inv-top { justify-content: center; }
.window.crafting .craft-wrap { margin: 0 auto; }
.craft-arrow, .arrow { width: 44px; height: 30px; position: relative; }
.craft-arrow::before, .arrow::before { content: ""; position: absolute; left: 0; top: 11px; width: 28px; height: 8px; background: #8b8b8b; }
.craft-arrow::after, .arrow::after { content: ""; position: absolute; left: 26px; top: 3px; border: 12px solid transparent; border-left: 14px solid #8b8b8b; }
.arrow-fill { position: absolute; left: 0; top: 11px; height: 8px; width: 0; background: #fff; z-index: 1; }
.furnace-ui { display: flex; align-items: center; justify-content: center; gap: 16px; margin: 6px 0 10px; }
.furnace-col { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.flame { width: 28px; height: 28px; position: relative; background: radial-gradient(circle at 50% 70%, #8b8b8b 50%, transparent 52%); }
.flame-fill { position: absolute; left: 4px; right: 4px; bottom: 2px; height: 0; background: linear-gradient(to top, #ff4000, #ffb000 60%, #ffe060); border-radius: 50% 50% 30% 30%; }
.creative-grid { max-height: 290px; overflow-y: auto; overflow-x: hidden; width: 344px; grid-template-columns: repeat(9, 36px); }
.creative-search { width: 100%; font: 14px var(--mc-font); padding: 4px 6px; margin-bottom: 6px; border: 2px solid #373737; background: #000; color: #fff; outline: none; }
.trash-row { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 6px; font-size: 13px; }
.cursor-item { position: fixed; width: 36px; height: 36px; margin: -18px 0 0 -18px; pointer-events: none !important; display: flex; align-items: center; justify-content: center; z-index: 10; transform: scale(var(--gui)); }
.tooltip { position: fixed; background: rgba(16,0,16,.94); border: 2px solid #2d0a63; outline: 2px solid rgba(16,0,16,.94); padding: 4px 8px; font-size: 15px; z-index: 11; pointer-events: none !important; color: #fff; text-shadow: 2px 2px var(--shadow); }
.tt-sub { color: #aaa; font-size: 13px; }

/* ---------------------------------------------------------------- menus */
.menu { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; z-index: 20; }
.dirt-bg { background-color: #3a2a1d; background-image: var(--dirt); background-size: 64px; image-rendering: pixelated; }
.title-bg { background-color: #1b2b3b; background-image: var(--title-bg); background-size: cover; }
.dim-bg { background: rgba(16,16,16,.6); }
.death-bg { background: linear-gradient(rgba(80,0,0,.55), rgba(160,20,20,.6)); }
.menu-col { display: flex; flex-direction: column; gap: 8px; align-items: center; zoom: var(--gui); }
.menu-row { display: flex; gap: 8px; justify-content: center; zoom: var(--gui); }
.menu-row .mc-btn { width: 240px; }
.menu-title { zoom: var(--gui); font-size: 20px; text-shadow: 2px 2px var(--shadow); margin-bottom: 14px; }
.menu-footer { position: absolute; bottom: 6px; left: 8px; right: 8px; font-size: 12px; color: #ddd; text-shadow: 2px 2px var(--shadow); text-align: center; }
.mc-btn { width: 400px; height: 40px; font: 16px var(--mc-font); color: #e0e0e0; text-shadow: 2px 2px var(--shadow); cursor: pointer;
  background: linear-gradient(#8a8a8a, #6b6b6b); border: 2px solid #000; box-shadow: inset 2px 2px 0 rgba(255,255,255,.35), inset -2px -3px 0 rgba(0,0,0,.35); }
.mc-btn:hover { background: linear-gradient(#8e98d8, #6a74b8); color: #ffffa0; outline: 2px solid #fff; outline-offset: -2px; }
.mc-btn:active { filter: brightness(.9); }
.mc-label { font-size: 14px; color: #a0a0a0; align-self: flex-start; text-shadow: 2px 2px var(--shadow); }
.mc-input { width: 400px; height: 40px; font: 16px var(--mc-font); color: #fff; background: #000; border: 2px solid #a0a0a0; padding: 4px 8px; outline: none; }
.mc-input:focus { border-color: #fff; }
.mc-slider { width: 300px; height: 40px; position: relative; background: #000; border: 2px solid #000; }
.mc-slider input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; margin: 0; }
.mc-slider-label { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 15px; text-shadow: 2px 2px var(--shadow); pointer-events: none;
  background: linear-gradient(#6b6b6b, #555); box-shadow: inset 2px 2px 0 rgba(255,255,255,.2), inset -2px -2px 0 rgba(0,0,0,.4); }
.options-grid { display: grid; grid-template-columns: 300px 300px; gap: 8px; zoom: var(--gui); margin-bottom: 18px; }
.options-grid .mc-btn { width: 300px; }
.logo { position: relative; text-align: center; margin-bottom: 36px; zoom: calc(var(--gui) * 0.85); }
.logo-text { font: 900 104px Impact, "Arial Black", "Helvetica Neue", sans-serif; letter-spacing: 6px; line-height: 1; color: transparent;
  background: var(--stone), #888; background-size: 64px; -webkit-background-clip: text; background-clip: text; -webkit-text-stroke: 3px #1b1b1b;
  filter: drop-shadow(0 7px 0 #222) drop-shadow(0 0 10px rgba(0,0,0,.7)); image-rendering: pixelated; }
.logo-sub { font: bold 20px var(--mc-font); letter-spacing: 12px; color: #fff; text-shadow: 2px 2px #000; margin-top: 4px; }
.splash { position: absolute; right: -70px; top: 78px; color: #ffff00; font-size: 20px; text-shadow: 2px 2px #3f3f00; transform: rotate(-18deg); animation: splash .5s ease-in-out infinite alternate; white-space: nowrap; }
@keyframes splash { from { transform: rotate(-18deg) scale(1); } to { transform: rotate(-18deg) scale(1.1); } }
.world-list { zoom: var(--gui); width: min(620px, 80vw); height: 46vh; overflow-y: auto; background: rgba(0,0,0,.55); border-top: 2px solid #000; border-bottom: 2px solid #000; padding: 6px; }
.world-row { padding: 8px 10px; border: 2px solid transparent; cursor: pointer; }
.world-row.sel { border-color: #aaa; background: rgba(0,0,0,.4); }
.world-name { font-size: 16px; }
.world-info { font-size: 13px; color: #9a9a9a; }
.world-empty { color: #aaa; text-align: center; margin-top: 30px; }
.death-title { font-size: 48px; text-shadow: 3px 3px #3f0000; margin-bottom: 10px; zoom: var(--gui); }
.death-msg { font-size: 16px; text-shadow: 2px 2px var(--shadow); }
.death-score { font-size: 16px; margin: 6px 0 30px; text-shadow: 2px 2px var(--shadow); color: #ffff55; }
.loading-sub { font-size: 15px; color: #ddd; text-shadow: 2px 2px var(--shadow); }
.loading-bar { width: 300px; height: 6px; background: #444; border: 1px solid #000; margin-top: 6px; }
.loading-fill { height: 100%; width: 0; background: #80ff20; transition: width .15s; }
.help-text { width: min(900px, 94vw); background: rgba(0,0,0,.6); padding: 14px 20px; font-size: 14px; line-height: 20px; text-shadow: 1px 1px #000; }
.help-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.help-text b { color: #ffff55; }
