/* Monocraft (OFL 1.1, github.com/IdreesInc/Monocraft): a readable pixel font with clear numerals */
@font-face { font-family: 'Monocraft'; src: url(vendor/fonts/Monocraft.otf) format('opentype'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Monocraft'; src: url(vendor/fonts/Monocraft-Bold.otf) format('opentype'); font-weight: 700; font-display: swap; }
/* Self-hosted pixel fonts (OFL): Google Fonts is blocked in China and stalled the page. */
/* cyrillic */
@font-face {
  font-family: 'Pixelify Sans';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(vendor/fonts/CHylV-3HFUT7aC4iv1TxGDR9JnkEi0tSaJ1f2A.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
/* latin-ext */
@font-face {
  font-family: 'Pixelify Sans';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(vendor/fonts/CHylV-3HFUT7aC4iv1TxGDR9JnMEi0tSaJ1f2A.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'Pixelify Sans';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(vendor/fonts/CHylV-3HFUT7aC4iv1TxGDR9Jn0Ei0tSaJ0.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* cyrillic */
@font-face {
  font-family: 'Pixelify Sans';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(vendor/fonts/CHylV-3HFUT7aC4iv1TxGDR9JnkEi0tSaJ1f2A.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
/* latin-ext */
@font-face {
  font-family: 'Pixelify Sans';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(vendor/fonts/CHylV-3HFUT7aC4iv1TxGDR9JnMEi0tSaJ1f2A.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'Pixelify Sans';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(vendor/fonts/CHylV-3HFUT7aC4iv1TxGDR9Jn0Ei0tSaJ0.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* cyrillic */
@font-face {
  font-family: 'Pixelify Sans';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(vendor/fonts/CHylV-3HFUT7aC4iv1TxGDR9JnkEi0tSaJ1f2A.woff2) format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
/* latin-ext */
@font-face {
  font-family: 'Pixelify Sans';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(vendor/fonts/CHylV-3HFUT7aC4iv1TxGDR9JnMEi0tSaJ1f2A.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'Pixelify Sans';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(vendor/fonts/CHylV-3HFUT7aC4iv1TxGDR9Jn0Ei0tSaJ0.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* latin-ext */
@font-face {
  font-family: 'Silkscreen';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(vendor/fonts/m8JXjfVPf62XiF7kO-i9YL1la0GA1dOkDw.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'Silkscreen';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(vendor/fonts/m8JXjfVPf62XiF7kO-i9YLNla0GA1dM.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* Emberwild pixel UI. Chunky bevelled panels, a pixel font, crisp icons. */
:root {
  --gui: 2;
  --px: calc(var(--gui) * 1px);
  --slot: calc(var(--gui) * 18px);
  --panel: #2b2733; --panel-hi: #4a4458; --panel-lo: #15121b;
  --slot-bg: #1c1924; --slot-hi: #3a3446; --slot-lo: #0b0910;
  --text: #f2ecdf; --dim: #a89fb5; --accent: #ffb347; --accent2: #7af0ff; --danger: #ff5a5a;
  --font: 'Monocraft', 'Pixelify Sans', ui-monospace, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0a0810; color: var(--text); font-family: var(--font); user-select: none; }
#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
#ui { position: fixed; inset: 0; pointer-events: none; font-size: calc(var(--gui) * 7px); }
img { image-rendering: pixelated; }
body.nohud .hud > *:not(.hurt):not(.portal-fx):not(.water-fx) { display: none !important; }

/* ---------- bevels ---------- */
.panel, .btn, .slot, input, select {
  box-shadow: inset var(--px) var(--px) 0 var(--hi, var(--panel-hi)), inset calc(var(--px) * -1) calc(var(--px) * -1) 0 var(--lo, var(--panel-lo));
}
.panel { background: var(--panel); border: var(--px) solid #000; padding: calc(var(--gui) * 7px); pointer-events: auto; max-height: 96vh; overflow: auto; }
.label { color: var(--dim); margin: calc(var(--gui) * 3px) 0; font-weight: 600; letter-spacing: 0.04em; }
.label.center { text-align: center; color: var(--text); font-size: 1.2em; }
.dim { color: var(--dim); font-size: 0.85em; line-height: 1.4; }
.btn {
  --hi: #8a8198; --lo: #2c2735; display: block; width: 100%; margin: calc(var(--gui) * 2px) 0; padding: calc(var(--gui) * 4px) calc(var(--gui) * 6px);
  background: #5d566b; color: var(--text); border: var(--px) solid #000; font: inherit; font-size: 1em; cursor: pointer; text-shadow: var(--px) var(--px) 0 #000;
}
.btn:hover { background: #6f6fa8; --hi: #a7a7e0; outline: var(--px) solid #fff; }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn.small { width: auto; display: inline-block; padding: calc(var(--gui) * 2px) calc(var(--gui) * 5px); font-size: 0.9em; }
.btn.danger:hover { background: #8a3a3a; }
input, select { background: #000; color: var(--text); border: var(--px) solid #8a8198; font: inherit; padding: calc(var(--gui) * 3px); width: 100%; margin: calc(var(--gui) * 1.5px) 0; --hi: #000; --lo: #000; outline: none; }
input:focus { border-color: var(--accent); }
input[type=range] { padding: 0; accent-color: var(--accent); }

/* ---------- slots ---------- */
.slot {
  --hi: var(--slot-lo); --lo: var(--slot-hi); width: var(--slot); height: var(--slot); background: var(--slot-bg); position: relative;
  display: flex; align-items: center; justify-content: center; pointer-events: auto;
}
.slot img { width: calc(var(--gui) * 16px); height: calc(var(--gui) * 16px); pointer-events: none; }
.slot:hover { background: #3c3650; }
.slot.ench img { filter: drop-shadow(0 0 calc(var(--gui) * 1.5px) #c070ff); animation: glint 2.5s infinite; }
@keyframes glint { 50% { filter: drop-shadow(0 0 calc(var(--gui) * 3px) #e0a0ff) brightness(1.15); } }
.slot .count { position: absolute; right: var(--px); bottom: 0; font-size: 0.95em; text-shadow: var(--px) var(--px) 0 #000; pointer-events: none; }
.slot .dur { position: absolute; left: calc(var(--gui) * 2px); right: calc(var(--gui) * 2px); bottom: calc(var(--gui) * 1.5px); height: calc(var(--gui) * 1.5px); background: #000; pointer-events: none; }
.slot .dur div { height: 100%; }
.slot.big { width: calc(var(--slot) * 1.4); height: calc(var(--slot) * 1.4); }
.slot.trash { color: var(--danger); cursor: pointer; }
.armor-slot:empty::after { content: ''; width: 50%; height: 50%; border: var(--px) dashed #4a4458; }
.grid { display: grid; gap: 0; }
.grid.hot { margin-top: calc(var(--gui) * 4px); }
.grid.creative { max-height: 40vh; overflow-y: auto; }
.cursor-stack { position: fixed; pointer-events: none; z-index: 50; display: none; background: none !important; box-shadow: none !important; }
.tooltip {
  position: fixed; z-index: 60; display: none; pointer-events: none; background: #120c1c; border: var(--px) solid #5a2a9a;
  padding: calc(var(--gui) * 3px) calc(var(--gui) * 4px); font-family: var(--font); font-size: calc(var(--gui) * 7px); color: var(--text); max-width: 40vw;
}
.tooltip .ench-line { color: #c9a0ff; } .tooltip .mod { color: var(--accent2); font-style: italic; }

/* ---------- screens ---------- */
.screen-wrap { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: auto; background: rgba(8, 6, 14, 0.45); }
.screen-wrap.dark { background: rgba(8, 6, 14, 0.7); }
.craft-head { display: flex; gap: calc(var(--gui) * 8px); align-items: flex-start; margin-bottom: calc(var(--gui) * 4px); }
.craft-row { display: flex; align-items: center; gap: calc(var(--gui) * 6px); }
.arrow { font-size: 2em; color: var(--dim); }
.avatar { width: calc(var(--gui) * 26px); height: calc(var(--slot) * 4); background: #000; display: flex; flex-direction: column; align-items: center; justify-content: center; box-shadow: inset var(--px) var(--px) 0 var(--slot-lo), inset calc(var(--px) * -1) calc(var(--px) * -1) 0 var(--slot-hi); }
.av-head { width: calc(var(--gui) * 8px); height: calc(var(--gui) * 8px); background: #d8a27a; box-shadow: inset 0 calc(var(--gui) * 2px) 0 #5a3a20; }
.av-body { width: calc(var(--gui) * 10px); height: calc(var(--gui) * 12px); background: #3a8ac0; }
.av-legs { width: calc(var(--gui) * 10px); height: calc(var(--gui) * 12px); background: #3a3060; }
.kiln-mid { display: flex; align-items: center; gap: calc(var(--gui) * 10px); justify-content: center; margin: calc(var(--gui) * 4px) 0; }
.kiln-col { display: flex; flex-direction: column; align-items: center; gap: calc(var(--gui) * 2px); }
.flame { --f: 0; width: calc(var(--gui) * 12px); height: calc(var(--gui) * 12px); background: linear-gradient(to top, #ff7a20 calc(var(--f) * 100%), #2a2430 calc(var(--f) * 100%)); clip-path: polygon(50% 0, 80% 40%, 100% 100%, 0 100%, 20% 40%); }
.prog { --p: 0; width: calc(var(--gui) * 24px); height: calc(var(--gui) * 10px); background: linear-gradient(to right, #f2ecdf calc(var(--p) * 100%), #2a2430 calc(var(--p) * 100%)); clip-path: polygon(0 30%, 65% 30%, 65% 0, 100% 50%, 65% 100%, 65% 70%, 0 70%); }
.ench-row { display: flex; gap: calc(var(--gui) * 8px); margin-bottom: calc(var(--gui) * 4px); }
.ench-left { display: flex; gap: calc(var(--gui) * 2px); align-items: flex-start; }
.ench-opts { flex: 1; display: flex; flex-direction: column; gap: calc(var(--gui) * 2px); min-width: calc(var(--gui) * 120px); }
.ench-btn { display: flex; justify-content: space-between; align-items: center; gap: calc(var(--gui) * 4px); background: #3a2a50; color: var(--text); border: var(--px) solid #000; font: inherit; padding: calc(var(--gui) * 3px); cursor: pointer; text-align: left; }
.ench-btn:hover { background: #5a3a80; }
.ench-btn.off { opacity: 0.45; cursor: default; }
.ench-btn .glyphs { color: #8a7aa0; letter-spacing: 0.1em; } .ench-btn .en { flex: 1; color: #d8c0ff; } .ench-btn .cost { color: #8aff6a; }
.panel.menu { min-width: calc(var(--gui) * 180px); max-width: 92vw; }
.panel.wide { min-width: calc(var(--gui) * 230px); }
.opt { display: flex; flex-direction: column; margin: calc(var(--gui) * 2px) 0; }
.journal-ch { margin: calc(var(--gui) * 3px) 0; padding: calc(var(--gui) * 3px); background: #221e2a; }
.journal-ch.done b { color: #8aff6a; }
.mod-row { padding: calc(var(--gui) * 2px) 0; border-bottom: var(--px) solid #3a3446; }
.err { color: var(--danger); font-size: 0.85em; white-space: pre-wrap; }
.panel.book { background: #e8dcc0; color: #2a2018; --hi: #fff6e0; --lo: #8a7050; width: min(92vw, calc(var(--gui) * 200px)); }
.book .page { min-height: calc(var(--gui) * 120px); font-size: 1.05em; line-height: 1.5; }
.book .book-title { font-weight: 700; font-size: 1.2em; margin-bottom: calc(var(--gui) * 4px); color: #5a2a10; }
.book .pg { color: #8a7050; text-align: right; font-size: 0.85em; }
.book-nav { display: flex; justify-content: space-between; }

/* ---------- title / death ---------- */
.title-screen { display: flex; flex-direction: column; align-items: center; gap: calc(var(--gui) * 4px); width: 100%; height: 100%; justify-content: center;
  background: radial-gradient(ellipse at 50% 120%, #ff7a2055, transparent 60%), radial-gradient(ellipse at 50% -20%, #5a3aa055, transparent 60%); }
.logo { font-family: 'Silkscreen', var(--font); font-size: min(calc(var(--gui) * 26px), 4.6vw); text-align: center; max-width: 94vw; color: var(--accent); letter-spacing: 0.06em;
  text-shadow: calc(var(--px) * 2) calc(var(--px) * 2) 0 #6a2a00, calc(var(--px) * 4) calc(var(--px) * 4) 0 #200a00, 0 0 calc(var(--gui) * 12px) #ff8a2088; animation: float 4s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(calc(var(--gui) * -2px)); } }
.tag { color: #ffd890; font-size: 1.3em; margin-bottom: calc(var(--gui) * 4px); animation: pulse 2s infinite; }
@keyframes pulse { 50% { color: #ffefc0; } }
.world-list { max-height: 26vh; overflow-y: auto; }
.world-row { display: flex; align-items: center; gap: calc(var(--gui) * 3px); padding: calc(var(--gui) * 2px); background: #221e2a; margin-bottom: var(--px); }
.world-row > div { flex: 1; }
.new-world { margin: calc(var(--gui) * 4px) 0; }
.credit { color: var(--dim); font-size: 0.8em; }
.death { text-align: center; pointer-events: auto; }
.death .dt { font-size: 3em; color: #ff4a4a; text-shadow: calc(var(--px) * 2) calc(var(--px) * 2) 0 #400; margin-bottom: calc(var(--gui) * 6px); }
.death .ds { margin-bottom: calc(var(--gui) * 4px); }
.death .btn { width: calc(var(--gui) * 150px); margin: calc(var(--gui) * 3px) auto; }
.search { margin-bottom: calc(var(--gui) * 3px); }

/* ---------- HUD ---------- */
.hud { position: absolute; inset: 0; }
.crosshair { position: absolute; left: 50%; top: 50%; width: calc(var(--gui) * 9px); height: calc(var(--gui) * 9px); transform: translate(-50%, -50%); mix-blend-mode: difference; }
.crosshair::before, .crosshair::after { content: ''; position: absolute; background: #fff; }
.crosshair::before { left: 0; right: 0; top: 50%; height: var(--px); transform: translateY(-50%); }
.crosshair::after { top: 0; bottom: 0; left: 50%; width: var(--px); transform: translateX(-50%); }
.vignette { position: absolute; inset: 0; background: radial-gradient(ellipse at center, transparent 60%, rgba(0, 0, 0, 0.35)); }
.hurt { position: absolute; inset: 0; background: radial-gradient(ellipse at center, transparent 40%, rgba(255, 0, 0, 0.45)); opacity: 0; }
.hurt.on { animation: hurt 0.45s; }
@keyframes hurt { 0% { opacity: 1; } 100% { opacity: 0; } }
.portal-fx { position: absolute; inset: 0; background: radial-gradient(ellipse at center, rgba(180, 60, 255, 0.3), rgba(120, 20, 200, 0.75)); opacity: 0; transition: opacity 0.2s; }
.water-fx { position: absolute; inset: 0; background: rgba(20, 60, 160, 0.3); opacity: 0; transition: opacity 0.2s; }
body.sleeping .hud::after { content: ''; position: absolute; inset: 0; background: #000; animation: sleep 1.8s; }
@keyframes sleep { 0% { opacity: 0; } 50% { opacity: 1; } 100% { opacity: 0; } }
.bottom { position: absolute; bottom: calc(var(--gui) * 2px); left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; }
.hotbar { display: flex; background: rgba(10, 8, 16, 0.55); padding: var(--px); box-shadow: 0 0 0 var(--px) #000; }
.hotbar .slot { background: rgba(28, 25, 36, 0.6); }
.hotbar .slot.sel { outline: calc(var(--px) * 2) solid #fff2c0; outline-offset: calc(var(--px) * -1); z-index: 1; background: rgba(90, 70, 40, 0.6); }
.stats { display: flex; justify-content: space-between; width: calc(var(--slot) * 9 + var(--px) * 2); margin-bottom: var(--px); }
.stats .row { display: flex; flex-direction: column; gap: var(--px); }
.stats .right { align-items: flex-end; }
.hearts, .foods, .armor, .bubbles { display: flex; height: calc(var(--gui) * 9px); }
.foods { flex-direction: row-reverse; }
.hearts img, .foods img, .armor img, .bubbles img { width: calc(var(--gui) * 8px); height: calc(var(--gui) * 8px); margin-right: var(--px); }
.hearts img.low { animation: shake 0.3s infinite; }
@keyframes shake { 50% { transform: translateY(var(--px)); } }
.xp { position: relative; width: calc(var(--slot) * 9); height: calc(var(--gui) * 4px); background: #101410; box-shadow: 0 0 0 var(--px) #000; margin-bottom: calc(var(--gui) * 2px); }
.xpfill { height: 100%; background: linear-gradient(#b8ff5a, #5ac020); width: 0; }
.lvl { position: absolute; left: 50%; top: calc(var(--gui) * -7px); transform: translateX(-50%); color: #9aff5a; text-shadow: var(--px) 0 0 #000, calc(var(--px) * -1) 0 0 #000, 0 var(--px) 0 #000, 0 calc(var(--px) * -1) 0 #000; font-weight: 700; }
.held-name { position: absolute; bottom: calc(var(--slot) + var(--gui) * 26px); left: 50%; transform: translateX(-50%); white-space: nowrap; text-shadow: var(--px) var(--px) 0 #000; opacity: 0; }
.held-name.show { animation: heldname 2.2s forwards; }
@keyframes heldname { 0%, 70% { opacity: 1; } 100% { opacity: 0; } }
.quest { position: absolute; right: calc(var(--gui) * 4px); top: calc(var(--gui) * 4px); max-width: calc(var(--gui) * 150px); background: rgba(10, 8, 16, 0.55); padding: calc(var(--gui) * 3px) calc(var(--gui) * 4px); text-shadow: var(--px) var(--px) 0 #000; }
.quest .qt, .journal-ch b { color: var(--accent); font-weight: 700; margin-bottom: var(--px); display: block; }
.qg { font-size: 0.9em; color: #e0d8e8; } .qg.done { color: #8aff6a; text-decoration: line-through; opacity: 0.8; }
.toasts { position: absolute; top: calc(var(--gui) * 4px); left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: calc(var(--gui) * 2px); }
.toast { background: rgba(20, 14, 30, 0.85); border: var(--px) solid #5a4a70; padding: calc(var(--gui) * 2px) calc(var(--gui) * 5px); transition: opacity 0.6s, transform 0.6s; text-shadow: var(--px) var(--px) 0 #000; }
.toast.out { opacity: 0; transform: translateY(calc(var(--gui) * -4px)); }
.toast.big { font-size: 1.4em; color: var(--accent); }
.toast.mod { border-color: var(--accent2); color: var(--accent2); }
.toast.err { border-color: var(--danger); color: var(--danger); }
.chapter-card { position: absolute; top: 28%; left: 0; right: 0; text-align: center; opacity: 0; pointer-events: none; }
.chapter-card .t { font-size: 2.4em; color: #ffe0a0; text-shadow: calc(var(--px) * 2) calc(var(--px) * 2) 0 #3a1a00, 0 0 calc(var(--gui) * 10px) #ff8a2066; font-weight: 700; }
.chapter-card .s { font-size: 1.2em; color: #e8dcff; margin-top: calc(var(--gui) * 3px); text-shadow: var(--px) var(--px) 0 #000; }
.chapter-card.show { animation: card 6s forwards; }
@keyframes card { 0% { opacity: 0; transform: scale(1.06); letter-spacing: 0.2em; } 12% { opacity: 1; transform: scale(1); letter-spacing: 0.02em; } 80% { opacity: 1; } 100% { opacity: 0; } }
.debug { position: absolute; left: calc(var(--gui) * 2px); top: calc(var(--gui) * 2px); display: none; background: rgba(0, 0, 0, 0.45); padding: calc(var(--gui) * 2px); line-height: 1.35; font-size: 0.9em; }
.bossbar { position: absolute; top: calc(var(--gui) * 20px); left: 50%; transform: translateX(-50%); display: none; text-align: center; width: calc(var(--gui) * 182px); }
.bname { color: #e0b0ff; text-shadow: var(--px) var(--px) 0 #000; margin-bottom: var(--px); }
.bbar { height: calc(var(--gui) * 5px); background: #200a30; box-shadow: 0 0 0 var(--px) #000; }
.bbar div { height: 100%; background: linear-gradient(#e070ff, #8020c0); width: 100%; transition: width 0.2s; }
.chat { position: absolute; left: calc(var(--gui) * 2px); bottom: calc(var(--gui) * 62px); width: min(60vw, calc(var(--gui) * 220px)); }
.chat .log { max-height: 40vh; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; }
.chat .line { background: rgba(0, 0, 0, 0.45); padding: 0 calc(var(--gui) * 2px); text-shadow: var(--px) var(--px) 0 #000; transition: opacity 1s; }
.chat .line.sys { color: #ffe08a; }
.chat .line.fade { opacity: 0; }
.chat.open .line.fade { opacity: 1; }
.chat.open .log { overflow-y: auto; pointer-events: auto; }
.chat-in { display: none; pointer-events: auto; background: rgba(0, 0, 0, 0.6); }
.chat.open .chat-in { display: block; }

/* ---------- advancements ---------- */
/* one top-right layout: advancement + recipe toasts, then effect tiles, then pickup text; each block flows under the one above, so nothing overlaps */
.tr-stack { position: absolute; right: calc(var(--gui) * 4px); top: calc(var(--gui) * 4px); display: flex; flex-direction: column; align-items: flex-end; gap: calc(var(--gui) * 2px); width: min(calc(var(--gui) * 150px), 56vw); max-height: calc(100% - var(--gui) * 60px); overflow: hidden; pointer-events: none; }
body.touch .tr-stack { top: calc(var(--tb, 44px) + var(--gap, 10px) * 2 + env(safe-area-inset-top, 0px)); right: calc(var(--gap, 10px) + env(safe-area-inset-right, 0px)); }
.adv-toasts, .fx-slot, .pickups { display: flex; flex-direction: column; align-items: flex-end; gap: calc(var(--gui) * 2px); max-width: 100%; }
.adv-toasts:empty, .fx-slot:empty, .pickups:empty { display: none; }
.pk { display: flex; align-items: center; gap: calc(var(--gui) * 2px); padding: var(--px) calc(var(--gui) * 4px) var(--px) calc(var(--gui) * 2px); background: rgba(14, 10, 22, 0.6); border-right: calc(var(--px) * 2) solid var(--accent, #e8b850); text-shadow: var(--outline); white-space: nowrap; animation: pkin 0.2s ease-out; transition: opacity 0.6s, transform 0.6s; }
.pk img { width: calc(var(--gui) * 10px); height: calc(var(--gui) * 10px); image-rendering: pixelated; }
.pk .pn { color: #7cf07c; font-weight: 700; } .pk .pt { color: #fff; }
.pk.bump { transform: scale(1.08); transform-origin: right center; }
.pk.out { opacity: 0; transform: translateX(calc(var(--gui) * 6px)); }
@keyframes pkin { from { opacity: 0; transform: translateX(calc(var(--gui) * 8px)); } }
.adv-toast { display: flex; gap: calc(var(--gui) * 4px); align-items: center; background: #212029; border: var(--px) solid #000; box-shadow: inset var(--px) var(--px) 0 #4a4458, inset calc(var(--px) * -1) calc(var(--px) * -1) 0 #121016;
  padding: calc(var(--gui) * 3px) calc(var(--gui) * 6px) calc(var(--gui) * 3px) calc(var(--gui) * 3px); min-width: min(calc(var(--gui) * 150px), 100%); box-sizing: border-box; animation: advin 0.5s ease-out; transition: transform 0.5s, opacity 0.5s; }
.adv-toast img { width: calc(var(--gui) * 16px); height: calc(var(--gui) * 16px); }
.adv-toast .ah { color: #ffe08a; text-shadow: var(--px) var(--px) 0 #000; }
.adv-toast.goal .ah { color: #9ae0ff; } .adv-toast.challenge .ah { color: #e0a0ff; }
.adv-toast .at { color: #fff; text-shadow: var(--px) var(--px) 0 #000; }
.adv-toast.out { transform: translateX(120%); opacity: 0; }
@keyframes advin { from { transform: translateX(120%); } to { transform: none; } }
.adv-screen { min-width: min(92vw, calc(var(--gui) * 260px)); }
.adv-tree { max-height: 62vh; overflow-y: auto; display: flex; flex-direction: column; gap: var(--px); margin: calc(var(--gui) * 3px) 0; }
.adv-node { display: flex; gap: calc(var(--gui) * 4px); align-items: center; padding: calc(var(--gui) * 2px) calc(var(--gui) * 4px); background: #1c1924; border-left: calc(var(--px) * 2) solid #3a3446; }
.adv-node img { width: calc(var(--gui) * 16px); height: calc(var(--gui) * 16px); }
.adv-node.earned { border-left-color: #ffb347; background: #2a2433; }
.adv-node.earned.goal { border-left-color: #7af0ff; } .adv-node.earned.challenge { border-left-color: #d080ff; }
.adv-node.next { opacity: 0.45; } .adv-node.next img { filter: brightness(0) invert(0.35); }
.anvil-name { margin-bottom: calc(var(--gui) * 4px); }
.anvil-cost { min-width: calc(var(--gui) * 16px); text-align: center; color: #8aff6a; font-size: 1.4em; text-shadow: var(--px) var(--px) 0 #000; }
.anvil-cost.bad { color: #ff5a5a; }
.trade-list { display: flex; flex-direction: column; gap: calc(var(--gui) * 2px); max-height: 40vh; overflow-y: auto; margin-bottom: calc(var(--gui) * 4px); }
.trade-row { display: flex; align-items: center; gap: calc(var(--gui) * 4px); padding: calc(var(--gui) * 2px); background: #221e2a; cursor: pointer; pointer-events: auto; }
.trade-row:hover { background: #3a3450; } .trade-row.out { opacity: 0.4; }
.trade-honor { font-size: calc(var(--gui) * 6px); color: #f5c85c; text-align: center; padding: calc(var(--gui) * 2px) calc(var(--gui) * 4px); background: rgba(245, 200, 92, 0.08); border-bottom: 1px solid rgba(245, 200, 92, 0.25); letter-spacing: 0.04em; }
.trade-row.special-saved { border-left: 2px solid #f5c85c; }
.trade-row.special-deed { border-left: 2px solid #e87a4a; }
.trade-row.special-leader { border-left: 2px solid #c084fc; }
.trade-row.special-caravan { border-left: 2px solid #5ad4c8; }
.trade-tag { margin-left: auto; color: #f5c85c; font-size: calc(var(--gui) * 7px); padding-right: calc(var(--gui) * 2px); }
.trade-credit-note { font-size: calc(var(--gui) * 5px); color: #e8b86a; margin-left: calc(var(--gui) * 3px); }
.trade-comm-txt { font-size: calc(var(--gui) * 6px); color: #e8d8b0; padding: calc(var(--gui) * 2px) calc(var(--gui) * 3px); }
.trade-comm.ready { border-left: 2px solid #8aff6a; background: rgba(138, 255, 106, 0.1); }
.trade-debt { border-left: 2px solid #f0a050; background: rgba(240, 160, 80, 0.1); }
.trade-xp { height: calc(var(--gui) * 3px); background: #101410; } .trade-xp div { height: 100%; background: #8aff6a; }
.title-screen.quiet { cursor: pointer; background: radial-gradient(ellipse at 50% 120%, #ff7a2033, transparent 60%), #07060b; }
.title-screen.quiet .logo { animation: emerge 4s ease-out, float 6s ease-in-out 4s infinite; }
@keyframes emerge { from { opacity: 0; letter-spacing: 0.5em; filter: blur(6px); } to { opacity: 1; } }
.off-hud { position: absolute; left: calc(var(--slot) * -1.4); bottom: var(--px); background: rgba(28, 25, 36, 0.6); }
.offhand { margin-top: calc(var(--gui) * 4px); }
.beacon-rows { display: flex; flex-direction: column; gap: calc(var(--gui) * 3px); margin-bottom: calc(var(--gui) * 4px); }
.beacon-row { display: flex; gap: calc(var(--gui) * 3px); } .beacon-row.off { opacity: 0.25; }
.beacon-fx { font: inherit; font-size: 1.6em; width: calc(var(--slot) * 1.2); height: calc(var(--slot) * 1.2); background: #1c1924; border: var(--px) solid #000; cursor: pointer; text-shadow: 0 0 calc(var(--gui) * 3px) currentColor; }
.beacon-fx.on { background: #3a3450; outline: calc(var(--px) * 2) solid #bff8ff; }
.fx-row { position: absolute; right: calc(var(--gui) * 4px); bottom: calc(var(--gui) * 4px); display: flex; gap: calc(var(--gui) * 4px); font-size: 1.6em; text-shadow: 0 0 calc(var(--gui) * 3px) currentColor; }
.title-screen.quiet { background: radial-gradient(ellipse at 50% 55%, rgba(7, 6, 11, 0.15), rgba(7, 6, 11, 0.85) 75%) !important; }
.screen-wrap:has(.title-screen) { background: transparent; }
/* classic front page: no animation, textured background, glowing name, plain pixel text */
.title-screen.classic { background-size: 64px 64px; image-rendering: pixelated; cursor: pointer; justify-content: flex-start; padding-top: 14vh; gap: calc(var(--gui) * 10px); animation: none !important; }
.title-screen.classic .logo { animation: none !important; letter-spacing: 0.08em; color: #ffb347;
  text-shadow: calc(var(--px) * 3) calc(var(--px) * 3) 0 #3a1a00, 0 0 calc(var(--gui) * 10px) #ff8a20aa, 0 0 calc(var(--gui) * 24px) #ff6a0066; }
.title-screen.classic .title-hint { color: #e8e0d8; font-size: 1.2em; text-shadow: var(--px) var(--px) 0 #000; margin-top: calc(var(--gui) * 20px); }
.title-screen.classic .title-ver { position: absolute; left: calc(var(--gui) * 3px); bottom: calc(var(--gui) * 2px); color: #fff; text-shadow: var(--px) var(--px) 0 #000; font-size: 0.9em; }
.screen-wrap:has(.title-screen.classic) { background: transparent; }
.book-btn { cursor: pointer; align-self: flex-start; }
.recipe-book { display: grid; grid-template-columns: repeat(9, var(--slot)); max-height: calc(var(--slot) * 3); overflow-y: auto; margin-bottom: calc(var(--gui) * 4px); background: #15121b; }
.recipe-book.hidden { display: none; }
.recipe-book .slot { cursor: pointer; } .recipe-book .slot.cant { opacity: 0.35; }

/* ---------- touch / mobile (src/touch.js, src/mobile.js) ---------- */
#boot .b-fatal { font-size: 64px; color: #ffb347; text-shadow: 0 0 12px #ff7a20; }
body.touch { touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; overscroll-behavior: none; position: fixed; inset: 0; overflow: hidden; }
body.touch .panel, body.touch .recipe-book, body.touch .adv-tree, body.touch .chat .log { touch-action: pan-y; -webkit-overflow-scrolling: touch; }
body.touch .btn, body.touch .ench-btn, body.touch button, body.touch input { touch-action: manipulation; }
body.touch .slot:hover { background: var(--slot-bg); }
body.touch .hotbar .slot { pointer-events: auto; touch-action: none; }
body.touch .hud .bottom { bottom: calc(var(--gui) * 2px + env(safe-area-inset-bottom, 0px)); }
body.touch .chat { padding-left: env(safe-area-inset-left, 0px); }
#touch { --tb: clamp(42px, 8.5vmin, 64px); --gap: clamp(6px, 1.6vmin, 12px);
  position: fixed; inset: 0; z-index: 1; touch-action: none; pointer-events: auto;
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px); }
#touch.hide { display: none; }
body.touch #ui { z-index: 2; }
#touch-top { position: fixed; inset: 0; z-index: 60; pointer-events: none; }
.t-btn { position: absolute; width: var(--tb); height: var(--tb); display: flex; align-items: center; justify-content: center; pointer-events: auto; touch-action: none;
  background: rgba(20, 16, 28, 0.42); box-shadow: inset 2px 2px 0 rgba(255, 255, 255, 0.16), inset -2px -2px 0 rgba(0, 0, 0, 0.45), 0 0 0 2px rgba(0, 0, 0, 0.55); }
.t-btn img { width: 56%; height: 56%; image-rendering: pixelated; pointer-events: none; opacity: 0.92; }
.t-btn.down { background: rgba(120, 96, 56, 0.6); box-shadow: inset -2px -2px 0 rgba(255, 255, 255, 0.16), inset 2px 2px 0 rgba(0, 0, 0, 0.45), 0 0 0 2px rgba(0, 0, 0, 0.55); }
.t-btn.big { --tb2: calc(var(--tb) * 1.35); width: var(--tb2); height: var(--tb2); }
/* landscape: right thumb cluster, menu row along the top */
.t-jump { right: calc(var(--gap) * 2 + env(safe-area-inset-right, 0px)); bottom: calc(var(--gap) * 3 + env(safe-area-inset-bottom, 0px)); }
.t-sneak { right: calc(var(--gap) * 3 + var(--tb) * 1.35 + env(safe-area-inset-right, 0px)); bottom: calc(var(--gap) * 2 + env(safe-area-inset-bottom, 0px)); }
.t-swap { right: calc(var(--gap) * 2 + env(safe-area-inset-right, 0px)); bottom: calc(var(--gap) * 4 + var(--tb) * 1.35 + env(safe-area-inset-bottom, 0px)); }
.t-drop { right: calc(var(--gap) * 3 + var(--tb) * 1.35 + env(safe-area-inset-right, 0px)); bottom: calc(var(--gap) * 3 + var(--tb) + env(safe-area-inset-bottom, 0px)); }
.t-inv { right: calc(var(--gap) * 3 + var(--tb) * 1.35 + env(safe-area-inset-right, 0px)); bottom: calc(var(--gap) * 4 + var(--tb) * 2 + env(safe-area-inset-bottom, 0px)); }
.t-btn.top { --tb: clamp(34px, 6.5vmin, 48px); top: calc(var(--gap) + env(safe-area-inset-top, 0px)); }
.t-pause { right: calc(var(--gap) + env(safe-area-inset-right, 0px)); }
.t-chat { right: calc(var(--gap) * 2 + var(--tb) + env(safe-area-inset-right, 0px)); }
.t-aim { right: calc(var(--gap) * 3 + var(--tb) * 2 + env(safe-area-inset-right, 0px)); }
.t-full { left: calc(var(--gap) + env(safe-area-inset-left, 0px)); }
.t-full.a2hs img { opacity: 0.6; }
.t-close { right: calc(12px + env(safe-area-inset-right, 0px)); top: calc(12px + env(safe-area-inset-top, 0px)); display: none; z-index: 61; }
.t-close.show { display: flex; }
/* floating joystick: shows where the left thumb lands */
.t-stick { position: absolute; display: none; background-size: 100% 100%; image-rendering: pixelated; pointer-events: none; }
.t-stick.live { display: block; }
.t-stick.sprint { filter: drop-shadow(0 0 6px #ffb347) brightness(1.3); }
.t-knob { position: absolute; left: 50%; top: 50%; width: 42%; height: 42%; transform: translate(-50%, -50%);
  background: rgba(242, 230, 200, 0.55); box-shadow: inset 2px 2px 0 rgba(255, 255, 255, 0.5), inset -2px -2px 0 rgba(0, 0, 0, 0.4), 0 0 0 2px #000a; }
/* portrait: compact, lifted above the hotbar */
@media (orientation: portrait) {
  #touch { --tb: clamp(40px, 11vmin, 56px); --lift: calc(var(--gui) * 44px + env(safe-area-inset-bottom, 0px)); }
  .t-jump { bottom: calc(var(--lift) + var(--gap)); }
  .t-sneak { bottom: calc(var(--lift) + var(--gap)); }
  .t-swap { bottom: calc(var(--lift) + var(--gap) * 2 + var(--tb) * 1.35); }
  .t-drop { bottom: calc(var(--lift) + var(--gap) * 2 + var(--tb)); }
  .t-inv { bottom: calc(var(--lift) + var(--gap) * 3 + var(--tb) * 2); }
}
/* add-to-home-screen hint (iPhone Safari has no element fullscreen): share, then add */
.t-a2hs { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 70; display: none; gap: 14px; padding: 10px 16px;
  font: 28px var(--font); color: #f2e6c8; background: rgba(20, 16, 28, 0.85); box-shadow: 0 0 0 2px #000, inset 2px 2px 0 rgba(255, 255, 255, 0.16); }
.t-a2hs.show { display: flex; }
.cursor-stack { pointer-events: none; }
.slot.drag-over { background: #4a4060; box-shadow: inset 0 0 0 var(--px) #ffe08a; }

/* readable numbers: stack counts, levels, costs */
.slot .count, .lvl, .anvil-cost, .trade-row .count { font-family: 'Monocraft', monospace; font-weight: 700; letter-spacing: 0;
  text-shadow: var(--px) var(--px) 0 #000, calc(var(--px) * -1) 0 0 #000, 0 calc(var(--px) * -1) 0 #000, var(--px) 0 0 #000; }
.slot .count { font-size: 1.05em; right: calc(var(--px) * 1.5); bottom: var(--px); }
/* the slot under the pointer is lit, like the classic inventory */
.slot:hover::after { content: ''; position: absolute; inset: 0; background: rgba(255, 255, 255, 0.28); pointer-events: none; }

/* ---------- UX pass 2026-11-26 (ui.js owner) ---------- */
.glyph { width: calc(var(--gui) * 7px); height: calc(var(--gui) * 7px); image-rendering: pixelated; vertical-align: middle; filter: drop-shadow(var(--px) var(--px) 0 #000); }
.glyph-btn { display: flex; align-items: center; justify-content: center; min-height: calc(var(--gui) * 18px); }
.glyph-btn .glyph { width: calc(var(--gui) * 9px); height: calc(var(--gui) * 9px); }
.slot.trash .glyph { width: calc(var(--gui) * 10px); height: calc(var(--gui) * 10px); }
.tooltip { white-space: nowrap; }
/* durability bar and count like classic: the bar hugs the bottom edge, the count sits above it */
.slot .dur { left: calc(var(--gui) * 2px); right: calc(var(--gui) * 3px); bottom: calc(var(--gui) * 2px); height: calc(var(--gui) * 2px); }
/* kiln: the flame burns down, the arrow fills; both glow while working */
.flame.lit { filter: drop-shadow(0 0 calc(var(--gui) * 3px) #ff8a20); animation: flick 0.6s steps(2) infinite; }
@keyframes flick { 50% { filter: drop-shadow(0 0 calc(var(--gui) * 4px) #ffb347) brightness(1.15); } }
.prog.lit { filter: drop-shadow(0 0 calc(var(--gui) * 2px) #ffe0a0); }
/* creative: icon tabs, search, palette, inventory with a bin beside the hotbar */
.ctabs { display: flex; gap: var(--px); margin-bottom: calc(var(--gui) * 3px); }
.ctab { cursor: pointer; opacity: 0.6; }
.ctab.on { opacity: 1; background: #3c3650; box-shadow: inset 0 calc(var(--px) * -2) 0 var(--accent); }
.ctab.inv-tab { margin-left: auto; }
.creative-foot { display: flex; align-items: flex-end; gap: calc(var(--gui) * 4px); }
.creative-btn { cursor: pointer; }
/* death: big title, score number, two glyph buttons */
.death .score { color: #ffe08a; font-size: 1.3em; text-shadow: var(--px) var(--px) 0 #000; }
.death .btn.glyph-btn { display: flex; }
.btn.glyph-label .glyph { margin-right: calc(var(--gui) * 3px); }
/* colour-blind aids (Options: Colour Aids, Palette) */
.title-hardcore { position: absolute; right: calc(var(--gui) * 6px); bottom: calc(var(--gui) * 6px); padding: calc(var(--gui) * 3px); cursor: pointer; opacity: 0.35; }
.title-hardcore .glyph { width: calc(var(--gui) * 12px); height: calc(var(--gui) * 12px); }
.title-hardcore.on { opacity: 1; filter: drop-shadow(0 0 calc(var(--gui) * 3px) #ff4a4a); }
.power-cue { position: absolute; left: calc(50% + var(--gui) * 8px); top: calc(50% + var(--gui) * 4px); color: #fff; text-shadow: var(--px) var(--px) 0 #000; font-weight: 700; }
.slot .bfill { position: absolute; left: calc(var(--gui) * 2px); right: calc(var(--gui) * 3px); top: calc(var(--gui) * 1px); height: calc(var(--gui) * 2px); background: #000; pointer-events: none; }
.slot .bfill div { height: 100%; background: repeating-linear-gradient(90deg, #f2ecdf 0 var(--px), #8a8198 var(--px) calc(var(--px) * 2)); }
body.cb-aids .slot .dur.low div { background-image: repeating-linear-gradient(90deg, transparent 0 var(--px), #000 var(--px) calc(var(--px) * 2)) !important; }
body.cb-aids .bbar div { background-image: repeating-linear-gradient(45deg, rgba(0,0,0,0.35) 0 calc(var(--px) * 2), transparent calc(var(--px) * 2) calc(var(--px) * 4)); }
body.cb-aids .anvil-cost.bad { text-decoration: line-through; }
body.cb-aids .ench-btn.off .cost::before { content: '✕ '; }
/* deutan / protan: meaning colours moved off the red-green axis (blue = good, orange = bad) */
body.cb-deut .anvil-cost, body.cb-prot .anvil-cost, body.cb-deut .ench-btn .cost, body.cb-prot .ench-btn .cost { color: #6ab0ff; }
body.cb-deut .anvil-cost.bad, body.cb-prot .anvil-cost.bad { color: #ffa040; }
body.cb-deut .xpfill, body.cb-prot .xpfill { background: linear-gradient(#9ad0ff, #3a80e0); }
body.cb-deut .lvl, body.cb-prot .lvl { color: #9ad0ff; }
body.cb-deut .trade-xp div, body.cb-prot .trade-xp div { background: #6ab0ff; }
body.cb-prot .hearts img, body.cb-prot .hurt { filter: saturate(1.4) brightness(1.15); }
/* bundle tooltip: what is inside as a small icon grid with counts */
.bundle-tip { display: grid; grid-template-columns: repeat(4, calc(var(--gui) * 12px)); gap: var(--px); margin: calc(var(--gui) * 2px) 0; }
.bundle-tip .bt { position: relative; width: calc(var(--gui) * 12px); height: calc(var(--gui) * 12px); background: #1c1924; }
.bundle-tip .bt img { width: 100%; height: 100%; }
.bundle-tip .bt i { position: absolute; right: 0; bottom: calc(var(--px) * -1); font-style: normal; font-size: 0.8em; text-shadow: var(--px) var(--px) 0 #000; }
/* bundles: family glyph, count badge, a pop when something goes in; the pickup cue flies into the sack */
.slot .count.badge { background: rgba(10, 8, 16, 0.75); padding: 0 calc(var(--px) * 1.5); border-radius: 0; }
.slot .fam { position: absolute; left: calc(var(--px) * 1.5); top: 0; font-size: 0.85em; color: #ffe8b0; text-shadow: var(--px) var(--px) 0 #000; pointer-events: none; }
.slot.pop img { animation: bpop 0.3s ease-out; }
@keyframes bpop { 40% { transform: scale(1.25); } }
.stow-cue { position: absolute; left: 50%; bottom: calc(var(--slot) + var(--gui) * 40px); transform: translateX(-50%); display: flex; gap: calc(var(--gui) * 6px); opacity: 0; pointer-events: none; }
.stow-cue img { width: calc(var(--gui) * 14px); height: calc(var(--gui) * 14px); }
.stow-cue.go { animation: stowfade 1.1s forwards; }
.stow-cue.go .from { animation: stowfly 0.7s ease-in forwards; }
@keyframes stowfade { 0%, 75% { opacity: 1; } 100% { opacity: 0; } }
@keyframes stowfly { 0% { transform: translateX(0) scale(1); } 100% { transform: translateX(calc(var(--gui) * 20px)) scale(0.3); opacity: 0; } }
/* sort: a glyph button by the label; after sorting it offers the undo */
.inv-head { display: flex; align-items: center; justify-content: space-between; }
.sort-btn { cursor: pointer; width: calc(var(--slot) * 0.8); height: calc(var(--slot) * 0.8); }
.sort-btn.undo { box-shadow: inset 0 0 0 var(--px) var(--accent); }
.slot.sort-btn .glyph { width: calc(var(--gui) * 8px); height: calc(var(--gui) * 8px); }
/* hold-over bundling: a sack grows in the slot while a family thing is held over it */
.slot.bundling::before { content: ''; position: absolute; inset: 15%; z-index: 2; pointer-events: none; border-radius: 40% 40% 45% 45%;
  background: radial-gradient(circle at 50% 60%, #c8a070 0 55%, #6a4a28 56% 62%, transparent 63%); animation: sackgrow 0.6s linear forwards; opacity: 0.85; }
@keyframes sackgrow { from { transform: scale(0.1); } to { transform: scale(1); } }
/* a bundle's tooltip is pinned by its slot and its icons can be clicked; holding right-click spills it */
.tooltip.pin { pointer-events: auto; }
.tooltip.pin .bt { cursor: pointer; }
.tooltip.pin .bt:hover { outline: var(--px) solid #ffe08a; }
.slot.spilling::before { content: ''; position: absolute; inset: 0; z-index: 2; pointer-events: none; background: conic-gradient(rgba(255, 224, 138, 0.45) 0 var(--sp, 0%), transparent 0); animation: spill 0.6s linear forwards; }
@property --sp { syntax: '<percentage>'; inherits: false; initial-value: 0%; }
@keyframes spill { to { --sp: 100%; } }
/* the pile: paged like a chest; its notice; the arrow back to the last death pile */
.pile-nav { display: flex; align-items: center; gap: calc(var(--gui) * 2px); }
.pile-pg { cursor: pointer; width: calc(var(--slot) * 0.8); height: calc(var(--slot) * 0.8); color: var(--text); }
.pile-num { min-width: calc(var(--gui) * 16px); text-align: center; color: var(--dim); }
.pile-toast img { width: calc(var(--gui) * 12px); height: calc(var(--gui) * 12px); vertical-align: middle; margin-right: calc(var(--gui) * 2px); }
.death-arrow { position: absolute; left: calc(50% + var(--slot) * 5.2); bottom: calc(var(--gui) * 6px); display: none; flex-direction: column; align-items: center; color: #ff8a7a; text-shadow: var(--px) var(--px) 0 #000; }
.death-arrow .a { display: inline-block; font-size: 1.4em; line-height: 1; }
.death-arrow .d { font-size: 0.8em; }
/* book stacks: spines in the pinned tooltip (colour = category, glow = rarity, pips = quality) */
.bundle-tip.books { grid-template-columns: repeat(16, calc(var(--gui) * 4px)); gap: var(--px); }
.bundle-tip .bt.spine { width: calc(var(--gui) * 4px); height: calc(var(--gui) * 14px); background: var(--c); box-shadow: inset calc(var(--px) * -1) 0 0 rgba(0,0,0,0.4); }
.bundle-tip .bt.spine.r1, .bundle-tip .bt.spine.r2, .bundle-tip .bt.spine.r3, .bundle-tip .bt.spine.r4 { box-shadow: 0 0 calc(var(--gui) * 2px) var(--g), inset 0 0 0 var(--px) var(--g); }
.bundle-tip .bt.spine .q { position: absolute; left: 0; right: 0; bottom: 0; font-size: 0.6em; line-height: 0.8; color: #ffe8a0; text-align: center; writing-mode: vertical-rl; }
/* nested containers in the tooltip: a marked child opens on click, ◂ backs up; the stats line under the name */
.bundle-tip .crumb { cursor: pointer; color: #ffe08a; padding: 0 calc(var(--gui) * 2px); align-self: center; }
.bundle-tip .bt.sub { outline: var(--px) dashed #ffe08a; }
.bundle-tip .bt.spine.folio { height: calc(var(--gui) * 11px); align-self: end; }
.bundle-tip .bt.spine.has::after { content: ''; position: absolute; left: 25%; right: 25%; top: 20%; height: var(--px); background: #e8dcc0; }
.tooltip .stats { letter-spacing: 0.05em; white-space: normal; }
.ench-cols { flex: 1; display: flex; flex-direction: column; gap: calc(var(--gui) * 3px); }
.book-opts:empty { display: none; }
.book-offer .glyphs { font-weight: 700; letter-spacing: 0.1em; }
/* rich tooltips: rarity-coloured name, quality badge, stat rows with arrows, container quality bar */
.tooltip .tip-head { display: flex; align-items: center; gap: calc(var(--gui) * 3px); }
.tooltip .rar.r0 { color: #f2ecdf; } .tooltip .rar.r1 { color: #6ad06a; } .tooltip .rar.r2 { color: #4aa8ff; } .tooltip .rar.r3 { color: #c070ff; } .tooltip .rar.r4 { color: #ffb347; }
.tooltip .kind { opacity: 0.8; }
.qbadge { font-size: 0.75em; letter-spacing: -0.05em; }
.qbadge.q0 { color: #8a7a6a; } .qbadge.q1 { color: #c8c0b0; } .qbadge.q2 { color: #8ad0ff; } .qbadge.q3 { color: #ffd060; text-shadow: 0 0 calc(var(--gui) * 2px) #ffb347; }
.tooltip .stat-rows { color: #e8e0d0; font-size: 0.9em; word-spacing: 0.3em; }
.tooltip .up { color: #6ad06a; } .tooltip .down { color: #ff6a5a; } .tooltip .up.vs, .tooltip .down.vs { font-size: 0.7em; vertical-align: super; }
body.cb-deut .tooltip .up, body.cb-prot .tooltip .up { color: #6ab0ff; } body.cb-deut .tooltip .down, body.cb-prot .tooltip .down { color: #ffa040; }
.tooltip .qsum { display: flex; align-items: center; gap: calc(var(--gui) * 2px); margin: var(--px) 0; }
.tooltip .qbar { display: flex; flex: 1; min-width: calc(var(--gui) * 30px); height: calc(var(--gui) * 2px); background: #000; }
.tooltip .qbar i { display: block; height: 100%; } .qbar .q0 { background: #8a7a6a; } .qbar .q1 { background: #c8c0b0; } .qbar .q2 { background: #8ad0ff; } .qbar .q3 { background: #ffd060; }
.tooltip .teaches .unk { opacity: 0.4; } .tooltip img.pg { width: calc(var(--gui) * 8px); height: calc(var(--gui) * 8px); vertical-align: middle; }
.tooltip.sub-tip { z-index: 61; }
/* slots: a thin corner of the rarity colour on rare+, a tiny quality pip */
.slot.rar2 { box-shadow: inset 0 0 0 var(--px) #4aa8ff88, inset var(--px) var(--px) 0 var(--slot-lo); }
.slot.rar3 { box-shadow: inset 0 0 0 var(--px) #c070ffaa, inset var(--px) var(--px) 0 var(--slot-lo); }
.slot.rar4 { box-shadow: inset 0 0 0 var(--px) #ffb347cc, 0 0 calc(var(--gui) * 2px) #ffb34766; }
.slot .qpip { position: absolute; left: calc(var(--px) * 1.5); bottom: calc(var(--px) * 1.5); width: calc(var(--gui) * 2px); height: calc(var(--gui) * 2px); pointer-events: none; }
.slot .qpip.q0 { background: #8a7a6a; } .slot .qpip.q2 { background: #8ad0ff; } .slot .qpip.q3 { background: #ffd060; box-shadow: 0 0 var(--px) #ffb347; }

/* ---------- vibrant theme (Leif 2026-11-27: "the UI and icons need to look and feel more vibrant") ----------
   Dark slate panels with a gold trim, a faint woven texture and pixel bevels; brighter slot frames that glow on hover;
   vivid rarity colours; outlined Monocraft text; a livelier HUD. Overrides the base rules above, same pixel scale. */
:root {
  --panel: #2c2838; --panel-hi: #5a5270; --panel-lo: #120f18;
  --slot-bg: #1d1a27; --slot-hi: #4a4260; --slot-lo: #08060c;
  --gold: #e8b850; --gold-lo: #8a5a1a; --glow: #ffd88a;
  --text: #fff4e0; --dim: #b8aed0; --accent: #ffbf50; --accent2: #7af6ff;
  --outline: var(--px) 0 0 #000, calc(var(--px) * -1) 0 0 #000, 0 var(--px) 0 #000, 0 calc(var(--px) * -1) 0 #000;
}
.panel {
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.018) 0 var(--px), transparent var(--px) calc(var(--px) * 3)),
    radial-gradient(ellipse at 50% 0%, #3a3350 0%, var(--panel) 60%, #221e2c 100%);
  border: var(--px) solid #000;
  box-shadow: inset var(--px) var(--px) 0 var(--panel-hi), inset calc(var(--px) * -1) calc(var(--px) * -1) 0 var(--panel-lo),
    0 0 0 var(--px) var(--gold-lo), 0 0 0 calc(var(--px) * 2) #000, 0 calc(var(--gui) * 4px) calc(var(--gui) * 10px) rgba(0, 0, 0, 0.55);
  animation: panelin 0.14s ease-out;
}
@keyframes panelin { from { transform: scale(0.97); opacity: 0.6; } }
.label { color: var(--gold); text-shadow: var(--outline); }
.label.center { color: var(--text); }
.tooltip, .toast, .btn, .slot .count, .held-name, .chat .line, .lvl, .bname, .anvil-cost, .ench-btn { text-shadow: var(--outline); }
/* slots: a brighter frame, a warm glow under the pointer, a press */
.slot { background: linear-gradient(#221e2e, #17141f); }
.slot:hover { background: linear-gradient(#3a3352, #2a2440); box-shadow: inset var(--px) var(--px) 0 var(--slot-lo), inset calc(var(--px) * -1) calc(var(--px) * -1) 0 var(--slot-hi), 0 0 calc(var(--gui) * 3px) rgba(255, 216, 138, 0.35); z-index: 1; }
.slot:hover::after { background: rgba(255, 236, 190, 0.16); }
.slot:active img { transform: scale(0.92); }
.slot img { transition: transform 0.08s; filter: drop-shadow(0 var(--px) 0 rgba(0, 0, 0, 0.35)); }
.slot.ench img { filter: drop-shadow(0 0 calc(var(--gui) * 2px) #d080ff) saturate(1.2); }
.slot.rar2 { box-shadow: inset 0 0 0 var(--px) #4ab0ff, 0 0 calc(var(--gui) * 2px) #4ab0ff66; }
.slot.rar3 { box-shadow: inset 0 0 0 var(--px) #c878ff, 0 0 calc(var(--gui) * 3px) #c878ff88; }
.slot.rar4 { box-shadow: inset 0 0 0 var(--px) #ffbf50, 0 0 calc(var(--gui) * 4px) #ffbf50aa; animation: legend 2.4s ease-in-out infinite; }
@keyframes legend { 50% { box-shadow: inset 0 0 0 var(--px) #ffe08a, 0 0 calc(var(--gui) * 6px) #ffbf50cc; } }
.tooltip .rar.r1 { color: #7cf07c; } .tooltip .rar.r2 { color: #5ab8ff; } .tooltip .rar.r3 { color: #d088ff; } .tooltip .rar.r4 { color: #ffc95a; text-shadow: var(--outline), 0 0 calc(var(--gui) * 3px) #ffb347; }
.tooltip { background: linear-gradient(#1c1428f2, #120c1cf2); border-color: #7a4ac0; box-shadow: 0 0 0 var(--px) #000, 0 calc(var(--gui) * 2px) calc(var(--gui) * 6px) rgba(0, 0, 0, 0.5); }
/* buttons: gold-trimmed, lift on hover, press down */
.btn { background: linear-gradient(#6a6280, #4e4862); --hi: #9a90b8; --lo: #26222f; transition: transform 0.06s; }
.btn:hover { background: linear-gradient(#7c7ac0, #5c5a98); outline: var(--px) solid var(--glow); }
.btn:active, .ench-btn:active, .sort-btn:active, .ctab:active { transform: translateY(var(--px)); filter: brightness(0.9); }
.ench-btn { background: linear-gradient(#4a3466, #36264c); } .ench-btn:hover { background: linear-gradient(#6a48a0, #4a3270); }
/* toasts slide in */
.toast { background: linear-gradient(rgba(36, 26, 52, 0.92), rgba(20, 14, 30, 0.92)); border-color: var(--gold-lo); animation: toastin 0.25s ease-out; }
@keyframes toastin { from { transform: translateY(calc(var(--gui) * -6px)); opacity: 0; } }
/* HUD: brighter hotbar, a glowing selection, an XP bar that shines, hearts and food with a soft glow */
.hotbar { background: rgba(14, 10, 22, 0.6); box-shadow: 0 0 0 var(--px) #000, 0 0 0 calc(var(--px) * 2) rgba(232, 184, 80, 0.35); }
.hotbar .slot { background: rgba(32, 28, 44, 0.65); }
.hotbar .slot.sel { outline: calc(var(--px) * 2) solid #fff2c0; background: rgba(120, 92, 44, 0.65); box-shadow: 0 0 calc(var(--gui) * 4px) rgba(255, 210, 120, 0.75); }
.hearts img, .foods img, .armor img { filter: drop-shadow(0 0 var(--px) rgba(0, 0, 0, 0.8)) saturate(1.25); }
.hearts img.h { filter: drop-shadow(0 0 calc(var(--px) * 1.5) rgba(255, 40, 70, 0.55)) saturate(1.3); }
.xpfill { background: linear-gradient(#d8ff7a, #6ad020 60%, #3a9a10); position: relative; overflow: hidden; }
.xpfill::after { content: none; }   /* no sweeping shine on the XP bar (Leif) */
@keyframes shine { 60%, 100% { left: 110%; } }
.lvl { color: #b6ff5a; }
.held-name { color: #fff8e8; }
/* furnace and enchanting: livelier gauges */
.flame { background: linear-gradient(to top, #ffd040 0, #ff6a10 calc(var(--f) * 100%), #2a2430 calc(var(--f) * 100%)); }
.prog { background: linear-gradient(to right, #fff0c0 calc(var(--p) * 100%), #2a2430 calc(var(--p) * 100%)); }
/* trade rows and the title */
.trade-row { background: linear-gradient(#2a2436, #221e2c); } .trade-row:hover { background: linear-gradient(#3c3456, #2e2844); box-shadow: 0 0 calc(var(--gui) * 3px) rgba(255, 216, 138, 0.3); }
.title-screen.classic .logo { color: #ffc24a; text-shadow: calc(var(--px) * 3) calc(var(--px) * 3) 0 #3a1a00, 0 0 calc(var(--gui) * 12px) #ff9a30cc, 0 0 calc(var(--gui) * 28px) #ff6a0088; }
/* the cursor stack sits a little above the world */
.cursor-stack img { filter: drop-shadow(0 calc(var(--gui) * 2px) calc(var(--gui) * 2px) rgba(0, 0, 0, 0.6)); }
/* tooltip lines (src/tiplines.js): compact coloured rows, one layout for every kind of thing */
.tooltip .tl { line-height: 1.3; font-size: 0.92em; white-space: pre; }
.tooltip .tl.dim { font-size: 0.82em; opacity: 0.85; }
/* the pantry view of a basket: soonest to spoil first ('eat next' lit), a freshness bar and effect badges per food */
.bundle-tip.pantry { grid-template-columns: repeat(6, calc(var(--gui) * 14px)); }
.bundle-tip .bt.food { width: calc(var(--gui) * 14px); height: calc(var(--gui) * 15px); padding-bottom: calc(var(--gui) * 2px); }
.bundle-tip .bt.food.next { outline: var(--px) solid #ffe08a; box-shadow: 0 0 calc(var(--gui) * 3px) #ffd88a99; }
.bundle-tip .bt.food .fb { position: absolute; left: var(--px); right: var(--px); bottom: 0; height: calc(var(--px) * 1.5); background: #000; }
.bundle-tip .bt.food .fb u { display: block; height: 100%; }
.bundle-tip .bt.food .fx { position: absolute; left: 0; top: 0; font-size: 0.6em; text-decoration: none; line-height: 1; }
.bundle-tip .crumb { grid-column: 1 / -1; font-size: 0.8em; }
/* a container's next thing (used from the hand), small in the slot's corner */
.slot img.nx { position: absolute; left: var(--px); bottom: var(--px); width: calc(var(--gui) * 7px); height: calc(var(--gui) * 7px); filter: drop-shadow(0 0 var(--px) #000); }
/* active effects (src/effectsview.js): top-right tiles, gold border good, red bad, level, timer bar and time; blink in the last 10 s */
.fx-hud { position: static; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: calc(var(--gui) * 2px); max-width: 100%; pointer-events: none; }
.fxi { position: relative; width: calc(var(--gui) * 18px); height: calc(var(--gui) * 20px); background: rgba(16, 12, 24, 0.75); box-shadow: inset 0 0 0 var(--px) #000, 0 0 0 var(--px) #e8b850; display: flex; flex-direction: column; align-items: center; }
.fxi.bad { box-shadow: inset 0 0 0 var(--px) #000, 0 0 0 var(--px) #d03a3a; }
.fxi .g { font-size: 1.5em; line-height: 1.1; text-shadow: 0 0 calc(var(--gui) * 2px) currentColor, var(--outline); }
.fxi i { position: absolute; right: var(--px); top: 0; font-style: normal; font-size: 0.65em; color: #fff; text-shadow: var(--outline); }
.fxi b { display: block; width: 86%; height: calc(var(--px) * 1.5); background: #000; margin-top: auto; }
.fxi b u { display: block; height: 100%; background: #e8b850; } .fxi.bad b u { background: #d03a3a; }
.fxi em { font-style: normal; font-size: 0.6em; color: #e8e0d0; text-shadow: var(--outline); margin-bottom: var(--px); }
.fxi.blink, .fxp.blink { animation: fxblink 0.5s steps(2) infinite; }
@keyframes fxblink { 50% { opacity: 0.35; } }
/* the inventory's left-side effect list */
.inv-holder { display: flex; align-items: flex-start; gap: calc(var(--gui) * 4px); pointer-events: auto; }
.fx-panel { display: flex; flex-direction: column; gap: calc(var(--gui) * 2px); min-width: calc(var(--gui) * 70px); }
.fxp { display: flex; align-items: center; gap: calc(var(--gui) * 3px); padding: calc(var(--gui) * 2px) calc(var(--gui) * 4px); background: linear-gradient(#2c2838, #1e1a28); box-shadow: 0 0 0 var(--px) #000, inset 0 0 0 var(--px) #e8b85066; text-shadow: var(--outline); }
.fxp.bad { box-shadow: 0 0 0 var(--px) #000, inset 0 0 0 var(--px) #d03a3a88; }
.fxp .g { font-size: 1.4em; text-shadow: 0 0 calc(var(--gui) * 2px) currentColor, var(--outline); } .fxp .n { flex: 1; } .fxp em { font-style: normal; color: var(--dim); font-size: 0.85em; }
/* hearts and food by state; the screen edge under gloom and poison (kept subtle) */
.hearts img.h.poison { filter: drop-shadow(0 0 calc(var(--px) * 1.5) rgba(110, 200, 60, 0.6)); } .hearts img.h.wither { filter: drop-shadow(0 0 var(--px) #000) brightness(0.9); }
.hud.fx-gloom .vignette { background: radial-gradient(ellipse at center, transparent 35%, rgba(0, 0, 0, 0.75)); animation: gloompulse 3s ease-in-out infinite; }
@keyframes gloompulse { 50% { opacity: 0.7; } }
.hud.fx-poison .vignette { background: radial-gradient(ellipse at center, transparent 62%, rgba(40, 90, 20, 0.28)); }
/* the pantry: warm and fresh food glows (food never goes off) */
.bundle-tip .bt.food.w3 { box-shadow: 0 0 calc(var(--gui) * 3px) #ffb070cc; } .bundle-tip .bt.food.w2 { box-shadow: 0 0 calc(var(--gui) * 2px) #ffc89099; } .bundle-tip .bt.food.w1 { box-shadow: 0 0 calc(var(--gui) * 2px) #a8f0a066; }
.bundle-tip .bt.food .fw { position: absolute; right: 0; top: 0; font-style: normal; font-size: 0.6em; color: #ffd0a0; text-shadow: var(--outline); }
/* the wheel's selection inside a container */
.bundle-tip .bt.sel { outline: calc(var(--px) * 1.5) solid #ffe08a; box-shadow: 0 0 calc(var(--gui) * 3px) #ffd88aaa; z-index: 1; }
.held-name.sel-pop { color: #ffe8b0; }
/* effect tiles carry their English name now (the glyph only beside it) */
.fxi { width: auto; min-width: calc(var(--gui) * 40px); height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: calc(var(--gui) * 2px); padding: var(--px) calc(var(--gui) * 2px); }
.fxi .g { font-size: 1.2em; } .fxi .nm { font-size: 0.75em; color: #fff4e0; text-shadow: var(--outline); white-space: nowrap; }
.fxi b { width: 100%; margin-top: 0; } .fxi em { margin-left: auto; margin-bottom: 0; }
/* the Area panel (B): numbers for the player's spot */
.area-panel { position: absolute; left: calc(var(--gui) * 4px); top: calc(var(--gui) * 40px); display: none; min-width: calc(var(--gui) * 110px); background: rgba(16, 12, 24, 0.82); box-shadow: 0 0 0 var(--px) #000, inset 0 0 0 var(--px) #e8b85066; padding: calc(var(--gui) * 3px) calc(var(--gui) * 4px); font-size: 0.8em; text-shadow: var(--outline); pointer-events: none; }
.area-panel b { color: var(--gold); } .area-panel .ar { display: flex; gap: calc(var(--gui) * 3px); flex-wrap: wrap; } .area-panel .ar span { flex: 1; } .area-panel .ar em { font-style: normal; color: #fff4e0; } .area-panel .ar i { width: 100%; font-size: 0.8em; color: var(--dim); font-style: normal; }
/* the recipe book: left of the screen, tabs, search, 'can make now', entries (missing ones dim) */
.rbook { width: calc(var(--slot) * 6 + var(--gui) * 10px); max-height: 80vh; display: flex; flex-direction: column; gap: calc(var(--gui) * 2px); padding: calc(var(--gui) * 4px); pointer-events: auto;
  background: radial-gradient(ellipse at 50% 0%, #3a3350 0%, #2c2838 60%, #221e2c 100%); box-shadow: 0 0 0 var(--px) #000, 0 0 0 calc(var(--px) * 2) #8a5a1a; }
.rbook.hidden { display: none; }
.rb-tabs { display: flex; flex-wrap: wrap; gap: var(--px); } .rb-tab.on { background: linear-gradient(#8a7ac0, #5c5a98); outline: var(--px) solid #ffd88a; }
.rb-head { display: flex; gap: calc(var(--gui) * 2px); align-items: center; } .rb-search { flex: 1; margin: 0; }
.rb-list { display: grid; grid-template-columns: repeat(6, var(--slot)); overflow-y: auto; max-height: 56vh; }
.rb-list .rb-entry { cursor: pointer; } .rb-list .rb-entry.cant { opacity: 0.45; } .rb-list .rb-entry.cant::before { content: ''; position: absolute; inset: 0; box-shadow: inset 0 0 0 var(--px) #d03a3a88; }
.rb-empty { grid-column: 1 / -1; padding: calc(var(--gui) * 4px); }
/* title: who you are + shared worlds (src/ui.js titleProfiles) */
.title-screen.classic .title-who { position: absolute; top: calc(var(--gui) * 4px); left: calc(var(--gui) * 4px); color: #e8e0d8; text-shadow: var(--px) var(--px) 0 #000; cursor: pointer; padding: calc(var(--gui) * 2px) calc(var(--gui) * 4px); background: rgba(0, 0, 0, 0.35); border: var(--px) solid rgba(255, 255, 255, 0.2); }
.title-screen.classic .title-who:hover { color: #ffb347; }
.title-screen.classic .title-worlds { left: auto; right: calc(var(--gui) * 4px); }
.title-screen .title-pop { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); min-width: min(90vw, calc(var(--gui) * 160px)); max-height: 80vh; overflow-y: auto; cursor: default; display: flex; flex-direction: column; gap: calc(var(--gui) * 3px); z-index: 5; }
.title-screen .title-pop-list { display: flex; flex-direction: column; gap: calc(var(--gui) * 2px); }
.title-screen .title-pop-list .btn.on { outline: var(--px) solid #ffb347; }
.title-screen .title-pop-row { display: flex; gap: calc(var(--gui) * 2px); }
.title-screen .title-pop-input { flex: 1; font: inherit; padding: calc(var(--gui) * 2px); background: #000; color: #fff; border: var(--px) solid #888; }
.title-screen .title-pop-note { opacity: 0.6; font-size: 0.85em; }
/* touch: the hold timer under the finger (fills until a hold starts mining); no selection or callout anywhere */
.t-holdring { position: fixed; width: 54px; height: 54px; margin: -27px 0 0 -27px; border-radius: 50%; pointer-events: none; opacity: 0; z-index: 3;
  background: conic-gradient(rgba(255, 224, 138, 0.75) var(--hp, 0%), rgba(0, 0, 0, 0.25) 0); -webkit-mask: radial-gradient(circle, transparent 55%, #000 57%); mask: radial-gradient(circle, transparent 55%, #000 57%); }
.t-holdring.go { opacity: 1; animation: holdfill var(--hold, 380ms) linear forwards; }
@property --hp { syntax: '<percentage>'; inherits: false; initial-value: 0%; }
@keyframes holdfill { to { --hp: 100%; } }
body.touch, body.touch * { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
body.touch input { -webkit-user-select: text; user-select: text; }
html, body { touch-action: none; }
/* classic recipe unlocks: the toast, a dot on new recipes, the book button pulsing until opened */
.recipe-toast .ri { display: flex; gap: var(--px); margin-top: var(--px); } .recipe-toast .ri img { width: calc(var(--gui) * 12px); height: calc(var(--gui) * 12px); } .recipe-toast .rmore { color: #ffe08a; font-size: 0.8em; align-self: center; }
.rb-list .rb-entry.new::after { content: ''; position: absolute; right: var(--px); top: var(--px); width: calc(var(--gui) * 3px); height: calc(var(--gui) * 3px); background: #ffd060; box-shadow: 0 0 calc(var(--gui) * 2px) #ffb347; border-radius: 50%; }
.book-btn.pulse { animation: bookpulse 1.2s ease-in-out infinite; } @keyframes bookpulse { 50% { box-shadow: 0 0 calc(var(--gui) * 5px) #ffd060, inset 0 0 0 var(--px) #ffd060; } }

/* ---------- medieval theme (Leif 2026-11-28: "make the whole UI a lot more stylized and medieval and cool looking, like a real game") ----------
   Carved stone panels with iron studs, plank buttons with brass nails, iron-bound slots, parchment books, gilt trims:
   crisp pixel-art 9-slices painted by src/ui.js (FRAMES) into --f-stone / --f-wood / --f-parch / --f-slot / --f-gold.
   Meters are icons only (no numbers), items live in their slots (a-* classes and .fx overlays), fear stays unseen. */
:root {
  --stone: #2f2b3a; --stone-lo: #1c1a24; --wood: #7a4c22; --wood-lo: #4a2c14; --parch: #ecdfc4; --ink: #2a1a0c;
  --gold: #e8b850; --gold-lo: #8a5a1a; --gold-hi: #fff0a0; --iron: #c8ccd8; --blood: #c8202e;
  --text: #f4ead6; --dim: #b8aa98; --accent: var(--gold);
  --f5: calc(var(--gui) * 5px); --f3: calc(var(--gui) * 3px);
}
.panel, .btn, .slot, input, select { box-shadow: none; }
/* carved stone panels */
.panel {
  border: var(--f5) solid transparent; border-image: var(--f-stone) 5 repeat; image-rendering: pixelated;
  background:
    repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.14) 0 var(--px), transparent var(--px) calc(var(--gui) * 8px)),
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.1) 0 var(--px), transparent var(--px) calc(var(--gui) * 16px)),
    radial-gradient(ellipse at 50% 0%, #3a3548 0%, var(--stone) 60%, #231f2c 100%);
  background-clip: padding-box; padding: calc(var(--gui) * 6px); color: var(--text);
  box-shadow: 0 calc(var(--gui) * 5px) calc(var(--gui) * 14px) rgba(0, 0, 0, 0.7);
}
.title-screen .title-pop.panel { border-image: var(--f-stone) 5 repeat; }
.panel.book { border-image: var(--f-parch) 5 repeat; background: var(--parch); color: var(--ink); }
.panel.book .label { color: #5a2a10; text-shadow: none; }
/* headings: engraved gold with a chiselled shadow, the centred ones flanked by diamonds */
.label { color: var(--gold); font-weight: 700; letter-spacing: 0.06em; text-shadow: 0 var(--px) 0 #000, 0 calc(var(--px) * -1) 0 rgba(255, 240, 160, 0.25); }
.label.center { color: var(--gold-hi); font-size: 1.25em; margin-bottom: calc(var(--gui) * 4px); }
.label.center::before { content: '◆ '; color: var(--gold-lo); } .label.center::after { content: ' ◆'; color: var(--gold-lo); }
.dim { color: var(--dim); }
/* plank buttons with brass nails: lift on hover, press down */
.btn, .ench-btn, .beacon-fx {
  border: var(--f3) solid transparent; border-image: var(--f-wood) 3 repeat; image-rendering: pixelated;
  background: linear-gradient(#8e5c2c, var(--wood) 55%, #5e3a1a); background-clip: padding-box; color: #fff0d0;
  text-shadow: var(--px) var(--px) 0 #1a0e06; outline: none; transition: none; padding: calc(var(--gui) * 3px) calc(var(--gui) * 5px);
}
.btn:hover, .ench-btn:hover, .beacon-fx:hover { background: linear-gradient(#a8703a, #8a5a2c 55%, #6a4420); outline: var(--px) solid var(--gold); outline-offset: calc(var(--px) * -1); color: #fff8e8; filter: none; }
.btn:active, .ench-btn:active, .sort-btn:active, .ctab:active, .beacon-fx:active { transform: translateY(var(--px)); background: linear-gradient(#5e3a1a, #6a4420); filter: none; }
.btn:disabled { opacity: 0.45; filter: saturate(0.4); }
.btn.on, .title-pop-list .btn.on { outline: var(--px) solid var(--gold); }
.btn.danger:hover { background: linear-gradient(#8a3a2a, #6a2a1a); }
.ench-btn { background: linear-gradient(#4a3466, #36264c); } .ench-btn:hover { background: linear-gradient(#6a48a0, #4a3270); }
.ench-btn .cost { color: #9aff6a; }
/* iron-bound inputs */
input, select { background: #0c0a12; border: var(--px) solid #000; box-shadow: inset 0 0 0 var(--px) #3a3446, 0 0 0 var(--px) var(--gold-lo); color: var(--text); }
input:focus { box-shadow: inset 0 0 0 var(--px) #5a5268, 0 0 0 var(--px) var(--gold); border-color: #000; }
input[type=range] { box-shadow: none; background: transparent; accent-color: var(--gold); }
/* slots: a dark iron-bound recess; lit from above when hovered */
.slot { background: linear-gradient(#1a1722, #110e18); box-shadow: inset 0 0 0 var(--px) #000, inset var(--px) var(--px) 0 #050408, inset calc(var(--px) * -1) calc(var(--px) * -1) 0 #3a3446, 0 0 0 var(--px) #4a4458; }
.grid { gap: var(--px); background: #0b0910; padding: var(--px); box-shadow: 0 0 0 var(--px) #000, 0 0 0 calc(var(--px) * 2) var(--gold-lo); }
.grid.hot { margin-top: calc(var(--gui) * 5px); }
.grid.out, .armor-col, .offhand { box-shadow: 0 0 0 var(--px) #000, 0 0 0 calc(var(--px) * 2) var(--gold-lo); }
.slot:hover { background: linear-gradient(#3a3352, #2a2440); box-shadow: inset 0 0 0 var(--px) #000, inset var(--px) var(--px) 0 #050408, inset calc(var(--px) * -1) calc(var(--px) * -1) 0 #5a5268, 0 0 0 var(--px) var(--gold), 0 0 calc(var(--gui) * 4px) rgba(232, 184, 80, 0.45); }
.slot.rar2 { box-shadow: inset 0 0 0 var(--px) #4ab0ff, 0 0 0 var(--px) #4a4458, 0 0 calc(var(--gui) * 2px) #4ab0ff66; }
.slot.rar3 { box-shadow: inset 0 0 0 var(--px) #c878ff, 0 0 0 var(--px) #4a4458, 0 0 calc(var(--gui) * 3px) #c878ff88; }
.slot.rar4 { box-shadow: inset 0 0 0 var(--px) #ffbf50, 0 0 0 var(--px) #4a4458, 0 0 calc(var(--gui) * 4px) #ffbf50aa; }
.armor-slot:empty::after { border-color: #4a4458; }
.avatar { background: radial-gradient(ellipse at 50% 30%, #2a2638, #0b0910); box-shadow: inset 0 0 0 var(--px) #000, 0 0 0 var(--px) var(--gold-lo); }
/* stack counts on a riveted plate; a bundle's strap gauge */
.slot .count { font-family: 'Monocraft', monospace; font-weight: 700; font-size: 1em; color: #fff4e0; right: var(--px); bottom: var(--px); line-height: 1.15; padding: 0 calc(var(--px) * 1.5);
  background: rgba(12, 8, 18, 0.88); box-shadow: 0 0 0 var(--px) #000, inset 0 var(--px) 0 rgba(255, 255, 255, 0.14), inset 0 calc(var(--px) * -1) 0 rgba(0, 0, 0, 0.7); border-radius: 0; text-shadow: var(--px) var(--px) 0 #000; }
.slot .count.badge { background: rgba(50, 32, 16, 0.92); color: #ffe8b0; box-shadow: 0 0 0 var(--px) #000, inset 0 0 0 var(--px) var(--gold-lo); }
.slot .bfill { top: auto; bottom: calc(var(--gui) * 1.5px); left: calc(var(--gui) * 2px); right: calc(var(--gui) * 6px); height: calc(var(--gui) * 2px); background: #2a1a0c; box-shadow: 0 0 0 var(--px) #000; }
.slot .bfill div { background: linear-gradient(#ffd870, var(--gold) 60%, #b8882a); }
.slot .dur { box-shadow: 0 0 0 var(--px) #000; }
/* tooltips, toasts and small HUD cards: iron-bound dark glass */
.tooltip, .toast, .adv-toast, .pk, .fxi, .quest, .area-panel, .fxp, .pile-toast {
  border: var(--f3) solid transparent; border-image: var(--f-slot) 3 repeat; image-rendering: pixelated;
  background: linear-gradient(rgba(30, 24, 42, 0.94), rgba(14, 10, 22, 0.94)); background-clip: padding-box; box-shadow: 0 calc(var(--gui) * 2px) calc(var(--gui) * 6px) rgba(0, 0, 0, 0.55);
}
.tooltip { padding: calc(var(--gui) * 2px) calc(var(--gui) * 4px); }
.tooltip .tip-head .rar { font-weight: 700; letter-spacing: 0.03em; }
.toast { border-image: var(--f-wood) 3 repeat; background: linear-gradient(rgba(70, 44, 20, 0.92), rgba(40, 24, 10, 0.92)); color: #fff0d0; }
.toast.big { color: var(--gold-hi); } .toast.mod { color: var(--accent2); } .toast.err { color: #ff8a7a; }
.adv-toast { background: linear-gradient(#2a2538, #1a1624); background-clip: padding-box; }
.pk { border-right-width: var(--f3); border-image: var(--f-slot) 3 repeat; }
/* HUD: a wooden hotbar rack with a gilt mark on the held slot; the selected slot's old outline goes */
.hotbar { border: var(--f3) solid transparent; border-image: var(--f-wood) 3 repeat; image-rendering: pixelated; background: linear-gradient(rgba(74, 44, 20, 0.85), rgba(46, 28, 12, 0.85)); background-clip: padding-box; padding: 0; box-shadow: 0 calc(var(--gui) * 2px) calc(var(--gui) * 6px) rgba(0, 0, 0, 0.6); }
.hotbar .slot { background: rgba(20, 16, 28, 0.78); box-shadow: inset 0 0 0 var(--px) #000, inset var(--px) var(--px) 0 #050408, inset calc(var(--px) * -1) calc(var(--px) * -1) 0 #3a3446; }
.hotbar .slot.sel { outline: none; background: rgba(90, 64, 28, 0.85); box-shadow: inset 0 0 0 var(--px) #000, 0 0 calc(var(--gui) * 5px) rgba(255, 210, 120, 0.55); z-index: 2; }
.hotbar .slot.sel::before { content: ''; position: absolute; inset: calc(var(--gui) * -2px); border: var(--f3) solid transparent; border-image: var(--f-gold) 3 repeat; image-rendering: pixelated; pointer-events: none; z-index: 3; }
.off-hud { border: var(--f3) solid transparent; border-image: var(--f-wood) 3 repeat; image-rendering: pixelated; background: rgba(46, 28, 12, 0.85); background-clip: padding-box; width: calc(var(--slot) + var(--f3) * 2); height: calc(var(--slot) + var(--f3) * 2); left: calc(var(--slot) * -1.5 - var(--f3)); bottom: 0; }
/* the meters: 9px pixel icons, overlapping by a pixel like classic, no numbers anywhere on the HUD */
.stats { width: calc(var(--slot) * 9 + var(--f3) * 2); margin-bottom: calc(var(--gui) * 2px); }
.hearts, .foods, .armor, .bubbles { height: calc(var(--gui) * 10px); align-items: flex-end; }
.hearts img, .foods img, .armor img, .bubbles img { width: calc(var(--gui) * 9px); height: calc(var(--gui) * 9px); margin-right: calc(var(--gui) * -1px); filter: drop-shadow(0 var(--px) 0 rgba(0, 0, 0, 0.7)); }
.hearts img.h { filter: drop-shadow(0 var(--px) 0 rgba(0, 0, 0, 0.7)) drop-shadow(0 0 calc(var(--px) * 1.5) rgba(255, 40, 70, 0.35)); }
.hearts img.h.poison { filter: drop-shadow(0 var(--px) 0 rgba(0, 0, 0, 0.7)) drop-shadow(0 0 calc(var(--px) * 1.5) rgba(110, 200, 60, 0.5)); }
.hearts img.h.wither { filter: drop-shadow(0 var(--px) 0 rgba(0, 0, 0, 0.9)); }
.hearts img.low { animation: shake 0.3s infinite; }
.bubbles img.pop { animation: bubpop 0.35s steps(2) forwards; }
@keyframes bubpop { to { opacity: 0; transform: scale(1.4); } }
.lvl { display: none; }   /* the level is a number: the enchanting table shows it where it matters (.plvl) */
.xp { height: calc(var(--gui) * 5px); margin-bottom: calc(var(--gui) * 2px); background: repeating-linear-gradient(90deg, #0e120e 0 calc(var(--slot) - var(--px)), #000 calc(var(--slot) - var(--px)) var(--slot)); box-shadow: 0 0 0 var(--px) #000, 0 0 0 calc(var(--px) * 2) var(--gold-lo); }
.xpfill { background: linear-gradient(#e0ff8a, #7ad030 45%, #3a9a10); box-shadow: inset 0 var(--px) 0 rgba(255, 255, 255, 0.35); }
.bossbar { width: calc(var(--gui) * 182px); }
.bname { color: #ffe0b0; letter-spacing: 0.08em; text-shadow: var(--outline); }
.bbar { height: calc(var(--gui) * 6px); background: repeating-linear-gradient(90deg, #1a0a26 0 calc(var(--gui) * 17px), #000 calc(var(--gui) * 17px) calc(var(--gui) * 18px)); box-shadow: 0 0 0 var(--px) #000, 0 0 0 calc(var(--px) * 2) var(--gold-lo); }
.bbar div { background: linear-gradient(#f090ff, #9030d0 50%, #5a1890); box-shadow: inset 0 var(--px) 0 rgba(255, 255, 255, 0.35); }
.held-name { bottom: calc(var(--slot) + var(--gui) * 38px); color: var(--gold-hi); letter-spacing: 0.04em; text-shadow: var(--outline), 0 0 calc(var(--gui) * 4px) rgba(0, 0, 0, 0.9); }
.chat .line { background: rgba(10, 8, 16, 0.6); border-left: var(--px) solid var(--gold-lo); }
.chat .line.sys { color: #ffe0a0; }
.chat-in { background: rgba(10, 8, 16, 0.85); }
.crosshair::before, .crosshair::after { background: #f4ead6; }
/* active effects: icon tiles with a bar, never a timer number on the HUD; the inventory list keeps its words */
.fxi { padding: var(--px) calc(var(--gui) * 2px); min-width: 0; flex-direction: column; gap: var(--px); } .fxi em { display: none; } .fxi .nm { display: none; } .fxi .g { font-size: 1.4em; }
.fxi b { width: calc(var(--gui) * 10px); height: calc(var(--px) * 1.5); box-shadow: 0 0 0 var(--px) #000; }
.fxi b u { background: var(--gold); } .fxi.bad { border-image: var(--f-slot) 3 repeat; } .fxi.bad b u { background: #d03a3a; }
.fxi.good::after, .fxi.bad::after { content: ''; position: absolute; inset: 0; pointer-events: none; box-shadow: inset 0 0 0 var(--px) rgba(232, 184, 80, 0.5); } .fxi.bad::after { box-shadow: inset 0 0 0 var(--px) rgba(208, 58, 58, 0.6); }
.fxp { background: linear-gradient(#2c2838, #1e1a28); background-clip: padding-box; }
/* ---- living items: eyes blink, dials turn, flasks bubble, soul-things smoke, lights breathe, enchantments glint ---- */
.slot img { transition: none; }
.slot.a-eye img { animation: eyeblink 4.6s steps(1, end) infinite; animation-delay: var(--ad, 0s); }
@keyframes eyeblink { 0%, 86%, 100% { clip-path: inset(0); } 88% { clip-path: inset(22% 0 22% 0); } 89.5% { clip-path: inset(44% 0 44% 0); } 91.5% { clip-path: inset(22% 0 22% 0); } 93% { clip-path: inset(0); } }
.slot.a-spin img { animation: needle 3.4s ease-in-out infinite alternate; animation-delay: var(--ad, 0s); }
@keyframes needle { from { transform: rotate(-11deg); } to { transform: rotate(11deg); } }
.slot.a-glow img { animation: glowpulse 2.4s ease-in-out infinite; animation-delay: var(--ad, 0s); }
@keyframes glowpulse { 0%, 100% { filter: drop-shadow(0 0 var(--px) rgba(255, 180, 70, 0.4)); } 50% { filter: drop-shadow(0 0 calc(var(--gui) * 3px) rgba(255, 200, 90, 0.95)) brightness(1.18); } }
.slot.ench img { animation: none; filter: drop-shadow(0 0 calc(var(--gui) * 2px) #c070ff) saturate(1.15); }
.slot .fx { position: absolute; inset: 0; pointer-events: none; overflow: visible; }
.slot .fx.glint { -webkit-mask: var(--ico) center / calc(var(--gui) * 16px) calc(var(--gui) * 16px) no-repeat; mask: var(--ico) center / calc(var(--gui) * 16px) calc(var(--gui) * 16px) no-repeat;
  background: linear-gradient(115deg, transparent 38%, rgba(220, 170, 255, 0.55) 46%, rgba(255, 255, 255, 0.95) 50%, rgba(220, 170, 255, 0.55) 54%, transparent 62%); background-size: 260% 260%; mix-blend-mode: screen; animation: glintsweep 3s linear infinite; animation-delay: var(--ad, 0s); }
@keyframes glintsweep { from { background-position: 100% 100%; } to { background-position: 0% 0%; } }
.slot .fx.smoke::before, .slot .fx.smoke::after { content: ''; position: absolute; left: 50%; top: 55%; width: calc(var(--gui) * 2px); height: calc(var(--gui) * 2px); background: transparent;
  box-shadow: calc(var(--gui) * -4px) 0 0 rgba(120, 70, 160, 0.85), calc(var(--gui) * 3px) calc(var(--gui) * -3px) 0 rgba(80, 40, 120, 0.85), calc(var(--gui) * -1px) calc(var(--gui) * -6px) 0 rgba(160, 110, 200, 0.6); animation: smoke 2.6s linear infinite; animation-delay: var(--ad, 0s); }
.slot .fx.smoke::after { animation-delay: calc(var(--ad, 0s) - 1.3s); box-shadow: calc(var(--gui) * 4px) 0 0 rgba(120, 70, 160, 0.85), calc(var(--gui) * -2px) calc(var(--gui) * -4px) 0 rgba(80, 40, 120, 0.85), calc(var(--gui) * 2px) calc(var(--gui) * -7px) 0 rgba(160, 110, 200, 0.6); }
@keyframes smoke { 0% { transform: translateY(0); opacity: 0; } 15% { opacity: 1; } 100% { transform: translateY(calc(var(--gui) * -11px)); opacity: 0; } }
.slot .fx.bubbles::before, .slot .fx.bubbles::after { content: ''; position: absolute; left: 50%; top: 70%; width: var(--px); height: var(--px); background: transparent;
  box-shadow: calc(var(--gui) * -2px) 0 0 rgba(255, 255, 255, 0.9), calc(var(--gui) * 2px) calc(var(--gui) * -3px) 0 rgba(220, 240, 255, 0.8), 0 calc(var(--gui) * -6px) 0 rgba(255, 255, 255, 0.6); animation: bubbles 1.9s linear infinite; animation-delay: var(--ad, 0s); }
.slot .fx.bubbles::after { animation-delay: calc(var(--ad, 0s) - 1s); box-shadow: calc(var(--gui) * 1px) 0 0 rgba(255, 255, 255, 0.9), calc(var(--gui) * -3px) calc(var(--gui) * -4px) 0 rgba(220, 240, 255, 0.8); }
@keyframes bubbles { 0% { transform: translateY(0); opacity: 0; } 20% { opacity: 1; } 100% { transform: translateY(calc(var(--gui) * -8px)); opacity: 0; } }
/* screens: dark velvet behind, the title untouched; death in blood-red carved letters, the score as orbs */
.screen-wrap { background: radial-gradient(ellipse at center, rgba(8, 6, 14, 0.35), rgba(4, 3, 8, 0.7)); }
.screen-wrap.dark { background: radial-gradient(ellipse at center, rgba(8, 6, 14, 0.6), rgba(2, 1, 5, 0.88)); }
.death .dt { color: var(--blood); text-shadow: calc(var(--px) * 2) calc(var(--px) * 2) 0 #300, 0 0 calc(var(--gui) * 10px) rgba(200, 32, 46, 0.5); letter-spacing: 0.1em; font-family: 'Silkscreen', var(--font); font-size: 2.6em; }
.death .ds { color: #d8cfc0; }
.death .score { display: flex; justify-content: center; gap: calc(var(--gui) * 2px); min-height: calc(var(--gui) * 8px); }
.death .score .orb { display: block; width: calc(var(--gui) * 5px); height: calc(var(--gui) * 5px); background: radial-gradient(circle at 35% 35%, #f0ffb0, #8ae030 55%, #3a8a10); box-shadow: 0 0 calc(var(--gui) * 3px) #9af050aa, inset 0 0 0 var(--px) #2a6a08; animation: orbglow 1.6s ease-in-out infinite; }
.death .score .orb:nth-child(odd) { animation-delay: -0.8s; }
@keyframes orbglow { 50% { box-shadow: 0 0 calc(var(--gui) * 6px) #c8ff80dd, inset 0 0 0 var(--px) #2a6a08; transform: translateY(calc(var(--px) * -1)); } }
.plvl { float: right; margin-left: calc(var(--gui) * 4px); padding: 0 calc(var(--gui) * 3px); color: #1a0e06; background: linear-gradient(var(--gold-hi), var(--gold) 50%, #b8882a); box-shadow: 0 0 0 var(--px) #000, 0 0 0 calc(var(--px) * 2) var(--gold-lo); font-family: 'Monocraft', monospace; font-weight: 700; text-shadow: none; }
.anvil-cost { color: #9aff6a; }
/* lists and rows: dark leather with a gilt edge */
.trade-row, .world-row, .journal-ch, .adv-node, .mod-row { background: linear-gradient(#2a2230, #1e1824); box-shadow: inset 0 0 0 var(--px) #000, 0 0 0 var(--px) #3a2c20; }
.trade-row:hover { background: linear-gradient(#3c3048, #2e2436); box-shadow: inset 0 0 0 var(--px) #000, 0 0 0 var(--px) var(--gold); }
.adv-node.earned { box-shadow: inset 0 0 0 var(--px) #000, 0 0 0 var(--px) var(--gold-lo); }
.ctab, .rb-tab { border: var(--f3) solid transparent; border-image: var(--f-wood) 3 repeat; image-rendering: pixelated; background: rgba(46, 28, 12, 0.85); background-clip: padding-box; box-shadow: none; opacity: 0.7; }
.ctab.on, .rb-tab.on { opacity: 1; background: linear-gradient(#8e5c2c, var(--wood)); outline: var(--px) solid var(--gold); outline-offset: calc(var(--px) * -1); }
.rbook, .recipe-book { border: var(--f5) solid transparent; border-image: var(--f-stone) 5 repeat; image-rendering: pixelated; background: var(--stone); background-clip: padding-box; box-shadow: 0 calc(var(--gui) * 4px) calc(var(--gui) * 10px) rgba(0, 0, 0, 0.6); }
.kiln-mid .flame { filter: drop-shadow(0 0 var(--px) #000); }
.arrow { color: var(--gold-lo); text-shadow: var(--px) var(--px) 0 #000; }
.sort-btn, .pile-pg, .book-btn, .creative-btn { background: linear-gradient(#5e3a1a, #4a2c14); box-shadow: inset 0 0 0 var(--px) #000, 0 0 0 var(--px) var(--gold-lo); cursor: pointer; }
.sort-btn:hover, .pile-pg:hover, .book-btn:hover, .creative-btn:hover { box-shadow: inset 0 0 0 var(--px) #000, 0 0 0 var(--px) var(--gold); }
.title-screen.classic .title-who { border: var(--f3) solid transparent; border-image: var(--f-wood) 3 repeat; image-rendering: pixelated; background: rgba(46, 28, 12, 0.8); background-clip: padding-box; color: #fff0d0; }
.title-screen.classic .title-who:hover { color: var(--gold-hi); }
/* touch buttons follow the theme */
.t-btn { background: rgba(46, 28, 12, 0.55); box-shadow: inset 2px 2px 0 rgba(255, 220, 160, 0.22), inset -2px -2px 0 rgba(0, 0, 0, 0.5), 0 0 0 2px #1a0e06; }
.t-btn.down { background: rgba(120, 90, 40, 0.7); }
/* toasts and the top-right stack float above any open screen (a panel never hides a message); the held name sits
   above the meter rows, clear of armour and air, and fades as before */
.toasts, .tr-stack { z-index: 70; }
.held-name { bottom: calc(var(--slot) + var(--gui) * 40px); }

/* ---------- plain menus (Leif 2026-11-30: "I hate all of the menus. Just keep it simple. No UI. No image. No graphics.
   Just pixelated text buttons... let's do the previous pixel simple one"): the old pixel panels and buttons above,
   plus a plain title (dark background, the name in pixel text, a column of text buttons) and a plain reader ---------- */
.title-screen.classic.plain { background: #0b0a0e; background-image: none; cursor: default; justify-content: center; padding-top: 0; }
.title-screen.classic.plain .logo { text-shadow: calc(var(--px) * 2) calc(var(--px) * 2) 0 #3a1a00; }
.title-btns { display: flex; flex-direction: column; width: min(80vw, calc(var(--gui) * 150px)); margin-top: calc(var(--gui) * 10px); }
.title-btns .btn { width: 100%; margin: calc(var(--gui) * 1.5px) 0; }
.title-btns .btn.on { color: #ffb347; }
.screen-wrap:has(.title-screen.classic.plain) { background: #0b0a0e; }
.title-new { margin-top: calc(var(--gui) * 3px); }
.title-pop-row .btn { width: auto; flex: none; margin: 0; }
.btn:focus-visible, .title-who:focus-visible { outline: var(--px) solid #ffb347; outline-offset: var(--px); }

/* ---------- reader: notes, scrolls, letters, books (src/reader.js) as a plain dark panel of pixel text ---------- */
.reader { pointer-events: auto; display: flex; flex-direction: column; align-items: center; gap: calc(var(--gui) * 4px); max-width: 96vw; }
.r-sheet { background: var(--panel, #1a1720); border: var(--px) solid #000; color: #e8e0d8; padding: calc(var(--gui) * 7px) calc(var(--gui) * 8px);
  font-family: 'Pixelify Sans', var(--font); font-size: calc(var(--gui) * 7.5px); line-height: 1.5; font-variant-ligatures: none; }
.r-title { text-align: center; color: #ffb347; margin-bottom: calc(var(--gui) * 4px); text-shadow: var(--px) var(--px) 0 #000; }
.r-body { display: flex; gap: calc(var(--gui) * 8px); }
.r-page { overflow: hidden; width: min(88vw, calc(var(--gui) * 175px)); height: min(58vh, calc(var(--gui) * 132px)); }
.r-book.spread .r-page { width: min(44vw, calc(var(--gui) * 150px)); }
.r-line { white-space: pre; height: 1.5em; text-shadow: var(--px) var(--px) 0 #000; }
.r-gap { height: 1.5em; }
.r-page.blank { visibility: hidden; }
.r-nav { display: flex; align-items: center; gap: calc(var(--gui) * 3px); }
.r-nav .btn { width: auto; min-width: calc(var(--gui) * 16px); margin: 0; }
.r-nav .r-pg { min-width: calc(var(--gui) * 26px); text-align: center; color: #b8b0a8; font-size: 0.85em; text-shadow: var(--px) var(--px) 0 #000; }
.r-nav .r-close { margin-left: calc(var(--gui) * 6px); }
@media (max-width: 620px) { .r-sheet { font-size: calc(var(--gui) * 7px); } }

/* ---------- pixel pass (Leif 2026-11-30: "simple pixelated interfaces and pixel art in the interfaces"): everything
   crisp: the pixel font, flat fills, hard 1-pixel bevels (light top-left, dark bottom-right, no blur, no gradients, no
   rounded corners), the pixel-art 9-slice frames kept, nearest-neighbour everywhere ---------- */
.panel, .r-sheet {
  background: var(--stone); background-clip: padding-box;
  box-shadow: inset var(--px) var(--px) 0 #45405a, inset calc(var(--px) * -1) calc(var(--px) * -1) 0 #1c1a24;
}
.panel.book { background: var(--parch); }
.r-sheet { border: var(--f5) solid transparent; border-image: var(--f-stone) 5 repeat; image-rendering: pixelated; }
.btn, .ench-btn, .beacon-fx {
  background: var(--wood); background-clip: padding-box; border-radius: 0; filter: none; font-family: var(--font);
  box-shadow: inset var(--px) var(--px) 0 #a8743c, inset calc(var(--px) * -1) calc(var(--px) * -2) 0 #4a2c14;
  text-shadow: var(--px) var(--px) 0 #1a0e06;
}
.btn:hover, .ench-btn:hover, .beacon-fx:hover, .btn:focus-visible {
  background: #9a6430; color: #fff8e8; outline: var(--px) solid var(--gold); outline-offset: calc(var(--px) * -1);
  box-shadow: inset var(--px) var(--px) 0 #c89050, inset calc(var(--px) * -1) calc(var(--px) * -2) 0 #5a3418;
}
.btn:active, .ench-btn:active, .beacon-fx:active {
  background: #5e3a1a; transform: translateY(var(--px));
  box-shadow: inset var(--px) var(--px) 0 #3a220e, inset calc(var(--px) * -1) calc(var(--px) * -1) 0 #7a4c22;
}
.btn:disabled { opacity: 1; background: #4a3a2e; color: #8a7a6a; box-shadow: inset var(--px) var(--px) 0 #5a4a3c, inset calc(var(--px) * -1) calc(var(--px) * -2) 0 #2a2018; filter: none; }
.btn.danger:hover { background: #8a3a2a; }
.ench-btn { background: #4a3466; } .ench-btn:hover { background: #6a48a0; }
.slot { background: #15121c; box-shadow: inset 0 0 0 var(--px) #000, inset var(--px) var(--px) 0 #050408, inset calc(var(--px) * -1) calc(var(--px) * -1) 0 #3a3446, 0 0 0 var(--px) #4a4458; }
.slot:hover { background: #2e2844; box-shadow: inset 0 0 0 var(--px) #000, inset var(--px) var(--px) 0 #050408, inset calc(var(--px) * -1) calc(var(--px) * -1) 0 #5a5268, 0 0 0 var(--px) var(--gold); }
.slot img, .panel img, .btn img { image-rendering: pixelated; }
.title-who, .title-screen .title-pop-input { font-family: var(--font); border-radius: 0; }
/* pixel pass, part 2 (browser check 2026-12-03): the last soft effects on the screens go flat: no radial dimming,
   no blurred drop shadows or glows, no gradient fills; hard 1-px rings stay. Pixel scrollbars instead of the OS ones. */
.screen-wrap { background: rgba(6, 4, 10, 0.5); }
.screen-wrap.dark { background: rgba(6, 4, 10, 0.8); }
.screen-wrap:has(.title-screen.classic.plain) { background: #0b0a0e; }
.tooltip, .adv-toast, .pk, .quest, .area-panel, .pile-toast, .fxi, .fxp { background: #150f1e; background-clip: padding-box; box-shadow: none; }
.toast { background: #3a2410; background-clip: padding-box; box-shadow: none; }
.ctab.on, .rb-tab.on { background: #8e5c2c; }
.sort-btn, .pile-pg, .book-btn, .creative-btn { background: #5e3a1a; }
.trade-row, .world-row, .journal-ch, .adv-node, .mod-row { background: #241c2a; } .trade-row:hover { background: #352a40; }
.rbook, .recipe-book { background: var(--stone); background-clip: padding-box; box-shadow: none; }
.plvl { background: var(--gold); }
.avatar { background: #0b0910; }
.slot.rar2 { box-shadow: inset 0 0 0 var(--px) #4ab0ff, 0 0 0 var(--px) #4a4458; }
.slot.rar3 { box-shadow: inset 0 0 0 var(--px) #c878ff, 0 0 0 var(--px) #4a4458; }
.slot.rar4 { box-shadow: inset 0 0 0 var(--px) #ffbf50, 0 0 0 var(--px) #4a4458; }
.death .dt { text-shadow: calc(var(--px) * 2) calc(var(--px) * 2) 0 #300; }
.death .score .orb { background: #8ae030; box-shadow: inset 0 0 0 var(--px) #2a6a08; border-radius: 0; animation: none; }
.book-btn.pulse { animation: bookpulse 1.2s steps(2) infinite; } @keyframes bookpulse { 50% { box-shadow: inset 0 0 0 var(--px) #ffd060, 0 0 0 var(--px) #ffd060; } }
.title-pop-back { order: 99; }
#ui input[type=range] { -webkit-appearance: none; appearance: none; height: calc(var(--gui) * 8px); background: transparent; box-shadow: none; border: 0; }   /* pixel sliders: a flat groove, a square bevelled grip */
#ui input[type=range]::-webkit-slider-runnable-track { height: calc(var(--gui) * 2px); background: #0b0910; box-shadow: 0 0 0 var(--px) #000, 0 0 0 calc(var(--px) * 2) #4a4458; }
#ui input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: calc(var(--gui) * 4px); height: calc(var(--gui) * 8px); margin-top: calc(var(--gui) * -3px); border-radius: 0; border: var(--px) solid #000; background: var(--wood); box-shadow: inset var(--px) var(--px) 0 #a8743c, inset calc(var(--px) * -1) calc(var(--px) * -1) 0 #4a2c14; }
#ui input[type=range]::-moz-range-track { height: calc(var(--gui) * 2px); background: #0b0910; box-shadow: 0 0 0 var(--px) #000, 0 0 0 calc(var(--px) * 2) #4a4458; }
#ui input[type=range]::-moz-range-thumb { width: calc(var(--gui) * 4px); height: calc(var(--gui) * 8px); border-radius: 0; border: var(--px) solid #000; background: var(--wood); box-shadow: inset var(--px) var(--px) 0 #a8743c, inset calc(var(--px) * -1) calc(var(--px) * -1) 0 #4a2c14; }
#ui input[type=range]:focus-visible::-webkit-slider-thumb { outline: var(--px) solid var(--gold); }
.net-together { font-family: var(--font); font-size: calc(var(--gui) * 7px); }   /* "Play together" (src/net/client.js) at the title buttons' size */
.panel { animation: none; }   /* no scale-in: a scaled pixel frame blurs for its 0.14 s */
/* the title's Worlds / "Who are you?" panel takes the button column's place (never over the buttons); Back brings them back */
.title-screen .title-pop { position: static; transform: none; margin-top: calc(var(--gui) * 10px); max-height: none; overflow: visible; width: min(92vw, calc(var(--gui) * 220px)); min-width: 0; }
.title-screen .title-pop-list { max-height: 38vh; overflow-y: auto; }   /* the list scrolls; the name field and Back stay in view */
.title-screen:has(.title-pop) .title-btns { display: none; }
#ui * { scrollbar-width: thin; scrollbar-color: #7a4c22 #15121c; }
#ui ::-webkit-scrollbar { width: calc(var(--gui) * 4px); height: calc(var(--gui) * 4px); background: #15121c; }
#ui ::-webkit-scrollbar-thumb { background: #7a4c22; border-radius: 0; box-shadow: inset var(--px) var(--px) 0 #a8743c, inset calc(var(--px) * -1) calc(var(--px) * -1) 0 #4a2c14; }
/* lore lines (altars, graves, bells, books, statues, wells, relics: src/magic/objectlore.js, claims.js): frameless
   pixel text in the world's voice, never the wooden system-message box (Leif 2026-12-01: "no error message like
   popups ... we need this to feel mysterious"). A return visit ('again') is the same voice, a little dimmer. */
.toasts .toast.lore { border: none; border-image: none; background: none; box-shadow: none; max-width: min(92vw, calc(var(--gui) * 220px)); text-align: center;
  color: #e9dcb4; letter-spacing: 0.02em; line-height: 1.35; text-shadow: var(--px) var(--px) 0 #000, calc(var(--px) * -1) 0 0 #000, 0 calc(var(--px) * -1) 0 #000, var(--px) 0 0 #000; animation: lorein 0.9s steps(6) backwards; }
.toasts .toast.lore.again { color: #c9bfa6; }
.toasts .toast.lore.out { opacity: 0; transform: none; transition: opacity 1.2s steps(6); }
@keyframes lorein { from { opacity: 0; } }
.bk-list { max-height: 44vh; overflow-y: auto; display: flex; flex-direction: column; gap: calc(var(--gui) * 2px); }
/* a carried bucket (src/invsway.js): drops thrown over the rim on a hard stop, square pixels */
.slot b.drop, .cursor-stack b.drop { position: absolute; left: 50%; top: 25%; width: calc(var(--gui) * 1.5px); height: calc(var(--gui) * 1.5px); pointer-events: none; z-index: 3; opacity: 0; animation: slop 0.7s steps(7) forwards; }
@keyframes slop { 0% { opacity: 1; transform: translate(0, 0); } 35% { opacity: 1; transform: translate(var(--dx), calc(var(--gui) * -5px)); } 100% { opacity: 0; transform: translate(calc(var(--dx) * 1.7), calc(var(--gui) * 14px)); } }
/* the open bookshelf (src/shelfui.js): dark boards, the books standing on them; enchanted ones glow in steps */
.shelfui .chest-part { background: #2a1a0e; padding: calc(var(--gui) * 3px); box-shadow: inset 0 0 0 var(--px) #0e0805, 0 0 0 var(--px) #6a4a28; justify-content: center; }
.shelfui .chest-part .slot { background: linear-gradient(#1a100a, #1a100a 85%, #8a6234 85%, #8a6234 93%, #4a3018 93%); box-shadow: none; }
.shelfui .chest-part .slot:hover { filter: brightness(1.25); }
.shelfui .chest-part .slot { height: calc(var(--gui) * 27px); }
.shelfui .chest-part .slot img { height: calc(var(--gui) * 24px); transform-origin: 50% 100%; }
.shelfui .chest-part .slot.sp1 img { filter: drop-shadow(0 0 calc(var(--gui) * 1px) #9a6aff); }
.shelfui .chest-part .slot.sp2 img { animation: spglow 2.4s steps(6) infinite alternate; }
.shelfui .chest-part .slot.sp3 img { animation: spgreat 1.4s steps(7) infinite alternate; }
@keyframes spglow { from { filter: drop-shadow(0 0 calc(var(--gui) * 1px) #9a6aff); } to { filter: drop-shadow(0 0 calc(var(--gui) * 2px) #c090ff) brightness(1.15); } }
@keyframes spgreat { from { filter: drop-shadow(0 0 calc(var(--gui) * 2px) #c090ff); transform: translateY(0); } to { filter: drop-shadow(0 0 calc(var(--gui) * 3px) #ffd070) brightness(1.3); transform: translateY(calc(var(--gui) * -1px)); } }
/* the recipe book head: the search field on its own line (the long toggle squeezed it to one letter) */
.rbook .rb-head { flex-wrap: wrap; } .rbook .rb-head .rb-search { flex: 1 1 100%; min-width: 0; width: 100%; box-sizing: border-box; }
