/* Visual geral (v0.5) e tela inicial da conta.
   PC: barra no topo, menu lateral, arena no centro, jornada à direita, deck e modos embaixo.
   Celular: uma coluna e menu fixo embaixo, como no Clash Royale. */

:root {
  --ink: #0b1124;
  --panel: rgba(17, 26, 52, 0.92);
  --panel-2: #1a2649;
  --line: #2f4a8a;
  --line-soft: rgba(120, 160, 255, 0.18);
  --gold: #f8c630;
  --gold-dark: #b98a06;
  --text-dim: #aab6d8;
  --pixel: 'Pixelify Sans', 'Segoe UI', system-ui, sans-serif;
}

/* ---------- Base ---------- */
h1, h2, h3, .panel h2, button, .brand, .stat-chip, .lvl-badge { font-family: var(--pixel); }
h1, h2, h3 { letter-spacing: 0.5px; }

.overlay {
  position: fixed;
  z-index: 20;
  background: radial-gradient(ellipse at top, rgba(30, 45, 95, 0.75), rgba(8, 12, 28, 0.9));
}
.panel {
  background: linear-gradient(180deg, #1d2a52, #141d3b);
  border: 2px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.panel h1 { font-size: 44px; color: var(--gold); text-shadow: 0 3px 0 #3b5bdb, 0 6px 14px rgba(0, 0, 0, 0.6); }
.panel h2 { font-size: 18px; opacity: 1; color: #fff; text-transform: none; letter-spacing: 0.5px; }

button {
  border-radius: 12px;
  background: linear-gradient(180deg, #4d63a8, #3a4d8a);
  box-shadow: 0 4px 0 #23305c, inset 0 1px 0 rgba(255, 255, 255, 0.18);
  font-size: 16px;
}
button.primary {
  background: linear-gradient(180deg, #ffd84a, #f0b400);
  color: #2a1d00;
  box-shadow: 0 4px 0 var(--gold-dark), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}
button.link { font-family: inherit; }

/* ---------- Tela inicial ---------- */
.hub {
  position: fixed;
  inset: 0;
  z-index: 15;
  display: flex;
  flex-direction: column;
  color: #fff;
  background: var(--ink);
  overflow: hidden;
}
/* Fundo: o mapa da arena atual, escurecido e desfocado */
.hub::before {
  content: '';
  position: absolute;
  inset: -20px;
  background: var(--map-full, none) center / cover;
  filter: blur(8px) brightness(0.35) saturate(1.2);
  z-index: -1;
}

.hub-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  background: linear-gradient(180deg, rgba(10, 16, 36, 0.95), rgba(10, 16, 36, 0.75));
  border-bottom: 2px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 6px; font-size: 26px; font-weight: 700; color: var(--gold); text-shadow: 0 2px 0 #3b5bdb; white-space: nowrap; }
.brand img { width: 34px; height: 34px; image-rendering: pixelated; }
.brand span { color: #fff; }

.trainer-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 4px 12px 4px 4px;
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: 12px;
}
.trainer-chip img { width: 42px; height: 42px; border-radius: 8px; image-rendering: pixelated; background: #2a3a6e; }
.trainer-info { min-width: 0; }
.trainer-info b#hub-name { display: block; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lvl-line { display: flex; align-items: center; gap: 8px; margin-top: 2px; }
.lvl-badge { font-size: 13px; color: var(--text-dim); white-space: nowrap; }
.lvl-badge b { color: #fff; }
.hub .xp-bar { width: 120px; height: 12px; margin: 0; background: #0b1230; border: 1px solid var(--line-soft); }
.hub .xp-bar i { background: linear-gradient(#5aa9ff, #2f6fdb); }
.hub .xp-bar span { line-height: 12px; font-size: 9px; }

.stats { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.stat-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: 12px;
  font-size: 18px;
  white-space: nowrap;
}
.icon-btn { flex: 0 0 auto; width: 42px; height: 42px; padding: 0; font-size: 20px; }

.hub-body { flex: 1; min-height: 0; display: flex; }

.hub-nav { display: flex; flex-direction: column; gap: 8px; padding: 14px 10px; width: 180px; flex-shrink: 0; }
.nav-btn {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  text-align: left;
  background: var(--panel);
  border: 2px solid var(--line);
  box-shadow: none;
  font-size: 17px;
}
.nav-btn .nav-ico { font-size: 22px; width: 26px; text-align: center; }
.nav-btn.active { background: linear-gradient(180deg, #2f6fdb, #1f4fb0); border-color: #7fb0ff; box-shadow: 0 0 0 2px rgba(127, 176, 255, 0.25); }

.hub-main {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  padding: 14px 16px 16px 4px;
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(230px, 1fr) minmax(320px, 1.5fr) minmax(230px, 1fr);
  grid-template-areas:
    'balls show journey'
    'deck deck modes';
  align-items: start;
}
.box {
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: 14px;
  padding: 12px;
}
.box h3 { font-size: 16px; margin-bottom: 10px; color: #fff; }
.box-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.box-head span { font-size: 13px; color: var(--text-dim); }

/* Arena em destaque */
.arena-show { grid-area: show; display: flex; flex-direction: column; align-items: stretch; gap: 10px; }
.arena-head { display: flex; align-items: center; gap: 8px; }
.arrow { flex: 0 0 auto; width: 40px; height: 52px; padding: 0; font-size: 30px; line-height: 1; }
.arrow:disabled { opacity: 0.3; }
.arena-title {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: 12px;
}
.arena-title img { width: 46px; height: 46px; border-radius: 50%; image-rendering: pixelated; background: #24335f; border: 2px solid var(--line); }
.arena-title h2 { font-size: 20px; text-transform: uppercase; }
.arena-title small { color: var(--text-dim); font-size: 13px; }
.arena-preview {
  position: relative;
  aspect-ratio: 16 / 10;
  border-radius: 14px;
  border: 3px solid var(--line);
  background: var(--map, #24335f) center 45% / cover;
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.45), 0 8px 24px rgba(0, 0, 0, 0.4);
  overflow: hidden;
}
.arena-preview.current { border-color: var(--gold); }
.arena-lock {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 6px;
  text-align: center;
  background: rgba(8, 12, 28, 0.6);
  backdrop-filter: grayscale(1);
  font-family: var(--pixel);
  font-size: 18px;
}
.arena-lock b { font-size: 34px; }
.battle-btn {
  padding: 16px;
  font-size: 34px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #2a1d00;
  background: linear-gradient(180deg, #ffe066, #f5b800 55%, #e09c00);
  border: 3px solid #fff3b0;
  border-radius: 16px;
  box-shadow: 0 6px 0 #9c6b00, 0 10px 24px rgba(0, 0, 0, 0.45);
}
.battle-btn:active { transform: translateY(3px); box-shadow: 0 3px 0 #9c6b00; }
.battle-sub { text-align: center; color: var(--text-dim); margin-top: -4px; }

/* Premier Balls */
.balls-box { grid-area: balls; }
.balls-box .ball-slots { grid-template-columns: repeat(2, 1fr); margin-top: 0; }
.balls-box .ball-slot { min-height: 96px; background: var(--panel-2); border-color: var(--line); }
.balls-box .free-ball { width: 100%; margin-top: 10px; font-size: 14px; }

/* Jornada */
.journey { grid-area: journey; max-height: 100%; }
#hub-journey { display: grid; gap: 6px; max-height: 470px; overflow-y: auto; padding-right: 2px; }
.journey-step {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 6px 6px;
  border-radius: 12px;
  background: var(--panel-2);
  border: 2px solid transparent;
  text-align: left;
  box-shadow: none;
  font-family: inherit;
  font-size: 14px;
}
.journey-step img { width: 38px; height: 38px; border-radius: 50%; image-rendering: pixelated; background: #24335f; flex-shrink: 0; }
.journey-step .j-name { flex: 1; min-width: 0; font-weight: 700; font-family: var(--pixel); font-size: 15px; }
.journey-step .j-name small { display: block; font-family: system-ui, sans-serif; font-weight: 400; font-size: 11px; color: var(--text-dim); }
.journey-step .type-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.journey-step.locked img { filter: grayscale(1) brightness(0.5); }
.journey-step.locked { opacity: 0.7; }
.journey-step.current { background: linear-gradient(90deg, #f8c630, #e2a600); color: #2a1d00; border-color: #fff3b0; }
.journey-step.current small { color: #4a3800; }
.journey-step.viewing:not(.current) { border-color: #7fb0ff; }

/* Deck ativo */
.deck-box { grid-area: deck; display: flex; flex-direction: column; gap: 10px; }
.deck-strip { display: grid; grid-template-columns: repeat(8, 1fr); gap: 8px; }
.deck-strip .card { cursor: pointer; }
.deck-strip .card .lvl-tag {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  text-align: center;
  font-family: var(--pixel);
  font-size: 13px;
  font-weight: 700;
  padding: 2px 0;
  background: rgba(0, 0, 0, 0.6);
}
.ghost-btn { align-self: flex-start; padding: 8px 14px; font-size: 14px; }

/* Modos */
.modes { grid-area: modes; display: grid; gap: 10px; }
.mode {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas: 'ico title' 'ico sub';
  align-items: center;
  gap: 0 12px;
  padding: 14px 16px;
  text-align: left;
  border-radius: 14px;
}
.mode-ico { grid-area: ico; font-size: 30px; }
.mode b { grid-area: title; font-size: 20px; text-transform: uppercase; }
.mode small { grid-area: sub; font-family: system-ui, sans-serif; font-size: 12px; opacity: 0.85; }
.mode-red { background: linear-gradient(180deg, #e2453c, #b62c25); box-shadow: 0 4px 0 #7a1712; border: 2px solid #ff8a80; }
.mode-blue { background: linear-gradient(180deg, #2f6fdb, #1f4fb0); box-shadow: 0 4px 0 #13306d; border: 2px solid #8fb7ff; }
.mode-green { background: linear-gradient(180deg, #2fb36b, #1f8a50); box-shadow: 0 4px 0 #125a33; border: 2px solid #7ee0a8; }

.hub #hub-error { min-height: 0; text-align: center; }
#friends .check small { opacity: 0.7; font-size: 11px; }

/* ---------- Telas médias: arena maior, jornada embaixo ---------- */
@media (max-width: 1180px) {
  .hub-main {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
    grid-template-areas:
      'balls show'
      'journey show'
      'deck deck'
      'modes modes';
  }
  .modes { grid-template-columns: 1fr 1fr; }
  #hub-journey { max-height: 260px; }
}

/* ---------- Celular: uma coluna e menu embaixo ---------- */
@media (max-width: 760px) {
  .hub-bar { gap: 8px; padding: 6px 10px; }
  .brand { display: none; }
  .trainer-chip { flex: 1; padding: 3px 8px 3px 3px; }
  .trainer-chip img { width: 36px; height: 36px; }
  .hub .xp-bar { width: 80px; }
  .stat-chip { padding: 6px 8px; font-size: 15px; gap: 4px; }
  .icon-btn { width: 36px; height: 36px; font-size: 16px; }

  .hub-body { flex-direction: column-reverse; }
  .hub-nav {
    flex-direction: row;
    width: auto;
    gap: 2px;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    background: rgba(10, 16, 36, 0.96);
    border-top: 2px solid var(--line);
  }
  .nav-btn { flex: 1; flex-direction: column; gap: 2px; padding: 6px 2px; font-size: 11px; text-align: center; border: none; background: none; }
  .nav-btn .nav-ico { font-size: 22px; width: auto; }
  .nav-btn.active { background: rgba(47, 111, 219, 0.35); box-shadow: none; }

  .hub-main {
    padding: 10px;
    gap: 10px;
    grid-template-columns: 1fr;
    grid-template-areas: 'show' 'balls' 'deck' 'modes';
  }
  .journey { display: none; } /* a aba Arenas mostra a jornada completa */
  .arena-title h2 { font-size: 16px; }
  .arena-title img { width: 38px; height: 38px; }
  .arrow { width: 34px; height: 46px; font-size: 24px; }
  .arena-preview { aspect-ratio: 16 / 9; }
  .battle-btn { font-size: 26px; padding: 12px; }
  .balls-box .ball-slots { grid-template-columns: repeat(4, 1fr); }
  .balls-box .ball-slot { min-height: 84px; }
  .deck-strip { grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .modes { grid-template-columns: 1fr 1fr; }
  .mode { grid-template-columns: 1fr; grid-template-areas: 'ico' 'title' 'sub'; text-align: center; padding: 10px; }
  .mode-ico { font-size: 24px; }
  .mode b { font-size: 16px; }
}

.hub .xp-bar span { position: absolute; inset: 0; }
@media (max-width: 760px) { .hub .xp-bar { flex: 1; width: auto; min-width: 60px; } .lvl-line { min-width: 0; } }
.hub .xp-bar { position: relative; overflow: hidden; border-radius: 6px; }
.hub .xp-bar i { position: absolute; inset: 0 auto 0 0; }
.hub .xp-bar span { display: block; text-align: center; font-weight: 700; text-shadow: 0 1px 1px #000; }

/* ---------- Abas dentro do início (Coleção, Arenas, Amigos, Treino, sala) ---------- */
.hub-content { position: relative; flex: 1; min-width: 0; min-height: 0; display: flex; }
.hub-content > .hub-main { flex: 1; }
.overlay.docked {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 14px 16px 16px 4px;
  background: none;
  backdrop-filter: none;
  overflow-y: auto;
}
.overlay.docked.hidden { display: none; }
.overlay.docked .panel { width: 100%; max-width: 880px; max-height: none; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35); }
.overlay.docked .deck-panel, .overlay.docked .road-panel { height: 100%; }
.overlay.docked #deck-close, .overlay.docked #road-close, .overlay.docked #friends-close { display: none; }
#menu.docked .panel > h1, #menu.docked .panel > h1 + .sub { display: none; }
#menu.docked .panel > h2:first-of-type { margin-top: 0; }
@media (max-width: 760px) {
  .overlay.docked { padding: 10px; }
}
.overlay.docked #deck-slots { width: 100%; max-width: 600px; margin: 0 auto; }
#friends.docked .panel, #menu.docked .panel, #lobby.docked .panel { max-width: 560px; }

/* ---------- Menus suspensos (ranking e minha conta) ---------- */
.trainer-chip.clickable, .stat-chip.clickable { cursor: pointer; transition: border-color 0.15s, transform 0.1s; }
.trainer-chip.clickable:hover, .stat-chip.clickable:hover { border-color: #7fb0ff; }
.trainer-chip.clickable:active, .stat-chip.clickable:active { transform: translateY(1px); }

.overlay.dropdown {
  align-items: flex-start;
  padding: 66px 14px 14px;
  background: rgba(6, 10, 24, 0.5);
  backdrop-filter: none;
}
.dropdown-right { justify-content: flex-end; }
.dropdown-left { justify-content: flex-start; }
.dropdown-panel {
  width: 100%;
  max-width: 440px;
  max-height: calc(100% - 4px);
  display: flex;
  flex-direction: column;
  text-align: left;
  animation: drop-down 0.18s ease-out;
}
.dropdown-left .dropdown-panel { margin-left: 90px; }
@keyframes drop-down { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }
.dropdown-panel .deck-head h2 { text-align: left; }

/* Ranking */
.ranking-list { flex: 1; min-height: 0; overflow-y: auto; display: grid; gap: 6px; margin-top: 10px; align-content: start; padding-right: 2px; }
.rank-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 6px 6px;
  border-radius: 12px;
  background: var(--panel-2, #1a2649);
  border: 2px solid transparent;
}
.rank-row.me { background: linear-gradient(90deg, #f8c630, #e2a600); color: #2a1d00; border-color: #fff3b0; }
.rank-pos { width: 40px; text-align: center; font-family: var(--pixel, sans-serif); font-size: 16px; font-weight: 700; flex-shrink: 0; }
.rank-row img { width: 36px; height: 36px; border-radius: 50%; image-rendering: pixelated; background: #24335f; flex-shrink: 0; }
.rank-name { flex: 1; min-width: 0; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-name em { font-style: normal; font-weight: 400; opacity: 0.8; }
.rank-name small { display: block; font-weight: 400; font-size: 11px; opacity: 0.75; }
.rank-trophies { font-family: var(--pixel, sans-serif); font-size: 16px; white-space: nowrap; }
.rank-gap { text-align: center; opacity: 0.5; letter-spacing: 4px; }

/* Minha conta */
.profile-card { display: flex; align-items: center; gap: 12px; padding: 10px; margin-top: 10px; border-radius: 12px; background: var(--panel-2, #1a2649); }
.profile-card img { width: 56px; height: 56px; border-radius: 10px; image-rendering: pixelated; background: #24335f; }
.profile-card b { display: block; font-size: 18px; }
.profile-card small { display: block; font-size: 12px; opacity: 0.8; }
.settings-form { margin-top: 14px; gap: 8px; }
.settings-form h3 { font-size: 15px; }
.form-msg { min-height: 1.1em; font-size: 13px; font-weight: 700; }
.form-msg.good { color: #7dff8a; }
.form-msg.bad { color: #ff8a8a; }
#set-logout { margin-top: 16px; }

@media (max-width: 760px) {
  .overlay.dropdown { padding: 56px 8px 8px; }
  .dropdown-left .dropdown-panel { margin-left: 0; }
  .dropdown-panel { max-width: none; }
}

/* ---------- PokéMart ---------- */
.shop-panel { display: flex; flex-direction: column; text-align: left; }
.overlay.docked .shop-panel { height: 100%; }
#shop-wallet { font-family: var(--pixel, sans-serif); font-size: 16px; white-space: nowrap; }
.shop-body { flex: 1; min-height: 0; overflow-y: auto; padding-right: 2px; }
.shop-title { font-size: 16px; margin: 14px 0 8px; }
.shop-title small { font-family: system-ui, sans-serif; font-weight: 400; font-size: 12px; opacity: 0.7; }
.offer-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.offer {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px;
  border-radius: 14px;
  text-align: center;
  background: var(--panel-2, #1a2649);
  border: 2px solid var(--line, #2f4a8a);
}
.offer.kind-card { background: linear-gradient(180deg, color-mix(in srgb, var(--type) 35%, #1a2649), #1a2649 70%); }
.offer.free { border-color: #7ee0a8; box-shadow: 0 0 0 2px rgba(126, 224, 168, 0.25); }
.offer.sold-out { opacity: 0.5; }
.offer-art { position: relative; width: 72px; height: 72px; display: grid; place-items: center; }
.offer-art img { width: 72px; height: 72px; object-fit: contain; image-rendering: pixelated; border-radius: 10px; }
.offer.kind-ball .offer-art img, .offer.kind-item .offer-art img { width: 52px; height: 52px; }
.offer-amount { position: absolute; right: -6px; bottom: -4px; padding: 0 5px; border-radius: 6px; background: #2fb36b; font-family: var(--pixel, sans-serif); font-weight: 700; font-size: 13px; }
.offer-name { font-size: 14px; }
.offer-info { font-size: 11px; opacity: 0.8; min-height: 2.4em; }
.offer-left { position: absolute; top: 6px; right: 8px; font-size: 11px; opacity: 0.75; }
.offer button { width: 100%; padding: 8px 6px; font-size: 14px; margin-top: auto; }
#shop-msg { margin-top: 4px; }

@media (max-width: 760px) {
  .offer-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .offer { padding: 8px; }
  #shop-wallet { font-size: 13px; }
}

/* Celular: barra do topo com 3 moedas cabe sem esmagar o nome (sair fica em Minha conta) */
@media (max-width: 760px) {
  #hub-logout { display: none; }
  .hub-bar .stats { gap: 4px; }
  .hub-bar .stat-chip { padding: 5px 7px; font-size: 13px; gap: 3px; }
  .trainer-chip { min-width: 0; }
  .trainer-info b#hub-name { font-size: 14px; }
}

/* ---------- Visual (cosméticos) ---------- */
.look-form label { display: grid; gap: 4px; font-size: 13px; opacity: 0.95; }
.look-form select {
  padding: 10px;
  border-radius: 10px;
  border: 2px solid var(--line, #2f4a8a);
  background: #161d36;
  color: #fff;
  font: inherit;
}
.look-form h3 small { font-family: system-ui, sans-serif; font-weight: 400; font-size: 11px; opacity: 0.7; }
.title-badge { font-size: 40px; }
.offer.kind-cosmetic .offer-art img { width: 64px; height: 64px; }

/* ---------- Zona Safári ---------- */
.safari-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 6px;
  padding: 12px;
  border-radius: 14px;
  background: linear-gradient(90deg, #2f7d3e, #1e5a2c);
  border: 2px solid #7ee0a8;
}
.safari-banner > img { width: 40px; height: 40px; image-rendering: pixelated; }
.safari-banner > div { flex: 1; min-width: 0; }
.safari-banner b { font-family: var(--pixel, sans-serif); font-size: 18px; display: block; }
.safari-banner small { font-size: 12px; opacity: 0.9; }
.safari-banner button { flex: 0 0 auto; padding: 10px 14px; }
.safari-panel { display: flex; flex-direction: column; text-align: left; max-width: 560px !important; }
.overlay.docked .safari-panel { height: 100%; }
#safari-body { flex: 1; min-height: 0; overflow-y: auto; }
.safari-scene { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; padding-top: 6px; }
.safari-info { width: 100%; display: flex; justify-content: space-between; align-items: center; font-size: 13px; opacity: 0.9; }
.safari-balls { display: inline-flex; align-items: center; gap: 1px; }
.safari-balls img { width: 18px; height: 18px; image-rendering: pixelated; }
.safari-balls b { margin-left: 4px; font-family: var(--pixel, sans-serif); }
.safari-wild {
  width: 150px;
  height: 150px;
  border-radius: 20px;
  overflow: hidden;
  border: 4px solid color-mix(in srgb, var(--type) 70%, #fff);
  background: radial-gradient(circle at 50% 60%, color-mix(in srgb, var(--type) 40%, #2f7d3e), #1e3a22);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}
.safari-wild img { width: 100%; height: 100%; image-rendering: pixelated; }
.safari-wild.escaped { animation: wild-shake 0.4s ease-in-out; }
.safari-wild.caught { animation: wild-caught 0.6s ease-out; }
@keyframes wild-shake { 25% { transform: translateX(-8px) rotate(-4deg); } 75% { transform: translateX(8px) rotate(4deg); } }
@keyframes wild-caught { 0% { transform: scale(1); } 50% { transform: scale(0.7); filter: brightness(2); } 100% { transform: scale(1); } }
.safari-scene h3 { font-size: 20px; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px; }
.safari-scene h3 small { font-family: system-ui, sans-serif; font-size: 12px; }
.safari-status { font-size: 13px; opacity: 0.9; min-height: 1.2em; }
.safari-actions { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.safari-actions button { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 12px 8px; font-size: 15px; }
.safari-actions img { width: 22px; height: 22px; image-rendering: pixelated; }
.safari-log { width: 100%; padding: 8px 10px; border-radius: 10px; background: rgba(0, 0, 0, 0.3); text-align: left; font-size: 13px; min-height: 60px; }
.safari-log p:last-child { font-weight: 700; color: #ffe27a; }
.safari-end { text-align: center; padding-top: 10px; }
.safari-end h3 { font-size: 20px; margin-bottom: 10px; }
.safari-caught { display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 8px; margin: 10px 0; }

/* ---------- Coleção: sub-abas e aba Ginásios ---------- */
.subtabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.subtabs button { padding: 9px; font-size: 15px; background: var(--panel-2, #1a2649); box-shadow: none; border: 2px solid var(--line, #2f4a8a); }
.subtabs button.active { background: linear-gradient(180deg, #2f6fdb, #1f4fb0); border-color: #7fb0ff; }
.skins-view { display: none; flex: 1; min-height: 0; overflow-y: auto; flex-direction: column; gap: 10px; }
.deck-panel.sub-skins .skins-view { display: flex; }
.deck-panel.sub-skins #deck-slots, .deck-panel.sub-skins .deck-filters, .deck-panel.sub-skins #deck-grid,
.deck-panel.sub-skins #deck-info, .deck-panel.sub-skins #deck-msg, .deck-panel.sub-skins > .btn-row,
.deck-panel.sub-skins #deck-avg { display: none !important; }

.skin-preview { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 12px; align-items: center; }
.skin-stage {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 4%;
  padding: 18px 10px 14px;
  min-height: 170px;
  border-radius: 14px;
  border: 2px solid var(--line, #2f4a8a);
  background: linear-gradient(rgba(10, 16, 36, 0.25), rgba(10, 16, 36, 0.45)), var(--map) center 70% / cover;
  overflow: hidden;
}
.skin-stage img { width: 26%; image-rendering: auto; }
.skin-stage img:nth-child(2) { width: 36%; }
.skin-stage.locked-preview::after { content: '🔒 Prévia'; position: absolute; top: 8px; left: 10px; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 8px; background: rgba(0, 0, 0, 0.55); }
.skin-stage.sparkle::before {
  content: '✦  ✧    ✦\A    ✧   ✦  ✧';
  white-space: pre;
  position: absolute;
  inset: 12px 10px auto;
  text-align: center;
  color: #fff8c8;
  font-size: 18px;
  letter-spacing: 6px;
  animation: twinkle 1.4s ease-in-out infinite;
  pointer-events: none;
}
@keyframes twinkle { 50% { opacity: 0.2; } }
.skin-detail { display: flex; flex-direction: column; gap: 6px; }
.skin-detail b { font-family: var(--pixel, sans-serif); font-size: 22px; }
.skin-detail small { font-size: 12px; opacity: 0.85; }
.skin-detail small.bad { color: #ff8a8a; opacity: 1; }
.skin-detail button { padding: 12px; }

.skin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.skin-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 6px;
  border-radius: 12px;
  background: var(--panel-2, #1a2649);
  border: 2px solid var(--line, #2f4a8a);
  box-shadow: none;
  font-family: inherit;
}
.skin-item img { width: 64px; height: 64px; object-fit: contain; pointer-events: none; }
.skin-item b { font-size: 14px; font-family: var(--pixel, sans-serif); }
.skin-item small { font-size: 11px; opacity: 0.85; }
.skin-item.locked img { filter: grayscale(0.85) brightness(0.55) !important; }
.skin-item.equipped { border-color: #7ee0a8; }
.skin-item.focused { border-color: #f8d030; box-shadow: 0 0 0 2px #f8d030; }
#look-skin-open { width: 100%; padding: 10px; font-size: 14px; }

@media (max-width: 760px) {
  .skin-preview { grid-template-columns: 1fr; }
  .skin-stage { min-height: 150px; }
  .skin-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ---------- Vários decks (abas 1–5 na Coleção) ---------- */
.deck-tabs { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; }
.deck-tabs button {
  padding: 6px 0;
  font-size: 14px;
  background: var(--panel-2, #1a2649);
  box-shadow: none;
  border: 2px solid var(--line, #2f4a8a);
}
.deck-tabs button.empty { opacity: 0.55; border-style: dashed; }
.deck-tabs button.active { background: linear-gradient(180deg, #2f6fdb, #1f4fb0); border-color: #7fb0ff; opacity: 1; }
.deck-tabs button.in-use { border-color: #ffcb05; }
.deck-panel.sub-skins #deck-tabs { display: none; }

/* Presente de versão: subtítulo embaixo do título da recompensa */
.reward-sub { display: block; font-size: 13px; font-weight: 600; opacity: 0.85; margin-top: 2px; }

/* ---------- Histórico de partidas (Minha conta) ---------- */
.history-list { display: grid; gap: 8px; max-height: 340px; overflow-y: auto; }
.history-row { padding: 8px 10px; border-radius: 10px; background: rgba(255, 255, 255, 0.05); border-left: 4px solid #8a93b8; }
.history-row.win { border-left-color: #4ade80; }
.history-row.loss { border-left-color: #f87171; }
.history-top { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.history-top .history-delta { margin-left: auto; font-weight: 800; }
.history-row.win .history-delta { color: #4ade80; }
.history-row.loss .history-delta { color: #f87171; }
.history-row small { opacity: 0.75; }
.history-row .mini-deck { grid-template-columns: repeat(8, 1fr); margin-top: 6px; }

/* ---------- Amigos (lista, pedidos) e convite para X1 ---------- */
.friends-box { display: grid; gap: 8px; margin: 10px 0 6px; }
.friends-box h3, .room-title { margin: 6px 0 0; font-size: 15px; }
.friend-add-row { display: flex; gap: 8px; }
.friend-add-row input { flex: 1; min-width: 0; padding: 10px 12px; border-radius: 10px; border: 2px solid var(--line, #2f4a8a); background: rgba(0, 0, 0, 0.25); color: inherit; font: inherit; }
.friend-list { display: grid; gap: 6px; max-height: 260px; overflow-y: auto; }
.friend-row { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 10px; background: rgba(255, 255, 255, 0.05); }
.friend-row img { width: 36px; height: 36px; border-radius: 8px; image-rendering: pixelated; background: rgba(0, 0, 0, 0.25); pointer-events: none; }
.friend-row .friend-name { flex: 1; min-width: 0; display: grid; font-weight: 700; }
.friend-row .friend-name small { font-weight: 400; opacity: 0.75; font-size: 12px; }
.friend-row button { padding: 6px 10px; font-size: 13px; }
.friend-row button.icon { width: 32px; height: 32px; padding: 0; }
.friend-row.request { border: 2px solid #ffcb05; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #6b7280; margin-right: 6px; vertical-align: middle; }
.dot.on { background: #4ade80; box-shadow: 0 0 6px #4ade80; }
.hub-nav [data-badge]:not([data-badge=""]) { position: relative; }
.hub-nav [data-badge]:not([data-badge=""])::after {
  content: attr(data-badge);
  position: absolute;
  top: 2px;
  right: 18%;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  line-height: 16px;
}
.invite-overlay { position: fixed; z-index: 50; }
.invite-panel { max-width: 340px; text-align: center; display: grid; justify-items: center; gap: 6px; }
.invite-panel img { width: 72px; height: 72px; image-rendering: pixelated; border-radius: 12px; background: rgba(0, 0, 0, 0.25); animation: wobble 0.6s ease-in-out 2; }
