:root {
  --gold: #c7a54a;
  --gold-dim: #8a7040;
  --bone: #e8e2d0;
  --ink: #0b0908;
  --panel: #15110d;
  --panel2: #1e1812;
  --edge: #5a4a30;
  --blood: #8a1010;
  --magic: #6f8cff;
  --rare: #ffe45e;
  --muted: #8a8272;
  --cell: 29px;
  --serif: 'IM Fell English', Georgia, 'Times New Roman', serif;
  --display: 'Cinzel', 'Trajan Pro', Georgia, serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #000; color: var(--bone); font-family: var(--serif); overflow: hidden; user-select: none; -webkit-user-select: none; }
#game-root { position: fixed; inset: 0; }
#world { position: absolute; inset: 0; display: block; cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24'><path d='M2 2 L2 19 L7 14 L11 22 L14 21 L10 13 L17 13 Z' fill='%23c7a54a' stroke='%23000' stroke-width='1.5'/></svg>") 2 2, default; }
#ui { position: absolute; inset: 0; pointer-events: none; }
#ui > * { pointer-events: auto; }
button { font-family: var(--display); }

/* ---------- generic panel ---------- */
.panel {
  position: absolute; top: 12px; bottom: 142px; width: min(430px, 46vw); z-index: 5;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(90, 60, 30, 0.18), transparent 60%),
    repeating-linear-gradient(45deg, rgba(255,255,255,0.012) 0 2px, transparent 2px 5px),
    linear-gradient(180deg, #1c1510, #0f0c09);
  border: 2px solid var(--edge);
  box-shadow: 0 0 0 1px #000, inset 0 0 0 1px rgba(199,165,74,0.15), 0 8px 30px rgba(0,0,0,0.8);
  display: flex; flex-direction: column; overflow: hidden;
}
.panel.left { left: 12px; }
.panel.right { right: 12px; }
.panel h2 { font-family: var(--display); font-weight: 700; color: var(--gold); letter-spacing: 0.08em; margin: 0; padding: 10px 14px 8px; font-size: 17px; text-align: center; border-bottom: 1px solid var(--edge); background: linear-gradient(180deg, rgba(199,165,74,0.08), transparent); position: relative; }
.panel .close { position: absolute; right: 8px; top: 6px; width: 26px; height: 26px; border: 1px solid var(--edge); background: #231a12; color: var(--gold); cursor: pointer; font-size: 14px; line-height: 1; }
.panel .close:hover { background: #3a2a1a; }
.panel .body { padding: 10px 12px; overflow-y: auto; flex: 1; scrollbar-width: thin; scrollbar-color: var(--edge) transparent; }
.sub { color: var(--muted); font-size: 13px; }

.btn {
  font-family: var(--display); font-size: 13px; letter-spacing: 0.05em; color: var(--bone);
  background: linear-gradient(180deg, #2c2218, #18120c); border: 1px solid var(--edge); padding: 7px 12px; cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06);
}
.btn:hover { color: #fff; border-color: var(--gold-dim); background: linear-gradient(180deg, #3a2c1e, #1e160e); }
.btn:disabled { opacity: 0.4; cursor: default; }
.btn.gold { color: var(--gold); }

/* ---------- HUD ---------- */
#hud {
  position: absolute; left: 0; right: 0; bottom: 0; height: 96px;
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,0.015) 0 1px, transparent 1px 7px),
    linear-gradient(180deg, #2a221a 0%, #15110c 30%, #0c0a07 100%);
  border-top: 2px solid var(--edge);
  box-shadow: 0 -2px 0 #000, 0 -10px 30px rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center; gap: 12px; padding: 0 150px;
}
.orb-wrap { position: absolute; bottom: 6px; width: 128px; height: 128px; }
.orb-wrap.life { left: 10px; }
.orb-wrap.mana { right: 10px; }
.orb-wrap canvas { width: 128px; height: 128px; display: block; }
.orb-label { position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%); z-index: 1; text-align: center; font-family: var(--display); font-size: 12px; color: var(--bone); text-shadow: 0 0 3px #000, 0 0 6px #000; pointer-events: none; }
.orb-name { position: absolute; left: 0; right: 0; bottom: -2px; text-align: center; font-family: var(--display); font-size: 10px; color: var(--muted); letter-spacing: 0.1em; text-transform: uppercase; pointer-events: none; }

.hud-center { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.hud-row { display: flex; align-items: center; gap: 8px; }
.skillbtn { width: 50px; height: 50px; border: 2px solid var(--edge); background: #0c0a08; cursor: pointer; position: relative; padding: 0; }
.skillbtn canvas { width: 46px; height: 46px; display: block; }
.skillbtn:hover { border-color: var(--gold); }
.skillbtn .key { position: absolute; right: 2px; bottom: 0; font-size: 10px; color: var(--gold); font-family: var(--display); text-shadow: 0 0 2px #000; }
.belt { display: grid; grid-template-columns: repeat(8, 34px); gap: 3px; position: relative; }
.belt .slot { width: 34px; height: 34px; border: 1px solid var(--edge); background: #0a0806; position: relative; cursor: pointer; background-size: contain; background-repeat: no-repeat; background-position: center; }
.belt .slot .k { position: absolute; left: 2px; top: 0; font-size: 10px; color: var(--muted); font-family: var(--display); }
.belt .slot:hover { border-color: var(--gold); }
.menu-btns { display: flex; gap: 4px; }
.menu-btns .btn { padding: 4px 7px; font-size: 11px; position: relative; }
.menu-btns .btn .dot { position: absolute; top: -5px; right: -5px; width: 14px; height: 14px; border-radius: 50%; background: #c02020; color: #fff; font-size: 10px; line-height: 14px; text-align: center; box-shadow: 0 0 6px #f44; font-family: var(--serif); }
.xpbar { width: min(520px, 42vw); height: 7px; background: #0a0806; border: 1px solid #3a2e20; position: relative; }
.xpbar > div { height: 100%; background: linear-gradient(90deg, #7a6020, #c7a54a); }
.goldline { font-size: 12px; color: #e8d27a; font-family: var(--display); }
.statusbar { display: flex; gap: 4px; }
.buff { width: 22px; height: 22px; border: 1px solid var(--edge); background: #1a140e; font-size: 12px; display: flex; align-items: center; justify-content: center; position: relative; }
.buff .t { position: absolute; bottom: -12px; font-size: 9px; color: var(--muted); }
/* the hero's summons, just above the bar beside the life orb: dimmed where one could be called, red as one falls */
.minions { position: absolute; left: 146px; bottom: 104px; display: flex; gap: 4px; }
.minion { width: 26px; height: 30px; border: 1px solid var(--edge); background: #120e0a; position: relative; box-shadow: 0 1px 4px #000; }
.minion canvas { width: 26px; height: 26px; display: block; }
.minion .mbar { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: #000; }
.minion .mbar > div { height: 100%; }
.minion.empty canvas { opacity: 0.25; filter: grayscale(1); }
.minion.fell { border-color: #e03020; box-shadow: 0 0 8px #e03020; }
@media (max-width: 760px) { .minions { left: 100px; bottom: 100px; } }

/* ---------- item grids ---------- */
.grid { position: relative; background-color: #0a0806; background-image: linear-gradient(rgba(90,74,48,0.35) 1px, transparent 1px), linear-gradient(90deg, rgba(90,74,48,0.35) 1px, transparent 1px); background-size: var(--cell) var(--cell); border: 1px solid var(--edge); margin: 0 auto; }
.grid .it, .eq .it { position: absolute; background-size: contain; background-repeat: no-repeat; background-position: center; cursor: pointer; }
.grid .it { background-color: rgba(40, 40, 70, 0.35); outline: 1px solid rgba(0,0,0,0.6); }
.grid .it.unique, .eq .it.unique { background-color: rgba(120, 90, 30, 0.35); }
.grid .it.rare, .eq .it.rare { background-color: rgba(110, 50, 150, 0.35); }
.grid .it.magic, .eq .it.magic { background-color: rgba(40, 60, 140, 0.35); }
.grid .it.unid { box-shadow: inset 0 0 0 2px rgba(200, 30, 30, 0.35); }
.grid .it.cant, .eq .it.cant { background-color: rgba(160, 20, 20, 0.4); }
.grid .it:hover { filter: brightness(1.3); }
.grid .preview { position: absolute; pointer-events: none; }
.grid .preview.ok { background: rgba(60, 200, 60, 0.25); }
.grid .preview.bad { background: rgba(200, 40, 40, 0.3); }
.sockets { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: grid; gap: 3px; pointer-events: none; }
.sockets i { width: 7px; height: 7px; border-radius: 50%; background: #000; border: 1px solid #666; display: block; }

.equip { position: relative; height: 262px; margin: 4px auto 10px; width: 350px; }
.eq { position: absolute; border: 1px solid var(--edge); background: #0a0806 center/60% no-repeat; }
.eq:hover { border-color: var(--gold); }
.eq .lbl { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 9px; color: #4a4030; font-family: var(--display); letter-spacing: 0.08em; pointer-events: none; }
.eq .it { inset: 2px; }

/* ---------- tooltip ---------- */
#tooltip { position: fixed; pointer-events: none; z-index: 50; background: rgba(6, 5, 4, 0.94); border: 1px solid #3a3020; padding: 8px 12px; max-width: 340px; text-align: center; font-family: var(--display); font-size: 13px; line-height: 1.35; display: none; box-shadow: 0 6px 20px #000; }
#tooltip .tt-name { font-size: 15px; font-weight: 700; }
#tooltip .tt-flavor { font-family: var(--serif); font-style: italic; margin-top: 4px; }
#tooltip .price { color: #e8d27a; margin-top: 4px; }
#tooltip .hint { color: var(--muted); font-size: 11px; margin-top: 3px; }

#held { position: fixed; pointer-events: none; z-index: 60; background-size: contain; background-repeat: no-repeat; opacity: 0.9; filter: drop-shadow(0 3px 6px #000); }

/* ---------- messages ---------- */
#messages { position: absolute; left: 50%; bottom: 110px; transform: translateX(-50%); width: min(720px, 80vw); display: flex; flex-direction: column-reverse; align-items: center; gap: 2px; pointer-events: none; }
#messages div { font-size: 16px; text-shadow: 0 0 4px #000, 0 0 8px #000; transition: opacity 1s; text-align: center; }
#banner { position: absolute; top: 18%; left: 0; right: 0; text-align: center; pointer-events: none; opacity: 0; transition: opacity 1.2s; }
#banner .t { font-family: var(--display); font-size: clamp(26px, 4vw, 44px); color: var(--gold); letter-spacing: 0.12em; text-shadow: 0 0 20px #000, 0 2px 0 #000; }
#banner .s { font-family: var(--serif); font-size: 18px; color: var(--bone); font-style: italic; text-shadow: 0 0 10px #000; }
#hurt { position: absolute; inset: 0; pointer-events: none; box-shadow: inset 0 0 120px rgba(160, 0, 0, 0); transition: box-shadow 0.4s; }
#floaters { position: absolute; inset: 0; pointer-events: none; }
#floaters div { position: absolute; font-family: var(--display); font-size: 15px; text-shadow: 0 0 3px #000; transition: transform 1.2s ease-out, opacity 1.2s; }

/* ---------- dialog ---------- */
.dialog .speaker { font-family: var(--display); color: var(--gold); font-size: 13px; letter-spacing: 0.05em; margin-top: 10px; }
.dialog .line { font-size: 17px; line-height: 1.45; margin: 3px 0 0; color: var(--bone); }
.dialog .line.stage { color: var(--muted); font-style: italic; }
.opts { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px 14px; border-top: 1px solid var(--edge); }
.opts .btn { text-align: left; }
.portrait { display: block; margin: 0 auto 6px; border: 1px solid var(--edge); background: radial-gradient(ellipse at 50% 35%, rgba(199,140,74,0.28), rgba(20,14,10,0.9) 72%), #0d0a07; box-shadow: inset 0 0 18px rgba(0,0,0,0.8); }
/* the trade window: the vendor beside your pack */
.panel.trade { left: 50%; transform: translateX(-50%); width: min(720px, calc(100vw - 24px)); }
.trade-head { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; }
.trade-head .portrait { margin: 0; flex: none; }
.trade-who { font-family: var(--display); color: var(--gold); font-size: 18px; letter-spacing: 0.06em; }
.trade-says { color: #ffd2a0; font-style: italic; font-size: 13px; margin: 2px 0 3px; }
.trade-cols { display: flex; gap: 18px; justify-content: center; flex-wrap: wrap; }
.trade-col { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.trade-col h3 { margin: 0; font-family: var(--display); color: var(--gold); font-size: 13px; letter-spacing: 0.12em; text-transform: uppercase; }
/* a shop's menu board (UI.menuBoard): the everyday stock that never runs out, a backlit sign, a row each, big buttons */
.menu-board { margin: 0 auto 14px; padding: 8px 10px; max-width: 640px; border: 2px solid #5a4422; border-radius: 4px;
  background: linear-gradient(180deg, #2a2014, #17110a); box-shadow: inset 0 0 18px rgba(255, 190, 90, 0.12), 0 0 14px rgba(255, 170, 60, 0.08); }
.menu-row { display: grid; grid-template-columns: 40px 1fr 84px 96px 54px 54px; gap: 8px; align-items: center; padding: 6px 2px; border-top: 1px solid rgba(199, 165, 74, 0.14); }
.menu-row:first-child, .menu-topup + .menu-row { border-top: none; }
.menu-icon { width: 36px; height: 36px; background: #0f0c09 center / contain no-repeat; border: 1px solid var(--edge); }
.menu-name { font-family: var(--display); color: var(--bone); font-size: 14px; letter-spacing: 0.03em; min-width: 0; }
.menu-does { font-family: inherit; color: var(--muted); font-size: 12px; letter-spacing: 0; margin-top: 2px; }
.menu-mark { margin: 0 2px; font-size: 15px; line-height: 1; vertical-align: -1px; }
.menu-price { color: var(--gold); font-family: var(--display); font-size: 18px; font-weight: 700; text-align: right; }
.menu-have { color: var(--bone); font-size: 12px; text-align: center; }
.menu-have.none { color: var(--muted); opacity: 0.7; }
.btn.menu-buy { font-size: 16px; padding: 9px 0; width: 100%; }
.btn.menu-topup { display: flex; width: 100%; justify-content: space-between; align-items: center; gap: 12px; padding: 11px 14px; margin-bottom: 6px;
  border-color: var(--gold-dim); background: linear-gradient(180deg, #4a3618, #261a0c); }
.menu-topup-what { font-size: 16px; color: var(--gold); letter-spacing: 0.08em; text-transform: uppercase; }
.menu-topup-cost { font-size: 13px; color: var(--bone); }
.menu-board .btn.off, .menu-board .btn.off:hover { opacity: 0.4; cursor: not-allowed; color: var(--bone); border-color: var(--edge); background: linear-gradient(180deg, #2c2218, #18120c); }
@media (max-width: 560px) { .menu-row { grid-template-columns: 36px 1fr 70px 46px 46px; } .menu-have { display: none; } }

/* ---------- character ---------- */
.charsheet table { width: 100%; border-collapse: collapse; font-size: 14px; }
.charsheet td { padding: 4px 6px; border-bottom: 1px solid rgba(90,74,48,0.4); }
.charsheet td.v { text-align: right; font-family: var(--display); }
.charsheet .plus { width: 22px; height: 22px; padding: 0; margin-left: 6px; font-size: 14px; line-height: 1; }
.charsheet .hdr { font-family: var(--display); color: var(--gold); font-size: 12px; letter-spacing: 0.1em; padding-top: 12px; }
.res-fire { color: #ff7a4a; } .res-cold { color: #8fc6ff; } .res-ltng { color: #ffe45e; } .res-pois { color: #7ed957; }
.low { color: #ff5050; }

/* ---------- skills ---------- */
.trees { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tree h3 { font-family: var(--display); font-size: 12px; color: var(--gold); text-align: center; margin: 0 0 8px; letter-spacing: 0.06em; }
.skill { display: flex; flex-direction: column; align-items: center; margin-bottom: 14px; cursor: pointer; }
.skill .ic { width: 52px; height: 52px; border: 2px solid var(--edge); background: #0a0806; position: relative; }
.skill .ic canvas { width: 48px; height: 48px; display: block; }
.skill.locked:not(.can) .ic { filter: grayscale(1) brightness(0.45); }
.skill.locked.can .ic canvas { filter: brightness(0.75); }
.skill.can .ic { border-color: var(--gold); box-shadow: 0 0 8px rgba(199,165,74,0.5); }
.skill .lv { position: absolute; right: -6px; bottom: -6px; background: #000; border: 1px solid var(--edge); font-size: 11px; min-width: 18px; text-align: center; font-family: var(--display); color: var(--bone); }
.skill .nm { font-size: 11px; text-align: center; margin-top: 4px; font-family: var(--display); color: var(--bone); line-height: 1.1; }
.skill .rq { font-size: 10px; color: var(--muted); }
.points { text-align: center; font-family: var(--display); color: var(--gold); margin-bottom: 10px; }

.picker { position: absolute; bottom: 104px; display: grid; grid-template-columns: repeat(6, 52px); gap: 4px; padding: 6px; background: rgba(10,8,6,0.96); border: 1px solid var(--edge); z-index: 20; }
.picker .skillbtn { width: 52px; height: 52px; }

/* ---------- quests ---------- */
.quest { padding: 8px 4px; border-bottom: 1px solid rgba(90,74,48,0.4); }
.quest .qn { font-family: var(--display); color: var(--gold); font-size: 14px; }
.quest.done .qn { color: var(--muted); text-decoration: line-through; }
.quest .qt { font-size: 15px; margin-top: 3px; }
.quest .qh { font-size: 11px; color: var(--muted); font-style: italic; }
.quest.fresh { background: linear-gradient(90deg, rgba(199,165,74,0.16), transparent 70%); border-left: 2px solid var(--gold); padding-left: 8px; }
/* a quest started, moved on or finished (UI.questToast) */
#quest-toasts { position: absolute; top: 58px; left: 50%; transform: translateX(-50%); width: min(340px, calc(100vw - 32px)); display: flex; flex-direction: column; gap: 6px; z-index: 30; }
.qtoast { background: linear-gradient(180deg, rgba(30,24,16,0.95), rgba(14,11,8,0.95)); border: 1px solid #8a7a50; box-shadow: 0 0 18px rgba(0,0,0,0.8), inset 0 0 12px rgba(199,165,74,0.12); padding: 8px 14px 10px; text-align: center; animation: qtoast-in 0.45s ease-out; transition: opacity 1.1s, transform 1.1s; }
.qtoast.out { opacity: 0; transform: translateY(-8px); }
.qtoast .qk { font-family: var(--display); font-size: 10px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--muted); }
.qtoast.new .qk, .qtoast.done .qk { color: #e8d27a; }
.qtoast .qn { font-family: var(--display); font-size: 17px; color: var(--gold); margin-top: 1px; text-shadow: 0 0 10px rgba(199,165,74,0.4); }
.qtoast .qt { font-size: 14px; color: var(--bone); margin-top: 4px; line-height: 1.35; }
@keyframes qtoast-in { from { opacity: 0; transform: translateY(-10px) scale(0.97); } to { opacity: 1; transform: none; } }

/* ---------- overlays / screens ---------- */
.overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,0.72); z-index: 40; }
.modal { background: linear-gradient(180deg, #1c1510, #0d0a07); border: 2px solid var(--edge); padding: 22px 28px; min-width: 320px; max-width: min(620px, 92vw); box-shadow: 0 10px 40px #000; text-align: center; }
.modal h1 { font-family: var(--display); color: var(--gold); margin: 0 0 12px; letter-spacing: 0.1em; font-size: 26px; }
.modal p { font-size: 17px; line-height: 1.5; }
.modal .row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 14px; }
.modal label { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 10px 0; font-family: var(--display); font-size: 13px; }
.modal input[type=range] { width: 180px; accent-color: var(--gold); }
.modal .version { margin-top: 16px; font-family: var(--display); font-size: 11px; letter-spacing: 0.12em; color: #7a6a52; } /* (the Game Menu's foot: src/version.js) */
.death h1 { color: #c02020; font-size: 44px; text-shadow: 0 0 20px #600; }
.tomb { width: 180px; height: 210px; margin: 10px auto; background: linear-gradient(180deg, #5a5a5a, #2a2a2a); border-radius: 90px 90px 6px 6px; border: 2px solid #111; display: flex; flex-direction: column; align-items: center; justify-content: center; font-family: var(--display); color: #ddd; text-shadow: 0 1px 0 #000; padding: 12px; }
.tomb .rip { font-size: 26px; }
.tomb .bb { font-size: 12px; margin-top: 8px; color: #bbb; }

.screen { position: absolute; inset: 0; z-index: 70; display: flex; flex-direction: column; align-items: center; justify-content: center; background: radial-gradient(ellipse at 50% 30%, #2a1208 0%, #0a0503 55%, #000 100%); overflow: auto; }
.logo { font-family: var(--display); font-weight: 900; font-size: clamp(44px, 9vw, 104px); letter-spacing: 0.06em; color: #d8b060; text-shadow: 0 0 30px rgba(255, 90, 20, 0.45), 0 4px 0 #3a1a08, 0 8px 30px #000; margin: 0; line-height: 1; text-align: center; }
.logo-sub { font-family: var(--serif); font-style: italic; color: var(--bone); opacity: 0.8; margin: 10px 0 34px; font-size: clamp(14px, 2vw, 19px); text-align: center; padding: 0 16px; }
.menu-col { display: flex; flex-direction: column; gap: 10px; width: min(320px, 86vw); }
.menu-col .btn { font-size: 16px; padding: 12px; }
.flame { position: absolute; bottom: 0; left: 0; right: 0; height: 30vh; background: radial-gradient(ellipse at 50% 120%, rgba(255, 90, 20, 0.25), transparent 70%); pointer-events: none; animation: flick 3s infinite alternate; }
@keyframes flick { from { opacity: 0.6; } to { opacity: 1; } }
.fine { position: absolute; bottom: 12px; font-size: 12px; color: #5a5040; text-align: center; padding: 0 16px; }

.heroes { display: flex; flex-direction: column; gap: 8px; width: min(520px, 92vw); max-height: 50vh; overflow-y: auto; margin-bottom: 16px; }
.hero-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; border: 1px solid var(--edge); background: rgba(20,15,10,0.9); cursor: pointer; }
.hero-row:hover { border-color: var(--gold); }
.hero-row .n { font-family: var(--display); color: var(--gold); font-size: 16px; }
.hero-row .d { font-size: 13px; color: var(--muted); }
.hero-row .x { color: #a04040; border: 1px solid #5a2a2a; background: #1a0c0c; padding: 3px 8px; cursor: pointer; font-family: var(--display); font-size: 11px; }
.hero-row .hero-pic { flex: none; border: 1px solid var(--edge); background: radial-gradient(ellipse at 50% 70%, rgba(255,150,60,0.22), #0d0a07 75%); }

.classes { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; margin: 10px 0 18px; padding: 0 12px; }
.cls { width: 210px; border: 2px solid var(--edge); background: rgba(15,11,8,0.92); padding: 10px; cursor: pointer; text-align: center; transition: transform 0.15s, border-color 0.15s; }
.cls:hover { transform: translateY(-3px); }
.cls.sel { border-color: var(--gold); box-shadow: 0 0 20px rgba(199,165,74,0.35); }
.cls canvas { width: 180px; height: 150px; display: block; margin: 0 auto; }
.cls .n { font-family: var(--display); color: var(--gold); font-size: 17px; }
.cls .t { font-size: 12px; color: var(--muted); font-family: var(--display); }
.cls .b { font-size: 14px; margin-top: 6px; line-height: 1.35; }
.create-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; justify-content: center; }
.create-row input[type=text] { background: #0a0806; border: 1px solid var(--edge); color: var(--bone); padding: 10px 12px; font-family: var(--display); font-size: 15px; width: 220px; }
.create-row label { font-family: var(--display); font-size: 13px; display: flex; gap: 6px; align-items: center; }

.cine { position: absolute; inset: 0; z-index: 80; background: #000; display: flex; align-items: center; justify-content: center; flex-direction: column; padding: 0 8vw; }
.cine .ln { font-family: var(--serif); font-size: clamp(18px, 2.4vw, 28px); line-height: 1.55; color: #d8cfb8; text-align: center; max-width: 900px; opacity: 0; transition: opacity 1.4s; }
.cine .ln.show { opacity: 1; }
.cine .who { font-family: var(--display); color: var(--gold); font-size: 14px; letter-spacing: 0.1em; margin-bottom: 6px; }
.cine .skip { position: absolute; right: 18px; bottom: 16px; }
.cine canvas { width: min(1000px, 92vw, 112vh); height: auto; aspect-ratio: 2 / 1; margin-bottom: 18px; border: 1px solid rgba(199,165,74,0.25); }

.book { font-family: var(--serif); font-size: 18px; line-height: 1.6; text-align: left; }

.shop-gold { text-align: center; margin: 8px 0; font-family: var(--display); color: #e8d27a; }
.tabs { display: flex; gap: 4px; justify-content: center; margin-bottom: 6px; }

@media (max-width: 760px) {
  #hud { padding: 0 100px; gap: 6px; }
  .orb-wrap { width: 90px; height: 90px; }
  .orb-wrap canvas { width: 90px; height: 90px; }
  .menu-btns .btn { padding: 3px 4px; font-size: 10px; }
  .panel { width: calc(100vw - 24px); }
  .panel.right { right: 12px; }
}

/* ---------- loading screen (between levels) ---------- */
#ui > .loading { position: absolute; inset: 0; z-index: 60; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  background: radial-gradient(ellipse at 50% 45%, #1e130b, #070504 70%); opacity: 0; pointer-events: none; transition: opacity 0.35s; }
#ui > .loading.show { opacity: 1; pointer-events: auto; transition: none; }
.loading .lt { font-family: var(--display); color: var(--gold); font-size: clamp(26px, 4.5vw, 46px); letter-spacing: 0.06em; text-shadow: 0 0 24px rgba(199,120,40,0.45); text-align: center; }
.loading .ls { font-family: var(--display); color: var(--muted); font-size: 14px; letter-spacing: 0.2em; text-transform: uppercase; }
.loading .lbar { width: min(360px, 70vw); height: 6px; border: 1px solid var(--edge); background: #0d0a07; margin-top: 18px; }
.loading .lbar i { display: block; height: 100%; width: 4%; background: linear-gradient(90deg, #8a3a10, #e0a040); transition: width 0.15s; }
.loading .ltip { margin-top: 14px; color: #9a9080; font-style: italic; font-size: 15px; max-width: 80vw; text-align: center; }

/* ---------- debug mode ---------- */
.debug-launch { display: flex; flex-direction: column; gap: 10px; min-width: min(420px, 90vw); }
.debug-launch label { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-family: var(--display); color: var(--gold); }
.debug-launch select, .debug-launch input, .debug-panel select, .debug-panel input[type=number] { background: #120d09; color: #e8dcc0; border: 1px solid var(--edge); padding: 4px 6px; font-family: inherit; }
.debug-panel { position: absolute; top: 12px; right: 12px; z-index: 40; width: min(340px, calc(100vw - 24px)); max-height: calc(100vh - 170px); overflow-y: auto;
  background: rgba(10, 16, 10, 0.94); border: 1px solid #4a8a4a; box-shadow: 0 6px 24px rgba(0,0,0,0.7); font-size: 13px; color: #d8e8d0; }
.debug-panel .dbg-head { position: relative; padding: 8px 10px; font-family: var(--display); letter-spacing: 0.2em; color: #9ad09a; border-bottom: 1px solid #2a4a2a; }
.debug-panel .dbg-head .close { position: absolute; right: 6px; top: 4px; background: none; border: 0; color: #9ad09a; cursor: pointer; font-size: 14px; }
.debug-panel .dbg-sec { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 8px 10px; border-bottom: 1px solid #1e321e; }
.debug-panel .dbg-sec b { width: 100%; font-family: var(--display); color: #9ad09a; font-weight: 400; letter-spacing: 0.1em; font-size: 12px; }
.debug-panel .btn { padding: 4px 8px; font-size: 12px; }
.debug-panel select { max-width: 100%; }
.debug-panel .dbg-log { width: 100%; box-sizing: border-box; resize: vertical; background: #0a0806; color: #cfe8cf; border: 1px solid #2a4a2a; padding: 6px; font: 11px/1.4 ui-monospace, Consolas, monospace; white-space: pre-wrap; }
.dbg-tog { display: flex; align-items: center; gap: 4px; margin-right: 8px; cursor: pointer; }
.modal .dbg-menu { align-items: center; gap: 10px; margin-top: 10px; padding-top: 10px; border-top: 1px solid #2a4a2a; color: #9ad09a; font-size: 12px; }
.modal .dbg-menu .btn { border-color: #4a8a4a; color: #9ad09a; }
#ui > .dbg-fps { position: absolute; left: 12px; top: 12px; z-index: 40; pointer-events: none; font: 12px/1.3 ui-monospace, Consolas, monospace; color: #9ad09a; background: rgba(0,0,0,0.6); padding: 3px 7px; }

/* debug mode's model viewer */
.model-viewer { position: fixed; inset: 0; z-index: 1000; display: flex; background: #0c100c; color: #d8e8d0; font-size: 13px; }
.model-viewer .mv-side { width: 250px; flex: none; display: flex; flex-direction: column; border-right: 1px solid #2a4a2a; background: rgba(10, 16, 10, 0.96); }
.model-viewer .dbg-head { position: relative; padding: 8px 10px; font-family: var(--display); letter-spacing: 0.2em; color: #9ad09a; border-bottom: 1px solid #2a4a2a; }
.model-viewer .dbg-head .close { position: absolute; right: 6px; top: 4px; background: none; border: 0; color: #9ad09a; cursor: pointer; font-size: 14px; }
.model-viewer input[type=search], .model-viewer select { background: #120d09; color: #e8dcc0; border: 1px solid var(--edge); padding: 4px 6px; font-family: inherit; }
.model-viewer input[type=search] { margin: 8px; }
.model-viewer .mv-list { flex: 1; overflow-y: auto; padding-bottom: 12px; }
.model-viewer .mv-group { padding: 10px 10px 4px; font-family: var(--display); color: #9ad09a; letter-spacing: 0.1em; font-size: 12px; cursor: pointer; user-select: none; }
.model-viewer .mv-group:hover { color: #c8f0c8; }
.model-viewer .mv-group.shut { color: #6a9a6a; }
.model-viewer .mv-caret { display: inline-block; width: 1em; }
.model-viewer .mv-item { padding: 3px 10px 3px 16px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.model-viewer .mv-item:hover { background: #1a2a1a; }
.model-viewer .mv-item.on { background: #2a4a2a; color: #fff; }
.model-viewer .mv-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.model-viewer .mv-bar { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; padding: 6px 10px; border-bottom: 1px solid #1e321e; }
.model-viewer .mv-bar label { display: flex; align-items: center; gap: 4px; }
.model-viewer .mv-bar input[type=range] { flex: 1; min-width: 120px; max-width: 320px; }
.model-viewer .btn { padding: 4px 8px; font-size: 12px; }
.model-viewer .mv-help { margin-left: auto; opacity: 0.7; }
.model-viewer .mv-stage { flex: 1; min-height: 120px; position: relative; }
.model-viewer .mv-view { position: absolute; inset: 0; width: 100%; height: 100%; cursor: grab; touch-action: none; }
.model-viewer .mv-view:active { cursor: grabbing; }
.model-viewer .mv-foot { border-top: 1px solid #1e321e; padding: 6px 10px; overflow-x: auto; }
.model-viewer .mv-foot-head { display: flex; gap: 12px; align-items: center; margin-bottom: 4px; color: #9ad09a; }
.model-viewer .mv-sprites { display: block; image-rendering: pixelated; }
.model-viewer .mv-info { padding: 4px 10px 6px; font: 12px/1.3 ui-monospace, Consolas, monospace; color: #9ad09a; }
@media (max-width: 700px) { .model-viewer { flex-direction: column; } .model-viewer .mv-side { width: auto; height: 34vh; border-right: 0; border-bottom: 1px solid #2a4a2a; } .model-viewer .mv-help { display: none; } }

/* a cup holder being drunk from: the holder flashes and the item's icon floats up out of it (see UI.beltUsed) */
.belt-flash, .belt-ghost { position: fixed; pointer-events: none; z-index: 30; }
.belt-flash { border: 1px solid #ffe08a; box-shadow: 0 0 10px 3px rgba(255, 210, 110, 0.75), inset 0 0 10px rgba(255, 220, 140, 0.6); animation: belt-flash 0.5s ease-out forwards; }
.belt-ghost { background-size: contain; background-repeat: no-repeat; background-position: center; animation: belt-ghost 0.8s ease-out forwards; }
@keyframes belt-flash { from { opacity: 1; transform: scale(1.18); } to { opacity: 0; transform: scale(1); } }
@keyframes belt-ghost { from { opacity: 0.95; transform: translateY(0) scale(1); } to { opacity: 0; transform: translateY(-34px) scale(1.35); } }
@keyframes belt-fade { from { opacity: 1; } to { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .belt-ghost { display: none; } .belt-flash { animation-name: belt-fade; } }
