/* =====================================================================
   AETHERIA — style.css
   Single, deliberate dark-fantasy pixel theme. Everything is painted
   explicitly (no system colors). Pixel borders with bronze rivets,
   no rounded corners, nearest-neighbour icons.
   ===================================================================== */

:root {
  --void: #07060b;
  --panel: #15111c;
  --panel2: #1e1828;
  --edge: #3b2c1f;
  --bronze: #8a6a3a;
  --gold: #d6a84c;
  --gold2: #f4d47c;
  --parch: #eadfc6;
  --dim: #9a8f7c;
  --hp: #c4232e;
  --hp2: #ff5a4a;
  --mp: #2a5fd6;
  --mp2: #6aa8ff;
  --xp: #e0b84a;
  --exc: #4fe06a;
  --mag: #7d9bff;
  --rare: #ffd34d;
  --uni: #ff9a3c;
  --danger: #ff4d4d;
  --ink: #120c18;
  --well: #0b0810;

  --f-title: "Jacquard 12", "Pixelify Sans", monospace;
  --f-ui: "Pixelify Sans", monospace;
  --f-num: "Silkscreen", "Pixelify Sans", monospace;

  /* "Tamanho do texto" (Opções / Esc menu; core.js AE.setTxtScale sets --txt on <html>, ?txt= / localStorage ae_txt):
     body text is calc(Npx * var(--txt)), 20-29px headings follow half the step (--txt-h), >= 30px display text is fixed */
  --txt: 1.25;
  --txt-h: calc(1 + (var(--txt) - 1) / 2);

  --cell: 32px;
  --u: calc(var(--cell) / 32);
  --orb: 96px;
  --sk: 44px;
  --pot: 40px;
  --mbs: 30px;
  --con-h: 116px;
  --notch: polygon(2px 0, calc(100% - 2px) 0, 100% 2px, 100% calc(100% - 2px), calc(100% - 2px) 100%, 2px 100%, 0 calc(100% - 2px), 0 2px);
  color-scheme: dark;
}

/* ---------- page shell ---------- */
html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--void);
  color: var(--parch);
  font-family: var(--f-ui);
  -webkit-font-smoothing: none;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
body { position: fixed; inset: 0; }

/* ---------- themed cursors ----------
   Pixel-art PNGs built by ferramentas/build_cursors.py (assets/ui/cursors/*.png, 32x32).
   "x y" = hotspot: keep in sync with assets/ui/cursors/hotspots.json and main.js CURSOR_HOT
   (world canvas). The keyword after the comma is the native fallback. Every cursor
   declaration in this file goes through these variables. */
:root {
  --cur-default: url(../assets/ui/cursors/default.png) 1 1, default;
  --cur-pointer: url(../assets/ui/cursors/pointer.png) 1 1, pointer;
  --cur-disabled: url(../assets/ui/cursors/disabled.png) 1 1, not-allowed;
  --cur-text: url(../assets/ui/cursors/text.png) 15 15, text;
  --cur-grab: url(../assets/ui/cursors/grab.png) 15 2, grab;
  --cur-grabbing: url(../assets/ui/cursors/grabbing.png) 15 2, grabbing;
  --cur-copy: url(../assets/ui/cursors/sell.png) 1 1, copy;          /* selling mode: a click sells (arrow + Zen coin) */
  --cur-hold: url(../assets/ui/cursors/grabbing.png) 15 2, crosshair; /* an item is on the cursor: closed hand, sits below the item */
}
html { cursor: var(--cur-default); }
button, label, select, input { cursor: var(--cur-default); }   /* the UA sheet gives these a native "default" */
input:not([type]), input[type="text"], input[type="search"], input[type="number"], input[type="password"], textarea { cursor: var(--cur-text); }
/* net.js injects its own <style> (cursor: pointer / default) after this sheet; these selectors out-rank it */
#ae-net button:not(:disabled) { cursor: var(--cur-pointer); }
html #ae-net .nu-rank .win-h { cursor: var(--cur-default); }   /* the ranking window is not draggable */

#game, #overlay {
  position: fixed;
  left: 0;
  top: 0;
  width: 100vw;
  height: 100vh;
  display: block;
  image-rendering: crisp-edges;
  image-rendering: pixelated;
}
#game { z-index: 0; touch-action: none; background: var(--void); }
#overlay { z-index: 1; pointer-events: none; }

