@font-face { font-family: 'Blockyard'; src: url('font/blockyard.ttf') format('truetype'); font-display: block; }

:root { --dirt: #3b2a1a; --stone: #6f6f6f; --planks: #8a6a3a; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #000; color: #fff; font-family: 'Blockyard', 'Courier New', monospace; font-size: 16px; user-select: none; image-rendering: pixelated; }
[hidden] { display: none !important; }
#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
#c.blur { filter: blur(5px) brightness(0.85); transform: scale(1.03); }
h1 { margin: 0 0 14px; font-size: 20px; font-weight: normal; text-align: center; text-shadow: 2px 2px 0 #3f3f3f; }
h1.big { font-size: 40px; }
p { margin: 6px 0; }

/* ---------- the stone button ---------- */
.btn { font: inherit; font-size: 16px; color: #e0e0e0; text-shadow: 2px 2px 0 #383838; height: 40px; padding: 0 12px; cursor: pointer;
  background: var(--stone) center / 64px 40px; background-color: #fff; background-blend-mode: multiply;
  border: 2px solid #000; box-shadow: inset 2px 2px 0 rgba(255,255,255,.4), inset -2px -2px 0 rgba(0,0,0,.5); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.btn:hover:not(:disabled), .btn.sel { background-color: #8ea6ff; color: #ffffa0; }
.btn:active:not(:disabled) { box-shadow: inset -2px -2px 0 rgba(255,255,255,.3), inset 2px 2px 0 rgba(0,0,0,.5); }
.btn:disabled { color: #a0a0a0; cursor: default; background-color: #bbb; }
.btn.wide { width: 100%; }
.btn.primary { color: #c8ffc8; }
.btn.small { height: 30px; font-size: 14px; padding: 0 8px; }
.row2 { display: flex; gap: 8px; }
.row2 > .btn { flex: 1; min-width: 0; }
.btnrow { display: flex; gap: 8px; width: 400px; max-width: 94vw; margin: 8px auto 0; }
.btnrow > .btn { flex: 1; min-width: 0; }
.btnrow.bottom { margin-top: 18px; }

/* ---------- screens ---------- */
.screen { position: fixed; inset: 0; z-index: 10; display: flex; flex-direction: column; align-items: center; padding: 28px 16px; overflow-y: auto; }
.screen.dirt { background: var(--dirt) center / 64px; background-color: #000; }
.title { justify-content: flex-start; padding-top: 7vh; background: transparent; pointer-events: none; }
.title > * { pointer-events: auto; }
.logo-wrap { position: relative; margin-bottom: 4vh; }
#logo { display: block; max-width: 92vw; height: auto; filter: drop-shadow(4px 6px 0 rgba(0,0,0,.45)); }
#splash { position: absolute; right: -10px; bottom: 10px; color: #ffff00; font-size: 18px; text-shadow: 2px 2px 0 #3f3f00; transform: rotate(-20deg); transform-origin: center; animation: splash .5s ease-in-out infinite alternate; white-space: nowrap; }
@keyframes splash { from { transform: rotate(-20deg) scale(1); } to { transform: rotate(-20deg) scale(1.08); } }
.title .menu { width: 400px; max-width: 92vw; display: flex; flex-direction: column; gap: 8px; margin-top: 2vh; }
.title .menu .row2 { margin-top: 14px; }
.corner { position: absolute; bottom: 10px; font-size: 14px; text-shadow: 2px 2px 0 #3f3f3f; color: #fff; }
.corner.left { left: 10px; } .corner.right { right: 10px; }

.listbox { width: 520px; max-width: 94vw; height: min(48vh, 360px); overflow-y: auto; background: rgba(0,0,0,.55); border-top: 2px solid #000; border-bottom: 2px solid #000; box-shadow: inset 0 2px 0 rgba(0,0,0,.6), inset 0 -2px 0 rgba(255,255,255,.1); padding: 6px; }
.witem { padding: 8px 10px; margin-bottom: 4px; border: 2px solid transparent; cursor: pointer; color: #fff; }
.witem:hover { border-color: #888; }
.witem.sel { border-color: #ddd; background: rgba(255,255,255,.08); }
.witem .sub { color: #a0a0a0; font-size: 14px; }
.witem .icon { float: left; width: 48px; height: 48px; margin-right: 10px; background: var(--planks) center / 48px; border: 2px solid #000; }
.listbox .empty { color: #a0a0a0; text-align: center; margin-top: 40px; }
.mlabel { display: flex; flex-direction: column; gap: 6px; width: 400px; max-width: 94vw; color: #a0a0a0; font-size: 14px; margin: 10px auto 0; text-shadow: 2px 2px 0 #222; }
.minput { font: inherit; font-size: 16px; color: #e0e0e0; background: #000; border: 2px solid #a0a0a0; padding: 8px 10px; height: 40px; outline: none; }
.minput:focus { border-color: #fff; }
.minput.code { text-transform: uppercase; letter-spacing: 4px; }
.mhint { color: #a0a0a0; font-size: 14px; text-shadow: 2px 2px 0 #222; width: 400px; max-width: 94vw; margin: 8px auto; text-align: center; min-height: 1.2em; }
.mhint.warn { color: #ff8080; }
.mhint.light { color: #fff; font-size: 16px; }
.helpbox { width: 560px; max-width: 94vw; color: #e0e0e0; text-shadow: 2px 2px 0 #222; line-height: 1.5; font-size: 14px; }
.helpbox b { color: #ffffa0; }
.bar { width: 400px; max-width: 94vw; height: 10px; background: #000; border: 2px solid #a0a0a0; margin-top: 14px; }
#loading-bar { height: 100%; width: 0; background: #3fb950; transition: width .2s; }

/* options */
.optgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; width: 520px; max-width: 94vw; }
.optgrid .btn { width: 100%; }
.optlist { width: 520px; max-width: 94vw; max-height: 60vh; overflow-y: auto; }
.optlist .krow { display: grid; grid-template-columns: 1fr 120px 70px; gap: 8px; align-items: center; margin-bottom: 6px; text-shadow: 2px 2px 0 #3f3f3f; }
.optlist .krow .btn.dup { color: #ff6060; }
.optlist .krow .btn.listening { color: #ffff60; }
.optlist h2 { font-size: 16px; font-weight: normal; margin: 14px 0 8px; color: #ffffa0; text-shadow: 2px 2px 0 #3f3f3f; }
.mslider { position: relative; height: 40px; }
.mslider input { -webkit-appearance: none; appearance: none; position: absolute; inset: 0; width: 100%; height: 40px; margin: 0; background: var(--stone) center / 64px 40px; background-color: #ccc; background-blend-mode: multiply; border: 2px solid #000; box-shadow: inset 2px 2px 0 rgba(255,255,255,.3), inset -2px -2px 0 rgba(0,0,0,.5); cursor: pointer; outline: none; }
.mslider input::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 36px; background: var(--stone) center / 64px 40px; background-color: #fff; background-blend-mode: multiply; border: 2px solid #000; box-shadow: inset 2px 2px 0 rgba(255,255,255,.4), inset -2px -2px 0 rgba(0,0,0,.5); }
.mslider input::-moz-range-thumb { width: 16px; height: 36px; border-radius: 0; background: #999; border: 2px solid #000; }
.mslider input:hover::-webkit-slider-thumb { background-color: #8ea6ff; }
.mslider .lbl { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; color: #e0e0e0; text-shadow: 2px 2px 0 #383838; font-size: 15px; }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
#debug, #fps { position: absolute; top: 8px; left: 8px; font-size: 14px; color: #fff; text-shadow: 2px 2px 0 #3f3f3f; white-space: pre; line-height: 1.4; background: rgba(0,0,0,.35); padding: 4px 6px; }
#player-list { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,.55); padding: 8px 14px; min-width: 240px; text-align: center; font-size: 14px; border: 2px solid #000; }
#player-list span { display: block; padding: 2px 0; }
#crosshair { position: absolute; left: 50%; top: 50%; width: 18px; height: 18px; transform: translate(-50%,-50%); }
#crosshair::before, #crosshair::after { content: ''; position: absolute; background: #fff; mix-blend-mode: difference; }
#crosshair::before { left: 8px; top: 0; width: 2px; height: 18px; }
#crosshair::after { top: 8px; left: 0; height: 2px; width: 18px; }
#water { position: absolute; inset: 0; background: rgba(20,70,190,.32); }
#vignette { position: absolute; inset: 0; background: radial-gradient(ellipse at center, rgba(0,0,0,0) 55%, rgba(0,0,0,.35) 100%); }
#hurt { position: absolute; inset: 0; background: radial-gradient(ellipse at center, rgba(255,0,0,0) 45%, rgba(220,0,0,.55) 100%); opacity: 0; transition: opacity .15s; }
#hurt.on { opacity: 1; }

#chat { position: absolute; left: 8px; bottom: 120px; width: min(60vw, 480px); }
#chat-log .line { background: rgba(0,0,0,.5); padding: 3px 6px; margin-top: 2px; font-size: 15px; text-shadow: 2px 2px 0 #3f3f3f; transition: opacity 1s; word-wrap: break-word; }
#chat-log .line.sys { color: #ffff55; }
#chat-log .line.old { opacity: 0; }
#chat-input { width: 100%; margin-top: 4px; pointer-events: auto; font: inherit; font-size: 15px; color: #fff; background: rgba(0,0,0,.5); border: 0; padding: 6px; outline: none; }

#hearts.shake { animation: shake .4s; }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.count { position: absolute; bottom: 0; right: 3px; font-size: 15px; color: #fff; text-shadow: 2px 2px 0 #3f3f3f; }
#toast { position: absolute; top: 18%; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,.6); padding: 8px 14px; font-size: 15px; max-width: 80vw; text-align: center; text-shadow: 2px 2px 0 #3f3f3f; }

/* ---------- modals ---------- */
.modal { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: auto; z-index: 9; cursor: default; }
.modal.dark { background: rgba(0,0,0,.55); }
.modal.red { background: rgba(140,0,0,.6); }
.menubox { width: 400px; max-width: 94vw; display: flex; flex-direction: column; gap: 8px; }
.menubox h1 { margin-bottom: 20px; }
.menubox .row2 .btn { flex: 1; }
.bigcode { font-size: 48px; letter-spacing: 12px; text-align: center; text-shadow: 3px 3px 0 #3f3f3f; margin: 6px 0 14px; }

/* the grey Minecraft-style panel */
.mcpanel { background: #c6c6c6; border: 3px solid; border-color: #fff #555 #555 #fff; outline: 2px solid #000; color: #404040; padding: 10px; }
.ptitle { color: #404040; font-size: 15px; margin-bottom: 4px; }
.mslot { position: relative; width: 36px; height: 36px; background: #8b8b8b center / 30px no-repeat; border: 2px solid; border-color: #373737 #fff #fff #373737; cursor: pointer; }
.mslot:hover::after { content: ''; position: absolute; inset: 0; background: rgba(255,255,255,.45); }
.mslot.out { width: 48px; height: 48px; background-size: 36px; }
.mslot .count { bottom: -1px; right: 1px; }
.mslot.armor { background-color: #8b8b8b; }
.mslot.armor::before { content: ''; position: absolute; inset: 4px; background: center / contain no-repeat; opacity: .35; }
.slotgrid { display: grid; grid-template-columns: repeat(9, 36px); gap: 0; margin-top: 8px; }
.slotgrid.hot { margin-top: 10px; }
.catalog { display: grid; grid-template-columns: repeat(9, 36px); max-height: 180px; overflow-y: auto; margin-top: 4px; }
.invpanel { width: 352px; }
.invtop { position: relative; display: flex; gap: 8px; align-items: flex-start; height: 150px; }
.armorcol { display: flex; flex-direction: column; }
.avatarbox { width: 102px; height: 142px; background: #000; border: 2px solid; border-color: #373737 #fff #fff #373737; }
#avatar { width: 98px; height: 138px; display: block; cursor: grab; }
.craftarea { flex: 1; padding-top: 6px; }
.craftarea .ptitle { text-align: center; }
.craftrow { display: flex; align-items: center; justify-content: center; gap: 8px; }
.craftgrid { display: grid; grid-template-columns: repeat(var(--cw, 2), 36px); }
.craftrow .arrow { font-size: 24px; color: #8b8b8b; }
.bookbtn { position: absolute; left: 148px; bottom: 2px; width: 24px; height: 22px; border: 2px solid #000; background: #2d8a3b; box-shadow: inset 2px 2px 0 rgba(255,255,255,.35), inset -2px -2px 0 rgba(0,0,0,.4); cursor: pointer; }
.bookbtn::before { content: ''; position: absolute; left: 6px; top: 4px; width: 8px; height: 10px; background: #f4ecd0; box-shadow: 1px 1px 0 #8a6a3a; }
.bookbtn:hover { filter: brightness(1.2); }
.bookpanel { width: 280px; max-height: 420px; margin-right: 6px; display: flex; flex-direction: column; }
#book-list { overflow-y: auto; flex: 1; }
.recipe { display: flex; align-items: center; gap: 6px; padding: 4px; cursor: pointer; border: 2px solid transparent; }
.recipe:hover { border-color: #fff #555 #555 #fff; background: #d6d6d6; }
.recipe.cant { opacity: .55; }
.recipe .mslot { cursor: inherit; }
.recipe .txt { flex: 1; font-size: 14px; color: #404040; line-height: 1.2; }
.recipe .txt small { display: block; font-size: 12px; color: #6a6a6a; }
.recipe.cant .txt small { color: #a04040; }
.catalog .mslot:hover::after, .inv-big .mslot:hover::after { background: rgba(255,255,255,.45); }
#inv { display: flex; align-items: center; justify-content: center; gap: 6px; }
#inv.table .invtop { height: auto; justify-content: center; }
#inv.table .bookbtn { left: 14px; top: 46px; bottom: auto; }
#inv.table .avatarbox, #inv.table .armorcol { display: none; }
#inv.creative .invtop { display: none; }
#cursor-stack { position: fixed; width: 36px; height: 36px; pointer-events: none; background: center / 30px no-repeat; z-index: 20; }
#tooltip { position: fixed; pointer-events: none; background: rgba(16,0,16,.94); border: 2px solid #28007f; padding: 4px 8px; font-size: 14px; color: #fff; z-index: 21; }

/* ---------- XP bar ---------- */
#xpwrap.empty #xplevel { display: none; }

/* ---------- touch controls ---------- */
#touch { position: absolute; inset: 0; pointer-events: auto; touch-action: none; }
#joy { position: absolute; left: 24px; bottom: 110px; width: 150px; height: 150px; border-radius: 50%; background: rgba(0,0,0,.25); border: 2px solid rgba(255,255,255,.35); }
#joy-knob { position: absolute; left: 50%; top: 50%; width: 60px; height: 60px; margin: -30px 0 0 -30px; border-radius: 50%; background: rgba(255,255,255,.45); border: 2px solid rgba(255,255,255,.7); }
.tbtn { position: absolute; width: 56px; height: 56px; display: grid; place-items: center; background: rgba(0,0,0,.35); border: 2px solid rgba(255,255,255,.5); color: #fff; font-size: 22px; text-shadow: 2px 2px 0 #000; border-radius: 8px; user-select: none; -webkit-user-select: none; }
.tbtn.big { width: 72px; height: 72px; right: 28px; bottom: 150px; font-size: 28px; }
.tbtn#tb-sneak { right: 36px; bottom: 90px; }
.tbtn.top { top: 10px; width: 44px; height: 44px; font-size: 18px; }
.tbtn.active { background: rgba(255,255,255,.4); }
/* character page: a turning preview of you next to the colour choices */
#options-lookwrap { display: flex; align-items: center; gap: 24px; justify-content: center; }
#options-lookwrap[hidden] { display: none; }
#look-preview { width: 160px; height: 220px; background: rgba(0,0,0,.25); border: 2px solid rgba(0,0,0,.5); }
#options-lookwrap .optgrid { grid-template-columns: 1fr; }
/* achievements: a pop-up in the corner, and the list */
#ach-toast { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; padding: 8px 14px 8px 8px; background: #212121; border: 2px solid #555; outline: 2px solid #000; color: #fff; z-index: 8; animation: achin .35s ease-out; }
#ach-toast .mslot { width: 40px; height: 40px; background-size: 36px; background-position: center; background-repeat: no-repeat; }
#ach-toast .txt { display: flex; flex-direction: column; font-size: 15px; }
#ach-toast b { color: #ffff55; font-weight: normal; }
@keyframes achin { from { transform: translate(-50%, -80px); } to { transform: translate(-50%, 0); } }
.achpanel { padding: 14px 16px; width: min(560px, 92vw); display: flex; flex-direction: column; gap: 8px; }
.achpanel .ptitle { color: #404040; text-shadow: none; text-align: center; }
#ach-list { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; max-height: 62vh; overflow-y: auto; }
.arow { display: flex; align-items: center; gap: 8px; padding: 4px 6px; background: rgba(0,0,0,.08); color: #3a3a3a; font-size: 14px; }
.arow .mslot { flex: none; width: 34px; height: 34px; background-size: 30px; background-position: center; background-repeat: no-repeat; }
.arow small { display: block; color: #666; font-size: 12px; }
.arow.locked { opacity: .45; filter: grayscale(1); }
.achpanel > .btn { align-self: center; min-width: 200px; }
/* the boss's health bar */
#bossbar { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); width: min(420px, 60vw); text-align: center; color: #fff; text-shadow: 2px 2px 0 #3f3f3f; z-index: 6; }
#bossbar .bar { height: 10px; margin-top: 4px; background: #2a0c30; border: 2px solid #000; }
#bossbar-fill { height: 100%; width: 100%; background: linear-gradient(#e070ff, #9030c0); transition: width .2s; }
/* minimap in the top right corner */
#minimap { position: absolute; top: 10px; right: 10px; width: calc(var(--s) * 64); height: calc(var(--s) * 64); max-width: 30vw; max-height: 30vw; image-rendering: pixelated; border: 2px solid rgba(0,0,0,.6); outline: 2px solid rgba(255,255,255,.35); background: #000; }
body.touch #minimap { top: 64px; }
/* sign editor: a wooden board with four lines */
.signpanel { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 18px 22px; background: #b08c54; border: 4px solid #6b4a24; box-shadow: 0 6px 0 #4a3418; }
.signpanel .ptitle { color: #2a1a0a; text-shadow: none; margin-bottom: 4px; }
.signline { width: 260px; font: inherit; font-size: 18px; text-align: center; color: #2a1a0a; background: rgba(255,255,255,.18); border: 2px solid rgba(60,36,10,.45); padding: 4px; outline: none; }
.signline:focus { background: rgba(255,255,255,.32); border-color: #2a1a0a; }
.signpanel .btn { margin-top: 8px; min-width: 200px; }
/* villager trading */
.tradepanel { padding: 14px 16px; min-width: 330px; display: flex; flex-direction: column; gap: 8px; align-items: stretch; }
.tradepanel .ptitle { color: #404040; text-shadow: none; text-align: center; }
#trade-list { display: flex; flex-direction: column; gap: 4px; max-height: 60vh; overflow-y: auto; }
.trow { display: flex; align-items: center; gap: 6px; padding: 4px 6px; background: rgba(0,0,0,.08); }
.trow .mslot { position: relative; width: 36px; height: 36px; background-size: 32px; background-position: center; background-repeat: no-repeat; }
.trow .mslot .count { position: absolute; right: 1px; bottom: 0; color: #fff; text-shadow: 2px 2px 0 #3f3f3f; font-size: 15px; }
.trow .tarrow { color: #555; font-size: 20px; margin: 0 4px; }
.trow .btn { margin-left: auto; min-width: 80px; padding: 4px 10px; }
.trow.cant { opacity: .55; }
.tradepanel > .btn { align-self: center; min-width: 200px; }
/* touch: the inventory covers the touch buttons, so it gets its own close button */
.invclose { display: none; top: 0; right: -56px; width: 44px; height: 44px; font-size: 20px; font-family: inherit; cursor: pointer; }
body.touch .invclose { display: grid; }
body.touch #crosshair { opacity: .7; }
body.touch #chat { bottom: 290px; left: 190px; width: min(50vw, 440px); }
body.touch #chat-log .line { font-size: 13px; }
body.touch .btn { height: 46px; }

/* ---------- durability bars ---------- */
.dur { position: absolute; left: 4px; right: 4px; bottom: 3px; height: 3px; background: #000; pointer-events: none; }
.dur i { display: block; height: 2px; }

/* ---------- chest & furnace ---------- */
#container .slotgrid { margin-top: 2px; }
.furnace { display: flex; align-items: center; justify-content: center; gap: 18px; padding: 6px 0 4px; }
.furnace .fcol { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.flame { width: 28px; height: 28px; position: relative; background: #8b8b8b; clip-path: polygon(50% 0, 80% 35%, 90% 70%, 70% 100%, 30% 100%, 10% 70%, 20% 35%); }
#f-flame { position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: linear-gradient(#ffe066, #ff8a1e 60%, #d8401a); }
.farrow { width: 44px; height: 30px; position: relative; background: #8b8b8b; clip-path: polygon(0 35%, 60% 35%, 60% 5%, 100% 50%, 60% 95%, 60% 65%, 0 65%); }
#f-arrow { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: #fff; }
#inv.chest .invtop, #inv.furnace .invtop { display: none; }
#inv.chest #furnace-ui, #inv.furnace #chest-grid { display: none; }
#sleep { background: rgba(0,0,10,.82); transition: background 1s; }

#portal-overlay { position: absolute; inset: 0; opacity: 0; pointer-events: none; background: radial-gradient(ellipse at center, rgba(150,60,230,.35) 0%, rgba(110,20,200,.85) 100%); transition: opacity .2s; }
#loading { z-index: 11; }

/* ---------- HUD, laid out in GUI units like the real game (--s = pixels per unit, set from the window size) ---------- */
:root { --s: 2px; }
#bottom { position: absolute; bottom: 0; left: 50%; transform: translateX(-50%); width: calc(var(--s) * 182); height: calc(var(--s) * 72); pointer-events: none; }
#stats { position: absolute; inset: 0; }
.icons { position: absolute; display: flex; height: calc(var(--s) * 9); }
.icons i { width: calc(var(--s) * 9); height: calc(var(--s) * 9); margin-right: calc(var(--s) * -1); background-size: 100% 100%; background-repeat: no-repeat; image-rendering: pixelated; flex: none; }
#hearts { left: 0; bottom: calc(var(--s) * 30); }
#armorbar { left: 0; bottom: calc(var(--s) * 40); }
#hunger { right: calc(var(--s) * -1); bottom: calc(var(--s) * 30); flex-direction: row-reverse; }
#air { right: calc(var(--s) * -1); bottom: calc(var(--s) * 40); flex-direction: row-reverse; }
#sel-name { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(var(--s) * 50); white-space: nowrap; font-size: calc(var(--s) * 8); line-height: 1; text-shadow: calc(var(--s) * 1) calc(var(--s) * 1) 0 #3f3f3f; transition: opacity .5s; }
body.creative-hud #sel-name { bottom: calc(var(--s) * 30); }
#hotbar { position: absolute; left: 0; bottom: 0; width: calc(var(--s) * 182); height: calc(var(--s) * 22); background: var(--art-hotbar) 0 0 / 100% 100%; image-rendering: pixelated; pointer-events: auto; }
#hotbar .slot { position: absolute; top: calc(var(--s) * 3); width: calc(var(--s) * 16); height: calc(var(--s) * 16); background: center / 100% 100% no-repeat; image-rendering: pixelated; }
#hotbar .slot::before { content: ''; position: absolute; inset: calc(var(--s) * -2); }
#hb-sel { position: absolute; top: calc(var(--s) * -1); width: calc(var(--s) * 24); height: calc(var(--s) * 24); background: var(--art-select) 0 0 / 100% 100%; image-rendering: pixelated; z-index: 2; pointer-events: none; }
#hotbar .count { right: calc(var(--s) * -1); bottom: calc(var(--s) * -1.5); font-size: calc(var(--s) * 7); line-height: 1; text-shadow: calc(var(--s) * 1) calc(var(--s) * 1) 0 #3f3f3f; z-index: 3; }
#hotbar .dur { left: calc(var(--s) * 2); right: calc(var(--s) * 1); bottom: calc(var(--s) * 1); height: calc(var(--s) * 2); }
#hotbar .dur i { height: calc(var(--s) * 1); }
#xpwrap { position: absolute; left: 0; bottom: calc(var(--s) * 24); width: calc(var(--s) * 182); height: calc(var(--s) * 5); }
#xpbar { position: absolute; inset: 0; background: var(--art-xpBack) 0 0 / 100% 100%; image-rendering: pixelated; }
#xpfill { height: 100%; width: 0; background: var(--art-xpFill) 0 0 / calc(var(--s) * 182) 100%; image-rendering: pixelated; }
#xplevel { position: absolute; left: 50%; bottom: calc(var(--s) * 3); transform: translateX(-50%); z-index: 1; color: #80ff20; font-size: calc(var(--s) * 8); line-height: 1;
  text-shadow: var(--s) 0 0 #000, calc(var(--s) * -1) 0 0 #000, 0 var(--s) 0 #000, 0 calc(var(--s) * -1) 0 #000; }
#xpwrap.empty #xplevel { display: none; }

/* ================= inventory screens in GUI units, laid out like the real game (texture coordinates) ================= */
#inv .mcpanel, .mcpanel.invpanel { position: relative; box-sizing: border-box; width: calc(var(--s) * 176); height: calc(var(--s) * 166); padding: 0; border: calc(var(--s) * 2) solid; border-color: #fff #555 #555 #fff; outline: var(--s) solid #000; border-radius: calc(var(--s) * 1); background: #c6c6c6; }
#inv-top, #inv:not(.chest):not(.furnace) #container, #container:not([hidden]), .craftarea, .craftrow, .furnace, .furnace .fcol { display: contents; }
#inv .ptitle { position: absolute; margin: 0; font-size: calc(var(--s) * 8); line-height: 1; color: #404040; white-space: nowrap; }
.mslot { box-sizing: border-box; width: calc(var(--s) * 18); height: calc(var(--s) * 18); border: var(--s) solid; border-color: #373737 #fff #fff #373737; background: #8b8b8b center / calc(var(--s) * 16) calc(var(--s) * 16) no-repeat; image-rendering: pixelated; }
.mslot.out { width: calc(var(--s) * 26); height: calc(var(--s) * 26); background-size: calc(var(--s) * 16) calc(var(--s) * 16); }
.mslot:hover::after { background: rgba(255,255,255,.5); }
.mslot .count { right: calc(var(--s) * -0.5); bottom: calc(var(--s) * -1); font-size: calc(var(--s) * 7); line-height: 1; text-shadow: var(--s) var(--s) 0 #3f3f3f; }
.mslot .dur { left: calc(var(--s) * 1); right: calc(var(--s) * 0); bottom: calc(var(--s) * 0); height: calc(var(--s) * 2); }
.mslot .dur i { height: var(--s); }
.mslot.armor::before { inset: calc(var(--s) * 1); }
.slotgrid { display: grid; grid-template-columns: repeat(9, calc(var(--s) * 18)); margin: 0; }
.craftgrid { display: grid; grid-template-columns: repeat(var(--cw, 2), calc(var(--s) * 18)); }
.armorcol { display: flex; flex-direction: column; }
.craftrow .arrow { background: var(--art-arrow) 0 0 / 100% 100%; image-rendering: pixelated; }
/* player inventory */
#armor-col { position: absolute; left: calc(var(--s) * 5); top: calc(var(--s) * 5); }
.avatarbox { position: absolute; left: calc(var(--s) * 23); top: calc(var(--s) * 5); width: calc(var(--s) * 52); height: calc(var(--s) * 72); box-sizing: border-box; border: var(--s) solid; border-color: #373737 #fff #fff #373737; background: #000; }
#avatar { width: 100%; height: 100%; }
#craft-title { left: calc(var(--s) * 95); top: calc(var(--s) * 4); }
#craft-grid { position: absolute; left: calc(var(--s) * 95); top: calc(var(--s) * 15); }
.craftrow .arrow { position: absolute; left: calc(var(--s) * 133); top: calc(var(--s) * 25); width: calc(var(--s) * 16); height: calc(var(--s) * 13); }
#craft-out { position: absolute; left: calc(var(--s) * 151); top: calc(var(--s) * 25); width: calc(var(--s) * 18); height: calc(var(--s) * 18); }
#inv.table #craft-out { width: calc(var(--s) * 26); height: calc(var(--s) * 26); }
.bookbtn { position: absolute; left: calc(var(--s) * 102); top: calc(var(--s) * 57); width: calc(var(--s) * 20); height: calc(var(--s) * 18); left: calc(var(--s) * 102); bottom: auto; }
#inv-label { left: calc(var(--s) * 6); top: calc(var(--s) * 70); display: none; }
#inv-grid { position: absolute; left: calc(var(--s) * 5); top: calc(var(--s) * 81); }
#inv-hotbar { position: absolute; left: calc(var(--s) * 5); top: calc(var(--s) * 139); }
/* crafting table */
#inv.table #craft-title { left: calc(var(--s) * 26); top: calc(var(--s) * 4); }
#inv.table #craft-grid { position: absolute; left: calc(var(--s) * 27); top: calc(var(--s) * 14); }
#inv.table .craftrow .arrow { position: absolute; left: calc(var(--s) * 87); top: calc(var(--s) * 32); width: calc(var(--s) * 22); height: calc(var(--s) * 15); }
#inv.table #craft-out { position: absolute; left: calc(var(--s) * 117); top: calc(var(--s) * 28); }
#inv.table .bookbtn { position: absolute; left: calc(var(--s) * 3); top: calc(var(--s) * 32); width: calc(var(--s) * 20); height: calc(var(--s) * 18); }
#inv.table #inv-label, #inv.chest #inv-label, #inv.furnace #inv-label { display: block; }
/* chest */
#container-title { left: calc(var(--s) * 6); top: calc(var(--s) * 4); }
#chest-grid { position: absolute; left: calc(var(--s) * 5); top: calc(var(--s) * 15); }
/* furnace */
#inv.furnace #container-title { left: 50%; transform: translateX(-50%); }
#f-in { position: absolute; left: calc(var(--s) * 53); top: calc(var(--s) * 14); }
.flame { position: absolute; left: calc(var(--s) * 54); top: calc(var(--s) * 34); width: calc(var(--s) * 14); height: calc(var(--s) * 14); }
#f-fuel { position: absolute; left: calc(var(--s) * 53); top: calc(var(--s) * 50); }
.farrow { position: absolute; left: calc(var(--s) * 77); top: calc(var(--s) * 32); width: calc(var(--s) * 24); height: calc(var(--s) * 17); clip-path: none; background: var(--art-arrow) 0 0 / 100% 100%; image-rendering: pixelated; }
#f-arrow { background: var(--art-arrowFill) 0 0 / calc(var(--s) * 24) 100%; image-rendering: pixelated; }
#f-out { position: absolute; left: calc(var(--s) * 109); top: calc(var(--s) * 28); }
/* creative: item list, then your inventory */
#inv.creative .mcpanel.invpanel { height: calc(var(--s) * 196); }
#inv.creative .catalog { position: absolute; left: calc(var(--s) * 5); top: calc(var(--s) * 5); width: calc(var(--s) * 170); height: calc(var(--s) * 92); display: grid; grid-template-columns: repeat(9, calc(var(--s) * 18)); grid-auto-rows: calc(var(--s) * 18); overflow-y: auto; max-height: none; margin: 0; }
#inv.creative #inv-grid { top: calc(var(--s) * 110); }
#inv.creative #inv-hotbar { top: calc(var(--s) * 168); }
/* held stack, tooltips and the recipe book scale too */
#cursor-stack { width: calc(var(--s) * 16); height: calc(var(--s) * 16); background-size: 100% 100%; image-rendering: pixelated; transform: translate(-50%, -50%); }
#cursor-stack .count { right: calc(var(--s) * -1.5); bottom: calc(var(--s) * -2); font-size: calc(var(--s) * 7); line-height: 1; }
#tooltip { font-size: calc(var(--s) * 8); padding: calc(var(--s) * 3) calc(var(--s) * 4); border-width: var(--s); line-height: 1.15; }
.bookpanel.mcpanel { position: relative; width: calc(var(--s) * 147); height: calc(var(--s) * 166); box-sizing: border-box; border: calc(var(--s) * 2) solid; border-color: #fff #555 #555 #fff; outline: var(--s) solid #000; padding: calc(var(--s) * 5); margin-right: calc(var(--s) * 2); }
.bookpanel .ptitle { position: static !important; margin-bottom: calc(var(--s) * 3) !important; }
.recipe { gap: calc(var(--s) * 3); padding: calc(var(--s) * 1); border-width: var(--s); }
.recipe .txt { font-size: calc(var(--s) * 7); }
.recipe .txt small { font-size: calc(var(--s) * 6); }
#inv { gap: calc(var(--s) * 2); }

.flame { clip-path: none; background: var(--art-flame) 0 0 / 100% 100%; image-rendering: pixelated; }
#f-flame { background: var(--art-flameFill) bottom / 100% calc(var(--s) * 14) no-repeat; image-rendering: pixelated; }
#inv { background: linear-gradient(rgba(16,16,16,.75), rgba(16,16,16,.82)); }

/* ---------- locator bar: where the other players are, drawn on the XP bar ---------- */
#locator { position: absolute; left: 0; bottom: calc(var(--s) * 24); width: calc(var(--s) * 182); height: calc(var(--s) * 5); background: var(--art-xpBack) 0 0 / 100% 100%; image-rendering: pixelated; }
body.locating #xpbar { visibility: hidden; }
#locator .dot { position: absolute; top: 50%; width: calc(var(--s) * 5); height: calc(var(--s) * 5); transform: translate(-50%, -50%); box-shadow: 0 0 0 var(--s) #000; transition: opacity .3s; }
#locator .dot.far { width: calc(var(--s) * 3); height: calc(var(--s) * 3); }
#locator .dot i { position: absolute; left: 50%; width: 0; height: 0; transform: translateX(-50%); border-left: calc(var(--s) * 3) solid transparent; border-right: calc(var(--s) * 3) solid transparent; }
#locator .dot i.up { bottom: calc(var(--s) * 3); border-bottom: calc(var(--s) * 3) solid currentColor; filter: drop-shadow(0 0 var(--s) #000); }
#locator .dot i.down { top: calc(var(--s) * 3); border-top: calc(var(--s) * 3) solid currentColor; filter: drop-shadow(0 0 var(--s) #000); }

/* ---------- recipe book: an icon grid with a search bar ---------- */
.booksearch { font: inherit; font-size: 15px; margin: 2px 4px 4px; padding: 4px 6px; background: #000; color: #e0e0e0; border: 2px solid #a0a0a0; outline: none; }
.booksearch:focus { border-color: #fff; }
.bookfilter { display: flex; justify-content: flex-end; padding: 0 4px 4px; }
.bookfilter .tbtn { position: static; width: auto; height: auto; padding: 2px 8px; font-size: 13px; }
.bookfilter .tbtn.on { background: #5b8f3a; color: #fff; }
#book-list { display: grid; grid-template-columns: repeat(6, 40px); gap: 2px; align-content: start; padding: 2px 4px; }
.recipe-icon.cant { background-color: #a86060; }
.recipe-icon.cant::before { content: ''; position: absolute; inset: 0; background: rgba(120, 0, 0, .25); }
.recipe-icon.table { background-color: #8b8b6b; opacity: .75; }
/* ---------- tooltips with more than a name ---------- */
#tooltip b { font-weight: normal; display: block; }
#tooltip b.ench { color: #55ffff; }
#tooltip .eline { display: block; color: #a8a8a8; }
#tooltip .stat { display: block; color: #55aa55; font-size: .9em; }
#tooltip .dim { display: block; color: #8a8a8a; font-size: .9em; }
#tooltip .warn { display: block; color: #ff6060; font-size: .9em; }
/* ---------- enchanted items shimmer ---------- */
.glint { overflow: hidden; }
.glint::before { content: ''; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(115deg, transparent 30%, rgba(190, 110, 255, .55) 45%, rgba(255, 190, 255, .65) 50%, rgba(190, 110, 255, .55) 55%, transparent 70%) 0 0 / 300% 100%; mix-blend-mode: screen; animation: glint 2.6s linear infinite; }
@keyframes glint { from { background-position: 150% 0; } to { background-position: -150% 0; } }
/* ---------- left-drag: the slots a stack will be spread over ---------- */
.mslot.dragsel::after { content: ''; position: absolute; inset: 0; background: rgba(255, 255, 255, .5); }

/* ---------- enchanting table ---------- */
.enchpanel { padding: 14px 16px; width: min(560px, 94vw); display: flex; flex-direction: column; gap: 8px; }
.enchpanel .ptitle { color: #404040; text-shadow: none; text-align: center; }
.enchbody { display: flex; gap: 12px; align-items: flex-start; }
.enchitems { display: grid; grid-template-columns: repeat(4, 40px); gap: 2px; align-content: start; min-height: 84px; }
.enchitems .mslot.on { outline: 3px solid #a070ff; outline-offset: -1px; }
.enchoffers { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.eoffer { display: flex; align-items: center; gap: 8px; padding: 6px 8px; background: #3a2a1e; border: 2px solid; border-color: #6b5440 #20160e #20160e #6b5440; color: #d8c8a8; cursor: pointer; font-size: 14px; }
.eoffer:hover { background: #4e3a28; color: #fff; }
.eoffer .lvl { flex: none; width: 34px; height: 34px; display: grid; place-items: center; background: #1e3a12; color: #80ff20; border: 2px solid #0e1e08; font-size: 16px; }
.eoffer .what { flex: 1; font-style: italic; }
.eoffer .what small { display: block; font-style: normal; color: #9a8a70; font-size: 12px; }
.eoffer.cant { opacity: .45; cursor: default; }
.eoffer.cant .lvl { color: #c04040; }
.enchinfo { font-size: 13px; color: #555; text-align: center; }
.enchpanel > .btn { align-self: center; min-width: 200px; }
