/* =============================================================
   Beast Arena — estilo da interface (tema escuro pixel-art)
   Layout de celular: mesma consulta de UI.MOBILE_QUERY (js/ui.js)
     (max-width: 820px), (max-height: 520px)
   ============================================================= */

/* Fontes: fonts/fonts.css (embutidas; licença SIL OFL 1.1 — ver fonts/OFL-*.txt) */

:root {
  --bg: #0e1621;
  --bg2: #142131;
  --panel: #1c2b3a;
  --panel2: #22364a;
  --border: #3c5a73;
  --border2: #5d7a8c;
  --text: #e8f1f2;
  --muted: #8aa3b5;
  --teal: #5fd4c4;
  --energy: #f4d35e;
  --gold: #ffcc4d;
  --dna: #7ee07e;
  --crystal: #7fe3ff;
  --danger: #ff5d5d;
  --ok: #6dff8b;
  --water: #4aa8ff;
  --electric: #ffd43b;
  --fire: #ff6b35;
  --earth: #b5835a;
  --pixel: 'Press Start 2P', 'Courier New', monospace;
  --body: 'VT323', 'Courier New', monospace;
  /* celular: alturas das barras e áreas seguras (entalhe, barra de gestos) */
  --header-h: 46px;
  --tabbar-h: 60px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  color-scheme: dark;   /* o jogo mantém o tema escuro (arte pixel pensada para fundo escuro) */
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  font-family: var(--body);
  font-size: 20px;
  line-height: 1.15;
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(ellipse at 50% -10%, #1d3147 0%, transparent 60%),
    var(--bg);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;   /* sem zoom de toque duplo (pinça continua funcionando) */
}
canvas { image-rendering: pixelated; image-rendering: crisp-edges; -webkit-touch-callout: none; user-select: none; -webkit-user-select: none; }
button { font-family: var(--pixel); touch-action: manipulation; }
.hidden { display: none !important; }
.px-icon { display: inline-block; vertical-align: middle; flex-shrink: 0; }

#app { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }
#screen { flex: 1; padding: 16px; max-width: 1280px; width: 100%; margin: 0 auto; }
#screen.full { max-width: none; padding: 8px; }

/* ---------- Barra superior ---------- */
#topbar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 8px 16px; background: rgba(20, 33, 49, 0.95);
  border-bottom: 2px solid var(--border); position: sticky; top: 0; z-index: 20;
}
#topbar .logo { font-family: var(--pixel); font-size: 13px; color: var(--gold); letter-spacing: 1px; margin-right: 8px; cursor: pointer; white-space: nowrap; }
#topbar .res { display: flex; gap: 14px; align-items: center; font-size: 20px; }
#topbar .res > span { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
#topbar .res b { color: var(--gold); font-weight: normal; }
#topbar .res .res-dna b { color: var(--dna); }
#topbar .res .res-crystal b { color: var(--crystal); }
#topbar .res .res-crystal { cursor: pointer; }
#topbar .res .res-energy b { color: #ffd43b; }
#topbar .res .res-energy { cursor: pointer; }
#topbar .res .pots-total { display: none; }
#topbar nav { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }
#topbar nav .btn.active { border-color: var(--gold); color: var(--gold); }
body.in-battle #topbar nav { display: none; }   /* durante a luta não dá para sair pelo menu */

/* ---------- Barra de abas (só no celular) ---------- */
#tabbar { display: none; }
#tabbar button {
  flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  background: none; border: 0; border-top: 3px solid transparent; color: var(--muted); padding: 5px 2px 4px;
  font-size: 7px; line-height: 1; text-transform: uppercase; cursor: pointer; user-select: none; -webkit-user-select: none;
}
#tabbar button .px-icon { width: 27px; height: 27px; }
#tabbar button.active { color: var(--gold); border-top-color: var(--gold); background: rgba(255, 204, 77, 0.06); }
#tabbar button:active { background: rgba(255, 255, 255, 0.06); }

