:root {
  --glass: rgba(22, 24, 42, 0.86);
  --glass-2: rgba(36, 38, 62, 0.9);
  --line: rgba(255, 255, 255, 0.1);
  --text: #eceaf6;
  --muted: #a9a6c2;
  --gold: #ffd34d;
  --accent: #9b8cff;
  --hp: #5fd38a;
  --xp: #8fb4ff;
  --r-common: #c9ccd3;
  --r-uncommon: #7bd88f;
  --r-rare: #5fa8ff;
  --r-epic: #b77cff;
  --r-legendary: #ffa53d;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #1b1d2e; color: var(--text); font-family: Nunito, system-ui, sans-serif; user-select: none; }
canvas#game { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; cursor: crosshair; }
.hidden { display: none !important; }
button { font-family: inherit; }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; }
#hud > * { pointer-events: auto; }
#hud-player { position: absolute; left: 16px; top: 16px; display: flex; gap: 12px; align-items: center; padding: 10px 14px 10px 10px; background: var(--glass); border: 1px solid var(--line); border-radius: 18px; backdrop-filter: blur(6px); }
.portrait { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; font-size: 28px; cursor: pointer;
  background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--cc) 70%, white), var(--cc)); box-shadow: inset 0 -4px 0 rgba(0,0,0,.18); }