#ui {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  font: calc(14px * var(--txt))/1.3 var(--f-ui);
  color: var(--parch);
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}
:where(#ui) *, :where(#ui) *::before, :where(#ui) *::after { box-sizing: border-box; }
:where(#ui) button { font-family: var(--f-ui); color: inherit; }
:where(#ui) img, :where(#ui) canvas, .px { image-rendering: crisp-edges; image-rendering: pixelated; }
:where(#ui) img { -webkit-user-drag: none; }
:where(#ui) p { margin: 0; }
.noscript { position: fixed; inset: 0; display: grid; place-items: center; margin: 0; font: calc(18px * var(--txt)) var(--f-ui); color: var(--parch); background: var(--void); }

.hide { display: none !important; }
.dim { color: var(--dim); }
.ic { display: inline-block; vertical-align: middle; }

/* ---------- panels: bronze pixel frame + corner rivets ---------- */
.pnl {
  position: relative;
  pointer-events: auto;
  background:
    linear-gradient(180deg, rgba(255, 230, 180, .045), transparent 38%),
    linear-gradient(180deg, var(--panel2), var(--panel) 55%, #100c15);
  border: 2px solid var(--bronze);
  box-shadow:
    inset 0 0 0 1px var(--ink),
    inset 0 0 0 2px rgba(244, 212, 124, .10),
    0 0 0 1px var(--ink),
    0 8px 22px rgba(0, 0, 0, .55);
}
.pnl::after {
  content: "";
  position: absolute;
  inset: 2px;
  pointer-events: none;
  background:
    linear-gradient(135deg, var(--gold2) 0 34%, var(--bronze) 34% 67%, #3a2a16 67%) 0 0 / 4px 4px no-repeat,
    linear-gradient(135deg, var(--gold2) 0 34%, var(--bronze) 34% 67%, #3a2a16 67%) 100% 0 / 4px 4px no-repeat,
    linear-gradient(135deg, var(--gold2) 0 34%, var(--bronze) 34% 67%, #3a2a16 67%) 0 100% / 4px 4px no-repeat,
    linear-gradient(135deg, var(--gold2) 0 34%, var(--bronze) 34% 67%, #3a2a16 67%) 100% 100% / 4px 4px no-repeat;
}

/* ---------- buttons ---------- */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 14px;
  font: 600 calc(14px * var(--txt))/1 var(--f-ui);
  color: var(--parch);
  text-shadow: 0 1px 0 #000;
  white-space: nowrap;
  background: linear-gradient(180deg, #3a2c3e 0, #2a2030 45%, #1d1622 100%);
  border: 2px solid var(--bronze);
  box-shadow: inset 0 0 0 1px var(--ink), inset 0 2px 0 rgba(255, 255, 255, .08);
  clip-path: var(--notch);
  cursor: var(--cur-pointer);
  pointer-events: auto;
}
.btn:hover { border-color: var(--gold); color: var(--gold2); background: linear-gradient(180deg, #4a3a4e 0, #33283a 45%, #231a29 100%); }
.btn:active { transform: translateY(1px); box-shadow: inset 0 0 0 1px var(--ink), inset 0 2px 6px rgba(0, 0, 0, .6); }
.btn:focus-visible { outline: none; border-color: var(--gold2); box-shadow: inset 0 0 0 1px var(--ink), inset 0 0 0 3px rgba(244, 212, 124, .55); }
.btn:disabled { opacity: .45; cursor: var(--cur-disabled); filter: grayscale(.6); transform: none; }
.btn:disabled:hover { border-color: var(--bronze); color: var(--parch); }
.btn img { width: 16px; height: 16px; }

.btn.gold {
  color: #1a1008;
  text-shadow: 0 1px 0 rgba(255, 245, 210, .45);
  background: linear-gradient(180deg, #fff0b0 0, #f4d47c 18%, #d6a84c 55%, #9a7434 100%);
  border-color: #5a4426;
  box-shadow: inset 0 0 0 1px #fff2c055, inset 0 -3px 0 rgba(90, 60, 20, .45);
}
.btn.gold:hover { color: #000; background: linear-gradient(180deg, #fff6cc 0, #ffe08a 18%, #e8b85a 55%, #a8803c 100%); border-color: #3a2a16; }
.btn.gold:focus-visible { box-shadow: inset 0 0 0 2px #fff6cc, inset 0 -3px 0 rgba(90, 60, 20, .45); }
.btn.red { background: linear-gradient(180deg, #9a3030 0, #7a1c20 50%, #4a0c10 100%); border-color: #c4232e; color: #ffe0d8; }
.btn.red:hover { background: linear-gradient(180deg, #b23a3a 0, #8e2226 50%, #5a1014 100%); border-color: var(--danger); color: #fff; }
.btn.ghost { background: rgba(10, 8, 14, .65); border-color: var(--edge); color: var(--dim); }
.btn.ghost:hover { border-color: var(--bronze); color: var(--parch); background: rgba(40, 30, 46, .8); }
.btn.sm { min-height: 28px; padding: 0 10px; font-size: calc(13px * var(--txt)); }
.btn.big { min-height: 50px; font-size: calc(22px * var(--txt-h)); letter-spacing: .5px; }
.btn.wide { width: 100%; }
.btn.toggle { justify-content: space-between; }
/* big text ("Tamanho do texto"): a long value ("Muito grande", "Auto · Ultra") drops under its label instead of spilling out */
.btn.toggle { flex-wrap: wrap; row-gap: 3px; padding-top: 5px; padding-bottom: 5px; white-space: normal; text-align: left; }
.btn.toggle b { margin-left: auto; }
.btn.toggle b { font: 400 calc(11px * var(--txt)) var(--f-num); color: var(--exc); }
.btn.toggle.off b { color: var(--dim); }
.btn.on { border-color: var(--rare); color: var(--rare); }
.btn.armed { border-color: var(--danger); color: #fff; background: linear-gradient(180deg, #9a3030, #5a1014); animation: armed .5s steps(2) infinite; }

kbd, .key {
  display: inline-block;
  font: 400 calc(9px * var(--txt))/1 var(--f-num);
  color: var(--parch);
  background: rgba(7, 6, 11, .82);
  border: 1px solid var(--edge);
  padding: 2px 3px 1px;
  text-shadow: none;
}

/* ---------- bars ---------- */
.bar {
  position: relative;
  height: 8px;
  overflow: hidden;
  background: var(--well);
  border: 1px solid var(--ink);
  box-shadow: 0 0 0 1px var(--edge);
}
.bar-f, .bar-t {
  position: absolute;
  inset: 0;
  transform-origin: 0 50%;
  transform: scaleX(0);
}
.bar-f { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35); }
.bar-t { background: rgba(255, 240, 210, .55); }
.bar::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(90deg, transparent 0 5px, rgba(0, 0, 0, .22) 5px 6px);
}
.bar-txt {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  font: 400 calc(8px * var(--txt))/1 var(--f-num);
  color: #fff;
  text-shadow: 1px 1px 0 #000, -1px 0 0 #000, 0 -1px 0 #000;
  white-space: nowrap;
}
.bar.hp .bar-f { background: linear-gradient(180deg, var(--hp2), var(--hp) 55%, #7a0e18); }
.bar.mp .bar-f { background: linear-gradient(180deg, var(--mp2), var(--mp) 55%, #14307a); }
.bar.xp .bar-f, .bar.quest .bar-f { background: linear-gradient(180deg, #ffeeb0, var(--xp) 50%, #8a6a1a); }
.bar.foe { height: 14px; }
.bar.foe .bar-f { background: linear-gradient(180deg, #ff7a5a, var(--hp) 50%, #6a0c16); }
.bar.foe .bar-t { background: #ffe0a0; }
.bar.foe .bar-txt { font-size: calc(9px * var(--txt)); }
.bar.xp, .bar.quest { height: 12px; }

/* ---------- tags ---------- */
.tag {
  display: inline-block;
  font: 400 calc(9px * var(--txt))/1 var(--f-num);
  padding: 3px 5px 2px;
  border: 1px solid var(--edge);
  color: var(--parch);
  background: rgba(0, 0, 0, .55);
  white-space: nowrap;
}
.tag.gold { color: #1a1008; background: var(--gold); border-color: var(--ink); }
.tag.red { background: #7a1018; color: #ffd0c8; border-color: var(--danger); }
.tag.here { color: var(--gold2); border-color: var(--bronze); }

/* =====================================================================
   HUD
   ===================================================================== */
.hud { position: absolute; inset: 0; z-index: 5; pointer-events: none; }

/* ---------- top-left: player frame + buffs ---------- */
.hud-tl {
  position: absolute;
  left: calc(10px + env(safe-area-inset-left));
  top: calc(10px + env(safe-area-inset-top));
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.pf {
  width: 234px;
  display: flex;
  gap: 9px;
  align-items: center;
  padding: 6px 9px 7px 6px;
  cursor: var(--cur-pointer);
}
.pf:hover { border-color: var(--gold); }
.pf-embw {
  position: relative;
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 40% 35%, #2a2030, var(--well));
  border: 2px solid var(--bronze);
  box-shadow: inset 0 0 0 1px var(--ink);
}
.pf-emb { width: 32px; height: 32px; }
/* player portrait (AE.Portrait): 48×48 at 1× inside the border; cropped (never scaled) on narrow screens */
.pf-ptw { position: absolute; inset: 0; overflow: hidden; }
.pf-pt { position: absolute; left: 0; top: 0; width: 48px; height: 48px; }
.pf-embw.pt .pf-emb, .pf-embw:not(.pt) .pf-ptw { display: none; }
.pf-badge {
  position: absolute;
  right: -7px;
  bottom: -7px;
  min-width: 20px;
  padding: 3px 3px 2px;
  font: 400 calc(10px * var(--txt))/1 var(--f-num);
  text-align: center;
  color: #1a1008;
  background: linear-gradient(180deg, var(--gold2), var(--gold));
  border: 1px solid var(--ink);
}
.pf-info { flex: 1; min-width: 0; }
.pf-name { font-weight: 700; font-size: calc(15px * var(--txt)); line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 0 #000; }
.pf-cls { font-size: calc(11px * var(--txt)); color: var(--dim); margin-bottom: 2px; }
.pf .bar { margin-top: 3px; height: 7px; }
.pf.lvl { animation: lvlFlash .9s steps(6); }

.buffs { display: flex; flex-wrap: wrap; gap: 4px 5px; max-width: 232px; }
.buff {
  position: relative;
  width: 26px;
  height: 26px;
  margin-bottom: 10px;
  padding: 2px;
  background: #000;
  border: 1px solid var(--gold);
  box-shadow: 0 0 0 1px var(--ink), 0 0 8px -2px rgba(244, 212, 124, .5);
  pointer-events: auto;
}
.buff img { width: 20px; height: 20px; display: block; }
.buff-sw { position: absolute; inset: 2px; background: rgba(7, 6, 11, .62); transform-origin: 50% 0; transform: scaleY(0); }
.buff-t {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-top: 1px;
  font: 400 calc(8px * var(--txt))/1 var(--f-num);
  color: var(--parch);
  text-shadow: 1px 1px 0 #000;
  white-space: nowrap;
}
.buff.ending { animation: blink .5s steps(2) infinite; }

/* ---------- top-center: boss bar + target frame ---------- */
.hud-tc {
  position: absolute;
  left: 50%;
  top: calc(10px + env(safe-area-inset-top));
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.tf { width: calc(268px * var(--txt)); padding: 5px 9px 8px; }   /* × "Tamanho do texto": a long monster name + its tags fit as at 1x */
.tf-top { display: flex; align-items: baseline; gap: 6px; margin-bottom: 4px; }
.tf-lvl { font: 400 calc(10px * var(--txt))/1 var(--f-num); color: var(--dim); }
.tf-name { flex: 1; min-width: 0; font-weight: 700; font-size: calc(14px * var(--txt)); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 0 #000; }
.tf-tags { display: flex; gap: 3px; }
.tf.npc { padding-bottom: 6px; }
.tf.npc .bar { display: none; }

.boss {
  width: min(560px, 76vw, calc(100vw - 500px));   /* stay clear of the player frame (left) and minimap (right) */
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity .3s steps(5), transform .3s steps(5);
}
.boss.on { opacity: 1; transform: none; }
.boss.enter .boss-n { animation: bossName .8s steps(8); }
.boss-top { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 4px; }
.boss-sk { width: 24px; height: 20px; filter: drop-shadow(0 0 6px rgba(255, 60, 40, .6)); }
.boss-sk.flip { transform: scaleX(-1); }
.boss-names { text-align: center; }
.boss-n {
  font: 400 32px/1 var(--f-title);
  color: #ffc09a;
  text-shadow: 0 0 14px rgba(255, 60, 30, .65), 0 3px 0 #2a0604, 0 0 2px #000;
}
.boss-l { font: 400 calc(9px * var(--txt))/1 var(--f-num); color: var(--dim); letter-spacing: 2px; margin-top: 2px; }
.bar.boss {
  /* the bar also carries the .boss class: undo the container's hidden/enter state (it stayed at opacity 0) */
  width: auto; opacity: 1; transform: none; transition: none;
  height: 18px;
  border: 2px solid #5a1a14;
  background: #160608;
  box-shadow: 0 0 0 1px var(--ink), 0 0 0 3px #3a2a16, 0 0 0 4px var(--ink), 0 0 18px rgba(255, 60, 40, .35);
}
.bar.boss .bar-f { background: linear-gradient(180deg, #ff8a5a 0, #e0302c 30%, #a0141c 70%, #5a0a10 100%); }
.bar.boss .bar-t { background: #ffd8a8; }
.bar.boss::after { background: repeating-linear-gradient(90deg, transparent 0 calc(10% - 2px), rgba(7, 6, 11, .75) calc(10% - 2px) 10%); }
.bar.boss .bar-txt { font-size: calc(10px * var(--txt)); }
.boss.enraged .bar-f { animation: enrage .7s steps(2) infinite; }

/* ---------- top-right: minimap + quest tracker ---------- */
.hud-tr {
  position: absolute;
  right: calc(10px + env(safe-area-inset-right));
  top: calc(10px + env(safe-area-inset-top));
  width: calc(204px * var(--txt-h));     /* minimap + quest tracker column: widens with "Tamanho do texto" */
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
}
.mm { padding: 6px 8px 6px; }
.mm-name {
  font: 400 calc(22px * var(--txt-h))/1 var(--f-title);
  color: var(--gold2);
  text-align: center;
  text-shadow: 0 2px 0 #000, 0 0 10px rgba(214, 168, 76, .3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 3px;
}
.mm-view {
  position: relative;
  width: 184px;
  height: 94px;
  margin: 0 auto;
  cursor: var(--cur-pointer);
  pointer-events: auto;
  outline: none;
}
.mm-view:focus-visible .mm-frame polygon:nth-child(2) { stroke: var(--gold2); }
.mm-clip {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  place-content: center;   /* the 128px canvas overflows the clip: centre the track, not just the item in it */
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 50%, #120e18, var(--void));
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
}
.mm-cv { width: 128px; height: 128px; transform: scaleY(.5) rotate(45deg); }
.mm-frame { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.mm-gem {
  position: absolute;
  left: 50%;
  top: -3px;
  width: 8px;
  height: 8px;
  margin-left: -4px;
  background: linear-gradient(135deg, #fff2c0, var(--gold) 50%, #5a4426);
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
  pointer-events: none;
}
.mm-gem.b { top: auto; bottom: -3px; }
.mm-info { display: flex; justify-content: space-between; align-items: center; margin-top: 4px; padding: 0 2px; font: 400 calc(10px * var(--txt))/1 var(--f-num); color: var(--dim); }
.mm-clock { display: inline-flex; align-items: center; gap: 4px; color: var(--parch); }
.mm-ic { width: 18px; height: 18px; }

.qt { padding: 6px 8px 7px; cursor: var(--cur-pointer); }
.qt:hover { border-color: var(--gold); }
.qt-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0 6px; margin-bottom: 2px; }   /* big text on a phone: the 1/5 count drops under the title */
.qt-head img { width: 24px; height: 24px; }        /* 12px glyph at 2x */
.qt-head span { font: 400 calc(19px * var(--txt))/1 var(--f-title); color: var(--gold2); }
.qt-n { margin-left: auto; font: 400 calc(10px * var(--txt))/1 var(--f-num) !important; color: var(--parch) !important; }
.qt-text { font-size: calc(12px * var(--txt)); line-height: 1.3; margin-bottom: 4px; }
.qt .bar { height: 6px; }
.qt-state { font-size: calc(11px * var(--txt)); color: var(--dim); margin-top: 3px; }
.qt.done { border-color: var(--exc); }
.qt.done .qt-state { color: var(--exc); animation: glowText 1.4s ease-in-out infinite; }
.qt.done .bar-f { background: linear-gradient(180deg, #b8ffb0, var(--exc) 50%, #1e7a2a); }

/* ---------- chat log ---------- */
.chat {
  position: absolute;
  left: calc(10px + env(safe-area-inset-left));
  bottom: calc(var(--con-h) + 10px + env(safe-area-inset-bottom));
  width: min(430px, 42vw);
  pointer-events: none;
}
.chat-btn {
  display: grid;
  place-items: center;
  width: 26px;
  height: 22px;
  margin-bottom: 3px;
  padding: 0;
  background: rgba(12, 9, 16, .7);
  border: 1px solid var(--edge);
  opacity: .65;
  cursor: var(--cur-pointer);
  pointer-events: auto;
}
.chat-btn:hover, .chat.open .chat-btn { opacity: 1; border-color: var(--bronze); }
.chat-btn img { width: 20px; height: 16px; }
.chat-l { display: block; max-height: 126px; overflow: hidden; scrollbar-width: thin; scrollbar-color: var(--bronze) transparent; }
.ln {
  padding: 1px 8px 1px 6px;
  font: calc(13px * var(--txt))/calc(16px * var(--txt)) var(--f-ui);
  color: var(--parch);
  text-shadow: 0 1px 0 #000, 0 0 3px #000, 1px 0 0 #000;
  background: linear-gradient(90deg, rgba(7, 6, 11, .55), rgba(7, 6, 11, 0));
  pointer-events: auto;
  transition: opacity .9s;
  overflow-wrap: anywhere;
}
.ln.old { opacity: 0; pointer-events: none; }
/* collapsed log: last 7 lines (hover / history button shows everything) */
.chat:not(:hover):not(.open) .ln:nth-last-child(n+8) { display: none; }
.chat:hover .chat-l, .chat.open .chat-l {
  max-height: min(42vh, 360px);
  overflow-y: auto;
  padding: 4px 0;
  background: rgba(12, 9, 16, .9);
  border: 2px solid var(--bronze);
  box-shadow: 0 0 0 1px var(--ink), 0 8px 18px rgba(0, 0, 0, .5);
  pointer-events: auto;
}
.chat:hover .ln, .chat.open .ln { display: block; opacity: 1; pointer-events: auto; background: none; }

/* ---------- bottom console (orbs + belt + menu) ---------- */
.console {
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: max-content;
  max-width: 100vw;
  padding-bottom: env(safe-area-inset-bottom);
  pointer-events: none;
}
.xp {
  position: relative;
  height: 12px;
  margin: 0 calc(var(--orb) * .42) 0;
  background: var(--well);
  border: 1px solid var(--ink);
  box-shadow: 0 0 0 1px var(--bronze), 0 0 0 2px var(--ink);
  pointer-events: auto;
  z-index: 3;
}
.xp-f {
  position: absolute;
  inset: 0;
  transform-origin: 0 50%;
  transform: scaleX(0);
  background: linear-gradient(180deg, #fff2c0 0, var(--xp) 45%, #8a6a1a 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5);
}
.xp-seg {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(90deg, transparent 0 calc(10% - 1px), rgba(7, 6, 11, .85) calc(10% - 1px) 10%);
}
.xp-txt {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font: 400 calc(8px * var(--txt))/1 var(--f-num);
  color: #fff;
  text-shadow: 1px 1px 0 #000, -1px 0 0 #000, 0 -1px 0 #000;
  white-space: nowrap;
}
.xp.flash { animation: xpFlash .8s steps(6); }

.con-row { display: flex; align-items: flex-end; }
.con-plate {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 -14px;
  padding: 8px 24px 9px;
  pointer-events: auto;
  background:
    linear-gradient(180deg, rgba(255, 230, 180, .06), transparent 30%),
    repeating-linear-gradient(90deg, rgba(0, 0, 0, .0) 0 31px, rgba(0, 0, 0, .18) 31px 32px),
    linear-gradient(180deg, #2a2131, #1a141f 55%, #120d16);
  border: 2px solid var(--bronze);
  border-bottom: 0;
  box-shadow: inset 0 0 0 1px var(--ink), inset 0 2px 0 rgba(244, 212, 124, .14), 0 -4px 14px rgba(0, 0, 0, .5);
}
.con-plate::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -7px;
  width: 12px;
  height: 12px;
  margin-left: -6px;
  background: linear-gradient(135deg, #ffd0c0, #c4232e 45%, #5a0a14);
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
  filter: drop-shadow(0 0 4px rgba(255, 80, 60, .7));
}
.belt { display: flex; align-items: center; gap: 9px; }
.pots, .skills { display: flex; gap: 4px; }
.con-div { width: 2px; height: 40px; background: linear-gradient(180deg, transparent, var(--bronze), transparent); flex: 0 0 auto; }

.orb {
  position: relative;
  z-index: 2;
  flex: 0 0 auto;
  width: var(--orb);
  height: var(--orb);
  padding: 0;
  margin-bottom: 2px;
  background: none;
  border: 0;
  cursor: var(--cur-pointer);
  pointer-events: auto;
}
.orb:focus-visible { outline: 2px solid var(--gold2); outline-offset: 2px; }
.orb-cv { position: relative; z-index: 1; display: block; width: 100%; height: 100%; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .7)); }
.orb-glow { position: absolute; inset: -8%; border-radius: 50%; opacity: .55; pointer-events: none; }
.orb.hp .orb-glow { background: radial-gradient(circle, rgba(255, 60, 50, .35), transparent 65%); }
.orb.mp .orb-glow { background: radial-gradient(circle, rgba(80, 140, 255, .35), transparent 65%); }
.orb.low .orb-glow { animation: orbPulse .6s ease-in-out infinite; opacity: 1; }
.orb.hit .orb-cv { animation: orbHit .28s steps(4); }
.orb-txt {
  position: absolute;
  z-index: 2;
  left: 0;
  right: 0;
  top: 44%;
  text-align: center;
  font-family: var(--f-num);
  color: #fff;
  text-shadow: 1px 1px 0 #000, -1px 0 0 #000, 0 -1px 0 #000, 0 0 4px #000;
  pointer-events: none;
}
.orb-v { display: block; font-size: calc(12px * var(--txt)); line-height: 1; }
.orb-m { display: block; font-size: calc(8px * var(--txt)); line-height: 1; color: var(--parch); opacity: .8; margin-top: 2px; }
.orb-pot {
  display: none;
  position: absolute;
  z-index: 3;
  left: 50%;
  bottom: -2px;
  transform: translateX(-50%);
  padding: 2px 4px 1px;
  font: 400 calc(8px * var(--txt))/1 var(--f-num);
  color: var(--parch);
  white-space: nowrap;
  background: rgba(7, 6, 11, .9);
  border: 1px solid var(--bronze);
}
.orb-pot.empty { color: var(--danger); }

.slot-btn {
  position: relative;
  flex: 0 0 auto;
  width: var(--sk);
  height: var(--sk);
  padding: 0;
  display: grid;
  place-items: center;
  background: var(--well);
  border: 2px solid var(--edge);
  box-shadow: inset 0 0 0 1px var(--ink), inset 0 0 10px rgba(0, 0, 0, .85);
  cursor: var(--cur-pointer);
  pointer-events: auto;
}
.slot-btn:hover { border-color: var(--gold); }
.slot-btn:focus-visible { outline: none; border-color: var(--gold2); box-shadow: inset 0 0 0 1px var(--ink), 0 0 0 2px rgba(244, 212, 124, .5); }
.slot-btn .key { position: absolute; left: 1px; top: 1px; z-index: 4; font-size: calc(8px * var(--txt)); padding: 1px 2px 0; pointer-events: none; }
.pot { width: var(--pot); height: var(--pot); }
.pot-img { width: 32px; height: 32px; }
.pot-n {
  position: absolute;
  right: 2px;
  bottom: 1px;
  z-index: 3;
  font: 400 calc(10px * var(--txt))/1 var(--f-num);
  color: #fff;
  text-shadow: 1px 1px 0 #000, -1px 0 0 #000, 0 -1px 0 #000;
}
.pot.empty .pot-img { opacity: .3; filter: grayscale(1); }
.pot.empty .pot-n { color: var(--danger); }

.sk-img { width: calc(var(--sk) - 4px); height: calc(var(--sk) - 4px); display: block; }
.sk-cd { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.sk-cdt {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  font: 400 calc(13px * var(--txt))/1 var(--f-num);
  color: #fff;
  text-shadow: 1px 1px 0 #000, -1px 0 0 #000, 0 -1px 0 #000, 1px -1px 0 #000;
  pointer-events: none;
}
.sk-lock {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: rgba(10, 8, 14, .7);
  pointer-events: none;
}
.sk-lock img { width: 16px; height: 20px; }
.sk-lv { font: 400 calc(7px * var(--txt))/1 var(--f-num); color: var(--parch); text-shadow: 1px 1px 0 #000; }
.sk.locked .sk-lock { display: flex; }
.sk.locked .sk-img { filter: grayscale(1) brightness(.5); }
/* learned skill locked by its attributes (MU checks them on every use): red lock, red requirement */
.sk.statlock { border-color: #9a2b2b; }
.sk.statlock .sk-lock img { filter: grayscale(1) sepia(1) saturate(7) hue-rotate(-38deg) brightness(.95); }
.sk.statlock .sk-lv { color: #ff6b5e; }
.orb-pot.cooling { opacity: .45; }
.sk.nomp .sk-img { filter: saturate(.45) brightness(.8); }
.sk.nomp::after { content: ""; position: absolute; inset: 0; z-index: 2; background: rgba(196, 35, 46, .32); box-shadow: inset 0 0 0 1px rgba(255, 77, 77, .6); pointer-events: none; }
.sk.rmb { border-color: var(--gold2); box-shadow: inset 0 0 0 1px var(--ink), 0 0 8px rgba(244, 212, 124, .55); }
.sk-rmb {
  display: none;
  position: absolute;
  right: 2px;
  top: 2px;
  z-index: 4;
  width: 7px;
  height: 9px;
  background: linear-gradient(90deg, #fff 0 50%, #6a6070 50%);
  border: 1px solid var(--ink);
  pointer-events: none;
}
.sk.rmb .sk-rmb { display: block; }
.sk.ready::before { content: ""; position: absolute; inset: -2px; z-index: 5; pointer-events: none; animation: ready .4s steps(4) forwards; }
.sk.deny { animation: shake .25s steps(4); }
.sk.press .sk-img { animation: press .15s steps(2); }

.menu-btns { display: grid; grid-template-columns: repeat(3, var(--mbs)); gap: 3px; }
.mb {
  position: relative;
  width: var(--mbs);
  height: var(--mbs);
  padding: 0;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, #2c2232, #16101b);
  border: 2px solid var(--edge);
  box-shadow: inset 0 0 0 1px var(--ink), inset 0 2px 0 rgba(255, 255, 255, .06);
  cursor: var(--cur-pointer);
  pointer-events: auto;
}
.mb img { width: 24px; height: 24px; }
.mb .key { position: absolute; right: 0; bottom: 0; font-size: calc(6px * var(--txt)); padding: 1px 1px 0; pointer-events: none; }
.mb:hover { border-color: var(--gold); }
.mb.on { border-color: var(--gold); background: linear-gradient(180deg, #4a3a22, #241a10); }
.mb:focus-visible { outline: none; border-color: var(--gold2); }
.badge {
  position: absolute;
  top: -7px;
  right: -7px;
  z-index: 2;
  min-width: 16px;
  height: 16px;
  padding: 0 3px;
  font: 400 calc(9px * var(--txt))/calc(15px * var(--txt)) var(--f-num);
  text-align: center;
  color: #fff;
  background: var(--danger);
  border: 1px solid var(--ink);
  animation: badge 1s steps(2) infinite;
}

/* ---------- overlays ---------- */
.vignette {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(ellipse at center, transparent 48%, rgba(150, 0, 12, .38) 78%, rgba(120, 0, 10, .75) 100%);
  transition: opacity .4s;
}
.vignette.on { animation: vig 1.1s ease-in-out infinite; }
.vignette.crit { animation-duration: .55s; }

.toasts {
  position: absolute;
  left: 50%;
  top: 22%;
  z-index: 60;
  transform: translateX(-50%);
  width: min(92vw, 660px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: none;
}
#ui.mode-title .toasts { display: none; }
.toast {
  --tc: var(--parch);
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 6px 14px 7px;
  font: 600 calc(15px * var(--txt))/1.2 var(--f-ui);
  color: var(--tc);
  text-align: center;
  text-shadow: 0 1px 0 #000;
  background: rgba(12, 9, 16, .9);
  border: 1px solid var(--edge);
  border-top: 2px solid var(--tc);
  box-shadow: 0 6px 16px rgba(0, 0, 0, .5);
  animation: toastIn .24s steps(4) both;
}
.toast.out { animation: toastOut .4s steps(4) forwards; }
.toast.bump { animation: bump .25s steps(3); }
.toast-n { font: 400 calc(10px * var(--txt))/1 var(--f-num); color: var(--dim); }
.toast-n:empty { display: none; }
.toast.big {
  --tc: var(--gold2);
  position: relative;
  isolation: isolate;
  padding: 14px 30px;
  font: 400 clamp(46px, 8vw, 88px)/1 var(--f-title);
  background: none;
  border: 0;
  box-shadow: none;
  text-shadow: 0 0 18px rgba(255, 190, 60, .75), 0 4px 0 #3a2208, 0 0 2px #000;
  animation: bigIn .55s cubic-bezier(.2, 1.6, .4, 1) both;
}
.toast.big.out { animation: toastOut .45s steps(5) forwards; }
.toast-rays {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: -1;
  width: 380px;
  height: 380px;
  margin: -190px 0 0 -190px;
  background: repeating-conic-gradient(rgba(255, 214, 110, .26) 0 7deg, transparent 7deg 20deg);
  -webkit-mask: radial-gradient(circle, #000 18%, transparent 64%);
  mask: radial-gradient(circle, #000 18%, transparent 64%);
  animation: spin 9s linear infinite;
}

.banner {
  position: absolute;
  left: 50%;
  top: 15%;
  z-index: 6;
  transform: translateX(-50%);
  text-align: center;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
}
.banner.show { animation: banner 3.6s ease-out both; }
.banner-n {
  font: 400 clamp(40px, 7vw, 76px)/1 var(--f-title);
  color: var(--gold2);
  text-shadow: 0 0 18px rgba(214, 168, 76, .55), 0 3px 0 #000, 0 0 2px #000;
}
.banner-s { margin-top: 4px; font: 400 calc(11px * var(--txt))/1 var(--f-num); color: var(--parch); letter-spacing: 3px; text-transform: uppercase; text-shadow: 1px 1px 0 #000; }
.banner-orn { display: block; width: 260px; height: 2px; margin: 8px auto; background: linear-gradient(90deg, transparent, var(--gold), transparent); }
.banner-orn.b { width: 160px; }

.death {
  position: absolute;
  inset: 0;
  z-index: 70;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  pointer-events: auto;
  background: radial-gradient(ellipse at center, rgba(60, 0, 8, .35), rgba(7, 6, 11, .86) 75%);
}
.death.show { animation: fadeIn .8s steps(8) both; }
.death-h {
  font: 400 clamp(56px, 11vw, 124px)/1 var(--f-title);
  color: #ff4d4d;
  letter-spacing: 4px;
  text-shadow: 0 0 26px rgba(255, 40, 40, .65), 0 5px 0 #2a0004, 0 0 2px #000;
}
.death.show .death-h { animation: deathIn 1.3s ease-out both; }
.death-s { margin-top: 10px; font-size: calc(16px * var(--txt)); color: var(--parch); text-shadow: 0 1px 0 #000; }
.death-t { margin-top: 16px; font: 400 calc(12px * var(--txt))/1 var(--f-num); color: var(--dim); }

/* ---------- tooltips ---------- */
.tip {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 90;
  max-width: min(calc(600px * var(--txt)), calc(100vw - 12px));   /* × "Tamanho do texto" like .itip: item + "Equipado" stay side by side (stacked, the 2nd ran off a 768px screen) */
  max-height: calc(100vh - 12px);   /* a long compare tooltip never runs off a short window */
  overflow: hidden;
  pointer-events: none;
}
.tip-box, .itip {
  min-width: 180px;
  max-width: min(calc(290px * var(--txt)), calc(100vw - 12px));   /* grows with "Tamanho do texto": lines wrap as at 1x */
  overflow-wrap: break-word;        /* long item / unique names and mod lines wrap inside the box */
  padding: 8px 10px 9px;
  font: calc(13px * var(--txt))/1.35 var(--f-ui);
  color: var(--parch);
  background: rgba(11, 8, 15, .97);
  border: 2px solid var(--bronze);
  box-shadow: inset 0 0 0 1px var(--ink), 0 0 0 1px var(--ink), 0 10px 26px rgba(0, 0, 0, .65);
}
.tip-t { font-weight: 700; font-size: calc(15px * var(--txt)); color: var(--gold2); text-shadow: 0 1px 0 #000; }
.tip-s { font: 400 calc(9px * var(--txt))/1.3 var(--f-num); color: var(--dim); margin: 2px 0 5px; text-transform: uppercase; letter-spacing: .5px; }
.tip-l { margin-top: 2px; }
.tip-l.dim { color: var(--dim); font-size: calc(12px * var(--txt)); }
.tip-l.bad { color: var(--danger); }
.tip-l.hint { color: var(--dim); font-size: calc(11px * var(--txt)); margin-top: 6px; }
.tip-row { display: flex; gap: 12px; font: 400 calc(10px * var(--txt))/1 var(--f-num); color: var(--parch); margin-bottom: 4px; }
.mana { color: var(--mp2); }

.itip { --rc: var(--parch); border-top-color: var(--rc); box-shadow: inset 0 0 0 1px var(--ink), 0 0 0 1px var(--ink), 0 0 18px -6px var(--rc), 0 10px 26px rgba(0, 0, 0, .65); }
.itip-wrap { display: flex; flex-wrap: wrap; gap: 6px; align-items: flex-start; }   /* stacks when two boxes do not fit side by side */
.itip-lbl { font: 400 calc(9px * var(--txt))/1 var(--f-num); color: var(--dim); letter-spacing: 1px; text-transform: uppercase; margin-bottom: 5px; }
.itip-n { font-weight: 700; font-size: calc(15px * var(--txt)); line-height: 1.2; text-shadow: 0 1px 0 #000; }
/* +N glow band of the item (ui.js itemTipNode data-g): the name glows in the band colour, +13 / +15 cycle the prism */
.itip-n[data-g="1"] { text-shadow: 0 1px 0 rgba(0, 0, 0, .6), 0 0 5px #e4ecff, 0 0 10px rgba(228, 236, 255, .7); }
.itip-n[data-g="2"] { text-shadow: 0 1px 0 rgba(0, 0, 0, .6), 0 0 5px #ffc23a, 0 0 10px rgba(255, 194, 58, .7); }
.itip-n[data-g="3"] { text-shadow: 0 1px 0 rgba(0, 0, 0, .6), 0 0 5px #ffd860, 0 0 11px #ffd860; }
.itip-n[data-g="4"], .itip-n[data-g="5"] { text-shadow: 0 1px 0 rgba(0, 0, 0, .6), 0 0 2px var(--th, transparent), 0 0 5px #ff4a6a, 0 0 11px #ff4a6a; animation: igTipPrism 2.7s linear infinite; }
.itip-n[data-g="5"] { --th: #fff4d8; }       /* +15: white-hot core */
.itip-s { font-size: calc(11px * var(--txt)); color: var(--dim); margin: 1px 0 5px; }
.itip-l { padding: 5px 0; border-top: 1px solid rgba(138, 106, 58, .3); }
.itip-l > div { margin: 1px 0; }
.itip-lore { font-style: italic; font-size: calc(12px * var(--txt)); color: #c9b896; padding: 4px 0; }
.itip-r { padding: 4px 0 0; font-size: calc(12px * var(--txt)); color: var(--dim); border-top: 1px solid rgba(138, 106, 58, .3); }
.itip-r .bad { color: var(--danger); }
.itip-d { margin-top: 5px; padding: 5px 6px; background: rgba(0, 0, 0, .35); border: 1px solid var(--edge); font-size: calc(12px * var(--txt)); }
.itip-dh { font: 400 calc(9px * var(--txt))/1 var(--f-num); color: var(--dim); text-transform: uppercase; margin-bottom: 3px; }
.itip-d > div:not(.itip-dh) { display: flex; justify-content: space-between; gap: 10px; }
.itip-d .up b { color: var(--exc); }
.itip-d .down b { color: var(--danger); }
.itip-d b { font: 400 calc(10px * var(--txt))/1.5 var(--f-num); }
.itip-v { display: flex; align-items: center; gap: 5px; margin-top: 6px; font: 400 calc(10px * var(--txt))/1 var(--f-num); color: var(--rare); }
.itip-v img { width: 16px; height: 16px; }        /* 8px coin at 2x */
.itip-v .bad { color: var(--danger); }
.itip-h { margin-top: 5px; font-size: calc(11px * var(--txt)); color: var(--dim); }

/* ---------- touch sheet ---------- */
.sheet {
  position: absolute;
  left: 50%;
  bottom: 0;
  z-index: 86;
  width: min(560px, 100%);
  max-height: 74vh;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  padding: 12px 12px calc(12px + env(safe-area-inset-bottom));
  border-bottom: 0;
}
.sheet.pop { animation: sheetUp .22s steps(4); }
.sheet-b { overflow-y: auto; min-height: 0; }
.sheet-b .itip, .sheet-b .tip-box { max-width: none; min-width: 0; padding: 0; background: none; border: 0; box-shadow: none; }
.sheet-b .itip-wrap { flex-direction: column; gap: 10px; }
.sheet-b .itip-wrap > .itip:last-child { padding-top: 8px; border-top: 1px dashed var(--edge); }
.sheet-a { display: grid; grid-template-columns: repeat(auto-fit, minmax(104px, 1fr)); gap: 6px; margin-top: 12px; }
.sheet-a .btn { min-height: 44px; }

/* ---------- cursor-held item ---------- */
.held {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 95;
  pointer-events: none;
  filter: drop-shadow(0 8px 6px rgba(0, 0, 0, .65)) drop-shadow(0 0 1px #000);
}
.held img { width: 100%; height: 100%; object-fit: contain; display: block; }
.held .it-qty { right: 2px; bottom: 2px; }

/* =====================================================================
   WINDOWS
   ===================================================================== */
.wins { position: absolute; inset: 0; z-index: 20; pointer-events: none; }
.backdrop { position: absolute; inset: 0; z-index: 39; background: rgba(7, 6, 11, .62); pointer-events: auto; }
.win {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 40;
  width: 330px;
  max-width: calc(100vw - 16px);
  max-height: calc(100vh - 140px);
  display: flex;
  flex-direction: column;
}
.win.pop { animation: winPop .18s steps(4); }
.win.dragging { opacity: .92; }
.win-h {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 5px 0 12px;
  background:
    linear-gradient(90deg, transparent, rgba(214, 168, 76, .14) 50%, transparent),
    linear-gradient(180deg, #2c2133, #18121f);
  border-bottom: 2px solid var(--edge);
  box-shadow: inset 0 -1px 0 var(--ink), 0 1px 0 rgba(244, 212, 124, .12);
  cursor: var(--cur-grab);
  touch-action: none;
}
.win.dragging .win-h { cursor: var(--cur-grabbing); }
.win-t {
  flex: 1;
  min-width: 0;
  font: 400 calc(26px * var(--txt-h))/1 var(--f-title);
  color: var(--gold2);
  letter-spacing: .5px;
  text-shadow: 0 0 10px rgba(214, 168, 76, .35), 0 2px 0 #000;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.win-t::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 8px;
  vertical-align: 5px;
  background: linear-gradient(135deg, #fff2c0, var(--gold) 50%, #5a4426);
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
}
.win-k { font-size: calc(9px * var(--txt)); color: var(--dim); }
.win-x {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  padding: 0;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, #3a2030, #1d1018);
  border: 2px solid var(--edge);
  cursor: var(--cur-pointer);
}
.win-x img { width: 16px; height: 16px; }
.win-x:hover { border-color: var(--danger); background: linear-gradient(180deg, #6a2030, #3a1018); }
.win-x:focus-visible { outline: none; border-color: var(--gold2); }
.win-b {
  flex: 1 1 auto;
  min-height: 0;
  padding: 12px 14px 14px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--bronze) var(--well);
}
.win-b::-webkit-scrollbar, .shop-list::-webkit-scrollbar, .t-list::-webkit-scrollbar, .chat-l::-webkit-scrollbar, .sheet-b::-webkit-scrollbar, .t-scroll::-webkit-scrollbar { width: 8px; }
.win-b::-webkit-scrollbar-track, .shop-list::-webkit-scrollbar-track, .t-list::-webkit-scrollbar-track, .chat-l::-webkit-scrollbar-track, .sheet-b::-webkit-scrollbar-track, .t-scroll::-webkit-scrollbar-track { background: var(--well); }
.win-b::-webkit-scrollbar-thumb, .shop-list::-webkit-scrollbar-thumb, .t-list::-webkit-scrollbar-thumb, .chat-l::-webkit-scrollbar-thumb, .sheet-b::-webkit-scrollbar-thumb, .t-scroll::-webkit-scrollbar-thumb { background: var(--bronze); border: 2px solid var(--well); }

.sec {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin: 12px 0 6px;
  padding-bottom: 3px;
  border-bottom: 1px solid var(--edge);
  font: 400 calc(21px * var(--txt-h))/1 var(--f-title);
  color: var(--gold);
}
.list-empty { padding: 16px; text-align: center; color: var(--dim); }
.only-narrow { display: none; }

/* ---------- Personagem ---------- */
.w-char { width: calc(344px * var(--txt-h)); }
.cw-head { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; }
.cw-embw { position: relative; flex: 0 0 auto; width: 100px; height: 100px; display: grid; place-items: center; background: radial-gradient(circle at 40% 35%, #2a2030, var(--well)); border: 2px solid var(--bronze); box-shadow: inset 0 0 0 1px var(--ink); }
.cw-emb { width: 48px; height: 48px; }
.cw-pt { width: 96px; height: 96px; }
.cw-embw.pt .cw-emb { position: absolute; right: -6px; bottom: -6px; width: 32px; height: 32px; }
.cw-embw:not(.pt) .cw-pt { display: none; }
/* evolved class (Soul Master): violet portrait frame with a soft glow, here and on the HUD frame (.pf.evo) */
.cw-embw.evo, .pf.evo .pf-embw { border-color: #9c7cff; box-shadow: inset 0 0 0 1px var(--ink), 0 0 9px rgba(156, 124, 255, .6); }
.pf.evo .pf-cls { color: #c9b2ff; }
.cw-id { min-width: 0; }
.cw-name { font: 400 32px/1 var(--f-title); color: var(--gold2); text-shadow: 0 2px 0 #000; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cw-cls { font-size: calc(12px * var(--txt)); color: var(--dim); }
.cw-lvl { font: 400 calc(11px * var(--txt))/1 var(--f-num); margin-top: 3px; }
.cw-pts { font: 400 calc(11px * var(--txt))/1 var(--f-num); color: var(--dim); }
.cw-pts b { font-weight: 400; }
.cw-pts.on { color: var(--exc); animation: glowText 1.2s ease-in-out infinite; }
.cw-st {
  display: grid;
  grid-template-columns: 1fr auto 32px;
  gap: 8px;
  align-items: center;
  min-height: 34px;
  margin-bottom: 3px;
  padding: 2px 4px 2px 8px;
  background: rgba(0, 0, 0, .3);
  border: 1px solid transparent;
}
.cw-st:hover { border-color: var(--edge); }
.cw-st.up { animation: statUp .45s steps(4); }
.cw-sn { font-size: calc(14px * var(--txt)); }
.cw-svw { font: 400 calc(12px * var(--txt))/1 var(--f-num); text-align: right; }
.cw-sb { margin-left: 4px; font-size: calc(9px * var(--txt)); color: var(--exc); }
.plus {
  width: 28px;
  height: 28px;
  padding: 0;
  font: 700 18px/1 var(--f-ui) !important;      /* the + glyph is the button's icon: fixed with "Tamanho do texto" */
  color: #0e2a12 !important;
  background: linear-gradient(180deg, #c8ff9a, #5fcf5a 45%, #2a7a30);
  border: 2px solid var(--ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5), 0 0 8px -2px rgba(79, 224, 106, .6);
  cursor: var(--cur-pointer);
  touch-action: manipulation;
}
.plus:hover { filter: brightness(1.15); }
.plus:active { transform: translateY(1px); }
.plus:focus-visible { outline: 2px solid var(--gold2); outline-offset: 1px; }
.plus.off { visibility: hidden; }
.cw-der { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.cw-dr { display: flex; justify-content: space-between; gap: 6px; padding: 3px 0; font-size: calc(12px * var(--txt)); border-bottom: 1px dotted rgba(138, 106, 58, .28); }
.cw-dr span { color: var(--dim); }
.cw-dr b { font: 400 calc(10px * var(--txt))/1.5 var(--f-num); color: var(--parch); white-space: nowrap; }
.cw-set { display: flex; gap: 8px; align-items: center; margin-top: 10px; padding: 6px 8px; font-size: calc(12px * var(--txt)); color: var(--exc); background: rgba(79, 224, 106, .08); border: 1px solid rgba(79, 224, 106, .4); }
.cw-set img { width: 18px; height: 18px; flex: 0 0 auto; }

/* ---------- Inventário ---------- */
.w-inv { width: calc(8 * var(--cell) + 32px); }
.w-inv .win-b { padding: 10px 14px 12px; }
.doll { position: relative; width: calc(256 * var(--u)); height: calc(232 * var(--u)); margin: 0 auto 10px; }
.doll-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 34% 52% at 50% 46%, rgba(214, 168, 76, .10), transparent 70%),
    radial-gradient(circle at 50% 46%, transparent 0 calc(60 * var(--u)), rgba(138, 106, 58, .16) calc(60 * var(--u)) calc(61 * var(--u)), transparent calc(61 * var(--u)));
}
.slot {
  position: absolute;
  left: calc(var(--x) * var(--u));
  top: calc(var(--y) * var(--u));
  width: calc(var(--w) * var(--u));
  height: calc(var(--h) * var(--u));
  display: grid;
  place-items: center;
  padding: 3px;
  background: linear-gradient(180deg, #100c15, #08060b);
  border: 2px solid var(--edge);
  box-shadow: inset 0 0 0 1px var(--ink), inset 0 0 14px rgba(0, 0, 0, .9);
  cursor: var(--cur-pointer);
  pointer-events: auto;
  outline: none;
}
.slot:hover, .slot:focus-visible { border-color: var(--bronze); }
.slot-ph { width: min(calc(32 * var(--u)), 82%); height: auto; opacity: .7; pointer-events: none; }
.slot-ic { width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.slot[data-r], .it, .sc, .held, .sc-ic { --rc: #8a7f6a; }
[data-r="magico"] { --rc: var(--mag); }
[data-r="raro"] { --rc: var(--rare); }
[data-r="excelente"] { --rc: var(--exc); }
[data-r="lendario"] { --rc: var(--uni); }
.slot.full { background: radial-gradient(ellipse at 50% 55%, color-mix(in srgb, var(--rc) 16%, #100c15), #08060b 80%); border-color: color-mix(in srgb, var(--rc) 35%, var(--edge)); }
.slot.full:hover { border-color: var(--gold); }
/* MU-like item glow (owner 2026-10-06; ui.js glowDeco ← item_icons.js II.itemGlow): ::before the +N band halo (ring
   only) pulsing at --gp, prism hue at +13 / +15; ::after a light sweep (--gs, every --gt) masked by the art (--gm).
   No z-index or transform on .ig: either would isolate the screen blend. */
.ig { position: absolute; inset: 0; pointer-events: none; }
.ig.fit { margin: auto; }                    /* equip slot / shop card: px size copied from the img (ui.js fitPx), centred */
.w-inv .it > .ig { inset: 3px; }             /* inventory.css pads the bag icon 3px */
.ig::before, .ig::after { content: ""; position: absolute; inset: 0; pointer-events: none; }
.ig::before { background: var(--gh) center / contain no-repeat; mix-blend-mode: screen; opacity: .35; animation: igPulse var(--gp, 2s) ease-in-out infinite; image-rendering: pixelated; }
.ig::after {
  -webkit-mask: var(--gm) center / contain no-repeat; mask: var(--gm) center / contain no-repeat;
  background: linear-gradient(115deg, transparent 0 45%, var(--gs) 50%, transparent 55% 100%) no-repeat;
  background-size: 300% 100%; background-position: 120% 0; mix-blend-mode: screen;
  animation: igSweep var(--gt, 3s) linear infinite;
}
.ig[data-g="0"]::before { display: none; }   /* excelente / lendario without a +7 band: the sheen only */
.ig[data-g="4"]::before, .ig[data-g="5"]::before { animation: igPulse var(--gp, 2s) ease-in-out infinite, igHue 2.7s linear infinite; }
.ig.x::after { --gs: rgba(141, 255, 176, .85); }
.slot.bad::before, .it.bad::before, .sc.bad .sc-ic::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: rgba(196, 35, 46, .26);
  pointer-events: none;
}
.slot .it-plus { z-index: 2; }
.slot.fit { border-color: var(--exc); box-shadow: inset 0 0 0 1px var(--ink), inset 0 0 16px rgba(79, 224, 106, .3), 0 0 10px rgba(79, 224, 106, .55); }
.slot.nofit { border-color: var(--danger); box-shadow: inset 0 0 0 1px var(--ink), inset 0 0 16px rgba(255, 77, 77, .25); }
.slot.jewel { border-color: #b48cff; box-shadow: inset 0 0 0 1px var(--ink), inset 0 0 16px rgba(180, 140, 255, .3), 0 0 10px rgba(180, 140, 255, .5); }
.slot.deny { animation: shake .25s steps(4); }

.grid {
  position: relative;
  width: calc(var(--cols) * var(--cell));
  height: calc(var(--rows) * var(--cell));
  box-sizing: content-box !important;
  margin: 0 auto;
  background-color: #09070d;
  background-image:
    linear-gradient(rgba(138, 106, 58, .22) 1px, transparent 1px),
    linear-gradient(90deg, rgba(138, 106, 58, .22) 1px, transparent 1px),
    radial-gradient(ellipse at 50% 40%, rgba(214, 168, 76, .05), transparent 70%);
  background-size: var(--cell) var(--cell), var(--cell) var(--cell), 100% 100%;
  border: 2px solid var(--edge);
  box-shadow: 0 0 0 1px var(--ink), inset 0 0 18px rgba(0, 0, 0, .8);
  pointer-events: auto;
  touch-action: none;
}
.grid-items { position: absolute; inset: 0; }
.it {
  position: absolute;
  left: calc(var(--gx) * var(--cell));
  top: calc(var(--gy) * var(--cell));
  width: calc(var(--iw) * var(--cell));
  height: calc(var(--ih) * var(--cell));
  background: radial-gradient(ellipse at 50% 55%, color-mix(in srgb, var(--rc) 22%, transparent), color-mix(in srgb, var(--rc) 6%, transparent) 75%);
  cursor: var(--cur-pointer);
}
.it::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border: 1px solid color-mix(in srgb, var(--rc) 50%, transparent);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .55);
}
.it:hover::after { border-color: var(--gold2); }
.it img { width: 100%; height: 100%; object-fit: contain; display: block; pointer-events: none; position: relative; }
.it.pend::after { border: 2px solid var(--rare); animation: blink .4s steps(2) infinite; }
.it-plus {
  position: absolute;
  left: 2px;
  top: 2px;
  z-index: 2;
  font: 400 calc(9px * var(--txt))/1 var(--f-num);
  color: var(--gold2);
  text-shadow: 1px 1px 0 #000, -1px 0 0 #000, 0 -1px 0 #000;
  pointer-events: none;
}
.it-qty {
  position: absolute;
  right: 2px;
  bottom: 1px;
  z-index: 2;
  font: 400 calc(10px * var(--txt))/1 var(--f-num);
  color: #fff;
  text-shadow: 1px 1px 0 #000, -1px 0 0 #000, 0 -1px 0 #000;
  pointer-events: none;
}
.inv-ghost {
  position: absolute;
  z-index: 3;
  left: calc(var(--gx) * var(--cell));
  top: calc(var(--gy) * var(--cell));
  width: calc(var(--iw) * var(--cell));
  height: calc(var(--ih) * var(--cell));
  pointer-events: none;
}
.inv-ghost.ok { background: rgba(79, 224, 106, .2); box-shadow: inset 0 0 0 2px rgba(79, 224, 106, .8); }
.inv-ghost.swap { background: rgba(255, 211, 77, .18); box-shadow: inset 0 0 0 2px rgba(255, 211, 77, .85); }
.inv-ghost.bad { background: rgba(255, 77, 77, .2); box-shadow: inset 0 0 0 2px rgba(255, 77, 77, .85); }
.inv-ghost.jewel { background: rgba(180, 140, 255, .22); box-shadow: inset 0 0 0 2px rgba(195, 155, 255, .9); animation: blink .5s steps(2) infinite; }
.inv-ghost.deny { animation: shake .25s steps(4); }
.inv-foot { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.inv-foot .zen { margin-right: auto; }
.inv-sell { font: 400 calc(9px * var(--txt))/1 var(--f-num); padding: 4px 6px 3px; color: #1a1008; background: var(--rare); border: 1px solid var(--ink); }
.inv-hint { margin-top: 6px; font-size: calc(11px * var(--txt)); line-height: 1.35; color: var(--dim); }
.hint-touch { display: none; }
.w-inv.selling .grid { box-shadow: 0 0 0 1px var(--ink), 0 0 0 3px rgba(255, 211, 77, .6), inset 0 0 18px rgba(0, 0, 0, .8); }
.w-inv.selling .it { cursor: var(--cur-copy); }
#ui.holding .grid, #ui.holding .slot { cursor: var(--cur-hold); }

.zen {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px 3px;
  font: 400 calc(12px * var(--txt))/1 var(--f-num);
  color: var(--rare);
  background: rgba(0, 0, 0, .45);
  border: 1px solid var(--edge);
}
.zen img { width: 16px; height: 16px; }
.zen.bump { animation: bump .3s steps(3); }

/* ---------- Loja ---------- */
.w-shop { width: calc(384px * var(--txt-h)); }
.w-shop .win-b { position: relative; }
.shop-top, .dl-top { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; }
.npc-ptw {
  flex: 0 0 auto;
  width: 64px;
  height: 88px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  overflow: hidden;
  background: radial-gradient(ellipse 70% 40% at 50% 92%, rgba(214, 168, 76, .25), transparent 70%), linear-gradient(180deg, #1a1420, var(--well));
  border: 2px solid var(--edge);
  box-shadow: inset 0 0 0 1px var(--ink), inset 0 0 18px rgba(0, 0, 0, .7);
}
.npc-ptw.big { width: 100px; height: 136px; }
.npc-pt { display: block; max-width: 100%; max-height: 100%; margin-bottom: 4px; }
.npc-pt.none { display: none; }
.npc-say { flex: 1; min-width: 0; }
.npc-role { font: 400 calc(9px * var(--txt))/1.2 var(--f-num); color: var(--gold); letter-spacing: 1px; text-transform: uppercase; }
.npc-line { margin-top: 5px !important; min-height: 2.8em; font-size: calc(13px * var(--txt)); line-height: 1.45; font-style: italic; color: var(--parch); }
.npc-line.big { font-size: calc(15px * var(--txt)); }
.shop-list { max-height: min(46vh, 420px); overflow-y: auto; padding-right: 2px; }
.shop-list.rows { display: flex; flex-direction: column; gap: 6px; }
.shop-list.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.sr { display: grid; grid-template-columns: 42px 1fr auto; gap: 8px; align-items: center; padding: 6px; background: rgba(0, 0, 0, .35); border: 1px solid var(--edge); }
.sr:hover { border-color: var(--bronze); }
.sr-ic { width: 42px; height: 42px; display: grid; place-items: center; background: var(--well); border: 1px solid var(--edge); }
.sr-ic img { width: 32px; height: 32px; }
.sr-n { font-weight: 600; font-size: calc(14px * var(--txt)); }
.sr-d { font-size: calc(11px * var(--txt)); color: var(--dim); line-height: 1.3; }
.sr-lv { font-size: calc(11px * var(--txt)); color: var(--uni); }
.sr-buy { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }
.sr-btns { display: flex; gap: 4px; }
.price { display: inline-flex; align-items: center; gap: 4px; font: 400 calc(11px * var(--txt))/1 var(--f-num); color: var(--rare); white-space: nowrap; }
.price img { width: 16px; height: 16px; }
.price.bad { color: var(--danger); }
.sc { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px; text-align: center; background: rgba(0, 0, 0, .35); border: 1px solid var(--edge); }
.sc:hover { border-color: color-mix(in srgb, var(--rc) 60%, var(--bronze)); }
.sc-ic {
  position: relative;
  width: 100%;
  height: 104px;
  display: grid;
  place-items: center;
  background: radial-gradient(ellipse at 50% 55%, color-mix(in srgb, var(--rc) 20%, transparent), transparent 70%), var(--well);
  border: 1px solid var(--edge);
}
.sc[data-r] .sc-ic { --rc: inherit; }
.sc-ic img { display: block; }
.sc-n { min-height: 2.4em; font-weight: 600; font-size: calc(12px * var(--txt)); line-height: 1.2; display: flex; align-items: center; }
.sc-s { font-size: calc(10px * var(--txt)); color: var(--dim); }
.sc-b { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; width: 100%; margin-top: auto; }   /* big text: the button drops under the price */
.shop-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.shop-foot .zen { margin-right: auto; }
.shop-hint { margin-top: 6px; font-size: calc(11px * var(--txt)); line-height: 1.35; color: var(--dim); }
/* shop categories (Ferreiro: weapon types · Armeiro: armour classes + Escudos) */
.shop-tabs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.shop-tabs .btn { flex: 1 1 auto; padding: 0 7px; font-size: calc(12px * var(--txt)); }   /* "Tudo" + 4 weapon types fit one row (≈350 px) */
/* Mago scroll rows: 20 px skill icon at 2×, requirement badges (.sk-reqs: orange until met), learned rows dimmed */
.sr-scroll .sr-ic img { width: 40px; height: 40px; }
.sr-scroll .sr-lv { display: flex; flex-wrap: wrap; align-items: center; gap: 0 4px; margin-top: 2px; color: var(--dim); }
.sr-scroll .sk-reqs { margin: 0; }
.sr.known { opacity: .7; }
.sell-drop {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  background: rgba(12, 9, 16, .88);
  border: 2px dashed var(--rare);
  pointer-events: none;
}
.sell-drop img.big { width: 32px; height: 32px; }
.sell-drop-t { font: 400 30px/1 var(--f-title); color: var(--rare); text-shadow: 0 2px 0 #000; }
.sell-drop-v { padding: 0 12px; font-size: calc(13px * var(--txt)); color: var(--parch); }

/* ---------- Diálogo ---------- */
.w-dialog { width: calc(430px * var(--txt-h)); }
.dl-box { margin: 4px 0 10px; }
.dl-offer p { margin: 0 0 4px !important; }
.dl-btns { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; margin-top: 8px; }
.qcard { padding: 10px; background: rgba(0, 0, 0, .35); border: 1px solid var(--edge); border-left: 3px solid var(--gold); }
.qcard.done { border-left-color: var(--exc); }
.qcard-t { font-weight: 600; font-size: calc(14px * var(--txt)); }
.qcard-m { margin: 2px 0 8px; font-size: calc(11px * var(--txt)); color: var(--dim); }
.qcard .bar { margin-top: 6px; }
.qcard.done .bar-f { background: linear-gradient(180deg, #b8ffb0, var(--exc) 50%, #1e7a2a); }
.qcard-r { margin-top: 8px; font-size: calc(12px * var(--txt)); }
.xpc { color: #c9a8ff; }
b.gold { color: var(--rare); }
.qcard-done { margin-top: 6px; font-weight: 700; color: var(--exc); animation: glowText 1.4s ease-in-out infinite; }

/* ---------- Teletransporte ---------- */
.w-warp { width: calc(404px * var(--txt-h)); }
.warp-intro { margin-bottom: 8px !important; font-size: calc(12px * var(--txt)); }
.warp-list { display: flex; flex-direction: column; gap: 6px; }
.wr { display: grid; grid-template-columns: 34px 1fr auto auto; gap: 10px; align-items: center; padding: 6px 8px; background: rgba(0, 0, 0, .35); border: 1px solid var(--edge); border-left: 3px solid var(--bc); }
.wr:hover { border-color: var(--bronze); border-left-color: var(--bc); }
.wr-sw {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 35% 30%, #fff8 0 8%, transparent 9%), linear-gradient(135deg, color-mix(in srgb, var(--bc) 70%, white), var(--bc) 50%, color-mix(in srgb, var(--bc) 45%, black));
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
  filter: drop-shadow(0 0 6px color-mix(in srgb, var(--bc) 60%, transparent));
}
.wr-sw img { width: 16px; height: 20px; }         /* 8x10 lock at 2x */
.wr-n { font-weight: 700; font-size: calc(14px * var(--txt)); }
.wr-s { font-size: calc(11px * var(--txt)); color: var(--dim); }
.wr-req { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; font: 400 calc(10px * var(--txt))/1 var(--f-num); }
.wr-req .bad { color: var(--danger); }
.free { color: var(--exc); }
.wr.here { background: rgba(214, 168, 76, .08); }
.wr.locked { opacity: .62; }

/* ---------- Habilidades ---------- */
.w-skills { width: calc(470px * var(--txt-h)); }
.sk-list { display: flex; flex-direction: column; gap: 6px; }
.skr { display: grid; grid-template-columns: 48px 1fr auto; gap: 10px; align-items: center; padding: 8px; background: rgba(0, 0, 0, .35); border: 1px solid var(--edge); }
.skr.rmb { border-color: var(--gold); background: rgba(214, 168, 76, .07); }
.skr-ic { position: relative; width: 48px; height: 48px; padding: 2px; background: #000; border: 2px solid var(--bronze); box-shadow: 0 0 0 1px var(--ink); }
.skr-ic img:first-child { width: 40px; height: 40px; display: block; }
.skr-ic .key { position: absolute; left: -4px; top: -4px; }
.skr-lock { position: absolute; right: -5px; bottom: -6px; width: 16px; height: 20px; }
.skr.locked .skr-ic img:first-child { filter: grayscale(1) brightness(.5); }
.skr.locked .skr-n > span:first-child { color: var(--dim); }
.skr-info { min-width: 0; }
.skr-n { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; font-weight: 700; font-size: calc(15px * var(--txt)); }
.skr-k { font: 400 calc(8px * var(--txt))/1 var(--f-num); color: var(--dim); text-transform: uppercase; }
.skr-m { display: flex; flex-wrap: wrap; gap: 3px 10px; margin: 3px 0; font: 400 calc(9px * var(--txt))/1.3 var(--f-num); color: var(--dim); white-space: nowrap; overflow: hidden; }
.skr-m > span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.skr-d { font-size: calc(12px * var(--txt)); line-height: 1.35; }
/* description / Soul Master preview: 2 lines, a click (tap) shows the whole text */
.skr-cl { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; cursor: var(--cur-pointer); }
.skr-cl.open { display: block; -webkit-line-clamp: unset; }
.skr-lk { margin-top: 2px; font-size: calc(11px * var(--txt)); color: var(--uni); }
.sk-hint { margin-top: 10px !important; font-size: calc(11px * var(--txt)); line-height: 1.4; }
/* the book's bar strip (6 slots + right mouse), sticky while the book scrolls; the icon of a learned row is its drag handle */
.sk-bar { position: sticky; top: -12px; z-index: 3; margin: -12px -14px 10px; padding: 10px 14px 8px; background: var(--panel); border-bottom: 1px solid var(--edge); box-shadow: 0 6px 10px -6px rgba(0, 0, 0, .85); }
.sk-bar-r { display: flex; align-items: center; gap: 4px; }
.sk-bar-t { margin-right: 6px; font: 400 calc(20px * var(--txt-h))/1 var(--f-title); color: var(--gold2); }
.sk-bar-s { display: flex; gap: 4px; }
.sk-rmbs { margin-left: 12px; }
/* mouse glyph with the right button lit: the book strip's right-mouse slot and the rows' right-mouse toggle */
.kms { display: inline-block; width: 7px; height: 9px; vertical-align: -1px; border: 1px solid currentColor; border-radius: 3px 3px 4px 4px; background: linear-gradient(90deg, transparent 50%, currentColor 50%) 0 0 / 100% 4px no-repeat; }
.skr-rmbb, .skr-rmbt { min-width: 26px; text-align: center; }
.sk-bar-h { margin: 7px 0 0 !important; min-height: 2.7em; font-size: calc(11px * var(--txt)); line-height: 1.35; color: var(--dim); }
#ui.skpick .sk-bar-h { color: var(--gold2); }
.sk.empty .sk-img { visibility: hidden; }
#ui.skpick .sk { border-color: var(--bronze); }
.sk.picked, #ui.skpick .sk.picked { border-color: var(--gold2); box-shadow: inset 0 0 0 1px var(--ink), 0 0 0 2px rgba(244, 212, 124, .55); }
.sk-held { width: 40px; height: 40px; z-index: 96; }
button.skr-ic { display: block; cursor: var(--cur-grab); }
.skr.locked button.skr-ic { cursor: var(--cur-default); }
.skr.picked { border-color: var(--gold2); background: rgba(214, 168, 76, .12); }
.skr-act { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.sk-sec { display: flex; align-items: baseline; gap: 8px; margin: 8px 0 0; padding-bottom: 3px; border-bottom: 1px solid var(--edge); }
.sk-sec:first-child { margin-top: 0; }
.sk-sec-t { font: 400 calc(21px * var(--txt-h))/1 var(--f-title); color: var(--gold2); }
.sk-sec-s { font: 400 calc(8px * var(--txt))/1 var(--f-num); color: var(--dim); text-transform: uppercase; }
.sk-sec-n { margin-left: auto; font: 400 calc(9px * var(--txt))/1 var(--f-num); color: var(--parch); }
.sk-sec.locked .sk-sec-t { color: #c39bff; }
.sk-sec-lock { width: 12px; height: 15px; align-self: center; }
.sk-sec-lk { margin: 0 !important; font-size: calc(11px * var(--txt)); line-height: 1.35; color: #c39bff; }
/* requirement badges: met dim, unmet red (book) / orange (Mago: buying early is allowed) */
.sk-reqs { display: flex; flex-wrap: wrap; gap: 3px; margin: 3px 0 4px; }
.skb { padding: 2px 4px 1px; font: 400 calc(8px * var(--txt))/1 var(--f-num); color: var(--dim); white-space: nowrap; background: rgba(0, 0, 0, .45); border: 1px solid var(--edge); }
.skb.bad { color: #ffd0c8; background: #5a0e14; border-color: var(--danger); }
.skb.warn { color: var(--uni); border-color: #6a4a20; }
.skr-b, .tip-l.sk-boost { margin-top: 3px; font-size: calc(11px * var(--txt)); line-height: 1.35; color: #9d86c4; }
.sk-req .ok { color: var(--parch); }
.sk-req .bad { color: var(--danger); }
.sktip .tip-row { flex-wrap: wrap; gap: 3px 12px; }
.sktip .tip-row span { white-space: nowrap; }
/* Pásio's evolution quest: tracker block and quest card */
.qt-evo { margin-top: 5px; padding-top: 4px; border-top: 1px solid rgba(138, 106, 58, .35); }
.qt-main.hide + .qt-evo { margin-top: 0; padding-top: 0; border-top: 0; }
.qt-evo-h { display: flex; align-items: baseline; gap: 6px; margin-bottom: 2px; font: 400 calc(9px * var(--txt))/1 var(--f-num); color: #c39bff; text-transform: uppercase; }
.qt-evo-h .qt-n { margin-left: auto; }
.qt-evo.done .qt-state { color: var(--exc); }
.qcard.evo { border-left-color: #9b6fd0; }
* + .qcard.evo { margin-top: 10px; }
.qcard-k { margin-bottom: 4px; font: 400 calc(9px * var(--txt))/1.2 var(--f-num); color: #c39bff; text-transform: uppercase; }

/* ---------- Missão ---------- */
.w-quest { width: calc(360px * var(--txt-h)); }
.q-empty { padding: 14px 6px; text-align: center; }
.q-empty img.big, .t-empty img.big { width: 48px; height: 48px; margin-bottom: 8px; }
.q-empty p { margin: 2px 0 !important; }

/* ---------- Menu ---------- */
.w-menu { width: calc(312px * var(--txt-h)); }
.w-menu .win-h { cursor: var(--cur-default); }
.w-menu .win-b { display: flex; flex-direction: column; gap: 7px; }
.menu-crest {
  margin: 2px 0 6px;
  text-align: center;
  font: 400 40px/1 var(--f-title);
  color: var(--gold2);
  text-shadow: 0 0 14px rgba(214, 168, 76, .45), 0 3px 0 #000;
}
.menu-crest::after { content: ""; display: block; width: 160px; height: 2px; margin: 8px auto 0; background: linear-gradient(90deg, transparent, var(--gold), transparent); }
.menu-ver { margin-top: 4px; text-align: center; font-size: calc(11px * var(--txt)); color: var(--dim); }

/* ---------- Ajuda ---------- */
.w-help { width: calc(660px * var(--txt-h)); }
.help-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
.help-sec h4 { margin: 0 0 6px; font: 400 calc(23px * var(--txt-h))/1 var(--f-title); color: var(--gold2); text-shadow: 0 2px 0 #000; }
.help-sec dl { display: grid; grid-template-columns: auto 1fr; gap: 5px 10px; margin: 0; font-size: calc(12px * var(--txt)); }
.help-sec dt { display: flex; flex-wrap: wrap; gap: 2px; align-content: flex-start; }
.help-sec dd { margin: 0; color: var(--parch); line-height: 1.35; }

/* =====================================================================
   TITLE / CHARACTER SELECT
   ===================================================================== */
.title {
  --cc: #d8483a;
  position: absolute;
  inset: 0;
  z-index: 80;
  pointer-events: auto;
  background:
    radial-gradient(ellipse 120% 85% at 50% 38%, rgba(7, 6, 11, .2), rgba(7, 6, 11, .78) 62%, rgba(7, 6, 11, .95)),
    linear-gradient(180deg, rgba(7, 6, 11, .55), transparent 30%, transparent 70%, rgba(7, 6, 11, .7));
}
.title.show { animation: fadeIn .6s steps(6); }
.t-scroll {
  position: absolute;
  inset: 0;
  overflow-x: hidden;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: calc(18px + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom));
  scrollbar-width: thin;
  scrollbar-color: var(--bronze) transparent;
}
.t-head { margin: 1vh 0 2.2vh; text-align: center; }
.t-logo {
  position: relative;
  margin: 0;
  font: 400 clamp(68px, 12.5vw, 156px)/.9 var(--f-title);
  letter-spacing: 6px;
}
.t-logo-txt {
  position: relative;
  display: inline-block;
  color: transparent;
  background: linear-gradient(180deg, #fff8dc 0%, #f4d47c 32%, #d6a84c 58%, #a8742a 78%, #6a4214 100%);
  -webkit-background-clip: text;
  background-clip: text;
  filter: drop-shadow(0 4px 0 #2a1608) drop-shadow(0 0 1px #000);
}
.t-logo-glow {
  position: absolute;
  inset: 0;
  color: #ffb84a;
  filter: blur(16px);
  opacity: .5;
  animation: logoGlow 4s ease-in-out infinite;
}
.t-sub {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 6px;
  font: 500 calc(clamp(13px, 1.8vw, 19px) * var(--txt))/1.2 var(--f-ui);
  color: #e0c896;
  letter-spacing: 3px;
  text-transform: uppercase;
  text-shadow: 0 2px 0 #000;
}
.t-orn { position: relative; width: clamp(30px, 8vw, 90px); height: 2px; background: linear-gradient(90deg, transparent, var(--gold)); }
.t-orn::after { content: ""; position: absolute; right: -4px; top: -3px; width: 8px; height: 8px; background: var(--gold2); clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); }
.t-orn.r { transform: scaleX(-1); }

.t-main { display: grid; grid-template-columns: minmax(260px, 330px) minmax(0, 780px); gap: 18px; width: min(1140px, 100%); align-items: start; }
.t-h {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 0 0 10px;
  font: 400 30px/1 var(--f-title);
  color: var(--gold2);
  text-shadow: 0 2px 0 #000, 0 0 10px rgba(214, 168, 76, .3);
}
.t-count { font: 400 calc(11px * var(--txt))/1 var(--f-num); color: var(--dim); }
.t-saves { padding: 12px; }
.t-list { display: flex; flex-direction: column; gap: 8px; max-height: 56vh; overflow-y: auto; padding-right: 2px; scrollbar-width: thin; scrollbar-color: var(--bronze) var(--well); }
.t-save {
  --cc: var(--gold);
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px 8px 8px 9px;
  background: rgba(0, 0, 0, .38);
  border: 1px solid var(--edge);
  border-left: 3px solid var(--cc);
  cursor: var(--cur-default);
}
.t-save:hover { background: rgba(214, 168, 76, .06); border-color: var(--bronze); border-left-color: var(--cc); }
.t-save-emb { width: 32px; height: 32px; }
.t-save-info { min-width: 0; }
.t-save-n { display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: calc(15px * var(--txt)); }
.t-save-n span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-recent { flex: 0 0 auto; padding: 2px 4px 1px; font: 400 calc(8px * var(--txt))/1 var(--f-num); font-style: normal; color: #1a1008; background: var(--gold); }
.t-save-c { font-size: calc(12px * var(--txt)); color: var(--cc); }
.t-save-m { font-size: calc(11px * var(--txt)); color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-save-btns { display: flex; flex-direction: column; gap: 4px; }
.t-save.confirm { grid-template-columns: 1fr auto; border-left-color: var(--danger); background: rgba(90, 10, 16, .38); }
.t-save-q b { display: block; font-size: calc(14px * var(--txt)); color: #ffd0c8; }
.t-save-q span { font-size: calc(11px * var(--txt)); color: var(--dim); }
.t-empty { padding: 18px 8px; text-align: center; font-size: calc(14px * var(--txt)); }
.t-empty p { margin: 3px 0 !important; }
.t-empty .dim { font-size: calc(12px * var(--txt)); line-height: 1.4; }

.t-create { padding: 12px 14px 14px; }
.t-cards { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.t-card {
  --cc: var(--gold);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 4px 8px;
  font-family: var(--f-ui);
  color: var(--parch);
  background: linear-gradient(180deg, rgba(0, 0, 0, .18), rgba(0, 0, 0, .5));
  border: 2px solid var(--edge);
  cursor: var(--cur-pointer);
  transition: transform .12s steps(3), border-color .12s;
}
.t-card:hover { border-color: var(--bronze); transform: translateY(-2px); }
.t-card:focus-visible { outline: none; border-color: var(--gold2); }
.t-card.sel {
  border-color: var(--cc);
  background: linear-gradient(180deg, color-mix(in srgb, var(--cc) 16%, transparent), rgba(0, 0, 0, .5));
  box-shadow: 0 0 0 1px var(--ink), 0 0 20px -4px var(--cc), inset 0 0 26px -12px var(--cc);
}
.t-card-stage { position: relative; width: 100%; height: 128px; display: flex; align-items: flex-end; justify-content: center; overflow: hidden; }
.t-card-img { position: relative; z-index: 1; max-width: 100%; max-height: 124px; }
.t-ped {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 76%;
  height: 14px;
  transform: translateX(-50%);
  background: radial-gradient(ellipse at center, color-mix(in srgb, var(--cc) 55%, transparent), transparent 70%);
}
.t-ped.big { width: 70%; height: 26px; bottom: 4px; }
.t-card-n { margin-top: 5px; font-weight: 700; font-size: calc(14px * var(--txt)); line-height: 1.1; text-align: center; }
.t-card-r { font-size: calc(11px * var(--txt)); color: var(--dim); text-align: center; }
.t-card.sel .t-card-n { color: #fff3d6; text-shadow: 0 0 8px var(--cc); }

.t-detail { display: grid; grid-template-columns: 230px 1fr; gap: 14px; margin-top: 12px; padding: 10px; background: rgba(0, 0, 0, .3); border: 1px solid var(--edge); }
.t-d-left { display: flex; flex-direction: column; gap: 8px; }
.t-d-stage {
  position: relative;
  height: 236px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  overflow: hidden;
  background: radial-gradient(ellipse 60% 70% at 50% 76%, color-mix(in srgb, var(--cc) 24%, transparent), transparent 72%), var(--well);
  border: 1px solid var(--edge);
  box-shadow: inset 0 0 26px rgba(0, 0, 0, .8);
}
.t-rays {
  position: absolute;
  inset: -45%;
  background: repeating-conic-gradient(from 0deg at 50% 50%, rgba(255, 230, 160, .07) 0 6deg, transparent 6deg 18deg);
  animation: spin 50s linear infinite;
}
.t-d-stage.legend .t-rays { background: repeating-conic-gradient(from 0deg at 50% 50%, rgba(255, 210, 90, .17) 0 6deg, transparent 6deg 16deg); animation-duration: 24s; }
.t-d-stage.legend { box-shadow: inset 0 0 26px rgba(0, 0, 0, .8), inset 0 0 0 1px rgba(255, 211, 77, .35); }
.t-d-img { position: relative; z-index: 1; max-width: 100%; max-height: 226px; margin-bottom: 8px; }
.t-d-stage.swap .t-d-img { animation: swapIn .3s steps(5); }
.t-legend { position: relative; display: flex; align-items: center; gap: 8px; font-size: calc(13px * var(--txt)); cursor: var(--cur-pointer); }
.t-legend-in { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.t-check { flex: 0 0 auto; width: 18px; height: 18px; background: var(--well); border: 2px solid var(--bronze); box-shadow: inset 0 0 0 1px var(--ink); }
.t-legend-in:checked + .t-check { background: var(--gold2); box-shadow: inset 0 0 0 3px #2a1a08; }
.t-legend-in:focus-visible + .t-check { border-color: var(--gold2); outline: 2px solid rgba(244, 212, 124, .5); outline-offset: 1px; }
.t-legend:hover .t-check { border-color: var(--gold); }
.t-d-info { min-width: 0; }
.t-d-name { margin: 0; font: 400 44px/1 var(--f-title); color: #fff3d6; text-shadow: 0 0 14px var(--cc), 0 3px 0 #000; }
.t-d-title { font-size: calc(14px * var(--txt)); font-style: italic; color: var(--gold); }
.t-d-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin: 6px 0; font-size: calc(12px * var(--txt)); color: var(--dim); }
.t-d-diff { display: inline-flex; align-items: center; gap: 2px; }
.t-d-diff b { margin-left: 5px; color: var(--parch); font-weight: 600; }
.pip { display: inline-block; width: 8px; height: 8px; margin-left: 2px; border: 1px solid var(--bronze); background: var(--well); }
.pip.on { background: var(--gold2); border-color: var(--ink); }
.t-d-desc { margin: 6px 0 10px !important; font-size: calc(14px * var(--txt)); line-height: 1.45; }
.t-d-stats { display: grid; gap: 4px; }
.t-stat { display: grid; grid-template-columns: 84px 1fr 26px; gap: 8px; align-items: center; font-size: calc(12px * var(--txt)); }
.t-stat-n { color: var(--dim); }
.t-stat-b { position: relative; height: 9px; background: var(--well); border: 1px solid var(--edge); }
.t-stat-b i { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(180deg, color-mix(in srgb, var(--cc) 55%, white), var(--cc) 60%, color-mix(in srgb, var(--cc) 60%, black)); transition: width .25s steps(5); }
.t-stat-v { font: 400 calc(11px * var(--txt))/1 var(--f-num); text-align: right; }
.t-d-gear { display: grid; gap: 3px; margin-top: 10px; font-size: calc(12px * var(--txt)); color: var(--dim); }
.t-d-gear b { color: var(--parch); font-weight: 600; }

.t-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 300px);
  gap: 6px 10px;
  margin-top: 12px;
}
.t-lbl { grid-column: 1 / -1; font: 400 calc(10px * var(--txt))/1 var(--f-num); color: var(--dim); letter-spacing: 1px; text-transform: uppercase; }
.t-name-row { grid-column: 1; grid-row: 2; display: flex; gap: 6px; }
.t-enter { grid-column: 2; grid-row: 2; }
.t-err { grid-column: 1 / -1; grid-row: 3; }
.t-name {
  flex: 1;
  min-width: 0;
  height: 44px;
  padding: 0 12px;
  font: 600 calc(19px * var(--txt)) var(--f-ui);
  color: var(--parch);
  background: var(--well);
  border: 2px solid var(--bronze);
  border-radius: 0;
  box-shadow: inset 0 0 0 1px var(--ink), inset 0 3px 10px rgba(0, 0, 0, .6);
  outline: none;
  user-select: text;
  -webkit-user-select: text;
}
.t-name::placeholder { color: #5f5648; }
.t-name:focus { border-color: var(--gold2); box-shadow: inset 0 0 0 1px var(--ink), 0 0 0 2px rgba(244, 212, 124, .25); }
.t-dice { width: 48px; min-height: 44px; padding: 0; }
.t-dice img { width: 20px; height: 20px; }
.t-dice.spin img { animation: spin .4s steps(6); }
.t-err { min-height: 16px; font-size: calc(13px * var(--txt)); color: var(--danger); }
.t-enter { min-height: 44px; }
.t-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 16px;
  margin: 18px 0 2px;
  font-size: calc(12px * var(--txt));
  color: var(--dim);
  text-shadow: 0 1px 0 #000;
}
.t-foot kbd { margin-right: 2px; }

/* =====================================================================
   ANIMATIONS (stepped for a pixel feel)
   ===================================================================== */
@keyframes winPop { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes sheetUp { from { transform: translate(-50%, 30px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes blink { 50% { opacity: .35; } }
@keyframes armed { 50% { filter: brightness(1.35); } }
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.12); } 100% { transform: scale(1); } }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-10px); } }
@keyframes bigIn { 0% { opacity: 0; transform: scale(.4); } 60% { opacity: 1; transform: scale(1.12); } 100% { opacity: 1; transform: scale(1); } }
@keyframes banner {
  0% { opacity: 0; transform: translate(-50%, 10px); }
  12% { opacity: 1; transform: translate(-50%, 0); }
  80% { opacity: 1; transform: translate(-50%, 0); }
  100% { opacity: 0; transform: translate(-50%, -8px); }
}
@keyframes vig { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }
@keyframes deathIn { 0% { opacity: 0; transform: scale(1.35); letter-spacing: 30px; } 60% { opacity: 1; } 100% { opacity: 1; transform: none; letter-spacing: 4px; } }
@keyframes orbPulse { 0%, 100% { opacity: .5; transform: scale(1); } 50% { opacity: 1; transform: scale(1.08); } }
@keyframes orbHit { 0% { transform: translate(0, 0); filter: brightness(2) drop-shadow(0 0 8px #ff2a2a); } 25% { transform: translate(-2px, 1px); } 50% { transform: translate(2px, -1px); } 100% { transform: none; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .7)); } }
@keyframes ready { 0% { box-shadow: 0 0 0 0 rgba(255, 246, 200, .9), inset 0 0 0 40px rgba(255, 246, 200, .55); } 100% { box-shadow: 0 0 0 6px rgba(255, 246, 200, 0), inset 0 0 0 40px rgba(255, 246, 200, 0); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }
@keyframes press { 50% { transform: scale(.9); } }
@keyframes badge { 50% { filter: brightness(1.4); } }
@keyframes glowText { 0%, 100% { text-shadow: 0 0 0 transparent; } 50% { text-shadow: 0 0 8px currentColor; } }
@keyframes igPulse { 0%, 100% { opacity: .2; } 50% { opacity: .9; } }
@keyframes igSweep { 0% { background-position: 120% 0; } 45%, 100% { background-position: -20% 0; } }
@keyframes igHue { to { filter: hue-rotate(360deg); } }
@keyframes igTipPrism {
  0%, 100% { text-shadow: 0 1px 0 rgba(0, 0, 0, .6), 0 0 2px var(--th, transparent), 0 0 5px #ff4a6a, 0 0 11px #ff4a6a; }
  16.7% { text-shadow: 0 1px 0 rgba(0, 0, 0, .6), 0 0 2px var(--th, transparent), 0 0 5px #ffa53a, 0 0 11px #ffa53a; }
  33.3% { text-shadow: 0 1px 0 rgba(0, 0, 0, .6), 0 0 2px var(--th, transparent), 0 0 5px #ffe84a, 0 0 11px #ffe84a; }
  50% { text-shadow: 0 1px 0 rgba(0, 0, 0, .6), 0 0 2px var(--th, transparent), 0 0 5px #5cff7a, 0 0 11px #5cff7a; }
  66.7% { text-shadow: 0 1px 0 rgba(0, 0, 0, .6), 0 0 2px var(--th, transparent), 0 0 5px #4ad8ff, 0 0 11px #4ad8ff; }
  83.3% { text-shadow: 0 1px 0 rgba(0, 0, 0, .6), 0 0 2px var(--th, transparent), 0 0 5px #a070ff, 0 0 11px #a070ff; }
}
@keyframes enrage { 50% { filter: brightness(1.45) saturate(1.3); } }
@keyframes bossName { 0% { opacity: 0; letter-spacing: 14px; } 100% { opacity: 1; letter-spacing: 0; } }
@keyframes xpFlash { 0%, 100% { filter: none; } 30% { filter: brightness(2.2) drop-shadow(0 0 8px #ffd34d); } }
@keyframes lvlFlash { 0%, 100% { box-shadow: inset 0 0 0 1px var(--ink), 0 0 0 1px var(--ink), 0 8px 22px rgba(0, 0, 0, .55); } 30% { box-shadow: inset 0 0 0 2px var(--gold2), 0 0 24px rgba(255, 211, 77, .8), 0 8px 22px rgba(0, 0, 0, .55); } }
@keyframes statUp { 0% { background: rgba(79, 224, 106, .35); } 100% { background: rgba(0, 0, 0, .3); } }
@keyframes logoGlow { 0%, 100% { opacity: .38; } 50% { opacity: .68; } }
@keyframes swapIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* =====================================================================
   RESPONSIVE / TOUCH
   ===================================================================== */
@media (hover: none) {
  .hint-mouse { display: none; }
  .hint-touch { display: inline; }
}
@media (pointer: coarse) {
  :root { --mbs: 36px; }
  .btn.sm { min-height: 36px; }
  .plus { width: 36px; height: 36px; }
  .win-x { width: 40px; height: 40px; }
  .chat-btn { width: 36px; height: 36px; }
  .cw-st { min-height: 42px; }
}

/* tablets & narrow windows: two-row console, windows become full-screen sheets */
@media (max-width: 760px) {
  :root {
    --orb: 64px;
    --sk: 42px;
    --pot: 40px;
    --mbs: 36px;
    --cell: clamp(28px, calc((100vw - 44px) / 8), 34px);
    --con-h: 132px;
  }
  .win {
    position: absolute;
    inset: 0 !important;
    left: 0 !important;
    top: 0 !important;
    width: auto !important;
    max-width: none;
    max-height: none;
    border-left: 0;
    border-right: 0;
  }
  .win.pop { animation: fadeIn .16s steps(3); }
  .win-h { height: 48px; padding-top: env(safe-area-inset-top); cursor: var(--cur-default); }
  .win-t { font-size: 30px; }
  .win-k { display: none; }
  .win-x { width: 42px; height: 42px; }
  .win-b { padding: 12px 12px calc(16px + env(safe-area-inset-bottom)); }
  .w-inv .win-b, .w-shop .win-b { padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
  .only-narrow { display: inline-flex; }
  .shop-list { max-height: none; }
  .help-grid { grid-template-columns: 1fr; }
  .w-menu .win-b { max-width: 420px; width: 100%; margin: 0 auto; }

  .con-plate { flex-direction: column-reverse; gap: 5px; margin: 0 -10px; padding: 6px 16px 7px; }
  .con-div.d2 { display: none; }
  .menu-btns { grid-template-columns: repeat(6, var(--mbs)); gap: 4px; }
  .mb .key { font-size: calc(6px * var(--txt)); }
  .xp { height: 11px; margin: 0 calc(var(--orb) * .35); }
  .orb-v { font-size: calc(10px * var(--txt)); }
  .orb-m { font-size: calc(7px * var(--txt)); }

  .chat { width: min(380px, 58vw); }
  .chat-l { max-height: 72px; }
  .chat:not(:hover):not(.open) .ln:nth-last-child(n+5) { display: none; }
  .ln { font-size: calc(12px * var(--txt)); line-height: calc(16px * var(--txt)); }

  .pf { width: 180px; padding: 5px 7px 6px 5px; gap: 7px; }
  .pf-embw { width: 38px; height: 38px; }
  .pf-pt { left: -9px; top: -5px; }
  .hud-tr { width: 156px; }
  .mm { padding: 5px 6px; }
  .mm-name { font-size: calc(18px * var(--txt)); }
  .mm-view { width: 140px; height: 72px; }
  .mm-cv { width: 96px; height: 96px; }
  .qt-text { font-size: calc(11px * var(--txt)); }
  .tf { width: calc(230px * var(--txt)); }
  /* narrow landscape: the boss bar fits between the player frame and the minimap; long names stay on one line */
  .boss { width: max(200px, calc(100vw - 400px)); }
  .boss-sk { display: none; }
  .boss-n { font-size: calc(clamp(15px, 3.2vw, 26px) * var(--txt-h)); white-space: nowrap; }

  .title .t-main { grid-template-columns: 1fr; }
  .t-form { grid-template-columns: 1fr; }
  .t-name-row, .t-enter, .t-err { grid-column: 1; }
  .t-err { grid-row: 3; }
  .t-enter { grid-row: 4; min-height: 50px; }
  .t-list { max-height: none; }
  .t-detail { grid-template-columns: 1fr; }
  .t-d-stage { height: 176px; }
  .t-d-img { max-height: 166px; }
  .t-card-stage { height: 92px; }
  .t-card-img { max-height: 88px; }
  .t-d-name { font-size: 38px; }
}

/* phones (portrait): potion slots move onto the orbs, target frame above the console */
@media (max-width: 560px) {
  :root { --sk: 40px; --con-h: 126px; }
  .pots, .belt > .con-div { display: none; }
  .orb-pot { display: block; }
  .skills { gap: 3px; }
  .menu-btns { gap: 3px; }
  .hud-tc {
    left: 10px;
    right: 10px;
    top: auto;
    bottom: calc(var(--con-h) + 6px + env(safe-area-inset-bottom));
    transform: none;
  }
  .tf { width: min(calc(268px * var(--txt)), 100%); }
  .boss { width: 100%; }
  .boss-n { font-size: calc(22px * var(--txt-h)); }
  .chat { bottom: calc(var(--con-h) + 60px + env(safe-area-inset-bottom)); width: 64vw; }
  .pf { width: 156px; }
  .pf-cls { display: none; }
  .pf-name { font-size: calc(13px * var(--txt)); }
  .buffs { max-width: 160px; }
  .hud-tr { width: 136px; }
  .mm-view { width: 124px; height: 64px; }
  .mm-cv { width: 85px; height: 85px; }
  .mm-name { font-size: calc(16px * var(--txt)); }
  .qt-head span { font-size: calc(16px * var(--txt)); }
  .t-logo { letter-spacing: 3px; }
  .t-sub { letter-spacing: 1.5px; gap: 8px; }
  .t-cards { gap: 5px; }
  .t-card { padding: 5px 2px 6px; }
  .t-card-n { font-size: calc(12px * var(--txt)); overflow-wrap: break-word; max-width: 100%; }
  .t-card-r { display: none; }
  .t-save { grid-template-columns: 32px 1fr; }
  .t-save-btns { grid-column: 1 / -1; flex-direction: row; justify-content: flex-end; }
  .t-save.confirm { grid-template-columns: 1fr; }
  .t-foot { gap: 4px 12px; font-size: calc(11px * var(--txt)); }
  .shop-list.cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cw-der { grid-template-columns: 1fr; }
  .wr { grid-template-columns: 30px 1fr auto; }
  .wr-sw { width: 30px; height: 30px; }
  .wr > :last-child { grid-column: 1 / -1; justify-self: end; }
  .skr { grid-template-columns: 48px 1fr; }
  .skr > :last-child { grid-column: 1 / -1; justify-self: end; }
  .skr-act { flex-direction: row; }
  .sk-bar { margin: -12px -12px 10px; padding: 8px 12px 6px; }
  .sk-bar-t { display: none; }
  .sk-bar-r { justify-content: center; }
}
@media (max-width: 480px) {
  .t-cards { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .t-card { grid-column: span 2; }
  .t-card:nth-child(4), .t-card:nth-child(5) { grid-column: span 3; }
  .t-card-stage { height: 80px; }
  .t-card-img { max-height: 76px; }
}
@media (max-width: 380px) {
  :root { --sk: 37px; --mbs: 36px; }
  .menu-btns { gap: 2px; }
  .con-plate { padding: 6px 12px 7px; }
}
/* mid-width desktops / tablets in landscape: tighter title columns */
@media (min-width: 761px) and (max-width: 1100px) {
  .t-main { grid-template-columns: minmax(210px, 250px) minmax(0, 1fr); gap: 12px; }
  .t-saves, .t-create { padding: 10px; }
  .t-save { grid-template-columns: 32px 1fr; }
  .t-save-btns { grid-column: 1 / -1; flex-direction: row; justify-content: flex-end; }
  .t-save.confirm { grid-template-columns: 1fr; }
  .t-cards { gap: 6px; }
  .t-detail { grid-template-columns: 170px minmax(0, 1fr); gap: 10px; }
  .t-d-name { font-size: 34px; }
  .t-stat { grid-template-columns: 70px 1fr 24px; }
  .t-form { grid-template-columns: minmax(0, 1fr) minmax(180px, 240px); }
}

/* desktop windows that are not very tall: compact title so the whole form fits */
@media (min-width: 761px) and (max-height: 920px) {
  .t-scroll { padding-top: calc(10px + env(safe-area-inset-top)); }
  .t-head { margin: 0 0 12px; }
  .t-logo { font-size: clamp(60px, 13.5vh, 140px); }
  .t-sub { margin-top: 2px; font-size: calc(15px * var(--txt)); }
  .t-h { font-size: calc(26px * var(--txt-h)); margin-bottom: 8px; }
  .t-detail { margin-top: 10px; padding: 8px; }
  .t-d-stage { height: 196px; }
  .t-d-img { max-height: 186px; margin-bottom: 6px; }
  .t-d-desc { margin: 4px 0 8px !important; font-size: calc(13px * var(--txt)); line-height: 1.4; }
  .t-d-gear { margin-top: 6px; }
  .t-form { margin-top: 10px; }
  .t-foot { margin-top: 10px; }
}

/* short landscape screens (phones sideways) */
@media (max-height: 500px) and (min-width: 561px) {
  :root { --con-h: 124px; }
  .qt-text, .qt-state { display: none; }
  .mm-view { width: 124px; height: 64px; }
  .mm-cv { width: 85px; height: 85px; }
  .chat-l { max-height: 54px; }
  .chat:not(:hover):not(.open) .ln:nth-last-child(n+4) { display: none; }
  .t-head { margin: 0 0 1vh; }
  .t-logo { font-size: 64px; }
}

/* =====================================================================
   REDUCED MOTION — keep fades, drop movement & looping effects
   ===================================================================== */
@media (prefers-reduced-motion: reduce) {
  .t-rays, .t-logo-glow, .toast-rays, .badge, .buff.ending, .orb.low .orb-glow, .boss.enraged .bar-f,
  .ig::before, .ig::after, .itip-n[data-g], .qt.done .qt-state, .cw-pts.on, .qcard-done, .sk.ready::before, .sk.deny,
  .sk.press .sk-img, .orb.hit .orb-cv, .inv-ghost.deny, .inv-ghost.jewel, .slot.deny, .pf.lvl, .xp.flash,
  .win.pop, .sheet.pop, .death.show .death-h, .t-d-stage.swap .t-d-img, .boss.enter .boss-n, .it.pend::after,
  .btn.armed, .t-dice.spin img, .zen.bump, .toast.bump, .cw-st.up {
    animation: none !important;
  }
  .t-card, .boss, .ln, .vignette, .t-stat-b i { transition: none !important; }
  .ig::after { display: none; }              /* item glow: the halo stays (still), no sweep */
  .vignette.on { animation: none !important; opacity: .8; }
  .toast, .toast.big { animation: fadeIn .2s linear both; }
  .toast.out, .toast.big.out { animation: fadeOut .3s linear forwards; }
  .banner.show { animation: bannerFade 3.6s linear both; }
  .title.show, .death.show { animation: fadeIn .3s linear both; }
}
@keyframes fadeOut { to { opacity: 0; } }
@keyframes bannerFade { 0% { opacity: 0; } 10% { opacity: 1; } 82% { opacity: 1; } 100% { opacity: 0; } }

/* =====================================================================
   BAÚ — account vault window (ui.js "WINDOW: Baú"): beside the Inventário on desktop; on narrow screens the two
   windows stack (#ui.vaulting): Baú on top, the bag below (side by side in landscape)
   ===================================================================== */
.w-vault { width: calc(8 * var(--cell) + 32px); }
.w-vault .win-b { padding: 10px 14px 12px; }
.w-vault .shop-top { gap: 10px; margin-bottom: 8px; }
.w-vault .npc-ptw { width: 46px; height: 58px; }
.w-vault .npc-line { margin-top: 3px !important; min-height: 2.7em; font-size: calc(12px * var(--txt)); line-height: 1.35; }
.vault-grid { background-color: #0d0a0a; }
.vault-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; }
.vault-cap { font: 400 calc(9px * var(--txt))/1.2 var(--f-num); color: var(--dim); letter-spacing: .5px; text-align: right; }
.vault-cap.full { color: var(--danger); }
.vault-zen { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }   /* big text: the buttons drop under the Zen field */
.vault-zen .btn { flex: 1 0 auto; padding: 0 8px; font-size: calc(12px * var(--txt)); }
.vault-in {
  flex: 1 1 auto;
  width: 60px;
  min-width: 7.5em;
  height: 28px;
  box-sizing: border-box;
  padding: 0 6px;
  font: 400 calc(11px * var(--txt))/1 var(--f-num);
  color: var(--parch);
  background: var(--well);
  border: 1px solid var(--edge);
  box-shadow: inset 0 0 0 1px var(--ink);
  border-radius: 0;
}
.vault-in::placeholder { color: var(--dim); font-family: var(--f-ui); font-size: calc(12px * var(--txt)); }
.hint-vault { display: none; }
@media (hover: hover) {
  #ui.vaulting .w-inv .hint-mouse { display: none; }
  #ui.vaulting .w-inv .hint-vault { display: inline; }
}
.vault-in:focus { outline: none; border-color: var(--gold); }
@media (pointer: coarse) { .vault-in { height: 36px; font-size: calc(13px * var(--txt)); } }
@media (max-width: 760px) {
  #ui.vaulting .win.w-vault { bottom: 46% !important; }
  #ui.vaulting .win.w-inv { top: 54% !important; }
  #ui.vaulting .win.w-vault .win-h, #ui.vaulting .win.w-inv .win-h { height: 40px; }
  #ui.vaulting .win.w-vault .win-t, #ui.vaulting .win.w-inv .win-t { font-size: calc(24px * var(--txt-h)); }
  #ui.vaulting .w-inv .doll, #ui.vaulting .w-inv .inv-hint, #ui.vaulting .w-vault .shop-top { display: none; }
  #ui.vaulting .w-vault .win-b, #ui.vaulting .w-inv .win-b { padding: 8px 10px calc(10px + env(safe-area-inset-bottom)); }
}
@media (max-width: 760px) and (orientation: landscape) {
  #ui.vaulting .win.w-vault { bottom: 0 !important; right: 50% !important; }
  #ui.vaulting .win.w-inv { top: 0 !important; left: 50% !important; }
}
/* laptop-height windows: no portrait / hint, then smaller cells, so the whole grid and the Zen row fit without a scroll */
@media (min-width: 761px) and (max-height: 779px) {
  .w-vault .shop-top, .w-vault .inv-hint { display: none; }
}
@media (min-width: 761px) and (max-height: 660px) {
  .w-vault { --cell: 28px; width: calc(8 * 32px + 32px); }      /* same width: room for the Zen field */
}
/* phones and very short windows: the Zen row above the grid, never below the fold of the window */
@media (max-width: 760px), (max-height: 600px) {
  .w-vault .win-b { display: flex; flex-direction: column; }
  .w-vault .win-b > * { flex: 0 0 auto; }
  .w-vault .vault-foot, .w-vault .vault-zen { order: -1; }
  .w-vault .vault-foot { margin-top: 0; }
  .w-vault .vault-zen { margin-bottom: 8px; }
}

/* ---------- Áudio: volume sliders (ui.js audioRows: Esc menu + title Opções) ---------- */
.vol-set { display: flex; flex-direction: column; gap: 6px; }
.sec.vol-h { margin: 6px 0 2px; font-size: calc(15px * var(--txt)); }
/* mouse: the mute button on the left spans both lines (label + % over the slider), ~49px rows so the Esc menu fits
   laptop-height windows; touch (pointer: coarse, below): label line over a 44px mute + slider line */
.vol-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-areas: "m l v" "m r r";
  align-items: center;
  gap: 0 8px;
  padding: 4px 10px 2px 6px;
  color: var(--mn-ink, var(--parch));
  background: rgba(255, 250, 236, .72);
  border: 1.5px solid var(--mn-line, var(--edge));
  border-radius: 10px;
}
.vol-l { grid-area: l; font: 600 calc(14px * var(--txt))/1.2 var(--f-ui); }
.vol-v { grid-area: v; min-width: 44px; text-align: right; font: 700 calc(12px * var(--txt))/1 var(--f-num); color: var(--mn-gold-deep, var(--gold2)); }
.btn.vol-mute { grid-area: m; width: 32px; height: 32px; min-height: 32px; padding: 0; justify-content: center; }
.vol-ic { display: flex; line-height: 0; }
.vol-mute .vol-x, .vol-mute[aria-pressed="true"] .vol-w { display: none; }
.vol-mute[aria-pressed="true"] .vol-x { display: inline; }
.btn.vol-mute[aria-pressed="true"] { color: var(--mn-rose-deep, #b23a52); }
.vol-r {
  --p: 100%;
  grid-area: r;
  width: 100%;
  height: 22px;
  margin: 0;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  cursor: var(--cur-pointer);
}
.vol-r:focus-visible { outline: none; }
.vol-r::-webkit-slider-runnable-track {
  height: 8px;
  border: 1px solid var(--mn-gold-mid, #c9953a);
  border-radius: 999px;
  background: linear-gradient(90deg, var(--mn-leaf, #6aa84f) 0 var(--p), var(--mn-well, #efe1c0) var(--p) 100%);
  box-shadow: inset 0 1px 2px rgba(120, 80, 30, .25);
}
.vol-r::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  margin-top: -7px;
  border: 1.5px solid var(--mn-gold-deep, #8a5f1e);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--mn-gold-hi, #fff4c2), var(--mn-gold, #e2b65a) 55%, var(--mn-gold-mid, #c9953a));
  box-shadow: 0 1px 2px rgba(74, 46, 20, .35);
}
.vol-r::-moz-range-track { height: 8px; border: 1px solid var(--mn-gold-mid, #c9953a); border-radius: 999px; background: var(--mn-well, #efe1c0); }
.vol-r::-moz-range-progress { height: 8px; border-radius: 999px; background: var(--mn-leaf, #6aa84f); }
.vol-r::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--mn-gold-deep, #8a5f1e);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--mn-gold-hi, #fff4c2), var(--mn-gold, #e2b65a) 55%, var(--mn-gold-mid, #c9953a));
  box-shadow: 0 1px 2px rgba(74, 46, 20, .35);
}
.vol-r:focus-visible::-webkit-slider-thumb { box-shadow: var(--mn-focus, 0 0 0 2px #fff, 0 0 0 4px #2f8592); }
.vol-r:focus-visible::-moz-range-thumb { box-shadow: var(--mn-focus, 0 0 0 2px #fff, 0 0 0 4px #2f8592); }
.vol-row.off .vol-r, .vol-row.off .vol-v { opacity: .5; filter: grayscale(.7); }
@media (pointer: coarse) {
  .vol-row { grid-template-areas: "l l v" "m r r"; gap: 2px 8px; padding: 6px 10px 4px 8px; }
  .btn.vol-mute { width: 44px; height: 44px; min-height: 44px; }
  /* only the knob takes the finger: a swipe that starts on the track scrolls the menu / page instead of moving the
     level (ui.js audioRows also undoes a jump that a cancelled touch made) */
  .vol-r { height: 44px; pointer-events: none; }
  .vol-r::-webkit-slider-thumb { width: 28px; height: 28px; margin-top: -11px; pointer-events: auto; }
  .vol-r::-moz-range-thumb { width: 26px; height: 26px; pointer-events: auto; }
}
/* the Esc menu is modal (the backdrop covers the HUD): it may use the window's height, not stop above the hotbar like
   the other windows; under 760px tall it drops the Scroll of Mana crest, so Controles / Sair stay above the fold */
@media (min-width: 761px) {
  .w-menu { max-height: calc(100vh - 24px); }
}
@media (min-width: 761px) and (max-height: 760px) {
  .w-menu .menu-crest { display: none; }
}
/* title Opções (ui.js buildGate): "Jogo" group; on a wide window Áudio | Jogo + Conta side by side, as wide as the server
   list, so the pane is shorter than the old one-column Som / Música toggles and "Fechar" stays above the fold */
.tg-jogo { display: flex; flex-direction: column; gap: 6px; }
@media (min-width: 900px) and (min-height: 501px) {
  .t-gate .tg-pane { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; column-gap: 16px; width: min(620px, 100%); }
  .t-gate .tg-pane > * { grid-column: 1 / -1; }
  .t-gate .tg-pane > .vol-set { grid-column: 1; grid-row: span 2; }
  .t-gate .tg-pane > .tg-jogo, .t-gate .tg-pane > .tg-ao { grid-column: 2; }
}
