/* Visual montado com texturas originais da pasta UI do WYD (aplicadas via ui-skin.js) */
:root {
  --gold: #e8c27a;
  --gold-hi: #ffe2a3;
  --text: #e6dccb;
  --muted: #a99b86;
  --ink: #17120e;
  --accent: #d9733b;
  --panel-bg: #231d19;
  --equip-w: 320px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: #0d0b09; color: var(--text);
  font: 13px/1.35 "Trebuchet MS", Tahoma, sans-serif;
  /* jogo, nao pagina: clique duplo/arrastar nao pinta o texto de azul (selecao do navegador); so os campos de digitar */
  -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent;
}
input, textarea, [contenteditable="true"] { -webkit-user-select: text; user-select: text; }
#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }

/* ---------- carregamento ---------- */
#loading {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: end center; padding-bottom: 12vh;
  /* logo do Velynor sobre o escuro, com um brilho dourado atras */
  background: url('../img/logo.webp') center 36% / min(620px, 82vw) auto no-repeat,
    radial-gradient(ellipse at 50% 38%, rgba(120, 80, 25, .45), transparent 55%), #0b0806;
  transition: opacity .6s;
}
#loading.done { opacity: 0; pointer-events: none; }
.loading-box { width: min(420px, 80vw); text-align: center; text-shadow: 0 1px 2px #000; }
#loading-text { margin-bottom: 8px; color: var(--gold); font-family: Cinzel, serif; letter-spacing: .04em; }
.bar { height: 8px; border: 1px solid #6b5640; background: #120d0a; border-radius: 4px; overflow: hidden; }
#loading-bar { height: 100%; width: 0; background: linear-gradient(90deg, #8a3e17, var(--accent), #f0b66b); transition: width .2s; }

/* ---------- molduras do jogo ---------- */
.window-skin {
  border: 40px solid transparent;
  border-width: 46px 14px 26px 14px;
  border-image: var(--ui-window) 46 14 26 14 fill stretch;
  background: transparent;
}
.window-skin .win-title {
  margin: -40px 0 16px; height: 24px; text-align: center;
  font: 700 12px/24px Cinzel, serif; color: #2a160a; letter-spacing: .08em;
  text-shadow: 0 1px 0 #f3b27a; position: relative; z-index: 1;
}
.win-body { position: relative; }
.close-x {
  position: absolute; right: -4px; top: 2px; width: 22px; height: 22px; padding: 0;
  border: 1px solid #6b5640; border-radius: 3px; background: #2a201a; color: var(--gold);
  font-size: 16px; line-height: 18px; cursor: pointer;
}
.close-x:hover { background: #4a3626; }

.titlebar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 10; height: 44px;
  display: flex; align-items: center; gap: 16px; padding: 0 14px;
  border-image: var(--ui-titlebar) 8 8 8 8 fill stretch;
  border: 6px solid transparent;
}
.brand { font: 700 17px Cinzel, serif; color: var(--gold-hi); text-shadow: 0 0 8px #000, 0 1px 1px #000; white-space: nowrap; }
.tabs { display: flex; gap: 6px; }
.top-actions { margin-left: auto; display: flex; gap: 6px; }
.map-pick { flex-direction: row; align-items: center; gap: 6px; color: var(--gold); font-weight: 600; }
#map-coords { color: var(--muted); font-size: 11px; white-space: nowrap; }

.wyd-btn {
  border: 6px solid transparent;
  border-image: var(--ui-button) 7 fill stretch;
  background: transparent; color: var(--text); padding: 2px 10px; min-height: 30px;
  font: 600 12px "Trebuchet MS", sans-serif; cursor: pointer; text-shadow: 0 1px 1px #000;
  filter: brightness(1); transition: filter .12s;
}
.wyd-btn:hover { filter: brightness(1.35); color: var(--gold-hi); }
.wyd-btn:active { filter: brightness(.85); }
.wyd-btn.active { color: var(--gold-hi); filter: brightness(1.5) sepia(.35); }
.wyd-btn:disabled { opacity: .45; cursor: default; filter: grayscale(.6); }
.wyd-btn.small { min-height: 26px; padding: 0 8px; font-size: 11.5px; }

select, .wyd-input, input[type=range] { accent-color: var(--accent); }
select, .wyd-input {
  background: #15100c; color: var(--text); border: 1px solid #5d4a36; border-radius: 3px;
  padding: 4px 6px; font: inherit; max-width: 100%;
}
select:focus, .wyd-input:focus { outline: 1px solid var(--gold); }
label { display: flex; flex-direction: column; gap: 3px; color: var(--muted); font-size: 11.5px; }
label.check { flex-direction: row; align-items: center; gap: 5px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin-top: 8px; }
.hint { color: var(--muted); font-size: 11px; margin-top: 6px; }

.panel { position: fixed; z-index: 5; }

/* ---------- painel de equipamentos ---------- */
.equip-skin {
  left: 10px; top: 54px; width: var(--equip-w); aspect-ratio: 458 / 706;
  background: var(--ui-equip) 0 0 / 100% 100% no-repeat;
  filter: drop-shadow(0 6px 14px #000c);
}
#equip-cells { position: absolute; inset: 0; }
.cell {
  position: absolute; width: calc(73 / 458 * 100%); height: calc(72 / 706 * 100%);
  border: 0; padding: 0; background: transparent; cursor: pointer; border-radius: 3px;
}
.cell:hover, .cell.selected { box-shadow: inset 0 0 0 2px var(--gold), 0 0 10px #e8a24a88; }
.cell .tag {
  position: absolute; left: 0; right: 0; bottom: 2px; font-size: 9.5px; color: var(--gold-hi);
  text-shadow: 0 1px 2px #000, 0 0 3px #000; pointer-events: none; text-align: center; line-height: 1.05;
  overflow: hidden; max-height: 2.1em;
}
.cell .label {
  position: absolute; left: 0; right: 0; top: 2px; font-size: 9px; color: #fff9; text-shadow: 0 1px 2px #000;
  text-align: center; pointer-events: none;
}
.cell.filled { background: radial-gradient(circle, #e8a24a33, transparent 70%); }
.equip-bottom {
  position: absolute; left: calc(36 / 458 * 100%); right: calc(36 / 458 * 100%);
  top: calc(480 / 706 * 100%); bottom: calc(62 / 706 * 100%);
  display: flex; flex-direction: column; gap: 6px;
}
.class-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px; }
.class-row .wyd-btn { min-height: 26px; padding: 0 4px; font-size: 11px; }
.char-badge { grid-column: 1 / -1; text-align: center; font: 700 13px Cinzel, serif; color: var(--gold-hi); text-shadow: 0 1px 2px #000; padding: 4px 0; }
.equip-info { font-size: 11px; color: var(--text); overflow: auto; text-shadow: 0 1px 1px #000; }

/* ---------- monstro ---------- */
#monster-panel { left: 10px; top: 54px; width: 300px; max-height: calc(100vh - 230px); overflow: auto; }
#monster-panel .win-body { display: flex; flex-direction: column; gap: 8px; }
#mon-parts { display: flex; flex-direction: column; gap: 6px; }
.part-row { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }

/* ---------- seletor ---------- */
#picker { left: calc(var(--equip-w) + 20px); top: 54px; width: 330px; z-index: 6; }
#picker .win-body { display: flex; flex-direction: column; gap: 8px; }
.picker-tabs { display: flex; gap: 6px; }
.list { max-height: min(52vh, 460px); overflow: auto; display: flex; flex-direction: column; gap: 2px; padding-right: 4px; }
.list button {
  text-align: left; background: #1b1511; border: 1px solid #3a2e24; color: var(--text);
  padding: 5px 8px; border-radius: 2px; cursor: pointer; font: inherit;
  display: flex; justify-content: space-between; gap: 8px;
}
.list button:hover { background: #33261c; border-color: #7a5e3e; color: var(--gold-hi); }
.list button.selected { border-color: var(--gold); color: var(--gold-hi); background: #3c2a1c; }
.list small { color: var(--muted); white-space: nowrap; }
.list .none { font-style: italic; }
#picker-free { display: flex; flex-direction: column; gap: 8px; }

/* ---------- skills ---------- */
#skill-panel { right: 10px; top: 54px; width: 290px; max-height: calc(100vh - 220px); overflow: auto; }
.skill-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.skill-grid .wyd-btn { text-align: left; min-height: 28px; padding: 0 6px; font-size: 11px; line-height: 1.1; }
.skill-grid .wyd-btn kbd { color: var(--gold); font: 700 10px monospace; margin-right: 3px; }

/* ---------- barra de acoes ---------- */
#action-bar {
  left: 50%; bottom: 150px; transform: translateX(-50%); z-index: 8;
  width: min(1100px, calc(100vw - 20px));
  border-width: 24px 14px 16px 14px;
}
.actions { display: flex; flex-wrap: wrap; gap: 3px; justify-content: center; margin-top: -10px; }
.actions .wyd-btn { min-height: 26px; padding: 0 7px; font-size: 11px; }
.controls { justify-content: center; margin-top: 6px; gap: 12px; }
.controls label { flex-direction: row; align-items: center; gap: 6px; }
.controls select { max-width: 190px; }
#action-bar .hint { text-align: center; margin-top: 4px; }
#speed-val { color: var(--gold); font-size: 11px; }

/* ---------- numeros de dano ---------- */
#damage-layer { position: fixed; inset: 0; pointer-events: none; z-index: 4; overflow: hidden; }
/* (v17.6) nomes e barras sobre as cabecas desenhados no WebGL (nomes-gl.js), por baixo dos nomes que ficam no HTML */
.nomes-gl { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.dmg {
  position: absolute; transform: translate(-50%, -50%);
  font: 700 22px Cinzel, serif; color: #ffd27a;
  text-shadow: 0 0 3px #000, 0 2px 2px #000, 0 0 10px #ff7a2a;
  animation: dmg-rise 1.1s ease-out forwards;
  /* (v17.1) camada propria e so transform/opacidade na animacao: subir com margin-top refazia o layout e repintava
     cada numero (brilho e contorno) a cada quadro; com o grupo e as evocacoes batendo eram dezenas ao mesmo tempo */
  will-change: transform, opacity;
}
.dmg.taken { color: #ff6a5a; text-shadow: 0 0 3px #000, 0 2px 2px #000, 0 0 10px #a00; }
.dmg.exp { color: #d6b8ff; font-size: 16px; text-shadow: 0 0 3px #000, 0 0 8px #7a3fd1; }
/* pilha de avisos acima da cabeca (EXP, item): ate 5 linhas, a nova entra por baixo e as antigas sobem e somem */
/* avisos (EXP, gold, drop): acima do nick, da barra de vida e da mira de aggro (v2.98) */
.notice-feed { position: absolute; transform: translate(-50%, calc(-100% - 64px)); display: flex; flex-direction: column; align-items: center;
  gap: 1px; pointer-events: none; }
.notice { font: 700 15px Cinzel, serif; color: #d6b8ff; white-space: nowrap; text-shadow: 0 0 3px #000, 0 2px 2px #000, 0 0 8px #7a3fd1;
  transition: transform .25s ease-out, opacity .45s; animation: notice-in .25s ease-out; }
.notice.coin { color: #ffd257; font-size: 13px; text-shadow: 0 0 3px #000, 0 2px 2px #000, 0 0 8px #a86a00; }
.notice.gain { color: #8dff6a; text-shadow: 0 0 3px #000, 0 2px 2px #000, 0 0 10px #2fa81a; }
.notice.out { opacity: 0 !important; transform: translateY(-8px); }
@keyframes notice-in { from { opacity: 0; transform: translateY(10px); } }
.dmg.exp.gain { color: #8dff6a; text-shadow: 0 0 3px #000, 0 2px 2px #000, 0 0 10px #2fa81a; }
.notice.gain.dobro, .dmg.exp.gain.dobro { color: #d9a2ff; text-shadow: 0 0 3px #000, 0 2px 2px #000, 0 0 12px #8a2be2; } /* EXP aumentada em roxo (v9.1) */
.dmg.heal { color: #9dff8a; text-shadow: 0 0 3px #000, 0 2px 2px #000, 0 0 10px #2aff6a; }
.dmg.heal-skill { color: #7cc4ff; text-shadow: 0 0 3px #000, 0 2px 2px #000, 0 0 10px #2a7dff; }
.dmg.crit { font-size: 24px; color: #ff9a6a; }
/* tipo do dano: fisico dourado, magico azul (critico: maior e mais claro; recebido: vermelho / roxo) */
.dmg.phys { color: #ffd257; text-shadow: 0 0 3px #000, 0 2px 2px #000, 0 0 10px #b86a00; }
.dmg.magic { color: #6fc8ff; text-shadow: 0 0 3px #000, 0 2px 2px #000, 0 0 10px #1a5cff; }
.dmg.pet { color: #ff6ae0; text-shadow: 0 0 3px #000, 0 2px 2px #000, 0 0 10px #c2189c; } /* dano das evocacoes (v2.83) */
/* critico fisico: letra gotica (Pirata One) um pouco maior e inclinada, ouro para laranja com contorno escuro,
   e um "estalo" ao aparecer */
.dmg.phys.crit {
  font: 400 30px "Pirata One", "Cinzel Decorative", Cinzel, serif; letter-spacing: .04em; font-style: normal;
  -webkit-text-stroke: .6px #4a1e00;
  background: linear-gradient(180deg, #fff6cf 0%, #ffd45a 45%, #ff8a1e 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent; text-shadow: none;
  filter: drop-shadow(0 1px 0 #000) drop-shadow(0 0 2px #000) drop-shadow(0 0 6px rgba(255, 120, 20, .7));
  animation: dmg-crit 1.2s ease-out forwards;
}
@keyframes dmg-crit {
  0% { opacity: 0; transform: translate(-50%, -50%) translateY(6px) skewX(-8deg) scale(1.6); }
  12% { opacity: 1; transform: translate(-50%, -50%) translateY(-3px) skewX(-8deg) scale(.94); }
  22% { transform: translate(-50%, -50%) translateY(-11px) skewX(-8deg) scale(1.05); }
  32% { transform: translate(-50%, -50%) translateY(-19px) skewX(-8deg) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -50%) translateY(-70px) skewX(-8deg) scale(1); }
}
.dmg.magic.crit { color: #c4ecff; }
.dmg.phys.taken { color: #ff6a5a; text-shadow: 0 0 3px #000, 0 2px 2px #000, 0 0 10px #a00; }
.dmg.magic.taken { color: #d78bff; text-shadow: 0 0 3px #000, 0 2px 2px #000, 0 0 10px #7a1fd1; }
@keyframes dmg-rise {
  0% { opacity: 0; transform: translate(-50%, -50%) translateY(10px); }
  15% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -50%) translateY(-70px); }
}

/* ---------- HUD do jogo (UI/newmain.wyt) ---------- */
.hud {
  position: fixed; left: 50%; bottom: 0; width: 870px; height: 136px; z-index: 7;
  background: var(--hud-bar) 0 0 / 870px 136px no-repeat;
  transform-origin: 50% 100%;
  user-select: none;
}
.orb { position: absolute; width: 88px; height: 88px; border-radius: 50%; overflow: hidden; }
.orb-fill { position: absolute; inset: 0; background-size: 116% 116%; background-position: center; transition: clip-path .2s; }
.orb.hp .orb-fill { background-image: var(--hud-hp); }
.orb.mp .orb-fill { background-image: var(--hud-mp); }
.orb-text {
  position: absolute; inset: 0; display: grid; place-items: center;
  font: 700 11px "Trebuchet MS", sans-serif; color: #fff; text-shadow: 0 0 3px #000, 0 1px 2px #000;
}
.hud-slot {
  position: absolute; padding: 0; border: 0; cursor: pointer; border-radius: 3px;
  background: transparent var(--skill-icons) no-repeat; background-size: 512px 256px;
  background-position: -9999px -9999px;
}
.hud-strip { position: absolute; border-radius: 5px; pointer-events: none;
  background: linear-gradient(#1c130b, #0d0905); box-shadow: inset 0 0 0 1px #6b4f2a, inset 0 0 8px #000, 0 0 0 1px #000; }
.hud-group { position: absolute; height: 7px; font: 800 6.5px/7px Inter, sans-serif; letter-spacing: .25em; text-align: center; color: #c9a46a; opacity: .8; pointer-events: none; }
.hud-slot { box-shadow: inset 0 0 0 1px #5a4024, inset 0 0 6px #000; background-color: #0b0805; }
.hud-slot.buff { box-shadow: inset 0 0 0 1px #3f6a3a, inset 0 0 6px #000; }
.hud-slot.magic { box-shadow: inset 0 0 0 1px #7a3a2a, inset 0 0 6px #000; }
.hud-slot.filled { box-shadow: inset 0 0 0 1px #0008; }
.hud-slot:not(.filled) { background-image: none; }
.hud-slot.current { z-index: 1; outline: 2px solid #fff3c4; outline-offset: 1px; box-shadow: 0 0 8px 2px #ffb54a, inset 0 0 6px #ffd27a88;
  animation: slot-next-in .35s ease-out, slot-next 1.2s ease-in-out .35s infinite; }
.hud-slot.nomana { filter: grayscale(.8) brightness(.6); }
/* (v14.19) contorno da proxima skill (a proxima da sequencia do Macro, ou a selecionada): claro, pulsando, e pisca ao mudar */
@keyframes slot-next-in { from { outline-color: #fff; outline-offset: 4px; box-shadow: 0 0 16px 6px #ffe08a, inset 0 0 10px #fff8; } }
@keyframes slot-next { 50% { outline-color: #ffb54a; box-shadow: 0 0 4px 1px #ffb54a99, inset 0 0 4px #ffd27a44; } }
.hud-slot .cd { position: absolute; inset: 0; border-radius: 3px; pointer-events: none; }
.hud-slot::after {
  content: attr(data-key); position: absolute; right: 2px; bottom: 0; font: 700 9px sans-serif;
  color: #ffe2a3; text-shadow: 0 0 2px #000;
}
.hud-field { position: absolute; top: 88px; height: 20px; font: 600 11px/20px "Trebuchet MS", sans-serif; color: var(--text); text-shadow: 0 1px 1px #000; overflow: hidden; white-space: nowrap; }
.hud-name { left: 142px; width: 180px; color: var(--gold-hi); }
.hud-info { left: 336px; width: 286px; text-align: center; }
.hud-exptext { left: 636px; width: 86px; text-align: center; color: #9fe870; }
.hud-exp { position: absolute; left: 139px; top: 119px; width: 585px; height: 8px; overflow: hidden; }
.hud-exp .fill { height: 100%; width: 0; background: linear-gradient(#c6ff9e, #3f9f2a); box-shadow: 0 0 6px #7fe05a; transition: width .3s; }
.hud-explabel { position: absolute; left: 139px; top: 105px; width: 585px; text-align: center; pointer-events: none; font: 700 10px Inter, sans-serif; color: #e8ffd9; text-shadow: 0 0 3px #000, 0 1px 1px #000; letter-spacing: .03em; }

.target-frame {
  position: fixed; top: 52px; left: 50%; transform: translateX(-50%); z-index: 7; width: 260px;
  padding: 6px 10px 8px; text-align: center; border: 1px solid #6b5640; border-radius: 4px;
  background: linear-gradient(#2a201aee, #15100cee); box-shadow: 0 4px 12px #000a;
}
.tf-name { font: 700 13px Cinzel, serif; color: var(--gold-hi); margin-bottom: 4px; }
.tf-text { font-size: 10px; color: var(--text); margin-top: 2px; }
.bar { position: relative; height: 10px; background: var(--bar-track) 0 0 / 100% 100%; border-radius: 4px; overflow: hidden; }
.bar .fill { position: absolute; inset: 0 auto 0 0; width: 100%; background: var(--bar-red) 0 0 / 100% 100%; transition: width .15s; }

.overhead {
  /* a posicao vem por transform (hud.js), a partir do canto */
  position: absolute; left: 0; top: 0; transform: translate(-50%, -100%); width: 86px; text-align: center; pointer-events: none;
  /* coluna centrada: nome/etiqueta mais largos que os 86px transbordam igual para os dois lados (antes so para a
     direita, deslocando a etiqueta do NPC); as barras de vida esticam nos 86px */
  display: flex; flex-direction: column; align-items: center;
  /* (v17.4) camada propria: os nomes andam todo quadro junto com a camera, e sem a camada cada passo repintava a
     camada inteira da interface (nomes com contorno, barras e brasoes); com ela mover e so compor */
  will-change: transform;
}
.overhead > .bar, .overhead > .oh-hp { align-self: stretch; }
/* (v14.13) debuffs (lento, atordoado, envenenado...): icones da skill a direita da barra de vida, com borda vermelha */
.overhead .oh-hp { position: relative; }
.overhead .oh-debuffs { position: absolute; left: calc(100% + 3px); top: 50%; transform: translateY(-50%); display: flex; gap: 2px; }
.overhead .oh-debuff { width: 16px; height: 16px; flex: none; background: var(--skill-icons) no-repeat; background-size: 256px 128px;
  border: 1px solid #ff4a3a; border-radius: 2px; box-shadow: 0 0 4px #ff2a1acc, 0 1px 2px #000; }
.overhead .oh-debuff.ending { animation: oh-debuff-end .5s steps(2, jump-none) infinite alternate; }
@keyframes oh-debuff-end { to { opacity: .35; } }
.overhead.nohp .oh-debuffs, .overhead.drop .oh-debuffs, .overhead.npc .oh-debuffs, .overhead.summon .oh-debuffs { display: none; }
/* (v15.33) monstro sob o mouse: dano do golpe dele em voce e a EXP se voce o matar */
.overhead .oh-info { display: flex; gap: 6px; margin-top: 3px; font: 700 10px "Trebuchet MS", sans-serif; white-space: nowrap; text-shadow: 0 0 2px #000, 0 1px 1px #000; }
.overhead .oh-info[hidden] { display: none; }
.overhead .oh-info .oi-dmg { color: #ff9a86; }
.overhead .oh-info .oi-exp { color: #9fe870; }
.overhead .oh-info .oi-exp.none { color: #a2967f; }
.overhead .oh-name { font: 700 10px "Trebuchet MS", sans-serif; color: #ffd9a0; text-shadow: 0 0 2px #000, 0 1px 1px #000; white-space: nowrap; }
.overhead .bar { height: 6px; border: 1px solid #000a; }
.overhead .oh-buffs { display: flex; justify-content: center; gap: 2px; margin-top: 2px; }
.overhead .oh-buff { width: 16px; height: 16px; background: var(--skill-icons) no-repeat; background-size: 256px 128px; border: 1px solid #000a; border-radius: 2px; box-shadow: 0 0 4px #7fd0ff; }
.overhead.targeted .oh-name { color: #ff8a6a; }
.overhead.ally .oh-name { color: #9dff8a; }
.overhead.ally .bar .fill { background: linear-gradient(#7ee06a, #3f9a32); }
/* evocacao de outro heroi: nome discreto e o dono embaixo em letra menor; sem barra de vida (nao polui) */
.overhead .oh-owner { display: none; }
.overhead.summon .oh-name { color: #d8d0c0; font-weight: 600; font-size: 9px; opacity: .85; }
.overhead.summon .oh-owner { display: block; font: 600 8px "Trebuchet MS", sans-serif; color: #b8ad98; opacity: .8; text-shadow: 0 0 2px #000, 0 1px 1px #000; white-space: nowrap; }
/* evocacao de quem esta no seu grupo: azul */
.overhead.summon.party .oh-owner, .overhead.summon.party .oh-name { color: #8fd3ff !important; }
.overhead.summon.party .oh-name::before { content: none; }
.overhead.summon .bar { display: none; }
/* todo heroi (voce, outros jogadores e habitantes): o mesmo nick creme, ninguem se destaca como bot (v2.91);
   vermelho so o piscando de PK; verde quem esta no seu grupo */
.overhead.other .oh-name { color: #fff3c8; font-size: 11px; }
.overhead.drop .bar { display: none; }
.overhead.drop .oh-name { color: #fff2c4; font-weight: 600; background: #0008; padding: 1px 5px; border-radius: 2px; }

/* ---------- inventario ---------- */
#inv-panel { right: 310px; top: 130px; width: 330px; z-index: 8; }
.inv-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 3px; }
.inv-slot {
  position: relative; aspect-ratio: 1; padding: 2px; border: 1px solid #3a2e24; border-radius: 2px;
  background: #15100c; color: var(--text); font: 600 8.5px/1.05 "Trebuchet MS", sans-serif; cursor: default; overflow: hidden;
}
.inv-slot.filled { cursor: pointer; background: linear-gradient(#2a2017, #17110c); border-color: #6b5236; }
.inv-slot.filled:hover { border-color: var(--gold); box-shadow: 0 0 8px #e8a24a66; }
.inv-slot.usable { border-color: #4f7a3a; }
.inv-slot .nm { display: block; text-align: center; word-break: break-word; max-height: 100%; overflow: hidden; }
.inv-slot .qt { position: absolute; right: 2px; bottom: 1px; font: 700 10px sans-serif; color: var(--gold-hi); text-shadow: 0 0 2px #000; }
.inv-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; gap: 8px; }
.inv-gold { color: var(--gold-hi); font: 700 12px Cinzel, serif; white-space: nowrap; }
.inv-tip { min-height: 30px; margin-top: 6px; font-size: 11px; color: var(--muted); }

.hud-msg {
  position: fixed; top: 28%; left: 50%; transform: translateX(-50%); z-index: 8; pointer-events: none;
  font: 700 32px Cinzel, serif; color: #ffe2a3; text-shadow: 0 0 10px #ff9a2a, 0 2px 3px #000;
  opacity: 0; transition: opacity .3s;
}
.hud-msg.show { opacity: 1; }
.hud-msg.bad { color: #ff7a6a; text-shadow: 0 0 10px #a00, 0 2px 3px #000; }
.skill-grid .wyd-btn .ico {
  display: inline-block; width: 22px; height: 22px; vertical-align: middle; margin-right: 4px;
  background: var(--skill-icons) no-repeat; background-size: 352px 176px; border-radius: 2px;
}
.skill-grid .wyd-btn.passive { opacity: .6; }

/* ---------- relogio do servidor ---------- */
.server-clock { color: var(--gold); font: 600 12px "Trebuchet MS", sans-serif; text-shadow: 0 1px 2px #000; white-space: nowrap; margin-left: 4px; }
.map-name { font: 700 13px Cinzel, serif; color: var(--gold-hi); text-shadow: 0 1px 2px #000; white-space: nowrap; }

/* ---------- chat ---------- */
#chat {
  position: fixed; left: 10px; bottom: 146px; z-index: 6; width: min(380px, 40vw);
  display: flex; flex-direction: column; gap: 4px; pointer-events: none;
}
/* (v13.44) mensagens do jogo no lado direito, espelhando o chat */
#info-log {
  position: fixed; right: 10px; bottom: 146px; z-index: 6; width: min(380px, 40vw); max-height: 160px; overflow: hidden;
  display: flex; flex-direction: column; justify-content: flex-end; align-items: flex-end; text-align: right; pointer-events: none;
}
#info-log.hidden, body.celular #info-log, body.in-lobby #info-log { display: none; }
#info-log div { font-size: 12px; line-height: 1.35; color: #ffd27a; text-shadow: 0 0 3px #000, 0 1px 1px #000; }
#info-log .bad { color: #ff8a7a; }
#info-log .good { color: #8fe39b; }
#chat-log { max-height: 160px; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; }
#chat-log div { font-size: 12px; color: #f2e8d6; text-shadow: 0 0 3px #000, 0 1px 1px #000; line-height: 1.35; }
#chat-log .sys { color: #ffd27a; }
#chat-log .sys.bad { color: #ff8a7a; }
#chat-log .sys.good { color: #8fe39b; } /* (v8.5) avisos bons */
/* (v8.6) Bau de Experiencia ativo: icone e horas ao lado do nome e no grupo */
.overhead .oh-exp, .pt-exp { display: inline-block; padding-left: 16px; margin-left: 4px; background: left center / 14px no-repeat;
  font: 700 10px Inter, sans-serif; color: #b6f59a; text-shadow: 0 1px 2px #000; vertical-align: middle; }
.overhead .oh-exp[hidden] { display: none; }
#chat-log b { color: #8fd3ff; }
#chat-log .global { color: #ffe0b8; }
#chat-log .global b { color: #ff9f4a; }
#chat-log .global i { font-style: normal; font-weight: 700; color: #ff9f4a; margin-right: 3px; }
.chat-toggle.chat-chan.global { color: #ff9f4a; border-color: #ff9f4a; }
#chat-input {
  pointer-events: auto; background: #120d0acc; color: var(--text); border: 1px solid #5d4a36;
  border-radius: 3px; padding: 4px 6px; font: inherit; opacity: .55;
}
#chat-input:focus { opacity: 1; outline: 1px solid var(--gold); }
.chat-row { display: flex; gap: 4px; }
.chat-row #chat-input { flex: 1; min-width: 0; }
.chat-toggle {
  pointer-events: auto; cursor: pointer; background: #120d0acc; color: var(--muted); border: 1px solid #5d4a36;
  border-radius: 3px; padding: 0 8px; font: 600 11px "Trebuchet MS", sans-serif; opacity: .7;
}
.chat-toggle.on { color: var(--gold-hi); border-color: var(--gold); }
.chat-toggle:hover { opacity: 1; }

/* ---------- baloes de conversa e NPCs ---------- */
.bubble {
  /* (v17.7) a posicao vem pela propriedade translate (hud.js), a partir do canto */
  position: absolute; left: 0; top: 0; transform: translate(-50%, -100%); max-width: 220px; pointer-events: none; z-index: 2;
  background: #fdf6e6f2; color: #2a1d10; font: 600 12px/1.3 "Trebuchet MS", sans-serif; padding: 5px 9px;
  border-radius: 8px; box-shadow: 0 2px 8px #0009; border: 1px solid #b89a63; word-wrap: break-word; text-align: center;
}
.bubble::after {
  content: ''; position: absolute; left: 50%; bottom: -7px; transform: translateX(-50%);
  border: 7px solid transparent; border-bottom: 0; border-top-color: #fdf6e6f2;
}
/* fala de NPC so para o jogador (resposta de quest, loja...): pergaminho dourado, um pouco maior */
.bubble.npc-say { max-width: 260px; background: #2a1d10f2; color: #ffe9b8; border-color: #d6b26a; font-size: 12.5px; }
.bubble.npc-say::after { border-top-color: #2a1d10f2; }
/* (v10.1) NPC: nome dourado numa etiqueta preta arredondada (a funcao embaixo, menor, dentro da mesma etiqueta) */
.overhead.npc .oh-name { display: inline-block; color: #ffd76a !important; font-size: 11px; line-height: 1.25; text-shadow: 0 1px 1px #000;
  background: rgba(0, 0, 0, .82); padding: 2px 10px 3px; border-radius: 999px; box-shadow: 0 1px 3px rgba(0, 0, 0, .5); }
.overhead.npc .oh-name[data-role]:not([data-role=""]) { border-radius: 10px; }
.overhead.npc .oh-name::after { content: attr(data-role); display: block; font: 600 9px "Trebuchet MS", sans-serif; letter-spacing: 0; color: #cfc3a8; }
.overhead.npc .oh-name[data-role=""]::after { display: none; }
.overhead.npc .bar { display: none; }
/* (v15.91) NPC de entrada da quest: rodada ao vivo e a recomendacao para o heroi, em duas pilulas embaixo do nome */
.overhead .oh-quest { display: flex; flex-direction: column; align-items: center; gap: 2px; margin-top: 2px; font: 700 10px "Trebuchet MS", sans-serif; text-shadow: 0 1px 1px #000; white-space: nowrap; }
.overhead .oh-quest span { padding: 1px 8px; border-radius: 999px; background: rgba(0, 0, 0, .78); }
.overhead .oh-quest span[hidden] { display: none; }
.overhead .oq-time { color: #f3e3bd; font-variant-numeric: tabular-nums; }
.overhead .oq-time.late { color: #ffb15c; }
.overhead .oq-verd.ok { color: #7dff8a; box-shadow: inset 0 0 0 1px rgba(125, 255, 138, .45); }
.overhead .oq-verd.warn { color: #ffd24a; box-shadow: inset 0 0 0 1px rgba(255, 210, 74, .45); }
.overhead .oq-verd.bad { color: #ff6a5a; box-shadow: inset 0 0 0 1px rgba(255, 106, 90, .45); }
.overhead .oq-verd.off { color: #b9b0a0; }
/* (v16.1) quest ocupada: lider de quem esta la dentro (vermelho) ou o seu grupo (verde) */
.overhead .oq-occ.bad { color: #ff8a6a; box-shadow: inset 0 0 0 1px rgba(255, 138, 106, .5); }
.overhead .oq-occ.ok { color: #7dff8a; }

/* ---------- janela de NPC (loja / guarda carga) ---------- */
#npc-panel { left: 50%; top: 110px; transform: translateX(-50%); width: 380px; z-index: 9; }
#npc-title { pointer-events: none; }
.npc-sub { font-size: 11px; color: var(--muted); margin-bottom: 6px; }
.npc-grid { grid-template-columns: repeat(8, 1fr); max-height: 210px; overflow: auto; margin-bottom: 6px; }
.npc-label { font: 700 11px Cinzel, serif; color: var(--gold); margin: 4px 0; }
.inv-slot .pr { position: absolute; left: 1px; right: 1px; bottom: 1px; font: 700 8px sans-serif; color: #ffe27a; text-shadow: 0 0 2px #000; text-align: center; }
.inv-slot.cant { opacity: .45; }

@media (max-width: 900px) {
  :root { --equip-w: 240px; }
  #skill-panel { top: auto; bottom: 200px; width: 240px; max-height: 30vh; }
  #picker { left: 10px; top: 54px; width: calc(100vw - 20px); }
  .top-actions { display: none; }
}

/* slots 1 e 2 da barra: pocao de HP e de MP (icone do item + quantidade) */
.hud-slot.potion { background-repeat: no-repeat; }
.hud-slot.potion:not(.filled) { opacity: .45; }
/* quantidade no canto de cima (o numero da tecla fica embaixo, sem sobrepor) */
.hud-slot.potion .qty { position: absolute; left: 1px; top: 0; min-width: 12px; padding: 0 2px; border-radius: 2px; font: 800 9px Inter, sans-serif; line-height: 12px; color: #fff; background: rgba(10, 6, 3, .75); text-shadow: 0 1px 1px #000; pointer-events: none; }
/* recarga em relogio: segundos que faltam no centro do slot */
.hud-slot .cd { display: grid; place-items: center; font: 800 13px Inter, sans-serif; color: #fff4cf; text-shadow: 0 0 3px #000, 0 1px 2px #000, 0 0 8px rgba(255, 180, 60, .6); }
.pt-anchor { margin-left: 4px; padding: 0 4px; border-radius: 3px; font-size: 10px; color: #9fd8ff; background: rgba(60, 120, 180, .35); } /* v9.4 */