.bars { width: 240px; }
.name-row { display: flex; justify-content: space-between; font-weight: 800; font-size: 14px; margin-bottom: 5px; }
.name-row #hud-level { color: var(--gold); }
.bar { position: relative; height: 16px; border-radius: 8px; background: rgba(0,0,0,.4); overflow: hidden; margin-top: 4px; }
.bar.xp { height: 9px; }
.bar .fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 8px; transition: width .15s; }
.bar.hp .fill { background: linear-gradient(180deg, #7ff0a6, #3fb46a); }
.bar.hp .fill.shield { background: rgba(255, 233, 160, .75); height: 4px; top: 0; bottom: auto; }
.bar.xp .fill { background: linear-gradient(180deg, #b5ccff, #6b8fe8); }
.bar span { position: absolute; inset: 0; display: grid; place-items: center; font-size: 11px; font-weight: 800; text-shadow: 0 1px 2px rgba(0,0,0,.7); }
.bar.xp span { font-size: 0; }
.bar.xp:hover span { font-size: 9px; }
#hud-gold { position: absolute; left: 16px; top: 104px; display: flex; gap: 8px; font-weight: 800; }
#hud-gold > span { background: var(--glass); border: 1px solid var(--line); padding: 5px 12px; border-radius: 12px; font-size: 14px; }
#hud-gold .pts { color: #1d1a05; background: var(--gold); cursor: pointer; animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { transform: scale(1.06); } }

#hud-zone { position: absolute; right: 16px; top: 16px; padding: 10px; background: var(--glass); border: 1px solid var(--line); border-radius: 18px; text-align: center; }
#zone-name { font-family: Cinzel, serif; font-weight: 800; font-size: 14px; letter-spacing: .5px; margin-bottom: 8px; color: #f3e8c8; }
#minimap { display: block; width: 200px; height: 140px; border-radius: 12px; background: rgba(0,0,0,.25); }
.menu-btns { display: flex; gap: 6px; justify-content: center; margin-top: 8px; }
.menu-btns button { width: 40px; height: 34px; border-radius: 10px; border: 1px solid var(--line); background: var(--glass-2); color: white; font-size: 17px; cursor: pointer; }
.menu-btns button:hover { background: #3c3f68; }

#boss-bar { position: absolute; top: 18px; left: 50%; transform: translateX(-50%); width: min(460px, 50vw); text-align: center; }
#boss-name { font-family: Cinzel, serif; font-weight: 800; font-size: 15px; color: #ffd6cc; text-shadow: 0 2px 6px rgba(0,0,0,.7); margin-bottom: 4px; }
#boss-bar .bar { height: 12px; border: 1px solid rgba(255,255,255,.2); }
#boss-bar .fill { background: linear-gradient(180deg, #ff8a7a, #d9473b); }

#arena-banner { position: absolute; top: 22%; left: 50%; transform: translateX(-50%); font-family: Cinzel, serif; font-weight: 800; font-size: 34px; color: #fff3d0;
  text-shadow: 0 3px 14px rgba(0,0,0,.65); pointer-events: none !important; white-space: nowrap; }

#skillbar { position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%); display: flex; gap: 8px; padding: 8px; background: var(--glass); border: 1px solid var(--line); border-radius: 20px; }
.slot { --p: 0; position: relative; width: 56px; height: 56px; border-radius: 14px; background: linear-gradient(180deg, #3a3d63, #2a2c4a); border: 1px solid rgba(255,255,255,.12); display: grid; place-items: center; overflow: hidden; }
.slot .icon { font-size: 26px; filter: drop-shadow(0 2px 2px rgba(0,0,0,.4)); }
/* arte própria nas habilidades: a imagem já traz a moldura da classe */
.slot.art { background: none; border: 0; overflow: visible; box-shadow: none; }
.slot.art .icon { position: absolute; inset: -2px; font-size: 0; filter: none; }
img.art { width: 100%; height: 100%; object-fit: contain; display: block; pointer-events: none; filter: drop-shadow(0 2px 3px rgba(0,0,0,.55)); }
.slot.art .cd { inset: 4px; border-radius: 12%; }
.slot.art.cooling .icon img { filter: saturate(.5) brightness(.75) drop-shadow(0 2px 3px rgba(0,0,0,.55)); }
.slot.art.empty .icon img { filter: grayscale(1) brightness(.6); }
img.tt-ic { width: 22px; height: 22px; vertical-align: -5px; margin-right: 4px; }
img.cc-sk { width: 20px; height: 20px; vertical-align: -5px; }
.slot .key { position: absolute; left: 5px; top: 3px; font-size: 10px; font-weight: 900; color: var(--muted); }
.slot .cd { position: absolute; inset: 0; background: conic-gradient(rgba(10,10,25,.72) calc(var(--p) * 360deg), transparent 0); pointer-events: none; }
.slot .cdt { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 900; font-size: 18px; text-shadow: 0 1px 4px #000; pointer-events: none; }
.slot .count { position: absolute; right: 5px; bottom: 2px; font-size: 12px; font-weight: 900; }
.slot.empty .icon { opacity: .35; }
.slot.spirit { margin-left: 6px; background: linear-gradient(180deg, #2f3a5e, #23284a); }

.orb { --sc: #fff; display: inline-block; width: 26px; height: 26px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, white, var(--sc) 45%, color-mix(in srgb, var(--sc) 60%, black)); box-shadow: 0 0 14px var(--sc); }
.orb.big { width: 46px; height: 46px; flex: none; }

#log { position: absolute; left: 16px; bottom: 18px; width: 380px; display: flex; flex-direction: column; gap: 3px; pointer-events: none !important; }
.log-line { font-size: 13px; font-weight: 600; background: rgba(15,16,30,.55); padding: 4px 10px; border-radius: 8px; width: fit-content; max-width: 100%; transition: opacity 1s; text-shadow: 0 1px 2px #000; }
.log-line.fade { opacity: 0; }

#toast-layer { position: fixed; top: 14%; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; z-index: 30; }
.toast { background: var(--glass); border: 1px solid var(--line); padding: 10px 26px; border-radius: 16px; text-align: center; animation: pop .35s ease; transition: opacity .5s, transform .5s; }
.toast.gold { border-color: rgba(255, 211, 77, .5); box-shadow: 0 0 30px rgba(255, 211, 77, .2); }
.toast .t1 { font-family: Cinzel, serif; font-weight: 800; font-size: 22px; color: #fff1c4; }
.toast .t2 { font-size: 13px; color: var(--muted); margin-top: 2px; }
.toast.out { opacity: 0; transform: translateY(-10px); }
@keyframes pop { from { transform: scale(.85); opacity: 0; } }

/* ---------- painéis ---------- */
#panel-layer { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); display: flex; gap: 14px; align-items: flex-start; z-index: 20; max-width: calc(100vw - 24px); }
.panel { width: 360px; max-height: 78vh; display: flex; flex-direction: column; background: var(--glass); border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 20px 60px rgba(0,0,0,.45); backdrop-filter: blur(8px); animation: pop .2s ease; }
.panel header { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 8px; }
.panel h2 { margin: 0; font-family: Cinzel, serif; font-size: 18px; color: #f6ebc9; }
.panel h2 small { font-family: Nunito; font-size: 12px; color: var(--muted); margin-left: 6px; }
.panel h3 { font-size: 12px; text-transform: uppercase; letter-spacing: 1.2px; color: var(--muted); margin: 16px 0 8px; display: flex; justify-content: space-between; }
.panel .body { padding: 0 16px 16px; overflow-y: auto; }
.panel .x { width: 30px; height: 30px; border-radius: 10px; border: none; background: rgba(255,255,255,.08); color: var(--text); cursor: pointer; }
.panel .x:hover { background: rgba(255,255,255,.18); }
.pts { color: var(--gold); text-transform: none; letter-spacing: 0; }
.hint { font-size: 12px; color: var(--muted); margin: 6px 0; }
.npc-line { font-style: italic; color: #e8dcc0; font-size: 14px; margin: 0 0 12px; }
.empty-msg { color: var(--muted); font-size: 14px; }
.soon { font-size: 12px; color: #9fd0ff; text-align: center; margin-top: 14px; }

.cell { position: relative; width: 52px; height: 52px; border-radius: 12px; background: linear-gradient(180deg, #34375a, #26284426); border: 2px solid var(--rc, rgba(255,255,255,.08)); display: grid; place-items: center; cursor: pointer; }
.cell.empty { cursor: default; background: rgba(0,0,0,.2); border-color: rgba(255,255,255,.05); }
.cell.ghost { font-size: 22px; opacity: .3; }
.cell .ic { font-size: 24px; }
.cell .lv { position: absolute; right: 4px; bottom: 1px; font-size: 10px; font-weight: 900; color: var(--muted); }
.cell:not(.empty):hover { transform: translateY(-2px); }
.r-common { --rc: var(--r-common); }
.r-uncommon { --rc: var(--r-uncommon); }
.r-rare { --rc: var(--r-rare); box-shadow: 0 0 10px rgba(95,168,255,.3); }
.r-epic { --rc: var(--r-epic); box-shadow: 0 0 12px rgba(183,124,255,.4); }
.r-legendary { --rc: var(--r-legendary); box-shadow: 0 0 16px rgba(255,165,61,.5); }

.inv-grid { display: grid; grid-template-columns: repeat(6, 52px); gap: 6px; justify-content: center; }
.inv-foot { display: flex; gap: 12px; align-items: center; margin-top: 12px; font-weight: 800; font-size: 14px; flex-wrap: wrap; }
.inv-foot .hint { font-weight: 600; margin: 0; }
.row-btns { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

.char-head { display: flex; gap: 12px; align-items: center; }
.char-head .avatar { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; font-size: 28px; background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--cc) 70%, white), var(--cc)); }
.char-head .nm { font-weight: 900; font-size: 18px; }
.sub { font-size: 12px; color: var(--muted); }
/* grade única do equipamento: 4 por linha, linha incompleta centralizada (sem buraco para classes sem escudo) */
.equip-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 6px; margin-top: 14px; }
.equip-grid .eq-slot { flex: 0 0 calc(25% - 6px); min-width: 58px; }
.eq-slot .sub { font-size: 10px; line-height: 1.15; text-align: center; max-width: 84px; }
.eq-slot { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.eq-slot label { font-size: 11px; color: var(--muted); }
.stat-row { display: grid; grid-template-columns: 1fr 50px 30px; align-items: center; padding: 6px 10px; border-radius: 10px; background: rgba(255,255,255,.04); margin-bottom: 4px; font-size: 14px; }
.stat-row.prim .sn::after { content: ' ★'; color: var(--gold); }
.stat-row b { text-align: right; }
.plus { width: 24px; height: 24px; border-radius: 8px; border: none; background: var(--gold); color: #3a2e00; font-weight: 900; cursor: pointer; justify-self: end; }
.kv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; }
.kv { display: flex; justify-content: space-between; font-size: 13px; padding: 3px 0; border-bottom: 1px dashed rgba(255,255,255,.07); }
.kv span { color: var(--muted); }

.sp-list { display: flex; flex-direction: column; gap: 8px; }
.sp-card { display: flex; gap: 10px; align-items: center; padding: 10px; border-radius: 14px; background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.06); }
.sp-card.active { border-color: var(--sc); background: color-mix(in srgb, var(--sc) 12%, transparent); }
.sp-card .orb { --sc: inherit; }
.sp-info { flex: 1; min-width: 0; }
.sp-info .nm { font-weight: 900; }
.rar { font-size: 11px; color: var(--rc); margin-left: 4px; }
.sp-info .desc { font-size: 12px; color: #cfcbe6; margin-top: 3px; }
.mini-bar { height: 5px; border-radius: 3px; background: rgba(0,0,0,.4); margin-top: 4px; overflow: hidden; }
.mini-bar div { height: 100%; background: var(--sc); }
.sp-btns { display: flex; flex-direction: column; gap: 5px; align-items: stretch; }
.tag { font-size: 11px; font-weight: 900; color: var(--sc); text-align: center; padding: 4px; }

.shop-item { display: grid; grid-template-columns: 52px 1fr auto; gap: 10px; align-items: center; padding: 6px; border-radius: 12px; background: rgba(255,255,255,.03); margin-bottom: 6px; }
.shop-item .nm { font-weight: 800; font-size: 14px; }
.btn-col { display: flex; flex-direction: column; gap: 4px; }
.arena-badge { text-align: center; padding: 14px; border-radius: 16px; background: radial-gradient(circle at 50% 0%, color-mix(in srgb, var(--tc) 30%, transparent), rgba(255,255,255,.03)); border: 1px solid color-mix(in srgb, var(--tc) 40%, transparent); margin-bottom: 14px; }
.arena-badge .tier { font-family: Cinzel, serif; font-weight: 800; font-size: 24px; color: var(--tc); }
.arena-badge .rt { font-size: 30px; font-weight: 900; }
.arena-badge .wl { font-size: 12px; color: var(--muted); }
.sage-types { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 12px; }
.sage-type { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px; border-radius: 12px; background: rgba(255,255,255,.04); font-size: 13px; }
.sage-type span { font-size: 11px; color: var(--muted); }
.sage-type .orb { --sc: inherit; }

.btn { padding: 8px 14px; border-radius: 12px; border: 1px solid rgba(255,255,255,.14); background: #3a3d63; color: var(--text); font-weight: 800; cursor: pointer; transition: transform .1s, background .15s; }
.btn:hover { background: #4a4e7c; transform: translateY(-1px); }
.btn.small { padding: 6px 10px; font-size: 13px; }
.btn.primary { background: linear-gradient(180deg, #ffd96b, #f0b429); color: #3a2a00; border-color: #ffe9a8; }
.btn.primary:hover { background: linear-gradient(180deg, #ffe38e, #f5bf3f); }
.btn.ghost { background: transparent; }
.btn.big { padding: 14px 26px; font-size: 17px; }
.btn.wide { width: 100%; padding: 12px; font-size: 15px; margin-top: 4px; }

/* ---------- tooltip ---------- */
#tooltip { position: fixed; z-index: 50; max-width: 290px; padding: 10px 12px; border-radius: 12px; background: rgba(14,15,28,.96); border: 1px solid rgba(255,255,255,.14); font-size: 13px; pointer-events: none; box-shadow: 0 10px 30px rgba(0,0,0,.5); }
.tt-name { font-weight: 900; font-size: 15px; }
.tt-sub { color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.tt-stat { color: #d8f0ff; }
.tt-req { color: #ff8a80; margin-top: 4px; font-weight: 800; }
.tt-cmp { margin-top: 8px; padding-top: 6px; border-top: 1px solid rgba(255,255,255,.1); }
.tt-cmp .up { color: #7dff9b; }
.tt-cmp .down { color: #ff8a80; }
.tt-foot { margin-top: 6px; color: var(--gold); font-size: 12px; font-weight: 800; }

/* ---------- telas ---------- */
#screen { position: fixed; inset: 0; display: none; z-index: 40; }
#screen.visible { display: grid; place-items: center; background: radial-gradient(ellipse at center, rgba(20,22,40,.25), rgba(15,16,30,.75)); }
#screen.dim { background: rgba(12,12,24,.6); backdrop-filter: blur(3px); }
.title-wrap { text-align: center; animation: pop .5s ease; }
.logo span { display: block; font-family: Cinzel, serif; font-weight: 800; font-size: clamp(48px, 9vw, 104px); letter-spacing: 10px;
  background: linear-gradient(180deg, #fff6d8, #f0c75a 60%, #c98a2a); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 6px 20px rgba(0,0,0,.5)); }
.logo small { display: block; font-family: Cinzel, serif; font-size: 20px; letter-spacing: 8px; color: #e8e0ff; margin-top: -6px; }
.tagline { color: #eee8ff; font-size: 17px; text-shadow: 0 2px 6px #000; }
.title-actions { display: flex; flex-direction: column; gap: 10px; align-items: center; margin-top: 24px; }
.foot { margin-top: 40px; color: var(--muted); font-size: 12px; text-shadow: 0 1px 3px #000; }

.create-wrap { width: min(1080px, 94vw); text-align: center; padding: 26px; background: var(--glass); border-radius: 24px; border: 1px solid var(--line); animation: pop .3s ease; max-height: 94vh; overflow-y: auto; }
.create-wrap h1 { font-family: Cinzel, serif; margin: 0 0 18px; color: #f6ebc9; }
.class-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.class-card { --cc: #fff; text-align: left; padding: 16px; border-radius: 18px; border: 2px solid rgba(255,255,255,.08); background: rgba(255,255,255,.04); color: var(--text); cursor: pointer; transition: transform .15s, border-color .15s; }
.class-card:hover { transform: translateY(-3px); }
.class-card.sel { border-color: var(--cc); background: color-mix(in srgb, var(--cc) 16%, transparent); box-shadow: 0 0 30px color-mix(in srgb, var(--cc) 30%, transparent); }
.cc-icon { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; font-size: 26px; background: var(--cc); }
.cc-name { font-family: Cinzel, serif; font-weight: 800; font-size: 19px; margin: 10px 0 4px; }
.cc-desc { font-size: 13px; color: #d6d2ec; min-height: 54px; }
.cc-stat { font-size: 12px; color: var(--muted); margin: 8px 0; }
.cc-skills { display: flex; flex-direction: column; gap: 3px; font-size: 12px; }
.create-row { display: flex; gap: 10px; justify-content: center; margin: 22px 0 10px; flex-wrap: wrap; }
.create-row input { padding: 12px 16px; border-radius: 12px; border: 1px solid rgba(255,255,255,.18); background: rgba(0,0,0,.3); color: white; font: 700 16px Nunito, sans-serif; width: 260px; outline: none; }
.create-row input:focus { border-color: var(--gold); }
.warn { color: #ffb4a8; font-size: 13px; }

.result { text-align: center; padding: 28px 44px; background: var(--glass); border-radius: 24px; border: 1px solid var(--line); animation: pop .3s ease; min-width: 340px; }
.result h1 { font-family: Cinzel, serif; font-size: 40px; margin: 0; }
.result.win h1 { color: var(--gold); }
.result.lose h1 { color: #ff9f94; }
.result ul { list-style: none; padding: 0; margin: 18px 0 22px; font-size: 16px; line-height: 1.8; }

@media (max-width: 900px) {
  .class-grid { grid-template-columns: repeat(2, 1fr); }
  #log { display: none; }
}
@media (max-width: 900px) and (orientation: portrait) {
  #panel-layer { flex-direction: column; max-height: 90vh; overflow-y: auto; }
}

/* ---------- escala da interface e opções ---------- */
:root { --ui: 1; --tb: max(var(--ui), .8); } /* --tb: escala dos botões de toque; nunca abaixo de .8 para a habilidade (50 px) ficar com ≥ 40 px físicos */
#hud, #panel-layer { zoom: var(--ui); }
#panel-layer { max-width: calc((100vw - 24px) / var(--ui)); }
.panel { max-height: calc(78vh / var(--ui)); }
#boss-bar { width: min(460px, calc(50vw / var(--ui))); }
.opt-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 10px 0; flex-wrap: wrap; }
.opt-row > b { font-size: 14px; }
.seg { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.btn.sel { background: linear-gradient(180deg, #ffd96b, #f0b429); color: #3a2a00; border-color: #ffe9a8; }
.opt-val { min-width: 54px; text-align: center; font-weight: 900; }

/* ---------- celular e tablet ---------- */
html, body { -webkit-tap-highlight-color: transparent; -webkit-touch-callout: none; overscroll-behavior: none; touch-action: none; } /* none (não só manipulation): dois dedos em qualquer ponto não dão zoom/pinça no navegador */
canvas#game { touch-action: none; }
.touch-only { display: none; }
body.touch .menu-btns .touch-only { display: inline-block; }
.online-only { display: none; }
body.online .online-only { display: inline-block; }
.menu-btns { flex-wrap: wrap; }
#hud { z-index: 3; }
#touch { position: fixed; inset: 0; z-index: 2; pointer-events: none; touch-action: none; }
#stick-zone { position: absolute; left: 0; top: 24%; bottom: 0; width: 48%; pointer-events: auto; touch-action: none; }
#stick { position: fixed; width: 112px; height: 112px; margin: -56px 0 0 -56px; border-radius: 50%; border: 2px solid rgba(255,255,255,.35);
  background: rgba(255,255,255,.08); pointer-events: none; transform: scale(var(--ui)); }
#stick i { position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; margin: -26px 0 0 -26px; border-radius: 50%; background: rgba(255,255,255,.55); box-shadow: 0 2px 10px rgba(0,0,0,.4); }
#aim-arrow { position: fixed; width: 84px; height: 4px; margin-top: -2px; transform-origin: 0 50%; pointer-events: none; border-radius: 2px;
  background: linear-gradient(90deg, rgba(255,255,255,.1), rgba(255,255,255,.95)); z-index: 4; }
#tbtns { position: absolute; right: calc(10px + env(safe-area-inset-right, 0px)); bottom: calc(8px + env(safe-area-inset-bottom, 0px)); width: 236px; height: 214px;
  pointer-events: none; transform: scale(var(--tb)); transform-origin: 100% 100%; }
.tbtn { position: absolute; pointer-events: auto; touch-action: none; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #4a4e7c, #2a2c4a); border: 2px solid rgba(255,255,255,.28);
  box-shadow: 0 4px 14px rgba(0,0,0,.4); width: 62px; height: 62px; }
.tbtn .icon { font-size: 28px; }
.tbtn.down { filter: brightness(1.45); transform: scale(.93); }
.tbtn .cd { border-radius: 50%; }
/* habilidades e poção do toque: quadrado arredondado com a arte da classe (o ataque e a vila seguem redondos) */
.tbtn.sk, .tbtn.pot { background: none; border: 0; box-shadow: none; border-radius: 14%; overflow: visible; } /* overflow visível: a gema de categoria sai um pouco do canto sem ser cortada */
.tbtn.sk .icon, .tbtn.pot .icon { position: absolute; inset: -2px; font-size: 0; }
.tbtn.sk .cd, .tbtn.pot .cd { inset: 4px; border-radius: 12%; }
.tbtn.sk.down, .tbtn.pot.down { filter: brightness(1.3); }
.tbtn.pot.empty img { filter: grayscale(1) brightness(.6); }
.tbtn.atk { width: 88px; height: 88px; right: 0; bottom: 0; background: radial-gradient(circle at 35% 30%, #ff9a7a, #c9483f); }
.tbtn.atk .icon { font-size: 36px; }
/* ARCO em volta do ataque (centro a 44 px do canto, raio 108 px; botões ~20% menores que antes): s0 a 180° (esquerda), s1 a 150°, s2 a 120°, s3 (Maestria, um pouco maior) a 90° (em cima); poção embaixo à esquerda; interagir fora do arco, a 135° */
.tbtn.sk0 { right: 127px; bottom: 19px; }
.tbtn.sk1 { right: 112px; bottom: 73px; }
.tbtn.sk2 { right: 73px; bottom: 112px; }
.tbtn.sk3 { right: 17px; bottom: 125px; width: 54px; height: 54px; } /* Maestria (4ª habilidade); fica com cadeado até o nível 25 + missão */
.tbtn.sk0, .tbtn.sk1, .tbtn.sk2 { width: 50px; height: 50px; }
.tbtn.pot { width: 50px; height: 50px; right: 184px; bottom: 19px; }
.tbtn.pot .icon { font-size: 22px; }
/* botão de voltar à vila: medalhão pintado como moldura e a casa 3D recortada dentro (assets/icons/ui/home.webp?v=5c8c9f3f) */
.tbtn.home, .slot.medal { background: url(assets/ui/medal-normal.webp?v=5c8c9f3f) center / 100% 100% no-repeat; border: 0; border-radius: 50%; box-shadow: none; overflow: visible; }
.tbtn.home:active, .tbtn.home.down, .slot.medal:active { background-image: url(assets/ui/medal-pressed.webp?v=5c8c9f3f); }
.tbtn.home .icon, .slot.medal .icon { position: absolute; inset: 0; display: grid; place-items: center; font-size: 20px; }
.tbtn.home .icon img, .slot.medal .icon img { width: 70%; height: 70%; object-fit: contain; filter: drop-shadow(0 2px 2px rgba(0,0,0,.5)); pointer-events: none; }
.zone-ic { width: 40px; height: 40px; object-fit: contain; filter: drop-shadow(0 2px 2px rgba(0,0,0,.45)); }
.tbtn.act { width: 56px; height: 56px; right: 135px; bottom: 135px; background: radial-gradient(circle at 35% 30%, #ffe38e, #e0a82e); animation: pulse 1.4s infinite; }
body.touch #skillbar, body.touch #log { display: none; }
body.touch .btn.small { padding: 10px 14px; }
body.touch .plus { width: 36px; height: 36px; }
body.touch .panel .x { width: 40px; height: 40px; }
body.touch .menu-btns button { width: 44px; height: 40px; }

#rotate-hint { display: none; position: fixed; inset: 0; z-index: 100; place-items: center; text-align: center; background: rgba(15,16,30,.97); color: var(--text); font-weight: 800; font-size: 18px; }
#rotate-hint b { display: block; font-size: 72px; color: var(--gold); }
@media (orientation: portrait) and (pointer: coarse) { #rotate-hint { display: grid; } }

/* Celular deitado DENTRO do navegador (barra de endereço ocupa altura): ≤ 420 px de altura.
   Minimapa menor, botões de toque menores e sem sobrepor o minimapa; tudo continua respeitando a escala da interface (--ui). */
@media (max-height: 420px) {
  #minimap { width: 96px; height: 64px; }
  #zone-name { font-size: 10px; margin-bottom: 3px; }
  #hud-zone { padding: 5px; }
  .bars { width: 128px; }
  #hud-gold { top: 62px; }
  #stick { transform: scale(calc(var(--ui) * .85)); }
  #boss-bar { width: min(260px, calc(34vw / var(--ui))); }
}
/* Muito baixa (≤ 360 px): o minimapa continua visível, só menor (pedido do proprietário: "o minimapa não mostra?"); os botões de toque encolhem um pouco,
   mas nunca abaixo de 44 px (alvo mínimo de toque): os pequenos crescem antes de encolher. */
@media (max-height: 360px) {
  #minimap { width: 84px; height: 56px; }
  .portrait { width: 34px; height: 34px; font-size: 17px; }
  #hud-gold { top: 54px; }
}

/* Celular na horizontal (pouca altura): HUD compacta, painéis lado a lado. */
@media (max-height: 520px) {
  #hud-player { left: calc(8px + env(safe-area-inset-left, 0px)); top: 8px; padding: 6px 10px 6px 6px; gap: 8px; border-radius: 14px; }
  .portrait { width: 40px; height: 40px; font-size: 20px; border-radius: 12px; }
  .bars { width: 150px; }
  .name-row { font-size: 12px; margin-bottom: 2px; }
  .bar { height: 12px; margin-top: 3px; }
  .bar span { font-size: 9px; }
  #hud-gold { left: calc(8px + env(safe-area-inset-left, 0px)); top: 70px; }
  #hud-gold > span { font-size: 12px; padding: 3px 9px; }
  #hud-zone { right: calc(8px + env(safe-area-inset-right, 0px)); top: 8px; padding: 6px; border-radius: 14px; }
  #zone-name { font-size: 11px; margin-bottom: 4px; }
  #minimap { width: 120px; height: 84px; margin: 0 auto; }
  .menu-btns { gap: 4px; margin-top: 5px; flex-wrap: wrap; }
  .menu-btns button { width: 30px; height: 28px; font-size: 13px; }
  body.touch .menu-btns button { width: 36px; height: 34px; }
  #boss-bar { top: 8px; width: min(320px, calc(36vw / var(--ui))); }
  #boss-name { font-size: 12px; margin-bottom: 2px; }
  #arena-banner { font-size: 22px; top: 16%; }
  #skillbar { bottom: 8px; gap: 5px; padding: 5px; border-radius: 16px; }
  #skillbar .slot { width: 44px; height: 44px; border-radius: 12px; }
  #skillbar .slot .icon { font-size: 20px; }
  #toast-layer { top: 10%; }
  .toast { padding: 6px 16px; }
  .toast .t1 { font-size: 16px; }
  #log { bottom: 8px; width: 300px; }
  #panel-layer { flex-direction: row; max-height: 94vh; gap: 8px; }
  .panel { width: min(340px, calc(47vw / var(--ui))); max-height: calc(88vh / var(--ui)); border-radius: 16px; }
  .panel header { padding: 10px 12px 4px; }
  .panel .body { padding: 0 12px 12px; touch-action: pan-y; }
  .create-wrap { padding: 12px; max-height: 96vh; touch-action: pan-y; }
  .create-wrap h1 { font-size: 20px; margin: 0 0 8px; }
  .class-grid { grid-template-columns: repeat(4, 1fr); gap: 8px; }
  .class-card { padding: 8px; border-radius: 14px; }
  .cc-icon { width: 34px; height: 34px; font-size: 18px; }
  .cc-name { font-size: 15px; margin: 6px 0 2px; }
  .cc-desc { font-size: 11px; min-height: 0; }
  .cc-stat { font-size: 10px; margin: 4px 0; }
  .cc-skills { font-size: 10px; }
  .create-row { margin: 10px 0 6px; }
  .btn.big { padding: 10px 20px; font-size: 15px; }
  .logo span { font-size: clamp(36px, 14vh, 72px); }
  .tagline { font-size: 14px; }
  .title-actions { margin-top: 12px; }
  .foot { margin-top: 14px; }
  .result { padding: 16px 28px; min-width: 280px; }
  .result h1 { font-size: 28px; }
  .result ul { margin: 8px 0 12px; line-height: 1.5; }
}

/* Conta e personagens (modo online) */
.auth-form { display: grid; gap: 10px; width: min(340px, 88vw); margin: 18px auto 0; }
.auth-form input { background: rgba(20,24,40,.85); color: var(--text, #f3e8c8); border: 1px solid rgba(255,255,255,.18); border-radius: 12px; padding: 12px 14px; font: inherit; font-size: 16px; }
.auth-form input:focus { outline: 2px solid #ffcf4a; outline-offset: 1px; }
.auth-err { color: #ffb4a8; font-size: 13px; margin: 0; text-shadow: 0 1px 3px #000; }
.google-btn { display: flex; justify-content: center; min-height: 44px; }
.recovery-codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; width: min(360px, 90vw); margin: 16px auto; }
.recovery-codes code { background: rgba(20,24,40,.9); border: 1px dashed #ffcf4a; border-radius: 10px; padding: 8px; font-size: 15px; letter-spacing: .06em; user-select: all; }
.char-list { display: grid; gap: 10px; width: min(460px, 92vw); margin: 14px auto; }
.char-card { display: flex; gap: 8px; align-items: stretch; }
.char-pick { flex: 1; display: grid; grid-template-columns: 44px 1fr; grid-template-rows: auto auto; column-gap: 12px; align-items: center; text-align: left; background: rgba(28,32,52,.92); border: 2px solid var(--cc, #999); border-radius: 14px; color: inherit; padding: 10px 14px; cursor: pointer; font: inherit; }
.char-pick .cc-icon { grid-row: span 2; font-size: 30px; }
.char-pick .cc-name { font-weight: 800; }
.char-pick .cc-desc { font-size: 12px; opacity: .8; }
.char-pick:hover, .char-pick:focus-visible { filter: brightness(1.15); outline: none; }

/* Missões, diário e mapa (P8) */
.qlist { list-style: none; margin: 6px 0; padding: 0; display: grid; gap: 3px; font-size: 13px; }
.qlist li { opacity: .92; } .qlist li.done { color: #9be8b0; } .qlist li b { margin-left: 4px; }
.map-link { text-align: center; color: var(--muted, #9aa3b8); font-size: 12px; margin: 2px 0; }
.shop-item.locked { opacity: .6; } .shop-item.sel { outline: 2px solid #ffcf4a; border-radius: 12px; }

/* ---- Celular deitado (pouca altura): só o MINIMAPA no canto (sem painel, nome da zona nem moldura) e os ícones do menu numa fileira SEMPRE visível ao lado dele.
   Provisório: o desenho final dessa área é da B1/B5 (decisão do proprietário). Fica NO FIM do arquivo para vencer as regras de tamanho acima. ---- */
@media (max-height: 520px) {
  body.touch #hud-zone { background: none; box-shadow: none; padding: 0; border-radius: 10px; }
  body.touch #zone-name { display: none; }
  body.touch #minimap { display: block; width: 104px; height: 70px; margin: 0; border-radius: 10px; box-shadow: 0 0 0 2px rgba(20,26,46,.9), 0 0 0 3px rgba(255,207,74,.55), 0 4px 10px rgba(0,0,0,.4); }
  body.touch .menu-btns { position: fixed; top: 8px; right: calc(8px + 104px + 12px + env(safe-area-inset-right, 0px)); display: flex; flex-wrap: nowrap; gap: 5px; margin: 0; }
  body.touch .menu-btns button { width: 36px; height: 36px; font-size: 16px; border-radius: 12px; }
}
@media (max-height: 360px) { body.touch #minimap { width: 88px; height: 58px; } body.touch .menu-btns { right: calc(8px + 88px + 12px + env(safe-area-inset-right, 0px)); } }
@media (max-height: 320px) { body.touch #minimap { width: 76px; height: 50px; } body.touch .menu-btns { right: calc(8px + 76px + 12px + env(safe-area-inset-right, 0px)); } }
@media (display-mode: fullscreen), (display-mode: standalone) { .menu-btns [data-action="fullscreen"] { display: none; } }

/* ---- categorias das habilidades: cor + FORMA (dano ■ vermelho · cura ● verde · reforço ▲ dourado · controle ◆ roxo) e estado indisponível ---- */
.cat { position: absolute; right: -4px; top: -4px; width: 12px; height: 12px; z-index: 2; pointer-events: none; box-shadow: 0 0 0 1.5px rgba(10,12,28,.9); }
.cat-dano { background: #ff5a5a; border-radius: 2px; }
.cat-cura { background: #3fcf7a; border-radius: 50%; }
.cat-buff { background: #ffc233; clip-path: polygon(50% 0, 100% 100%, 0 100%); box-shadow: none; }
.cat-controle { background: #b77cff; transform: rotate(45deg) scale(.8); border-radius: 2px; }
.tt-cat { font-weight: 800; } .tt-cat.cat-dano { color: #ff8a8a; } .tt-cat.cat-cura { color: #6fe8a0; } .tt-cat.cat-buff { color: #ffd45e; } .tt-cat.cat-controle { color: #cfa6ff; }
.tt-cat { background: none; position: static; width: auto; height: auto; transform: none; clip-path: none; box-shadow: none; }
.slot.art.blocked .icon img, .tbtn.sk.blocked .icon img { filter: grayscale(1) brightness(.55); }
.slot.art.blocked::after, .tbtn.sk.blocked::after { content: '✕'; position: absolute; inset: 0; display: grid; place-items: center; color: rgba(255,120,120,.85); font: 900 22px Nunito, sans-serif; text-shadow: 0 1px 4px #000; pointer-events: none; z-index: 3; }

/* ---- ataque básico com arte própria por classe (emblema redondo; o recarga cônica continua por cima) ---- */
.tbtn.atk { background: none; border: 0; box-shadow: none; }
.tbtn.atk .icon { position: absolute; inset: -3px; font-size: 0; }
.tbtn.atk.down { filter: brightness(1.25); }
.slot.art .icon img.art[src*="/attack/"] { border-radius: 50%; }

/* =====================================================================================================================================
   HUD PINTADO (B5): cartão do herói + vidros de poção, minimapa redondo de runas e medalhões de menu — peças aprovadas em public/assets/ui.
   Só muda a "pele": ids, data-action e a lógica de updateHud continuam iguais. FICA NO FIM do arquivo de propósito (vence as regras de tamanho acima).
   ===================================================================================================================================== */
:root { --card-w: 150px; --map: 124px; }
@media (max-height: 520px) { :root { --card-w: 128px; --map: 104px; } }
@media (max-height: 420px) { :root { --card-w: 120px; --map: 96px; } }
@media (max-height: 360px) { :root { --card-w: 112px; --map: 104px; } }
@media (max-height: 320px) { :root { --card-w: 100px; --map: 96px; } }

/* cartão do herói: moldura de bronze com 4 gemas; o retrato entra no vão escuro (10%,15,4% · 44,3%×69%) e os dois tubos saem pela direita */
#hud-player { left: calc(8px + env(safe-area-inset-left, 0px)); top: 8px; width: var(--card-w); height: calc(var(--card-w) * .637); padding: 0; gap: 0; display: block; background: url(assets/ui/hero-card.webp?v=5c8c9f3f) center/100% 100% no-repeat; border: 0; border-radius: 0; box-shadow: none; filter: drop-shadow(0 3px 4px rgba(0,0,0,.5)); }
#hud-player .portrait { position: absolute; left: 10%; top: 15.4%; width: 44.3%; height: 69%; border-radius: 6px; background: #141a28; box-shadow: none; border: 0; font-size: 0; overflow: hidden; display: grid; place-items: center; z-index: 2; }
#hud-player .portrait img { width: 96%; height: 96%; object-fit: contain; filter: none; }
#hud-player .bars { display: contents; }
#hud-player .name-row { display: contents; }
#hud-name { position: absolute; left: 40%; top: 1%; max-width: 135%; font: 800 10px Nunito, sans-serif; color: #fff6d6; text-shadow: 0 1px 2px #000, 0 0 4px #000; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#hud-player .name-row #hud-level, #hud-level { position: absolute; left: 1%; bottom: -8%; min-width: 22px; height: 20px; padding: 0 6px; display: grid; place-items: center; z-index: 3; border-radius: 10px; font: 900 11px Nunito, sans-serif; color: #3a2600; background: radial-gradient(circle at 35% 30%, #fff0a6, #c98f12); box-shadow: 0 0 0 1.5px #8a5d08, 0 2px 4px rgba(0,0,0,.45); }
/* vidros de poção: tubo vazio por baixo; o líquido (vida vermelha, XP dourado: nunca azul, o jogo não tem mana) só aparece até a fração --v (11,9%–84% da peça = parte de vidro) */
#hud-player .bar { position: absolute; left: 38.7%; width: 135.5%; height: auto; aspect-ratio: 520 / 117; margin: 0; border-radius: 0; background: url(assets/ui/vial-empty.webp?v=5c8c9f3f) center/100% 100% no-repeat; overflow: visible; }
#hud-player .bar.hp { top: 16.5%; } #hud-player .bar.xp { top: 47%; height: auto; }
#hud-player .bar .fill { position: absolute; inset: 0; width: 100% !important; height: 100% !important; border-radius: 0; transition: clip-path .15s; clip-path: inset(0 calc(100% - (11.9% + var(--v, 1) * 72.1%)) 0 0); }
#hud-player .bar.hp .fill:not(.shield) { background: url(assets/ui/vial-hp.webp?v=5c8c9f3f) center/100% 100% no-repeat; }
#hud-player .bar.xp .fill { background: url(assets/ui/vial-xp.webp?v=5c8c9f3f) center/100% 100% no-repeat; }
#hud-player .bar.hp .fill.shield { inset: auto; left: 11.9%; top: 26%; height: 5px !important; width: calc(var(--s, 0) * 72.1%) !important; clip-path: none; background: rgba(255,226,120,.9); border-radius: 3px; box-shadow: 0 0 4px rgba(255,200,60,.8); }
#hud-player .bar span { left: 12%; right: 16%; font: 900 10px Nunito, sans-serif; color: #fff; text-shadow: 0 1px 2px #000, 0 0 3px #000; z-index: 2; }
#hud-player .bar.xp span { font-size: 9px; }
#hud-gold { left: calc(8px + env(safe-area-inset-left, 0px)); top: calc(8px + var(--card-w) * .637 + 10px); }
#hud-gold > span { font-size: 12px; padding: 3px 10px; }

/* minimapa: anel pintado por cima de um canvas redondo (radar centrado no jogador); o vão do anel é 19,7%–80,4% */
#hud-zone { right: calc(8px + env(safe-area-inset-right, 0px)); top: 8px; width: var(--map); height: var(--map); padding: 0; background: none; border: 0; border-radius: 0; box-shadow: none; filter: drop-shadow(0 3px 4px rgba(0,0,0,.5)); }
#hud-zone::after { content: ''; position: absolute; inset: 0; background: url(assets/ui/minimap-ring.webp?v=5c8c9f3f) center/100% 100% no-repeat; pointer-events: none; z-index: 2; }
#hud-zone #minimap, body.touch #minimap { position: absolute; display: block; left: 19.7%; top: 19.4%; width: 60.7%; height: 61%; margin: 0; border-radius: 50%; background: rgba(20,30,40,.5); box-shadow: none; }
#zone-name { display: none; }
body:not(.touch) #zone-name { display: block; position: absolute; top: 100%; left: 50%; transform: translateX(-50%); margin: -2px 0 0; white-space: nowrap; font: 800 12px Cinzel, serif; color: #fff6d6; text-shadow: 0 1px 3px #000, 0 0 5px #000; }
body:not(.online) .menu-btns .online-only { display: none; } /* grupo só com conta (a regra de grade abaixo o reexibiria) */
/* medalhões de menu: fileira ao lado do minimapa (toque) ou sob ele (teclado e mouse) */
.menu-btns { position: absolute; top: calc(100% + 22px); right: 0; margin: 0; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; width: 250px; }
.menu-btns button, body.touch .menu-btns button { width: 40px; height: 40px; padding: 0; background: none; border: 0; border-radius: 50%; box-shadow: none; font-size: 0; display: grid; place-items: center; }
.menu-btns button img { width: 100%; height: 100%; object-fit: contain; display: block; pointer-events: none; filter: drop-shadow(0 2px 3px rgba(0,0,0,.5)); }
.menu-btns button:active img { filter: brightness(1.25) drop-shadow(0 2px 3px rgba(0,0,0,.5)); }
.menu-btns button.txt { background: url(assets/ui/medal-normal.webp?v=5c8c9f3f) center/100% 100% no-repeat; font-size: 17px; color: #fff0a6; }
body.touch .menu-btns { position: fixed; top: 8px; right: calc(8px + var(--map) + 8px + env(safe-area-inset-right, 0px)); width: auto; flex-wrap: nowrap; justify-content: flex-start; gap: 4px; }
@media (max-height: 420px) { .menu-btns button, body.touch .menu-btns button { width: 36px; height: 36px; } }
@media (max-height: 320px) { .menu-btns button, body.touch .menu-btns button { width: 34px; height: 34px; } }

/* ===== PAINÉIS PINTADOS (B5, parte 2): moldura em 9 fatias, botões, células de raridade, dica e faixa — só a "pele" mudou; marcação e ações iguais ===== */
.panel { --pb: 26px; background: none; border: var(--pb) solid transparent; border-image: url(assets/ui/panel-9.webp?v=5c8c9f3f) 135 134 131 135 fill / var(--pb) stretch; border-radius: 0; box-shadow: none; backdrop-filter: none; filter: drop-shadow(0 14px 22px rgba(0,0,0,.55)); }
.panel header { padding: 0 2px 6px; }
.panel h2 { color: #f6ebc9; text-shadow: 0 2px 0 #000b; letter-spacing: .6px; }
.panel .body { padding: 0 4px 4px; }
.panel .x { width: 36px; height: 36px; border-radius: 50%; border: 0; background: url(assets/ui/medal-normal.webp?v=5c8c9f3f) center / 100% 100% no-repeat; color: #f6ebc9; font-weight: 900; text-shadow: 0 1px 0 #000; }
.panel .x:hover { background: url(assets/ui/medal-normal.webp?v=5c8c9f3f) center / 100% 100% no-repeat; filter: brightness(1.2); }
.panel .x:active { background-image: url(assets/ui/medal-pressed.webp?v=5c8c9f3f); }
body.touch .panel .x { width: 42px; height: 42px; }

.btn { --bb: 14px; min-height: 36px; border: var(--bb) solid transparent; border-image: url(assets/ui/btn-normal.webp?v=5c8c9f3f) 80 fill / var(--bb) stretch; border-radius: 0; background: none; padding: 0 8px; margin: -4px 0; color: #f6ebc9; text-shadow: 0 2px 0 #000b; letter-spacing: .3px; transition: filter .1s, transform .1s; }
.btn:hover { background: none; filter: brightness(1.15); transform: none; }
.btn:active { border-image-source: url(assets/ui/btn-pressed.webp?v=5c8c9f3f); transform: translateY(1px); }
.btn.primary, .btn.sel { background: none; border-color: transparent; border-image-source: url(assets/ui/btn-primary.webp?v=5c8c9f3f); color: #fff6d6; }
.btn.primary:hover { background: none; }
.btn:disabled, .btn.disabled { border-image-source: url(assets/ui/btn-disabled.webp?v=5c8c9f3f); color: #a8a6a0; cursor: default; filter: none; }
.btn.ghost { border-image-source: url(assets/ui/btn-normal.webp?v=5c8c9f3f); opacity: .85; }
.btn.small { padding: 0 4px; min-height: 30px; --bb: 12px; }
.btn.big { padding: 0 18px; min-height: 46px; --bb: 16px; }
.btn.wide { padding: 0 8px; min-height: 44px; margin: 2px 0; }
body.touch .btn.small { padding: 0 6px; }

.cell { width: 54px; height: 54px; border: 0; border-radius: 0; box-shadow: none; background: url(assets/ui/rarity-0.webp?v=5c8c9f3f) center / 100% 100% no-repeat; }
.cell.r-uncommon { background-image: url(assets/ui/rarity-1.webp?v=5c8c9f3f); }
.cell.r-rare { background-image: url(assets/ui/rarity-4.webp?v=5c8c9f3f); box-shadow: none; }
.cell.r-epic { background-image: url(assets/ui/rarity-6.webp?v=5c8c9f3f); box-shadow: none; }
.cell.r-legendary { background-image: url(assets/ui/rarity-5.webp?v=5c8c9f3f); box-shadow: none; }
.cell.empty { background: url(assets/ui/rarity-0.webp?v=5c8c9f3f) center / 100% 100% no-repeat; opacity: .38; border: 0; }
.cell .ic { text-shadow: 0 1px 3px #000a; }

#tooltip { --tb: 22px; max-width: 300px; padding: 0; border: var(--tb) solid transparent; border-image: url(assets/ui/tip.webp?v=5c8c9f3f) 70 fill / var(--tb) stretch; border-radius: 0; background: none; box-shadow: none; filter: drop-shadow(0 8px 14px rgba(0,0,0,.5)); }
#arena-banner { background: url(assets/ui/banner.webp?v=5c8c9f3f) center / 100% 100% no-repeat; padding: .35em 1.6em; text-shadow: 0 2px 0 #000b; }
@media (max-height: 520px) { .panel { --pb: 20px; } .cell { width: 48px; height: 48px; } }
.inv-grid { grid-template-columns: repeat(6, minmax(0, 56px)); gap: 4px; }
.inv-grid .cell { width: 100%; height: auto; aspect-ratio: 1; }
.shop-item { grid-template-columns: 56px 1fr auto; }
.equip-grid .cell { margin: 0 auto; }
.char-head .avatar.art { background: none; border-radius: 0; width: 64px; height: 64px; overflow: visible; }
.char-head .avatar.art img { width: 100%; height: 100%; filter: drop-shadow(0 3px 4px rgba(0,0,0,.5)); }

/* ===== B5 parte 2b: criação de personagem, diálogo de NPC e barra do chefe pintados ===== */
.create-wrap { --pb: 30px; background: none; border: var(--pb) solid transparent; border-image: url(assets/ui/panel-9.webp?v=5c8c9f3f) 135 134 131 135 fill / var(--pb) stretch; border-radius: 0; padding: 4px 8px 8px; filter: drop-shadow(0 16px 28px rgba(0,0,0,.6)); }
.create-wrap h1 { text-shadow: 0 2px 0 #000b; letter-spacing: 1px; }
.class-card { background: rgba(8,10,26,.55); border: 2px solid rgba(201,162,74,.28); border-radius: 12px; }
.class-card.sel { border-color: color-mix(in srgb, var(--cc) 55%, #e8c46a); background: color-mix(in srgb, var(--cc) 20%, rgba(8,10,26,.6)); }
.cc-icon.art { background: none; border-radius: 0; width: 60px; height: 60px; font-size: 0; }
.cc-icon.art img { width: 100%; height: 100%; filter: drop-shadow(0 3px 4px rgba(0,0,0,.55)); }
.create-row input { background: rgba(8,10,26,.7); border: 2px solid rgba(201,162,74,.55); }
@media (max-height: 520px) { .create-wrap { --pb: 22px; } .cc-icon.art { width: 40px; height: 40px; } }

.npc-line { --db: 18px; margin: 0 0 10px; padding: 2px 6px; border: var(--db) solid transparent; border-image: url(assets/ui/dialog.webp?v=5c8c9f3f) 60 fill / var(--db) stretch; color: #3b2a14; font-style: italic; font-weight: 700; text-shadow: 0 1px 0 rgba(255,246,214,.5); }

#boss-bar { width: min(460px, 56vw); }
#boss-name { position: relative; margin: 0 auto 2px; padding: 5px 40px 7px; width: max-content; max-width: 100%; background: url(assets/ui/plaque.webp?v=5c8c9f3f) center / 100% 100% no-repeat; color: #fff0d6; text-shadow: 0 2px 0 #000b; }
#boss-bar .bar { height: 14px; border: 2px solid #c9a24a; border-radius: 8px; background: #2a0e12; box-shadow: 0 0 0 1px #4a2a18, 0 4px 10px rgba(0,0,0,.5); }
#boss-bar .fill { border-radius: 5px; background: linear-gradient(180deg, #ff9a88 0%, #d9473b 55%, #9c2a24 100%); }
/* retrato do chefe: recorte frontal do sprite pintado, em medalhão dourado à esquerda da barra */
#boss-portrait { --s: 58px; --cols: 5; --rows: 8; --ratio: 1.2; display: none; position: absolute; left: -34px; top: 6px; width: var(--s); height: var(--s); box-sizing: border-box; border-radius: 50%; border: 3px solid #c9a24a; background-color: #2a0e12; background-repeat: no-repeat; background-size: cover; background-position: center top; box-shadow: 0 0 0 1px #4a2a18, 0 4px 10px rgba(0,0,0,.55), inset 0 0 8px rgba(0,0,0,.6); z-index: 2; }
body.touch #boss-portrait { --s: 44px; left: -26px; top: 2px; }
.npc-line { border: 0; border-image: none; background: url(assets/ui/dialog.webp?v=5c8c9f3f) center / 100% 100% no-repeat; padding: 16px 18px 16px 21%; color: #f6ebc9; text-shadow: 0 2px 0 #000b; min-height: 74px; display: flex; align-items: center; }
body.touch #boss-bar { top: 54px; width: min(420px, 48vw); }
@media (max-height: 520px) {
  .create-wrap { padding: 0 6px 4px; }
  .create-wrap h1 { font-size: 18px; margin: 0 0 6px; }
  .class-card { padding: 6px 8px; }
  .cc-icon.art { width: 34px; height: 34px; } .cc-name { margin: 2px 0 1px; } .cc-desc { margin: 0; } .cc-stat { margin: 3px 0; }
  .create-row { margin: 6px 0 2px; gap: 8px; } .create-row input { padding: 6px 12px; width: 220px; }
  .create-wrap > .btn, .create-wrap .btn.ghost { margin: 0; }
}

/* o desfoque de fundo do HUD antigo aparecia como um retângulo translúcido atrás dos vidros de vida/XP (a arte pintada já tem forma própria) */
#hud-player, #hud-zone, #hud-zone .menu-btns, .menu-btns button, #boss-bar, #hud-level { backdrop-filter: none; -webkit-backdrop-filter: none; }

/* ícones de equipamento pintados dentro das células de raridade */
.cell .ic { display: grid; place-items: center; width: 100%; height: 100%; }
.cell .it-img { width: 84%; height: 84%; object-fit: contain; filter: drop-shadow(0 2px 2px rgba(0,0,0,.5)); pointer-events: none; }
.cell.ghost { opacity: .45; }
.shield-fb { position: relative; display: block; width: 100%; height: 100%; }
.shield-fb .it-img { width: 84%; height: 84%; }
.shield-fb i { position: absolute; right: 2px; bottom: 0; font-style: normal; font-size: 55%; filter: drop-shadow(0 1px 1px rgba(0,0,0,.7)); }
.cell.ghost .it-img { filter: grayscale(1) brightness(.7); }
.coin { width: 1.2em; height: 1.2em; object-fit: contain; vertical-align: -.26em; margin-right: .1em; filter: drop-shadow(0 1px 1px rgba(0,0,0,.5)); }
#hud-gold .coin { width: 1.35em; height: 1.35em; }

/* spirits pintados no lugar das esferas */
.sp-img { width: 30px; height: 30px; object-fit: contain; vertical-align: middle; filter: drop-shadow(0 2px 2px rgba(0,0,0,.45)); pointer-events: none; }
.sp-img.hud { width: 100%; height: 100%; padding: 4px; box-sizing: border-box; }
.sp-img.big { width: 58px; height: 58px; flex: none; }
.sage-type .sp-img { width: 34px; height: 34px; }
.npc-line { position: relative; }
.npc-emb { position: absolute; left: 3.2%; top: 50%; width: 15%; aspect-ratio: 3 / 4; transform: translateY(-50%); display: grid; place-items: center; pointer-events: none; }
.npc-emb img { width: 92%; height: 92%; object-fit: contain; filter: drop-shadow(0 2px 3px rgba(0,0,0,.6)); }
.result { --pb: 28px; background: none; border: var(--pb) solid transparent; border-image: url(assets/ui/panel-9.webp?v=5c8c9f3f) 135 134 131 135 fill / var(--pb) stretch; border-radius: 0; padding: 6px 24px 8px; filter: drop-shadow(0 16px 28px rgba(0,0,0,.6)); }
.result h1 { text-shadow: 0 2px 0 #000b; }
.result .sub { color: #cdd3ea; }
@media (max-height: 520px) { .result { --pb: 22px; padding: 0 14px 4px; } }

/* retratos pintados */
#hud-portrait img.por { width: 100%; height: 100%; object-fit: cover; object-position: 50% 14%; display: block; }
.npc-emb.por { width: 17%; aspect-ratio: 1; left: 2.8%; border-radius: 50%; overflow: hidden; background: radial-gradient(circle at 50% 35%, #34476e, #141a2e); }
.npc-emb.por img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 18%; filter: none; }
.char-head .avatar.art img.por { border-radius: 50%; object-fit: cover; object-position: 50% 14%; background: radial-gradient(circle at 50% 35%, #34476e, #141a2e); box-shadow: 0 0 0 2px #c9a24a; }
.cc-icon.art img.por { border-radius: 50%; object-fit: cover; object-position: 50% 14%; background: radial-gradient(circle at 50% 35%, #34476e, #141a2e); box-shadow: 0 0 0 2px #c9a24a; }

/* ===== B5 parte 2c: avisos, ouro e log pintados (sobras do estilo antigo: caixas escuras e fonte comum) ===== */
.toast { --tb: 20px; background: none; border: var(--tb) solid transparent; border-image: url(assets/ui/tip.webp?v=5c8c9f3f) 70 fill / var(--tb) stretch; border-radius: 0; padding: 0 10px; filter: drop-shadow(0 6px 10px rgba(0,0,0,.45)); box-shadow: none; }
.toast.gold { border-color: transparent; box-shadow: none; filter: drop-shadow(0 0 12px rgba(255,211,77,.45)) drop-shadow(0 6px 10px rgba(0,0,0,.45)); }
.toast .t1 { color: #fff0c8; text-shadow: 0 2px 0 #000b; }
.toast .t2 { color: #e6dcc0; font-family: Cinzel, serif; font-weight: 700; font-size: 12px; text-shadow: 0 1px 0 #000a; }
#hud-gold > span { --bb: 12px; background: none; border: var(--bb) solid transparent; border-image: url(assets/ui/btn-normal.webp?v=5c8c9f3f) 80 fill / var(--bb) stretch; border-radius: 0; padding: 0 6px; font: 800 13px Cinzel, serif; color: #f6ebc9; text-shadow: 0 2px 0 #000b; margin: -4px 0; }
#hud-gold .pts { border-image-source: url(assets/ui/btn-primary.webp?v=5c8c9f3f); color: #fff6d6; background: none; }
.log-line { --db: 12px; background: none; border: var(--db) solid transparent; border-image: url(assets/ui/tip.webp?v=5c8c9f3f) 70 fill / var(--db) stretch; border-radius: 0; padding: 0 4px; font: 700 12px Cinzel, serif; color: #f6ebc9; margin: -6px 0; }
/* a faixa da arena ("1×1 — começa em 3", "Lute!") ficava em cima da barra do rival: desce abaixo dela */
#arena-banner { top: 36%; }
@media (max-height: 520px) { #arena-banner { top: 38%; font-size: 20px; } }
/* retrato de NPC enquadrado no oval da faixa pintada (o oval é mais alto que largo): preenche toda a abertura, cabeça no topo */
.npc-emb.por { left: 4.4%; top: 50%; width: 14.4%; height: 76%; aspect-ratio: auto; transform: translateY(-50%); border-radius: 50%; overflow: hidden; background: radial-gradient(circle at 50% 30%, #3d5078, #141a2e); }
.npc-emb.por img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 6%; transform: scale(1.12); transform-origin: 50% 14%; }

/* janela só anima ao abrir (render() refaz o HTML a cada ação e antes isso "piscava") */
.panel { animation: none; }
.panel.fresh { animation: pop .2s ease; }
.plus-grp { display: inline-flex; gap: 4px; }
.plus-grp .plus { width: auto; min-width: 38px; height: 34px; padding: 0 8px; font-size: 13px; }
.sp-card .evo { font-size: 11px; color: #ffe08a; border: 1px solid #ffe08a88; border-radius: 8px; padding: 0 6px; margin: 0 6px; }
.tag.dim { opacity: .65; font-size: 11px; }

/* ---- Acabamento: cartões, títulos e campos dentro das janelas pintadas (antes: retângulos translúcidos arredondados e Nunito em caixa-alta) ---- */
.panel h3, .create-wrap h3, .opt-row > b, .panel .body > b { font: 700 14px Cinzel, serif; letter-spacing: .08em; text-transform: none; color: #ecd08e; text-shadow: 0 2px 0 #000a; }
.panel h3 { border-bottom: 1px solid transparent; border-image: linear-gradient(90deg, #c9a24a, rgba(201,162,74,0)) 1; padding-bottom: 4px; }
.sp-card, .shop-item, .stat-row, .class-card, .quest-card, .kv-grid, .opt-row { background: linear-gradient(180deg, rgba(58,42,26,.6), rgba(22,17,12,.62)); border: 1px solid rgba(201,162,74,.34); border-radius: 5px; box-shadow: inset 0 1px 0 rgba(255,235,180,.13), inset 0 -3px 8px rgba(0,0,0,.45), 0 2px 0 rgba(0,0,0,.45); }
.sp-card.active, .shop-item.sel, .class-card.sel { border-color: #e8c46a; background: linear-gradient(180deg, rgba(92,64,28,.65), rgba(34,24,14,.7)); box-shadow: inset 0 1px 0 rgba(255,235,180,.2), inset 0 -3px 8px rgba(0,0,0,.4), 0 0 14px rgba(232,196,106,.35); }
.sp-card { box-shadow: inset 4px 0 0 var(--sc, #c9a24a), inset 0 1px 0 rgba(255,235,180,.13), inset 0 -3px 8px rgba(0,0,0,.45), 0 2px 0 rgba(0,0,0,.45); }
.kv-grid { padding: 4px 10px; }
.create-wrap input { background: linear-gradient(180deg, #14100b, #261b11); border: 2px solid #8a6a38; border-radius: 5px; color: #f6ebc9; font: 700 18px Cinzel, serif; box-shadow: inset 0 3px 8px #000c, 0 1px 0 #e8c46a55; }
.create-wrap input::placeholder { color: #8d7a58; font-family: Cinzel, serif; }
.portal-label, .npc-name { font-family: Cinzel, serif; }

/* Habilidade ainda não aprendida: cadeado + nível (--lv é definido por touch.js / ui.js) */
/* filtro na <img> (não no contêiner: no Safari/iOS o filtro no span absoluto com font-size 0 sumia com a arte) + placa escura própria, para o botão nunca ficar só "cadeado flutuando" */
.slot.locked .icon, .tbtn.sk.locked .icon { filter: none; }
.slot.locked .icon img, .tbtn.sk.locked .icon img { filter: grayscale(1) brightness(.5); opacity: 1; visibility: visible; }
.tbtn.sk.locked { background: radial-gradient(circle at 50% 40%, #2a2630, #0e0c12 80%); border: 2px solid #5a4a30; box-shadow: inset 0 0 8px #000c, 0 2px 4px #0008; border-radius: 14%; }
.tbtn.sk.locked::after { background: rgba(8,6,12,.35); border-radius: 14%; }
.slot.locked::after, .tbtn.sk.locked::after { content: '🔒 Nv ' var(--lv); position: absolute; inset: 0; display: grid; place-items: center; text-align: center; white-space: pre-wrap; color: #ffe9a0; font: 900 11px Nunito, sans-serif; text-shadow: 0 1px 4px #000; pointer-events: none; z-index: 3; }
.tbtn.sk.locked { pointer-events: none; }
.cc-skills small { opacity: .7; font-size: .8em; }

/* ritual do chefe final: pílula pequena sob o minimapa */
#ritual { position: absolute; top: 148px; right: 14px; padding: 3px 12px; font: 700 12px Cinzel, serif; color: #ffd9a0; background: rgba(24,16,8,.8); border: 1px solid rgba(255,140,60,.6); border-radius: 12px; text-shadow: 0 1px 0 #000; pointer-events: none; z-index: 5; }

/* ---- Auditoria V1/V2/V3/V7: alvos de toque >= 44 px, atributos em duas linhas, spirits com botões em linha própria, barra do chefe fora do HUD ---- */
/* V1: nome+valor em cima; +1 +5 Máx embaixo (cada botão com área de toque de 44x44) */
.stat-row { grid-template-columns: 1fr auto; row-gap: 2px; }
.stat-row .plus-grp { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 8px; margin-top: 2px; }
.stat-row .plus-grp .plus, body.touch .plus { min-width: 44px; width: auto; height: 44px; padding: 0 12px; border-radius: 10px; }
.stat-row > i { display: none; }
/* V2: menu superior 44 px (8 botões cabem em 844x390: 8x44 + 7x4 = 380 px, ao lado do minimapa e abaixo da barra do chefe) */
.menu-btns button, body.touch .menu-btns button { width: 44px; height: 44px; }
@media (max-height: 420px) { .menu-btns button, body.touch .menu-btns button { width: 44px; height: 44px; } }
@media (max-height: 320px) { .menu-btns button, body.touch .menu-btns button { width: 44px; height: 44px; } }
/* V7: texto do spirit usa a largura toda; botões numa linha própria sob o texto */
.sp-card { flex-wrap: wrap; }
.sp-info { flex: 1 1 150px; }
.sp-btns { flex: 1 1 100%; flex-direction: row; flex-wrap: wrap; gap: 6px; }
.sp-btns .btn, .sp-btns .tag { flex: 1 1 0; min-width: 96px; min-height: 44px; display: grid; place-items: center; }
/* V3: barra do chefe abaixo da faixa do HUD (cartão do herói e frascos ocupam x<220, y<84; menu e minimapa à direita, y<56/84) */
@media (max-height: 520px) {
  #boss-bar, body.touch #boss-bar { top: 84px; width: min(340px, 46vw); }
  #boss-portrait, body.touch #boss-portrait { --s: 44px; left: -22px; top: 4px; }
}
/* Celular estreito (667 px): o retrato do chefe batia no botão "+N PONTOS" (x<220, y<130); desloca a barra para a direita, longe do minimapa (x>580) */
@media (max-height: 520px) and (max-width: 740px) {
  #boss-bar, body.touch #boss-bar { left: calc(50% + 46px); width: min(290px, 42vw); }
}

/* acabamento: botão Evoluir numa linha só; linha do pergaminho legível */
.sp-btns .btn { white-space: nowrap; }
.sp-btns .btn[data-action="spirit-evolve"] { flex: 2 1 0; min-width: 150px; }
.shop-item .sub { font-size: 12px; }
/* o grid empilhava texto, moeda e número em 3 linhas: em linha, centralizado */
.sp-btns .btn, .sp-btns .tag { display: flex; align-items: center; justify-content: center; gap: .3em; flex-wrap: nowrap; }

/* ===== Auditoria visual, média/baixa (V5–V30) ===== */
/* V6: botão de interagir (toque) no mesmo medalhão pintado dos outros; o ícone é pintado (baú ou pergaminho), sem disco amarelo */
.tbtn.act { width: 60px; height: 60px; background: url(assets/ui/medal-normal.webp?v=5c8c9f3f) center / 100% 100% no-repeat; border: 0; border-radius: 50%; box-shadow: none; animation: act-glow 1.4s ease-in-out infinite; }
.tbtn.act.down { background-image: url(assets/ui/medal-pressed.webp?v=5c8c9f3f); }
.tbtn.act .icon { position: absolute; inset: 0; display: grid; place-items: center; font-size: 0; }
.tbtn.act .icon img { width: 66%; height: 66%; object-fit: contain; filter: drop-shadow(0 2px 2px rgba(0,0,0,.5)); pointer-events: none; }
@keyframes act-glow { 50% { filter: drop-shadow(0 0 8px rgba(255,214,120,.9)) brightness(1.12); } }

/* V8: missão ativa no Diário: texto em largura total e botão Abandonar embaixo */
.shop-item.quest-card { display: flex; flex-direction: column; align-items: stretch; gap: 6px; padding: 8px 10px; }
.shop-item.quest-card .qtxt { min-width: 0; }
.shop-item.quest-card .btn { align-self: flex-end; min-width: 120px; min-height: 40px; }

/* V9: painéis de uma coluna só ficam mais largos em celular deitado, e Personagem/Opções se dividem em duas colunas (menos rolagem) */
.cols { display: block; }
@media (max-height: 520px) and (min-width: 700px) and (orientation: landscape) {
  #panel-layer .panel:only-child:is(.p-character, .p-options, .p-map, .p-journal, .p-spirits) { width: min(660px, calc(80vw / var(--ui))); }
  #panel-layer .panel:only-child:is(.p-character, .p-options) .cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; align-items: start; }
  #panel-layer .panel:only-child:is(.p-character, .p-options) .col > h3:first-child { margin-top: 4px; }
  .panel h3 { margin: 10px 0 6px; }
  .stat-row { padding: 4px 8px; margin-bottom: 3px; }
}

/* V10/V11: o aviso de zona fica por baixo dos painéis e desce abaixo da barra do chefe (classes alternadas por ui.js) */
#toast-layer { z-index: 15; }
body.boss-on #toast-layer { top: 38%; }
body.panel-open #toast-layer { top: 6%; }
@media (max-height: 520px) { body.boss-on #toast-layer { top: 40%; } }

/* V18: pílula do ritual com a moldura de metal da barra do chefe */
#ritual { top: calc(var(--map) + 30px); right: calc(8px + env(safe-area-inset-right, 0px)); padding: 5px 26px 7px; background: url(assets/ui/plaque.webp?v=5c8c9f3f) center / 100% 100% no-repeat; border: 0; border-radius: 0; color: #fff0d6; text-shadow: 0 2px 0 #000b; font-size: 12px; white-space: nowrap; }
body.touch #ritual { top: calc(var(--map) + 10px); }
body:not(.touch) #ritual { top: calc(var(--map) + 150px); }

/* V19: habilidade bloqueada (atordoado/morto) só escurece; o X vermelho lido como erro saiu */
.slot.art.blocked::after, .tbtn.sk.blocked::after { content: none; }
.slot.art.blocked .icon img, .tbtn.sk.blocked .icon img { filter: grayscale(.85) brightness(.5); }

/* V24: item opalino: moldura prateada (rarity-2, que sobrava) com brilho em arco-íris pulsando */
.cell.opal { background-image: url(assets/ui/rarity-2.webp?v=5c8c9f3f); animation: opal-pulse 2.8s linear infinite; }
.cell.opal::after { content: ''; position: absolute; inset: 6%; border-radius: 12px; pointer-events: none; mix-blend-mode: screen; opacity: .55;
  background: linear-gradient(115deg, rgba(255,120,200,.0) 10%, rgba(255,140,220,.7) 28%, rgba(120,230,255,.7) 46%, rgba(170,255,170,.7) 62%, rgba(255,230,130,.7) 78%, rgba(255,120,200,0) 92%); background-size: 220% 100%; animation: opal-sheen 3.4s ease-in-out infinite; }
@keyframes opal-pulse { 0%, 100% { filter: drop-shadow(0 0 5px rgba(255,150,230,.7)); } 33% { filter: drop-shadow(0 0 7px rgba(130,230,255,.8)); } 66% { filter: drop-shadow(0 0 6px rgba(190,255,170,.75)); } }
@keyframes opal-sheen { 0% { background-position: 120% 0; } 100% { background-position: -120% 0; } }
@media (prefers-reduced-motion: reduce) { .cell.opal, .cell.opal::after { animation: none; } }

/* V25: nome do item em Cinzel */
.tt-name { font-family: Cinzel, serif; font-weight: 800; letter-spacing: .02em; }
.tt-foot { font-family: Nunito, sans-serif; }

/* V26: subtítulos de cartão em Cinzel (classe, spirit, missão, loja) */
.char-head .nm, .sp-info .nm, .shop-item .nm, .quest-card .nm, .sage-type b, .arena-badge .tier { font-family: Cinzel, serif; font-weight: 700; letter-spacing: .02em; }
.char-head .nm { font-size: 17px; }

/* V27: nível do item numa plaquinha escura no canto da célula (legível sobre armas claras) */
.cell .lv { right: 3px; bottom: 3px; min-width: 15px; padding: 0 3px; line-height: 14px; text-align: center; font: 800 10px Nunito, sans-serif; color: #ffe9a8; background: rgba(14,10,6,.82); border: 1px solid rgba(201,162,74,.6); border-radius: 6px; z-index: 2; pointer-events: none; }

/* P1: tooltip de item lendario/opalino com comparacao passava da tela em paisagem baixa (390 px): fonte e espacos menores */
@media (max-height: 420px) { #tooltip { font-size: 11px; line-height: 1.2; max-width: 280px; } #tooltip > div { margin-top: 1px; margin-bottom: 1px; } #tooltip .tt-name { font-size: 14px; } }

/* Auditoria: diálogo com rodapé fixo (recompensa e botões sempre visíveis; só o texto rola) e sinais pintados nos painéis */
.p-dialog .body { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.dlg-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; touch-action: pan-y; }
@media (max-height: 520px) { .panel.p-dialog { max-height: calc((100vh - 92px) / var(--ui)); } } /* celular em paisagem: o painel nasce abaixo do menu; falas longas (mentores com habilidades) rolam dentro dele e o rodapé com os botões fica à vista */
.dlg-foot { flex: none; padding-top: 6px; border-top: 1px solid rgba(201,162,74,.35); }
.dlg-foot:empty { display: none; }
.cell .ic .ic-img { width: 78%; height: 78%; object-fit: contain; filter: drop-shadow(0 1px 2px rgba(0,0,0,.5)); }
.shop-item.locked .cell .ic-img { filter: grayscale(1) brightness(.7); opacity: .8; }

/* ===== Rodada de UI (2026-11-02): XP, ouro na mochila, selo +N, cartão de recompensa, mapa-múndi ===== */
/* barra de XP: frasco dourado com o rótulo sempre visível ("XP 12 / 40"); o nível fica no selo "Nv" */
#hud-player .bar.xp span { font-size: 9px; letter-spacing: .02em; }
.bar.xp span { font-size: 9px; }
/* ouro no rodapé da mochila: valor grande com a moeda pintada (não é item) */
.inv-foot { gap: 6px 14px; }
.inv-foot .inv-gold { display: inline-flex; align-items: center; gap: 6px; padding: 2px 12px 2px 8px; border-radius: 999px; background: rgba(0,0,0,.35); border: 1px solid rgba(201,162,74,.6); color: #ffe38e; font: 900 18px Cinzel, serif; }
.inv-foot .inv-gold .coin { width: 26px; height: 26px; margin: 0; }
.inv-foot .inv-res { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; }
.inv-foot .inv-res .coin { width: 22px; height: 22px; margin: 0; }
/* selo de aprimoramento: canto superior direito da célula */
.cell .plus-b { position: absolute; right: 2px; top: 2px; z-index: 3; min-width: 20px; padding: 0 4px; line-height: 15px; text-align: center; font: 900 11px Nunito, sans-serif; color: #3a2600; background: linear-gradient(180deg, #fff0a6, #e0a82e); border: 1px solid #8a5d08; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,.6); pointer-events: none; }
.cell .plus-b.hi { color: #fff; background: linear-gradient(180deg, #ffb24d, #e2631a); border-color: #7a2d05; }
.cell .plus-b.max { color: #fff; font-size: 9px; letter-spacing: .04em; background: linear-gradient(180deg, #ff6a5e, #b3201a); border-color: #5c0d09; box-shadow: 0 0 6px rgba(255,90,70,.8), 0 1px 3px rgba(0,0,0,.6); }
.tt-plus { color: #ffd34d; font-weight: 800; }
/* cartão de recompensa do baú: por cima de tudo (até dos painéis), uma de cada vez */
#reward-layer { position: fixed; left: 50%; top: 18%; transform: translateX(-50%); z-index: 70; display: flex; flex-direction: column; align-items: center; pointer-events: none; max-width: calc(100vw - 24px); }
.reward-card { min-width: 220px; max-width: 360px; padding: 10px 16px 12px; border-radius: 16px; background: rgba(18,14,10,.94); border: 2px solid #c9a24a; box-shadow: 0 0 22px rgba(255,211,77,.45), 0 8px 18px rgba(0,0,0,.6); text-align: left; animation: pop .3s ease; transition: opacity .35s, transform .35s; }
.reward-card.out { opacity: 0; transform: translateY(-8px); }
.reward-card .rw-t { font: 800 17px Cinzel, serif; color: #fff0c8; text-align: center; margin-bottom: 6px; text-shadow: 0 2px 0 #000b; }
.reward-card .rw-row { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.reward-card .rw-row .cell { flex: none; width: 48px; height: 48px; }
.reward-card .rw-coin .coin { width: 34px; height: 34px; margin: 0 7px; }
.reward-card .rw-nm { font: 800 15px Cinzel, serif; text-shadow: 0 1px 0 #000a; }
.reward-card .rw-sub { font-size: 12px; color: #d9cfb4; }
@media (max-height: 520px) { #reward-layer { top: 10%; } .reward-card { padding: 7px 12px 9px; } .reward-card .rw-t { font-size: 15px; } .reward-card .rw-nm { font-size: 14px; } .reward-card .rw-row .cell { width: 42px; height: 42px; } }
/* mapa-múndi: mini-mundo com nós ligados por caminhos */
.p-map { width: min(660px, calc(88vw / var(--ui))); }
.mp-world { position: relative; width: 100%; aspect-ratio: 3.4 / 1; margin-top: 4px; border-radius: 12px; overflow: hidden; background: radial-gradient(ellipse at 30% 40%, rgba(110,150,90,.28), transparent 60%), radial-gradient(ellipse at 80% 60%, rgba(150,200,230,.2), transparent 55%), radial-gradient(ellipse at 95% 30%, rgba(210,90,30,.25), transparent 45%), rgba(0,0,0,.28); box-shadow: inset 0 0 0 1px rgba(201,162,74,.35); }
.mp-paths { position: absolute; inset: 0; width: 100%; height: 100%; }
.mp-paths line { stroke: rgba(201,162,74,.28); stroke-width: 2.5; stroke-dasharray: 3 4; vector-effect: non-scaling-stroke; stroke-linecap: round; }
.mp-paths line.lit { stroke: #ffd96b; stroke-opacity: .85; }
.mp-paths line.dungeon { stroke: rgba(120,210,230,.4); stroke-dasharray: 2 6; }
.mp-paths line.dungeon.lit { stroke: #7fe0ea; stroke-opacity: .9; }
.mp-node.dungeon .mp-nm { color: #9fe8f2; }
.mp-node { position: absolute; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 1px; width: 92px; padding: 2px 0; background: none; border: 0; color: #f6ebc9; cursor: pointer; font-family: Nunito, sans-serif; }
.mp-ic { position: relative; width: 46px; height: 46px; display: grid; place-items: center; border-radius: 50%; background: url(assets/ui/medal-normal.webp?v=5c8c9f3f) center / 100% 100% no-repeat; }
.mp-ic .zone-ic { width: 30px; height: 30px; }
.mp-node.sel .mp-ic { filter: drop-shadow(0 0 7px #ffd34d) brightness(1.15); }
.mp-node.here .mp-ic { box-shadow: 0 0 0 2px #7dff9b; }
.mp-node.locked .zone-ic { filter: grayscale(1) brightness(.6); }
.mp-node.locked { opacity: .8; }
.mp-lock { position: absolute; right: -5px; bottom: -4px; width: 20px; height: 20px; }
.mp-lock img, .mp-pin img, .tag img, .mp-have img { width: 100%; height: 100%; object-fit: contain; vertical-align: middle; }
.mp-pin { position: absolute; top: -20px; left: 50%; width: 22px; height: 22px; margin-left: -11px; animation: mp-bob 1.2s ease-in-out infinite; filter: drop-shadow(0 2px 2px rgba(0,0,0,.6)); }
@keyframes mp-bob { 50% { transform: translateY(-4px); } }
.mp-nm { font: 700 11px Cinzel, serif; line-height: 1.1; text-align: center; text-shadow: 0 1px 0 #000, 0 0 4px #000; }
.mp-lv { font-size: 10px; color: #d9cfb4; text-shadow: 0 1px 2px #000; }
.mp-card { display: flex; align-items: center; gap: 10px; margin-top: 8px; padding: 8px 10px; border-radius: 12px; background: rgba(0,0,0,.3); box-shadow: inset 0 0 0 1px rgba(201,162,74,.35); }
.mp-card-ic .zone-ic { width: 44px; height: 44px; }
.mp-card-tx { flex: 1 1 auto; min-width: 0; }
.mp-card-tx .nm { font: 700 15px Cinzel, serif; color: #f6ebc9; }
.mp-card-tx .sub { font-size: 12px; color: var(--muted); }
.mp-card-act { flex: 0 1 auto; display: flex; flex-direction: column; align-items: stretch; gap: 3px; max-width: 46%; text-align: center; font-size: 12px; }
.mp-card-act .tag { display: inline-flex; align-items: center; gap: 4px; justify-content: center; }
.mp-card-act .tag img { width: 18px; height: 18px; flex: none; }
.mp-have { font-size: 12px; color: var(--muted); }
.mp-have img { width: 16px; height: 16px; }
.mp-hint { margin: 6px 0 0; font-size: 11px; }
/* celular em paisagem (874×402 pt): textos de painel um pouco menores; nada passa de ~85% da altura */
@media (max-height: 420px) {
  .panel { max-height: calc(86vh / var(--ui)); }
  .panel h2 { font-size: 16px; }
  .panel h3 { font-size: 13px; margin: 8px 0 5px; }
  .shop-item .nm, .sp-info .nm { font-size: 13px; }
  .shop-item .sub, .hint, .sp-info .sub { font-size: 11px; line-height: 1.25; }
  .btn { font-size: 13px; }
  .btn.wide { font-size: 13px; min-height: 40px; }
  .inv-foot .inv-gold { font-size: 16px; }
  .inv-foot .inv-gold .coin { width: 22px; height: 22px; }
  .reward-card .rw-sub { font-size: 11px; }
  .npc-line { font-size: 12px; line-height: 1.3; }
  .mp-card-tx .nm { font-size: 13px; }
  .mp-world { aspect-ratio: 4 / 1; }
}
@media (max-height: 520px) { .mp-node { width: 84px; } .mp-ic { width: 42px; height: 42px; } .mp-ic .zone-ic { width: 27px; height: 27px; } .mp-nm { font-size: 10px; } .mp-lv { font-size: 9px; } }

/* iOS (iPhone com entalhe / Dynamic Island / barra inicial, em paisagem): os cantos do HUD e do boss respeitam as áreas seguras. O canvas continua cobrindo a tela toda. */
@supports (padding: env(safe-area-inset-left)) {
  :root { --sal: env(safe-area-inset-left, 0px); --sar: env(safe-area-inset-right, 0px); --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px); }
  #hud-player { top: calc(8px + var(--sat)); }
  #hud-gold { top: calc(8px + var(--card-w) * .637 + 10px + var(--sat)); }
  #hud-zone { top: calc(8px + var(--sat)); }
  body.touch .menu-btns { top: calc(8px + var(--sat)); }
  #boss-bar { top: calc(8px + var(--sat)); }
  #log { left: calc(16px + var(--sal)); bottom: calc(8px + var(--sab)); }
}

/* Porto: contratos, banco, itens de outra classe e missão de evolução do spirit */
.shop-item.daily { --sc: #e0b84a; }
.shop-item.daily .mini-bar { height: 7px; }
.bank-grid { margin-bottom: 4px; }
.cell.wrong-class { filter: saturate(.55) brightness(.85); box-shadow: inset 0 0 0 2px rgba(255,107,107,.55); }
.cell .cls-x { position: absolute; left: 3px; right: 3px; bottom: 1px; font: 800 8px/1 Cinzel, serif; color: #ff9a92; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 2px #000; pointer-events: none; }
.cell.wrong-class .lv { display: none; }
.sp-info .evo-note { margin-top: 4px; font-size: 12px; color: var(--muted); }
.sp-info .evo-note.ready { color: #9be58f; font-weight: 800; }
.sp-info .evo-note.available, .sp-info .evo-note.active { color: #ffd88a; }
@media (max-height: 520px) and (min-width: 700px) and (orientation: landscape) {
  #panel-layer .panel:only-child.p-board { width: min(620px, calc(80vw / var(--ui))); }
}

/* Celular deitado (≤ 430 px de altura): HUD enxuto. A escala automática (prefs.js) já encolhe tudo em ~16%; aqui os alvos de toque
   ficam em tamanho FÍSICO fixo (dividindo por --ui), o menu junta mais os botões e os avisos ficam menores. */
@media (max-height: 430px) {
  :root { --card-w: 118px; --map: 96px; }
  .menu-btns button, body.touch .menu-btns button { width: calc(40px / var(--ui)); height: calc(40px / var(--ui)); }
  body.touch .menu-btns { gap: calc(2px / var(--ui)); right: calc(6px + var(--map) + 4px + env(safe-area-inset-right, 0px)); top: calc(4px + var(--sat, 0px)); }
  .toast { --tb: 14px; padding: 0 6px; }
  .toast .t1 { font-size: 14px; }
  .toast .t2 { font-size: 10.5px; }
  #hud-gold > span { font-size: 11px; padding: 2px 8px; }
}
/* muito baixa (≤ 360 px): o minimapa mantém o tamanho físico (104 px) apesar da escala automática menor */
@media (max-height: 360px) { :root { --map: calc(104px / var(--ui)); } }

/* Confirmação do jogo (ui.confirm): no lugar da janela do sistema do navegador */
.confirm-veil { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: rgba(6,8,18,.6); padding: 16px; }
.confirm-box { max-width: min(420px, 90vw); padding: 18px 20px; border-radius: 14px; background: linear-gradient(180deg, #1c2440, #121830); border: 2px solid #b98f3c; box-shadow: 0 0 0 2px #2a2010, 0 16px 40px rgba(0,0,0,.6); color: var(--text); text-align: center; }
.confirm-box p { margin: 0 0 14px; font-size: 15px; line-height: 1.4; }
.confirm-btns { display: flex; gap: 10px; justify-content: center; }

/* Diálogo em paisagem baixa (celular 667×375): rodapé compacto (recompensa em cima, botões lado a lado) para o texto do epílogo ter mais altura; retrato inteiro no oval */
@media (max-height: 420px) {
  .p-dialog .dlg-foot { display: flex; flex-wrap: wrap; gap: 4px; padding-top: 4px; }
  .p-dialog .dlg-foot .hint { flex: 1 0 100%; margin: 0; font-size: 11px; line-height: 1.2; }
  .p-dialog .dlg-foot .btn.wide { flex: 1 1 45%; width: auto; min-height: 34px; margin: 0; font-size: 12px; padding: 0 6px; }
  .p-dialog .dlg-scroll .hint { margin: 2px 0; }
  .p-dialog .npc-emb.por img { transform: none; object-position: 50% 10%; }
}

/* nome de item opalino (mochila, loja, tooltip): texto em arco-íris suave, no mesmo tom da moldura */
.opal-name { background: linear-gradient(100deg, #ff9ee0, #8fe6ff 35%, #b4ffb0 60%, #ffe28a 85%); background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: #cfe9ff; animation: opal-sheen 5s ease-in-out infinite alternate; }
@media (prefers-reduced-motion: reduce) { .opal-name { animation: none; } }
/* aviso de noite no HUD (texto curto sob o nome da zona) */
.night-tag { display: block; font-family: system-ui, sans-serif; font-weight: 700; font-size: 10px; letter-spacing: 0; color: #a9c4ff; margin-top: 2px; }

/* venda em lote: células marcadas ganham aro dourado e um check; barra de seleção sob a grade da mochila */
.cell.sel { box-shadow: inset 0 0 0 3px #ffd34d, 0 0 8px rgba(255,211,77,.55); filter: brightness(1.12); }
.cell .selmk { position: absolute; right: 2px; top: 2px; width: 16px; height: 16px; border-radius: 50%; background: #ffd34d; color: #3a2a00; font: 800 12px/16px system-ui, sans-serif; text-align: center; pointer-events: none; }
.sel-bar { margin: 6px 0 2px; display: grid; gap: 4px; }
.sel-bar .row-btns { flex-wrap: wrap; }
.sel-count { font-size: 12px; text-align: center; }
.sel-count .coin { width: 13px; height: 13px; vertical-align: -2px; }
.inv-gold-line { margin: 2px 0 6px; }
.inv-gold-line .coin { width: 16px; height: 16px; vertical-align: -3px; }
.sell-row .sub .coin { width: 13px; height: 13px; vertical-align: -2px; }

/* ---------- explicação das habilidades (cartão de segurar + painel Habilidades) ---------- */
#skill-card { position: fixed; z-index: 60; right: calc(248px * var(--tb, 1) + 8px); bottom: 8px; width: min(300px, 46vw); max-height: calc(100vh - 16px); overflow: hidden; padding: 10px 12px; border-radius: 14px;
  background: rgba(14,15,28,.97); border: 1px solid rgba(255,225,150,.35); box-shadow: 0 10px 30px rgba(0,0,0,.55); font-size: 12px; line-height: 1.3; pointer-events: none; }
#skill-card.hidden { display: none; }
.sk-top, .sk-card summary { display: flex; align-items: center; gap: 10px; }
.sk-ic { width: 40px; height: 40px; flex: none; display: grid; place-items: center; font-size: 24px; position: relative; }
.sk-ic img { width: 100%; height: 100%; object-fit: contain; }
.sk-t .nm { font-weight: 900; font-size: 15px; color: #fff1c4; }
.sk-t .sub { color: var(--muted); font-size: 11px; }
.sk-sum { margin: 6px 0 4px; color: #e9e6ff; }
.sk-row { display: flex; justify-content: space-between; gap: 10px; padding: 2px 0; border-top: 1px solid rgba(255,255,255,.06); }
.sk-row span { color: var(--muted); flex: none; }
.sk-row b { font-weight: 700; text-align: right; color: #d8f0ff; }
.sk-spec { margin-top: 6px; padding: 6px 8px; border-radius: 10px; background: rgba(255,214,120,.08); border: 1px solid rgba(255,214,120,.25); }
.sk-h { font-size: 11px; font-weight: 900; text-transform: uppercase; letter-spacing: .8px; color: var(--gold); }
.sk-lock { margin-top: 6px; color: #ffb199; font-weight: 800; }
.sk-card { margin: 0 0 6px; padding: 6px 8px; border-radius: 12px; background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.08); font-size: 12px; }
.sk-card summary { cursor: pointer; list-style: none; min-height: 44px; }
.sk-card summary::-webkit-details-marker { display: none; }
.sk-card[open] { border-color: rgba(255,225,150,.35); }
.sk-card.locked .sk-ic { filter: grayscale(.8) brightness(.7); }
.sk-badge { margin-left: auto; font-size: 11px; font-weight: 800; color: #ffb199; white-space: nowrap; }
.sk-mods { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0 6px; }
.sk-mods i { font-style: normal; font-size: 11px; padding: 2px 8px; border-radius: 999px; background: rgba(125,255,155,.1); color: #b8f5c8; border: 1px solid rgba(125,255,155,.25); }
.sk-cards { grid-column: 1 / -1; margin: -2px 0 8px; }
@media (max-height: 460px) {
  #skill-card { font-size: 11px; padding: 8px 10px; width: min(320px, 50vw); right: calc(248px * var(--tb, 1) + 8px); }
  #skill-card .sk-ic { width: 30px; height: 30px; }
  #skill-card .sk-t .nm { font-size: 13px; }
  #skill-card .sk-sum { margin: 3px 0 2px; }
  #skill-card .sk-row { padding: 1px 0; }
}
/* painel Habilidades: mais baixo que os outros para caber na paisagem do celular (a camada de painéis centraliza pela altura sem o zoom) */
.p-skills { max-height: calc(74vh / var(--ui)); }

/* ---- rastreador de missão + auto-viagem (core/autopath.js; ui.js updateTracker) ---- */
/* rastreador de missão no padrão da interface pintada: medalhão do mapa + faixa de madeira (moldura dos botões) com o objetivo em 1 linha + medalhões redondos de ação.
   Fica SOB o cartão do herói (canto esquerdo): nunca sobre o menu nem o minimapa. */
#qtrack { position: absolute; left: calc(8px + env(safe-area-inset-left, 0px)); top: calc(8px + var(--card-w) * .637 + 12px + var(--sat, 0px)); max-width: min(340px, calc(46vw / var(--ui))); display: flex; align-items: center; gap: 3px; pointer-events: none; z-index: 3; }
body:has(#hud-gold .pts) #qtrack { top: calc(8px + var(--card-w) * .637 + 12px + 40px + var(--sat, 0px)); } /* com o aviso "+N pontos" ele vem primeiro */
#qtrack button { padding: 0; border: 0; background: none; cursor: pointer; pointer-events: auto; flex: none; position: relative; filter: drop-shadow(0 2px 3px rgba(0,0,0,.5)); }
#qtrack .qt-ic { width: 34px; height: 34px; } #qtrack .qt-ic img { width: 100%; height: 100%; object-fit: contain; display: block; pointer-events: none; }
#qtrack .qt-txt { --bb: 9px; min-width: 0; flex: 0 1 auto; margin-left: -4px; pointer-events: auto; cursor: pointer; background: none; border: var(--bb) solid transparent; border-image: url(assets/ui/btn-normal.webp?v=5c8c9f3f) 80 fill / var(--bb) stretch; border-radius: 0; padding: 0 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font: 800 11px/18px Nunito, system-ui, sans-serif; color: #fff6d6; text-shadow: 0 1px 2px #000, 0 0 3px #000; filter: drop-shadow(0 2px 3px rgba(0,0,0,.45)); }
#qtrack b { display: none; } /* o nome da missão fica no diário (title); a linha mostra o objetivo e o destino */
#qtrack span, #qtrack em { font: 800 11px/18px Nunito, system-ui, sans-serif; color: #fff6d6; font-style: normal; }
#qtrack em { color: #bfeaff; } #qtrack em::before { content: ' · '; color: #ffd98a; }
#qtrack em.go { color: #b6ffb0; } #qtrack em.warn { color: #ffb4a8; }
#qtrack .qt-btn { width: 34px; height: 34px; background: url(assets/ui/medal-normal.webp?v=5c8c9f3f) center / 100% 100% no-repeat; color: #ffe08a; display: grid; place-items: center; }
#qtrack .qt-btn svg { width: 54%; height: 54%; margin-top: 2px; filter: drop-shadow(0 1px 1px rgba(0,0,0,.7)); pointer-events: none; }
#qtrack .qt-btn.stop { color: #ffb4a8; }
#qtrack .qt-btn:active { background-image: url(assets/ui/medal-pressed.webp?v=5c8c9f3f); }
.quest-card .btn-col { display: flex; flex-direction: column; gap: 4px; }

/* ---- geometria dos botões de toque (touch-logic.js skillLayout): centro (--cx da borda direita, --cy da de baixo) e diâmetro (--d), em px do contêiner.
   Os valores abaixo repetem o cálculo; touch.js os reescreve no resize (applyLayout). Dist. entre centros de QUALQUER par >= 1,15 × (r1 + r2). ---- */
.tbtn.sk0 { --cx: 128; --cy: 44; --d: 50; } .tbtn.sk1 { --cx: 103.4; --cy: 103.4; --d: 50; } .tbtn.sk2 { --cx: 44; --cy: 128; --d: 50; }
.tbtn.sk3 { --cx: 101.4; --cy: 182.6; --d: 54; } .tbtn.pot { --cx: 190; --cy: 44; --d: 50; } .tbtn.act { --cx: 190; --cy: 110; --d: 60; }
.tbtn.sk, .tbtn.pot, .tbtn.act { width: calc(var(--d) * 1px); height: calc(var(--d) * 1px); right: calc(var(--cx) * 1px - var(--d) * .5px); bottom: calc(var(--cy) * 1px - var(--d) * .5px); }
/* com a barra do chefe/elite na tela o rastreador vira só os medalhões (mapa e seta): o texto longo ia por baixo da barra */
body.boss-on #qtrack .qt-txt { display: none; }

/* ---- Partidas (PvP/ondas/arena online): HUD central compacto, sem cobrir o campo ---- */
body #arena-banner { top: 50px; font-size: 12px; font-weight: 700; letter-spacing: .02em; padding: 2px 12px; background: rgba(20,14,8,.72); border: 1px solid rgba(201,162,74,.6); border-radius: 10px; text-shadow: 0 1px 0 #000; white-space: nowrap; line-height: 1.3; pointer-events: none; }
body.touch #boss-bar.compact, #boss-bar.compact { top: 74px; width: min(150px, 24vw); left: 50%; transform: translateX(-50%); }
#boss-bar.compact #boss-name, #boss-bar.compact #boss-portrait { display: none; }
#boss-bar.compact .bar { height: 6px; border-width: 1px; border-radius: 4px; box-shadow: none; }
#boss-bar.compact .fill { border-radius: 3px; }

/* busto pequeno da especialização (cartões do painel/mentor) */
.cell .ic img.spec-por { width: 40px; height: 40px; object-fit: contain; filter: drop-shadow(0 1px 2px rgba(0,0,0,.5)); }
h3 > img.spec-por { width: 28px; height: 28px; vertical-align: middle; margin-right: 2px; }

/* ---- Barra de chefe/elite SEMPRE fina (PvE): sem asas, retrato nem moldura; nome pequeno com "Nv" em gema; colada sob o menu ---- */
body #boss-bar.slim, body.touch #boss-bar.slim { top: 58px; left: 50%; transform: translateX(-50%); width: min(250px, calc(36vw / var(--ui, 1))); opacity: .85; pointer-events: none; }
#boss-bar.slim #boss-portrait { display: none !important; } /* ui.js põe display inline */
#boss-bar.slim #boss-name { background: none; padding: 0; margin: 0 auto 2px; width: auto; max-width: 100%; display: flex; justify-content: center; align-items: center; gap: 4px; font-size: 10px; line-height: 12px; font-weight: 800; color: #ffe2d8; text-shadow: 0 1px 2px #000, 0 0 3px #000; white-space: nowrap; }
#boss-bar.slim #boss-name span { overflow: hidden; text-overflow: ellipsis; }
#boss-bar.slim #boss-name i { font-style: normal; flex: none; font-size: 8px; line-height: 10px; padding: 0 4px; border-radius: 6px; background: linear-gradient(180deg, #e9c25a, #a97a22); color: #2a1a05; text-shadow: none; border: 1px solid #5a3d0e; }
#boss-bar.slim .bar { position: relative; height: 7px; border: 1px solid rgba(0,0,0,.7); border-radius: 4px; background: rgba(30,10,12,.7); box-shadow: none; overflow: hidden; }
#boss-bar.slim .bar::after { content: ''; position: absolute; left: 50%; top: 0; bottom: 0; width: 1px; background: rgba(255,255,255,.55); } /* marca de 50% */
#boss-bar.slim .fill { border-radius: 3px; }
#boss-bar.slim.ph2 .fill { background: linear-gradient(180deg, #ffc066, #e07a1f); }
#boss-bar.slim.ph3 .fill { background: linear-gradient(180deg, #ffe27a, #ff3b2a); animation: pulse 1s infinite; }
#boss-bar.slim, #boss-bar.compact { transition: none; }

/* ---------- Chat online (ui/chat.js) ---------- */
/* contador de não lidas no ícone do chat (o ícone com moldura é assets/icons/menu/menu-chat.webp?v=5c8c9f3f, tools/make-chat-icon.py) */
.chat-btn { position: relative; }
.chat-btn[data-count]:not([data-count=""])::after { content: attr(data-count); position: absolute; top: 0; right: 0; min-width: 16px; height: 16px; padding: 0 3px; border-radius: 8px; background: #e0463a; color: #fff; font: 800 10px/16px Nunito, sans-serif; text-align: center; box-shadow: 0 1px 3px rgba(0,0,0,.5); }
.chat-box { position: fixed; z-index: 40; left: calc(8px + env(safe-area-inset-left, 0px)); top: calc(8px + var(--card-w, 150px) * .637 + 10px); width: min(340px, 46vw); height: min(260px, calc(100vh - var(--card-w, 150px) * .637 - 40px)); display: flex; flex-direction: column; background: var(--glass); border: 1px solid #b08a4a; border-radius: 14px; box-shadow: 0 12px 40px rgba(0,0,0,.5); color: #f6ebc9; font-family: Nunito, sans-serif; }
.chat-box.hidden { display: none; }
.chat-head { display: flex; align-items: center; gap: 4px; padding: 6px 6px 4px; border-bottom: 1px solid rgba(176,138,74,.35); }
.chat-tab { min-height: 32px; padding: 4px 12px; border: 1px solid rgba(176,138,74,.5); border-radius: 9px; background: rgba(0,0,0,.25); color: #d9c9a0; font: 800 13px Nunito, sans-serif; cursor: pointer; }
.chat-tab.on { background: linear-gradient(#7a5426, #4e3415); color: #ffe9a8; border-color: #e0b866; }
.chat-tab:disabled { opacity: .4; cursor: default; }
.chat-mutes { margin-left: auto; min-height: 28px; padding: 2px 8px; border: 0; border-radius: 8px; background: rgba(0,0,0,.3); color: #c8b890; font: 700 11px Nunito, sans-serif; cursor: pointer; }
.chat-mutes.hidden { display: none; }
.chat-x { margin-left: auto; width: 34px; height: 34px; border: 0; border-radius: 50%; background: rgba(0,0,0,.3); color: #f6ebc9; font-size: 15px; cursor: pointer; }
.chat-mutes:not(.hidden) + .chat-x { margin-left: 4px; }
.chat-list { flex: 1; margin: 0; padding: 6px 8px; list-style: none; overflow-y: auto; overscroll-behavior: contain; font-size: 13px; line-height: 1.35; }
.chat-line { padding: 2px 0; word-wrap: break-word; overflow-wrap: anywhere; }
.chat-line.party .chat-text { color: #9fe0ff; }
.chat-line.mine .chat-from { text-decoration: underline; text-underline-offset: 2px; }
.chat-time { color: #8f8466; font-size: 10px; margin-right: 5px; }
.chat-from { font-weight: 800; margin-right: 5px; cursor: pointer; }
.chat-from::after { content: ":"; color: #c8b890; }
.chat-lv { margin-right: 4px; padding: 0 4px; border-radius: 5px; background: rgba(255,211,77,.16); color: #e8cf8a; font: 800 9px/14px Nunito, sans-serif; vertical-align: 1px; }
.chat-hint { margin: 0 8px 4px; padding: 4px 8px; border-radius: 8px; background: rgba(224,70,58,.25); color: #ffd6cf; font-size: 12px; }
.chat-hint.hidden { display: none; }
.chat-form { display: flex; gap: 6px; padding: 6px; border-top: 1px solid rgba(176,138,74,.35); }
.chat-input { flex: 1; min-width: 0; min-height: 36px; padding: 6px 10px; border: 1px solid #6b5530; border-radius: 9px; background: rgba(0,0,0,.35); color: #fff; font: 16px Nunito, sans-serif; } /* 16 px: o iPhone não dá zoom ao focar */
.chat-input:focus { outline: none; border-color: var(--gold); }
/* aviso rápido com a caixa fechada: últimas mensagens no canto esquerdo, sem bloquear o toque */
.chat-feed { position: fixed; z-index: 6; left: calc(8px + env(safe-area-inset-left, 0px)); top: 46%; width: min(300px, 40vw); display: flex; flex-direction: column; gap: 3px; pointer-events: none; font: 12px/1.3 Nunito, sans-serif; }
.chat-feed .chat-line { padding: 3px 8px; border-radius: 8px; background: rgba(10,12,24,.62); color: #f3ead0; transition: opacity .6s; }
.chat-feed .chat-line.system { background: rgba(120,30,24,.7); }
.chat-feed .chat-line.out { opacity: 0; }
.chat-feed .chat-time { display: none; }
body:not(.online) .chat-feed, body:not(.online) .chat-box, body.panel-open .chat-feed { display: none; }

/* ---------- Botões fora da fileira do menu (pedido do dono, 2026-11-04) ---------- */
/* Mapa e Opções: lado a lado embaixo do minimapa. Os ids vencem as regras de posição de .menu-btns (que valem para a fileira de cima). */
#side-btns.menu-btns { position: absolute; top: calc(100% + 4px); right: 0; left: auto; width: auto; margin: 0; display: flex; flex-wrap: nowrap; justify-content: flex-end; gap: 4px; }
/* Chat: canto esquerdo, logo abaixo do cartão do herói */
#chat-dock.menu-btns { position: fixed; z-index: 4; left: calc(8px + env(safe-area-inset-left, 0px)); top: calc(8px + var(--card-w) * .637 + 8px + var(--sat, 0px)); right: auto; width: auto; margin: 0; gap: 0; }
body:not(.online) #chat-dock { display: none; }
body.online #chat-dock { display: flex; }
/* online, o aviso de pontos e o rastreador de missões começam à direita do botão de chat (44 px + folga) */
body.online #hud-gold, body.online #qtrack { left: calc(8px + 44px + 8px + env(safe-area-inset-left, 0px)); }
/* a placa do ritual do chefe desce uma fileira (Mapa e Opções ocupam o espaço logo abaixo do minimapa) */
#ritual, body.touch #ritual { top: calc(8px + var(--map) + 4px + 44px + 8px + var(--sat, 0px)); }
/* PC (modo teclado): a fileira do menu também fica sob o minimapa; ordem = nome da zona → Mapa/Opções → fileira → placa do ritual */
body:not(.touch) #side-btns.menu-btns { top: calc(100% + 22px); }
body:not(.touch) #menu-btns.menu-btns { top: calc(100% + 22px + 44px + 6px); }
body:not(.touch) #ritual { top: calc(var(--map) + 200px); }
