#panel-battle.active { display: flex; padding: 12px; height: 100%; }

.hunt {
  flex: 1; min-height: 0;
  display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 12px;
}

.hunt-stage {
  position: relative; min-height: 0;
  background: #000; border: 3px solid #0a1120; border-radius: 12px; overflow: hidden;
  box-shadow: 0 0 0 1px var(--line), 0 12px 30px #0008;
}

/* HUD over the map: title chip on the left, actions on the right */
.hunt-hud {
  position: absolute; top: 10px; left: 10px; right: 10px;
  display: flex; justify-content: space-between; align-items: flex-start; gap: 8px;
  pointer-events: none;
}
.hunt-hud > * { pointer-events: auto; }
.hunt-title {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--pixel); font-size: 1.15rem;
  background: #0b1424d9; border: 1px solid var(--line); border-radius: 10px;
  padding: 4px 12px 4px 6px; backdrop-filter: blur(3px);
}
.hunt-actions { display: flex; gap: 6px; }
.hunt-actions .btn.pulse { animation: pulse-red 1.1s ease-in-out infinite; }
@keyframes pulse-red {
  50% { box-shadow: 0 0 0 4px #e9456055; background: #5a1f30; }
}
.hunt-keys {
  position: absolute; right: 10px; bottom: 10px;
  font-family: var(--pixel); font-size: 0.75rem; color: #ffffffb0;
  background: #05091280; border-radius: 6px; padding: 3px 8px;
  pointer-events: none;
}
@media (prefers-reduced-motion: reduce) {
  .hunt-actions .btn.pulse { animation: none; box-shadow: 0 0 0 2px var(--red); }
}
.hunt-actions .btn { backdrop-filter: blur(3px); }
.hunt-canvas { display: block; width: 100%; height: 100%; image-rendering: pixelated; cursor: crosshair; }
.hunt-loading {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-family: var(--pixel); color: var(--muted); background: #050a14;
}
.hunt-overlay { position: absolute; inset: 0; display: grid; place-items: center; background: #000a; padding: 16px; }
.hunt-overlay-box {
  background: var(--bg-2); border: 2px solid var(--red); border-radius: 14px;
  padding: 20px 24px; max-width: 420px; text-align: center; display: grid; gap: 10px;
}
.hunt-overlay-box h3 { font-family: var(--pixel); font-size: 1.3rem; }
.hunt-overlay-actions { display: flex; justify-content: center; gap: 8px; }

.tag-town { background: #2a6fdb; font-family: var(--pixel); font-size: 0.8rem; }
.tag-fainted { background: var(--red); }
.center-card .btn { width: 100%; }
.team-row { display: flex; align-items: center; gap: 8px; padding: 3px 4px; border-radius: 8px; font-size: 0.8rem; }
.team-row.active { background: #ffd23f14; outline: 1px solid #ffd23f55; }
button.team-row { width: 100%; text-align: left; color: inherit; }
.team-row.pickable { cursor: pointer; }
.team-row.pickable:hover { background: #ffffff0d; outline: 1px solid var(--line); }
.team-row.pickable:focus-visible { outline: 2px solid var(--accent); }
.team-row.fainted { opacity: 0.6; }
.team-row.fainted .sprite-canvas { filter: grayscale(1); }
.team-row-info { flex: 1; display: grid; gap: 3px; }
.mini-hp { height: 4px; background: #000; border-radius: 2px; overflow: hidden; }
.mini-hp i { display: block; height: 100%; background: var(--green); }
img.pixel { image-rendering: pixelated; width: 48px; height: auto; }

/* side column: scene cards scroll on their own, the chat takes whatever height is left */
.hunt-side { display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.side-cards {
  display: flex; flex-direction: column; gap: 10px;
  flex: 0 1 auto; min-height: 0; overflow-y: auto; padding-right: 2px; scrollbar-width: thin;
}
.side-card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.side-mon { display: flex; align-items: center; gap: 12px; }
.side-mon .sprite-canvas { background: radial-gradient(circle, #2a4a7a, #13213b); border-radius: 10px; }
.side-mon-name { font-family: var(--pixel); font-size: 1.2rem; }
.side-title { font-family: var(--pixel); font-size: 1rem; margin-bottom: 2px; }

.side-bar { display: grid; grid-template-columns: 32px 1fr auto; align-items: center; gap: 6px; font-size: 0.75rem; }
.side-bar-label { font-family: var(--pixel); color: var(--muted); }
.side-bar-track { height: 8px; background: #000; border-radius: 4px; overflow: hidden; border: 1px solid #0006; }
.side-bar-fill { height: 100%; width: 0; transition: width 0.2s; }
.bar-hp .side-bar-fill { background: linear-gradient(180deg, #5df06b, #2fb53d); }
.bar-exp .side-bar-fill { background: linear-gradient(180deg, #ffe06a, #d9a91a); }
.side-bar-val { font-variant-numeric: tabular-nums; color: var(--muted); min-width: 64px; text-align: right; }

/* two columns: a pokemon with a dozen moves still leaves room for the session and the automations */
.side-moves { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.move {
  position: relative; overflow: hidden;
  display: flex; justify-content: space-between; gap: 4px;
  padding: 4px 6px; border-radius: 6px; font-size: 0.74rem;
  background: #0b1424; border-left: 3px solid #888;
}
.move span { position: relative; z-index: 1; }
.move span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.move span:last-of-type { flex-shrink: 0; }
.move i { position: absolute; left: 0; top: 0; bottom: 0; background: #ffffff10; transition: width 0.2s linear; }
.move.cooling { opacity: 0.7; }
.move.type-fire { border-color: #ff7b2e; } .move.type-water { border-color: #4aa3ff; } .move.type-grass { border-color: #5ed16a; }
.move.type-electric { border-color: #ffd83b; } .move.type-ice { border-color: #9ff0ff; } .move.type-fighting { border-color: #e0503a; }
.move.type-poison { border-color: #b65fe0; } .move.type-ground { border-color: #d8b45a; } .move.type-flying { border-color: #a8c6ff; }
.move.type-psychic { border-color: #ff6fae; } .move.type-bug { border-color: #a8c83a; } .move.type-rock { border-color: #b9a055; }
.move.type-ghost { border-color: #8a6bd1; } .move.type-dragon { border-color: #7a5cff; } .move.type-dark { border-color: #6b5a50; }
.move.type-steel { border-color: #c0c8d8; } .move.type-fairy { border-color: #ffb3e0; }

.side-row { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; }
.side-row span { flex: 1; }
.side-row .icon { width: 20px; height: 20px; image-rendering: pixelated; }
.side-row.toggle { cursor: pointer; color: var(--muted); }
.side-row.toggle input { accent-color: var(--red); width: 16px; height: 16px; }

.side-stats { gap: 4px; }
.side-stat { display: flex; justify-content: space-between; font-size: 0.85rem; }
.side-stat b { font-family: var(--pixel); font-weight: 600; }

/* Tibia-style server log over the bottom-left of the map */
.hunt-log {
  position: absolute; left: 10px; bottom: 10px;
  width: min(460px, calc(100% - 20px)); max-height: 112px; overflow-y: auto;
  background: #05091299; border: 1px solid #ffffff14; border-radius: 8px;
  padding: 6px 10px; backdrop-filter: blur(2px);
  font-size: 0.76rem; line-height: 1.35; display: flex; flex-direction: column; gap: 1px;
  text-shadow: 0 1px 0 #000, 0 0 3px #000;
  scrollbar-width: thin;
}
.hunt-log:empty { display: none; }
.log-line { color: var(--muted); }
.log-info { color: #a9b8d8; }
.log-good { color: #6dff8b; }
.log-bad { color: #ff7a8a; }
.log-loot { color: #ffd23f; }
/* town chat, bottom-left over the map */
/* item chips (balls / potions / revives) */
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.item-chip {
  flex: none; display: inline-flex; flex-direction: row; align-items: center; gap: 4px;
  min-width: 52px; padding: 3px 8px 3px 4px; border-radius: 8px; white-space: nowrap;
  background: #0b1424; border: 1px solid var(--line); color: var(--text);
  font-family: var(--pixel); font-size: 0.78rem; line-height: 1;
}
.item-chip img { flex: none; width: 20px; height: 20px; max-width: none; image-rendering: pixelated; object-fit: contain; }
button.item-chip:hover { border-color: #4b6aa8; }
.item-chip.on { background: #3b2366; border-color: #a86bff; box-shadow: 0 0 0 1px #a86bff55; }
.item-chip.empty { opacity: 0.45; }

/* automations */
.auto-card summary {
  display: flex; align-items: center; justify-content: space-between;
  cursor: pointer; list-style: none;
}
.auto-card summary::-webkit-details-marker { display: none; }
.auto-card summary::after { content: '▾'; color: var(--muted); margin-left: 8px; }
.auto-card:not([open]) summary::after { content: '▸'; }
.auto-card[open] summary { margin-bottom: 10px; }
.auto-count { margin-left: auto; font-family: var(--pixel); font-size: 0.8rem; color: var(--muted); }
.auto-count.lit { color: #7dff8a; }
.auto-card { gap: 0; }
.auto-group { display: grid; gap: 8px; padding: 12px 0; border-top: 1px solid #ffffff12; }
.auto-group:last-child { padding-bottom: 2px; }
.auto-hint { margin-top: 2px; }
.auto-hint.auto-shiny { margin-top: 6px; color: #ffe14d; }
.auto-row { display: flex; align-items: center; gap: 10px; font-size: 0.86rem; cursor: pointer; min-height: 22px; }
.auto-row span:nth-child(2) { flex: 1; }
.vip-badge {
  font-family: var(--pixel); font-size: 0.7rem; color: #0b1424;
  background: linear-gradient(180deg, #7fd8ff, #2a9bd8); border-radius: 4px; padding: 1px 6px;
}
input.switch {
  appearance: none; width: 30px; height: 17px; border-radius: 9px; flex: none;
  background: #2a3550; border: 1px solid var(--line); position: relative; cursor: pointer; transition: background 0.15s;
}
input.switch::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 11px; height: 11px; border-radius: 50%;
  background: #c9d3e8; transition: transform 0.15s;
}
input.switch:checked { background: #8a4fe0; border-color: #a86bff; }
input.switch:checked::after { transform: translateX(13px); background: #fff; }
input.switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.auto-threshold { display: flex; align-items: center; gap: 10px; }
.auto-threshold > span:first-child { white-space: nowrap; }
.shop-btn { display: inline-flex; align-items: center; gap: 5px; margin-left: 10px; }
.shop-btn img { width: 18px; height: 18px; image-rendering: pixelated; }
.auto-card summary .shop-btn { margin-left: 10px; }
.center-card .shop-btn { margin-left: 0; justify-content: center; }
.auto-threshold input { flex: 1; accent-color: #a86bff; }
.auto-threshold-val { font-family: var(--pixel); min-width: 36px; text-align: right; }

/* bodies on the ground: overlay at the bottom-right of the map, above the key hints */
.stage-corpses {
  position: absolute; right: 10px; bottom: 38px;
  width: min(290px, calc(100% - 20px)); max-height: 45%;
  display: flex; flex-direction: column; gap: 6px;
  background: #050912cc; border: 1px solid #ffffff1a; border-radius: 10px;
  padding: 8px 10px; backdrop-filter: blur(3px);
}
.stage-corpses-title { font-family: var(--pixel); font-size: 0.9rem; }
.stage-corpses .corpse-list { overflow-y: auto; min-height: 0; scrollbar-width: thin; }
/* a column whose rows never shrink: the list scrolls instead of the rows squeezing into each other */
.corpse-list { display: flex; flex-direction: column; gap: 6px; }
.corpse-row { display: flex; flex-shrink: 0; align-items: center; gap: 8px; font-size: 0.8rem; }
.corpse-row.shiny { color: #ffe14d; }
.corpse-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.corpse-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.corpse-meta { display: flex; align-items: center; gap: 4px; white-space: nowrap; line-height: 1.2; }
.corpse-meta .gene-chip { font-size: 0.58rem; padding: 0 4px; line-height: 1.3; }
.corpse-row .btn { flex-shrink: 0; }
.corpse-time { height: 3px; background: #000; border-radius: 2px; overflow: hidden; }
.corpse-time i { display: block; height: 100%; background: #8ea0c4; }

/* chat (side column): Cidade / Global / Comércio */
.chat-card { flex: 1 1 240px; min-height: 220px; padding: 8px; gap: 6px; }
.chat-tabs { display: flex; gap: 4px; }
.chat-tab {
  flex: 1; position: relative;
  padding: 5px 4px; border-radius: 7px; font-family: var(--pixel); font-size: 0.8rem;
  color: var(--muted); background: #0b1424; border: 1px solid var(--line);
  min-width: 0;
}
/* the name is cut, not the tab: the unread count hangs over its corner */
.chat-tab-label { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-tab:hover:not(:disabled) { color: var(--text); }
.chat-tab.active { color: #fff; background: var(--card-2); border-color: #4b6aa8; }
.chat-tab.tab-local.active { border-color: #2f8a4a; color: #7dff8a; }
.chat-tab.tab-trade.active { border-color: #8a6d1f; color: #ffd23f; }
.chat-tab:disabled { opacity: 0.4; }
.chat-unread {
  position: absolute; top: -6px; right: -4px;
  min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px;
  background: var(--red); color: #fff; font-family: 'Inter', sans-serif; font-size: 0.65rem; font-weight: 700; line-height: 16px;
  box-shadow: 0 0 0 2px #0e1626, 0 0 8px #e9456088; pointer-events: none;
  animation: chat-unread-in 0.25s ease-out;
}
@keyframes chat-unread-in { from { transform: scale(0.4); } }
.chat-lines {
  flex: 1; min-height: 0; overflow-y: auto;
  background: #070d19; border: 1px solid #ffffff0d; border-radius: 8px;
  padding: 6px 8px; font-size: 0.8rem; line-height: 1.4; scrollbar-width: thin;
}
.chat-line { overflow-wrap: anywhere; }
.chat-time { color: #5d6f93; font-size: 0.7rem; margin-right: 5px; font-variant-numeric: tabular-nums; }
.chat-name { color: #fff; font-weight: 700; }
.chat-name.me { color: #7dff8a; }
.chat-text { color: #d8e2f6; }
.chat-card.is-trade .chat-text { color: #ffe9a0; }
.chat-sys { color: var(--muted); font-style: italic; }
.chat-role { display: inline-block; margin-right: 4px; padding: 0 5px; border-radius: 4px; font-size: 0.65rem; font-weight: 700; vertical-align: 1px; }
.chat-role.role-tutor { background: #163a2a; color: #6dff8b; }
.chat-role.role-admin { background: #4a1a26; color: #ff8fa3; }
/* VIP next to a name in chat (the colors are .vip-badge's) */
.chat-vip { display: inline-block; margin-right: 4px; padding: 0 5px; font-size: 0.6rem; line-height: 1.5; vertical-align: 1px; cursor: help; box-shadow: 0 0 6px #2a9bd855; }
.chat-name.role-tutor { color: #6dff8b; }
.chat-name.role-admin { color: #ff8fa3; }
.chat-announce { background: #3d321033; border-left: 3px solid var(--accent); padding-left: 5px; }
.chat-announce .chat-name, .chat-announce .chat-text { color: var(--accent); }
.chat-input {
  width: 100%; padding: 7px 10px; border-radius: 7px;
  background: #0b1424; border: 1px solid var(--line); color: var(--text); font: inherit; font-size: 0.85rem;
}
.chat-input:focus { outline: 2px solid var(--accent); outline-offset: 0; }
.players-list { display: flex; flex-wrap: wrap; gap: 4px; }
.player-chip { font-size: 0.78rem; padding: 2px 8px; border-radius: 999px; background: #0b1424; border: 1px solid var(--line); }
.player-chip.me { color: #7dff8a; border-color: #2f6b3a; }
.player-chip { display: inline-flex; align-items: center; gap: 4px; }
.player-duel { padding: 0 4px; border: 0; border-radius: 6px; background: #3a1c2a; color: #ffb3c0; cursor: pointer; font-size: 0.75rem; line-height: 1.4; }
.player-duel:hover { background: #e94560; color: #fff; }
.log-shiny { color: #ffe14d; font-weight: 700; text-shadow: 0 0 6px #ffe14d66; }

.hunt-empty { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 80px 16px; text-align: center; }
.hunt-empty img { width: 72px; image-rendering: pixelated; }
.hunt-empty h2 { font-family: var(--pixel); }

@media (max-width: 960px) {
  #panel-battle.active { height: auto; }
  .hunt { grid-template-columns: 1fr; }
  .hunt-stage { height: calc(62vh / var(--ui-zoom, 1)); }
  .side-cards { overflow: visible; }
  .chat-card { min-height: 300px; }
}

/* Hunt Analyser (huntanalyser.js): per-hour rates, matchups and drops of the hunt */
.an-card { gap: 6px; }
.an-head { display: flex; align-items: center; gap: 10px; padding-bottom: 8px; border-bottom: 1px solid #ffffff14; }
.an-sprite { width: 52px; height: 52px; flex: none; display: grid; place-items: center; border-radius: 50%; background: #0b1424; overflow: hidden; }
.an-name { font-family: var(--pixel); font-size: 1rem; }
.an-rates { display: grid; gap: 3px; padding: 4px 0 6px; border-bottom: 1px solid #ffffff14; }
.an-rate { display: flex; justify-content: space-between; gap: 8px; font-size: 0.86rem; }
.an-rate b { font-family: var(--pixel); color: #ff9ad5; }
.an-section { margin-top: 4px; font-family: var(--pixel); font-size: 0.78rem; letter-spacing: 0.5px; color: var(--muted); text-transform: uppercase; }
.an-types { display: flex; flex-wrap: wrap; gap: 4px; }
.an-type { display: inline-flex; align-items: center; gap: 3px; padding: 2px 5px 2px 2px; border-radius: 6px; background: #0b1424; }
.an-type b { font-family: var(--pixel); font-size: 0.72rem; color: var(--muted); }
.an-drops { display: grid; gap: 8px; }
.an-drop-species { font-family: var(--pixel); font-size: 0.85rem; margin-bottom: 3px; }
.an-drop { display: grid; grid-template-columns: 22px 1fr auto; align-items: center; gap: 6px; padding: 3px 6px; border-radius: 6px; background: #0b1424; font-size: 0.8rem; }
.an-drop img, .an-drop .item-noicon { width: 20px; height: 20px; image-rendering: pixelated; }
.an-chance { font-family: var(--pixel); font-size: 0.75rem; color: #ff9ad5; }
.an-note { font-size: 0.7rem; color: var(--muted); }

/* the automations header: title, count and the shop button wrap instead of widening the column */
.auto-card summary { flex-wrap: wrap; row-gap: 6px; }
.auto-card summary .shop-btn { white-space: nowrap; }
.hunt-side, .side-cards { min-width: 0; overflow-x: hidden; }
