/* =============================================================
   HUD DO JOGO: topo, painéis laterais, botões, etiquetas 3D
   ============================================================= */
.hud { pointer-events: none; }
.hud > * { pointer-events: auto; }
.hud .hint, .hud .banner { pointer-events: none; }

.top-left, .top-right, .top-mid { position: absolute; top: max(10px, env(safe-area-inset-top, 0px)); }
.top-left { left: max(10px, env(safe-area-inset-left, 0px)); }
.top-right { right: max(10px, env(safe-area-inset-right, 0px)); display: flex; gap: 6px; }
.top-mid { left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; }

/* cartão da vez */
#turn-card {
  display: flex; align-items: center; gap: 10px; padding: 5px 14px 5px 5px; border-radius: 18px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--tc) 35%, rgba(14, 18, 40, 0.9)), rgba(14, 18, 40, 0.86));
  border: 1px solid color-mix(in srgb, var(--tc) 55%, transparent);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); max-width: 40cqw;
}
.tc-ava { position: relative; width: 44px; height: 44px; flex: none; }
.tc-ava img { width: 38px; height: 38px; border-radius: 50%; position: absolute; left: 3px; top: 3px; object-fit: cover; background: radial-gradient(circle at 50% 30%, color-mix(in srgb, var(--tc) 55%, #fff), #1a1d40); }
.tc-ava .ring { position: absolute; inset: 0; transform: rotate(-90deg); }
.tc-ava .ring circle { fill: none; stroke: var(--tc); stroke-width: 3.5; stroke-linecap: round; transition: stroke-dashoffset 0.25s linear; }
.tc-ava .ring circle.low { stroke: var(--red); }
.tc-txt { min-width: 0; }
.tc-txt b { display: block; font-family: var(--display); font-weight: 400; font-size: 18px; line-height: 1.05; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tc-txt small { display: block; font-size: 11.5px; font-weight: 800; color: #d8d4f0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tc-time { font-family: var(--display); font-size: 20px; min-width: 24px; text-align: right; font-variant-numeric: tabular-nums; }

.round { font-family: var(--display); font-size: 15px; padding: 6px 12px; border-radius: 99px; background: rgba(14, 18, 40, 0.8); border: 1px solid var(--line); white-space: nowrap; }
.order { display: flex; gap: 4px; padding: 3px; border-radius: 99px; background: rgba(14, 18, 40, 0.7); border: 1px solid var(--line); }
.oav { width: 30px; height: 30px; border-radius: 50%; overflow: hidden; box-shadow: 0 0 0 2px var(--tc); opacity: 0.6; transition: 0.2s; background: #1a1d40; }
.oav img { width: 100%; height: 100%; object-fit: cover; }
.oav.cur { opacity: 1; transform: scale(1.12); box-shadow: 0 0 0 2.5px var(--tc), 0 0 14px var(--tc); }
.oav.out { filter: grayscale(1); opacity: 0.3; }

/* painéis laterais */
.panel {
  position: absolute; top: calc(max(10px, env(safe-area-inset-top, 0px)) + 58px);
  background: linear-gradient(180deg, rgba(24, 28, 62, 0.93), rgba(14, 17, 40, 0.93));
  border: 1px solid var(--line); border-radius: 20px; box-sizing: border-box;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45); overflow: auto; overscroll-behavior: contain; touch-action: pan-y;
  animation: slideIn 0.22s ease-out;
}
.panel.left { left: max(10px, env(safe-area-inset-left, 0px)); width: clamp(220px, 29cqw, 300px); bottom: 12px; padding: 12px; border-top: 3px solid var(--owner, var(--line)); }
@keyframes slideIn { from { opacity: 0; transform: translateY(10px); } }
.ip-head { display: flex; gap: 10px; align-items: center; padding-right: 30px; }
.ip-stage { width: 92px; height: 92px; flex: none; border-radius: 16px; background: radial-gradient(70% 70% at 50% 35%, color-mix(in srgb, var(--tc) 45%, #1a1d40), #10122a); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08); }
.ip-title { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.ip-title h3 { font-size: 22px; line-height: 1; }
.ip-title small { font-size: 11.5px; color: var(--muted); font-weight: 800; line-height: 1.3; }
.ip-title .owner { font-size: 11.5px; font-weight: 900; color: var(--owner); }
.ip-hp { display: flex; align-items: center; gap: 8px; margin: 10px 0 8px; font-weight: 900; font-size: 13px; font-variant-numeric: tabular-nums; }
.hpbar { flex: 1; height: 10px; border-radius: 99px; background: rgba(0, 0, 0, 0.45); overflow: hidden; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1); }
.hpbar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(180deg, #8dffb3, #2fcf6a); transition: width 0.35s; }
.hpbar i.mid { background: linear-gradient(180deg, #ffe680, #f2b51c); }
.hpbar i.low { background: linear-gradient(180deg, #ff8a9a, #e8334f); }
.ip-fx { display: flex; flex-wrap: wrap; gap: 5px; margin: 8px 0 2px; }
.ip-fx span { font-size: 11.5px; font-weight: 900; padding: 2px 8px; border-radius: 8px; }
.ip-fx .good, .mp-fx .good { background: #1d8f4a; } .ip-fx .bad, .mp-fx .bad { background: #4a2350; color: #ffc2cf; }


/* botões de baixo */
.bottom-right { position: absolute; bottom: max(10px, env(safe-area-inset-bottom, 0px)); right: max(10px, env(safe-area-inset-right, 0px)); }
.bottom-right { right: max(10px, env(safe-area-inset-right, 0px)); }
.btn.end { padding: 13px 20px; font-family: var(--display); font-weight: 400; font-size: 18px; letter-spacing: 0.02em; border-radius: 18px; }
.btn.end .ic { width: 20px; height: 20px; }
.btn.end.pulse { animation: endPulse 1.3s ease-in-out infinite; }
@keyframes endPulse { 50% { box-shadow: 0 4px 0 #b86a00, 0 0 0 6px rgba(255, 208, 77, 0.35), 0 8px 30px rgba(255, 160, 30, 0.5); } }

.hint {
  position: absolute; left: 50%; bottom: max(14px, env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 10px);
  max-width: min(46cqw, 520px); text-align: center; padding: 8px 16px; border-radius: 99px;
  background: rgba(14, 18, 40, 0.86); border: 1px solid var(--line); font-weight: 800; font-size: 13.5px; line-height: 1.3;
  opacity: 0; transition: 0.25s;
}
.hint.show { opacity: 1; transform: translate(-50%, 0); }
/* aviso de ligação: "X sem ligação…" (por baixo da ordem dos domadores) */
.top-mid { flex-wrap: wrap; justify-content: center; }
.net-warn {
  flex-basis: 100%; margin-top: 2px; padding: 4px 12px; border-radius: 99px; font-weight: 800; font-size: 12px; text-align: center;
  background: rgba(60, 18, 24, 0.9); border: 1px solid rgba(255, 106, 106, 0.6); color: #ffd6d6;
  animation: netpulse 1.6s ease-in-out infinite;
}
.net-warn[hidden] { display: none; }
@keyframes netpulse { 50% { opacity: 0.65; } }
.cf-ic { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; flex: none; background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--tc) 85%, #fff), var(--tc)); }
.cf-ic .ic { width: 24px; height: 24px; stroke: #fff; stroke-width: 2.1; }

.banner {
  position: absolute; left: 50%; top: 22%; transform: translate(-50%, -10px) scale(0.92); text-align: center;
  opacity: 0; transition: opacity 0.25s, transform 0.3s cubic-bezier(.2, 1.4, .4, 1);
}
.banner.show { opacity: 1; transform: translate(-50%, 0) scale(1); }
.banner b { display: block; font-family: var(--display); font-weight: 400; font-size: clamp(26px, 4.5cqw, 40px); color: var(--bc); -webkit-text-stroke: 6px #0d1124; paint-order: stroke fill; white-space: nowrap; filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.5)); }
.banner small { display: block; font-weight: 900; font-size: 14px; color: #fff; -webkit-text-stroke: 4px #0d1124; paint-order: stroke fill; margin-top: 2px; }

/* etiquetas sobre os monstros */
.ulabel { position: absolute; left: 0; top: 0; width: 0; height: 0; will-change: transform; }
.ul-bar { position: absolute; left: -26px; top: -5px; width: 52px; height: 8px; border-radius: 6px; background: rgba(8, 10, 24, 0.85); border: 2px solid var(--tc); overflow: hidden; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5); }
.ul-bar { opacity: 0; transition: opacity 0.3s; }
.ulabel.hp-on .ul-bar { opacity: 1; }
.ul-bar i { position: absolute; left: 0; top: 0; display: block; height: 100%; width: 100%; background: linear-gradient(180deg, #8dffb3, #2fcf6a); transition: width 0.25s; }
.ul-bar b { position: absolute; left: 0; top: 0; display: block; height: 100%; width: 100%; background: #fff4c2; transition: width 0.7s 0.45s; }
.ul-bar i.mid { background: linear-gradient(180deg, #ffe680, #f2b51c); }
.ul-bar i.low { background: linear-gradient(180deg, #ff8a9a, #e8334f); }
.ulabel.bench .ul-bar { width: 36px; left: -18px; height: 6px; border-width: 1.5px; }
.ulabel.wild .ul-bar { width: 32px; left: -16px; border-color: #e8e0c8; }
/* efeitos: ícones redondos à volta do monstro (posição em js/render/scene.js, ringFx) */
.ul-ring { position: absolute; left: 0; top: 0; }
.ul-ring span { position: absolute; left: 0; top: 0; width: 17px; height: 17px; border-radius: 50%; display: flex; align-items: center; justify-content: center; border: 1.5px solid rgba(255, 255, 255, 0.9); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.55); }
.ul-ring .good { background: #1fa855; color: #fff; }
.ul-ring .bad { background: #2a1b2e; color: #ff9fb4; border-color: #ff9fb4; }
.ul-ring .more { background: rgba(8, 10, 24, 0.85); font-size: 9px; font-weight: 900; }
.ul-ring .fx-ic { position: relative; margin: 0; }
.ul-ring .fx-ic .ic { width: 11px; height: 11px; }
.ul-ring .fx-ic b { position: absolute; right: -7px; top: -8px; font-size: 9px; line-height: 1; margin: 0; text-shadow: 0 0 2px #000, 0 0 2px #000; color: #fff; }
.fx-ic { display: inline-flex; align-items: center; vertical-align: -2px; margin-right: 3px; font-style: normal; }
.fx-ic .ic { width: 12px; height: 12px; }
.fx-ic b { font-size: 9px; margin-left: 1px; }
.tlabel { position: absolute; left: 0; top: 0; transform-origin: 0 0; white-space: nowrap; font-weight: 900; font-size: 11px; padding: 1px 8px; border-radius: 99px; background: rgba(8, 10, 24, 0.7); border: 1.5px solid var(--tc); opacity: 0.75; }   /* centrada e ampliada em js/render/scene.js */
.tlabel.active { background: var(--tc); color: #0d1124; opacity: 1; box-shadow: 0 0 12px var(--tc); }

.float {
  position: absolute; transform: translate(-50%, -50%); pointer-events: none; white-space: nowrap;
  font-family: var(--display); font-size: 30px; -webkit-text-stroke: 6px #0d1124; paint-order: stroke fill;
  animation: floatUp 1.4s ease-out forwards;
}
.float { scale: var(--uis, 1); }   /* cresce com a interface (MB.UI.fit) */
.float.dmg { color: #fff; }
.float.dmg.super { color: #ffd04d; font-size: 38px; }
.float.dmg.weak { color: #c9c3e6; font-size: 24px; }
.float.heal { color: #7dffb0; }
.float.ko { color: var(--red); font-size: 44px; }
.float.tag { font-family: var(--body); font-weight: 900; font-size: 15px; -webkit-text-stroke: 4px #0d1124; color: #fff; }
.float.tag.super { color: #ffd04d; } .float.tag.weak { color: #c9c3e6; } .float.tag.good { color: #8fd0ff; } .float.tag.bad { color: #d6a2ff; }
@keyframes floatUp {
  0% { opacity: 0; transform: translate(-50%, -20%) scale(0.5); }
  12% { opacity: 1; transform: translate(-50%, -70%) scale(1.25); }
  25% { transform: translate(-50%, -80%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -230%); }
}

/* aviso para rodar o telemóvel */
.rotate-tip { position: absolute; inset: 0; z-index: 20; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; background: rgba(6, 8, 20, 0.9); text-align: center; padding: 24px; }
.rotate-tip p { font-weight: 900; font-size: 17px; max-width: 280px; }
.rt-phone { width: 56px; height: 96px; border-radius: 12px; border: 4px solid var(--gold); animation: turnPhone 1.8s ease-in-out infinite; }
@keyframes turnPhone { 40%, 70% { transform: rotate(-90deg); } }

/* fim */
.over-card { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; max-width: 420px; }
.over-card .kicker { font-size: 12px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--muted); font-weight: 900; }
.over-card h2 { font-size: clamp(34px, 7cqw, 54px); -webkit-text-stroke: 7px #0d1124; paint-order: stroke fill; filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.5)); }
.over-card p { font-weight: 800; color: #dcd8f0; }

/* telemóvel ao alto (se o jogador quiser continuar assim) */
body.portrait .top-mid { top: calc(max(10px, env(safe-area-inset-top, 0px)) + 56px); }
body.portrait #turn-card { max-width: 54cqw; }
body.portrait .top-right .icon-btn { width: 36px; height: 36px; }
@container app (max-height: 430px) {
  .ip-stage { width: 72px; height: 72px; }
  .ip-title h3 { font-size: 19px; }
  .btn.end { padding: 10px 16px; font-size: 16px; }
}

/* janela "trocar por qual?" */
.swap-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.swap-opt { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px; border-radius: 16px; background: radial-gradient(100% 80% at 50% 30%, color-mix(in srgb, var(--tc) 30%, transparent), rgba(255, 255, 255, 0.05)); border: 2px solid color-mix(in srgb, var(--tc) 40%, transparent); }
.swap-opt:active { transform: scale(0.97); }
.swap-opt img { width: 72px; height: 72px; }
.swap-opt b { font-family: var(--display); font-weight: 400; font-size: 18px; }
.swap-opt small { color: var(--muted); font-weight: 800; }

/* linha de ataque curta: ícone + nome + poder/alcance */
.atk-txt .am { display: flex; gap: 8px; margin-top: 2px; }
.atk-txt .am i { display: inline-flex; align-items: center; gap: 2px; font-style: normal; font-variant-numeric: tabular-nums; }
.atk-txt .am .ic { width: 12px; height: 12px; stroke-width: 2.4; opacity: 0.8; }
.atk-txt b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.btn.end.next { background: linear-gradient(180deg, #6fc0ff, #2f86e8); box-shadow: 0 4px 0 #1a5aa8; color: #fff; }

/* ecrãs pequenos (telemóvel deitado): tudo mais compacto para caberem os 4 ataques */
@container app (max-height: 500px) or (max-width: 700px) {
  .panel.left { width: clamp(170px, 26cqw, 230px); padding: 8px; bottom: 8px; }
  .ip-stage { width: 56px; height: 56px; border-radius: 12px; }
  .ip-title h3 { font-size: 16px; }
  .ip-title small, .ip-title .owner { font-size: 10.5px; }
  .ip-hp { margin: 6px 0 4px; font-size: 11.5px; }
  .hpbar { height: 7px; }
  .btn.end { padding: 8px 12px; font-size: 14px; border-radius: 14px; }
  .btn.end .ic { width: 16px; height: 16px; }
  #turn-card { padding: 3px 10px 3px 3px; gap: 6px; }
  .tc-ava { width: 36px; height: 36px; } .tc-ava img { width: 30px; height: 30px; }
  .tc-txt b { font-size: 14px; } .tc-txt small { font-size: 10px; }
  .round { font-size: 12px; padding: 4px 9px; }
  .oav { width: 24px; height: 24px; }
  .top-right .icon-btn { width: 34px; height: 34px; border-radius: 11px; }
  .hint { font-size: 11.5px; padding: 5px 12px; max-width: 40cqw; }
  .banner b { font-size: 24px; }
}


/* =============================================================
   PAINÉIS RECOLHÍVEIS (2026-10-30): mais mapa, menos interface
   ============================================================= */
/* --- esquerda: monstro selecionado --- */
.mpanel { position: static; }
.mp-tab {
  position: absolute; left: max(8px, env(safe-area-inset-left, 0px)); top: calc(max(10px, env(safe-area-inset-top, 0px)) + 62px);
  display: flex; align-items: center; gap: 2px; padding: 4px 4px 4px 4px; border-radius: 18px;
  background: rgba(14, 18, 40, 0.86); border: 2px solid #3ea2ff; box-shadow: 0 8px 22px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); animation: slideIn 0.2s ease-out;
}
.mp-tab.foe { border-color: #ff3448; }
.mp-tab-img { width: 46px; height: 46px; border-radius: 14px; overflow: hidden; background: radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--tc) 55%, #1a1d40), #10122a); }
.mp-tab-img img { width: 100%; height: 100%; object-fit: contain; display: block; }
.mp-tab .mi .ic { width: 20px; height: 20px; color: var(--gold); stroke-width: 2.6; }
.mp-tab:active { transform: scale(0.95); }
/* efeitos do monstro selecionado, por baixo do ícone, com o painel fechado */
.mp-fx { position: absolute; left: 0; top: calc(100% + 6px); display: flex; flex-direction: column; align-items: flex-start; gap: 4px; pointer-events: none; }
.mp-fx:empty { display: none; }
.mp-fx span { font-size: 11px; font-weight: 900; padding: 2px 8px; border-radius: 8px; white-space: nowrap; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45); color: #fff; }
.panel.left .close { position: absolute; right: 6px; top: 6px; width: 32px; height: 32px; border-radius: 10px; z-index: 2; }
.panel.left .close .ic { color: var(--gold); stroke-width: 2.6; }
.ip-tabs { display: flex; gap: 4px; margin: 8px 0 8px; padding: 3px; border-radius: 12px; background: rgba(0, 0, 0, 0.3); }
.ip-tabs button { flex: 1; padding: 6px 4px; border-radius: 9px; font-weight: 900; font-size: 12.5px; color: var(--muted); }
.ip-tabs button[aria-selected="true"] { background: rgba(255, 255, 255, 0.12); color: #fff; box-shadow: inset 0 -2px 0 var(--tc); }
.ip-skills { display: flex; flex-direction: column; gap: 6px; }
.sk .cdmax { position: absolute; right: 6px; top: 6px; font-size: 10px; font-weight: 800; color: var(--muted); }
.sk { position: relative; display: flex; gap: 8px; align-items: flex-start; padding: 7px; border-radius: 12px; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line); }
.sk .atk-ic { width: 32px; height: 32px; border-radius: 10px; }
.sk .atk-ic .ic { width: 18px; height: 18px; }
.sk-txt { flex: 1; min-width: 0; }
.sk-txt b { display: block; font-size: 13px; font-weight: 900; line-height: 1.15; padding-right: 18px; }
.sk-txt p { font-size: 11.5px; color: #d6d2ee; line-height: 1.3; margin: 2px 0 3px; }
.sk .cd { position: absolute; right: 6px; top: 6px; min-width: 18px; height: 18px; border-radius: 99px; background: #ff9a1f; color: #2a1200; display: grid; place-items: center; font-weight: 900; font-size: 11px; }
.am { display: flex; flex-wrap: wrap; gap: 4px 8px; font-size: 11px; font-weight: 900; color: var(--muted); }
.am i { display: inline-flex; align-items: center; gap: 3px; font-style: normal; font-variant-numeric: tabular-nums; white-space: nowrap; }
.am .ic { width: 12px; height: 12px; stroke-width: 2.4; }
.am .m-dmg { color: #ffb0a0; } .am .m-dmg.none { color: var(--muted); font-weight: 800; }
.am .m-rng { color: #a9d2ff; }
.am .m-kind { color: #d8c6ff; font-weight: 800; }
.panel.left .ip-stats { display: flex; flex-direction: column; gap: 6px; }

/* --- direita: ataques (só ícones; a seta abre nome, dano e tiles) --- */
.apanel {
  position: absolute; right: max(8px, env(safe-area-inset-right, 0px)); top: calc(max(10px, env(safe-area-inset-top, 0px)) + 58px);
  max-height: calc(100% - max(10px, env(safe-area-inset-top, 0px)) - 58px - max(10px, env(safe-area-inset-bottom, 0px)) - 62px);
  display: flex; flex-direction: column; align-items: flex-end; gap: 6px; overflow: auto; overscroll-behavior: contain; touch-action: pan-y;
  animation: slideIn 0.2s ease-out;
}
.ap-top { display: flex; align-items: center; gap: 5px; flex: none; }
.ap-exp { width: 38px; height: 30px; border-radius: 11px; display: grid; place-items: center; background: rgba(14, 18, 40, 0.86); border: 1px solid var(--line); flex: none; }
.ap-exp .ic { width: 20px; height: 20px; color: var(--gold); stroke-width: 2.6; }
.apanel .mov { display: inline-flex; align-items: center; gap: 3px; padding: 3px 9px; border-radius: 99px; background: rgba(20, 50, 100, 0.85); color: #9fd0ff; border: 1px solid rgba(61, 139, 255, 0.4); flex: none; }
.apanel .mov b { font-family: var(--display); font-weight: 400; font-size: 15px; color: #fff; }
.apanel .mov small { font-weight: 900; font-size: 11px; }
.apanel .mov .ic { width: 14px; height: 14px; }
.ap-list { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.apanel .atk-row { width: auto; padding: 4px; gap: 8px; border-radius: 15px; background: rgba(14, 18, 40, 0.82); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.apanel .atk-ic { width: 44px; height: 44px; border-radius: 12px; }
.apanel .atk-ic .ic { width: 24px; height: 24px; }
.apanel .atk-txt { display: none; }
.apanel .atk-row .cd { right: -3px; top: -3px; min-width: 18px; height: 18px; font-size: 11px; }
.apanel.open .atk-row { width: min(230px, 46cqw); padding: 4px 10px 4px 4px; }
.apanel.open .atk-txt { display: block; }
.apanel.open .atk-txt b { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.apanel.open .atk-row .cd { right: 6px; top: 6px; }
.apanel.acted .ap-list::after { content: ""; }

/* confirmação pequena: ícone + "Atacar" */
.confirm {
  position: absolute; left: 50%; bottom: calc(max(12px, env(safe-area-inset-bottom, 0px)) + 44px); transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px; padding: 5px; border-radius: 18px;
  background: linear-gradient(180deg, rgba(34, 40, 84, 0.97), rgba(18, 22, 48, 0.97)); border: 1px solid rgba(255, 208, 77, 0.45);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5); animation: pop 0.18s ease-out;
}
.confirm .cf-ic { width: 38px; height: 38px; border-radius: 12px; }
.confirm .cf-ic .ic { width: 22px; height: 22px; }
.confirm .btn { padding: 9px 18px; font-family: var(--display); font-weight: 400; font-size: 17px; letter-spacing: 0.02em; }

@container app (max-height: 500px) or (max-width: 700px) {
  .mp-tab { top: calc(max(6px, env(safe-area-inset-top, 0px)) + 50px); }
  .mp-tab-img { width: 40px; height: 40px; border-radius: 12px; }
  .apanel { top: calc(max(6px, env(safe-area-inset-top, 0px)) + 48px); gap: 5px; max-height: calc(100% - max(6px, env(safe-area-inset-top, 0px)) - 48px - max(6px, env(safe-area-inset-bottom, 0px)) - 52px); }
  .ap-list { gap: 5px; }
  .apanel .atk-ic { width: 40px; height: 40px; }
  .apanel .atk-ic .ic { width: 22px; height: 22px; }
  .panel.left { width: clamp(200px, 30cqw, 250px); }
  .sk { padding: 5px; gap: 6px; }
  .sk-txt p { font-size: 10.5px; }
  .ip-tabs { margin: 5px 0; }
  .ip-tabs button { padding: 4px; font-size: 11.5px; }
  .confirm { bottom: calc(max(8px, env(safe-area-inset-bottom, 0px)) + 36px); }
  .confirm .btn { padding: 7px 14px; font-size: 15px; }
  .confirm .cf-ic { width: 32px; height: 32px; }
}
@container app (max-height: 380px) {
  .apanel .atk-ic { width: 36px; height: 36px; }
  .apanel .mov small { display: none; }
}
body.portrait .panel.left { width: min(300px, 78cqw); top: calc(max(10px, env(safe-area-inset-top, 0px)) + 100px); bottom: 74px; max-height: none; }
body.portrait .mp-tab { top: calc(max(10px, env(safe-area-inset-top, 0px)) + 100px); }
body.portrait .apanel { top: calc(max(10px, env(safe-area-inset-top, 0px)) + 100px); }
body.portrait .hint { bottom: 70px; max-width: 80cqw; }
body.portrait .confirm { bottom: 120px; }

/* pontos do rank no fim da partida */
.over-rank { margin: 6px 0 0; padding: 8px 14px; border-radius: 14px; background: rgba(255, 255, 255, 0.08); font-weight: 900; font-size: 16px; }
.over-rank .up { color: #7dffb0; } .over-rank .down { color: #ff8a7a; }
.over-rank small { display: block; font-size: 12px; font-weight: 800; color: var(--muted, #aab); margin-top: 2px; }
.over-rank[hidden] { display: none; }
.over-rank .liga-fim { display: inline-flex; align-items: center; gap: 10px; text-align: left; }
.over-rank .liga-fim svg { flex: none; }
.over-rank .lf-emb { flex: none; display: grid; place-items: center; width: 46px; }
.over-rank .lf-emb.lf-flash { animation: lf-flash .9s ease-out; }
@keyframes lf-flash { 0% { transform: scale(1); filter: brightness(1); } 25% { transform: scale(1.35); filter: brightness(2.2) drop-shadow(0 0 12px #fff6c0); } 100% { transform: scale(1); filter: brightness(1); } }
.over-rank .lf-txt { display: flex; flex-direction: column; min-width: 170px; }
.over-rank .lf-head { opacity: .35; transition: opacity .4s; }
.over-rank .lf-head.lf-mostra { opacity: 1; }
.over-rank .lf-linha { display: flex; align-items: center; gap: 8px; margin-top: 5px; }
.over-rank .lf-bar { flex: 1; height: 9px; border-radius: 99px; background: rgba(255, 255, 255, 0.12); overflow: hidden; position: relative; min-width: 110px; }
.over-rank .lf-bar i { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: 99px; background: linear-gradient(90deg, #ff9a1f, #ffd04d); box-shadow: 0 0 8px rgba(255, 208, 77, 0.7); }
.over-rank .lf-desce .lf-bar i { background: linear-gradient(90deg, #b04050, #ff8a7a); box-shadow: none; }
.over-rank .lf-pl { font-family: var(--display); font-weight: 400; font-size: 15px; min-width: 64px; text-align: right; white-space: nowrap; }
.over-rank .lf-pos { opacity: 0; transition: opacity .4s; font-size: 13px; }
.over-rank .lf-pos.lf-mostra, .over-rank .lf-pos:not(:empty) { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .over-rank .lf-emb.lf-flash { animation: none; } }
/* XP no fim da partida (js/core/progresso.js) */
.over-rank .xp-ach { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 4px; font-size: 13px; }
.over-rank .xp-ach svg { flex: none; }
.over-rank .xp-mis { width: 18px; height: 18px; display: inline-flex; color: #7dffb0; }
.over-rank .xp-mis svg { width: 100%; height: 100%; }
.over-rank .xp-moedas { display: flex; align-items: center; justify-content: center; gap: 4px; font-weight: 900; color: #ffcc33; }
.over-rank .xp-moedas .mi { width: 16px; height: 16px; display: inline-flex; }
.over-rank .xp-moedas .mi svg { width: 100%; height: 100%; }
.over-rank .xp-fim { display: block; margin-top: 6px; }
.over-rank .liga-fim + .xp-fim, .over-rank small + .xp-fim { padding-top: 6px; border-top: 1px solid rgba(255, 255, 255, 0.1); }
.over-rank .xp-fim > .up { display: block; }
.over-rank .xp-barra { display: block; height: 6px; margin: 6px 0 2px; border-radius: 3px; background: rgba(255, 255, 255, 0.12); overflow: hidden; }
.over-rank .xp-barra i { display: block; height: 100%; border-radius: 3px; background: linear-gradient(90deg, #7dffb0, #4dd2ff); }

/* ===== mensagens rápidas e emotes (js/ui/chat.js) ===== */
.chat-pop { position: absolute; z-index: 31; left: max(10px, env(safe-area-inset-left, 0px)); bottom: calc(max(12px, env(safe-area-inset-bottom, 0px)) + 66px); width: min(320px, calc(100% - 20px)); max-height: calc(100% - 140px); overflow-y: auto; padding: 10px 12px 12px; border-radius: 18px;
  background: linear-gradient(180deg, rgba(44, 50, 108, 0.97), rgba(20, 23, 54, 0.97)); border: 1px solid var(--line); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); animation: cp-in 0.18s ease-out; }
.chat-pop[hidden] { display: none; }
@keyframes cp-in { from { opacity: 0; transform: translateY(-6px) scale(0.97); } }
.cp-h { display: flex; align-items: baseline; justify-content: space-between; margin: 2px 2px 6px; }
.cp-h b { font-size: 11px; font-weight: 900; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.cp-espera { font-size: 11px; font-weight: 900; color: #ff9d5c; }
.cp-emotes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 10px; }
.cp-emotes button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px 6px; border-radius: 14px; background: rgba(255, 255, 255, 0.07); border: 1px solid rgba(255, 255, 255, 0.08); color: inherit; }
.cp-emotes button i { font-style: normal; font-size: 26px; line-height: 1; }
.cp-emotes button small { font-size: 10px; font-weight: 800; color: var(--muted); }
.cp-emotes button:active, .cp-msgs button:active { transform: scale(0.95); }
.cp-msgs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.cp-msgs button { padding: 8px 8px; border-radius: 12px; font-size: 12.5px; font-weight: 800; text-align: left; color: inherit; background: rgba(255, 255, 255, 0.07); border: 1px solid rgba(255, 255, 255, 0.08); }
.chat-pop.a-espera .cp-emotes button, .chat-pop.a-espera .cp-msgs button { opacity: 0.4; }
.cp-mudo { margin-top: 10px; width: 100%; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 6px; border-radius: 10px; font-size: 11.5px; font-weight: 800; color: var(--muted); background: none; border: 1px dashed rgba(255, 255, 255, 0.15); }
.cp-mudo svg { width: 16px; height: 16px; }
.cp-mudo.on { color: #ff9d5c; border-color: rgba(255, 157, 92, 0.5); }
/* balão por cima do domador (posição em js/render/scene.js) */
.tsay { position: absolute; left: 0; top: 0; transform-origin: 0 0; z-index: 3; pointer-events: none; white-space: nowrap; max-width: 220px; padding: 6px 12px; border-radius: 14px; font-weight: 900; font-size: 13px; color: #10122a; background: #fff; border: 2px solid var(--tc); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35); animation: tsay-in 0.28s cubic-bezier(.2, 1.4, .4, 1), tsay-out 0.35s ease-in 2.85s forwards; }
.tsay::after { content: ""; position: absolute; left: 50%; bottom: -8px; width: 12px; height: 12px; background: #fff; border-right: 2px solid var(--tc); border-bottom: 2px solid var(--tc); transform: translateX(-50%) rotate(45deg); }
.tsay.emote { padding: 4px 8px; border-radius: 50%; }
.tsay.emote i { font-style: normal; font-size: 30px; line-height: 1; display: block; animation: tsay-pulo 0.6s ease-in-out 0.2s 2; }
@keyframes tsay-in { from { opacity: 0; scale: 0.4; } }
@keyframes tsay-out { to { opacity: 0; } }
@keyframes tsay-pulo { 50% { transform: translateY(-4px) rotate(-8deg) scale(1.1); } }

/* nível antes do nome: turno, painel do monstro, troca, nome por cima do domador */
.tc-txt b .nv-tag { font-size: 11px; vertical-align: 0.2em; }
.ip-title h3 .nv-tag { font-size: 12px; vertical-align: 0.25em; }
.swap-opt b .nv-tag { font-size: 10px; }
.tlabel .nv-tag { font-size: 9px; padding: 0 4px; margin-right: 4px; vertical-align: 0.05em; }
/* moldura da liga à volta do retrato do domador da vez (mais pequena que no menu) */
.tc-ava .moldura-svg { left: -18%; top: -18%; width: 136%; height: 136%; }


/* ---------- emotes e mensagens: dois botões em baixo à esquerda (js/ui/chat.js) ---------- */
.emo-dock { position: absolute; z-index: 12; left: max(12px, env(safe-area-inset-left, 0px)); bottom: max(12px, env(safe-area-inset-bottom, 0px)); display: flex; align-items: flex-end; gap: 8px; --esp: 0; }
.emo-dock[hidden] { display: none; }
.ed-btn { position: relative; display: grid; place-items: center; border-radius: 50%; padding: 0; color: #fff; transition: transform 0.12s; -webkit-tap-highlight-color: transparent; }
.ed-btn:active { transform: scale(0.9); }
.ed-emo { width: 56px; height: 56px; background: radial-gradient(circle at 38% 30%, #fff6c8 0%, #ffd04d 38%, #f08a1c 100%); box-shadow: 0 4px 0 #9a4f08, 0 8px 18px rgba(0, 0, 0, 0.45), inset 0 -3px 6px rgba(160, 70, 0, 0.35); border: 2px solid rgba(255, 255, 255, 0.85); }
.ed-emo .ed-ic { font-size: 29px; line-height: 1; filter: drop-shadow(0 2px 2px rgba(120, 50, 0, 0.45)); transform: translateY(1px); }
.ed-msg { width: 46px; height: 46px; margin-bottom: 2px; background: radial-gradient(circle at 38% 30%, #bfe6ff 0%, #4aa8ff 45%, #2a5fd8 100%); box-shadow: 0 4px 0 #1b3d93, 0 8px 18px rgba(0, 0, 0, 0.45), inset 0 -3px 6px rgba(10, 30, 110, 0.35); border: 2px solid rgba(255, 255, 255, 0.85); }
.ed-msg .mi { display: inline-flex; }
.ed-msg .ic { width: 24px; height: 24px; stroke-width: 2.4; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.35)); }
.emo-dock.a-emotes .ed-emo, .emo-dock.a-msgs .ed-msg { transform: scale(1.06); box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.25), 0 8px 18px rgba(0, 0, 0, 0.45); }
/* tempo de espera: um anel escuro que vai desaparecendo à volta dos dois botões */
.ed-espera { position: absolute; inset: -5px; width: calc(100% + 10px); height: calc(100% + 10px); transform: rotate(-90deg); pointer-events: none; opacity: 0; transition: opacity 0.2s; }
.ed-espera circle { fill: none; stroke: rgba(8, 10, 24, 0.75); stroke-width: 4; stroke-dasharray: 113.1; stroke-dashoffset: calc(113.1 - var(--esp) * 1); stroke-linecap: round; }
.emo-dock.a-espera .ed-espera { opacity: 1; }
.emo-dock.a-espera .ed-btn { filter: saturate(0.55) brightness(0.85); }
/* a roda: emotes em arco à volta do botão */
.er-roda { position: absolute; left: 28px; bottom: 28px; width: 0; height: 0; }
.er-roda[hidden] { display: none; }
.er-b { position: absolute; left: 0; top: 0; width: 58px; height: 58px; margin: -29px 0 0 -29px; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; padding: 0; color: inherit;
  background: radial-gradient(circle at 40% 30%, #3b4290, #1a1e48); border: 2px solid rgba(255, 208, 77, 0.7); box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transform: translate(var(--x), var(--y)); animation: er-in 0.22s cubic-bezier(.2, 1.4, .4, 1) backwards; animation-delay: calc(var(--i) * 0.03s); }
.er-b i { font-style: normal; font-size: 26px; line-height: 1; }
.er-b small { font-size: 8.5px; font-weight: 900; color: #ffe6a0; max-width: 52px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.er-b:active { transform: translate(var(--x), var(--y)) scale(0.9); }
@keyframes er-in { from { transform: translate(0, 0) scale(0.3); opacity: 0; } }
.er-roda.a-espera .er-b { opacity: 0.45; }
.er-vazia { position: absolute; left: 0; bottom: 40px; width: 200px; padding: 10px 12px; border-radius: 14px; font-size: 12px; font-weight: 800; color: var(--muted); background: rgba(16, 20, 44, 0.95); border: 1px solid var(--line); }
/* com o painel do monstro aberto (em baixo à esquerda) os botões saem da frente */
#game:has(#info-panel:not([hidden]) #ip-body:not([hidden])) .emo-dock, #game:has(#info-panel:not([hidden]) #ip-body:not([hidden])) .chat-pop { display: none; }

/* ===== Fim da partida (2026-11-16) =====
   Vencedores à esquerda (a festejar, com a coroa), vencidos à direita (caídos), o
   resultado ao meio. O meio tem barra se o XP e as missões forem compridos; os
   botões ficam sempre à vista em baixo. Ao alto: os avatares em cima, o resto em baixo. */
#ov-over.fim { place-items: stretch; }
.fim-wrap { width: 100%; height: 100%; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 390px) minmax(0, 1fr); gap: 12px; }
.fim-lado { min-width: 0; min-height: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.fl-tit { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 99px; font-weight: 900; font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; }
.fl-tit .ic { width: 16px; height: 16px; }
.fim-lado.ven .fl-tit { color: #3a2400; background: linear-gradient(180deg, #ffe08a, #f0a92a); box-shadow: 0 0 18px rgba(255, 196, 70, 0.45); }
.fim-lado.per .fl-tit { color: #c9cbe0; background: rgba(255, 255, 255, 0.08); }
.fl-avas { flex: 1; min-height: 0; width: 100%; display: flex; justify-content: center; gap: 6px; }
.over-ava { position: relative; flex: 1 1 0; min-width: 0; max-width: 220px; display: flex; flex-direction: column; align-items: center; }
.over-ava .palco {
  position: relative; flex: 1; min-height: 0; width: 100%;
  background: radial-gradient(55% 12% at 50% 93%, color-mix(in srgb, var(--tc) 60%, transparent), transparent 70%),
              radial-gradient(60% 60% at 50% 45%, color-mix(in srgb, var(--tc) 22%, transparent), transparent 75%);
}
.fim-lado.per .over-ava .palco { filter: saturate(0.7); }
.oa-nome { flex: none; max-width: 100%; margin-top: -4px; padding: 3px 12px; border-radius: 10px; font-family: var(--display); font-size: 16px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  background: color-mix(in srgb, var(--tc) 35%, rgba(10, 12, 30, 0.85)); box-shadow: 0 0 0 1.5px color-mix(in srgb, var(--tc) 75%, transparent); }
.over-ava.eu .oa-nome { box-shadow: 0 0 0 2px #fff, 0 0 14px color-mix(in srgb, var(--tc) 70%, transparent); }
#ov-over .over-card { max-width: none; min-width: 0; min-height: 0; height: 100%; gap: 6px; justify-content: center; }
.over-cab { flex: none; display: flex; flex-direction: column; align-items: center; gap: 2px; }
#ov-over .over-card h2 { font-size: clamp(30px, 6cqh, 46px); line-height: 1; }
#ov-over .over-card p { margin: 0; font-size: 13px; }
.over-meio { flex: 0 1 auto; min-height: 0; width: 100%; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.over-meio .over-rank { margin: 0 auto; font-size: 14px; max-width: 380px; }
.over-foot { flex: none; width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px; padding-top: 4px; }
.over-btns { display: flex; align-items: center; gap: 8px; }
.over-btns .btn.big { padding: 10px 16px; font-size: 16px; }
.over-btns .btn.ghost { padding: 9px 12px; font-size: 13px; }
.over-foot .dock-slot .ed-emo { width: 42px; height: 42px; }
.over-foot .dock-slot .ed-msg { width: 36px; height: 36px; }
.over-btns .btn { white-space: nowrap; }
/* (report 2026-11-18_2302_xcnu) o meio mais estreito e ao alto, para os avatares e os discos de
   rank terem mais espaço: a liga por cima da barra, o emote e os botões uns por baixo dos outros */
@media (min-aspect-ratio: 1/1) {
  .fim-wrap { grid-template-columns: minmax(0, 1fr) minmax(220px, 280px) minmax(0, 1fr); gap: 8px; }
  .over-meio .over-rank { max-width: 280px; padding: 8px 10px; }
  .over-rank .liga-fim { flex-direction: column; gap: 4px; text-align: center; }
  .over-rank .lf-txt { min-width: 0; width: 100%; }
  .over-rank .lf-bar { min-width: 0; }
  .over-rank .lf-pl { min-width: 0; }
  .over-foot { flex-direction: column; gap: 6px; }
  .over-btns { flex-direction: column; align-items: stretch; width: 100%; max-width: 240px; }
  .over-btns .btn { width: 100%; }
}
@media (max-aspect-ratio: 1/1) {
  .fim-wrap { grid-template-columns: 1fr 1fr; grid-template-rows: minmax(0, 40%) minmax(0, 1fr); }
  .fim-lado.ven { grid-column: 1; grid-row: 1; }
  .fim-lado.per { grid-column: 2; grid-row: 1; }
  #ov-over .over-card { grid-column: 1 / -1; grid-row: 2; justify-content: flex-start; }
  .over-foot { flex-wrap: wrap; }
}