/* ---------- Botões ---------- */
.btn {
  font-family: var(--pixel); font-size: 10px; line-height: 1.4;
  padding: 9px 12px; border: 2px solid var(--border2); background: var(--panel2);
  color: var(--text); cursor: pointer; border-radius: 0;
  box-shadow: 0 3px 0 #0a111a; transition: transform 0.05s, background 0.1s;
  text-transform: uppercase; white-space: nowrap;
  user-select: none; -webkit-user-select: none;
}
.btn:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 #0a111a; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.primary { background: #1f5c55; border-color: var(--teal); color: #eafffb; }
.btn.gold { background: #6b5118; border-color: var(--gold); color: #fff6d8; }
.btn.danger { background: #5c1f25; border-color: var(--danger); }
.btn.small { font-size: 8px; padding: 6px 8px; }
.btn.big { font-size: 13px; padding: 14px 20px; }
.btn.active { border-color: var(--gold); color: var(--gold); }
.btn.block { display: flex; width: 100%; align-items: center; justify-content: center; gap: 10px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
@media (hover: hover) {
  .btn:hover:not(:disabled) { background: #2d4660; border-color: var(--teal); }
  .btn.primary:hover:not(:disabled) { background: #277369; }
  #tabbar button:hover { color: var(--text); }
}

/* ---------- Painéis e textos ---------- */
.panel { background: var(--panel); border: 2px solid var(--border); padding: 12px; box-shadow: 0 4px 0 #0a111a; }
.panel + .panel { margin-top: 12px; }
.panel + .subtabs { margin-top: 12px; }   /* abas logo depois de um painel (ex.: Laboratório) não encostam nele */
.boss-panel > h3 { margin-top: 14px; margin-bottom: 8px; }   /* painel do chefe: seções separadas do bloco de cima */
h1, h2, h3 { font-family: var(--pixel); font-weight: normal; margin: 0 0 12px; line-height: 1.5; }
h1 { font-size: 18px; color: var(--gold); }
h2 { font-size: 13px; color: var(--gold); }
h3 { font-size: 10px; color: var(--teal); }
p { margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 17px; }
.tiny { font-family: var(--pixel); font-size: 8px; }
.gold-text { color: var(--gold); }
.dna-text { color: var(--dna); }
.crystal-text { color: var(--crystal); }
.energy-text { color: #ffd43b; }
.ok-text { color: var(--ok); }
.danger-text { color: var(--danger); }
.grid { display: grid; gap: 12px; }
.cols-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.cols-3 { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.sep { height: 2px; background: var(--border); margin: 10px 0; }

.el { font-family: var(--pixel); font-size: 8px; padding: 3px 5px; border: 1px solid; display: inline-block; }
.el-water { color: var(--water); border-color: var(--water); }
.el-electric { color: var(--electric); border-color: var(--electric); }
.el-fire { color: var(--fire); border-color: var(--fire); }
.el-earth { color: var(--earth); border-color: var(--earth); }
.chip { font-family: var(--pixel); font-size: 8px; padding: 3px 5px; background: #0f1a26; border: 1px solid var(--border); display: inline-block; margin: 2px 2px 0 0; }

.bar { height: 6px; background: #0b121b; border: 1px solid #0b121b; position: relative; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--teal); }
.bar.hp.mid > i { background: #ffc94d; }
.bar.hp.low > i { background: var(--danger); }
.bar.xp > i { background: #8f7bff; }
.bar.en > i { background: var(--energy); }

/* ---------- Tela inicial ---------- */
.title-screen { display: flex; flex-direction: column; align-items: center; gap: 18px; padding-top: 3vh; text-align: center; }
.title-screen .logo-canvas { max-width: 100%; }
.title-screen .title-stage { width: min(92vw, 864px); height: auto; border: 2px solid var(--border); box-shadow: 0 0 0 2px #081014; }
.title-screen .menu { display: flex; flex-direction: column; gap: 10px; min-width: 280px; }
.title-screen .menu .btn { font-size: 12px; padding: 14px; }
.title-screen .foot { color: var(--muted); font-size: 16px; max-width: 640px; }
.title-screen .legal-links { margin-top: 4px; }
.title-screen .legal-links a, .login-form a { color: var(--teal); display: inline-block; padding: 6px 2px; }

/* ---------- Cards de monstro ---------- */
.mcard {
  display: flex; gap: 10px; align-items: center; background: var(--bg2); border: 2px solid var(--border);
  padding: 8px; cursor: pointer; position: relative; min-width: 0;
  user-select: none; -webkit-user-select: none;
}
.mcard:active { border-color: var(--teal); }
.mcard.selected { border-color: var(--gold); background: #2a2a1c; }
.mcard.ko { opacity: 0.55; }
.mcard.ko::after { content: 'K.O.'; position: absolute; top: 6px; right: 8px; font-family: var(--pixel); font-size: 8px; color: var(--danger); }
.mcard .sprite-box { width: 84px; height: 84px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.portrait { display: block; box-shadow: 0 0 0 2px #081014; }
.mcard .info { flex: 1; min-width: 0; }
.mcard .name { font-family: var(--pixel); font-size: 10px; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mcard .name .lv { color: var(--muted); font-size: 8px; }
.mcard .sub { font-size: 17px; color: var(--muted); margin-bottom: 4px; }
.mcard .bar { margin-top: 3px; }
.mcard .traits { margin-top: 4px; }
.trait { font-family: var(--pixel); font-size: 7px; padding: 2px 4px; border: 1px solid currentColor; display: inline-block; margin: 2px 2px 0 0; }
.trait.aff { box-shadow: inset 0 0 0 1px currentColor; }
.role { font-family: var(--pixel); font-size: 7px; padding: 1px 4px; border: 1px solid; display: inline-block; vertical-align: 1px; }
/* funções-chave (o que responde às provas dos chefes): selos que se tocam na ficha, no painel do chefe e no diário */
.kf-row { display: inline-flex; flex-wrap: wrap; gap: 4px; vertical-align: middle; }
.kf { font-family: var(--pixel); font-size: 7px; line-height: 1.2; padding: 4px 7px; min-height: 34px; background: rgba(0, 0, 0, 0.25); border: 1px solid; color: var(--text); cursor: pointer; }
.kf.off { color: #7d8a96; border-color: #3a4a5a; border-style: dashed; }
.kf[aria-pressed="true"] { background: rgba(255, 255, 255, 0.1); }
.kf-box { margin-bottom: 8px; }
.kf-box > div { margin-bottom: 4px; }
.race-funcs .rf b { color: var(--gold); }
.race-funcs .rf.sec b { color: #9fd8ff; }
.trait-brain { margin: 2px 0 6px; color: #cfe3e8; }
.trait-brain b { font-weight: normal; color: var(--gold); }
.synergy { margin-top: 8px; padding: 6px 8px; border: 1px solid #2b4c51; background: rgba(8, 16, 20, 0.35); line-height: 1.5; }
.synergy b { font-weight: normal; }
@media (hover: hover) { .mcard:hover { border-color: var(--teal); } }

/* ---------- Mapa ---------- */
.loc-card { display: flex; flex-direction: column; gap: 8px; }
.loc-card .thumb { width: 100%; aspect-ratio: 4 / 3; border: 2px solid var(--border); display: block; background: #0b121b; }
.loc-card .lv { font-family: var(--pixel); font-size: 8px; color: var(--gold); }
.loc-card .spawns { font-size: 16px; color: var(--muted); }
.loc-card details summary { font-family: var(--pixel); font-size: 8px; color: var(--teal); cursor: pointer; padding: 6px 0; list-style-position: inside; user-select: none; -webkit-user-select: none; }
.loc-card details[open] summary { margin-bottom: 4px; }

/* ---------- Detalhe de monstro ---------- */
.detail { display: grid; grid-template-columns: 220px 1fr; gap: 16px; }
.detail .left { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.sprite-big { width: 200px; height: 200px; display: flex; align-items: center; justify-content: center; background: #0f1a26; border: 2px solid var(--border); }
.sprite-big .portrait { box-shadow: none; max-width: 100%; height: auto; }
.ab-list { display: grid; gap: 6px; }
.ab { background: var(--bg2); border: 1px solid var(--border); padding: 6px 8px; }
.ab .ab-head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.ab .ab-name { font-family: var(--pixel); font-size: 9px; color: var(--text); }
.ab .ab-slot { font-family: var(--pixel); font-size: 7px; color: var(--muted); }
.ab .ab-meta { font-size: 16px; color: var(--muted); }
.ab .ab-desc { font-size: 17px; }
.ab .ab-crit { font-size: 16px; color: #ffe066; }
/* ficha de habilidade (estilo das fichas de MOBA): cabeçalho, texto com palavras-chave e coluna de valores por aprimoramento */
/* painel de atributos: ícone e número em duas colunas (secundários em cima, principais embaixo) */
.stp { background: #0b1620; border: 2px solid #26394b; padding: 6px; min-width: 0; }
.stp-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 2px 8px; }
.stp-sep { height: 1px; background: #2a3d50; margin: 5px 2px; }
.stp-c { display: grid; grid-template-columns: 20px minmax(0, 1fr); grid-template-rows: auto; align-items: center; column-gap: 7px; row-gap: 1px;
  text-align: left; background: none; border: 1px solid transparent; color: var(--text); padding: 4px 5px; min-height: 34px; cursor: pointer; font: inherit; min-width: 0; }
.stp-c > .px-icon { grid-row: 1 / span 3; align-self: center; }
.stp-c[aria-pressed="true"] { border-color: #3d5870; background: rgba(255, 255, 255, 0.04); }
@media (hover: hover) { .stp-c:hover { border-color: #3d5870; background: rgba(255, 255, 255, 0.04); } }
.stp-v { font-size: 19px; line-height: 1; white-space: nowrap; color: #f2f5f8; }
.stp-dna { color: #7ee07e; font-size: 13px; margin-left: 3px; }
.stp-r { font-size: 13px; color: var(--muted); white-space: nowrap; line-height: 1.1; overflow: hidden; text-overflow: ellipsis; }
.stp-bar { display: block; height: 2px; background: #1c2b3a; }
.stp-bar > i { display: block; height: 100%; background: #5fd4c4; }
.stp-bar.over > i { background: var(--gold); }
.stp-info { margin-top: 6px; padding: 6px 8px; background: rgba(0, 0, 0, 0.28); border-left: 2px solid #3d5870; font-size: 15px; line-height: 1.25; }
.stp-info b { font-weight: normal; color: var(--gold); }
.docil-stats { margin-top: 8px; }
.stp-legend { margin-top: 5px; font-size: 13px; color: var(--muted); line-height: 1.2; }
.abx { background: var(--bg2); border: 2px solid var(--border); min-width: 0; }
.abx-head { padding: 7px 10px 6px; border-bottom: 1px solid var(--border); display: grid; gap: 4px; }
.abx-title { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.abx-name { font-family: var(--pixel); font-size: 10px; color: var(--gold); line-height: 1.5; }
.stars { display: inline-flex; gap: 1px; align-items: center; vertical-align: middle; }
.abx-slot { font-family: var(--pixel); font-size: 7px; color: var(--muted); }
.abx-meta { display: flex; flex-wrap: wrap; gap: 2px 14px; font-size: 16px; }
.abx-meta i { font-style: normal; font-family: var(--pixel); font-size: 7px; color: #8fb3ff; letter-spacing: 0.5px; }
.abx-meta b { font-weight: normal; }
.abx-meta .abx-wide { flex-basis: 100%; }
.abx-hnow { color: var(--muted); font-size: 14px; }
.abx-body { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 10px; padding: 8px 10px 10px; }
.abx-text p { margin: 0 0 6px; font-size: 18px; line-height: 1.2; }
.abx-text p:last-child { margin-bottom: 0; }
.abx-kw { font-weight: normal; }
.abx-text .abx-crit { color: #ffe066; font-size: 16px; }
.abx-text .abx-note { color: var(--muted); font-size: 15px; }
.abx-vals { display: grid; gap: 5px; align-content: start; min-width: 0; }
.abx-legend { font-size: 14px; color: var(--muted); }
.abx-row { background: rgba(0, 0, 0, 0.22); border-left: 2px solid var(--border); padding: 4px 8px 5px; min-width: 0; }
.abx-k { font-family: var(--pixel); font-size: 7px; color: #8fb3ff; letter-spacing: 0.5px; margin-bottom: 3px; line-height: 1.4; }
.abx-v { font-size: 17px; overflow-wrap: anywhere; }
.abx-cur { color: var(--gold); font-weight: normal; }
.abx-v > b:only-child, .abx-v > b:first-child:last-child { color: var(--text); }
.abx-oth { color: var(--muted); }
.abx-sep { color: #4d6479; }
.abx-sc { color: #c8a2ff; }
.abx-now { font-size: 14px; color: var(--muted); margin-top: 2px; }
@media (max-width: 640px) { .abx-body { grid-template-columns: minmax(0, 1fr); } }
.abx-play { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; }
/* demonstração das habilidades (js/abdemo.js): recorte da arena ampliado por número inteiro */
.abdemo { display: grid; gap: 6px; margin: 4px 0 10px; justify-items: center; }
.abdemo .abdemo-cap, .abdemo .abdemo-bar { justify-self: stretch; }
.abdemo-stage { background: #081014; border: 2px solid var(--border); width: fit-content; max-width: 100%; margin: 0 auto; min-height: 104px; overflow: hidden; }
.abdemo-canvas { display: block; image-rendering: pixelated; image-rendering: crisp-edges; max-width: 100%; }
.abdemo-cap { margin: 0; }
.abdemo-bar { margin: 0; }

/* ---------- Batalha ----------
   Grade com áreas nomeadas: no computador a arena fica à esquerda e o painel à direita;
   no celular em pé, tudo empilhado; no celular deitado, arena à esquerda e controles à direita. */
.battle-wrap {
  display: grid; justify-content: center; column-gap: 10px; row-gap: 8px;
  grid-template-columns: auto 300px;
  grid-template-rows: auto auto auto 1fr;
  grid-template-areas: "title side" "canvas side" "controls side" "hint side";
}
.battle-title { grid-area: title; justify-self: center; text-align: center; }
.battle-canvas-box { grid-area: canvas; justify-self: center; background: #000; border: 2px solid var(--border); line-height: 0; }
.battle-canvas-box canvas { touch-action: manipulation; }
.battle-controls { grid-area: controls; display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.battle-hint { grid-area: hint; justify-self: center; text-align: center; }
.battle-side { grid-area: side; width: 300px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.bs-tabs { display: none; gap: 6px; }
.bs-tabs .btn { flex: 1; }
.bs-sec { display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.bs-sec h3 { margin: 0; }
.battle-log { height: 420px; overflow-y: auto; font-size: 17px; background: var(--bg2); border: 2px solid var(--border); padding: 6px 8px; overscroll-behavior: contain; }
.battle-log div { margin-bottom: 2px; }
.battle-log .t { color: #56697a; margin-right: 4px; }
.battle-log .s0 { color: #bfe9ff; }
.battle-log .s1 { color: #ffc4bd; }
.battle-log .reaction { color: #ffe066; }
.battle-log .ko { color: var(--danger); }
.battle-log .joint { color: var(--teal); }
.battle-log .rage { color: #ff7eb6; }
.battle-log .prop { color: #d8b88a; }
.battle-log .heal { color: var(--ok); }
.battle-log .sys { color: var(--gold); }
/* aba Lutadores: aliados e inimigos lado a lado; cada monstro com nome, status (ícones) e ação */
.fighter-list { font-size: 16px; line-height: 1.05; background: var(--bg2); border: 2px solid var(--border); padding: 5px; overflow-y: auto; overscroll-behavior: contain; }
.fl-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 5px; align-items: start; }
.fl-head { font-size: 7px; margin: 0 0 3px 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fl-col.s0 .fl-head { color: #5fd4ff; }
.fl-col.s1 .fl-head { color: #ff6b6b; }
.fl { padding: 1px 4px 2px; margin-bottom: 2px; background: rgba(255, 255, 255, 0.03); border-left: 2px solid rgba(95, 212, 255, 0.45); cursor: pointer; }
.fl-col.s1 .fl { border-left-color: rgba(255, 107, 107, 0.45); }
.fl-top { display: flex; align-items: center; flex-wrap: wrap; gap: 2px 4px; min-width: 0; }
.fl-el { font-size: 12px; flex: none; }
.fl-name { flex: 0 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fl-name.lead { color: #ffb13b; }
.fl-sts { display: inline-flex; flex-wrap: wrap; gap: 2px; }
.fl-sts:empty { display: none; }
.fl-sts .st { position: relative; display: inline-flex; }
.fl-sts .st i { position: absolute; right: -3px; bottom: -4px; font-style: normal; font-size: 12px; line-height: 1; color: #fff; text-shadow: 1px 0 #081014, -1px 0 #081014, 0 1px #081014, 0 -1px #081014; }
.fl-act { font-size: 15px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fl-act:empty { display: none; }
.fl-act.cast { color: var(--gold); }
.fl.ko { opacity: 0.45; }
.fl.ko .fl-name { text-decoration: line-through; }
.fl-ko { font-family: var(--pixel); font-size: 7px; color: var(--danger); }
.fl.open { background: rgba(255, 255, 255, 0.07); }
.fl.open .fl-act { white-space: normal; }
.fl-info { display: flex; flex-wrap: wrap; gap: 1px 8px; font-size: 15px; margin-top: 2px; }
.fl-st { display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; }
/* aba Estatísticas: categorias com barras; o melhor de cada uma em destaque (faixa e valor dourados; o nome fica na cor do lado) */
.battle-stats { font-size: 15px; line-height: 1.1; background: var(--bg2); border: 2px solid var(--border); padding: 5px 6px; overflow-y: auto; overscroll-behavior: contain; max-height: 320px; }
.bstats { display: flex; flex-direction: column; gap: 7px; }
.bst-head { font-family: var(--pixel); font-size: 7px; color: var(--muted); margin-bottom: 3px; }
.bst-row { display: grid; grid-template-columns: minmax(0, 7.5em) minmax(0, 1fr) auto; align-items: center; gap: 6px; margin-bottom: 1px; }
.bst-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bst-row.mine .bst-name { color: #bfe9ff; }
.bst-row.foe .bst-name { color: #ffc4bd; }
.bst-bar { height: 7px; background: rgba(255, 255, 255, 0.06); }
.bst-bar i { display: block; height: 100%; }
.bst-val { font-variant-numeric: tabular-nums; min-width: 3em; text-align: right; }
.bst-row.best { background: rgba(255, 212, 59, 0.09); }
.bst-row.best .bst-val { color: var(--gold); }
.bst-none { font-size: 14px; }
.modal .battle-stats, .modal .bstats { max-height: none; }
@media (max-width: 1100px) {
  .battle-wrap {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: none;
    grid-template-areas: "title" "canvas" "controls" "hint" "side";
  }
  .battle-side { width: 100%; max-width: 720px; justify-self: center; }
  .battle-log { height: 200px; }
}

/* ---------- Modais ---------- */
#modal-root .overlay {
  position: fixed; inset: 0; background: rgba(5, 9, 15, 0.72); z-index: 50;
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modal {
  background: var(--panel); border: 2px solid var(--border2); box-shadow: 0 6px 0 #05090f;
  max-width: 860px; width: 100%; max-height: calc(100vh - 32px); overflow-y: auto; padding: 16px;
  overscroll-behavior: contain;
}
.modal.narrow { max-width: 520px; }
.modal .modal-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.modal .modal-head h2 { margin: 0; flex: 1; }

/* Folha "Mais" (menu) */
.menu-list { display: flex; flex-direction: column; gap: 8px; }
.menu-list .btn { justify-content: flex-start; text-align: left; }
.menu-list .menu-sep { height: 2px; background: var(--border); margin: 4px 0; }
.menu-list .note { font-size: 16px; color: var(--muted); margin: -2px 0 2px; }

/* ---------- Toasts ---------- */
#toast-root { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; width: max-content; max-width: calc(100vw - 24px); }
.toast { background: #10202e; border: 2px solid var(--teal); padding: 8px 14px; font-size: 19px; box-shadow: 0 4px 0 #05090f; animation: toastIn 0.2s ease-out; text-align: center; }
.toast.warn { border-color: var(--gold); }
.toast.bad { border-color: var(--danger); }
@keyframes toastIn { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes sheetIn { from { transform: translateY(40px); opacity: 0.4; } to { transform: none; opacity: 1; } }

/* ---------- Diversos ---------- */
.potion-opt { display: flex; align-items: center; gap: 10px; padding: 8px; background: var(--bg2); border: 1px solid var(--border); margin-bottom: 6px; }
.result-row { display: flex; gap: 10px; align-items: center; padding: 6px; background: var(--bg2); border: 1px solid var(--border); margin-bottom: 6px; }
.part-opt { padding: 6px 8px; background: var(--bg2); border: 2px solid var(--border); cursor: pointer; font-size: 17px; user-select: none; -webkit-user-select: none; }
.part-opt.current { border-color: var(--gold); }
.part-opt.chosen { border-color: var(--teal); background: #173a38; }
.part-opt.ab-opt { font-size: 16px; }
.part-opt.ab-opt .role { margin-left: 2px; }
.lab-part { margin-top: 12px; }
.lab-role { margin: 8px 0; padding: 6px 8px; background: var(--bg2); border: 2px solid var(--border); }
@media (hover: hover) { .part-opt:hover { border-color: var(--teal); } }
.form-grid { display: grid; grid-template-columns: auto 1fr; gap: 6px 10px; align-items: center; }
select, input[type=number], input[type=text], input[type=password] {
  font-family: var(--body); font-size: 19px; background: #0f1a26; color: var(--text);
  border: 2px solid var(--border); padding: 3px 6px; min-width: 0; border-radius: 0;
}
input:focus-visible, select:focus-visible { outline: 2px solid var(--teal); outline-offset: 1px; }

/* Laboratório: listas de melhorias com DNA */
.lab-dna { display: flex; align-items: center; gap: 6px; margin: 4px 0 10px; }
.lab-list { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.lab-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: var(--bg2); border: 2px solid var(--border); }
.lab-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.lab-dots { color: var(--dna); letter-spacing: 2px; font-size: 14px; }
.lab-row .btn { white-space: nowrap; min-height: 44px; }
.lab-trait { margin-top: 12px; }
.lab-trait .btn.active { outline: 2px solid var(--gold); }
.btn .px-icon { vertical-align: middle; }

/* ---------- Entrar / criar conta e avisos ---------- */
.login-form { width: min(100%, 420px); display: flex; flex-direction: column; gap: 12px; text-align: left; }
.login-form h1 { margin-bottom: 4px; }
.login-form label { display: flex; flex-direction: column; gap: 4px; font-size: 18px; }
.login-form input { width: 100%; padding: 8px 10px; }
.login-form .btn.small { align-self: flex-start; }
.panel.notice { max-width: 560px; text-align: left; }

/* pedido ao servidor em andamento: faixa animada no topo */
body.busy { cursor: progress; }
body.busy::after {
  content: ''; position: fixed; left: 0; right: 0; top: var(--safe-t); height: 3px; z-index: 100; pointer-events: none;
  background: linear-gradient(90deg, transparent, var(--teal), transparent); background-size: 40% 100%; background-repeat: no-repeat;
  animation: busyBar 0.9s linear infinite;
}
@keyframes busyBar { from { background-position: -40% 0; } to { background-position: 140% 0; } }
.sim-table { width: 100%; border-collapse: collapse; font-size: 17px; }
.sim-table td, .sim-table th { border-bottom: 1px solid var(--border); padding: 3px 6px; text-align: left; }
.sim-table th { font-family: var(--pixel); font-size: 8px; color: var(--teal); font-weight: normal; }
.table-scroll { overflow-x: auto; }
.help h3 { margin-top: 14px; }
.help ul { margin: 4px 0 8px 18px; padding: 0; }
.help li { margin-bottom: 3px; }
.kbd { font-family: var(--pixel); font-size: 8px; border: 1px solid var(--border2); padding: 2px 4px; }
.sticky-actions { position: sticky; bottom: 0; z-index: 5; margin-top: 12px; padding: 10px 0 4px; background: linear-gradient(rgba(14, 22, 33, 0), var(--bg) 35%); pointer-events: none; }
.sticky-actions > * { pointer-events: auto; }

@media (max-width: 700px) {
  body { font-size: 18px; }
  #screen { padding: 10px; }
  .detail { grid-template-columns: 1fr; }
  .cols-2, .cols-3 { grid-template-columns: 1fr; }
  #topbar nav { margin-left: 0; }
}

/* =============================================================
   Toque (dedo): alvos de pelo menos ~44 px
   ============================================================= */
@media (pointer: coarse) {
  .btn { min-height: 44px; padding: 11px 14px; }
  .btn.small { min-height: 40px; padding: 9px 10px; font-size: 9px; }
  .part-opt { padding: 10px 12px; }
  select, input[type=number], input[type=text], input[type=password] { min-height: 42px; font-size: 20px; }
  .loc-card details summary { padding: 10px 0; }
  .keys-only { display: none; }
}

/* =============================================================
   Layout de celular (em pé ou deitado)
   ============================================================= */
@media (max-width: 820px), (max-height: 520px) {
  body { overscroll-behavior-y: none; }
  #screen { padding: 12px calc(10px + var(--safe-r)) 16px calc(10px + var(--safe-l)); }
  .btn { white-space: normal; max-width: 100%; }   /* rótulos longos quebram a linha em vez de alargar a tela */
  .battle-controls .btn, #tabbar button { white-space: nowrap; }
  select { max-width: 100%; }
  body.has-tabbar #screen { padding-bottom: calc(var(--tabbar-h) + var(--safe-b) + 18px); }
  #topbar.hidden + #screen { padding-top: calc(12px + var(--safe-t)); }   /* sem cabeçalho: não fica sob a barra de status */
  h1 { font-size: 15px; }
  h2 { font-size: 12px; }

  /* cabeçalho compacto: logo + ouro, DNA, cristais e poções; a navegação vai para a barra de abas */
  #topbar {
    flex-wrap: nowrap; gap: 10px; min-height: calc(var(--header-h) + var(--safe-t));
    padding: calc(6px + var(--safe-t)) calc(12px + var(--safe-r)) 6px calc(12px + var(--safe-l));
  }
  #topbar .logo { font-size: 10px; margin-right: 0; }
  #topbar nav { display: none; }
  #topbar .res { margin-left: auto; gap: 10px; font-size: 17px; }
  #topbar .res > span { gap: 4px; }
  #topbar .res .pots-detail { display: none; }
  #topbar .res .pots-total { display: inline; }
  #tabbar:not(.hidden) {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    min-height: calc(var(--tabbar-h) + var(--safe-b));
    padding: 0 var(--safe-r) var(--safe-b) var(--safe-l);
    background: rgba(16, 27, 40, 0.97); border-top: 2px solid var(--border);
    box-shadow: 0 -4px 0 rgba(5, 9, 15, 0.5);
  }
  #toast-root { bottom: calc(16px + var(--safe-b)); }
  .toast { font-size: 17px; padding: 6px 10px; }
  body.has-tabbar #toast-root { bottom: calc(var(--tabbar-h) + var(--safe-b) + 12px); }
  body.has-tabbar .sticky-actions { bottom: calc(var(--tabbar-h) + var(--safe-b)); }

  .title-screen { gap: 14px; padding-top: calc(2vh + var(--safe-t)); }
  .title-screen .menu { min-width: 0; width: min(100%, 360px); }

  /* modais viram folhas que sobem da borda de baixo */
  #modal-root .overlay { align-items: flex-end; padding: calc(var(--safe-t) + 10px) 0 0; }
  .modal, .modal.narrow {
    max-width: none; max-height: 100%; border-left: 0; border-right: 0; border-bottom: 0;
    padding: 0 calc(14px + var(--safe-r)) calc(16px + var(--safe-b)) calc(14px + var(--safe-l));
    animation: sheetIn 0.18s ease-out;
  }
  .modal .modal-head { position: sticky; top: 0; z-index: 3; background: var(--panel); padding: 12px 0 8px; margin: 0 0 6px; border-bottom: 2px solid var(--border); }
  .modal > :not(.modal-head):first-child { margin-top: 14px; }
  .detail { grid-template-columns: 1fr; }
  .detail .left { max-width: 360px; margin: 0 auto; width: 100%; }

  /* equipe no mapa: 3 cartas pequenas lado a lado */
  .mgrid.compact { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  /* escolha do monstro na Mutação: fileira que rola para o lado */
  .mgrid.picker { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x proximity; padding-bottom: 6px; overscroll-behavior-x: contain; }
  .mgrid.picker .mcard { flex: 0 0 104px; scroll-snap-align: start; }
  .mgrid.compact .mcard, .mgrid.picker .mcard { flex-direction: column; gap: 4px; padding: 6px 4px; text-align: center; }
  .mgrid.compact .mcard .sprite-box, .mgrid.picker .mcard .sprite-box { width: 64px; height: 64px; }
  .mgrid.compact .mcard .portrait, .mgrid.picker .mcard .portrait { width: 64px; height: 64px; }
  .mgrid.compact .mcard .info, .mgrid.picker .mcard .info { width: 100%; }
  .mgrid.compact .mcard .name, .mgrid.picker .mcard .name { font-size: 8px; }
  .mgrid.compact .mcard .name .lv, .mgrid.picker .mcard .name .lv { display: block; margin-top: 3px; }
  .mgrid.compact .mcard .sub, .mgrid.compact .mcard .traits,
  .mgrid.picker .mcard .sub, .mgrid.picker .mcard .traits, .mgrid.picker .mcard .bar { display: none; }
  .mgrid.compact .mcard.ko::after, .mgrid.picker .mcard.ko::after { top: 4px; right: 4px; }

  .sprite-big { width: 150px; height: 150px; }
  .lab-preview .sprite-big { width: 140px; height: 140px; }

  /* ---------- batalha em tela cheia (sem cabeçalho nem abas) ---------- */
  body.in-battle #topbar, body.in-battle #tabbar { display: none !important; }
  body.in-battle #screen.full { padding: calc(4px + var(--safe-t)) calc(4px + var(--safe-r)) calc(4px + var(--safe-b)) calc(4px + var(--safe-l)); }
  .battle-wrap {
    height: calc(100vh - 8px - var(--safe-t) - var(--safe-b));
    height: calc(100dvh - 8px - var(--safe-t) - var(--safe-b));
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto auto minmax(0, 1fr);
    grid-template-areas: "title" "canvas" "controls" "side";
    row-gap: 6px;
  }
  .battle-hint { display: none; }
  .battle-title { font-size: 7px; }
  .battle-controls { flex-wrap: nowrap; gap: 5px; width: 100%; }
  .battle-controls .btn { flex: 1 1 auto; min-width: 0; padding-left: 4px; padding-right: 4px; font-size: 9px; min-height: 44px; }
  .battle-side { width: 100%; max-width: none; min-height: 0; gap: 6px; }
  .bs-tabs { display: flex; }
  .bs-tabs .btn { min-height: 38px; font-size: 8px; }
  .bs-sec h3 { display: none; }
  .bs-sec:not(.active) { display: none; }
  .bs-sec.active { flex: 1; }
  .battle-log, .fighter-list, .battle-stats { flex: 1; height: auto; min-height: 0; max-height: none; }
}

/* tela em pé bem alta (tablet): Lutadores e Registro juntos, um embaixo do outro (sem abas), em vez de um
   painel quase vazio embaixo da arena. Nos celulares a arena ocupa a maior parte e o painel usa as abas */
@media (max-width: 820px) and (orientation: portrait) and (min-height: 960px) {
  .bs-tabs { display: none; }
  .bs-sec, .bs-sec:not(.active) { display: flex; gap: 4px; }
  .bs-sec h3 { display: block; font-size: 9px; }
  .bs-sec.bs-list { order: -1; flex: 0 1 auto; max-height: 42%; }
  .bs-sec.bs-log { flex: 1 1 0; }
  .bs-sec.bs-stats { flex: 0 1 auto; max-height: 34%; }
  .fighter-list, .battle-stats { flex: 0 1 auto; }
}

/* celular em pé (tela estreita): o nome do jogo sai do cabeçalho e os contadores usam a largura toda
   (com valores grandes, ouro/DNA/cristais/poções não cabiam ao lado do nome) */
@media (max-width: 480px) {
  #topbar .logo { display: none; }
  #topbar .res { margin-left: 0; flex: 1; justify-content: space-between; gap: 6px; }
}

/* celular deitado: barras mais baixas; na luta a arena ocupa a altura e controles e painel ficam à direita */
@media (max-height: 520px) and (orientation: landscape) {
  :root { --header-h: 38px; --tabbar-h: 44px; }
  #topbar { padding-top: calc(4px + var(--safe-t)); padding-bottom: 4px; }
  #tabbar button { flex-direction: row; gap: 8px; font-size: 8px; padding: 2px; }
  #tabbar button .px-icon { width: 21px; height: 21px; }
  .battle-wrap {
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-areas: "canvas controls" "canvas side";
    justify-content: stretch;
  }
  .battle-title { display: none; }
  .battle-canvas-box { align-self: center; }
  /* (controles numa linha só quando cabem: sobra altura para a aba Lutadores) */
  .battle-controls { flex-wrap: wrap; gap: 4px; }
  .battle-controls .btn { min-height: 40px; font-size: 8px; padding-left: 3px; padding-right: 3px; }
}

/* =============================================================
   Mundo (mapa explorável em tempo real)
   ============================================================= */
body.in-world { overflow: hidden; overscroll-behavior: none; }
body.in-world #screen { padding: 0; }
.world { position: fixed; left: 0; right: 0; top: 0; height: 100vh; overflow: hidden; background: #0b1118; z-index: 1; touch-action: none; }
.world-canvas { display: block; position: absolute; left: 0; top: 0; }
.world-hud { position: absolute; inset: 0; pointer-events: none; font-family: var(--body); }
.world-hud > *, .world-hud button, .world-hud input { pointer-events: auto; }
.wh-bubbles { position: absolute; inset: 0; pointer-events: none !important; overflow: hidden; }
.wbubble {
  position: absolute; left: 0; top: 0; max-width: 170px; padding: 3px 7px 4px; font-size: 17px; line-height: 1.05;
  background: #fff8e6; color: #2a2014; border: 2px solid #1a140c; box-shadow: 0 2px 0 rgba(0, 0, 0, 0.35);
  word-wrap: break-word; overflow-wrap: anywhere; pointer-events: none;
}
.wh-top { position: absolute; left: 0; right: 0; top: 0; display: flex; justify-content: space-between; align-items: flex-start; gap: 8px;
  padding: 8px calc(8px + var(--safe-r)) 0 calc(8px + var(--safe-l)); pointer-events: none !important; }
.wh-left { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; min-width: 0; pointer-events: none !important; }
.wh-left > * { pointer-events: auto; }
.wh-map { font-family: var(--pixel); font-size: 9px; color: #fff6d8; background: rgba(10, 16, 24, 0.72); border: 2px solid rgba(90, 120, 140, 0.6); padding: 5px 8px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.tag-prov { font-family: var(--pixel); font-size: 7px; color: #ffcc4d; border: 1px solid #ffcc4d; padding: 1px 3px; }
.tag-safe { font-family: var(--pixel); font-size: 7px; color: #6dff8b; border: 1px solid #6dff8b; padding: 1px 3px; }
.wh-quest { font-family: var(--body); font-size: 17px; text-align: left; color: var(--text); background: rgba(10, 16, 24, 0.72); border: 2px solid rgba(255, 204, 77, 0.5);
  padding: 4px 8px; max-width: min(360px, 70vw); display: flex; flex-direction: column; gap: 2px; cursor: pointer; }
.wh-quest b { font-family: var(--pixel); font-size: 8px; font-weight: normal; color: var(--gold); }
.wh-right { display: flex; gap: 6px; align-items: center; }
.wh-chan { font-family: var(--pixel); font-size: 8px; color: var(--text); background: rgba(10, 16, 24, 0.72); border: 2px solid rgba(90, 120, 140, 0.6); padding: 6px 8px; cursor: pointer; }
.wh-net { width: 12px; height: 12px; border: 2px solid #0b1118; background: #6dff8b; display: inline-block; }
.wh-net.wait { background: #ffcc4d; animation: blink 0.8s steps(2) infinite; }
.wh-net.bad { background: #ff5d5d; }
@keyframes blink { 50% { opacity: 0.3; } }
.wh-banner { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); background: rgba(10, 16, 24, 0.9); border: 2px solid var(--border2);
  padding: 12px 16px; font-size: 20px; text-align: center; display: flex; flex-direction: column; gap: 8px; align-items: center; max-width: 86vw; }
.wh-bottom { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-between; align-items: flex-end; gap: 8px; z-index: 3;
  padding: 0 calc(8px + var(--safe-r)) 8px calc(8px + var(--safe-l)); pointer-events: none !important; }
/* o chat não fica embaixo do joystick: mais estreito à esquerda dele (--joy-chat-w) ou mais alto (--joy-lift); WorldView.placeJoy */
.wh-chatlog { display: flex; flex-direction: column; gap: 2px; min-width: 0; max-width: var(--joy-chat-w, min(420px, 64vw)); pointer-events: none !important; margin-bottom: var(--joy-lift, 0px); }
.wh-line { font-size: 17px; line-height: 1.05; color: #eef6f8; text-shadow: 1px 1px 0 #000, -1px 0 0 #000, 0 -1px 0 #000, 1px 0 0 #000; overflow-wrap: anywhere; }
.wh-line b { color: #9ff5e8; font-weight: normal; }
.wh-line.me b { color: var(--gold); }
/* canto de baixo à direita: o botão da montaria (v0.32.1: um toque monta, outro desce) ao lado do botão do menu */
.wh-corner { display: flex; align-items: flex-end; gap: 6px; flex: none; }
/* Caçada aos Soberanos (v0.33): o chefe do dia no diário, no painel do chefe e no painel da caçada */
.panel.hunt-today { border-color: #ff9a5a; background: #2a1f1a; margin-top: 8px; }
.panel.hunt-today h3 { color: #ffb37a; margin-top: 0; }
.panel.quest.hunt-quest { border-color: #ff9a5a; }
.wh-mount-btn { min-width: 52px; min-height: 52px; padding: 2px 3px 3px; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 2px; position: relative; }
.wh-mount-btn.on { border-color: var(--gold); }
.wh-mount-pic { width: 46px; height: 32px; display: flex; align-items: flex-end; justify-content: center; overflow: hidden; }
.wh-mount-pic canvas { image-rendering: pixelated; display: block; flex: none; }
.wh-mount-lbl { font-family: var(--pixel); font-size: 7px; line-height: 1; color: var(--text); }
.wh-mount-btn.on .wh-mount-lbl { color: var(--gold); }
/* com o menu aberto, a lista passa por cima: o botão da montaria espera */
.wh-corner.menu-open .wh-mount-btn { visibility: hidden; }
/* menu do canto (v0.31): um botão que abre Eventos, Chat, Emotes e Log */
.wh-menu { position: relative; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex: none; }
/* a lista abre por cima do botão sem ocupar lugar no canto (o botão da montaria fica colado no do menu) */
.wh-menu-list { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; position: absolute; right: 0; bottom: calc(100% + 6px); }
.wh-mbtn { display: flex; align-items: center; gap: 8px; font-family: var(--pixel); font-size: 9px; color: var(--text); background: rgba(22, 34, 48, 0.94);
  border: 2px solid var(--border2); min-height: 44px; min-width: 116px; padding: 6px 12px 6px 8px; box-shadow: 0 3px 0 #0a111a; cursor: pointer; position: relative;
  opacity: 0; transform: translateY(14px) scale(0.92); transition: opacity 0.14s ease-out, transform 0.18s ease-out; transition-delay: calc(var(--i) * 35ms); }
.world-hud .wh-mbtn { pointer-events: none; }
.world-hud .wh-menu.open .wh-mbtn { opacity: 1; transform: none; pointer-events: auto; }
.wh-mbtn:active { transform: translateY(2px); box-shadow: 0 1px 0 #0a111a; }
.wh-mi { width: 27px; height: 27px; image-rendering: pixelated; flex: none; }
.wh-menu-btn { min-width: 52px; min-height: 52px; display: flex; align-items: center; justify-content: center; position: relative; padding: 4px; }
.wh-menu.open .wh-menu-btn { border-color: var(--gold); }
.wh-badge { position: absolute; top: -5px; right: -5px; width: 12px; height: 12px; background: #ff5d5d; border: 2px solid #0b1118; animation: badge-pop 1.2s ease-in-out infinite; }
@keyframes badge-pop { 50% { transform: scale(1.25); } }
@media (max-height: 520px) and (orientation: landscape) {
  .wh-menu { flex-direction: row; align-items: flex-end; }
  .wh-menu-list { flex-direction: row; align-items: flex-end; right: calc(100% + 6px); bottom: 0; }
  .wh-mbtn { min-width: 0; transform: translateX(14px) scale(0.92); }
}
/* joystick (v0.31; ligado por padrão desde a v0.31.1): no centro do pé do mapa (acima da aba Diário) ou onde o
   jogador escolheu; a posição vem de WorldView.placeJoy (left/top), o CSS só dá o lugar antes do primeiro cálculo.
   O menu do canto fica por cima dele (z-index) */
.wh-joy { position: absolute; left: calc(50% - 60px); bottom: 8px; width: 120px; height: 120px; z-index: 2; touch-action: none; user-select: none; -webkit-user-select: none; }
.wh-joy-base { display: block; width: 120px; height: 120px; image-rendering: pixelated; }
.wh-joy-knob { position: absolute; left: 33px; top: 33px; width: 54px; height: 54px; image-rendering: pixelated; pointer-events: none; }
/* editor do lugar do joystick (Configurações › Mudar posição): o mapa escurece e o joystick segue o dedo */
.wh-joy-edit { position: absolute; inset: 0; z-index: 4; background: rgba(5, 9, 15, 0.55); touch-action: none; cursor: crosshair; }
.world.joy-editing .wh-joy { z-index: 5; border-radius: 50%; outline: 3px dashed var(--gold); outline-offset: 5px; cursor: grab; animation: joy-edit 1.1s ease-in-out infinite; }
@keyframes joy-edit { 50% { outline-color: rgba(255, 212, 59, 0.35); } }
.wh-joy-card { position: absolute; left: 50%; top: 10px; transform: translateX(-50%); width: min(360px, calc(100% - 20px)); cursor: default;
  background: var(--panel); border: 2px solid var(--gold); box-shadow: 0 4px 0 #0a111a; padding: 10px 12px 12px; text-align: center; display: flex; flex-direction: column; gap: 8px; }
.wh-joy-card b { font-family: var(--pixel); font-size: 10px; font-weight: normal; color: var(--gold); }
.wh-joy-card p { margin: 0; font-size: 19px; line-height: 1.1; color: var(--text); }
.wh-joy-btns { display: flex; flex-direction: column; gap: 6px; }
.wh-joy-card .btn-row { justify-content: center; gap: 6px; margin: 0; flex-wrap: nowrap; }
.wh-joy-card .btn { flex: 1 1 0; min-width: 0; min-height: 44px; }
/* celular deitado (pouca altura): o quadro fica baixo, com os 5 botões numa linha, para não cobrir o joystick */
@media (max-height: 520px) and (orientation: landscape) {
  .wh-joy-card { top: 6px; width: min(680px, calc(100% - 20px)); padding: 8px 10px 10px; gap: 6px; }
  .wh-joy-card p { font-size: 17px; }
  .wh-joy-btns { flex-direction: row; }
  .wh-joy-btns .btn-row:first-child { flex: 3 1 0; }
  .wh-joy-btns .btn-row:last-child { flex: 2 1 0; }
}
.wh-btn { font-family: var(--pixel); font-size: 9px; color: var(--text); background: rgba(22, 34, 48, 0.9); border: 2px solid var(--border2); min-width: 46px; min-height: 42px; padding: 6px 8px; cursor: pointer; box-shadow: 0 3px 0 #0a111a; }
.wh-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #0a111a; }
.wh-input { position: absolute; left: calc(8px + var(--safe-l)); right: calc(8px + var(--safe-r)); bottom: 58px; font-family: var(--body); font-size: 20px;
  background: #0e1621; color: var(--text); border: 2px solid var(--teal); padding: 8px; }
.emote-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.avatar-portrait { image-rendering: pixelated; display: block; }

/* conversa com NPC: caixa no pé da tela, o mapa continua visível */
#modal-root .overlay.npc-dialog-overlay { background: rgba(5, 9, 15, 0.25); align-items: flex-end; }
.modal.npc-dialog { border-color: #c9a45a; background: #1a1612; max-width: 640px; width: 100%; }
.dlg { display: flex; flex-direction: column; gap: 10px; padding-top: 12px; }
.dlg-head { display: flex; align-items: flex-end; gap: 10px; }
.dlg-portrait { background: #2a2218; border: 2px solid #c9a45a; padding: 4px 6px 0; }
.dlg-name { font-family: var(--pixel); font-size: 11px; color: var(--gold); padding-bottom: 4px; }
.dlg-text { margin: 0; font-size: 22px; line-height: 1.15; min-height: 3.4em; color: #f4ecdc; }
.dlg-choices { display: flex; flex-direction: column; gap: 6px; }
.dlg-choices .btn { text-align: left; justify-content: flex-start; white-space: normal; }

/* criação do personagem */
.char-screen { max-width: 900px; margin: 0 auto; }
.char-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 12px; }
.char-preview { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; min-height: 220px;
  background: radial-gradient(ellipse at 50% 70%, #3a6a2e 0%, #24402a 60%, #1c2b3a 100%); }
.char-stage { min-height: 150px; display: flex; align-items: flex-end; justify-content: center; }
.char-name { display: flex; flex-direction: column; gap: 4px; margin-bottom: 6px; }
.char-name span { font-family: var(--pixel); font-size: 9px; color: var(--teal); }
.char-name input { font-family: var(--body); font-size: 22px; background: #0e1621; color: var(--text); border: 2px solid var(--border2); padding: 6px 8px; }
.char-opts { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.char-row { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(110px, auto) auto; align-items: center; gap: 6px; }
.char-lab { font-size: 18px; color: var(--muted); }
.char-val { font-size: 19px; text-align: center; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.swatch { width: 14px; height: 14px; border: 2px solid #0a111a; display: inline-block; }

/* missões */
.quest.main { border-color: #8a6a2a; }
.quest.done { opacity: 0.7; padding: 8px 12px; }
.qbar { height: 6px; background: #0e1621; border: 1px solid var(--border); margin: 4px 0; }
.qbar span { display: block; height: 100%; background: var(--gold); }

@media (max-width: 820px), (max-height: 520px) {
  body.in-world #screen { padding: 0; }
  .char-body { grid-template-columns: 1fr; }
  .char-preview { min-height: 180px; }
  .wh-map { font-size: 8px; }
  .modal.npc-dialog { padding-top: 0; }
  .dlg-text { font-size: 21px; }
}
@media (max-height: 520px) and (orientation: landscape) {
  .wh-quest { max-width: 44vw; }
  .dlg-text { min-height: 2.3em; }
}
/* no mundo os avisos ficam no alto (embaixo ficam o chat e a caixa de conversa) */
body.in-world #toast-root { top: calc(var(--header-h) + var(--safe-t) + 92px); bottom: auto; }
@media (max-width: 820px), (max-height: 520px) {
  body.in-world.has-tabbar #toast-root { top: calc(var(--header-h) + var(--safe-t) + 92px); bottom: auto; }
}
@media (max-height: 520px) and (orientation: landscape) {
  body.in-world #toast-root, body.in-world.has-tabbar #toast-root { top: calc(var(--header-h) + var(--safe-t) + 52px); }
}

/* =============================================================
   Sistemas (v0.8): abas internas, selos, bolsa, social, correio,
   troca, bestiário, conquistas, recompensa diária, Coliseu, chefes,
   configurações, conta e moderação
   ============================================================= */
/* com uma janela aberta (no celular ela sobe do pé da tela), os avisos vão para o alto */
body.has-modal #toast-root, body.has-modal.has-tabbar #toast-root, body.has-modal.in-world #toast-root { top: calc(10px + var(--safe-t)); bottom: auto; }
/* botões fixos dentro das janelas: sempre no pé da janela (a barra de abas fica atrás dela) */
body.has-tabbar .modal .sticky-actions, .modal .sticky-actions { bottom: 0; background: linear-gradient(rgba(28, 43, 58, 0), var(--panel) 35%); }
/* abas que não cabem numa linha quebram para a de baixo (nenhuma fica escondida fora da tela) */
.subtabs { display: flex; flex-wrap: wrap; gap: 6px; margin: -4px 0 12px; }
.subtabs .btn { flex: 0 0 auto; }
@media (max-width: 480px) { .subtabs .btn { flex: 1 1 auto; } }   /* no celular em pé, as abas ocupam a largura (como botões segmentados) */
.badge { display: inline-block; min-width: 16px; padding: 2px 4px; margin-left: 6px; background: var(--danger); color: #fff; font-family: var(--pixel); font-size: 7px; line-height: 1.2; text-align: center; border: 1px solid #0a111a; vertical-align: middle; }
.tab-ico { position: relative; display: inline-flex; }
.tab-ico .badge { position: absolute; top: -4px; right: -12px; margin: 0; }
.textarea { width: 100%; font-family: var(--body); font-size: 19px; background: #0f1a26; color: var(--text); border: 2px solid var(--border); padding: 6px 8px; resize: vertical; border-radius: 0; }
.form-field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; font-size: 18px; }
.form-field input, .form-field select { width: 100%; }
.narrow-screen { max-width: 640px; margin: 0 auto; }
/* sela: a própria montaria (retrato em pixel art, 1 pixel da arte = 1 px) */
.mount-icon { width: 52px; height: 42px; flex-shrink: 0; display: flex; align-items: flex-end; justify-content: center; background: radial-gradient(ellipse 22px 5px at 50% 92%, rgba(0, 0, 0, 0.35), transparent); }
.mount-icon canvas { image-rendering: pixelated; display: block; }
.item-row, .friend-row { display: flex; align-items: center; gap: 10px; padding: 8px; background: var(--bg2); border: 1px solid var(--border); margin-bottom: 6px; flex-wrap: wrap; }
.it-info, .fr-info { flex: 1; min-width: 150px; display: flex; flex-direction: column; gap: 2px; }
.it-info b, .fr-info b { font-weight: normal; font-family: var(--pixel); font-size: 9px; line-height: 1.5; }
.friend-row .avatar-portrait, .offer .avatar-portrait { flex-shrink: 0; }
.offer { padding: 8px; background: var(--bg2); border: 1px solid var(--border); margin-top: 8px; display: flex; flex-direction: column; gap: 8px; }
/* correio */
.mail-row { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 10px 8px; margin-bottom: 6px; background: var(--bg2); border: 1px solid var(--border); color: var(--text); font-family: var(--body); font-size: 18px; cursor: pointer; min-height: 44px; }
.mail-row .mail-dot { width: 10px; height: 10px; flex-shrink: 0; background: transparent; border: 2px solid var(--border2); }
.mail-row.unread .mail-dot { background: var(--gold); border-color: var(--gold); }
.mail-row .mail-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.mail-row .mail-main b { font-weight: normal; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-row.unread .mail-main b { color: var(--gold); }
.letter-body { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 20px; }
/* troca */
.trade .panel + .panel { margin-top: 0; }
.trade-offer { margin-top: 8px; }
.step-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto 36px auto; align-items: center; gap: 6px; margin-bottom: 4px; }
.step-lab { font-size: 18px; }
.step-val { text-align: center; font-family: var(--pixel); font-size: 10px; }
/* bestiário */
.dex { display: flex; flex-direction: column; gap: 3px; overflow-x: auto; }
.dex-row { display: grid; grid-template-columns: minmax(120px, 1.6fr) repeat(4, minmax(52px, 1fr)); gap: 4px; align-items: center; }
.dex-head span { text-align: center; }
.dex-el { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.dex-fam { display: flex; align-items: center; gap: 6px; font-size: 17px; }
.dex-fam canvas { width: 40px; height: 40px; }
.dex-unknown { width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; background: #0f1a26; border: 2px solid var(--border); color: var(--muted); font-family: var(--pixel); font-size: 10px; }
.dex-cell { text-align: center; font-size: 16px; color: #56697a; background: #0f1a26; border: 1px solid var(--border); padding: 6px 2px; }
.dex-cell.seen { color: var(--muted); }
.dex-cell.tamed { color: var(--ok); border-color: #2f7a4a; background: #13291d; font-size: 18px; }
/* conquistas */
.panel.ach.done { border-color: #2f7a4a; }
.panel.ach h3 { color: var(--text); }
.panel.ach.done h3 { color: var(--ok); }
.cols-2 > .panel + .panel { margin-top: 0; }
/* recompensa diária */
.daily-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 6px; }
.daily-cell { display: flex; flex-direction: column; gap: 3px; padding: 8px; background: var(--bg2); border: 2px solid var(--border); font-size: 16px; }
.daily-cell b { font-family: var(--pixel); font-size: 8px; font-weight: normal; color: var(--teal); }
.daily-cell.past { opacity: 0.5; }
.daily-cell.next { border-color: var(--gold); background: #2a2a1c; }
.daily-cell.next b { color: var(--gold); }
/* Coliseu e ranking */
.ranking tr.me td { color: var(--gold); }
/* configurações e conta */
.set-row { display: grid; grid-template-columns: 90px minmax(0, 1fr) 52px; gap: 10px; align-items: center; margin-bottom: 8px; font-size: 19px; }
.set-row.toggle { grid-template-columns: auto minmax(0, 1fr); cursor: pointer; }
.set-row.joy-pos { grid-template-columns: minmax(0, 1fr) auto; padding-left: 34px; }
.set-row input[type=range] { width: 100%; accent-color: var(--teal); min-height: 44px; }
.set-row input[type=checkbox] { width: 24px; height: 24px; accent-color: var(--teal); }
.recovery-code { font-family: var(--pixel); font-size: 13px; letter-spacing: 1px; color: var(--gold); background: #0f1a26; border: 2px dashed var(--gold); padding: 12px; text-align: center; user-select: all; -webkit-user-select: all; overflow-wrap: anywhere; }
/* moderação */
.mod-chat { background: #0f1a26; border: 1px solid var(--border); padding: 6px 8px; margin: 4px 0 8px; max-height: 140px; overflow-y: auto; }
.mod-log { padding: 4px 0; border-bottom: 1px solid rgba(60, 90, 115, 0.4); font-size: 17px; }
.mod-log b { font-weight: normal; color: var(--teal); }
/* chat do mundo: sussurros, grupo e avisos */
.wh-line.whisper, .wh-line.whisper b { color: #e0b0ff; }
.wh-line.party b { color: #7dffb0; }
.wh-line.sys, .wh-line.sys b { color: var(--gold); }
.wh-line.news { color: #ffd9a8; }
.wh-line.news b { color: #ff9f43; }
.chat-history { display: flex; flex-direction: column; gap: 4px; max-height: 50vh; overflow-y: auto; background: #0b121b; border: 1px solid var(--border); padding: 8px; }
.chat-history .wh-line { text-shadow: none; }
/* quadro do grupo no mapa */
.wh-party { font-family: var(--body); font-size: 16px; text-align: left; color: var(--text); background: rgba(10, 16, 24, 0.72); border: 2px solid rgba(125, 255, 176, 0.45);
  padding: 4px 8px; max-width: min(300px, 60vw); display: flex; flex-direction: column; gap: 1px; cursor: pointer; }
.wh-party b { font-family: var(--pixel); font-size: 8px; font-weight: normal; color: #7dffb0; }
.wh-party span.off { color: var(--muted); }
@media (max-width: 820px), (max-height: 520px) {
  .item-row .btn, .friend-row .btn { flex: 0 0 auto; }
  .dex-row { grid-template-columns: minmax(96px, 1.4fr) repeat(4, minmax(44px, 1fr)); }
  .dex-fam span { font-size: 15px; }
  .set-row { grid-template-columns: 76px minmax(0, 1fr) 48px; }
}
@media (max-height: 520px) and (orientation: landscape) {
  .wh-party { max-width: 40vw; }
  .tab-ico .badge { top: -3px; right: -10px; }
}

/* Loja de Cristais */
.crystal-balance { display: flex; align-items: center; gap: 8px; font-size: 22px; margin: 4px 0 8px; }
.crystal-balance .btn { margin-left: auto; }
.crystal-offer { display: flex; flex-direction: column; gap: 6px; }
.crystal-offer h2 { margin: 0; }
.crystal-offer .btn { margin-top: auto; min-height: 44px; }
.dye-preview { display: flex; justify-content: center; margin-bottom: 10px; }
.dye-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.dye-swatch { height: 44px; border: 3px solid var(--border); cursor: pointer; }
.dye-swatch.active { border-color: var(--gold); box-shadow: 0 0 0 2px var(--bg) inset; }

/* Mercado de Jogadores */
.market-head .btn-row { margin-top: 6px; }
.market-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--border); }
.market-row.mine { opacity: 0.8; }
.market-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.market-row .btn { min-height: 40px; }
.price { display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; }
.market-filter { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.market-filter select { flex: 1 1 140px; min-height: 40px; }

/* páginas de texto (política de privacidade, excluir conta) */
body.doc-page { padding: calc(16px + var(--safe-t)) 16px 32px; }
.doc { max-width: 760px; margin: 0 auto; font-size: 20px; line-height: 1.35; }
.doc h1 { font-size: 18px; line-height: 1.4; }
.doc h2 { margin-top: 18px; }
.doc a { color: var(--teal); }
.doc .login-form { max-width: 420px; }
.doc-check { display: flex; align-items: center; gap: 8px; }
.doc-check input { width: 22px; height: 22px; }

/* pacotes de cristais (Google Play) */
.pack-amount { display: flex; align-items: center; gap: 6px; font-size: 24px; }
.crystal-offer.pack.bonus { border-color: var(--gold); }

/* tutorial: dica com destaque (js/tips.js) */
.tip-layer { position: fixed; inset: 0; z-index: 2000; }
.tip-layer.dim { background: rgba(5, 9, 15, 0.55); }
.tip-hole { position: fixed; border: 3px solid var(--gold); box-shadow: 0 0 0 9999px rgba(5, 9, 15, 0.6); pointer-events: none; animation: tip-pulse 1.4s ease-in-out infinite; }
@keyframes tip-pulse { 50% { border-color: #fff1a8; } }
.tip-bubble { position: fixed; left: 50%; transform: translateX(-50%); width: min(92vw, 380px); background: var(--panel2); border: 3px solid var(--gold);
  padding: 12px 14px; box-shadow: 0 6px 0 rgba(5, 9, 15, 0.6); font-size: 19px; }
.tip-bubble .tip-title { display: block; font-family: var(--pixel); font-size: 11px; color: var(--gold); margin-bottom: 6px; }
.tip-bubble p { margin: 0 0 10px; }
.tip-bubble .btn-row { justify-content: flex-end; }
.tip-bubble .btn { min-height: 44px; }

/* cosméticos (Loja de Cristais › Visual) */
.cosm-name { display: block; font-size: 15px; margin: 6px 0; text-shadow: 0 1px 0 #000; }
.crystal-offer.in-use { outline: 2px solid var(--ok, #6dff8b); }
.crystal-offer.muted-offer { opacity: 0.6; }

/* Passe de Temporada */
/* Passe de Temporada (v0.30): cabeçalho, próximo prêmio, como subir, premium e a trilha */
.pass-hero { background: linear-gradient(160deg, #1d3348 0%, #182638 60%, #14202e 100%); border-color: #3a5a78; }
.pass-hero.premium { background: linear-gradient(160deg, #3a3018 0%, #262214 55%, #182030 100%); border-color: #a07a2a; }
.pass-hero-top { display: flex; align-items: center; gap: 10px; }
.pass-hero-txt { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; }
.pass-hero-txt .chip { align-self: flex-start; }
.pass-level { font-family: var(--pixel); font-weight: normal; font-size: 14px; color: var(--gold); line-height: 1.4; }
.pass-badge { font-family: var(--pixel); font-size: 8px; color: #1a1408; background: linear-gradient(180deg, #ffe08a, #e0a030); padding: 4px 6px; border-radius: 3px; align-self: flex-start; }
.pass-bar { position: relative; height: 22px; margin: 10px 0 6px; background: #0b121b; border: 2px solid #2c3d50; border-radius: 4px; overflow: hidden; }
.pass-bar i { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(180deg, #7ff0e0, #2fae9e); }
.pass-bar span { position: relative; display: block; text-align: center; font-size: 12px; line-height: 18px; color: #fff; text-shadow: 0 1px 0 #000, 0 0 3px #000; }
.pass-claim-all { width: 100%; margin-top: 4px; }
.pass-next h3, .pass-how h3, .pass-prem h3 { margin-top: 0; }
.pass-next-row { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; margin: 6px 0; }
.pass-next-row > .tiny { width: 64px; flex: none; }
.pass-src-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 6px; margin: 8px 0; }
.pass-src { display: flex; align-items: center; gap: 8px; padding: 6px; background: var(--bg2); border: 1px solid var(--border); border-radius: 4px; }
.pass-src-txt { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.pass-src-txt b { font-weight: normal; }
.pass-src-pts { display: flex; flex-direction: column; align-items: flex-end; text-align: right; }
.pass-src-pts b { font-family: var(--pixel); font-weight: normal; font-size: 11px; }
.pass-prem { border-color: #6a5320; }
/* a montaria exclusiva do premium em destaque (v0.31) */
.pass-feat { display: flex; gap: 12px; align-items: center; border-color: #ffb02e; background: radial-gradient(ellipse at 20% 50%, #4a2a10 0%, #1d1a20 70%); box-shadow: 0 0 18px rgba(255, 176, 46, 0.25); }
.pass-feat.on { border-color: #ffd84a; }
.pass-feat-art { flex: none; display: flex; align-items: center; justify-content: center; min-width: 96px; animation: feat-float 2.4s ease-in-out infinite; }
.pass-feat-art canvas { image-rendering: pixelated; max-width: 150px; height: auto; }
@keyframes feat-float { 50% { transform: translateY(-4px); } }
.pass-feat-txt { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.pass-feat-txt b { font-family: var(--pixel); font-size: 12px; color: #ffd98c; font-weight: normal; }
.pass-prem.on { border-color: #a07a2a; background: #241f14; }
.pass-prem .rw-chips { margin: 4px 0 8px; }
.pass-aura { display: flex; align-items: center; gap: 10px; margin: 6px 0; }
.pass-aura .aura-preview { margin: 0; flex: none; }
.pass-head, .pass-row { display: grid; grid-template-columns: 40px 1fr 1fr; gap: 6px; align-items: stretch; }
.pass-head { margin-top: 12px; padding: 0 2px; }
.pass-list { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 12px; max-height: 62vh; overflow-y: auto; padding: 2px; border: 1px solid var(--border); border-radius: 6px; background: #0e1722; }
.pass-row { opacity: 0.7; }
.pass-row.reached, .pass-row.current { opacity: 1; }
.pass-n { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; background: #16263a; border-radius: 6px; }
.pass-n b { font-family: var(--pixel); font-weight: normal; font-size: 11px; color: #8aa3b5; }
.pass-row.reached .pass-n { background: #2b4a3a; }
.pass-row.reached .pass-n b { color: #b8ffd8; }
.pass-row.current .pass-n { background: #3a3218; outline: 2px solid var(--gold); }
.pass-row.current .pass-n b { color: var(--gold); }
.pass-row.milestone .pass-n b { font-size: 13px; }
.pass-n-bar { width: 28px; height: 4px; background: #0b121b; border-radius: 2px; overflow: hidden; }
.pass-n-bar i { display: block; height: 100%; background: #7ff0e0; }
.pass-cell { display: flex; flex-direction: column; gap: 6px; justify-content: space-between; padding: 6px; border-radius: 6px; background: #1a2230; min-height: 44px; border: 1px solid transparent; }
.pass-cell.premium { background: #2a2414; }
.pass-cell.locked .rw-chips { opacity: 0.55; filter: saturate(0.6); }
.pass-cell.ready { border-color: var(--gold); box-shadow: 0 0 8px rgba(255, 204, 77, 0.25); }
.pass-cell.got { border-color: #2f6b4a; }
.pass-cell.got .rw-chips { opacity: 0.6; }
.pass-cell.empty { align-items: center; justify-content: center; color: #6b7a8c; }
.pass-cell .btn { min-height: 36px; }
.pass-cell .rw-chips.big { flex-direction: column; align-items: flex-start; }
.pass-cell .rw-chip { font-size: 12px; }

/* ---------------- Profissões (v0.20) ---------------- */
.job-row { display: flex; align-items: flex-start; gap: 10px; padding: 8px; background: var(--bg2); border: 1px solid var(--border); margin-bottom: 6px; }
.job-row .bar { margin: 3px 0; }
.recipe { padding: 8px; background: var(--bg2); border: 1px solid var(--border); margin-bottom: 8px; }
.recipe.locked { opacity: 0.6; }
.recipe .row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.recipe .row b { font-weight: normal; font-family: var(--pixel); font-size: 9px; line-height: 1.5; }
.recipe p { margin: 6px 0; }
.costs { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0; }
.cost { font-size: 12px; padding: 2px 6px 2px 2px; border: 1px solid var(--border); background: #0b121b; display: inline-flex; align-items: center; gap: 4px; }
.cost.ok { color: #7dffb0; border-color: #2f6b4a; }
.cost.miss { color: #ff9a8a; border-color: #6b2f2f; }
.warn-text { color: #ffb0a0; }
details.panel > summary { cursor: pointer; font-family: var(--pixel); font-size: 10px; padding: 4px 0; min-height: 32px; display: flex; align-items: center; }
details.panel[open] > summary { margin-bottom: 8px; }

/* prévia animada da aura (Loja de Cristais › Visual) */
.aura-preview { display: block; margin: 6px auto; image-rendering: pixelated; background: radial-gradient(ellipse at 50% 80%, #24402a 0%, #15241a 70%); border: 2px solid #0b121b; }

/* ícones dos itens (v0.30, js/itemicons.js): pixel art 16x16 ampliada por número inteiro, num quadradinho
   com a cor da raridade */
.px-img { image-rendering: pixelated; display: block; }
.item-ic { display: inline-flex; align-items: center; justify-content: center; flex: none; padding: 2px; background: #1b2735; border: 2px solid #2c3d50; border-radius: 4px; vertical-align: middle; }
.item-ic.sm { padding: 0; border-width: 1px; border-radius: 3px; }
.item-ic.lg { padding: 4px; }
.item-ic.rar-comum { border-color: #6b7886; }
.item-ic.rar-incomum { border-color: #3fbf62; }
.item-ic.rar-raro { border-color: #4aa8ff; }
.item-ic.rar-epico { border-color: #b07bff; background: #241f38; }
.item-ic.rar-lendario { border-color: #ffb13b; background: #33281a; box-shadow: 0 0 6px rgba(255, 177, 59, 0.45); }
.item-ic.empty { width: 32px; height: 32px; opacity: 0.35; }
.job-row .item-ic { margin-top: 2px; }
.shop-head { display: flex; align-items: center; gap: 10px; }
/* prêmios em fichinhas com ícone (UI.rewardChips) */
.rw-chips { display: inline-flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; vertical-align: middle; max-width: 100%; }
.rw-chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 6px 1px 1px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--border); border-radius: 4px; max-width: 100%; }
.rw-chips.big .rw-chip { padding: 2px 8px 2px 2px; gap: 6px; }
.rw-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin: 6px 0; }
.daily-cell .rw-chips { font-size: 12px; }
/* prévia da sela (a montaria) e da skin (o treinador vestido) */
.out-preview { display: flex; align-items: flex-end; gap: 6px; margin-top: 4px; }
.item-preview { display: inline-flex; align-items: flex-end; justify-content: center; min-width: 52px; padding: 2px 4px; background: radial-gradient(ellipse 24px 6px at 50% 90%, rgba(0, 0, 0, 0.35), transparent), #142030; border: 1px solid var(--border); }
.item-preview canvas { image-rendering: pixelated; display: block; }
.quest-guide { color: #ffe066; font-size: 14px; }

/* =============================================================
   Eventos (v0.31): lista, menu do Festival da Pesca e o mini game de pesca
   ============================================================= */
.fest-canvas { display: block; image-rendering: pixelated; margin: 0 auto; }
.ev-list { display: flex; flex-direction: column; gap: 10px; }
.ev-card { display: flex; flex-direction: column; text-align: left; background: #14202c; border: 2px solid #c9874a; box-shadow: 0 3px 0 #0a111a; cursor: pointer; overflow: hidden; color: var(--text); padding: 0; }
.ev-card:active { transform: translateY(2px); box-shadow: 0 1px 0 #0a111a; }
.ev-card.soon { border-color: var(--border2); opacity: 0.85; }
.ev-card-art { background: #241a46; line-height: 0; overflow: hidden; }
.ev-card-body { display: flex; flex-direction: column; gap: 4px; padding: 8px 10px 10px; }
.ev-card-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.ev-card-top b { font-family: var(--pixel); font-size: 11px; color: #ffd98c; font-weight: normal; }
.ev-card-stats { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.ev-card-stats .chip { display: inline-flex; align-items: center; gap: 4px; }
.chip.ev-live { border-color: #43d6d0; color: #9ff5e8; }
.chip.ev-claim { border-color: #6dff8b; color: #6dff8b; animation: badge-pop 1.2s ease-in-out infinite; }
.chip.ev-prem { border-color: #ffd43b; color: #ffd43b; background: #2a2210; }
/* Caçada aos Soberanos na lista de eventos e no painel (v0.35): o banner do chefe de hoje */
.ev-card.hunt-card { border-color: #ff9a5a; background: #1e1814; }
.ev-card.hunt-card .ev-card-art { background: #0b0812; }
.ev-card.hunt-card .ev-card-top b { color: #ffb37a; }
.ev-card.hunt-card.done { border-color: #4f8a5a; }
.chip.ev-done { border-color: #6dff8b; color: #b8ffc8; }
.hunt-banner { line-height: 0; overflow: hidden; background: #0b0812; border: 2px solid #ff9a5a; margin: 0 0 8px; }
.ev-screen h3 { margin: 4px 0 6px; }
.ev-hero { border: 2px solid #c9874a; background: linear-gradient(#241a46, #14202c 70%); margin-bottom: 10px; box-shadow: 0 3px 0 #0a111a; }
.ev-banner { line-height: 0; overflow: hidden; }
.ev-hero-info { display: flex; gap: 6px; flex-wrap: wrap; padding: 6px 10px 0; }
.ev-level { display: flex; flex-direction: column; gap: 6px; padding: 8px 10px 10px; }
.ev-level b { font-family: var(--pixel); font-size: 10px; color: #fff6d8; font-weight: normal; }
.ev-bar { position: relative; height: 20px; background: #0b1118; border: 2px solid #43d6d0; overflow: hidden; }
.ev-bar i { position: absolute; left: 0; top: 0; bottom: 0; background: repeating-linear-gradient(90deg, #2fb8b0 0 6px, #43d6d0 6px 12px); transition: width 0.5s ease-out; }
.ev-bar span { position: relative; display: block; text-align: center; font-family: var(--pixel); font-size: 8px; line-height: 16px; color: #fff; text-shadow: 1px 1px 0 #000; }
.ev-fish { border-color: #43d6d0; background: radial-gradient(ellipse at 20% 0%, #1d3a4a 0%, #14202c 70%); }
.ev-fish-row { display: flex; gap: 10px; align-items: center; }
.ev-fish-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ev-fish-txt b { font-family: var(--pixel); font-size: 10px; color: #ffcc4d; font-weight: normal; }
.ev-fish-btn { width: 100%; margin-top: 10px; font-size: 14px; letter-spacing: 1px; }
.ev-bar-note { margin: 12px 0 0; }
.ev-fish-btn.primary { animation: fish-btn 1.6s ease-in-out infinite; }
@keyframes fish-btn { 50% { box-shadow: 0 3px 0 #0a111a, 0 0 16px rgba(67, 214, 208, 0.6); } }
.ev-final { border-color: #ffd43b; background: radial-gradient(ellipse at 50% 0%, #3a2e14 0%, #14202c 75%); }
.ev-final-row { display: flex; gap: 12px; justify-content: space-around; flex-wrap: wrap; }
.ev-final-item { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; max-width: 160px; }
.ev-final-item b { font-family: var(--pixel); font-size: 9px; color: #ffd98c; font-weight: normal; }
.ev-final-item .item-preview { min-height: 64px; display: flex; align-items: flex-end; justify-content: center; }
.ev-log { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
.ev-log-cell { display: flex; flex-direction: column; align-items: center; gap: 3px; text-align: center; padding: 6px 4px; background: #0f1a26; border: 1px solid var(--border); }
.ev-log-cell b { font-size: 16px; font-weight: normal; line-height: 1.05; }
.ev-log-cell.unknown .item-ic img { filter: brightness(0) opacity(0.55); }
.ev-how ol { margin: 0 0 8px; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }
.ev-qual { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.ev-got { margin: 6px 0 0; padding-left: 18px; font-size: 17px; }
/* o mini game */
.fg-overlay { position: fixed; inset: 0; z-index: 60; background: #0b1020; display: flex; flex-direction: column; align-items: center; touch-action: none; user-select: none; -webkit-user-select: none;
  padding: calc(6px + var(--safe-t)) 8px 8px; }
.fg-top { width: 100%; max-width: 520px; display: flex; justify-content: space-between; align-items: center; gap: 8px; padding-bottom: 6px; }
.fg-top b { font-family: var(--pixel); font-size: 10px; color: #ffd98c; font-weight: normal; }
.fg-stage { position: relative; flex: 1; display: flex; align-items: center; justify-content: center; width: 100%; }
.fg-canvas { display: block; image-rendering: pixelated; box-shadow: 0 0 0 2px #2a1a0e, 0 8px 24px rgba(0, 0, 0, 0.6); }
.fg-hint { position: absolute; left: 50%; bottom: 6%; transform: translateX(-50%); font-family: var(--pixel); font-size: 10px; color: #fff6d8; background: rgba(10, 16, 24, 0.82);
  border: 2px solid #43d6d0; padding: 8px 12px; pointer-events: none; animation: hint-pulse 1s ease-in-out infinite; white-space: nowrap; }
.fg-hint.gone { display: none; }
@keyframes hint-pulse { 50% { transform: translateX(-50%) scale(1.06); } }
.fg-result { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(420px, calc(100vw - 24px)); max-height: calc(100vh - 24px); overflow-y: auto;
  background: #14202c; border: 3px solid #43d6d0; box-shadow: 0 6px 0 #0a111a, 0 0 30px rgba(67, 214, 208, 0.35); padding: 12px; display: flex; flex-direction: column; gap: 8px; animation: fg-pop 0.25s ease-out; }
.fg-result.won { border-color: #ffd43b; box-shadow: 0 6px 0 #0a111a, 0 0 30px rgba(255, 212, 59, 0.35); }
.fg-result.lost { border-color: #ff7a7a; }
.fg-result h2 { margin: 0; font-family: var(--pixel); font-size: 16px; text-align: center; color: #ffd98c; }
.fg-result.lost h2 { color: #ff9a9a; }
@keyframes fg-pop { from { transform: translate(-50%, -50%) scale(0.85); opacity: 0; } }
.fg-res-fish { display: flex; gap: 10px; align-items: center; }
.fg-res-fish > div { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.fg-res-fish b { font-size: 20px; font-weight: normal; }
.fg-badges { display: flex; flex-wrap: wrap; gap: 4px; }
.chip.fg-perfect { border-color: #c08bff; color: #e0c8ff; }
.chip.fg-record { border-color: #6dff8b; color: #6dff8b; }
.fg-points { display: flex; flex-direction: column; gap: 2px; font-size: 17px; background: #0f1a26; border: 1px solid var(--border); padding: 6px 8px; }
.fg-points b { font-family: var(--pixel); font-size: 12px; font-weight: normal; margin-top: 2px; }
.fg-prize { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.fg-retry { position: absolute; left: 50%; bottom: 20px; transform: translateX(-50%); background: #14202c; border: 2px solid #ff7a7a; padding: 10px; text-align: center; }
@media (max-height: 520px) and (orientation: landscape) {
  .fg-result { width: min(680px, calc(100vw - 24px)); gap: 6px; padding: 10px; }
  .fg-result .btn.big { min-height: 44px; }
}

/* ---------- v0.37: texto ao tocar (UI.fold, UI.hint, UI.howTo) ---------- */
details.fold { margin: 0; }
details.fold > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 6px; min-height: 28px; -webkit-user-select: none; user-select: none; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::after { content: ''; flex: 0 0 auto; width: 0; height: 0; margin-left: 2px; border-left: 5px solid var(--muted); border-top: 4px solid transparent; border-bottom: 4px solid transparent; transition: transform 0.12s; }
details.fold[open] > summary::after { transform: rotate(90deg); }
details.fold > .fold-body { padding: 4px 0 2px; }
details.fold.how { margin: -4px 0 10px; }
details.fold.how > summary { color: var(--muted); font-size: 17px; }
.how-head { display: inline-flex; align-items: center; gap: 4px; }
.hint-btn { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; padding: 0; border: 1px solid var(--border2); border-radius: 50%; background: transparent; color: var(--muted); font-family: var(--pixel); font-size: 9px; cursor: pointer; flex: 0 0 auto; }
.hint-btn[aria-expanded="true"] { color: var(--gold); border-color: var(--gold); }
.hint-btn.as-text { pointer-events: none; }
.panel-head { gap: 8px; align-items: center; flex-wrap: nowrap; }
.panel-head h2 { margin: 0; }
.hint-text { margin: 4px 0 8px; }
.it-info details.fold > summary { min-height: 22px; }

/* ---------- v0.37: menu Mais em grade ---------- */
.menu-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.menu-tile { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 76px; padding: 8px 4px;
  background: var(--panel2); border: 2px solid var(--border); color: var(--text); font-family: var(--pixel); font-size: 8px; line-height: 1.35; text-align: center; cursor: pointer; }
.menu-tile:active { transform: translateY(1px); }
.menu-tile .px-icon { width: 24px; height: 24px; }
.menu-tile.gold { border-color: var(--gold); color: var(--gold); }
.menu-tile.primary { border-color: var(--teal); }
.menu-tile.danger { border-color: #8a3a3a; color: #ff9a9a; }
.menu-tile .badge { position: absolute; top: 4px; right: 6px; }
.menu-group { margin: 10px 0 6px; color: var(--muted); font-family: var(--pixel); font-size: 8px; text-transform: uppercase; letter-spacing: 1px; }
.menu-group:first-child { margin-top: 0; }
.menu-foot { margin: 10px 0 0; }
@media (max-width: 360px) { .menu-grid { grid-template-columns: repeat(2, 1fr); } }

/* ---------- v0.37: ficha compacta ---------- */
.mini-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 8px; }
.mini-chip { display: inline-flex; align-items: center; gap: 4px; min-height: 28px; padding: 2px 8px; border: 1px solid var(--border2); background: var(--bg2); color: var(--text); font-family: var(--body); font-size: 17px; cursor: pointer; }
.mini-chip[aria-pressed="true"] { border-color: var(--gold); }
.mini-chip.off { color: var(--muted); }
.chip-info { margin: -2px 0 10px; padding: 6px 8px; border-left: 3px solid var(--gold); background: var(--bg2); font-size: 17px; }
.ab-row > summary { padding: 6px 4px; border-bottom: 1px solid var(--border); }
.ab-row .ab-cat { width: 10px; height: 10px; flex: 0 0 auto; border: 1px solid #0a111a; }
.ab-row .ab-name { font-family: var(--pixel); font-size: 9px; line-height: 1.4; }
.ab-row .ab-slot { margin-left: auto; color: var(--muted); font-size: 15px; white-space: nowrap; }
.ab-row > .fold-body { padding: 6px 0 8px; }
.detail-actions { margin: 8px 0 4px; }
