:root {
  color-scheme: dark;
  font-family: "Segoe UI", system-ui, sans-serif;
  color: #fbf7ed;
  background: #142027;
  --glass: rgb(17 30 36 / .82);
  --line: rgb(224 235 228 / .26);
  --gold: #f0d297;
}
* { box-sizing: border-box; }
body { margin: 0; overflow: hidden; overscroll-behavior: none; }
button, select, input { font: inherit; color: inherit; }
button, select {
  padding: .52rem .82rem;
  border: 1px solid var(--line);
  background: #253a43;
  border-radius: .45rem;
  cursor: pointer;
}
button:hover, select:hover { background: #38535c; }
button:focus-visible, select:focus-visible, input:focus-visible, .skin-option:focus-within .skin-picker { outline: 2px solid var(--gold); outline-offset: 2px; }
button:disabled { cursor: wait; opacity: .45; }
#game, #scene { position: fixed; inset: 0; }
#scene canvas { display: block; width: 100%; height: 100%; touch-action: none; }
#teleport-loading:not([hidden]) {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .8rem;
  background: #000;
  color: #fff;
}
.top, .bottom {
  position: absolute;
  left: max(1rem, env(safe-area-inset-left));
  right: max(1rem, env(safe-area-inset-right));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .65rem;
  pointer-events: none;
}
.top { z-index: 2; top: max(1rem, env(safe-area-inset-top)); }
.bottom { bottom: max(1rem, env(safe-area-inset-bottom)); flex-wrap: wrap; }
.brand, .bottom > span, .tools {
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: .55rem;
  padding: .48rem .72rem;
  box-shadow: 0 2px 12px #14202740;
}
.brand { display: grid; line-height: 1.1; gap: .18rem; }
.brand strong { font-size: 1.04rem; }
.brand span { font-size: .73rem; color: var(--gold); }
.tools { display: flex; align-items: center; gap: .55rem; pointer-events: auto; font-size: .83rem; }
#game:not(.paused) .top .brand, #game:not(.paused) .tools > :not(#clock-toggle) { display: none; }
.paused .top .brand { display: grid; }
.paused .tools > :not([hidden]) { display: inline-flex; }
.playing .tools { padding: 0; border: 0; background: none; box-shadow: none; }
.paused .tools { flex-wrap: wrap; justify-content: flex-end; }
#resume-help { margin-top: .5rem; line-height: 1.4; }
.distance { display: flex; gap: .45rem; align-items: center; }
.bottom { font-size: .77rem; }
#coords { font-variant-numeric: tabular-nums; }
#clock-toggle { min-width: 4.6rem; font-variant-numeric: tabular-nums; }
#clock-toggle.frozen { color: var(--gold); border-color: var(--gold); }
.social-panel, #chat.expanded {
  z-index: 3; position: absolute; border: 1px solid var(--line); border-radius: .7rem;
  background: var(--glass); padding: .85rem; box-shadow: 0 2px 12px #14202755;
}
#clock-form, #teleport-form { top: 5rem; right: 1rem; gap: .65rem; }
#clock-form:not([hidden]), #teleport-form:not([hidden]) { display: grid; }
#clock-input, #chat-input, #warp-title, .teleport-coordinates input { padding: .45rem .55rem; background: #14252e; border: 1px solid var(--line); border-radius: .4rem; }
#warps-menu:not([hidden]) {
  display: grid; gap: .6rem; top: 22%; left: max(1rem, env(safe-area-inset-left));
  width: min(25rem, calc(100vw - 2rem)); max-height: 73vh; overflow-y: auto;
}
#game:has(#warps-menu:not([hidden])) #entry { visibility: hidden; }
#warps-menu header, #warp-actions:not([hidden]) { display: flex; align-items: center; justify-content: space-between; gap: .4rem; flex-wrap: wrap; }
#warp-heading { font-size: 1.05rem; margin: 0; }
#warp-status { margin: 0; font-size: .84rem; color: var(--gold); }
#warp-status:empty, #warp-list:empty { display: none; }
#warp-list { display: grid; gap: .35rem; list-style: none; margin: 0; padding: 0; max-height: 35vh; overflow-y: auto; }
#warp-list button { display: flex; align-items: center; justify-content: space-between; width: 100%; text-align: start; gap: .6rem; }
#warp-list button span { overflow-wrap: anywhere; }
#warp-list button small { flex: none; opacity: .8; font-variant-numeric: tabular-nums; }
#warp-list button[aria-pressed="true"] { border-color: var(--gold); }
#warp-form:not([hidden]) { display: grid; gap: .4rem; }
#warp-title { min-width: 0; }
.teleport-coordinates { display: flex; gap: .45rem; }
.teleport-coordinates label { display: grid; gap: .2rem; }
.teleport-coordinates input { width: 5.5rem; }
#online { top: 5rem; left: 50%; transform: translateX(-50%); width: min(22rem, 85vw); pointer-events: none; }
#online-names { columns: 2; padding: 0; margin: .5rem 0 0; list-style: none; overflow-wrap: anywhere; }
#online-names li { margin: .25rem .4rem .25rem 0; }
#chat { z-index: 1; position: absolute; left: 1rem; bottom: max(4.9rem, calc(env(safe-area-inset-bottom) + 4rem)); width: min(35rem, calc(100vw - 2rem)); pointer-events: none; }
#chat.expanded { pointer-events: auto; }
.chat-log:not([hidden]) { display: flex; flex-direction: column; gap: .2rem; list-style: none; padding: 0; margin: 0; }
.chat-log li { align-self: flex-start; max-width: 100%; overflow-wrap: anywhere; font-size: .86rem; }
#chat:not(.expanded) li { display: none; }
.playing #chat:not(.expanded) li.recent { display: block; padding: .24rem .4rem; border-radius: .25rem; background: var(--glass); }
.playing #chat:not(.expanded) li.recent.fading { opacity: 0; transition: opacity 2s ease; }
.playing #chat:not(.expanded) li.recent:has(~ .recent ~ .recent ~ .recent ~ .recent) { display: none; }
#chat.expanded .chat-log { max-height: min(36vh, 19rem); overflow-y: auto; margin-bottom: .55rem; }
.chat-log strong, .chat-status { color: var(--gold); }
.chat-log .chat-global { color: #8bef94; font-weight: 700; }
#chat-channel[aria-pressed="true"] { color: var(--gold); border-color: var(--gold); }
#chat-form:not([hidden]) { display: flex; flex-wrap: wrap; gap: .38rem; }
#chat-input { flex: 1 1 9rem; min-width: 0; }
#aim { display: none; position: absolute; inset: 50% auto auto 50%; pointer-events: none; }
.playing #aim { display: block; }
#aim::before, #aim::after { content: ""; position: absolute; background: #fff; box-shadow: 0 0 3px #000; transform: translate(-50%, -50%); }
#aim::before { width: 13px; height: 1px; }
#aim::after { width: 1px; height: 13px; }
.entry { position: absolute; inset: 0; display: grid; place-items: center; background: #12232c61; }
.entry[hidden] { display: none; }
#game.paused .entry {
  inset: clamp(4.25rem, 20vh, 9rem) auto auto max(.75rem, env(safe-area-inset-left));
  display: block;
  background: none;
}
#game.paused .entry[hidden] { display: none; }
#game.paused .panel {
  width: min(17rem, calc(100vw - 1.5rem));
  padding: .95rem 1rem;
  text-align: left;
  max-height: 72vh;
  overflow-y: auto;
}
#game.paused .panel h1, #game.paused #entry-help { display: none; }
#game.paused #loading { min-height: 0; margin: 0 0 .75rem; font-weight: 600; }
#game.paused .profile { margin-bottom: .75rem; }
#game.paused #play { min-width: 0; width: 100%; }
.panel {
  width: min(92vw, 28rem);
  padding: 2rem 1.7rem 1.55rem;
  border-radius: 1rem;
  background: var(--glass);
  border: 1px solid var(--line);
  text-align: center;
  box-shadow: 0 1rem 3rem #111e2d66;
}
.panel h1 { margin: 0; font-family: Georgia, serif; color: var(--gold); font-weight: 500; font-size: clamp(2.35rem, 7vw, 3.6rem); }
.panel p { min-height: 1.5rem; margin: .55rem 0 1rem; }
.panel button { color: #212929; background: var(--gold); font-weight: 600; min-width: 10rem; }
.panel small { display: block; margin-top: 1rem; color: #d7e4e3; }
.panel small[hidden] { display: none; }
.profile { display: grid; gap: .42rem; max-width: 20rem; margin: 0 auto 1rem; text-align: left; }
.profile > label { font-size: .88rem; }
.profile input[type="text"] { width: 100%; border: 1px solid var(--line); border-radius: .45rem; padding: .58rem .7rem; background: #14252e; }
.profile input[readonly] { color: #d7e4e3; }
.skin-option { display: flex; align-items: center; flex-wrap: wrap; gap: .6rem; position: relative; margin-top: .25rem; }
.skin-option input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.skin-picker { cursor: pointer; padding: .38rem .54rem; border-bottom: 1px solid var(--line); font-size: .83rem; color: var(--gold); }
.skin-option button { background: transparent; color: #d7e4e3; padding: .27rem .45rem; min-width: 0; font-size: .8rem; }
.skin-status { font-size: .76rem; color: #d7e4e3; overflow-wrap: anywhere; }
#player-name { max-width: 10rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--gold); }
#toast { position: absolute; inset: auto 10% 16%; text-align: center; pointer-events: none; }
#toast span { display: inline-block; background: var(--glass); border: 1px solid var(--line); border-radius: .6rem; padding: .55rem .8rem; }
#touch { display: none; }
.touch.playing #touch { display: block; }
.touch #keys { display: none; }
.touch.playing #chat:not(.expanded) { bottom: calc(13.35rem + env(safe-area-inset-bottom)); }
#stick, .touch-actions { position: absolute; bottom: calc(4.45rem + env(safe-area-inset-bottom)); touch-action: none; }
#stick { z-index: 2; left: max(1.2rem, calc(env(safe-area-inset-left) + .45rem)); width: 6.5rem; height: 6.5rem; border: 1px solid #fff8; border-radius: 50%; background: #16283173; }
#stick i { pointer-events: none; position: absolute; left: calc(50% - 17px); top: calc(50% - 17px); width: 34px; height: 34px; border-radius: 50%; background: #f0d297b8; }
.touch-actions { z-index: 2; right: max(.65rem, calc(env(safe-area-inset-right) + .35rem)); display: grid; grid-template-columns: repeat(2, minmax(4.5rem, 1fr)); gap: .35rem; }
#touch button { min-height: 44px; padding: .38rem .46rem; font-size: .83rem; background: var(--glass); touch-action: manipulation; }
#touch button[aria-pressed="true"], #touch button.holding { border-color: var(--gold); color: var(--gold); background: #334646; }
#touch-use { color: var(--gold); }
.touch-quick { position: absolute; z-index: 3; top: max(.5rem, env(safe-area-inset-top)); right: max(.55rem, env(safe-area-inset-right)); display: flex; gap: .32rem; }
#touch-more-panel:not([hidden]) { position: absolute; z-index: 4; right: max(.55rem,env(safe-area-inset-right)); top: calc(max(.5rem, env(safe-area-inset-top)) + 3.05rem);
  display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: .35rem; width: min(95vw,24rem);
  max-height: calc(100dvh - 8.2rem - env(safe-area-inset-top) - env(safe-area-inset-bottom)); overflow: auto;
  padding: .5rem; border: 1px solid var(--line); border-radius: .55rem; background: #14232e; }
.touch.playing .target-tag { top: calc(max(.5rem,env(safe-area-inset-top)) + 3.15rem); }
.touch:has(.social-panel:not([hidden])) #touch, .touch:has(dialog[open]) #touch { display: none; }
.touch.dead #touch { display: none; }
#health:not([hidden]) { position: absolute; z-index: 2; top: calc(max(.5rem,env(safe-area-inset-top)) + 3.05rem);
  left: max(.55rem,env(safe-area-inset-left)); display: flex; gap: 3px; padding: 5px; border: 1px solid var(--line);
  border-radius: .38rem; background: var(--glass); pointer-events: none; }
#health span { width: clamp(9px,1.18vw,15px); height: clamp(11px,1.4vw,17px); border: 1px solid #4c6b76;
  background: #152832; box-shadow: inset 0 0 0 1px #10202a; }
#health span.filled { background: #b13d41; border-color: #dc7564; box-shadow: inset 0 2px #db6160, inset 0 -2px #8a2932; }
#game.paused #health { display: none; }
#death-screen:not([hidden]) { position: absolute; z-index: 5; inset: 0; display: grid; align-content: center;
  justify-items: center; gap: 1rem; pointer-events: none; background: radial-gradient(transparent 32%,#43090970 100%); }
#death-title { margin: 0; font-size: clamp(2.3rem,6vw,4.5rem); text-shadow: 0 2px 9px #1d0303; }
#revive { min-width: 7rem; min-height: 44px; pointer-events: auto; }
#mode-players, #craft-list { display: grid; gap: .45rem; max-height: 55dvh; overflow-y: auto; }
#mode-players label, .mode-row { display: flex; justify-content: space-between; align-items: center; gap: .7rem; }
.mode-row { padding-bottom: .55rem; border-bottom: 1px solid var(--line); margin-bottom: .55rem; }
#craft-list button { display: grid; gap: .17rem; text-align: start; min-height: 44px; }
#craft-list small { opacity: .8; }
.touch .tools { max-height: 34dvh; overflow-y: auto; }
@media (orientation: portrait) {
  .touch .touch-quick { top: calc(max(.5rem,env(safe-area-inset-top)) + 2.75rem); }
  .touch #touch-more-panel:not([hidden]), .touch.playing .target-tag { top: calc(max(.5rem,env(safe-area-inset-top)) + 5.75rem); }
  #game.touch.paused .panel { max-width: min(92vw,30rem); }
  .touch #health:not([hidden]) { top: calc(max(.5rem,env(safe-area-inset-top)) + 5.75rem); }
  .touch.playing .target-tag { margin-top: 2.15rem; }
}
@media (max-width: 640px) {
  .top, .bottom { left: max(.5rem, env(safe-area-inset-left)); right: max(.5rem, env(safe-area-inset-right)); }
  .tools, .brand { padding: .3rem .5rem; }
  .tools button, .tools select { padding: .42rem .38rem; }
  .distance { font-size: 0; }
  .distance select { font-size: .74rem; }
  #keys { display: none; }
}

#creative-toggle, #inventory-toggle, #warp-toggle { pointer-events: auto; background: var(--glass); padding: .42rem .65rem; font-size: inherit; }
#creative-toggle:hover, #inventory-toggle:hover, #warp-toggle:hover { background: #38535c; }
#sign-editor {
  width: min(26rem, 90vw);
  padding: 1.25rem;
  color: inherit;
  background: #172730;
  border: 1px solid var(--line);
  border-radius: .65rem;
}
#sign-editor::backdrop { background: #091319a6; }
#sign-form { display: grid; gap: .55rem; }
#sign-title { margin: 0 0 .35rem; font-size: 1.2rem; }
#sign-form input { width: 100%; padding: .45rem .6rem; background: var(--glass); border: 1px solid var(--line); border-radius: .35rem; }
#sign-status:empty { display: none; }
.sign-actions { display: flex; justify-content: flex-end; gap: .55rem; margin-top: .3rem; }
#creative-menu {
  --gui-px: clamp(1px, min(calc((100vw - 30px) / 195), calc((100dvh - 74px) / 196)), 3px);
  --slot-step: calc(18 * var(--gui-px));
  --slot-size: calc(16 * var(--gui-px));
  position: fixed;
  overflow: visible;
  width: calc(195 * var(--gui-px));
  height: calc(136 * var(--gui-px));
  max-width: none;
  max-height: none;
  padding: 0;
  border: 0;
  color: #233542;
  color-scheme: light;
  font-family: ui-monospace, monospace;
  font-size: calc(8 * var(--gui-px));
  background-color: #bdcad2;
  isolation: isolate;
}
#creative-menu[open] { display: block; }
#creative-menu [hidden] { display: none; }
#creative-menu::backdrop, #audio-settings::backdrop { background: #080b107e; }
#creative-menu, #creative-tabs button, #creative-scroll::-webkit-slider-thumb, .equipment-empty, #hotbar, #hotbar .selected-slot::before {
  background-image: url('/generated/textures/legacy-interface.png');
  background-repeat: no-repeat;
  background-size: calc(512 * var(--gui-px)) calc(352 * var(--gui-px));
  image-rendering: pixelated;
}
#creative-menu.search-tab { background-position-x: calc(-256 * var(--gui-px)); }
#creative-menu.inventory-only { background-position-y: calc(-140 * var(--gui-px)); }

.creative-header { position: absolute; inset: 0; pointer-events: none; }
.creative-header h2 {
  position: absolute; left: calc(8 * var(--gui-px)); top: calc(4 * var(--gui-px)); margin: 0;
  width: calc(156 * var(--gui-px)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font: inherit; font-weight: 700;
}
.inventory-only .creative-header h2 { top: calc(7 * var(--gui-px)); left: calc(87 * var(--gui-px)); width: calc(100 * var(--gui-px)); }
.search-tab .creative-header h2 { width: calc(70 * var(--gui-px)); }
#creative-search {
  position: absolute;
  top: calc(4 * var(--gui-px));
  left: calc(81 * var(--gui-px));
  width: calc(87 * var(--gui-px));
  height: calc(11 * var(--gui-px));
  padding: 0 calc(2 * var(--gui-px));
  color: #162430; background: #cbe5f387; border: 0; border-radius: 0;
  pointer-events: auto;
}
#creative-close, .creative-tabs-row > button, #creative-retry {
  padding: 0;
  color: #263642;
  border: 1px solid #597b8b;
  border-radius: 1px;
  background: #c2d6de;
  line-height: 1;
}
#creative-close { position: absolute; top: calc(2 * var(--gui-px)); right: calc(3 * var(--gui-px)); width: calc(12 * var(--gui-px)); height: calc(12 * var(--gui-px)); }
#creative-menu button:focus-visible, #creative-menu input:focus-visible { outline: 2px solid #235299; outline-offset: -2px; }
.creative-tabs-row, #creative-tabs { position: absolute; inset: 0; pointer-events: none; }
.creative-tabs-row > button {
  position: absolute; top: calc(-25 * var(--gui-px)); height: calc(13 * var(--gui-px)); width: calc(13 * var(--gui-px));
  z-index: 1; pointer-events: auto;
}
#creative-prev-page { left: calc(-14 * var(--gui-px)); }
#creative-next-page { right: calc(-14 * var(--gui-px)); }
#creative-tabs button {
  position: absolute;
  left: calc(var(--tab-x) * var(--gui-px));
  top: calc(-28 * var(--gui-px));
  display: grid; place-items: center;
  width: calc(28 * var(--gui-px)); height: calc(28 * var(--gui-px)); padding: 0;
  border: 0; border-radius: 0; background-color: transparent;
  background-position: calc((-256 - var(--tab-source-x)) * var(--gui-px)) calc(-140 * var(--gui-px));
  pointer-events: auto;
}
#creative-tabs button[data-row="1"] { top: 100%; background-position-y: calc(-204 * var(--gui-px)); }
#creative-tabs [aria-selected="true"] { background-position-y: calc(-172 * var(--gui-px)); }
#creative-tabs button[data-row="1"][aria-selected="true"] { background-position-y: calc(-236 * var(--gui-px)); }
#creative-tabs canvas { width: var(--slot-size); height: var(--slot-size); image-rendering: pixelated; }
#creative-list {
  position: absolute; top: calc(16 * var(--gui-px)); left: calc(8 * var(--gui-px));
  width: calc(162 * var(--gui-px)); height: calc(90 * var(--gui-px));
  overflow: auto; overflow-anchor: none; overscroll-behavior: contain; scrollbar-width: none;
}
#creative-scroll {
  appearance: none;
  position: absolute; writing-mode: vertical-lr; direction: ltr;
  top: calc(16 * var(--gui-px)); left: calc(174 * var(--gui-px));
  width: calc(12 * var(--gui-px)); height: calc(111 * var(--gui-px)); margin: 0;
  border: 0; border-radius: 0; background: transparent; cursor: ns-resize;
}
#creative-scroll::-webkit-slider-thumb {
  appearance: none; border: 0; width: calc(12 * var(--gui-px)); height: calc(15 * var(--gui-px));
  background-position: calc(-488 * var(--gui-px)) calc(-140 * var(--gui-px));
}
#creative-scroll:disabled::-webkit-slider-thumb { background-position-x: calc(-500 * var(--gui-px)); }
#creative-grid, .inventory-grid, .inventory-hotbar { display: grid; grid-template-columns: repeat(9,var(--slot-step)); }
#creative-grid { grid-auto-rows: var(--slot-step); }
.creative-card, .inventory-slot, #inventory-trash {
  position: relative; display: grid; place-items: center;
  width: var(--slot-size); height: var(--slot-size); padding: 0; border: 0; border-radius: 0;
  background: transparent; color: white;
}
.creative-card:hover, .inventory-slot:hover, #inventory-trash:hover { background: #fcfcfcb0; }
.creative-card canvas, .inventory-slot canvas, #inventory-carried canvas { width: 100%; height: 100%; image-rendering: pixelated; pointer-events: none; }
.creative-card:disabled { cursor: default; }
.inventory-slot.picked-slot > *, .inventory-slot.picked-slot::after { visibility: hidden; }
.inventory-slot.drop-target, #inventory-trash.drop-target { background: #f1faf5a0; }
.stack-count {
  position: absolute; right: 0; bottom: 0; color: white; font: bold calc(8 * var(--gui-px)) monospace;
  text-shadow: calc(1 * var(--gui-px)) calc(1 * var(--gui-px)) #181818; pointer-events: none;
}
.creative-footer { position: absolute; left: calc(9 * var(--gui-px)); top: calc(108 * var(--gui-px)); font-size: calc(6 * var(--gui-px)); }
#creative-inventory { position: absolute; inset: 0; pointer-events: none; }
#creative-inventory h3 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
#inventory-hotbar, #inventory-slots { position: absolute; left: calc(8 * var(--gui-px)); }
#inventory-hotbar { top: calc(112 * var(--gui-px)); }
#inventory-slots { top: calc(54 * var(--gui-px)); grid-auto-rows: var(--slot-step); }
#inventory-equipment button, #inventory-trash, #inventory-preview { position: absolute; }
#inventory-equipment button { left: calc(var(--equipment-x) * var(--gui-px)); top: calc(var(--equipment-y) * var(--gui-px)); }
#creative-inventory button { pointer-events: auto; }
#inventory-trash { top: calc(112 * var(--gui-px)); left: calc(173 * var(--gui-px)); }
#inventory-edit {
  display:none; position:absolute; top:calc(13 * var(--gui-px)); left:calc(149 * var(--gui-px));
  width:var(--slot-size); height:var(--slot-size); padding:0; border:1px solid #49667c;
  background:#a7c9db; color:#203847; font-size:calc(10 * var(--gui-px));
}
.inventory-only #inventory-edit { display:block; }
#inventory-edit.drop-target { background:#e6f2fa; }
#inventory-preview {
  top: calc(5 * var(--gui-px)); left: calc(27 * var(--gui-px));
  width: calc(32 * var(--gui-px)); height: calc(44 * var(--gui-px)); background: #000;
  image-rendering: pixelated;
}
.equipment-empty { width: 100%; height: 100%; background-position: calc(var(--equipment-index) * -16 * var(--gui-px)) calc(-320 * var(--gui-px)); opacity: .7; }
#inventory-carried {
  position: fixed; z-index: 2; pointer-events: none; width: var(--slot-size); height: var(--slot-size);
  transform: translate(-50%, -50%);
}
.hud-hotbar-row {
  position: fixed; left: 50%; bottom: max(0px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  display: flex; justify-content: center;
}
.inventory-document {
  width:min(580px,calc(100vw - 30px)); max-height:calc(100dvh - 30px);
  overflow:auto; padding:18px; color:#182c3b; background:#cbddeb;
  border:4px ridge #819daf; border-radius:4px;
}
.inventory-document::backdrop { background:#0c141bb0; }
.inventory-document h2,.inventory-document h3 { margin:0 0 12px; }
.inventory-document h3 { margin-top:15px; font-size:.95rem; }
.inventory-document label { display:grid; gap:4px; margin-bottom:10px; }
.inventory-document input,.inventory-document textarea {
  width:100%; padding:7px 9px; border:1px solid #839caa; color:#152735; background:#edf5fa;
  font:inherit; resize:vertical;
}
.inventory-document textarea { white-space:pre-wrap; overflow-wrap:anywhere; }
#item-format { display:flex; flex-wrap:wrap; gap:4px; margin:8px 0; }
#item-format button,.inventory-document .document-actions button,.book-pagination button {
  min-height:25px; border:1px solid #6d899c; color:#223848; background:#e6f1f8; padding:4px 9px;
}
#item-format .text-color { padding:0; width:25px; }
#item-text-preview { min-height:2em; margin:8px 0; padding:7px; color:#21333f; background:#e4eff5; white-space:pre-wrap; overflow-wrap:anywhere; }
.book-pagination,.document-actions { display:flex; justify-content:flex-end; gap:8px; align-items:center; margin:8px 0; }
.book-pagination { justify-content:space-between; }
#book-page { background:#f2e7cd; color:#24190e; line-height:1.5; }
#book-author { margin-bottom:6px; }
#item-document-error,#container-status { color:#84251c; min-height:1.25em; margin:5px 0; }
.container-grid { display:grid; grid-template-columns:repeat(9,minmax(0,1fr)); gap:2px; max-width:440px; }
.container-grid .inventory-slot {
  aspect-ratio:1; width:100%; min-height:0; position:relative;
  border:2px inset #a6bac8; padding:3px; background:#8dafc4;
}
.container-grid .inventory-slot:hover,.container-grid .container-source { background:#d5e7f2; }
.container-grid .inventory-slot canvas,#container-carried canvas {
  width:100%; height:100%; image-rendering:pixelated; pointer-events:none;
}
#container-carried { position:fixed; transform:translate(-50%,-50%); width:36px; height:36px; pointer-events:none; z-index:3; }
#hotbar {
  --gui-px: clamp(1.4px, calc(100vw / 184), 2.5px);
  --slot-size: calc(16 * var(--gui-px));
  --slot-step: calc(20 * var(--gui-px));
  width: calc(182 * var(--gui-px)); height: calc(22 * var(--gui-px));
  padding: calc(3 * var(--gui-px)); gap: 0;
  background-position: 0 calc(-280 * var(--gui-px));
  pointer-events: auto;
}
#hotbar[hidden], .hud-hotbar-row:has(#hotbar[hidden]), #game:not(.playing):not(.paused) .hud-hotbar-row,
#game:has(#spectator-status:not([hidden])) .hud-hotbar-row { display: none; }
#hotbar .inventory-slot:hover { background: transparent; }
#hotbar .selected-slot::before {
  content: ""; position: absolute; z-index: -1;
  inset: calc(-4 * var(--gui-px)); pointer-events: none;
  background-position: calc(-184 * var(--gui-px)) calc(-280 * var(--gui-px));
}
#hotbar .selected-slot { isolation: isolate; }
#game:not(.paused) .target-tag:not(:empty) {
  position: absolute; top: max(.65rem, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%);
  max-width: min(35rem,62vw); width: max-content; font-size: .82rem; text-align: center;
  padding: .38rem .65rem; border: 1px solid var(--line); background: var(--glass); border-radius: .4rem;
  pointer-events: none;
}
#game.paused .target-tag, #keys { display: none; }
#game.paused:not(.touch) #keys {
  display: block; position: absolute; right: max(.75rem,env(safe-area-inset-right)); top: clamp(7rem, 21vh, 11rem);
  max-height: min(65dvh,35rem); overflow-y: auto; font-size: clamp(.61rem,1.1vw,.82rem);
  border: 1px solid var(--line); border-radius: .55rem; background: var(--glass); padding: .55rem .6rem;
}
#keys dl { display: grid; grid-template-columns: max-content minmax(0,1fr); gap: .23rem .55rem; margin: 0; }
#keys dt { color: var(--gold); }
#keys dd { margin: 0; }
#keys .context-keys:has(span:not([hidden])) {
  display: grid; gap: .35rem; border-top: 1px solid var(--line);
  margin-top: .5rem; padding-top: .45rem; max-width: 15rem;
}
.pause-inventory { display: none; }
#game.paused .pause-inventory { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .55rem; }
#game.paused .pause-inventory button { color: #e7edec; min-width: 0; flex: 1 0 auto; }
#game:not(.touch) #entry-help { display: none; }
.touch.playing .hud-hotbar-row { bottom: max(0px, env(safe-area-inset-bottom)); }
#audio-settings {
  width: min(29rem, 91vw); max-height: 88dvh; color: #fbf7ed; background: #172730;
  border: 1px solid var(--line); padding: 1rem 1.15rem; border-radius: .65rem;
}
#audio-settings h2 { margin: 0 0 .75rem; font-size: 1.15rem; }
.audio-options { display: grid; gap: .45rem; }
.audio-options label { display: grid; grid-template-columns: 1fr minmax(7rem,1.5fr); gap: .55rem; align-items: center; }
.audio-options fieldset { display: grid; gap: .32rem; border: 1px solid var(--line); border-radius: .3rem; }
.audio-options input[type="range"] { width: 100%; accent-color: var(--gold); }
#audio-settings-close { margin-top: .75rem; }
@media (max-width: 575px) {
  #creative-prev-page { left: 0; top: 0; }
  #creative-next-page { right: 0; top: 0; }
  #creative-close { right: calc(16 * var(--gui-px)); }
  .bottom { bottom: calc(3.3rem + env(safe-area-inset-bottom)); }
  .bottom > span { padding: .4rem .48rem; }
  #game.paused:not(.touch) #keys { max-width: 35vw; }
  #keys dl { grid-template-columns: 1fr; }
  #keys dd { margin-bottom: .22rem; }
  #game.paused .panel { max-width: 58vw; }
}
