:root {
  color-scheme: dark;
  --gold: #d9ad63;
  --ink: #09110f;
  --panel: rgba(10, 20, 18, .82);
  --line: rgba(225, 197, 139, .25);
  --text: #f1eadb;
  --muted: #a8b2aa;
  /* Mana: the one blue of the HUD, beside the green, yellow, red and dark red of the health bands. */
  --mana: #5d93c4;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; background: var(--ink); color: var(--text); font-family: Inter, ui-sans-serif, system-ui, sans-serif; touch-action: none; user-select: none; }
#game { position: fixed; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; background: #08100e; }
.hud { position: fixed; z-index: 5; }
.ground-material-preview-badge { position: fixed; z-index: 6; top: max(72px, calc(env(safe-area-inset-top) + 70px)); left: 50%; transform: translateX(-50%); padding: 5px 9px; border: 1px solid #c7974b; border-radius: 999px; background: #251c11e8; color: #f3d69d; font: 700 9px/1.2 system-ui, sans-serif; letter-spacing: .08em; white-space: nowrap; pointer-events: none; }
.character-loadout-panel { position: fixed; z-index: 10; top: 176px; left: max(12px, env(safe-area-inset-left)); right: max(12px, env(safe-area-inset-right)); max-width: 420px; max-height: min(56vh, 380px); margin: 0 auto; padding: 8px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; overflow-y: auto; overscroll-behavior: contain; border: 1px solid #c7974b; border-radius: 14px; background: #251c11f5; box-shadow: 0 12px 34px #0009; }
.character-loadout-panel[hidden] { display: none; }
/* Opened from the menu: a sheet in the middle of the screen, clear of the frames above and the controls below. */
.character-loadout-panel.sheet { top: 50%; transform: translateY(-50%); max-height: min(60dvh, 420px); }
.character-loadout-panel button { min-width: 0; min-height: 44px; padding: 5px 8px; display: flex; align-items: center; gap: 8px; border: 1px solid #c7974b66; border-radius: 10px; background: #1b130ae0; color: #f3d69d; font: 700 11px/1.2 system-ui, sans-serif; text-align: left; cursor: pointer; }
.character-loadout-panel button[aria-selected="true"] { border-color: #f3d69d; background: #4a3618; }
.character-loadout-panel button:focus-visible { outline: 2px solid #f3d69d; outline-offset: 1px; }
.character-loadout-icon { flex: none; width: 32px; height: 32px; image-rendering: pixelated; }
.top { left: max(12px, env(safe-area-inset-left)); right: max(12px, env(safe-area-inset-right)); top: max(10px, env(safe-area-inset-top)); height: 54px; display: flex; align-items: center; gap: 12px; padding: 7px 8px 7px 13px; border: 1px solid var(--line); border-radius: 15px; background: linear-gradient(135deg, rgba(9, 20, 17, .91), rgba(16, 29, 25, .72)); box-shadow: 0 12px 34px #0007; backdrop-filter: blur(12px); }
.brand { display: grid; line-height: 1; }
.brand b { color: var(--gold); letter-spacing: .13em; font-size: 13px; }
.brand span { margin-top: 5px; color: var(--muted); letter-spacing: .08em; font-size: 8px; }
/* Where the character is: the region first, then floor and tile on one line. Trouble, when there is any, below. */
.where { min-width: 0; margin-left: auto; display: grid; grid-template-columns: auto auto; justify-content: end; align-items: baseline; gap: 3px 7px; text-align: right; line-height: 1.15; }
.where b { font-size: 12px; white-space: nowrap; }
.where span { color: var(--muted); font-size: 10px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.where #regionLabel { grid-column: 1 / -1; min-width: 0; overflow: hidden; text-overflow: ellipsis; color: var(--text); font-size: 13px; font-weight: 700; }
.where #regionLabel:not([hidden]) ~ #floorLabel { color: var(--muted); font-size: 10px; font-weight: 600; }
.where #worldNotice { grid-column: 1 / -1; color: var(--gold); font-weight: 700; }
button, a { color: var(--text); font: inherit; }
button { cursor: pointer; }
.glass { min-height: 38px; border: 1px solid var(--line); border-radius: 11px; padding: 0 13px; background: rgba(27, 42, 37, .84); text-decoration: none; display: inline-grid; place-items: center; box-shadow: inset 0 1px #fff1; }
.glass:active { transform: translateY(1px); background: rgba(44, 64, 55, .92); }
/* Row under the top bar: the character on the left, the floors on the right. The row after it has the quest line
   on the left and the target on the right. Every panel is the dark glass of the bar, so it reads over light grass
   and inside a dark cave alike. */
.icon-sprite { position: absolute; }
.icon { width: 18px; height: 18px; flex: none; fill: currentColor; }
.player-frame { top: 82px; left: max(12px, env(safe-area-inset-left)); max-width: calc(100vw - 168px); min-height: 44px; display: flex; align-items: center; gap: 8px; padding: 3px 11px 3px 3px; border: 1px solid var(--line); border-radius: 13px; background: var(--panel); box-shadow: 0 10px 28px #0006; backdrop-filter: blur(10px); }
.frame-portrait { flex: none; width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 10px; background: #07100e; image-rendering: pixelated; }
.frame-body { min-width: 0; display: grid; gap: 3px; line-height: 1.1; }
.frame-body b { color: var(--gold); font-size: 12px; letter-spacing: .02em; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.frame-body > span { color: var(--muted); font-size: 10px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.frame-body span[hidden], .health[hidden], .frame-vitals[hidden] { display: none; }
.frame-vitals { display: flex; align-items: center; gap: 6px; }
.frame-vitals output { color: var(--text); font-size: 10px; font-weight: 700; font-variant-numeric: tabular-nums; }
.health { display: block; flex: 1 1 auto; height: 7px; min-width: 64px; border: 1px solid #050a09; border-radius: 4px; background: #07100ed9; overflow: hidden; }
.health i { display: block; height: 100%; width: var(--health, 100%); background: #4cc34a; transition: width .2s ease-out; }
.health[data-band="mid"] i { background: #e3b62c; }
.health[data-band="low"] i { background: #d5392c; }
.health[data-band="critical"] i { background: #7d1410; }
/* Mana, under the health: the same bar, thinner, in its own colour. */
.frame-mana { margin-top: -1px; }
.health.mana { height: 5px; }
.health.mana i { width: var(--mana-fill, 100%); background: var(--mana); }
/* With the mana row and a title under the name the character's frame is taller than the gap to the row under it
   (quest line, target): that row steps down by the difference. */
body:has(#playerManaRow:not([hidden])):has(#playerNote:not([hidden])) :is(.quest-tracker, .target-frame) { top: 144px; }
body:has(#playerManaRow:not([hidden])):has(#playerNote:not([hidden])):has(#questTracker:not([hidden]), #targetFrame:not([hidden])) .server-environment-badge { top: max(196px, calc(env(safe-area-inset-top) + 194px)) !important; }
/* A blow taken: the character's bar blinks once in the red of its low band. Two names for one flash, so that a
   second blow during the first starts it again. */
.player-frame[data-hurt] .health { animation: hurt-a .42s ease-out; }
.player-frame[data-hurt="b"] .health { animation-name: hurt-b; }
@keyframes hurt-a { from { box-shadow: 0 0 0 2px #bb5148; } to { box-shadow: 0 0 0 2px #bb514800; } }
@keyframes hurt-b { from { box-shadow: 0 0 0 2px #bb5148; } to { box-shadow: 0 0 0 2px #bb514800; } }
/* A fall in combat, said right under the character (the middle of the screen) until it is back on its feet: above
   it would cover whoever receives it at the return point. The same dark glass as the frames. */
.defeat-notice { top: 58%; left: 50%; transform: translateX(-50%); width: max-content; max-width: min(86vw, 320px); display: grid; gap: 4px; padding: 10px 16px; border: 1px solid var(--line); border-radius: 13px; background: var(--panel); box-shadow: 0 10px 28px #0006; backdrop-filter: blur(10px); text-align: center; line-height: 1.25; pointer-events: none; }
.defeat-notice[hidden], .defeat-notice span[hidden] { display: none; }
.defeat-notice b { color: var(--gold); font-size: 15px; letter-spacing: .02em; }
.defeat-notice span { color: var(--text); font-size: 12px; }
.quest-tracker { top: 132px; left: max(12px, env(safe-area-inset-left)); max-width: calc(100vw - 24px); display: flex; border: 1px solid var(--line); border-radius: 13px; background: var(--panel); box-shadow: 0 10px 28px #0006; backdrop-filter: blur(10px); overflow: hidden; }
/* With a target on screen the line shares the row with it. */
body:has(#targetFrame:not([hidden])) .quest-tracker { max-width: calc(100vw - 160px); }
.quest-tracker[hidden], .target-frame[hidden] { display: none; }
.quest-tracker button { min-width: 0; min-height: 44px; border: 0; padding: 0 9px; display: flex; align-items: center; gap: 6px; background: transparent; font-size: 12px; }
.quest-tracker button:active { background: rgba(44, 64, 55, .92); }
.quest-tracker .icon { width: 16px; height: 16px; color: var(--gold); }
#questTrackerText { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
#questTrackerCount { flex: none; color: var(--gold); font-weight: 700; font-variant-numeric: tabular-nums; }
#questTrackerCount:empty { display: none; }
#questTrackerFold { flex: none; width: 40px; justify-content: center; border-left: 1px solid var(--line); color: var(--muted); }
#questTrackerFold .icon { width: 14px; height: 14px; color: inherit; }
.quest-tracker.folded #questTrackerText { display: none; }
.quest-tracker.folded #questTrackerFold .icon { transform: scaleX(-1); }
.target-frame { top: 132px; right: max(12px, env(safe-area-inset-right)); width: 128px; min-height: 44px; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px 6px; padding: 5px 9px; border: 1px solid #c9716288; border-radius: 13px; background: var(--panel); box-shadow: 0 10px 28px #0006; backdrop-filter: blur(10px); text-align: left; cursor: default; }
.target-frame b { grid-column: 1 / -1; color: #f3c9bd; font-size: 12px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.target-frame .health { min-width: 0; }
.target-frame output { color: var(--text); font-size: 10px; font-weight: 700; font-variant-numeric: tabular-nums; }
.target-frame.far { border-color: var(--line); }
.target-frame.far b { color: var(--muted); }
.target-frame.chosen { cursor: pointer; }
/* Weakened by a spell: the mark of that spell in the corner of the frame, while it lasts. */
.target-condition { position: absolute; top: 6px; right: 8px; display: grid; color: var(--gold); }
.target-condition .icon { width: 12px; height: 12px; }
.target-condition[hidden] { display: none; }
.target-frame.weakened b { padding-right: 15px; }
/* Locked on the server: the frame takes the gold of a chosen option while the blows land on their own. */
.target-frame.locked { border-color: var(--gold); }
/* The test-environment seal (styled inline by `server-environment.js`) steps down while the second row is in use. */
body:has(#questTracker:not([hidden]), #targetFrame:not([hidden])) .server-environment-badge { top: max(184px, calc(env(safe-area-inset-top) + 182px)) !important; }
.floor-controls { top: 82px; right: max(12px, env(safe-area-inset-right)); display: grid; grid-template-columns: 40px 48px 40px; align-items: stretch; border: 1px solid var(--line); border-radius: 13px; overflow: hidden; background: var(--panel); box-shadow: 0 10px 28px #0006; backdrop-filter: blur(10px); }
.floor-controls button { border: 0; border-radius: 0; min-height: 42px; padding: 0; background: rgba(255,255,255,.035); }
.floor-controls div { border-inline: 1px solid var(--line); display: grid; place-content: center; text-align: center; line-height: 1; }
.floor-controls small { color: var(--muted); font-size: 7px; letter-spacing: .12em; }
.floor-controls b { margin-top: 4px; color: var(--gold); font-size: 14px; }
.dpad { left: max(16px, env(safe-area-inset-left)); bottom: max(18px, env(safe-area-inset-bottom)); width: 150px; height: 150px; border-radius: 50%; border: 1px solid var(--line);
  background: radial-gradient(circle, rgba(10, 20, 18, .55) 0 38%, var(--panel) 39% 100%); box-shadow: 0 10px 28px #0007, inset 0 0 0 7px rgba(217, 173, 99, .06); backdrop-filter: blur(8px); touch-action: none; }
.dpad::before { content: ""; position: absolute; inset: 14px; border-radius: 50%; border: 1px dashed rgba(217, 173, 99, .16); pointer-events: none; }
/* 8 zonas de toque invisiveis (teclado/acessibilidade/smoke); o visual e a base + bolinha */
.dpad button { position: absolute; width: 46px; height: 46px; margin: -23px 0 0 -23px; border: 0; border-radius: 50%; padding: 0; background: transparent; color: rgba(241, 234, 219, .38); font-size: 11px; }
.dpad button:nth-child(1) { left: 26%; top: 26%; font-size: 0; }
.dpad button:nth-child(2) { left: 50%; top: 15%; }
.dpad button:nth-child(3) { left: 74%; top: 26%; font-size: 0; }
.dpad button:nth-child(4) { left: 15%; top: 50%; }
.dpad button:nth-child(6) { left: 85%; top: 50%; }
.dpad button:nth-child(7) { left: 26%; top: 74%; font-size: 0; }
.dpad button:nth-child(8) { left: 50%; top: 85%; }
.dpad button:nth-child(9) { left: 74%; top: 74%; font-size: 0; }
.dpad .stick { position: absolute; left: 50%; top: 50%; width: 62px; height: 62px; margin: -31px 0 0 -31px; border-radius: 50%; pointer-events: none;
  border: 1px solid rgba(217, 173, 99, .55); background: radial-gradient(circle at 38% 32%, #3b5247, #1a2a24 62%, #111c18); box-shadow: 0 6px 16px #000a, inset 0 1px 0 #ffffff1c;
  transform: translate(var(--sx, 0px), var(--sy, 0px)); transition: transform .12s ease-out; }
.dpad.active .stick { transition: none; border-color: var(--gold); }
.dpad .stick::after { content: ""; position: absolute; inset: 22px; border-radius: 50%; background: #d9ad6333; }
/* The spells (ADR-0091): one row of slots above the joystick and the actions, in reach of both thumbs, with the
   effects in force on the character in a line over it. On a wide screen it is the bar in the middle of the bottom. */
.ability-bar { left: 0; right: 0; bottom: max(176px, calc(env(safe-area-inset-bottom) + 176px)); display: grid; justify-items: center; gap: 5px; pointer-events: none; }
.ability-bar[hidden], .ability-conditions[hidden] { display: none; }
.ability-slots { display: flex; gap: 6px; pointer-events: auto; }
.ability-conditions { display: flex; gap: 5px; pointer-events: none; }
.ability-conditions span { display: inline-flex; align-items: center; gap: 4px; padding: 2px 7px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); color: var(--text); font-size: 10px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.3; }
.ability-conditions .icon { width: 11px; height: 11px; color: var(--gold); }
.ability-conditions small { color: var(--muted); font-size: 9px; font-weight: 600; }
.ability { position: relative; width: 46px; height: 46px; min-height: 0; padding: 0; overflow: hidden; background: var(--panel); box-shadow: 0 10px 24px #0006; backdrop-filter: blur(8px); }
.ability .icon { width: 20px; height: 20px; }
.ability[data-group="attack"] .icon { color: #f3c9bd; }
.ability[data-group="heal"] .icon { color: #8fbf8f; }
.ability[data-group="support"] .icon { color: var(--gold); }
/* What it costs, in the colour of the mana, and the key that casts it on a keyboard. */
.ability-cost { position: absolute; right: 4px; bottom: 2px; color: var(--mana); font-size: 9px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1; }
.ability-key { position: absolute; left: 4px; top: 3px; display: none; color: var(--muted); font: 700 9px/1 system-ui, sans-serif; }
/* Recharging: a shade that empties from the top as the time runs, and the seconds left over it. The spell stays
   recognisable under the shade. */
.ability::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: var(--wait, 0%); background: #07100e99; pointer-events: none; }
.ability-wait { position: absolute; inset: 0; z-index: 1; display: grid; place-items: center; color: var(--text); font-size: 15px; font-weight: 800; font-variant-numeric: tabular-nums; text-shadow: 0 1px 2px #07100e, 0 0 6px #07100e; pointer-events: none; }
.ability-wait:empty { display: none; }
.ability[data-state="cooldown"] .icon, .ability[data-state="down"] .icon { opacity: .5; }
.ability[data-state="cooldown"] .ability-cost { opacity: 0; }
.ability[data-state="mana"] { border-color: #bb514888; }
.ability[data-state="mana"] .icon { opacity: .4; }
.ability[data-state="mana"] .ability-cost { color: #e8847a; }
.ability[data-state="target"] { border-style: dashed; }
.ability[data-state="target"] .icon { opacity: .55; }
.ability[data-state="down"] { opacity: .45; }
.ability.sent { border-color: var(--gold); }
.spell-art {
  display: block;
  inline-size: 100%;
  aspect-ratio: 1;
  background-position: var(--spell-art-position);
  background-size: var(--spell-art-size);
  background-repeat: no-repeat;
  image-rendering: pixelated;
  pointer-events: none;
}
.spell-art[data-spell-art="base"] { background-image: url("assets/hud/a0844/base-spells.png"); }
.spell-art[data-spell-art="effect"] { background-image: url("assets/spell-effects-a0812.png"); background-color: #11161c; }
.ability[data-illustrated] > .spell-art, .mastery-node-icon.has-spell-art > .spell-art, .mastery-slot.has-spell-art > .spell-art {
  position: absolute;
  inset: 3px;
  inline-size: auto;
  border-radius: 2px;
}
.ability[data-illustrated] :is(.ability-cost, .ability-key) { z-index: 1; }
.ability:is([data-state="cooldown"], [data-state="target"]) > .spell-art { opacity: .6; }
.ability[data-state="mana"] > .spell-art { opacity: .55; filter: saturate(.55); }
.mastery-node-icon.has-spell-art > .icon, .mastery-slot.has-spell-art > .icon { visibility: hidden; }
.mastery-node-icon.has-spell-art .mastery-node-mark, .mastery-slot.has-spell-art .mastery-slot-key { z-index: 1; }
.mastery-node[data-state="locked"] .spell-art { filter: saturate(.75) brightness(.8); }
.spell-tip {
  position: fixed;
  bottom: max(env(safe-area-inset-bottom), var(--spell-tip-bottom, 112px));
  left: 50%;
  transform: translateX(-50%);
  width: min(328px, calc(100vw - 36px));
  padding: 8px;
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  border: 1px solid #785c34;
  border-radius: 7px;
  background: #121916;
  box-shadow: 0 6px 22px #000a;
  color: #eae0cd;
}
.spell-tip[hidden] { display: none; }
.spell-tip > .spell-art { border: 1px solid #785c34; border-radius: 4px; }
.spell-tip strong { display: block; color: #f9dc9f; font-size: 15px; line-height: 1.2; }
.spell-tip p { margin: 3px 0 0; font-size: 12px; line-height: 1.4; }
/* The support items after the spells (ADR-0092): the same slot, with the art of the item and how many the
   backpack holds where a spell shows its cost. */
.ability-row { display: flex; gap: 6px; pointer-events: none; }
.item-slots { padding-left: 6px; border-left: 1px solid var(--line); }
.item-slots[hidden] { display: none; }
.ability.item .item-icon { --s: 36px; image-rendering: auto; }
.ability-count { position: absolute; right: 4px; bottom: 2px; z-index: 1; color: var(--text); font-size: 10px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1; text-shadow: 0 1px 2px #07100e, 0 0 4px #07100e; }
.ability[data-state="cooldown"] .item-icon, .ability[data-state="down"] .item-icon { opacity: .5; }
.ability[data-state="none"] { border-style: dashed; }
.ability[data-state="none"] .item-icon { opacity: .35; filter: grayscale(1); }
/* A conversation takes the middle of the screen: the spells step aside until it is over. */
body:has(#npcDialogue:not([hidden])) .ability-bar { display: none; }
.quick { right: max(16px, env(safe-area-inset-right)); bottom: max(18px, env(safe-area-inset-bottom)); display: flex; gap: 8px; align-items: flex-end; }
/* The right thumb: ATK in the corner with the menu beside it, and Falar, Diário and Mapa in the row above. The
   joystick has the left thumb, so nothing of this side reaches it, on a phone or on a wide screen. */
.quick .glass { height: 48px; min-width: 48px; background: var(--panel); box-shadow: 0 10px 24px #0006; }
.quick .attack { order: 2; position: relative; width: 68px; height: 68px; padding: 0; border-color: #c97162aa; border-radius: 50%; background: radial-gradient(circle at 38% 30%, #a94f45, #632b2b 72%); color: #fff0df; font-size: 15px; font-weight: 800; letter-spacing: .05em; display: inline-grid; place-items: center; align-content: center; gap: 0; }
.quick .attack:disabled { opacity: .45; cursor: default; }
.quick .attack[hidden], .attack-weapon[hidden] { display: none; }
/* The equipped weapon, as the weapon list shows it; the label goes under it. */
.attack-weapon { width: 34px; height: 34px; margin-top: -2px; image-rendering: pixelated; pointer-events: none; filter: drop-shadow(0 1px 1px #000a); }
.quick .attack.armed .attack-label { margin-top: -4px; font-size: 11px; }
.quick .tools-toggle { order: 1; width: 48px; padding: 0; }
/* Whether the character walks after its locked target. On: the gold of a chosen option; off: struck through. */
.quick .follow { order: 0; position: relative; width: 48px; padding: 0; }
.quick .follow[hidden] { display: none; }
/* A0823: the weapon swap, a plain button with its two arrows (the follow switch's neighbour). */
.quick .swap { order: 0; position: relative; width: 48px; padding: 0; }
/* Its icon is its own (the arrows of the sheet, side by side), not the first cell of the sheet (the backpack). */
/* :not(.attack) gives it the weight of the general rule of the sheet (further down) so that this one wins (A0824). */
.quick > .glass.swap:not(.attack)::before { background: url("assets/hud/a0823/swap.png") center / contain no-repeat; }
.quick .swap[hidden] { display: none; }
.equipment-swap { display: inline-flex; align-items: center; gap: 6px; justify-content: center; }
.equipment-swap[hidden] { display: none; }
.quick .follow[aria-pressed="true"] { border-color: var(--gold); color: var(--gold); }
.quick .follow[aria-pressed="false"] { color: var(--muted); }
.quick .follow[aria-pressed="false"]::after { content: ""; position: absolute; left: 11px; right: 11px; top: 50%; border-top: 2px solid currentColor; transform: rotate(-45deg); }
/* A target is locked: the ring of the ATK button says the blows are the server's now, not the thumb's. */
.quick .attack.locked { border-color: var(--gold); box-shadow: 0 0 0 2px #0c1714, 0 0 0 4px var(--gold), 0 10px 24px #0006; }
/* The menu: a list that opens above the actions and closes on a choice or on a touch outside. */
.quick-tools { position: fixed; z-index: 9; right: max(16px, env(safe-area-inset-right)); bottom: max(158px, calc(env(safe-area-inset-bottom) + 158px)); width: 216px; max-height: calc(100dvh - 250px); display: none; flex-direction: column; align-items: stretch; gap: 6px; padding: 8px; overflow-y: auto; overscroll-behavior: contain; border: 1px solid var(--line); border-radius: 14px; background: #0c1714f2; box-shadow: 0 12px 34px #0009; }
/* Above the test-environment seal while it is open. */
.quick.tools-open { z-index: 9; }
.quick.tools-open .quick-tools { display: flex; }
.quick.tools-open .tools-toggle { border-color: var(--gold); color: var(--gold); }
.quick-tools .glass { flex: none; height: auto; min-height: 44px; display: flex; justify-content: flex-start; align-items: center; gap: 9px; padding: 0 12px; box-shadow: none; font-size: 13px; text-align: left; }
.quick-tools .glass.on, .quick-tools .glass[aria-pressed="true"] { border-color: var(--gold); color: var(--gold); }
.menu-group { flex: none; display: grid; gap: 6px; padding: 6px 0 2px; border-top: 1px solid var(--line); }
.menu-group[hidden] { display: none; }
.menu-group small { color: var(--muted); font-size: 9px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.menu-test { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.menu-test small { grid-column: 1 / -1; }
.menu-test .glass { justify-content: center; padding: 0 6px; font-size: 12px; }
.menu-group + a.glass { margin-top: 2px; }
.story-actions { right: max(16px, env(safe-area-inset-right)); bottom: max(94px, calc(env(safe-area-inset-bottom) + 94px)); display: flex; gap: 8px; align-items: flex-end; }
.story-actions .action { width: 54px; height: 54px; min-height: 0; padding: 0; display: inline-grid; place-items: center; align-content: center; gap: 3px; background: var(--panel); box-shadow: 0 10px 24px #0006; font-size: 10px; font-weight: 600; }
.story-actions .action[hidden] { display: none; }
.story-actions .action .icon { width: 20px; height: 20px; }
.story-actions .talk { border-color: var(--gold); color: var(--gold); font-weight: 700; }
/* Without ATK (a visitor has no combat) the menu button is the whole row: the actions come down to it. */
.quick:not(:has(.attack:not([hidden]))) ~ .story-actions { bottom: max(74px, calc(env(safe-area-inset-bottom) + 74px)); }
.hud :is(button, a):focus-visible, .hud:focus-visible, .character-loadout-panel button:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.npc-dialogue { left: 50%; bottom: max(184px, calc(env(safe-area-inset-bottom) + 184px)); z-index: 8; width: min(440px, calc(100vw - 24px)); transform: translateX(-50%); display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 15px; background: linear-gradient(135deg, rgba(9, 20, 17, .96), rgba(16, 29, 25, .93)); box-shadow: 0 12px 34px #0009; backdrop-filter: blur(12px); }
.npc-dialogue[hidden] { display: none; }
.npc-dialogue.no-portrait { grid-template-columns: minmax(0, 1fr); }
.npc-portrait { width: 72px; height: 72px; border: 1px solid var(--line); border-radius: 11px; background: #07100e; image-rendering: pixelated; }
.npc-portrait[hidden] { display: none; }
.npc-dialogue header, .npc-dialogue footer { display: flex; align-items: center; gap: 8px; }
.npc-dialogue header div { min-width: 0; display: grid; gap: 3px; line-height: 1.1; }
.npc-dialogue header b { color: var(--gold); font-size: 13px; letter-spacing: .03em; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.npc-dialogue header span { color: var(--muted); font-size: 10px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.npc-dialogue header span:empty { display: none; }
.npc-dialogue header .glass { margin-left: auto; flex: none; width: 34px; min-height: 34px; padding: 0; }
.npc-dialogue p { margin: 7px 0 0; font-size: 14px; line-height: 1.4; }
.npc-dialogue .npc-dialogue-note { color: var(--muted); font-size: 11px; }
.npc-dialogue p[hidden], .npc-dialogue .glass[hidden] { display: none; }
.npc-dialogue footer { margin-top: 9px; }
.npc-dialogue footer .glass { padding: 0 9px; font-size: 13px; white-space: nowrap; }
.npc-dialogue footer span { margin-right: auto; color: var(--muted); font-size: 10px; font-variant-numeric: tabular-nums; }
.npc-dialogue .primary { border-color: var(--gold); color: var(--gold); font-weight: 700; }
/* A0808: the destinations of a captain under his lines, the same bronze buttons, wrapping on a narrow screen. */
.npc-dialogue .npc-dialogue-travel { margin-top: 9px; }
.npc-dialogue .npc-dialogue-travel[hidden] { display: none; }
.npc-dialogue .npc-dialogue-travel > span { display: block; color: var(--muted); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
.npc-dialogue .npc-dialogue-travel > div { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 5px; }
.npc-dialogue .npc-dialogue-travel .glass { min-height: 34px; padding: 0 10px; font-size: 13px; white-space: nowrap; }
/* While someone talks the box has the place of the messages, so they go under the frames at the top. */
html[data-npc-dialogue] #toast { top: max(190px, calc(env(safe-area-inset-top) + 190px)); bottom: auto; }
.quest-journal .map-card { width: min(520px, 100%); max-height: calc(100dvh - 24px); display: flex; flex-direction: column; }
.quest-list { flex: 1 1 auto; min-height: 0; margin: 12px 0 10px; display: grid; align-content: start; gap: 9px; overflow-y: auto; overscroll-behavior: contain; }
.quest-list h3 { margin: 2px 0 0; color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.quest-card { padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: #13231e; }
.quest-card b { color: var(--gold); font-size: 13px; }
.quest-card p, .quest-hint { margin: 4px 0 0; color: var(--muted); font-size: 12px; line-height: 1.4; }
.quest-card .quest-honor { color: var(--gold); }
.quest-card ol { margin: 9px 0 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.quest-card li { display: grid; grid-template-columns: 14px minmax(0, 1fr) auto; gap: 6px; color: var(--muted); font-size: 12px; line-height: 1.4; }
.quest-card li::before { content: "·"; text-align: center; }
.quest-card li.done::before { content: "✓"; color: #8fbf8f; }
.quest-card li.current { color: var(--text); }
.quest-card li.current::before { content: "▸"; color: var(--gold); }
.quest-card li output { color: var(--gold); font-weight: 700; font-variant-numeric: tabular-nums; }
.quest-journal .map-card footer { display: grid; justify-content: stretch; gap: 5px; line-height: 1.4; }
/* Item art: one sheet of 48 px cells (generated for the island; see assets/provenance.json). The game sets the
   sheet and its size on the root; `--ix` and `--iy` pick the cell. At 48 px the pixels are kept square. */
.item-icon { --s: 48px; display: block; flex: none; width: var(--s); height: var(--s); background-image: var(--item-sheet, none); background-repeat: no-repeat;
  background-size: calc(var(--s) * var(--item-columns, 6)) calc(var(--s) * var(--item-rows, 3));
  background-position: calc(var(--s) * var(--ix, 0) * -1) calc(var(--s) * var(--iy, 0) * -1); image-rendering: pixelated; }
/* An item this client has no art for: the box of the icon set, never a drawing made up here. */
.item-icon.plain { background: none; display: grid; place-items: center; color: var(--muted); }
.item-icon.plain .icon { width: 55%; height: 55%; }
[data-item="item_canvas_bag_0001"] .item-icon, html[data-backpack-selected="item_canvas_bag_0001"] #backpackDetailIcon {
  background: url("assets/hud/a0744/icons.png") no-repeat 0 0 / calc(var(--s) * 6) calc(var(--s) * 2);
}
[data-item="item_canvas_bag_0001"] .item-icon .icon, html[data-backpack-selected="item_canvas_bag_0001"] #backpackDetailIcon .icon { visibility: hidden; }
:is([data-item="item_farol_javelin_0001"] .item-icon, .item-icon[data-item-icon="item_farol_javelin_0001"], html[data-backpack-selected="item_farol_javelin_0001"] #backpackDetailIcon) {
  background: url("assets/outfits/outfit_brumavale_wayfarer_a0720/attack-javelin/icon.png") center / contain no-repeat;
}
:is([data-item="item_farol_javelin_0001"] .item-icon, .item-icon[data-item-icon="item_farol_javelin_0001"], html[data-backpack-selected="item_farol_javelin_0001"] #backpackDetailIcon) .icon { visibility: hidden; }
/* The backpack (ADR-0092): the card of the journal, with the slots, what the chosen item is for, and the loot filter. */
.backpack .map-card { width: min(520px, 100%); max-height: calc(100dvh - 24px); display: flex; flex-direction: column; }
.backpack-tabs { display: flex; gap: 6px; margin: 10px 0 0; }
.backpack-tools { display: flex; align-items: stretch; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.backpack-tools .backpack-tabs { flex: 1 1 8.5rem; margin: 0; }
.backpack.floating .backpack-tools { margin-top: 6px; }
.backpack-tools .glass#backpackOrganize {
  flex: 0 0 auto; min-height: 44px; padding: 5px 9px; color: var(--gold); font-size: 12px; font-weight: 700;
}
.backpack-tools #backpackOrganize[aria-disabled="true"] { opacity: .5; cursor: default; }
.backpack-tools #backpackOrganize:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; }
.backpack-organize-status { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.35; }
.backpack-organize-status:not(:empty) { margin-top: 5px; }

.backpack-tabs .glass { flex: 1 1 0; min-height: 36px; display: inline-flex; justify-content: center; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; }
.backpack-tabs .glass[aria-selected="true"] { border-color: var(--gold); color: var(--gold); }
.backpack-tabs .icon { width: 13px; height: 13px; }
.backpack-pane { flex: 1 1 auto; min-height: 0; margin: 10px 0 8px; padding-right: 2px; scrollbar-width: thin; display: grid; align-content: start; gap: 9px; overflow-y: auto; overscroll-behavior: contain; }
.backpack-pane[hidden] { display: none; }
.backpack-pane .quest-hint:empty { display: none; }
.backpack-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 5px; }
.backpack-trail { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; color: var(--gold); font-size: 12px; }
.backpack-trail[hidden], .backpack-move-form[hidden], .backpack-bag-actions .glass[hidden] { display: none; }
.backpack-trail .glass { min-height: 44px; padding-inline: 9px; }
.backpack-trail [aria-current] { overflow-wrap: anywhere; font-weight: 700; }
.backpack-bag-actions { display: flex; grid-column: 1 / -1; flex-wrap: wrap; gap: 6px; }
.backpack-bag-actions:not(:has(button:not([hidden]))) { display: none; }
.backpack-bag-actions .glass, .backpack-move-actions .glass { min-height: 44px; padding-inline: 10px; }
.backpack-move-form { display: grid; gap: 6px; min-width: 0; padding: 8px; border: 1px solid var(--line); background: #10140f; border-radius: 4px; }
.backpack-move-form label { font-size: 12px; color: var(--muted); }
.backpack-move-form :is(select, input) { display: block; width: 100%; min-height: 44px; min-width: 0; padding: 4px 6px; font: inherit; font-size: 16px;
  border: 1px solid var(--line); border-radius: 4px; color: var(--text); background: #0a1411; }
.backpack-move-fields { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 6px; }
.backpack-move-fields label { display: grid; min-width: 0; gap: 4px; }
.backpack-move-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 6px; }
.backpack-move-actions .primary { color: var(--gold); border-color: var(--gold); }
:is(.backpack-trail, .backpack-bag-actions, .backpack-move-form) :is(button, input, select):focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
.backpack-slot { position: relative; aspect-ratio: 1; min-height: 0; padding: 0; border: 1px solid var(--line); border-radius: 9px; background: #13231e; display: grid; place-items: center; overflow: hidden; }
.backpack-slot.empty { border-style: dashed; border-color: #e1c58b1f; background: #0a1411; }
.backpack-slot.selected { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); }
.backpack-slot output { position: absolute; right: 3px; bottom: 1px; color: var(--text); font-size: 10px; font-weight: 800; font-variant-numeric: tabular-nums; text-shadow: 0 1px 2px #07100e, 0 0 4px #07100e; }
#backpackGrid .backpack-slot output:not(:empty) { padding: 0 2px; line-height: 1.25; border-radius: 3px; background: #08120fdd; white-space: nowrap; }
.backpack-detail { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: #13231e; }
.backpack-detail[hidden] { display: none; }
.backpack-detail-body { display: grid; gap: 3px; }
.backpack-detail b { color: var(--gold); font-size: 13px; }
.backpack-detail small { color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.backpack-detail p { margin: 2px 0 0; color: var(--text); font-size: 12px; line-height: 1.4; }
.backpack-detail ul { margin: 4px 0 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.backpack-detail li { display: grid; grid-template-columns: 14px minmax(0, 1fr); gap: 6px; color: var(--muted); font-size: 12px; line-height: 1.4; }
.backpack-detail li::before { content: "·"; text-align: center; }
.backpack-detail li.active { color: var(--text); }
.backpack-detail li.active::before { content: "✓"; color: #8fbf8f; }
.backpack-detail .item-bonus-line { grid-template-columns: 14px minmax(0, 1fr) auto; }
.backpack-detail .item-bonus-value { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.backpack-detail .primary { align-self: center; border-color: var(--gold); color: var(--gold); font-weight: 700; }
.backpack-detail .primary[hidden] { display: none; }
.backpack .map-card footer { display: grid; justify-content: stretch; gap: 5px; line-height: 1.4; }
.loot-mode { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.loot-mode .glass { min-height: 40px; padding: 5px 8px; font-size: 11px; line-height: 1.25; text-align: center; }
.loot-mode .glass[aria-pressed="true"] { border-color: var(--gold); color: var(--gold); }
.loot-list { display: grid; gap: 5px; }
.loot-entry { min-height: 44px; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 9px; padding: 3px 10px 3px 4px; border: 1px solid var(--line); border-radius: 10px; background: #13231e; color: var(--text); text-align: left; font-size: 12px; }
.loot-entry .item-icon { --s: 36px; image-rendering: auto; }
.loot-entry .loot-name { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.loot-entry em { color: #8fbf8f; font-size: 10px; font-style: normal; font-weight: 700; white-space: nowrap; }
.loot-entry[aria-pressed="false"] { background: #0a1411; color: var(--muted); }
.loot-entry[aria-pressed="false"] .item-icon { opacity: .45; }
.loot-entry[aria-pressed="false"] em { color: var(--muted); }
/* With the backpack open the messages of the game go to the top of the screen, clear of the card. */
html[data-backpack="open"]:not([data-backpack-window="floating"]) #toast { top: max(10px, calc(env(safe-area-inset-top) + 10px)); bottom: auto !important; }
/* What dropped: a line or two under the frames of the left, gone in a few seconds. It never takes a touch and
   never sits over the middle of the screen, where the fight is. */
.loot-feed { top: 180px; left: max(12px, env(safe-area-inset-left)); max-width: min(64vw, 300px); display: grid; justify-items: start; gap: 4px; pointer-events: none; }
.loot-feed[hidden] { display: none; }
.corpse-loot-action[hidden] { display: none; }
.corpse-loot-action { position: fixed; z-index: 7; width: 136px; min-height: 44px; left: clamp(calc(80px + env(safe-area-inset-left)), var(--corpse-loot-x), calc(100vw - 80px - env(safe-area-inset-right)));
  top: clamp(calc(56px + env(safe-area-inset-top)), calc(var(--corpse-loot-y) - 14px), calc(100dvh - 12px - env(safe-area-inset-bottom)));
  translate: -50% -100%; border-color: var(--gold); background: #0b1412; color: var(--gold); font-size: 13px; font-weight: 700; box-shadow: 0 6px 18px #000b; }
.corpse-loot-action:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.loot-feed p { margin: 0; padding: 4px 9px; border: 1px solid var(--line); border-radius: 9px; background: #07100fd9; color: var(--text); font-size: 11px; line-height: 1.35; }
.loot-feed p.left { border-color: #c9716288; }
.controls-dialog { width: min(440px, calc(100vw - 24px)); border: 1px solid var(--line); border-radius: 16px; padding: 0; background: #0c1714; color: var(--text); box-shadow: 0 24px 80px #000d; }
.controls-dialog::backdrop { background: #020605d9; backdrop-filter: blur(8px); }
.controls-dialog form { padding: 14px; }
.controls-dialog header, .controls-dialog footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.controls-dialog header div { display: grid; gap: 3px; }
.controls-dialog header b { color: var(--gold); }
.controls-dialog header span, .controls-dialog output { color: var(--muted); font-size: 11px; }
.binding-list { display: grid; gap: 8px; margin: 14px 0; }
.binding-list button { display: flex; justify-content: space-between; align-items: center; min-height: 46px; border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; background: #13231e; color: var(--text); }
.binding-list button kbd { min-width: 76px; border: 1px solid #ffffff2b; border-radius: 7px; padding: 5px 8px; background: #07100f; color: var(--gold); font: 700 12px/1 ui-monospace, monospace; }
.binding-list button.listening { border-color: var(--gold); box-shadow: 0 0 0 2px #d9ad6322; }
.loading { position: fixed; inset: 0; z-index: 20; display: grid; place-content: center; justify-items: center; gap: 9px; background: radial-gradient(circle at center, #162a22, #07100e 62%); opacity: 0; visibility: hidden; transition: .3s; }
.loading:not(.open) { pointer-events: none; }
.loading.open { opacity: 1; visibility: visible; }
.loading b { margin-top: 6px; color: var(--gold); letter-spacing: .04em; }
.loading span { color: var(--muted); font-size: 12px; }
.sigil { width: 54px; height: 54px; border: 2px solid #d9ad6340; border-top-color: var(--gold); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.world-map { position: fixed; inset: 0; z-index: 15; display: grid; place-items: center; padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); background: #020605d9; opacity: 0; visibility: hidden; transition: .2s; backdrop-filter: blur(10px); }
.where #streamStatus { grid-column: 1 / -1; color: #93aa9e; font-size: 7px; letter-spacing: .02em; white-space: normal; }
.world-map.open { opacity: 1; visibility: visible; }
.map-card { width: min(920px, 100%); max-height: 100%; padding: 13px; border: 1px solid var(--line); border-radius: 18px; background: #0c1714; box-shadow: 0 24px 80px #000b; }
.map-head, .map-card footer { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.map-head > div { display: grid; }
.map-head b { color: var(--gold); }
.map-head span, .map-card footer { color: var(--muted); font-size: 11px; }
#overview { display: block; width: 100%; height: auto; max-height: calc(100dvh - 150px); margin: 12px 0 8px; border: 1px solid #ffffff14; border-radius: 10px; background: #050a09; image-rendering: pixelated; touch-action: manipulation; }
#toast { position: fixed; left: 50%; bottom: max(185px, calc(env(safe-area-inset-bottom) + 185px)); z-index: 30; max-width: min(86vw, 440px); transform: translate(-50%, 10px); padding: 9px 13px; border: 1px solid var(--line); border-radius: 10px; background: #07100feb; color: var(--text); font-size: 12px; text-align: center; opacity: 0; pointer-events: none; transition: .25s; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
/* With the spells on screen the messages go over them, not under. */
html:not([data-npc-dialogue]) body:has(#abilityBar:not([hidden])) #toast { bottom: max(258px, calc(env(safe-area-inset-bottom) + 258px)); }
@media (min-width: 900px) {
  /* Wide screen: the controls sit in the corners, so the conversation goes down between them. */
  .npc-dialogue { bottom: max(78px, calc(env(safe-area-inset-bottom) + 78px)); }
}
@media (min-width: 760px) {
  .dpad { opacity: .72; }
  .top { max-width: 680px; left: 50%; right: auto; width: calc(100% - 32px); transform: translateX(-50%); }
}
@media (max-width: 420px) {
  .brand span { display: none; }
  .top { gap: 7px; }
  .top .glass { padding: 0 10px; }
  .floor-controls, .player-frame { top: 74px; }
  .quest-tracker, .target-frame { top: 124px; }
  .loot-feed { top: 172px; }
  /* Eight slots in one row: the six spells and the two support items, a little smaller. */
  .ability-row:has(.item-slots:not([hidden])) { gap: 5px; }
  .ability-row:has(.item-slots:not([hidden])) .ability-slots { gap: 4px; }
  .ability-row:has(.item-slots:not([hidden])) .item-slots { padding-left: 5px; }
  .ability-row:has(.item-slots:not([hidden])) .ability { width: 38px; height: 38px; }
  .ability-row:has(.item-slots:not([hidden])) .ability .icon { width: 17px; height: 17px; }
  .ability-row:has(.item-slots:not([hidden])) .ability.item .item-icon { --s: 30px; }
  /* Falar, Mochila, Diário and Mapa together must stay clear of the joystick. */
  .story-actions:has(.talk:not([hidden])):has(#backpackButton:not([hidden])) { gap: 6px; }
  .story-actions:has(.talk:not([hidden])):has(#backpackButton:not([hidden])) .action { width: 42px; font-size: 9px; }
}
/* The key of each spell is shown where there is a keyboard and a pointer to hover with. */
@media (hover: hover) and (pointer: fine) { .ability-key { display: block; } }
/* Wide screens are read from further away: the whole HUD, the conversation, the journal and the messages grow by
   one factor. Same window sizes as `hud-scale.js`, which gives the game the factor for names and health bars.
   Nothing here applies to a phone. */
@media (min-width: 1100px) and (min-height: 700px) {
  .hud, #toast, .quest-journal .map-card, .backpack .map-card, .controls-dialog, .server-environment-badge, .character-loadout-panel { zoom: 1.25; }
  :root { --hud-scale: 1.25; }
  .loot-feed { top: max(112px, calc(env(safe-area-inset-top) + 102px)); }
  /* The bar is in the middle and the corners are free: the frames go up beside it. */
  .player-frame, .floor-controls { top: max(10px, env(safe-area-inset-top)); }
  .quest-tracker, .target-frame { top: max(62px, calc(env(safe-area-inset-top) + 52px)); }
  .player-frame { max-width: 220px; }
  body:has(#playerManaRow:not([hidden])):has(#playerNote:not([hidden])) :is(.quest-tracker, .target-frame) { top: max(72px, calc(env(safe-area-inset-top) + 62px)); }
  /* The joystick and the actions are in the corners: the spells are the bar in the middle of the bottom. */
  .ability-bar { bottom: max(18px, env(safe-area-inset-bottom)); }
  html:not([data-npc-dialogue]) body:has(#abilityBar:not([hidden])) #toast { bottom: max(185px, calc(env(safe-area-inset-bottom) + 185px)); }
  .quest-tracker, body:has(#targetFrame:not([hidden])) .quest-tracker { max-width: 230px; }
  /* The menu is magnified too: its room is the height of the screen at this scale. */
  .quick-tools { max-height: calc(100dvh / 1.25 - 250px); }
  /* Here the frames are in the corners, so the test-environment seal goes right under the bar. */
  .server-environment-badge, body:has(#questTracker:not([hidden]), #targetFrame:not([hidden])) .server-environment-badge { top: max(72px, calc(env(safe-area-inset-top) + 62px)) !important; }
}
@media (min-width: 1700px) and (min-height: 900px) {
  .hud, #toast, .quest-journal .map-card, .backpack .map-card, .controls-dialog, .server-environment-badge, .character-loadout-panel { zoom: 1.5; }
  :root { --hud-scale: 1.5; }
  .quick-tools { max-height: calc(100dvh / 1.5 - 250px); }
}
@media (min-width: 2400px) and (min-height: 1300px) {
  .hud, #toast, .quest-journal .map-card, .backpack .map-card, .controls-dialog, .server-environment-badge, .character-loadout-panel { zoom: 2; }
  :root { --hud-scale: 2; }
  .quick-tools { max-height: calc(100dvh / 2 - 250px); }
}
@media (prefers-reduced-motion: reduce) {
  .sigil { animation: none; }
  .dpad .stick, .health i, #toast, .loading, .world-map { transition: none; }
  .player-frame[data-hurt] .health { animation: none; }
  .health.mana i { transition: none; }
}

/* ────────────────────────────────────────────────────────────────────────────────────────────────────────────
   The skin of the HUD (A0744), after the art direction board of the owner: dark plates in bronze frames, the
   character in a ring with the name over a red and a blue bar, a round minimap under the plaque of the place,
   the ten slots of the action bar in one frame, and octagonal buttons with drawn icons. Everything above still
   decides what exists and when; from here down it is only how it looks and where it sits. The pieces are in
   assets/hud/a0744 (generated; see assets/provenance.json): two image pixels per CSS pixel, so a phone shows
   them one to one.
   ──────────────────────────────────────────────────────────────────────────────────────────────────────────── */
:root {
  --hud-panel: url("assets/hud/a0744/panel.png");
  --hud-button: url("assets/hud/a0744/button.png");
  --hud-slot: url("assets/hud/a0744/slot.png");
  --hud-trough: url("assets/hud/a0744/trough.png");
  --hud-actionbar: url("assets/hud/a0744/actionbar.png");
  --hud-ring-map: url("assets/hud/a0744/ring-map.png");
  --hud-ring: url("assets/hud/a0744/ring-portrait.png");
  --hud-icons: url("assets/hud/a0744/icons.png");
  --hud-spells: url("assets/hud/a0744/spells.png");
  --plate: #151915;
  --mana: #2f6fd3;
  --mana-light: #5b9cf0;
}
/* A drawn icon of the sheet (six columns by two rows): `--ix` and `--iy` pick the cell, `--s` its size on screen. */
.story-actions .action::before, .quick > .glass:not(.attack)::before, .quick .attack::before,
.minimap-step::before, .floor-controls button::before {
  --s: 30px; content: ""; display: block; flex: none; width: var(--s); height: var(--s);
  background: var(--hud-icons) calc(var(--s) * var(--ix, 0) * -1) calc(var(--s) * var(--iy, 0) * -1) / calc(var(--s) * 6) calc(var(--s) * 2) no-repeat;
}
/* A small plate in a bronze frame with cut corners: the frames of the HUD and its buttons. */
.target-frame, .quest-tracker, .floor-controls, .top, .defeat-notice, .story-actions .action, .quick > .glass:not(.attack),
#toast, .loot-feed p, .ability-conditions span {
  border: 1px solid transparent; border-image: var(--hud-button) 30 fill / 15px; border-radius: 0; background: none;
  box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none;
}
#toast, .loot-feed p { border-image-width: 12px; }
.ability-conditions span { border-image-width: 9px; }
.loot-feed p { padding: 5px 11px; }
.ability-conditions span { padding: 3px 9px; }
.story-actions .action:active, .quick > .glass:not(.attack):active { background: none; filter: brightness(1.3); }
/* A card: the conversation, the map, the journal, the backpack, the menu and the pickers. */
.map-card, .npc-dialogue, .controls-dialog, .quick-tools, .character-loadout-panel {
  border: 1px solid transparent; border-image: var(--hud-panel) 48 fill / 24px; border-radius: 0; background: none;
  box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; filter: drop-shadow(0 10px 18px #0009);
}
.map-card { padding: 18px 20px; }
/* Inside the cards: the buttons are the same bronze plate, a chosen one is lit, and the boxes take the dark of
   the plates instead of the green glass they had. */
:is(.map-card, .npc-dialogue, .controls-dialog, .quick-tools) .glass { border: 1px solid transparent; border-image: var(--hud-button) 30 fill / 10px; border-radius: 0;
  background: none; box-shadow: none; }
:is(.map-card, .npc-dialogue, .controls-dialog, .quick-tools) .glass:active { background: none; filter: brightness(1.3); }
:is(.backpack-tabs .glass[aria-selected="true"], .loot-mode .glass[aria-pressed="true"], .npc-dialogue .primary, .backpack-detail .primary,
  .quick-tools .glass.on, .quick-tools .glass[aria-pressed="true"]) { border-color: transparent; color: var(--gold); filter: drop-shadow(0 0 2px #f1c56d); }
.backpack-slot { border: 1px solid transparent; border-image: var(--hud-slot) 20 fill / 10px; border-radius: 0; background: none; }
.backpack-slot.empty { border-style: solid; border-color: transparent; background: none; opacity: .5; }
.backpack-slot.selected { border-color: transparent; box-shadow: inset 0 0 0 2px var(--gold); }
:is(.backpack-detail, .quest-card, .loot-entry, .binding-list button) { border-color: #6b4a1e; border-radius: 4px; background: #10140f; }
.loot-entry[aria-pressed="false"] { background: #0a0d0a; }
.binding-list button.listening { border-color: var(--gold); }
/* The keys by group (ADR-0102): the list scrolls by itself, so the conflict line and the foot stay in sight. */
.binding-list { max-height: min(46vh, 380px); overflow-y: auto; gap: 6px; padding-right: 4px; scrollbar-width: thin; }
.binding-list button { min-height: 44px; text-align: left; }
.binding-list button.conflict { border-color: #c96a4a; }
.binding-list button kbd.unset { color: var(--muted); font-weight: 400; }
.binding-group { margin-top: 6px; color: var(--gold); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.binding-group:first-child { margin-top: 0; }
.binding-conflict { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 12px; border: 1px solid #c96a4a; border-radius: 4px; padding: 10px; background: #1a120d; font-size: 12px; line-height: 1.35; }
.binding-conflict[hidden] { display: none; }
.binding-conflict span { flex: 1 1 100%; }
@media (min-width: 700px) {
  .controls-dialog { width: min(640px, calc(100vw - 24px)); }
  .binding-list { grid-template-columns: 1fr 1fr; }
  .binding-group { grid-column: 1 / -1; }
}
.npc-portrait { border-color: #6b4a1e; border-radius: 4px; background: #0c120f; }
#overview { border-color: #6b4a1e; border-radius: 4px; }
.npc-dialogue { padding: 16px 18px; }
.controls-dialog form { padding: 20px; }
.quick-tools, .character-loadout-panel { padding: 16px 14px; }

/* The character: the portrait in a ring, the name on a dark strip, the health in red and the mana in blue, each
   with its number inside the bar. A title earned (or "Visitante") goes beside the name. The space under the ring
   is kept free: a level will go there when the game has one. */
.player-frame { top: max(8px, env(safe-area-inset-top)); left: max(8px, env(safe-area-inset-left)); min-height: 60px; max-width: calc(100vw - 156px); gap: 0; padding: 0;
  border: 0; border-radius: 0; background: none; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; }
.player-frame::before { content: ""; position: absolute; z-index: 2; left: 0; top: 50%; width: 60px; height: 60px; transform: translateY(-50%);
  background: var(--hud-ring) center / 100% 100% no-repeat; pointer-events: none; }
.frame-portrait { position: relative; z-index: 1; width: 50px; height: 50px; margin: 5px; border: 0; border-radius: 50%; background: #0c120f; }
.frame-body { margin-left: -9px; grid-template-columns: auto minmax(0, 1fr); column-gap: 0; row-gap: 1px; align-items: stretch; justify-items: start; }
.frame-body b { padding: 3px 11px 3px 15px; border: 0 solid transparent; border-image: var(--hud-button) 30 fill / 8px; color: #fff; font-size: 12px; font-weight: 700;
  letter-spacing: .01em; text-shadow: 0 1px 0 #000; line-height: 1.25; }
.frame-body > span { padding: 2px 8px 2px 5px; background: #0e1310e0; color: var(--gold); font-size: 10px; font-weight: 600; line-height: 1.25; text-shadow: 0 1px 0 #000;
  display: flex; align-items: center; align-self: center; }
.frame-body b { max-width: 150px; }
.frame-vitals { grid-column: 1 / -1; position: relative; gap: 0; }
.frame-mana { margin-top: 0; }
.player-frame .health, .player-frame .health.mana { box-sizing: border-box; flex: none; width: 148px; height: 18px; min-width: 0; padding: 3px 0; overflow: visible;
  border-style: solid; border-color: transparent; border-width: 0 13px; border-radius: 0; background: none;
  border-image: var(--hud-trough) 0 30 fill / 0 13px; }
.player-frame .health.mana { height: 16px; }
/* The health takes its colour from how much is left (`HEALTH_BANDS` in `hud-model.js`): green, yellow, red and,
   in the last tenth, dark red with a slow pulse. The length is always health over maximum. */
.player-frame .health i { background: linear-gradient(to bottom, #8be37f 0 34%, #4cc34a 34% 100%); }
.player-frame .health[data-band="mid"] i { background: linear-gradient(to bottom, #f6dc74 0 34%, #e3b62c 34% 100%); }
.player-frame .health[data-band="low"] i { background: linear-gradient(to bottom, #f0776a 0 34%, #d5392c 34% 100%); }
.player-frame .health[data-band="critical"] i { background: linear-gradient(to bottom, #b0302a 0 34%, #7d1410 34% 100%); animation: critical-health 1.6s ease-in-out infinite; }
@keyframes critical-health { 0%, 100% { filter: brightness(1); } 50% { filter: brightness(1.35); } }
.player-frame .health.mana i { background: linear-gradient(to bottom, var(--mana-light) 0 34%, var(--mana) 34% 100%); }
/* A0809: the level under the ring (the space kept free for it), on a bronze plate in gold, and a thin bar of
   experience under the mana, gold on the dark of the troughs. */
.frame-level { position: absolute; z-index: 3; left: 30px; top: calc(50% + 21px); transform: translateX(-50%); min-width: 22px; padding: 0 6px;
  border: 0 solid transparent; border-image: var(--hud-button) 30 fill / 6px; color: var(--gold); font-size: 10px; font-weight: 800; line-height: 15px;
  text-align: center; text-shadow: 0 1px 0 #000; font-variant-numeric: tabular-nums; pointer-events: none; }
.frame-level[hidden], .frame-xp[hidden] { display: none; }
.frame-xp { grid-column: 1 / -1; box-sizing: border-box; width: 148px; height: 5px; margin-top: 1px; padding: 0 13px; }
.frame-xp span { display: block; height: 100%; overflow: hidden; border-radius: 2px; background: #0c0f0bd9; box-shadow: inset 0 0 0 1px #3b2a12; }
.frame-xp i { display: block; width: var(--xp-fill, 0%); height: 100%; background: linear-gradient(to right, #b9832e, var(--gold)); }
.frame-vitals output { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-size: 10px; font-weight: 800; letter-spacing: .02em;
  text-shadow: 0 1px 0 #000, 0 0 3px #000, 0 0 3px #000; pointer-events: none; }
.frame-mana:has(.frame-concentration:not([hidden])) output { padding-right: 26px; }
.frame-concentration { position: absolute; right: 9px; top: 50%; transform: translateY(-50%); display: inline-grid; grid-auto-flow: column; gap: 2px;
  padding: 2px 3px; background: #101711; border: 1px solid #81592e; border-radius: 3px; }
.frame-concentration i { width: 4px; height: 6px; background: #503d2d; border-radius: 1px; }
.frame-concentration i.filled { background: #f0bf6e; }
.ability-cost.concentration { color: #f0bf6e; }
.ability[data-state="concentration"] > .spell-art, .ability[data-state="concentration"] .icon { opacity: .55; filter: saturate(.55); }
.player-frame[data-hurt] .health { animation: none; }
.player-frame[data-hurt] .frame-vitals:not(.frame-mana) { animation: hurt-a .42s ease-out; }
.player-frame[data-hurt="b"] .frame-vitals:not(.frame-mana) { animation-name: hurt-b; }

/* The place: a plaque over the minimap with the region, and under it the floor and the tile. The name of the
   game stays on screen as a mark, out of the way. */
.top { left: auto; right: max(8px, env(safe-area-inset-right)); top: max(8px, env(safe-area-inset-top)); width: 132px; height: auto; min-height: 34px; max-width: none;
  transform: none; display: grid; gap: 0; padding: 4px 9px 5px; align-items: center; }
.where { margin: 0; grid-template-columns: auto auto; justify-content: center; text-align: center; gap: 1px 6px; }
.where #regionLabel { color: #fff; font-size: 12px; text-shadow: 0 1px 0 #000; }
.where b, .where #regionLabel:not([hidden]) ~ #floorLabel { color: var(--muted); font-size: 9px; font-weight: 600; }
.where #regionLabel[hidden] ~ #floorLabel { color: #fff; font-size: 12px; font-weight: 700; }
.where span { font-size: 9px; }
/* The zone of the character's tile (A0806), its own line under the region: the blue shield with a gold edge in a
   protection zone, the same shield in red and crossed out in a hunting zone. The plaque grows by this line, so the
   minimap and what hangs under it go down by `--zone-row`; a world without zones shows no line and moves nothing. */
:root { --zone-row: 0px; }
:root[data-zone="safe"], :root[data-zone="hunt"] { --zone-row: 13px; }
.where .zone-chip { grid-column: 1 / -1; justify-self: center; display: inline-flex; align-items: center; gap: 4px; height: 12px; max-width: 100%; min-width: 0;
  font-size: 10px; font-weight: 700; line-height: 12px; letter-spacing: .02em; white-space: nowrap; text-shadow: 0 1px 0 #000; }
.where .zone-chip[hidden] { display: none; }
.where .zone-chip .zone-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; color: inherit; font-size: inherit; }
.where .zone-mark { position: relative; display: inline-grid; place-items: center; width: 11px; height: 11px; }
.where .zone-mark .icon { width: 11px; height: 11px; }
.where .zone-chip[data-zone="safe"] { color: #acd3ff; }
.where .zone-chip[data-zone="safe"] .icon { fill: var(--mana-light); filter: drop-shadow(0 0 1px #d9ad63) drop-shadow(0 1px 0 #000); }
.where .zone-chip[data-zone="hunt"] { color: #f0a594; }
.where .zone-chip[data-zone="hunt"] .icon { fill: #c4553f; filter: drop-shadow(0 1px 0 #000); }
.where .zone-chip[data-zone="hunt"] .zone-mark::after { content: ""; position: absolute; left: 50%; top: -1px; width: 2px; height: 13px; margin-left: -1px;
  border-radius: 1px; background: #f6ddd5; box-shadow: 0 0 0 1px #2a0d08b3; transform: rotate(-45deg); }
.brand { position: fixed; left: 50%; bottom: max(3px, env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; gap: 5px; align-items: baseline;
  opacity: .55; pointer-events: none; white-space: nowrap; text-shadow: 0 1px 2px #000; }
.brand b { font-size: 9px; }
.brand span:not([hidden]) { display: inline; margin: 0; font-size: 7px; }

/* The minimap: a round picture of the ground around the character in a bronze ring. A touch opens the big map;
   plus and minus change how much ground it shows. */
.minimap { top: calc(max(46px, calc(env(safe-area-inset-top) + 46px)) + var(--zone-row)); right: max(26px, calc(env(safe-area-inset-right) + 26px)); width: 96px; height: 98px; }
.minimap[hidden] { display: none; }
.minimap::after { content: ""; position: absolute; inset: 0; background: var(--hud-ring-map) center / 100% 100% no-repeat; pointer-events: none; }
.minimap-view { position: absolute; left: 8%; right: 8%; top: 9%; bottom: 7.5%; padding: 0; border: 0; border-radius: 50%; overflow: hidden; background: #07100e; cursor: pointer; }
.minimap-view canvas { display: block; width: 100%; height: 100%; image-rendering: pixelated; }
.minimap-step { position: absolute; z-index: 1; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 50%; display: grid; place-items: center;
  background: var(--hud-ring) center / 100% 100% no-repeat, radial-gradient(circle, var(--plate) 0 62%, transparent 64%); }
.minimap-step::before { --s: 14px; }
/* The touch reaches a little further than the button is drawn. */
.minimap-step::after { content: ""; position: absolute; inset: -7px; border-radius: 50%; }
.minimap-step.in { --ix: 2; --iy: 1; right: -16px; bottom: 26px; }
.minimap-step.out { --ix: 3; --iy: 1; right: -8px; bottom: -6px; }
.minimap-step:disabled { opacity: .45; cursor: default; }
.minimap-step:active:not(:disabled) { filter: brightness(1.3); }

/* The floors, under the minimap. The arrows are drawn ones; the characters stay in the page for a reader. */
.floor-controls { top: calc(max(150px, calc(env(safe-area-inset-top) + 150px)) + var(--zone-row)); right: max(17px, calc(env(safe-area-inset-right) + 17px)); grid-template-columns: 36px 42px 36px; overflow: visible; }
.floor-controls button { min-height: 34px; background: none; font-size: 0; display: grid; place-items: center; }
.floor-controls button::before { --s: 16px; }
.floor-controls #floorUp { --ix: 4; --iy: 1; }
.floor-controls #floorDown { --ix: 5; --iy: 1; }
.floor-controls button:disabled { opacity: .35; }
.floor-controls div { border-inline: 0; }
.floor-controls b { margin-top: 2px; color: #fff; font-size: 13px; }

/* The quest line and the target, under the character. */
.quest-tracker { top: 74px; left: max(8px, env(safe-area-inset-left)); max-width: calc(100vw - 160px); overflow: visible; }
body:has(#targetFrame:not([hidden])) .quest-tracker { max-width: calc(100vw - 160px); }
.quest-tracker button { min-height: 40px; }
.quest-tracker button:active { background: none; filter: brightness(1.3); }
#questTrackerFold { border-left: 1px solid #6b4a1e; }
.target-frame { top: 120px; left: max(8px, env(safe-area-inset-left)); right: auto; width: 150px; min-height: 42px; padding: 5px 11px; }
body:not(:has(#questTracker:not([hidden]))) .target-frame { top: 74px; }
.target-frame b { color: #ffd9cf; }
.target-frame.locked { filter: drop-shadow(0 0 3px #f1c56d) drop-shadow(0 0 1px #f1c56d); }
.target-frame.far { opacity: .82; }
body:has(#playerManaRow:not([hidden])):has(#playerNote:not([hidden])) :is(.quest-tracker, .target-frame) { top: 74px; }
body:has(#playerManaRow:not([hidden])):has(#playerNote:not([hidden])):has(#questTracker:not([hidden])) .target-frame { top: 120px; }
.loot-feed { top: 170px; left: max(8px, env(safe-area-inset-left)); max-width: min(calc(100vw - 150px), 300px); }
/* The test-environment seal (styled inline by `server-environment.js`) goes under the floors, on the right. */
.server-environment-badge, body:has(#questTracker:not([hidden]), #targetFrame:not([hidden])) .server-environment-badge,
body:has(#playerManaRow:not([hidden])):has(#playerNote:not([hidden])):has(#questTracker:not([hidden]), #targetFrame:not([hidden])) .server-environment-badge {
  top: calc(max(194px, calc(env(safe-area-inset-top) + 194px)) + var(--zone-row)) !important; left: auto !important; right: max(8px, env(safe-area-inset-right)) !important; transform: none !important; }

/* The action bar holds the spell and support slots. Empty slots fill out the ten keyboard places. */
.ability-bar { bottom: max(176px, calc(env(safe-area-inset-bottom) + 176px)); }
.ability-row { display: grid; grid-template-columns: repeat(5, 40px); gap: 4px; padding: 9px 11px; pointer-events: auto;
  border: 1px solid transparent; border-image: var(--hud-button) 30 fill / 15px; }
.ability-row > .ability-slots:not([hidden]) { display: contents; }
.item-slots { padding-left: 0; border-left: 0; }
.ability, .ability-row:has(.item-slots:not([hidden])) .ability { width: 40px; height: 40px; border: 1px solid transparent; border-image: var(--hud-slot) 20 fill / 10px; border-radius: 0;
  background: none; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; }
.ability:active { background: none; filter: brightness(1.3); }
.ability.empty { position: relative; display: block; }
.ability .icon, .ability-row:has(.item-slots:not([hidden])) .ability .icon { width: 19px; height: 19px; }
.ability.item .item-icon, .ability-row:has(.item-slots:not([hidden])) .ability.item .item-icon { --s: 30px; }
.ability::after { left: 3px; right: 3px; bottom: 3px; max-height: calc(100% - 6px); }
/* The six spells of the island have drawn icons (one row of the sheet, in the order of the catalog); a spell the
   sheet does not know keeps the icon of the set. */
.ability:is([data-ability="ability_brine_dart_0001"], [data-ability="ability_beacon_flare_0001"], [data-ability="ability_mist_breath_0001"],
  [data-ability="ability_mycelium_weave_0001"], [data-ability="ability_salt_crust_0001"], [data-ability="ability_low_tide_0001"])::before {
  content: ""; position: absolute; inset: 4px; background: var(--hud-spells) calc(var(--spell, 0) * 20%) 0 / 600% 100% no-repeat; }
.ability:is([data-ability="ability_brine_dart_0001"], [data-ability="ability_beacon_flare_0001"], [data-ability="ability_mist_breath_0001"],
  [data-ability="ability_mycelium_weave_0001"], [data-ability="ability_salt_crust_0001"], [data-ability="ability_low_tide_0001"]) .icon { display: none; }
.ability[data-ability="ability_beacon_flare_0001"] { --spell: 1; }
.ability[data-ability="ability_mist_breath_0001"] { --spell: 2; }
.ability[data-ability="ability_mycelium_weave_0001"] { --spell: 3; }
.ability[data-ability="ability_salt_crust_0001"] { --spell: 4; }
.ability[data-ability="ability_low_tide_0001"] { --spell: 5; }
.ability[data-state="cooldown"]::before, .ability[data-state="target"]::before { opacity: .55; }
.ability[data-state="mana"]::before { opacity: .4; filter: grayscale(.6); }
.ability-key { left: 5px; top: auto; bottom: 3px; color: #e9dcc0; text-shadow: 0 1px 0 #000, 0 0 2px #000; }
.ability-cost { right: 5px; bottom: 3px; color: var(--mana-light); text-shadow: 0 1px 0 #000, 0 0 2px #000; }
.ability-count { right: 5px; bottom: 3px; }
.ability[data-state="mana"] { box-shadow: inset 0 0 0 2px #bb5148cc; }
.ability[data-state="target"], .ability[data-state="none"] { outline: 1px dashed #c58a3a99; outline-offset: -5px; }
.ability.sent { box-shadow: inset 0 0 0 2px var(--gold); }
html:not([data-npc-dialogue]) body:has(#abilityBar:not([hidden])) #toast { bottom: max(316px, calc(env(safe-area-inset-bottom) + 316px)); }

/* The buttons of the right thumb: octagonal plates with drawn icons. ATK keeps its round shape and its red, in
   a bronze ring, with the crossed swords until a weapon is in hand. */
.story-actions { right: max(12px, env(safe-area-inset-right)); gap: 6px; }
.story-actions .action { width: 52px; height: 52px; gap: 0; font-size: 0; }
.story-actions .action .icon, .quick > .glass:not(.attack) .icon { display: none; }
.story-actions .action::before { --s: 32px; }
#backpackButton { --ix: 0; --iy: 0; }
#journalButton { --ix: 2; --iy: 0; }
#mapButton { --ix: 3; --iy: 0; }
/* Falar is there only beside someone to talk to: the same plate, lit in gold, and the one that keeps its word
   (the hints of the game tell the player to touch "Falar"). */
.story-actions .talk { --ix: 5; --iy: 0; align-content: center; color: var(--gold); font-size: 9px; font-weight: 700; line-height: 1;
  filter: drop-shadow(0 0 3px #f1c56d) drop-shadow(0 0 1px #f1c56d); }
.story-actions .talk::before { --s: 24px; margin-bottom: 1px; }
.story-actions:has(.talk:not([hidden])):has(#backpackButton:not([hidden])) { gap: 4px; }
.story-actions:has(.talk:not([hidden])):has(#backpackButton:not([hidden])) .action { width: 46px; }
.story-actions:has(.talk:not([hidden])):has(#backpackButton:not([hidden])) .action:not(.talk) { font-size: 0; }
.quick { right: max(12px, env(safe-area-inset-right)); gap: 6px; }
.quick > .glass:not(.attack) { width: 52px; height: 52px; min-width: 0; padding: 0; display: inline-grid; place-items: center; }
/* A control the game has hidden stays hidden: the rule above would show it again. */
.quick > .glass[hidden]:not(.attack) { display: none; }
.quick .tools-toggle { --ix: 4; --iy: 0; }
.quick > .glass.follow::before { display: none; }
.quick > .glass.follow { align-content: center; gap: 2px; }
.quick > .glass.follow .icon { display: block; width: 21px; height: 21px; }
.quick .follow-label { font-size: 9px; font-weight: 700; line-height: 1; }
.quick .follow[aria-pressed="true"] { border-color: transparent; }
.quick .follow[aria-pressed="false"]::after { left: 12px; right: 12px; top: calc(50% - 5px); border-top-color: #e9dcc0; filter: drop-shadow(0 1px 0 #000); }
.quick.tools-open .tools-toggle { border-color: transparent; filter: drop-shadow(0 0 3px #f1c56d); }
/* A0824: the red fills the whole inside of the ring, centred (the ring's inner edge is at 80% of the radius); it used to end at 64%,
   off-centre, and left an empty band under and right of the swords. */
.quick .attack { border: 0; background: var(--hud-ring) center / 100% 100% no-repeat, radial-gradient(circle closest-side at 50% 50%, #b8443b 0%, #a33a32 55%, #842d28 80%, transparent 86%); }
/* A0824, the owner: "o botao pra ataque vai ser esse aqui" — always the crossed swords of the sheet, big, on the red disc in the
   bronze ring, armed or not: the weapon in hand no longer replaces the drawing, and the word ATK stays for screen readers only. */
.quick .attack::before { --s: 42px; --ix: 1; --iy: 0; margin-top: 0; }
.quick .attack .attack-weapon { display: none; }
.quick .attack .attack-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.quick .attack-label { text-shadow: 0 1px 0 #000, 0 0 3px #000; }
.quick .attack.locked { border: 0; box-shadow: none; filter: drop-shadow(0 0 4px #f1c56d) drop-shadow(0 0 1px #f1c56d); }
/* The turn of the base attack (ADR-0096): what is left of it before the next blow shades the button, clockwise. */
.quick .attack.turning::after { content: ""; position: absolute; inset: 8%; border-radius: 50%; background: conic-gradient(#07100ea8 var(--turn, 0%), transparent 0); pointer-events: none; }
.dpad { border: 0; box-shadow: none; background: var(--hud-ring) center / 100% 100% no-repeat, radial-gradient(circle, rgba(10, 16, 13, .5) 0 38%, #131813d9 39% 64%, transparent 65%); backdrop-filter: none; -webkit-backdrop-filter: none; }
.dpad::before { inset: 18px; border-color: #c58a3a33; }
.dpad .stick { border-color: #c58a3a; background: radial-gradient(circle at 38% 32%, #6b5330, #3a2a17 62%, #22180d); }
.dpad .stick::after { background: #f1c56d33; }
.defeat-notice { padding: 12px 20px; }
#toast { padding: 9px 15px; }

@media (max-width: 420px) {
  .player-frame { top: max(8px, env(safe-area-inset-top)); }
  .floor-controls { top: calc(max(150px, calc(env(safe-area-inset-top) + 150px)) + var(--zone-row)); }
  .quest-tracker { top: 74px; }
  .target-frame { top: 120px; }
  body:not(:has(#questTracker:not([hidden]))) .target-frame { top: 74px; }
  .loot-feed { top: 170px; }
  .player-frame .health, .player-frame .health.mana { width: 132px; }
}
/* Every active or empty slot contributes one column to the frame. The keyboard slots are only its minimum. */
@media (min-width: 700px) and (min-height: 521px) {
  .ability-row { grid-template-columns: none; grid-template-rows: 40px; grid-auto-flow: column; grid-auto-columns: 40px;
    max-width: calc((100vw - max(24px, env(safe-area-inset-left) + env(safe-area-inset-right))) / var(--hud-scale));
    overflow: auto hidden; padding: 3px 2px; border-style: solid; border-color: transparent; border-width: 8px 28px;
    border-image: var(--hud-actionbar) 20 56 fill / 8px 28px; }
  .top { left: auto; right: max(8px, env(safe-area-inset-right)); width: 132px; transform: none; }
  .dpad { opacity: .8; }
  html:not([data-npc-dialogue]) body:has(#abilityBar:not([hidden])) #toast { bottom: max(270px, calc(env(safe-area-inset-bottom) + 270px)); }
}
/* A phone held sideways: no room over the controls, so the slots go between them, at the bottom, in two rows. */
@media (min-width: 560px) and (max-height: 520px) {
  .ability-bar { bottom: max(8px, env(safe-area-inset-bottom)); }
  .ability-row { grid-template-columns: repeat(5, 38px); padding: 8px 10px; border-width: 1px; border-image: var(--hud-button) 30 fill / 15px; }
  .ability, .ability-row:has(.item-slots:not([hidden])) .ability { width: 38px; height: 38px; }
  .dpad { width: 132px; height: 132px; bottom: max(8px, env(safe-area-inset-bottom)); }
  .quick { bottom: max(8px, env(safe-area-inset-bottom)); }
  .story-actions { bottom: max(72px, calc(env(safe-area-inset-bottom) + 72px)); }
  .quick:not(:has(.attack:not([hidden]))) ~ .story-actions { bottom: max(66px, calc(env(safe-area-inset-bottom) + 66px)); }
  .brand { bottom: auto; top: max(2px, env(safe-area-inset-top)); }
  html:not([data-npc-dialogue]) body:has(#abilityBar:not([hidden])) #toast { bottom: max(118px, calc(env(safe-area-inset-bottom) + 118px)); }
  .npc-dialogue { bottom: max(8px, env(safe-area-inset-bottom)); }
  .quick-tools { bottom: max(132px, calc(env(safe-area-inset-bottom) + 132px)); max-height: calc(100dvh - 150px); }
}
/* A wide screen: the board itself. The character in the corner of the top left, the place and the minimap in
   the top right, the action bar in the middle of the bottom. */
@media (min-width: 1100px) and (min-height: 700px) {
  .player-frame { top: max(10px, env(safe-area-inset-top)); left: max(10px, env(safe-area-inset-left)); max-width: 300px; }
  .player-frame::before { width: 68px; height: 68px; }
  .frame-portrait { width: 56px; height: 56px; margin: 6px; }
  .frame-body b { font-size: 13px; }
  .player-frame .health, .player-frame .health.mana { width: 176px; }
  .top { top: max(10px, env(safe-area-inset-top)); right: max(10px, env(safe-area-inset-right)); width: 190px; }
  .minimap { top: calc(max(52px, calc(env(safe-area-inset-top) + 52px)) + var(--zone-row)); right: max(28px, calc(env(safe-area-inset-right) + 28px)); width: 154px; height: 158px; }
  .minimap-step { width: 30px; height: 30px; }
  .minimap-step.in { right: -15px; bottom: 44px; }
  .minimap-step.out { right: -4px; bottom: 6px; }
  .floor-controls { top: calc(max(216px, calc(env(safe-area-inset-top) + 216px)) + var(--zone-row)); right: max(48px, calc(env(safe-area-inset-right) + 48px)); }
  .quest-tracker, body:has(#targetFrame:not([hidden])) .quest-tracker { top: max(84px, calc(env(safe-area-inset-top) + 84px)); left: max(10px, env(safe-area-inset-left)); max-width: 260px; }
  .target-frame { top: max(132px, calc(env(safe-area-inset-top) + 132px)); left: max(10px, env(safe-area-inset-left)); }
  body:not(:has(#questTracker:not([hidden]))) .target-frame { top: max(84px, calc(env(safe-area-inset-top) + 84px)); }
  body:has(#playerManaRow:not([hidden])):has(#playerNote:not([hidden])) :is(.quest-tracker, .target-frame) { top: max(84px, calc(env(safe-area-inset-top) + 84px)); }
  body:has(#playerManaRow:not([hidden])):has(#playerNote:not([hidden])):has(#questTracker:not([hidden])) .target-frame { top: max(132px, calc(env(safe-area-inset-top) + 132px)); }
  .loot-feed { top: max(184px, calc(env(safe-area-inset-top) + 184px)); left: max(10px, env(safe-area-inset-left)); }
  .brand { bottom: auto; top: max(4px, env(safe-area-inset-top)); }
  .ability-bar { bottom: max(14px, env(safe-area-inset-bottom)); }
  html:not([data-npc-dialogue]) body:has(#abilityBar:not([hidden])) #toast { bottom: max(108px, calc(env(safe-area-inset-bottom) + 108px)); }
  .server-environment-badge, body:has(#questTracker:not([hidden]), #targetFrame:not([hidden])) .server-environment-badge,
  body:has(#playerManaRow:not([hidden])):has(#playerNote:not([hidden])):has(#questTracker:not([hidden]), #targetFrame:not([hidden])) .server-environment-badge {
    top: max(22px, calc(env(safe-area-inset-top) + 20px)) !important; left: 50% !important; right: auto !important; transform: translateX(-50%) !important; }
}
@media (prefers-reduced-motion: reduce) {
  .player-frame .health[data-band="critical"] i, .player-frame[data-hurt] .frame-vitals { animation: none; }
}

/* ────────────────────────────────────────────────────────────────────────────────────────────────────────────
   The HUD on a phone (A0744, third pass), after the owner's direction of 2026-11-21: health, mana and the place
   of a level at the top left; the minimap at the top right; the joystick at the bottom left; ATK and the slots at
   the bottom right, within reach of one thumb. Since A0764 (ADR-0101) the buttons of the fight are one group
   (ATK, the spells in an arc over it, the heal and a fourth spell at its sides, the potions under it) that is
   always there, and the menus are a strip between the two thumbs.
   The sizes come from `hud-layout.js`: the defaults are written here as custom properties, one set for each kind
   of phone window, and the game writes the same properties on the page from the data (so a setting changes data,
   not these rules). Three rules hold on every phone size and are tested there: nothing fixed sits over the
   character and the creatures around it; every touch is at least 44 px wide and tall, whatever size its drawing
   has; and everything keeps inside the safe area of the device.
   ──────────────────────────────────────────────────────────────────────────────────────────────────────────── */
/* The switch of the group beside ATK (A0744) has nothing to switch since A0764: every button of the fight is
   always on the screen of a phone. It is drawn nowhere. */
.quick > .glass.menu-toggle:not(.attack) { display: none; }
@media (max-width: 699px), (min-width: 560px) and (max-height: 520px) {
  :root { --hud-touch: 44px; --hud-gap: 4px; --hud-row-gap: 6px; --hud-edge: 10px; --hud-foot: 12px; --hud-attack: 60px; --hud-joystick: 112px; --hud-opacity: 1;
    /* The edges of the layout: the margin of the design or the safe area of the device, whichever is larger. */
    --hud-t: max(8px, env(safe-area-inset-top, 0px)); --hud-l: max(8px, env(safe-area-inset-left, 0px)); --hud-r: max(8px, env(safe-area-inset-right, 0px));
    --hud-cl: max(var(--hud-edge), env(safe-area-inset-left, 0px)); --hud-cr: max(var(--hud-edge), env(safe-area-inset-right, 0px));
    --hud-b: max(var(--hud-foot), env(safe-area-inset-bottom, 0px));
    --hud-column: calc(100vw - var(--hud-l) - var(--hud-r) - 136px); }
  /* Left column: the character, the quest line, the target, the effects, what dropped, the message. */
  .player-frame { top: var(--hud-t); left: var(--hud-l); min-height: 54px; max-width: 190px; }
  .player-frame::before { width: 52px; height: 52px; }
  .frame-portrait { width: 44px; height: 44px; margin: 4px; }
  .frame-body { margin-left: -8px; }
  .frame-body b { max-width: 112px; padding: 2px 9px 2px 13px; font-size: 11px; }
  .frame-body > span { font-size: 9px; }
  .player-frame .health, .player-frame .health.mana { width: 124px; height: 16px; border-width: 0 11px; border-image-width: 0 11px; }
  .player-frame .health.mana { height: 14px; }
  .frame-vitals output { font-size: 9px; }
  .quest-tracker { top: calc(var(--hud-t) + 58px) !important; left: var(--hud-l); border-image-width: 9px; }
  .quest-tracker, body:has(#targetFrame:not([hidden])) .quest-tracker { max-width: var(--hud-column); }
  .quest-tracker button { position: relative; min-width: 44px; min-height: 26px; padding: 0 7px; font-size: 11px; }
  .quest-tracker .icon { width: 13px; height: 13px; }
  #questTrackerFold { width: 44px; }
  /* The target on one line: its name, the bar, the number. */
  .target-frame { top: calc(var(--hud-t) + 90px) !important; left: var(--hud-l); width: auto; max-width: var(--hud-column); min-height: 26px; padding: 2px 9px;
    grid-template-columns: minmax(0, auto) 40px auto; gap: 0 6px; border-image-width: 9px; }
  body:not(:has(#questTracker:not([hidden]))) .target-frame { top: calc(var(--hud-t) + 58px) !important; }
  .target-frame b { grid-column: auto; font-size: 11px; }
  .target-frame .health { height: 6px; }
  .target-frame output { font-size: 9px; }
  .target-condition { top: 2px; right: 3px; }
  /* Drawn small, touched as tall as a finger: the quest line reaches up, the target down, and they never meet. */
  /* (The buttons of the quest line are one pixel inside its plate.) */
  .quest-tracker button::after { content: ""; position: absolute; left: 0; right: 0; top: -13px; bottom: -5px; }
  .target-frame::after { content: ""; position: absolute; left: 0; right: 0; top: 0; bottom: -18px; }
  .ability-conditions { position: fixed; left: var(--hud-l); top: calc(var(--hud-t) + 120px); max-width: var(--hud-column); gap: 3px; }
  .ability-conditions span { padding: 1px 6px; border-image-width: 7px; font-size: 9px; line-height: 1.2; }
  .ability-conditions .icon { width: 9px; height: 9px; }
  .ability-conditions small { font-size: 8px; }
  /* What dropped and what the game says: one discreet line each, never a plate. */
  .loot-feed { top: calc(var(--hud-t) + 142px); left: var(--hud-l); max-width: var(--hud-column); gap: 2px; }
  .loot-feed p { max-width: 100%; padding: 1px 7px; border: 1px solid #6b4a1e; border-image: none; border-radius: 3px; background: #0b0f0cd9; font-size: 10px; line-height: 1.3;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .loot-feed p:nth-last-child(n+3) { display: none; }
  #toast { left: var(--hud-l); right: auto; top: calc(var(--hud-t) + 182px); bottom: auto !important; max-width: var(--hud-column); transform: none; padding: 2px 8px;
    border: 1px solid #6b4a1e; border-image: none; border-radius: 3px; background: #0b0f0ce6; font-size: 10px; line-height: 14px; text-align: left;
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
  #toast.show { transform: none; }
  /* Right column: the place, the minimap with a button at each end of its rim, the floors, the seal of the test
     environment. */
  .top { top: var(--hud-t); right: var(--hud-r); width: 124px; min-height: 34px; padding: 3px 8px 4px; border-image-width: 12px; }
  .where #regionLabel, .where #regionLabel[hidden] ~ #floorLabel { font-size: 11px; }
  .minimap { top: calc(var(--hud-t) + 36px + var(--zone-row)); right: calc(var(--hud-r) + 20px); width: 84px; height: 86px; }
  .minimap-step { width: 26px; height: 26px; right: -20px; }
  .minimap-step::before { --s: 13px; }
  .minimap-step::after { inset: -9px 0 -9px -18px; border-radius: 0; }
  .minimap-step.in { right: -20px; top: 0; bottom: auto; }
  .minimap-step.out { right: -20px; bottom: 0; }
  .floor-controls { top: calc(var(--hud-t) + 142px + var(--zone-row)); right: calc(var(--hud-r) + 4px); grid-template-columns: 32px 40px 32px; border-image-width: 10px; }
  .floor-controls button { position: relative; min-height: 28px; }
  .floor-controls button::after { content: ""; position: absolute; top: -9px; bottom: -7px; }
  .floor-controls #floorUp::after { left: -4px; right: -8px; }
  .floor-controls #floorDown::after { left: -8px; right: -4px; }
  .floor-controls small { font-size: 6px; }
  .floor-controls b { margin-top: 1px; font-size: 12px; }
  .server-environment-badge, body:has(#questTracker:not([hidden]), #targetFrame:not([hidden])) .server-environment-badge,
  body:has(#playerManaRow:not([hidden])):has(#playerNote:not([hidden])):has(#questTracker:not([hidden]), #targetFrame:not([hidden])) .server-environment-badge {
    top: calc(var(--hud-t) + 176px + var(--zone-row)) !important; right: var(--hud-r) !important; padding: 2px 7px !important; }
  /* The thumbs. Left: the joystick. Right: the group of the fight. Between them, the menus. Each of these controls
     is put in its place by the game, from the data of `hud-layout.js` and from what the player set in "Editar HUD"
     (`combat-hud.js`): `data-hud-place` says which edge it counts from, and the custom properties how far from it
     (`--hx`, `--hb`), how big (`--hs`) and how opaque (`--ho`) it is. */
  .dpad, .quick, .story-actions, .ability-row { opacity: var(--hud-opacity); }
  .dpad { left: var(--hud-cl); bottom: var(--hud-b); width: var(--hud-joystick); height: var(--hud-joystick); }
  .dpad::before { inset: 14px; }
  .dpad button { width: 38px; height: 38px; margin: -19px 0 0 -19px; }
  .dpad .stick { width: 50px; height: 50px; margin: -25px 0 0 -25px; transform: translate(calc(var(--sx, 0px) * .7), calc(var(--sy, 0px) * .7)); }
  .dpad .stick::after { inset: 18px; }
  .quick { right: var(--hud-cr); bottom: var(--hud-b); gap: var(--hud-row-gap); align-items: flex-end; }
  .quick > .glass:not(.attack) { width: var(--hs, var(--hud-touch)); height: var(--hs, var(--hud-touch)); border-image-width: 12px; }
  .quick > .glass:not(.attack)::before, .story-actions .action::before { --s: calc(var(--hs, var(--hud-touch)) * .6); }
  .quick .attack::before { --s: calc(var(--hs, var(--hud-attack)) * .62); }
  .quick .attack { width: var(--hs, var(--hud-attack)); height: var(--hs, var(--hud-attack)); }
  .attack-weapon { width: calc(var(--hs, var(--hud-attack)) * .46); height: calc(var(--hs, var(--hud-attack)) * .46); }
  .quick-tools { right: var(--hud-cr); bottom: calc(var(--hud-b) + 166px); max-height: calc(100dvh - var(--hud-b) - 190px); }
  /* The slots: drawn and touched at the size of a touch. The bar itself is no box here: each slot that has a
     place in the group is put there, and a spell or an item no button of the group uses is not drawn. */
  .ability-bar { left: auto; right: var(--hud-cr); bottom: var(--hud-b); width: 0; gap: 0; justify-items: stretch; }
  .ability-row, .ability-row:has(.item-slots:not([hidden])) { display: block; padding: 0; border: 0; border-image: none; }
  .ability, .ability-row:has(.item-slots:not([hidden])) .ability { width: var(--hs, var(--hud-touch)); height: var(--hs, var(--hud-touch)); border-image-width: 10px; }
  .ability .icon, .ability-row:has(.item-slots:not([hidden])) .ability .icon { width: 19px; height: 19px; }
  .ability.item .item-icon, .ability-row:has(.item-slots:not([hidden])) .ability.item .item-icon { --s: calc(var(--hs, var(--hud-touch)) * .72); }
  .ability-key { left: 5px; bottom: 3px; font-size: 9px; }
  .ability-cost, .ability-count { right: 5px; bottom: 3px; font-size: 9px; }
  /* The two empty slots of the wide bar do nothing, so a thumb does not get them. */
  .ability-row > #emptySlots { display: none; }
  .ability-row .ability:not([data-hud-role]) { display: none; }
  /* The menus: Mochila, Diário, Mapa, the game menu, and Falar (only beside someone). */
  .story-actions { right: var(--hud-cr); bottom: var(--hud-b); gap: 0; }
  .story-actions .action, .story-actions:has(.talk:not([hidden])):has(#backpackButton:not([hidden])) .action { width: var(--hs, var(--hud-touch)); height: var(--hs, var(--hud-touch)); border-image-width: 12px; }
  .story-actions .talk { font-size: 8px; }
  .story-actions .talk::before { --s: 21px; }
  html :is(.quick, .ability-row, .story-actions) [data-hud-place] { position: fixed; bottom: calc(var(--hud-b) + var(--hb, 0px)); margin: 0; opacity: var(--ho, 1); }
  html :is(.quick, .ability-row, .story-actions) [data-hud-place="right"] { right: calc(var(--hud-cr) + var(--hx, 0px)); left: auto; }
  html :is(.quick, .ability-row, .story-actions) [data-hud-place="left"] { left: calc(var(--hud-cl) + var(--hx, 0px)); right: auto; }
  .npc-dialogue { bottom: calc(var(--hud-b) + var(--hud-joystick) + 8px); }
}
/* A phone held sideways: the lines of the left stop before the middle and the messages go to the top; the menus
   are one strip at the foot of the screen, between the joystick and the group of the fight. */
@media (min-width: 560px) and (max-height: 520px) {
  :root { --hud-foot: 8px; --hud-column: calc(50vw - 104px - var(--hud-l)); }
  #toast, html[data-npc-dialogue] #toast { left: calc(var(--hud-l) + 192px); right: calc(var(--hud-r) + 192px); top: calc(env(safe-area-inset-top, 0px) + 14px); width: fit-content;
    max-width: calc(100vw - var(--hud-l) - var(--hud-r) - 384px); margin: 0 auto; text-align: center; }
  .server-environment-badge, body:has(#questTracker:not([hidden]), #targetFrame:not([hidden])) .server-environment-badge,
  body:has(#playerManaRow:not([hidden])):has(#playerNote:not([hidden])):has(#questTracker:not([hidden]), #targetFrame:not([hidden])) .server-environment-badge {
    top: auto !important; right: auto !important; left: var(--hud-cl) !important; bottom: calc(var(--hud-b) + var(--hud-joystick) + var(--hud-row-gap)); }
  .quick-tools { right: calc(var(--hud-cr) + 162px); bottom: calc(var(--hud-b) + 50px); max-height: calc(100dvh - var(--hud-b) - 66px); }
  .npc-dialogue { bottom: var(--hud-b); }
}
/* Separate the centered action bar from the two corner rows where the current hotbar and combat group can meet. */
@media (min-width: 1100px) and (max-width: 1619px) and (min-height: 700px),
       (min-width: 1700px) and (max-width: 1929px) and (min-height: 900px),
       (min-width: 2400px) and (max-width: 2579px) and (min-height: 1300px) {
  .ability-bar { bottom: calc(158px + env(safe-area-inset-bottom)); }
  html:not([data-npc-dialogue]) body:has(#abilityBar:not([hidden])) #toast { bottom: calc(218px + env(safe-area-inset-bottom)); }
}
/* At widths with room for both groups, lay them out together. Visible combat buttons set the menu offset. */
.hud-commands { display: contents; }
@media (min-width: 2264px) and (max-width: 2399px) and (min-height: 521px), (min-width: 3020px) and (min-height: 521px) {
  .hud-commands { position: fixed; display: flex; flex-direction: row-reverse; align-items: center; gap: 4px; z-index: 5;
    right: max(8px, env(safe-area-inset-right)); bottom: max(18px, env(safe-area-inset-bottom)); zoom: var(--hud-scale); }
  .hud-commands:has(.quick.tools-open) { z-index: 9; }
  .hud-commands :is(.quick, .story-actions) { position: relative; inset: auto; gap: 4px; align-items: center; zoom: 1; }
  .hud-commands .quick:not(:has(.attack:not([hidden]))) ~ .story-actions { inset: auto; }
  .hud-commands .quick .mount { right: max(8px, env(safe-area-inset-right)); bottom: calc(max(18px, env(safe-area-inset-bottom)) + 74px); }
  .hud-commands .story-actions .talk { position: absolute; right: 0; bottom: 58px; }
}

/* ────────────────────────────────────────────────────────────────────────────────────────────────────────────
   Cards that scroll (A0748). A magnified card (`zoom`, the same factor as `--hud-scale`) measures its own lengths
   in magnified pixels: a height of "the screen less a margin" has to be divided by the factor, or the card is
   taller than the screen and the end of its list cannot be reached. Every card keeps inside the screen and the
   safe area, whatever its scale, and its list is what scrolls.
   ──────────────────────────────────────────────────────────────────────────────────────────────────────────── */
/* The default is on `html`, which the steps of the scale (on `:root`) outrank wherever they sit in this file. */
html { --hud-scale: 1; }
:root { --card-room: calc((100dvh - 24px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)) / var(--hud-scale)); }
.quest-journal .map-card, .backpack .map-card { max-height: var(--card-room); }
.controls-dialog { max-height: var(--card-room); overflow-y: auto; }
.map-card { box-sizing: border-box; }
.quest-list, .backpack-pane { -webkit-overflow-scrolling: touch; touch-action: pan-y; }
.quest-journal .map-card > :not(.quest-list), .backpack .map-card > :not(.backpack-pane) { flex: none; }
/* The backpack as a window over the game (`floating-window.js`): no dark page behind it, only the card, where the
   player left it. The game under it keeps taking touches and keys; the head is what drags it. It is narrower than
   the card it was, so that it can stay open beside the character, and the note about loot stays on the Loot tab. */
.world-map.floating { inset: auto; left: 0; top: 0; z-index: 14; display: block; width: max-content; max-width: 100vw; padding: 0; background: none; backdrop-filter: none; transition: opacity .12s, visibility .12s; }
.backpack.floating .map-card { width: min(304px, calc((100vw - 8px) / var(--hud-scale))); max-height: min(var(--card-room), calc(78dvh / var(--hud-scale))); padding: 10px 12px 12px; box-shadow: 0 10px 34px #000a; }
.backpack.floating .map-head { margin: -4px -4px 0; padding: 4px; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
.backpack.floating.dragging .map-head { cursor: grabbing; }
.backpack.floating.dragging .map-card { filter: brightness(1.12); }
.backpack.floating .backpack-tabs { margin-top: 6px; }
.backpack.floating .backpack-tools .backpack-tabs { margin-top: 0; }
.backpack.floating .backpack-pane { margin: 8px 0 0; gap: 7px; }
.backpack.floating .backpack-grid { gap: 3px; }
.backpack.floating .backpack-detail { grid-template-columns: auto minmax(0, 1fr); padding: 8px; }
.backpack.floating .backpack-detail .primary { grid-column: 1 / -1; }
.backpack.floating .map-card footer { margin-top: 8px; }
.backpack.floating:has(#backpackLoot[hidden]) .map-card footer { display: none; }
/* Two windows open: the one touched last is over the other. */
.world-map.floating.behind { z-index: 13; }
/* The window of the character (ADR-0098): the backpack's card with the ten spaces laid out around the body (three
   columns by four rows), the totals of what is worn, and the skills with their bars (the mana bar's blue). */
.backpack .map-head .head-icon { margin-left: auto; min-width: 36px; padding: 0 8px; display: inline-grid; place-items: center; }
.backpack .map-head .head-icon[hidden] { display: none; }
.backpack .map-head .head-icon .icon { width: 15px; height: 15px; }
.player-frame.opens-character { cursor: pointer; }
.equipment-grid { display: grid; grid-template-columns: repeat(3, 52px); grid-auto-rows: 52px; gap: 4px; justify-content: center; }
.equipment-slot { aspect-ratio: auto; width: 52px; height: 52px; }
.equipment-slot.empty { opacity: .75; }
.equipment-slot small { padding: 0 2px; color: var(--muted); font-size: 8px; font-weight: 700; line-height: 1.15; letter-spacing: .02em; text-align: center; text-transform: uppercase; overflow-wrap: anywhere; }
.equipment-slot .item-icon { --s: 40px; }
.equipment-totals { margin: 0; padding: 0; list-style: none; display: grid; gap: 2px; color: var(--text); font-size: 12px; line-height: 1.4; text-align: center; }
.equipment-totals li:first-child { color: var(--gold); font-weight: 700; }
.equipment-warning { color: #f0a08a; text-align: center; }
.equipment-warning:empty { display: none; }
.backpack-detail-body ul:empty { display: none; }
.backpack.floating .backpack-detail .primary + .primary { margin-top: -2px; }
.skill-list { display: grid; gap: 6px; }
.skill-entry { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; gap: 2px 8px; padding: 7px 10px; border: 1px solid #6b4a1e; border-radius: 4px; background: #10140f; }
.skill-entry .skill-name { color: var(--text); font-size: 13px; font-weight: 600; }
.skill-entry b { color: var(--gold); font-size: 14px; font-variant-numeric: tabular-nums; }
.skill-entry .skill-bar { grid-column: 1 / -1; height: 6px; border: 1px solid #0006; border-radius: 3px; background: #07100e; overflow: hidden; }
.skill-entry .skill-bar i { display: block; height: 100%; background: linear-gradient(to bottom, #7fb6ee 0 34%, #3f82cf 34% 100%); }
.skill-entry small { grid-column: 1 / -1; color: var(--muted); font-size: 10px; line-height: 1.3; }
/* On a phone everything a finger touches inside a card is at least 44 px tall and wide. */
@media (max-width: 699px), (min-width: 560px) and (max-height: 520px) {
  .map-head .glass, .backpack-tabs .glass, .loot-mode .glass, .backpack-detail .primary, .npc-dialogue .glass { min-height: 44px; min-width: 44px; }
  .loot-entry { min-height: 46px; }
}

/* ────────────────────────────────────────────────────────────────────────────────────────────────────────────
   Items on the ground, dragging an item, and the size of a window (ADR-0099).
   ──────────────────────────────────────────────────────────────────────────────────────────────────────────── */
/* "Jogar no chão": under the other buttons of the card, with how many of a pile. */
.backpack-detail > .glass:not(.primary), .drop-row { grid-column: 1 / -1; }
.drop-row { display: flex; align-items: center; gap: 6px; }
.drop-row[hidden], .drop-row [hidden] { display: none; }
.drop-row label { color: var(--muted); font-size: 11px; }
.drop-row input { width: 58px; min-height: 36px; padding: 0 6px; border: 1px solid #6b4a1e; border-radius: 4px; background: #10140f; color: var(--text); font: inherit; font-size: 13px; font-variant-numeric: tabular-nums; text-align: center; }
.drop-row .glass { flex: 1 1 auto; min-height: 36px; font-size: 12px; font-weight: 600; }
@media (max-width: 699px), (min-width: 560px) and (max-height: 520px) {
  .drop-row input, .drop-row .glass, .backpack-detail > .glass:not(.primary) { min-height: 44px; }
}
/* A space that holds an item is dragged, not scrolled: the finger that comes down on it carries the item. */
.backpack-slot[data-drag] { touch-action: none; -webkit-touch-callout: none; user-select: none; -webkit-user-select: none; }
.backpack-slot.drag-source { opacity: .35; }
.drop-ok { outline: 2px solid #8fbf8f; outline-offset: -2px; }
.drop-no { outline: 2px solid #c2523a; outline-offset: -2px; }
/* What the finger carries: the art of the item itself, under the finger and a little above it, taking no touch. */
.item-drag-ghost { --s: 44px; position: fixed; z-index: 60; left: 0; top: 0; margin: -34px 0 0 -22px; pointer-events: none; filter: drop-shadow(0 4px 6px #000b); }
.item-drag-ghost.plain { width: 28px; height: 28px; border: 2px dashed var(--gold); border-radius: 6px; }
.item-drag-ghost.refused { opacity: .45; filter: grayscale(.8) drop-shadow(0 4px 6px #000b); }
html[data-item-drag], html[data-item-drag] * { cursor: grabbing !important; user-select: none; -webkit-user-select: none; }
/* The size of a floating window (`floating-window.js`): the whole card scaled from its top left corner, so that
   everything in it keeps its proportions. The room it may take grows as it shrinks. */
.world-map.floating { transform: scale(var(--window-scale, 1)); transform-origin: 0 0; }
.backpack.floating .map-card { position: relative; max-height: calc(min(var(--card-room), 78dvh / var(--hud-scale)) / var(--window-scale, 1)); }
/* The grip that sizes it: small to the eye, 44 px to the finger, in the corner the window grows towards. */
.window-grip { display: none; }
.world-map.floating.sizable .window-grip { position: absolute; right: 0; bottom: 0; z-index: 2; display: grid; place-items: center; width: 26px; height: 26px; padding: 0; border: 0; border-radius: 6px 0 4px 0;
  background: #10140fcc; color: var(--gold); cursor: nwse-resize; touch-action: none; }
.world-map.floating.sizable .window-grip::before { content: ""; position: absolute; right: 0; bottom: 0; width: 44px; height: 44px; }
.world-map.floating.sizable .window-grip .icon { width: 13px; height: 13px; transform: scaleX(-1); pointer-events: none; }
.world-map.floating.sizing .map-card { filter: brightness(1.12); }
/* The zoom of the game in the menu of the controls (`view-zoom.js`): a line with one step out, the value, one step in. */
.view-zoom { display: flex; align-items: center; gap: 8px; margin: 0 0 14px; color: var(--text); font-size: 13px; }
.view-zoom span { margin-right: auto; }
.view-zoom output { min-width: 46px; color: var(--gold); font-weight: 700; font-size: 13px; text-align: center; font-variant-numeric: tabular-nums; }
.view-zoom .glass { min-width: 44px; min-height: 44px; font-size: 18px; font-weight: 700; }
.view-zoom .glass:disabled { opacity: .4; }

/* ────────────────────────────────────────────────────────────────────────────────────────────────────────────
   Mistfall UI (A0761) — the design system of the interface (docs/design-system/MISTFALL_UI.md), applied in this
   round to ONE place: the Equipment tab of the character window. Dark panels, aged bronze, a discreet gold, a few
   blue details. The frames are the ones of the HUD kit (A0744); the icons and the silhouettes of the empty spaces
   are assets/ui/a0761. Everything here is scoped to `.character`, so the backpack, the content of the Skills tab
   and the other cards are what they were. No text under 11 px; a touch is 44 px on a phone.
   ──────────────────────────────────────────────────────────────────────────────────────────────────────────── */
:root {
  /* Surfaces and metals. */
  --ms-ink: #10140f; --ms-ink-deep: #0a0d0a; --ms-bronze: #8a5a24; --ms-bronze-dark: #6b4a1e; --ms-gold: #d9ad63; --ms-gold-bright: #f1c56d;
  /* The one blue of the interface, for mana and for what speaks of it. */
  --ms-blue: #2f6fd3; --ms-blue-light: #5b9cf0; --ms-blue-ink: #0c1830; --ms-blue-text: #dbe6fb;
  --ms-text: #f1eadb; --ms-muted: #a8b2aa; --ms-faint: #8d968e;
  /* Type: the smallest text there is, the body, what stands out, a title. Numbers are tabular. */
  --ms-text-min: 11px; --ms-text-body: 12px; --ms-text-strong: 13px; --ms-text-title: 16px;
  --ms-touch: 44px;
  --ms-icons: url("assets/ui/a0761/ui-icons.png");
  --ms-silhouettes: url("assets/ui/a0761/slot-silhouettes.png");
}
/* An icon of the sheet (four columns by three rows): `--ix` and `--iy` pick the cell, `--s` its size on screen. */
.ms-icon, .ms-banner, .ms-close, .equipment-stats i {
  background-image: var(--ms-icons); background-repeat: no-repeat; background-size: 400% 300%;
  background-position: calc(var(--ix, 0) * 100% / 3) calc(var(--iy, 0) * 100% / 2);
}
.ms-icon, .equipment-stats i { display: inline-block; flex: none; width: var(--s, 18px); height: var(--s, 18px); }
/* The head: the pennant of the game, the title, how much is worn, and the round button that closes. */
.character .map-head { gap: 8px; align-items: center; }
.character .map-head > div { flex: 1 1 auto; min-width: 0; }
.ms-banner { --ix: 2; --iy: 1; flex: none; width: 38px; height: 38px; margin: -10px -4px -10px -6px; pointer-events: none; }
.character .map-head b { font-size: var(--ms-text-title); line-height: 1.15; letter-spacing: .01em; }
.character .map-head span:not(.ms-banner) { font-size: var(--ms-text-body); }
.character .map-head .ms-close { --ix: 3; --iy: 1; flex: none; width: 30px; min-width: 30px; height: 30px; min-height: 30px; padding: 0; border: 0; border-image: none;
  background: var(--ms-icons) 100% 50% / 400% 300% no-repeat; }
.character .map-head .ms-close:active { filter: brightness(1.25); }
.ms-close span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
/* The tabs: each with its icon; the one that is not chosen is quieter. */
.character .backpack-tabs .glass { gap: 6px; font-size: var(--ms-text-strong); }
.character .backpack-tabs .ms-icon { --s: 22px; }
#characterTabGear .ms-icon { --ix: 0; --iy: 1; }
#characterTabSkills .ms-icon { --ix: 1; --iy: 1; }
.character .backpack-tabs .glass[aria-selected="false"] .ms-icon { filter: grayscale(.75) brightness(.8); }
/* The ten spaces, in the places they had. An empty one shows the silhouette of what goes there and its name under
   it; one with a piece shows the piece alone. */
/* The plate and the box are taller than the lines of text they took the place of: the gaps between the pieces of
   the tab give that back, so that the window stays the size it was. */
.character.floating #characterGear { gap: 5px; }
.character .equipment-grid { grid-template-columns: repeat(3, 56px); grid-auto-rows: 52px; gap: 4px; }
.character .equipment-slot { width: 56px; height: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; }
.character .equipment-slot.empty { opacity: 1; }
.character .equipment-slot .item-icon { --s: 40px; }
.character .equipment-slot[data-slot="legs"] .item-icon:not(.plain) { transform: scaleX(1.38); }
.character .equipment-slot output { font-size: var(--ms-text-min); }
.character .equipment-slot small { padding: 0; color: var(--ms-faint); font-size: var(--ms-text-min); font-weight: 600; line-height: 1.1; letter-spacing: 0; text-transform: none; white-space: nowrap; overflow-wrap: normal; }
.slot-silhouette { order: -1; flex: none; width: 26px; height: 26px; opacity: .6; pointer-events: none;
  background: var(--ms-silhouettes) calc(var(--ix, 0) * 25%) calc(var(--iy, 0) * 100%) / 500% 200% no-repeat; }
.equipment-slot[data-slot="neck"] .slot-silhouette { --ix: 0; --iy: 0; }
.equipment-slot[data-slot="head"] .slot-silhouette { --ix: 1; --iy: 0; }
.equipment-slot[data-slot="trinket"] .slot-silhouette { --ix: 2; --iy: 0; }
.equipment-slot[data-slot="mainHand"] .slot-silhouette { --ix: 3; --iy: 0; }
.equipment-slot[data-slot="body"] .slot-silhouette { --ix: 4; --iy: 0; }
.equipment-slot[data-slot="offHand"] .slot-silhouette { --ix: 0; --iy: 1; }
.equipment-slot[data-slot="ring"] .slot-silhouette { --ix: 1; --iy: 1; }
.equipment-slot[data-slot="legs"] .slot-silhouette { --ix: 2; --iy: 1; }
.equipment-slot[data-slot="ammo"] .slot-silhouette { --ix: 3; --iy: 1; }
.equipment-slot[data-slot="feet"] .slot-silhouette { --ix: 4; --iy: 1; }
/* A0823: the secondary weapon has the weapon's silhouette; its off hand, the book of the mages (assets/ui/a0823). */
.equipment-slot[data-slot="swapMainHand"] .slot-silhouette { --ix: 3; --iy: 0; }
.equipment-slot[data-slot="swapOffHand"] .slot-silhouette { background: url("assets/ui/a0823/slot-book.png") center / contain no-repeat; }
/* An item carried over an empty space lights the space up; the silhouette stays under the light. */
.character .equipment-slot.drop-ok .slot-silhouette { opacity: .85; }
/* What the equipment adds up to: the three numbers on a plate, each with its icon; the reach under it, with its own. */
.equipment-stats { display: flex; justify-content: space-between; align-items: center; gap: 4px; padding: 2px 9px; border: 1px solid transparent; border-image: var(--hud-button) 30 fill / 10px; }
.equipment-stats:empty { display: none; }
.equipment-stats span { display: inline-flex; align-items: center; gap: 4px; min-width: 0; white-space: nowrap; }
.equipment-stats i { --s: 18px; }
.equipment-stats [data-stat="attack"] i { --ix: 0; --iy: 0; }
.equipment-stats [data-stat="defense"] i { --ix: 1; --iy: 0; }
.equipment-stats [data-stat="armor"] i { --ix: 2; --iy: 0; }
.equipment-stats em { color: var(--ms-text); font-size: var(--ms-text-body); font-style: normal; }
.equipment-stats b { color: var(--ms-gold); font-size: 14px; font-variant-numeric: tabular-nums; }
/* The first line of the list says the same three numbers in words: with the plate drawn, it is kept for a reader only. */
.equipment-stats:not(:empty) + .equipment-totals li:first-child { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.character .equipment-totals { gap: 3px; font-size: var(--ms-text-body); color: var(--ms-muted); }
.character .equipment-totals li:nth-child(2) { display: flex; justify-content: center; align-items: center; gap: 6px; color: var(--ms-text); font-size: var(--ms-text-strong); }
.character .equipment-totals li:nth-child(2)::before { content: ""; flex: none; width: 16px; height: 16px; background: var(--ms-icons) 100% 0 / 400% 300% no-repeat; }
/* A weapon without its ammunition shoots mana: said in the blue of mana, with its flame. */
.character .equipment-warning { display: grid; grid-template-columns: 24px minmax(0, 1fr); align-items: center; gap: 8px; margin: 0; padding: 3px 9px; border: 1px solid var(--ms-blue); border-radius: 4px;
  background: linear-gradient(to bottom, #10203f, var(--ms-blue-ink)); box-shadow: inset 0 0 0 1px #5b9cf02e; color: var(--ms-blue-text); font-size: var(--ms-text-body); line-height: 1.3; text-align: left; }
.character .equipment-warning::before { content: ""; width: 24px; height: 24px; background: var(--ms-icons) calc(100% / 3) 100% / 400% 300% no-repeat; }
.character .equipment-warning:empty { display: none; }
/* The line of help under everything, with the sign of information. */
.character #characterHint { display: grid; grid-template-columns: 14px minmax(0, 1fr); align-items: start; gap: 5px; margin: 0; color: var(--ms-muted); font-size: 11.5px; line-height: 1.35; text-align: left; }
.character #characterHint::before { content: ""; width: 14px; height: 14px; margin-top: 1px; background: var(--ms-icons) 0 100% / 400% 300% no-repeat; }
.character #characterHint:empty { display: none; }
.character .backpack-detail small { font-size: var(--ms-text-min); }
/* One blue stone set in the foot of the frame: the only ornament added, and it takes no room from the card. */
.character .map-card::after { content: ""; position: absolute; left: 50%; bottom: -19px; width: 40px; height: 40px; margin-left: -20px; pointer-events: none;
  background: var(--ms-icons) calc(200% / 3) 100% / 400% 300% no-repeat; }

/* ────────────────────────────────────────────────────────────────────────────────────────────────────────────
   "Editar HUD" (A0764, ADR-0101): the panel that changes the buttons of the fight on a phone, and how those
   buttons look while it is open. The plate and the buttons are the ones of the other cards; the colours are the
   tokens of Mistfall UI.
   ──────────────────────────────────────────────────────────────────────────────────────────────────────────── */
#hudEditButton { display: none; }
@media (max-width: 699px), (min-width: 560px) and (max-height: 520px) { #hudEditButton { display: flex; } }
html[data-studio-hud="available"] #hudEditButton { display: flex; }
.hud-editor { top: max(6px, env(safe-area-inset-top)); left: 50%; z-index: 12; width: min(400px, calc(100vw - 12px)); transform: translateX(-50%); display: grid; gap: 6px;
  padding: 8px 14px 10px; border: 1px solid transparent; border-image: var(--hud-panel) 48 fill / 20px; color: var(--ms-text); font-size: 12px; filter: drop-shadow(0 8px 14px #0009); }
.hud-editor[hidden] { display: none; }
.hud-editor[data-mode="bindings"] .hud-editor-layout { display: none; }
.hud-editor-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.hud-editor-head b { color: var(--ms-gold-bright); font-size: 13px; }
.hud-editor-head output { flex: 1; min-width: 0; color: var(--ms-muted); font-size: 11px; text-align: right; }
.hud-editor-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 4px 8px; }
.hud-editor-row label { color: var(--ms-muted); font-size: 11px; }
.hud-editor-row output { min-width: 40px; color: var(--ms-gold); font-size: 11px; font-variant-numeric: tabular-nums; text-align: right; }
.hud-editor select { min-width: 0; min-height: 32px; grid-column: 2 / -1; border: 1px solid var(--ms-bronze-dark); border-radius: 4px; padding: 0 6px; background: var(--ms-ink); color: var(--ms-text); font: inherit; }
.hud-editor input[type="range"] { width: 100%; min-height: 28px; accent-color: var(--ms-gold); }
.hud-editor-all { display: flex; align-items: center; gap: 6px; grid-column: 1 / -1; }
.hud-editor-all input { width: 18px; height: 18px; accent-color: var(--ms-gold); }
.hud-editor-foot { display: flex; justify-content: space-between; gap: 8px; }
.hud-editor .glass { min-height: 36px; padding: 0 12px; border: 1px solid transparent; border-image: var(--hud-button) 30 fill / 10px; border-radius: 0; background: none; box-shadow: none; font-size: 12px; }
.hud-editor .glass.primary { color: var(--ms-gold-bright); }
html[data-hud-edit] [data-hud-role] { outline: 1px dashed #c58a3acc; outline-offset: 1px; touch-action: none; cursor: grab; }
html[data-hud-edit] [data-hud-role].hud-selected { outline: 2px solid var(--ms-gold-bright); }
html[data-hud-edit] [data-hud-role].hud-dragging { z-index: 20; filter: brightness(1.25); cursor: grabbing; }
/* Sideways the panel is two columns, so that it leaves the foot of the screen (and its buttons) in sight. */
@media (min-width: 560px) and (max-height: 520px) {
  .hud-editor { width: min(560px, calc(100vw - 12px)); grid-template-columns: 1fr 1fr; gap: 4px 14px; padding: 6px 14px 8px; }
  .hud-editor-head, .hud-editor-foot { grid-column: 1 / -1; }
  .hud-editor select, .hud-editor .glass { min-height: 30px; }
}

/* ────────────────────────────────────────────────────────────────────────────────────────────────────────────
   Auto Heal (ADR-0103): its window, the entry of the menu and the mark on the frame of the character. The window
   is the backpack's card with the head of Mistfall UI (A0761); the bars are the colours the HUD already uses for
   life and for mana. No text under 11 px; on a phone everything a finger touches is 44 px.
   ──────────────────────────────────────────────────────────────────────────────────────────────────────────── */
.auto-heal .map-head { gap: 8px; align-items: center; }
.auto-heal .map-head > div { flex: 1 1 auto; min-width: 0; }
.auto-heal .map-head b { font-size: var(--ms-text-title); line-height: 1.15; letter-spacing: .01em; }
.auto-heal .map-head span:not(.ms-banner) { font-size: var(--ms-text-body); }
.auto-heal .map-head .ms-close { --ix: 3; --iy: 1; flex: none; width: 30px; min-width: 30px; height: 30px; min-height: 30px; padding: 0; border: 0; border-image: none;
  background: var(--ms-icons) 100% 50% / 400% 300% no-repeat; }
.auto-heal .map-head .ms-close:active { filter: brightness(1.25); }
.auto-heal.floating .map-card { width: min(320px, calc((100vw - 8px) / var(--hud-scale))); }
.auto-heal .auto-heal-note { margin: 0; padding-top: 6px; border-top: 1px solid var(--line); font-size: var(--ms-text-min); }
.auto-heal.floating .backpack-pane { padding-bottom: 14px; }
.auto-heal-master { min-height: 44px; display: flex; align-items: center; justify-content: center; gap: 8px; font-size: var(--ms-text-strong); font-weight: 700; color: var(--ms-muted); }
.auto-heal-master .icon { width: 16px; height: 16px; }
.auto-heal-master.on { color: var(--ms-gold-bright); filter: drop-shadow(0 0 2px #f1c56d); }
.auto-heal-master:disabled { opacity: .5; }
.auto-heal-state:empty, .auto-heal-status:empty, .auto-heal-notice:empty { display: none; }
.auto-heal-state { margin: 0; text-align: center; font-size: var(--ms-text-min); }
.auto-heal-status { margin: 0; color: var(--ms-muted); font-size: var(--ms-text-min); }
.auto-heal-status.failed { color: #f0a08a; }
.auto-heal-rules { display: grid; gap: 7px; }
.auto-heal-rules.off { opacity: .6; }
.auto-heal-rule { --bar: #4cc34a; --bar-light: #8be37f; display: grid; gap: 6px; padding: 8px 10px; border: 1px solid var(--ms-bronze-dark); border-radius: 4px; background: var(--ms-ink); }
.auto-heal-rule[data-rule="manaPotion"] { --bar: var(--mana); --bar-light: var(--mana-light); }
.auto-heal-rule.off .auto-heal-threshold, .auto-heal-rule.off .auto-heal-resource, .auto-heal-rule.off .auto-heal-when { opacity: .5; }
.auto-heal-rule-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 2px 8px; }
.auto-heal-rule-head b { grid-column: 1; grid-row: 1; color: var(--ms-text); font-size: var(--ms-text-strong); letter-spacing: .02em; }
.auto-heal-when { grid-column: 1; grid-row: 2; color: var(--ms-muted); font-size: var(--ms-text-body); }
.auto-heal-switch { grid-column: 2; grid-row: 1 / span 2; min-width: 84px; min-height: 36px; padding: 0 8px; font-size: var(--ms-text-body); font-weight: 700; color: var(--ms-muted); }
.auto-heal-switch[aria-checked="true"] { color: var(--ms-gold-bright); filter: drop-shadow(0 0 2px #f1c56d); }
.auto-heal-threshold { display: grid; grid-template-columns: auto minmax(0, 1fr) auto 44px; align-items: center; gap: 6px; }
.auto-heal-threshold .glass { min-width: 36px; min-height: 36px; padding: 0; font-size: 18px; font-weight: 700; }
.auto-heal-threshold .glass:disabled { opacity: .4; }
.auto-heal-threshold output { color: var(--ms-gold); font-size: var(--ms-text-strong); font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
/* The bar of a threshold: filled up to the value in the colour of what it watches, with a thumb a finger can hold. */
.auto-heal-threshold input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 36px; margin: 0; background: none; cursor: pointer; touch-action: pan-y; }
.auto-heal-threshold input[type="range"]::-webkit-slider-runnable-track { height: 10px; border: 1px solid #0008; border-radius: 5px;
  background: linear-gradient(to right, var(--bar) 0 var(--fill, 50%), #2a3330 var(--fill, 50%) 100%); }
.auto-heal-threshold input[type="range"]::-moz-range-track { height: 10px; border: 1px solid #0008; border-radius: 5px;
  background: linear-gradient(to right, var(--bar) 0 var(--fill, 50%), #2a3330 var(--fill, 50%) 100%); }
.auto-heal-threshold input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 22px; height: 22px; margin-top: -7px; border: 2px solid var(--ms-gold); border-radius: 50%; background: var(--bar-light); box-shadow: 0 1px 3px #000a; }
.auto-heal-threshold input[type="range"]::-moz-range-thumb { width: 18px; height: 18px; border: 2px solid var(--ms-gold); border-radius: 50%; background: var(--bar-light); box-shadow: 0 1px 3px #000a; }
.auto-heal-threshold input[type="range"]:focus-visible { outline: 2px solid var(--ms-gold); outline-offset: 2px; }
.auto-heal-resource { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 8px; color: var(--ms-muted); font-size: var(--ms-text-body); }
.auto-heal-resource[hidden] { display: none; }
.auto-heal-resource select { min-width: 0; min-height: 36px; padding: 0 8px; border: 1px solid var(--ms-bronze-dark); border-radius: 4px; background: var(--ms-ink-deep); color: var(--ms-text); font: inherit; font-size: var(--ms-text-body); }
.auto-heal-resource select:disabled { opacity: 1; color: var(--ms-text); -webkit-appearance: none; appearance: none; }
.auto-heal-notice { margin: 0; color: #f0a08a; font-size: var(--ms-text-min); }
.auto-heal-priority { display: grid; gap: 6px; }
.auto-heal-priority small { color: var(--ms-muted); font-size: var(--ms-text-min); font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.auto-heal-priority .quest-hint { margin: 0; font-size: var(--ms-text-min); }
@media (max-width: 699px), (min-width: 560px) and (max-height: 520px) {
  .auto-heal-switch, .auto-heal-threshold .glass, .auto-heal-resource select { min-height: 44px; }
  .auto-heal-threshold .glass { min-width: 44px; }
  .auto-heal-threshold input[type="range"] { height: 44px; }
}
/* The entry of the menu says whether it is on. */
.quick-tools .tool-state { margin-left: auto; color: var(--muted); font-size: 11px; font-weight: 600; }
.quick-tools .glass[aria-pressed="true"] .tool-state { color: var(--gold); }
.quick-tools .glass[hidden] { display: none; }
/* The mark on the frame of the character: small to the eye (a disc on the lower left rim of the portrait, clear of
   the bars), 44 px to the finger and inside the frame.
   Dim while Auto Heal is off, green and lit while it is on. */
.auto-heal-mark { position: absolute; z-index: 3; left: 1px; top: 38px; display: grid; place-items: center; width: 20px; height: 20px; padding: 0; border: 1px solid var(--ms-bronze-dark); border-radius: 50%;
  background: var(--ms-ink-deep); color: var(--ms-faint); cursor: pointer; }
.auto-heal-mark[hidden] { display: none; }
.auto-heal-mark::before { content: ""; position: absolute; left: -6px; top: -23px; width: 44px; height: 44px; }
.auto-heal-mark .icon { width: 11px; height: 11px; pointer-events: none; }
.auto-heal-mark.on { border-color: var(--ms-gold); color: #8be37f; box-shadow: 0 0 5px #4cc34a99; }
@media (min-width: 1100px) and (min-height: 700px) {
  .auto-heal-mark { left: 2px; top: 44px; width: 22px; height: 22px; }
  .auto-heal-mark .icon { width: 12px; height: 12px; }
}

/* ────────────────────────────────────────────────────────────────────────────────────────────────────────────
   Árvore de habilidades (A0814, ADR-0128): a janela da maestria da arma, os três ramos em colunas, o detalhe do nó
   escolhido e a barra que a árvore libera. O cartão da mochila com o cabeçalho de Mistfall UI (A0761), como o Auto
   Heal; as placas e os espaços são os do kit da HUD (A0744); só as cores e as letras que a interface já tem.
   Dourado no que se tem, cinza no que falta, borda acesa no que dá para liberar agora; a passiva num círculo e a
   ultimate na moldura de bronze acesa. No celular a árvore rola dentro da janela e o detalhe toma o lugar da barra
   enquanto está aberto; numa tela larga o detalhe e a barra ficam numa coluna ao lado da árvore. Nenhum texto abaixo
   de 11 px; no celular tudo o que o dedo toca tem 44 px.
   ──────────────────────────────────────────────────────────────────────────────────────────────────────────── */
.mastery svg[hidden] { display: none; }
.mastery .map-head { gap: 8px; align-items: center; }
.mastery .map-head > div { flex: 1 1 auto; min-width: 0; }
.mastery .map-head b { font-size: var(--ms-text-title); line-height: 1.15; letter-spacing: .01em; }
.mastery .map-head span:not(.ms-banner) { font-size: var(--ms-text-body); }
.mastery .map-head .ms-close { --ix: 3; --iy: 1; position: relative; flex: none; width: 30px; min-width: 30px; height: 30px; min-height: 30px; padding: 0; border: 0; border-image: none;
  background: var(--ms-icons) 100% 50% / 400% 300% no-repeat; }
/* Pequeno ao olho, 44 px ao dedo. */
.mastery .map-head .ms-close::after { content: ""; position: absolute; inset: -7px; }
.mastery .map-head .ms-close:active { filter: brightness(1.25); }
.mastery.floating .map-card { width: min(560px, calc((100vw - 8px) / var(--hud-scale))); }
/* A maestria da família escolhida: o nível, o caminho até o próximo (o dourado da barra de experiência) e os pontos. */
.mastery-progress { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; margin-top: 8px; }
.mastery-progress[hidden] { display: none; }
.mastery-progress b { color: var(--ms-gold); font-size: 14px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mastery-meter { display: block; height: 8px; overflow: hidden; border-radius: 4px; background: #0c0f0bd9; box-shadow: inset 0 0 0 1px #3b2a12; }
.mastery-meter i { display: block; width: var(--fill, 0%); height: 100%; background: linear-gradient(to right, #b9832e, var(--gold)); }
.mastery-progress output { color: var(--ms-text); font-size: var(--ms-text-body); font-variant-numeric: tabular-nums; white-space: nowrap; }
/* As abas: o nome da família e a maestria dela; um ponto aceso na da arma na mão ("na mão" está no rótulo). */
.mastery-tabs { margin-top: 8px; }
.mastery-tabs .glass { min-width: 0; min-height: 40px; padding: 3px 6px; display: grid; place-content: center; justify-items: center; gap: 1px; line-height: 1.15; text-align: center; }
.mastery-tabs .glass b { font-size: var(--ms-text-body); font-weight: 600; }
.mastery-tabs .glass small { color: var(--ms-muted); font-size: var(--ms-text-min); font-weight: 600; font-variant-numeric: tabular-nums; }
.mastery-tabs .glass[aria-selected="true"] small { color: var(--ms-gold); }
.mastery-tabs .glass.in-hand b::before { content: ""; display: inline-block; width: 6px; height: 6px; margin: 0 5px 2px 0; border-radius: 50%; background: var(--ms-gold-bright); box-shadow: 0 0 4px var(--ms-gold-bright); }
/* O corpo: a árvore (que rola) e o lado, com o detalhe e a barra. */
.mastery .map-card > .mastery-layout { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: 8px; }
.mastery .mastery-pane { flex: 1 1 auto; min-height: 80px; margin: 8px 0 0; gap: 6px; }
.mastery-side { flex: none; display: grid; align-content: start; gap: 8px; min-width: 0; }
.mastery-note { margin: 0; font-size: var(--ms-text-min); }
/* A árvore: um cabeçalho por ramo, a linha de cada degrau com o que ele pede, e uma célula por ramo em cada degrau. */
.mastery-tree { display: grid; grid-template-columns: repeat(var(--branches, 3), minmax(0, 1fr)); gap: 5px 6px; align-items: start; }
.mastery-branch { display: grid; justify-items: center; align-content: center; gap: 1px; min-height: 40px; padding: 4px 6px; border: 1px solid transparent; border-image: var(--hud-button) 30 fill / 10px; text-align: center; }
.mastery-branch b { color: var(--ms-gold); font-size: var(--ms-text-strong); line-height: 1.15; }
.mastery-branch small { color: var(--ms-muted); font-size: var(--ms-text-min); font-variant-numeric: tabular-nums; }
.mastery-tier { grid-column: 1 / -1; display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 3px; color: var(--ms-faint); font-size: var(--ms-text-min); font-weight: 600; line-height: 1.2; text-align: center; }
.mastery-tier::before, .mastery-tier::after { content: ""; flex: 1 1 12px; height: 1px; background: var(--line); }
.mastery-tier.open { color: var(--ms-muted); }
.mastery-tier .icon { width: 11px; height: 11px; }
.mastery-cell { display: grid; align-content: start; gap: 5px; min-width: 0; }
/* O nó: o ícone na placa de espaço do kit, o nome em até duas linhas, os níveis (●○○) e o lugar dele na barra. */
.mastery-node { position: relative; min-width: 0; min-height: 52px; padding: 5px 6px; display: grid; grid-template-columns: 32px minmax(0, 1fr); align-items: center; gap: 3px 7px;
  border: 1px solid var(--ms-bronze-dark); border-radius: 4px; background: var(--ms-ink); color: var(--ms-text); text-align: left; }
.mastery-node:active { filter: brightness(1.2); }
.mastery-node-icon { position: relative; grid-row: 1 / span 2; display: grid; place-items: center; width: 32px; height: 32px; border: 1px solid transparent; border-image: var(--hud-slot) 20 fill / 8px; color: var(--ms-muted); }
.mastery-node-icon .icon { width: 17px; height: 17px; }
.mastery-node-mark { position: absolute; right: -5px; bottom: -5px; display: grid; place-items: center; width: 16px; height: 16px; border: 1px solid var(--ms-bronze-dark); border-radius: 50%; background: var(--ms-ink-deep); color: var(--ms-faint); }
.mastery-node-mark[hidden] { display: none; }
.mastery-node-mark .icon { width: 9px; height: 9px; }
.mastery-node-name { min-width: 0; font-size: var(--ms-text-min); font-weight: 600; line-height: 1.2; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.mastery-node-foot { display: flex; align-items: center; justify-content: space-between; gap: 4px; min-width: 0; }
.mastery-node-pips { display: flex; align-items: center; gap: 3px; }
.mastery-node-pips i { width: 7px; height: 7px; border: 1px solid var(--ms-bronze); border-radius: 50%; }
.mastery-node-pips i.on { border-color: var(--ms-gold); background: var(--ms-gold); }
.mastery-node-pips em { color: var(--ms-faint); font-size: var(--ms-text-min); font-style: normal; font-weight: 600; }
.mastery-node-tag { padding: 0 4px; border: 1px solid var(--ms-bronze); border-radius: 3px; background: var(--ms-ink-deep); color: var(--ms-gold); font-size: var(--ms-text-min); font-weight: 700; line-height: 14px; font-variant-numeric: tabular-nums; }
.mastery-node-tag[hidden] { display: none; }
.mastery-node:is([data-state="owned"], [data-state="max"]) { border-color: var(--ms-bronze); }
.mastery-node:is([data-state="owned"], [data-state="max"]) .mastery-node-icon { color: var(--ms-gold); }
.mastery-node[data-state="max"] .mastery-node-icon { color: var(--ms-gold-bright); }
.mastery-node[data-state="available"] { border-color: var(--ms-gold); box-shadow: 0 0 0 1px #d9ad6340, 0 0 6px #d9ad6340; }
.mastery-node[data-state="locked"] { opacity: .78; }
.mastery-node[data-state="locked"][data-open="false"] { opacity: .5; }
.mastery-node[data-state="planned"] { border-style: dashed; opacity: .6; }
.mastery-node[data-kind="passive"] .mastery-node-icon, .mastery-detail .mastery-node-icon[data-kind="passive"] { border: 1px solid var(--ms-bronze); border-image: none; border-radius: 50%; background: var(--ms-ink-deep); }
.mastery-node[data-kind="ultimate"] { border-color: var(--ms-bronze); background: linear-gradient(to bottom, #d9ad6322, transparent 70%), var(--ms-ink); }
.mastery-node[data-kind="ultimate"] .mastery-node-name { color: var(--ms-gold); }
.mastery-node[data-kind="ultimate"] .mastery-node-icon { filter: drop-shadow(0 0 2px #f1c56d); }
.mastery-node[data-kind="ultimate"]:is([data-state="owned"], [data-state="max"]) .mastery-node-icon { color: var(--ms-gold-bright); }
.mastery-node.selected { box-shadow: inset 0 0 0 2px var(--ms-gold); }
.mastery-node[data-state="available"].selected { box-shadow: inset 0 0 0 2px var(--ms-gold), 0 0 6px #d9ad6340; }
/* O detalhe do nó escolhido: o cartão de detalhe da mochila, com o que ele faz, o nível, o que falta e os dois botões. */
/* (Com o peso das regras do detalhe da mochila flutuante, que põem o botão principal numa linha só dele.) */
.mastery .map-card .mastery-detail { grid-template-columns: auto minmax(0, 1fr) auto; gap: 6px 10px; padding: 8px; }
.mastery .mastery-detail .mastery-node-icon { grid-row: auto; width: 40px; height: 40px; color: var(--ms-gold); }
.mastery .mastery-detail .mastery-node-icon .icon { width: 20px; height: 20px; }
.mastery .mastery-detail .mastery-node-icon:is([data-state="available"], [data-state="locked"], [data-state="planned"]) { color: var(--ms-muted); }
.mastery .mastery-detail .mastery-node-icon[data-kind="ultimate"] { color: var(--ms-gold-bright); filter: drop-shadow(0 0 2px #f1c56d); }
.mastery-detail-body { min-width: 0; }
.mastery .backpack-detail small { font-size: var(--ms-text-min); letter-spacing: .04em; }
.mastery-detail .mastery-detail-rank { color: var(--ms-gold); }
.mastery-detail .mastery-detail-need { color: #f0a08a; }
.mastery-detail .mastery-detail-need.soon { color: var(--ms-muted); }
.mastery-detail p:empty { display: none; }
.mastery-detail-close { align-self: start; width: 34px; min-width: 34px; min-height: 34px; padding: 0; font-size: 14px; }
/* O ✕ fica no canto, não na linha de "Jogar no chão" que a mochila dá aos outros botões do detalhe. */
.mastery .map-card .mastery-detail > .mastery-detail-close { grid-column: 3; grid-row: 1; }
.mastery-actions { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 6px; }
.mastery .map-card .mastery-actions .glass { grid-column: auto; min-height: 40px; padding: 0 10px; font-size: var(--ms-text-body); font-weight: 600; }
.mastery-actions .glass[hidden] { display: none; }
.mastery-actions .glass:disabled { opacity: .45; cursor: default; }
.mastery-detail-empty { margin: 0; font-size: var(--ms-text-min); }
/* A barra da arma: Magia 1–3 e a ULT nas placas de espaço da barra de magias, as passivas em círculos; e redistribuir. */
.mastery.floating .map-card .mastery-foot { margin-top: 0; }
.mastery .mastery-foot { display: grid; gap: 6px; color: var(--ms-muted); font-size: var(--ms-text-min); line-height: 1.3; }
/* Num celular de 375 px os sete lugares cabem numa linha (7 × 44 px e os vãos); mais estreito, as passivas descem. */
.mastery-loadout { display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-end; gap: 6px 8px; }
.mastery-bar-group { display: grid; justify-items: center; gap: 2px; }
.mastery-bar-group > small { color: var(--ms-muted); font-size: var(--ms-text-min); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.mastery-bar-slots { display: flex; gap: 3px; }
.mastery-slot { position: relative; width: 40px; height: 40px; padding: 0; display: grid; place-items: center; border: 1px solid transparent; border-image: var(--hud-slot) 20 fill / 10px; background: none; color: var(--ms-gold); }
.mastery-slot .icon { width: 18px; height: 18px; }
.mastery-slot.empty { opacity: .55; }
.mastery-slot.selected { box-shadow: inset 0 0 0 2px var(--ms-gold); }
.mastery-slot[data-place="ultimate"]:not(.empty) { color: var(--ms-gold-bright); filter: drop-shadow(0 0 2px #f1c56d); }
.mastery-slot[data-place="passive"] { border: 1px solid var(--ms-bronze); border-image: none; border-radius: 50%; background: var(--ms-ink-deep); }
.mastery-slot-key { position: absolute; left: 4px; bottom: 2px; color: #e9dcc0; font-size: var(--ms-text-min); font-weight: 700; line-height: 1; text-shadow: 0 1px 0 #000, 0 0 2px #000; }
.mastery-slot-key:empty { display: none; }
.mastery-reset { min-height: 40px; display: flex; align-items: center; justify-content: center; gap: 8px; font-size: var(--ms-text-body); font-weight: 600; }
.mastery-reset[hidden] { display: none; }
.mastery-reset .icon { width: 15px; height: 15px; }
.mastery-reset small { color: var(--ms-muted); font-size: var(--ms-text-min); font-weight: 600; }
.mastery-reset small:empty { display: none; }
.mastery-reset:disabled { opacity: .6; cursor: default; }
.mastery-status { margin: 0; color: var(--ms-muted); font-size: var(--ms-text-min); text-align: center; }
.mastery-status.failed { color: #f0a08a; }
.mastery-status:empty { display: none; }
/* A entrada do menu: os pontos livres na arma na mão, em dourado. */
.quick-tools #masteryButton.lit .tool-state { color: var(--gold); }
/* Celular (e janela estreita): o detalhe aberto toma o lugar da barra, e o texto dele rola se for longo. */
@media (max-width: 699px) {
  .mastery.detail-open .mastery-loadout, .mastery.detail-open .mastery-reset { display: none; }
  .mastery-detail-body { max-height: 22dvh; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
  .mastery-detail-empty { display: none; }
}
/* Um celular em pé: as colunas ficam lado a lado, e cada nó empilha o ícone, o nome e os níveis. */
@media (max-width: 479px) {
  .mastery-tree { gap: 5px 4px; }
  .mastery-branch { padding: 4px 3px; }
  .mastery-branch b { font-size: var(--ms-text-body); }
  .mastery-node { grid-template-columns: minmax(0, 1fr); justify-items: center; gap: 3px; padding: 6px 4px 5px; text-align: center; }
  .mastery-node-icon { grid-row: auto; width: 30px; height: 30px; }
  .mastery-node-foot { justify-content: center; }
}
@media (max-width: 699px), (min-width: 560px) and (max-height: 520px) {
  .mastery-tabs .glass, .mastery .map-card .mastery-actions .glass, .mastery-reset { min-height: 44px; }
  .mastery-detail-close { width: 44px; min-width: 44px; min-height: 44px; }
  .mastery-slot { width: 44px; height: 44px; }
  .mastery-node { min-height: 54px; }
}
/* Tela larga: a árvore à esquerda, o detalhe e a barra numa coluna à direita; cada um rola por si. */
@media (min-width: 700px) {
  .mastery.floating .map-card { width: min(760px, calc((100vw - 8px) / var(--hud-scale))); }
  .mastery .map-card > .mastery-layout { flex-direction: row; gap: 12px; }
  .mastery .mastery-pane { min-width: 0; min-height: 0; }
  .mastery-side { flex: 0 0 280px; min-height: 0; margin-top: 8px; padding-right: 2px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
  /* Na coluna estreita o ✕ fica no canto, por cima, e o texto do detalhe ganha a largura toda. */
  .mastery .map-card .mastery-detail { position: relative; grid-template-columns: auto minmax(0, 1fr); }
  .mastery .map-card .mastery-detail > .mastery-detail-close { position: absolute; top: 6px; right: 6px; grid-column: auto; grid-row: auto; }
  .mastery-detail-body > b, .mastery-detail-body > small { padding-right: 36px; }
}

/* ────────────────────────────────────────────────────────────────────────────────────────────────────────────
   The battle list (A0825), after the owner's board of 2026-11-29: right under the character, a plate that reads
   "Batalha • 4" with a chevron (up while open, down while folded), and under it a row a creature, nearest first:
   its face in the slot of the action bar, its name and its health. The row of the target has a gold frame and the
   crosshair of the interface (assets/ui/a0761, the one of the reach); a touch on a row is a touch on that creature.
   The plates are the bronze ones of the HUD kit (A0744); the colours are the tokens of Mistfall UI (A0761).
   Where the list sits and how many rows it shows is `hud-layout.js` (`battleRoom`): the quest line goes beside the
   plate, the target frame stays under it while the list is folded and hides while it is open (the target is then its
   row), and the lines under it (effects, what dropped, the message upright) go down by its rows (`--battle-rows-h`,
   written by the game). On the smallest phones the open list hides the effects and the loot lines.
   ──────────────────────────────────────────────────────────────────────────────────────────────────────────── */
.battle-list { display: grid; justify-items: start; align-content: start; gap: 6px; width: 220px; pointer-events: none; }
.battle-list[hidden], .battle-rows[hidden], .battle-weak[hidden] { display: none; }
.battle-head { position: relative; display: inline-flex; align-items: center; gap: 4px; width: 108px; height: 40px; min-height: 0; padding: 0 8px 0 10px;
  border: 1px solid transparent; border-image: var(--hud-button) 30 fill / 12px; border-radius: 0; background: none; color: var(--ms-text);
  font-size: 12px; font-weight: 700; line-height: 1; white-space: nowrap; text-shadow: 0 1px 0 #000; pointer-events: auto; }
.battle-head:active { filter: brightness(1.3); }
.battle-head .battle-title { color: var(--ms-gold); letter-spacing: .02em; }
.battle-head .battle-dot { color: var(--ms-muted); }
.battle-head output { color: var(--ms-text); font-variant-numeric: tabular-nums; }
/* The chevron of the page's icons turned up (open) or down (folded); not there where the window has no room for a row. */
.battle-head .icon { width: 12px; height: 12px; margin-left: auto; color: var(--ms-gold); transform: rotate(90deg); transition: transform .15s; }
.battle-head[aria-expanded="false"] .icon { transform: rotate(-90deg); }
.battle-head:not([data-expandable]) .icon { display: none; }
@media (prefers-reduced-motion: reduce) { .battle-head .icon { transition: none; } }
.battle-rows { display: grid; gap: 4px; width: 100%; pointer-events: none; }
.battle-row { position: relative; display: grid; grid-template-columns: 34px auto minmax(0, 1fr) auto; grid-template-rows: 1fr 1fr; align-items: center; column-gap: 6px;
  width: 100%; height: 40px; min-height: 0; padding: 2px 9px 2px 2px; border: 1px solid transparent; border-image: var(--hud-button) 30 fill / 10px; border-radius: 0;
  background: none; color: var(--ms-text); text-align: left; pointer-events: auto; }
/* Drawn 40 px tall, touched 44: the touch reaches down over the gap to the next row (`pitch` in `hud-layout.js`). */
.battle-row::after { content: ""; position: absolute; left: 0; right: 0; top: -1px; bottom: -5px; }
.battle-row:active { filter: brightness(1.3); }
/* A0827: with a mouse, the row under it lights up while its creature in the world gets the faint square. */
@media (hover: hover) { .battle-row:not(.target):hover { filter: brightness(1.18); } }
.battle-portrait { grid-row: 1 / -1; grid-column: 1; width: 34px; height: 34px; border: 1px solid transparent; border-image: var(--hud-slot) 20 fill / 8px; image-rendering: pixelated; }
.battle-aim { grid-row: 1 / -1; grid-column: 2; display: none; width: 15px; height: 15px; background: var(--ms-icons) 100% 0 / 400% 300% no-repeat; }
.battle-name { grid-row: 1; grid-column: 3; align-self: end; min-width: 0; overflow: hidden; color: #ffd9cf; font-size: 11px; font-weight: 700; line-height: 1.25;
  white-space: nowrap; text-overflow: ellipsis; text-shadow: 0 1px 0 #000; }
.battle-row .health { grid-row: 2; grid-column: 3; align-self: start; height: 6px; min-width: 0; margin-top: 3px; }
.battle-weak { grid-row: 1 / -1; grid-column: 4; display: grid; color: var(--gold); }
.battle-weak .icon { width: 12px; height: 12px; }
/* The target: the gold of a locked target in the HUD (the frame and ATK), a gold border and the crosshair. */
.battle-row.target { outline: 2px solid var(--ms-gold-bright); outline-offset: -2px; filter: drop-shadow(0 0 3px #f1c56d) drop-shadow(0 0 1px #f1c56d); }
.battle-row.target .battle-aim { display: block; }
.battle-row.target .battle-name { color: var(--ms-gold-bright); }
/* While the list is open the target is its row with the gold frame: the frame of the target would say it twice. */
html[data-battle="open"] .target-frame { display: none !important; }
/* A wide screen: the list where the quest line was, the line beside the plate, the target under it, the loot under the rows. */
@media (min-width: 700px) and (min-height: 521px) {
  .battle-list { top: 74px; left: max(8px, env(safe-area-inset-left)); }
  html[data-battle] .quest-tracker, html[data-battle] body:has(#targetFrame:not([hidden])) .quest-tracker { left: calc(max(8px, env(safe-area-inset-left)) + 114px); max-width: calc(100vw - 280px); }
  html[data-battle] .target-frame { top: 120px !important; }
  html[data-battle="open"] .loot-feed { top: calc(124px + var(--battle-rows-h, 0px)); }
}
@media (min-width: 1100px) and (min-height: 700px) {
  .battle-list { top: max(84px, calc(env(safe-area-inset-top) + 84px)); left: max(10px, env(safe-area-inset-left)); gap: 8px; }
  html[data-battle] .quest-tracker, html[data-battle] body:has(#targetFrame:not([hidden])) .quest-tracker { left: calc(max(10px, env(safe-area-inset-left)) + 114px); max-width: 260px; }
  html[data-battle] .target-frame { top: max(132px, calc(env(safe-area-inset-top) + 132px)) !important; }
  html[data-battle="open"] .loot-feed { top: calc(max(136px, calc(env(safe-area-inset-top) + 136px)) + var(--battle-rows-h, 0px)); }
}
/* A phone: the numbers of `HUD_LAYOUTS[form].battle` and of the lines under it. */
@media (max-width: 699px), (min-width: 560px) and (max-height: 520px) {
  .battle-list { top: calc(var(--hud-t) + 58px); left: var(--hud-l); width: min(var(--hud-column), 220px); gap: 4px; }
  .battle-head { width: 104px; height: 28px; padding: 0 7px 0 9px; border-image-width: 9px; font-size: 11px; }
  /* Drawn 28 px tall, touched 44: up into the frame of the character and down to the first row, as the quest line was. */
  .battle-head::after { content: ""; position: absolute; left: 0; right: 0; top: -13px; bottom: -5px; }
  .battle-row { border-image-width: 9px; }
  html[data-battle] .quest-tracker, html[data-battle] body:has(#targetFrame:not([hidden])) .quest-tracker { left: calc(var(--hud-l) + 108px); max-width: calc(var(--hud-column) - 108px); }
  html[data-battle] body:not(:has(#questTracker:not([hidden]))) .target-frame { top: calc(var(--hud-t) + 90px) !important; }
  html[data-battle="open"] .ability-conditions { top: calc(var(--hud-t) + 90px + var(--battle-rows-h, 0px)); }
  html[data-battle="open"] .loot-feed { top: calc(var(--hud-t) + 112px + var(--battle-rows-h, 0px)); }
  html[data-battle="open"][data-battle-room="tight"] :is(.ability-conditions, .loot-feed) { display: none !important; }
}
/* Upright the message is the last line of the column, under the rows; sideways it stays at the top. */
@media (max-width: 559px), (max-width: 699px) and (min-height: 521px) {
  html[data-battle="open"] #toast { top: calc(var(--hud-t) + 152px + var(--battle-rows-h, 0px)); }
  html[data-battle="open"][data-battle-room="tight"] #toast { top: calc(var(--hud-t) + 90px + var(--battle-rows-h, 0px)); }
}

/* ────────────────────────────────────────────────────────────────────────────────────────────────────────────
   Balcão (A0839): a janela do balcão de um NPC (o armazém da Dona Salva Maré). O cartão da mochila com o cabeçalho de
   Mistfall UI, como Montarias: o título do balcão e os lumes do personagem, uma linha por mercadoria (o desenho do item
   num espaço da HUD, o nome, o preço e quantas a mochila já leva) com "Comprar 1" e "Comprar 5", a linha do último pedido
   e Fechar no pé. Só os tokens, as molduras e as cores que a interface já tem. Nenhum texto abaixo de 11 px; no celular,
   tudo o que o dedo toca tem 44 px.
   ──────────────────────────────────────────────────────────────────────────────────────────────────────────── */
.shop .map-head { gap: 8px; align-items: center; }
.shop .map-head > div { flex: 1 1 auto; min-width: 0; }
.shop .map-head b { font-size: var(--ms-text-title); line-height: 1.15; letter-spacing: .01em; }
.shop .map-head span:not(.ms-banner) { font-size: var(--ms-text-body); }
.shop .map-head .ms-close { --ix: 3; --iy: 1; position: relative; flex: none; width: 30px; min-width: 30px; height: 30px; min-height: 30px; padding: 0; border: 0;
  border-image: none; background: var(--ms-icons) 100% 50% / 400% 300% no-repeat; }
/* Pequeno para o olho, 44 px para o dedo. */
.shop .map-head .ms-close::after { content: ""; position: absolute; inset: -7px; }
.shop .map-head .ms-close:active { filter: brightness(1.25); }
.shop.floating .map-card { width: min(320px, calc((100vw - 8px) / var(--hud-scale))); }
.shop.floating .backpack-pane { gap: 8px; }
/* Os lumes do personagem: a moeda e o número em dourado. */
.shop-purse { display: flex; align-items: center; gap: 8px; margin: 0; padding: 4px 10px; border: 1px solid var(--ms-bronze-dark); border-radius: 4px;
  background: var(--ms-ink); color: var(--ms-text); font-size: var(--ms-text-body); }
.shop-purse[hidden] { display: none; }
.shop-purse .item-icon { --s: 24px; image-rendering: auto; }
.shop-purse output { color: var(--ms-gold); font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.shop-list { display: grid; gap: 6px; }
.shop-list[hidden], .shop-tabs[hidden], .shop-retry[hidden] { display: none; }
.shop-tabs { margin-top: 0; }
.shop-tabs .glass { min-height: 44px; }
.shop-tabs .glass[aria-pressed="true"] { box-shadow: inset 0 -2px 0 var(--ms-gold); color: var(--ms-gold-bright); }
.shop-sale-form { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(88px, 1fr) minmax(0, 1fr); gap: 8px; align-items: end; }
.shop-sale-form label { display: grid; gap: 4px; min-width: 0; font-size: var(--ms-text-min); color: var(--ms-muted); }
.shop-sale-form input { box-sizing: border-box; min-width: 0; width: 100%; min-height: 44px; padding: 6px 8px;
  background: var(--ms-ink-deep); border: 1px solid var(--ms-bronze); border-radius: 4px; color: var(--ms-text); font: inherit; font-size: 16px; }
.shop-sale-form .shop-buy, .shop-retry { min-height: 44px; }
/* Uma mercadoria: o desenho num espaço, o nome, o preço e quantas há na mochila; embaixo, as duas ofertas lado a lado. */
.shop-item { display: grid; grid-template-columns: 44px minmax(0, 1fr); align-items: center; gap: 6px 10px; padding: 7px 8px 8px; border: 1px solid var(--ms-bronze-dark);
  border-radius: 4px; background: var(--ms-ink); }
/* A moldura do espaço pinta o próprio miolo (`fill`): por isso o desenho do item vai dentro dele, por cima, e não nele. */
.shop-item-slot { box-sizing: border-box; display: grid; place-items: center; width: 44px; height: 44px; border: 1px solid transparent;
  border-image: var(--hud-slot) 20 fill / 8px; }
.shop-item .item-icon { --s: 36px; image-rendering: auto; }
.shop-item-body { display: grid; gap: 2px; min-width: 0; }
.shop-item-body b { color: var(--ms-text); font-size: var(--ms-text-strong); line-height: 1.2; overflow-wrap: anywhere; }
.shop-item-price { color: var(--ms-gold); font-size: var(--ms-text-body); font-weight: 700; font-variant-numeric: tabular-nums; }
.shop-item-held { color: var(--ms-muted); font-size: var(--ms-text-min); }
.shop-item-held[hidden] { display: none; }
.shop-item-offers { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.shop-buy { min-height: 40px; padding: 3px 8px; display: grid; place-content: center; gap: 1px; color: var(--ms-gold-bright); font-size: var(--ms-text-strong);
  font-weight: 700; line-height: 1.15; }
.shop-buy small { color: var(--ms-muted); font-size: var(--ms-text-min); font-weight: 600; font-variant-numeric: tabular-nums; }
/* Uma oferta que os lumes não pagam continua tocável (o servidor diz a recusa), mais apagada e com o preço em vermelho. */
.shop-buy[data-short="true"] { color: var(--ms-muted); }
.shop-buy[data-short="true"] small { color: #f0a08a; }
.shop-buy:disabled { opacity: .55; cursor: default; }
.shop-list[aria-busy="true"] .shop-buy { cursor: progress; }
.shop-note, .shop-status { margin: 0; font-size: var(--ms-text-min); }
.shop-status { color: var(--ms-muted); }
.shop-status.failed { color: #f0a08a; }
.shop-note:empty, .shop-status:empty { display: none; }
.shop .shop-foot { display: grid; margin-top: 8px; }
.shop-foot .glass { min-height: 40px; padding: 0 12px; font-size: var(--ms-text-strong); font-weight: 700; }
@media (max-width: 699px), (min-width: 560px) and (max-height: 520px) {
  .shop-buy, .shop-foot .glass { min-height: 44px; }
}
