/* Telas da conta (v0.4): entrar, inicial, início, caminho dos troféus, recompensas, coleção */

.hidden { display: none !important; }
.overlay { overflow-y: auto; }
.panel { max-height: 100%; overflow-y: auto; }
.sub.small, p.small { font-size: 12px; opacity: 0.75; margin-top: 8px; }
.waiting::after { content: ''; animation: dots 1.4s steps(4) infinite; }
button.link {
  display: block;
  width: 100%;
  margin-top: 10px;
  background: none;
  box-shadow: none;
  color: #9fb3ff;
  font-weight: 600;
  text-decoration: underline;
  padding: 6px;
}
button.link:active { transform: none; }
#menu-account { margin-top: 14px; }

.auth-form { display: grid; gap: 10px; margin-top: 14px; }
.auth-form input {
  padding: 12px;
  border-radius: 10px;
  border: 2px solid #4d5d94;
  background: #161d36;
  color: #fff;
  font: inherit;
  user-select: text;
  -webkit-user-select: text;
}
.auth-form input:focus { outline: 2px solid #f8d030; border-color: transparent; }

/* Escolha do inicial */
.starter-panel { max-width: 520px; }
#starter-options { display: grid; gap: 10px; margin-top: 14px; }
.starter-card {
  display: grid;
  grid-template-columns: 64px 1fr;
  grid-template-areas: 'img title' 'img hint' 'deck deck' 'btn btn';
  gap: 2px 12px;
  padding: 10px;
  border-radius: 14px;
  text-align: left;
  background: linear-gradient(135deg, color-mix(in srgb, var(--type) 45%, #222b4a), #222b4a 70%);
  border: 2px solid color-mix(in srgb, var(--type) 70%, #fff);
}
.starter-card > img { grid-area: img; width: 64px; height: 64px; image-rendering: pixelated; border-radius: 10px; }
.starter-card h3 { grid-area: title; align-self: end; }
.starter-card p { grid-area: hint; font-size: 13px; opacity: 0.85; }
.mini-deck { grid-area: deck; display: grid; grid-template-columns: repeat(8, 1fr); gap: 3px; margin-top: 6px; }
.mini-deck img { width: 100%; image-rendering: pixelated; border-radius: 6px; background: rgba(0, 0, 0, 0.25); }
.starter-card button { grid-area: btn; margin-top: 8px; }

/* Início: ver css/hub.css. Peças reaproveitadas lá: */
.ball-slots { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 12px; }
.ball-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-height: 92px;
  padding: 6px 4px;
  border-radius: 12px;
  background: #1a2240;
  border: 2px solid #3b4a7d;
  box-shadow: none;
  font-size: 11px;
  text-align: center;
}
.ball-slot img { width: 34px; height: 34px; image-rendering: pixelated; }
.ball-slot b, .ball-slot small { font-size: 11px; }
.ball-slot.empty { justify-content: center; border-style: dashed; opacity: 0.6; }
.ball-slot.empty small { font-size: 9px; }
.ball-slot.unlocking { border-color: #8fb0ff; }
.ball-slot.ready { border-color: #f8d030; background: #3b3416; animation: glow 1.2s ease-in-out infinite; }
@keyframes glow { 50% { box-shadow: 0 0 14px #f8d030; } }
.free-ball { margin-top: 8px; display: flex; align-items: center; justify-content: center; gap: 6px; }
.free-ball img { width: 26px; height: 26px; image-rendering: pixelated; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; margin: 10px 0 8px; text-align: left; }
.check input { width: 18px; height: 18px; accent-color: #f0b400; flex-shrink: 0; }

/* Caminho dos troféus */
.road-panel { display: flex; flex-direction: column; height: 100%; text-align: left; }
#road-list { flex: 1; overflow-y: auto; display: grid; gap: 8px; margin-top: 10px; padding: 2px; }
.road-step {
  display: grid;
  grid-template-columns: 70px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 12px;
  background: #1a2240;
  border: 2px solid #3b4a7d;
  opacity: 0.6;
}
.road-step.reached { opacity: 1; background: linear-gradient(90deg, color-mix(in srgb, var(--arena) 45%, #1a2240), #1a2240); }
.road-step.current { border-color: #f8d030; box-shadow: 0 0 0 2px #f8d030; }
.road-trophies { font-weight: 800; font-size: 13px; }
.road-body { display: grid; gap: 3px; font-size: 14px; }
.road-body small { opacity: 0.8; font-size: 11px; }
.road-you { font-weight: 900; color: #f8d030; font-size: 12px; }

/* Recompensas */
.reward-title { display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 22px; text-align: center; }
.reward-ball { width: 48px; height: 48px; image-rendering: pixelated; animation: wobble 0.6s ease-in-out 2; }
@keyframes wobble { 25% { transform: rotate(-18deg); } 75% { transform: rotate(18deg); } }
/* Cartas centralizadas, mesmo quando são poucas (presente, Poké Ball com 2 cartas...) */
#reward-cards { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 14px 0; align-items: flex-start; }
#reward-cards .reward-card { width: 76px; flex: 0 0 76px; }
.reward-card { animation: pop 0.35s ease-out both; }
@keyframes pop { from { transform: scale(0.3); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.reward-card .count { position: absolute; top: 2px; right: 4px; font-weight: 900; font-size: 13px; text-shadow: 0 1px 2px #000; }
.reward-card .new { position: absolute; top: 40%; left: 50%; transform: translate(-50%, -50%) rotate(-12deg); background: #ef4444; padding: 1px 6px; border-radius: 6px; font-size: 11px; font-weight: 900; }
#reward-extra { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-bottom: 14px; font-weight: 700; }
.reward-gold { font-size: 18px; }
.reward-item { display: inline-flex; align-items: center; gap: 4px; }
.item-icon { width: 24px; height: 24px; image-rendering: pixelated; vertical-align: middle; }

/* Cartas na coleção */
.card { box-shadow: 0 3px 0 #0d1226, inset 0 -4px 0 var(--rarity, transparent); }
.card .lvl { position: absolute; top: 2px; right: 3px; font-size: 9px; font-weight: 900; background: rgba(0, 0, 0, 0.55); padding: 0 4px; border-radius: 5px; }
.card.locked { filter: grayscale(1) brightness(0.55); }
.card.can-upgrade::after {
  content: '▲';
  position: absolute;
  bottom: 16px;
  right: 3px;
  color: #7dff8a;
  font-size: 12px;
  text-shadow: 0 1px 2px #000;
  animation: glow-up 1s ease-in-out infinite;
}
@keyframes glow-up { 50% { transform: translateY(-3px); } }
#deck-gold { font-weight: 800; font-size: 13px; }
#deck-info { flex-wrap: wrap; }
#deck-info .rarity { font-weight: 800; }
.info-actions { display: flex; flex-direction: column; gap: 6px; }
.copies { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 6px; }
.copies-bar { position: relative; flex: 1; min-width: 90px; height: 18px; border-radius: 9px; background: #0f1430; overflow: hidden; }
.copies-bar i { position: absolute; inset: 0 auto 0 0; background: linear-gradient(#7dd3fc, #2563eb); }
.copies-bar span { position: relative; display: block; text-align: center; font-size: 11px; font-weight: 800; line-height: 18px; text-shadow: 0 1px 1px #000; }
.copies button { flex: 0 0 auto; padding: 6px 10px; font-size: 12px; }
.locked-hint { opacity: 0.85; font-size: 12px; }
.item-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.item-row button { flex: 0 0 auto; padding: 4px 8px; font-size: 12px; display: inline-flex; align-items: center; gap: 4px; }
#deck-msg { min-height: 1.2em; font-size: 13px; font-weight: 700; text-align: center; }
#deck-msg.good { color: #7dff8a; }
#deck-msg.bad { color: #ff8a8a; }

/* Fim de partida */
#end-reward { display: grid; gap: 8px; margin: -6px 0 16px; }
.trophy-delta { font-size: 26px; font-weight: 900; }
.trophy-delta.up { color: #7dff8a; }
.trophy-delta.down { color: #ff8a8a; }
.trophy-delta small { font-size: 14px; color: #fff; opacity: 0.75; }
.won-ball { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 14px; }
.won-ball img { width: 30px; height: 30px; image-rendering: pixelated; }
.won-ball.muted { opacity: 0.75; font-size: 13px; }
.arena-up { padding: 8px; border-radius: 10px; background: rgba(248, 208, 48, 0.15); border: 1px solid #f8d030; font-size: 14px; }

.road-body small { display: block; }

/* Miniaturas dos mapas como fundo do caminho dos troféus */
.road-step { background: linear-gradient(90deg, rgba(26, 34, 64, 0.95), rgba(26, 34, 64, 0.7)), var(--map, none) center 40% / cover, #1a2240; }
.road-step.reached { background: linear-gradient(90deg, rgba(26, 34, 64, 0.9), rgba(26, 34, 64, 0.35)), var(--map, none) center 40% / cover, #1a2240; }

/* Deck inicial no celular: 2 fileiras de 4 para os ícones não ficarem minúsculos */
@media (max-width: 560px) {
  .starter-panel { padding: 16px 12px; }
  .mini-deck { grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 10px; }
  .mini-deck span { display: block; border-radius: 8px; background: rgba(0, 0, 0, 0.25); }
  .mini-deck img { display: block; width: 100%; max-width: 72px; margin: 0 auto; }
}

/* ---------- Ball abrindo (antes das recompensas) ---------- */
.reward-panel { min-height: 320px; }
/* Compra na loja: o painel entra com um pulinho e um brilho girando atrás do que você ganhou */
.reward-panel.reward-pop { animation: pop 0.3s ease-out; position: relative; overflow: hidden; }
.reward-panel.reward-pop::before {
  content: ''; position: absolute; left: 50%; top: 42%; width: 360px; height: 360px; margin: -180px 0 0 -180px; pointer-events: none;
  background: repeating-conic-gradient(from 0deg, rgba(255, 230, 120, 0.09) 0 12deg, transparent 12deg 30deg);
  border-radius: 50%; animation: purchase-rays 6s linear infinite, purchase-fade 0.6s ease-out;
}
.reward-panel.reward-pop > * { position: relative; }
@keyframes purchase-rays { to { transform: rotate(360deg); } }
@keyframes purchase-fade { from { opacity: 0; transform: scale(0.4); } }
.reward-icon { display: inline-flex; animation: wobble 0.6s ease-in-out 2; }
.reward-icon img { width: 44px; height: 44px; image-rendering: pixelated; }
.reward-pop .reward-item { font-size: 18px; font-weight: 800; animation: pop 0.35s ease-out both; }
.reward-pop .reward-item img { width: 40px; height: 40px; image-rendering: pixelated; }
.reward-cosmetic { display: grid; justify-items: center; gap: 6px; animation: pop 0.35s ease-out both; }
.ball-open {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  cursor: pointer;
  user-select: none;
}
.ball-svg { width: 150px; height: 150px; overflow: visible; filter: drop-shadow(0 10px 12px rgba(0, 0, 0, 0.5)); }
.ball-name { margin-top: 14px; font-family: var(--pixel, sans-serif); font-size: 22px; color: #fff; opacity: 0; }
.ball-skip { margin-top: 6px; font-size: 11px; opacity: 0.5; }
.ball-top { transform-box: view-box; transform-origin: 95px 50px; }
.ball-button { transform-box: fill-box; transform-origin: center; }
.ball-burst {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 40px;
  height: 40px;
  margin: -20px 0 0 -20px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff 0%, rgba(255, 245, 180, 0.9) 35%, rgba(255, 220, 120, 0) 70%);
  opacity: 0;
  pointer-events: none;
}
.tier-great .ball-burst { background: radial-gradient(circle, #fff 0%, rgba(150, 200, 255, 0.9) 35%, rgba(80, 140, 255, 0) 70%); }
.tier-ultra .ball-burst { background: radial-gradient(circle, #fff 0%, rgba(255, 220, 90, 0.95) 35%, rgba(255, 190, 0, 0) 70%); }
.tier-master .ball-burst { background: radial-gradient(circle, #fff 0%, rgba(230, 150, 255, 0.95) 35%, rgba(180, 80, 255, 0) 70%); }

/* Sequência: cai (0–0,45 s) → balança 3x (0,5–1,6 s) → botão brilha (1,6–1,9 s) → abre e clarão (1,9–2,6 s) */
.ball-open.playing .ball-svg { animation: ball-drop 0.45s cubic-bezier(0.3, 1.6, 0.6, 1) both, ball-shake 0.36s ease-in-out 0.5s 3; transform-origin: 50% 90%; }
.ball-open.playing .ball-button { animation: ball-glow 0.3s ease-in-out 1.6s 2 alternate; }
.ball-open.playing .ball-top { animation: ball-lid 0.45s cubic-bezier(0.2, 1.4, 0.5, 1) 1.95s both; }
.ball-open.playing .ball-burst { animation: ball-burst 0.7s ease-out 1.95s both; }
.ball-open.playing .ball-name { animation: ball-name 0.4s ease-out 0.3s both; }
@keyframes ball-drop { from { transform: translateY(-160px) scale(0.6); opacity: 0; } to { transform: translateY(0) scale(1); opacity: 1; } }
@keyframes ball-shake { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-16deg); } 75% { transform: rotate(16deg); } }
@keyframes ball-glow { to { fill: #fff6b0; transform: scale(1.25); } }
@keyframes ball-lid { to { transform: translate(-2px, -12px) rotate(48deg); } } /* dobradiça à direita: o lado esquerdo sobe */
@keyframes ball-burst { 0% { opacity: 0; transform: scale(0.5); } 30% { opacity: 1; } 100% { opacity: 0; transform: scale(9); } }
@keyframes ball-name { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Grades de cartas: cada linha tem a altura da carta (sem isso, com muitas cartas as linhas
   encolhiam até zero e as cartas ficavam umas sobre as outras), e arrastar por cima rola a lista.
   As cartas da mão na partida continuam com touch-action: none para poder arrastar. */
#deck-grid, #deck-slots, #reward-cards, .deck-strip, .mini-deck { grid-auto-rows: max-content; }
#deck-grid .card, #deck-slots .card, #reward-cards .card, .deck-strip .card { touch-action: pan-y; }

/* ✕ para fechar os detalhes da carta na coleção */
#deck-info { position: relative; }
#deck-info .info-close { position: absolute; top: 6px; right: 6px; width: 30px; height: 30px; padding: 0; font-size: 14px; z-index: 1; }
#deck-info .info-body { padding-right: 26px; }

/* Celular: detalhes da carta compactos, sem esmagar a lista nem passar por cima dos botões */
@media (max-width: 760px) {
  #deck-info { flex-wrap: wrap; align-items: flex-start; max-height: 40vh; overflow-y: auto; gap: 8px 10px; padding: 10px; }
  #deck-info > img { width: 56px; height: 56px; }
  #deck-info .info-body { flex: 1 1 calc(100% - 70px); min-width: 0; }
  #deck-info h3 { font-size: 15px; }
  #deck-info .info-actions { flex-direction: row; width: 100%; }
  #deck-info .info-actions button { flex: 1; }
  #deck-grid { min-height: 150px; }
}
