:root { --u: 2px; --hb: 44px; color-scheme: dark; }
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #000; color: #fff; font: 14px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -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; }
#hud { 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; }
.off { display: none !important; }

#screen { position: fixed; inset: 0; z-index: 5; display: none; overflow-y: auto; background: rgba(16, 16, 16, 0.62); touch-action: pan-y; }
#screen.on { display: flex; }
#screen.clear { background: rgba(0, 0, 0, 0.22); }
#screen.card { background: none; }
.landing #screen { background: linear-gradient(rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0.55)), url(/assets/block/dirt.png) 0 0 / calc(32 * var(--u)) repeat; image-rendering: pixelated; }
#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%; }
.logo { width: min(94vw, calc(256 * var(--u))); height: auto; margin-bottom: calc(6 * var(--u)); filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.5)); }
#screen.card .logo { width: 50vw; margin: 0; }
.mct { image-rendering: pixelated; margin: 0 0 calc(6 * var(--u)); }
.desc { margin: 0; max-width: min(94vw, calc(230 * var(--u))); text-align: center; color: #e0e0e0; font-size: max(12px, calc(6.5 * var(--u))); text-shadow: 1px 1px 0 #000; user-select: text; -webkit-user-select: text; }
.desc.small { font-size: max(11px, calc(5.5 * var(--u))); color: #b8b8b8; }
.row { display: flex; gap: calc(4 * var(--u)); align-items: center; justify-content: center; max-width: 94vw; }

.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; }
.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.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))); }
.who { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: max(12px, calc(6.5 * var(--u))); text-shadow: 1px 1px 0 #000; }
.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: max(12px, calc(6 * var(--u))) ui-monospace, SFMono-Regular, Menlo, monospace; user-select: text; -webkit-user-select: text; outline: none; }
.link:focus { border-color: #fff; }

.inv { display: grid; grid-template-columns: repeat(9, calc(18 * var(--u))); padding: calc(4 * var(--u)); background: #c6c6c6; border: var(--u) solid #000; }
.slot { display: grid; place-items: center; width: calc(18 * var(--u)); height: calc(18 * var(--u)); margin: 0; padding: 0; border: 0; cursor: pointer; background: #8b8b8b;
  box-shadow: inset var(--u) var(--u) #373737, inset calc(-1 * var(--u)) calc(-1 * var(--u)) #fff; }
.slot:hover { background: #c5c5c5; }
.slot.cur { outline: var(--u) solid #fff; outline-offset: calc(-1 * var(--u)); }
.slot canvas { image-rendering: pixelated; pointer-events: none; }

#touch { position: fixed; inset: 0; z-index: 3; pointer-events: none; }
#touch > *, #t-top > * { pointer-events: auto; }
#touch.mini #stick, #touch.mini #t-jump, #touch.mini #t-sneak { display: none; }
#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: 20px system-ui, sans-serif; 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); }
#t-top { position: absolute; top: max(10px, env(safe-area-inset-top)); right: max(10px, env(safe-area-inset-right)); display: flex; gap: 8px; pointer-events: none; }
#t-top .tb { width: 42px; height: 42px; font-size: 16px; }

#chatbox { position: fixed; left: 4px; right: 4px; bottom: calc(var(--hb) + 6px); z-index: 6; height: 30px; padding: 0 8px; border: 0; outline: none; background: rgba(0, 0, 0, 0.62);
  color: #fff; font: 16px ui-monospace, SFMono-Regular, Menlo, monospace; user-select: text; -webkit-user-select: text; }
#note { position: fixed; left: 50%; top: 14px; z-index: 9; 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; }
#adv { position: fixed; top: env(safe-area-inset-top, 0px); right: env(safe-area-inset-right, 0px); z-index: 7; pointer-events: none; image-rendering: pixelated; transform: translateX(100%); }
#loading { position: fixed; inset: 0; z-index: 8; display: grid; place-items: center; padding: 20px; text-align: center; font-size: 18px; text-shadow: 2px 2px 0 #000;
  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; }
