@font-face { font-family: "Minecraft"; src: url(/assets/font/minecraft.woff2) format("woff2"); font-display: block; }
:root { --u: 2px; --d: 1.5px; --hp: 1px; --hb: 44px; color-scheme: dark; }
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
.off { display: none !important; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #000; color: #fff; font: 16px/1.25 "Minecraft", ui-monospace, monospace; font-synthesis: none;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
body.game { touch-action: none; overscroll-behavior: none; }
#gl, #hud { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
#gl { outline: none; }
#gl.pix { image-rendering: pixelated; }
#hud { z-index: 1; pointer-events: none; }
#cross { position: fixed; left: 50%; top: 50%; z-index: 2; transform: translate(-50%, -50%); pointer-events: none; mix-blend-mode: difference; image-rendering: pixelated; }

/* menus */
#screen { position: fixed; inset: 0; z-index: 5; display: none; overflow-y: auto; touch-action: pan-y; }
#screen.on { display: flex; }
#screen.dim { background: rgba(16, 16, 16, 0.62); }
#screen.title { background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0) 45%, rgba(0, 0, 0, 0.4)); }
#screen.blur { background: rgba(0, 0, 0, 0.4); -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px); }
#screen.card { background: none; }
#screen > .inner { margin: auto; display: flex; flex-direction: column; align-items: center; gap: calc(4 * var(--u)); padding: calc(10 * var(--u)) calc(6 * var(--u)); max-width: 100%; }
.logowrap { position: relative; display: flex; justify-content: center; margin-bottom: calc(6 * var(--u)); }
.logo { width: min(94vw, calc(256 * var(--u))); height: auto; filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.5)); }
#screen.card .logo { width: 66vw; margin: 0; }
.splashw { position: absolute; left: 80%; top: 70%; transform: translate(-50%, -50%) rotate(-20deg); pointer-events: none; }
.splash { display: block; image-rendering: pixelated; animation: splash 0.5s ease-in-out infinite alternate; }
@keyframes splash { from { transform: scale(1.2); } to { transform: scale(1.35); } }
.mct { image-rendering: pixelated; margin: 0 0 calc(6 * var(--u)); }
.lbl { image-rendering: pixelated; margin-bottom: calc(-2 * var(--u)); }
.desc { margin: 0; max-width: min(94vw, calc(230 * var(--u))); text-align: center; color: #a0a0a0; font-size: calc(8 * var(--d)); line-height: calc(10 * var(--d)); text-shadow: var(--d) var(--d) 0 #282828; user-select: text; -webkit-user-select: text; }
.desc.small { color: #808080; text-shadow: var(--d) var(--d) 0 #202020; }
.desc b, b { font-weight: normal; color: #fff; }
.desc.err { color: #ff5555; }
.desc.code { color: #ffff55; }
.row { display: flex; gap: calc(4 * var(--u)); align-items: center; justify-content: center; max-width: 94vw; }
.row.wrap { flex-wrap: wrap; }

/* vanilla buttons */
.mcb { display: flex; align-items: center; justify-content: center; flex: none; width: calc(200 * var(--u)); max-width: 94vw; height: calc(20 * var(--u)); margin: 0; padding: 0;
  cursor: pointer; background: none; border: calc(3 * var(--u)) solid transparent; border-image: url(/assets/gui/button.png) 3 fill / calc(3 * var(--u)) stretch; image-rendering: pixelated; overflow: hidden; }
.mcb:hover:not(:disabled), .mcb:focus-visible { border-image-source: url(/assets/gui/button_highlighted.png); outline: none; }
.mcb:disabled { cursor: default; border-image-source: url(/assets/gui/button_disabled.png); }
.mcb canvas { image-rendering: pixelated; pointer-events: none; }
.mcb .hi { display: none; }
.mcb:hover:not(:disabled) .lo, .mcb:focus-visible .lo { display: none; }
.mcb:hover:not(:disabled) .hi, .mcb:focus-visible .hi { display: block; }
.mcb.half { width: calc(98 * var(--u)); max-width: 46vw; }
.mcb.wide { width: calc(148 * var(--u)); max-width: 94vw; }
.mcb.third { width: calc(64 * var(--u)); max-width: 30vw; }
.mcb.small { width: calc(60 * var(--u)); max-width: 30vw; }
.row.p { width: min(94vw, calc(200 * var(--u))); }
.row.p .link { flex: 1; width: auto; min-width: 0; }
.who { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: calc(8 * var(--u)); text-shadow: var(--u) var(--u) 0 #3f3f3f; }
.who.ver { color: #55ffff; }
.face { flex: none; image-rendering: pixelated; }
.link { width: calc(200 * var(--u)); max-width: 94vw; height: calc(18 * var(--u)); min-height: 28px; padding: 0 calc(4 * var(--u)); background: #000; color: #fff; border: 1px solid #a0a0a0;
  border-radius: 0; font: calc(8 * var(--u)) "Minecraft", ui-monospace, monospace; user-select: text; -webkit-user-select: text; outline: none; }
.link:focus { border-color: #fff; }
.link.search { width: min(94vw, calc(305 * var(--u))); }
/* a read-only link with its copy button inside the bar */

/* server list */
.servers { display: flex; flex-direction: column; gap: calc(2 * var(--u)); width: min(94vw, calc(305 * var(--u))); padding: calc(2 * var(--u)) 0; }
.srow { display: flex; gap: calc(3 * var(--u)); align-items: flex-start; padding: calc(2 * var(--u)); border: var(--u) solid transparent; cursor: pointer; outline: none; }
.srow:hover { background: rgba(255, 255, 255, 0.06); }
.srow.sel { border-color: #fff; background: rgba(0, 0, 0, 0.6); }
.sicon { flex: none; width: calc(32 * var(--u)); height: calc(32 * var(--u)); image-rendering: pixelated; }
.sicon.pfp { image-rendering: auto; }
.stext { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: var(--u); overflow: hidden; }
.sline { display: flex; justify-content: space-between; gap: calc(4 * var(--u)); }
.stext canvas { flex: none; image-rendering: pixelated; }

/* small in-game buttons: menu top left; Play in new tab, Inventory and Chat top right */
#hudtop { position: fixed; inset: 0; z-index: 4; pointer-events: none; }
#hudleft, #hudright { position: absolute; top: max(calc(4 * var(--hp)), env(safe-area-inset-top)); display: flex; flex-direction: column; gap: calc(2 * var(--hp)); }
#hudleft { left: max(calc(4 * var(--hp)), env(safe-area-inset-left)); flex-direction: row; align-items: flex-start; }
#hudleft.stack { flex-direction: column; }
#hudright { right: max(calc(4 * var(--hp)), env(safe-area-inset-right)); align-items: stretch; }
.mcb.hb { pointer-events: auto; width: auto; max-width: none; height: calc(18 * var(--hp)); padding: 0 calc(3 * var(--hp)); justify-content: flex-start;
  border-width: calc(3 * var(--hp)); border-image-width: calc(3 * var(--hp)); touch-action: manipulation; }
#hudleft .mcb.hb { justify-content: center; min-width: calc(18 * var(--hp)); }

/* touch controls */
#touch { position: fixed; inset: 0; z-index: 3; pointer-events: none; }
#touch > * { pointer-events: auto; }
#stick { position: absolute; left: max(18px, env(safe-area-inset-left)); bottom: calc(var(--hb) + 16px); width: 128px; height: 128px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.1); border: 2px solid rgba(255, 255, 255, 0.28); touch-action: none; }
#knob { position: absolute; left: 34px; top: 34px; width: 56px; height: 56px; border-radius: 50%; background: rgba(255, 255, 255, 0.42); pointer-events: none; }
.tb { width: 62px; height: 62px; padding: 0; border-radius: 10px; border: 2px solid rgba(255, 255, 255, 0.32); background: rgba(0, 0, 0, 0.32); color: #fff; font: 24px "Minecraft", monospace; touch-action: none; }
.tb:active { background: rgba(255, 255, 255, 0.25); }
#t-jump { position: absolute; right: max(18px, env(safe-area-inset-right)); bottom: calc(var(--hb) + 40px); }
#t-sneak { position: absolute; right: calc(max(18px, env(safe-area-inset-right)) + 74px); bottom: calc(var(--hb) + 16px); }

/* the chat field is drawn on the HUD in the Minecraft font; this invisible input over it takes the typing */
#chatbox { position: fixed; z-index: 6; margin: 0; padding: 0; border: 0; outline: none; background: transparent; color: transparent; caret-color: transparent;
  font-size: 16px; user-select: text; -webkit-user-select: text; }
#chatbox::selection { background: transparent; }

/* creative inventory: a canvas, with an invisible input over its search box */
#inv { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 7; touch-action: none; }
#invsearch { position: fixed; z-index: 8; margin: 0; padding: 0; border: 0; outline: none; background: transparent; color: transparent; caret-color: transparent;
  font-size: 16px; user-select: text; -webkit-user-select: text; }
#invsearch::selection { background: transparent; }

#adv { position: fixed; top: env(safe-area-inset-top, 0px); right: env(safe-area-inset-right, 0px); z-index: 9; pointer-events: none; image-rendering: pixelated; transform: translateX(100%); }
#note { position: fixed; left: 50%; top: 14px; z-index: 10; transform: translateX(-50%); padding: 6px 12px; background: rgba(0, 0, 0, 0.8); color: #fff; border: 1px solid #555;
  opacity: 0; pointer-events: none; transition: opacity 0.2s; }
#note.show { opacity: 1; }
#load { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 11; background: #000; }
#fatal { position: fixed; inset: 0; z-index: 12; display: grid; place-items: center; padding: 20px; text-align: center; font-size: 16px; line-height: 20px; text-shadow: 2px 2px 0 #3f3f3f;
  background: linear-gradient(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.6)), url(/assets/block/dirt.png) 0 0 / 64px repeat; image-rendering: pixelated; }
