* { box-sizing: border-box; }

:root {
  --bg: #1b1d24;
  --panel: rgba(255, 255, 255, 0.08);
  --border: rgba(255, 255, 255, 0.55);
  --text: #f2f2f2;
  --muted: #b7bac4;
  --yellow: #ffcb05;
  /* Tema da região (trocado em applyTheme) */
  --bg-a: #2b2f3a;
  --bg-b: #15161b;
  --accent: #ffffff;
}

html, body { margin: 0; height: 100%; }
html { background: var(--bg-b); overflow-x: hidden; }
@media (min-width: 1001px) { html { overflow: hidden; } }

body {
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(circle at 20px 20px, rgba(255,255,255,0.05) 9px, transparent 10px),
    radial-gradient(circle at 70px 70px, rgba(255,255,255,0.035) 14px, transparent 15px),
    radial-gradient(ellipse at center, var(--bg-a) 0%, var(--bg-b) 100%);
  background-size: 100px 100px, 100px 100px, 100% 100%;
  background-attachment: fixed;
  display: grid;
  grid-template-columns: 170px 1fr 300px;
  gap: 16px;
  padding: 16px;
  /* A página tem sempre a altura da tela: nada estica quando a cena muda. */
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.hidden { display: none !important; }

/* ---------- Barra esquerda ---------- */
.side.left { display: flex; flex-direction: column; gap: 10px; }
.logo {
  font-size: 22px; font-weight: bold; line-height: 1.05; text-align: center;
  color: var(--yellow); text-shadow: 3px 3px 0 #2a75bb, -1px -1px 0 #2a75bb;
  margin-bottom: 6px;
}
.logo span { font-size: 28px; }
.record { font-size: 12px; color: var(--muted); text-align: center; line-height: 1.5; }

.btn {
  border: none; border-radius: 8px; padding: 12px 14px; cursor: pointer;
  font: inherit; font-weight: bold; color: #fff; background: #555;
  transition: transform .08s, filter .15s;
}
.btn:hover:not(:disabled) { filter: brightness(1.15); }
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.blue { background: #1f6feb; }
.btn.grey { background: #5f6670; }
.btn.green { background: #1e8c4e; }
.btn.red { background: #c0392b; }
.btn.yellow { background: var(--yellow); color: #222; }
.btn.outline { background: transparent; border: 1px solid var(--border); }
.btn.small { padding: 8px 10px; font-size: 13px; }
.btn.big { font-size: 22px; padding: 14px 40px; }
.btn.attempt { background: #e3350d; font-size: 16px; }
.btn.attempt strong { font-size: 20px; display: block; }

/* ---------- Centro ---------- */
/* Cabeçalho, área da cena e botões têm altura fixa: trocar de cena não muda o tamanho de nada. */
.center {
  display: flex; flex-direction: column; align-items: center; text-align: center; min-width: 0; min-height: 0;
  height: 100%; padding: 12px; border-radius: 16px;
}
.scene-head { flex: 0 0 152px; width: 100%; display: flex; flex-direction: column; align-items: center; overflow: hidden; }
.status {
  font-size: 13px; color: color-mix(in srgb, var(--accent) 60%, var(--muted)); letter-spacing: .5px; height: 18px;
  text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
}
h1 {
  margin: 4px 0; font-size: 30px; line-height: 38px; height: 38px; max-width: 100%;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 2px 2px 0 rgba(0,0,0,.5);
}
.subtitle { margin: 0; color: var(--muted); max-width: 720px; line-height: 1.35; max-height: 5.4em; overflow: hidden; }

.scene-body {
  flex: 1 1 0; min-height: 0; width: 100%; position: relative; container-type: size;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
/* Imagens de destaque ficam por cima, nos cantos de cima da área (não empurram a roleta). */
.spotlight {
  position: absolute; top: 0; left: 0; right: 0; z-index: 2; pointer-events: none;
  display: flex; justify-content: space-between; align-items: flex-start;
}
.spotlight img, .spotlight canvas { width: 120px; height: 120px; object-fit: contain; filter: drop-shadow(0 4px 8px rgba(0,0,0,.6)); }
/* Sprites de treinador e sprites animados são pixel art pequenos: ampliar sem borrar. */
img.trainer, img.anim, canvas.anim { image-rendering: pixelated; }
/* Treinadores não têm GIF: ficam "respirando" (o corpo estica e encolhe em passos, como pixel art)
   e, ao aparecer, entram dando um pulinho. */
img.trainer {
  transform-origin: 50% 100%;
  animation: trainer-in .45s ease-out, trainer-idle 1.6s steps(2, jump-none) .45s infinite;
}
.spotlight img.trainer:nth-child(2) { animation-delay: 0s, .25s; }
@keyframes trainer-idle {
  0%, 100% { transform: scale(1, 1); }
  50% { transform: scale(1.02, .965) translateY(1px); }
}
@keyframes trainer-in {
  0% { transform: translateY(14px) scale(.9); opacity: 0; }
  60% { transform: translateY(-6px) scale(1.02); opacity: 1; }
  100% { transform: none; }
}
@media (prefers-reduced-motion: reduce) { img.trainer { animation: none; } }

/* Cenário de batalha (tipo do líder) ou da área. */
.center { transition: background .4s; }
.center.arena {
  background: var(--arena) center / cover no-repeat;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.15), 0 8px 24px rgba(0,0,0,.5);
}

/* Fala do líder */
.card blockquote { margin: 0 0 10px; }
.quote {
  display: block; font-size: 18px; font-style: italic; line-height: 1.4; margin-bottom: 8px;
  padding: 8px 12px; border-left: 4px solid var(--yellow); background: rgba(0,0,0,.25); border-radius: 6px; text-align: left;
}
.quote b { font-style: normal; color: var(--yellow); }

.wheel-wrap { width: min(100cqw, 100cqh, 600px); aspect-ratio: 1; flex: none; }
.wheel-wrap canvas { width: 100%; height: 100%; filter: drop-shadow(0 8px 20px rgba(0,0,0,.6)); }

/* Letreiro das roletas grandes: por cima da parte de baixo da roleta. */
.ticker {
  position: absolute; bottom: 4px; left: 50%; transform: translateX(-50%); z-index: 3; pointer-events: none;
  display: flex; align-items: center; justify-content: center; gap: 10px; white-space: nowrap;
  font-size: 26px; font-weight: bold; text-shadow: 2px 2px 0 rgba(0,0,0,.6);
}
.ticker:not(:empty) { background: rgba(0,0,0,.55); border-radius: 14px; padding: 2px 18px 2px 6px; }
.ticker img { width: 80px; height: 80px; object-fit: contain; image-rendering: pixelated; filter: drop-shadow(0 4px 6px rgba(0,0,0,.6)); }

/* Cartões maiores que a área rolam por dentro dela. */
.stage { width: 100%; max-height: 100%; overflow-y: auto; display: flex; justify-content: center; }
.stage:empty { display: none; }
.stage > * { margin: auto 0; }
.actions {
  flex: 0 0 72px; width: 100%; display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; align-items: center;
  overflow: hidden;
}

.gen-grid { display: grid; grid-template-columns: repeat(3, 110px); gap: 16px; margin-top: 10px; }
.gen-btn {
  height: 90px; border-radius: 8px; border: none; cursor: pointer; color: #fff;
  font: inherit; font-weight: bold; font-size: 20px; display: flex; flex-direction: column;
  justify-content: center; align-items: center; gap: 6px; box-shadow: 0 4px 10px rgba(0,0,0,.4);
}
.gen-btn small { font-size: 13px; opacity: .9; }
.gen-btn:hover { filter: brightness(1.2); transform: translateY(-2px); }
.gen-btn.locked { filter: grayscale(.85) brightness(.55); cursor: not-allowed; }
.gen-btn.locked:hover { transform: none; }
.gen-btn .req { font-size: 10px; font-weight: normal; opacity: .85; }

.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px;
  padding: 20px 28px; max-width: 560px; box-shadow: 0 0 18px color-mix(in srgb, var(--accent) 30%, transparent);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
}
.card img.big, .card canvas.big { width: 200px; height: 200px; object-fit: contain; filter: drop-shadow(0 6px 10px rgba(0,0,0,.6)); }
.card p { font-size: 18px; line-height: 1.5; margin: 8px 0; }
.card .row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.card .row img { width: 80px; height: 80px; object-fit: contain; }

.type {
  display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px;
  font-weight: bold; color: #fff; text-shadow: 1px 1px 0 rgba(0,0,0,.4); margin: 0 2px;
}
.shiny { color: var(--yellow); }

/* Vantagem / Desvantagem de tipo na batalha */
.matchup { display: inline-flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 6px; font-size: 13px; }
.matchup.neutral { color: var(--muted); font-size: 12px; }
.matchup b { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; }
.matchup b.good { color: #5be38b; }
.matchup b.bad { color: #ff7b6b; margin-left: 6px; }
.matchup-type { display: inline-flex; align-items: center; }
.matchup-type img { width: 26px; height: 26px; margin: -6px -3px; image-rendering: pixelated; }

/* ---------- Painel direito ---------- */
.side.right { display: flex; flex-direction: column; gap: 14px; min-height: 0; overflow-y: auto; }
.panel {
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 12px;
  box-shadow: 0 0 14px color-mix(in srgb, var(--accent) 25%, transparent); backdrop-filter: blur(2px);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
}
.panel h2 { margin: 0 0 8px; font-size: 20px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; }
.power { font-size: 12px; color: var(--muted); }

.team { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 10px; }
.slot {
  aspect-ratio: 1; border: 1px solid var(--border); border-radius: 8px; position: relative;
  display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.15);
  overflow: hidden;
}
.slot img, .slot canvas { width: 85%; height: 85%; object-fit: contain; }
.slot .name {
  position: absolute; bottom: 0; left: 0; right: 0; font-size: 10px; background: rgba(0,0,0,.55);
  padding: 1px 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.slot .star { position: absolute; top: 2px; right: 4px; font-size: 13px; }
.slot .mega {
  position: absolute; top: 3px; left: 4px; width: 18px; height: 18px; border-radius: 50%;
  background: linear-gradient(135deg, #ff7eb3, #7a5cff); font-size: 11px; font-weight: bold;
  display: flex; align-items: center; justify-content: center; box-shadow: 0 0 6px #ff7eb3;
}
.slot .mega.dmax { background: linear-gradient(135deg, #ff5252, #b71c1c); box-shadow: 0 0 6px #ff5252; }
.slot img.held { position: absolute; bottom: 14px; right: 2px; width: 22px; height: 22px; image-rendering: pixelated; }
.unown-word { letter-spacing: 4px; font-size: 1.2em; color: var(--yellow); }
.slot.selected { outline: 3px solid var(--yellow); }
.slot.clickable { cursor: pointer; }
.slot.clickable:hover { background: rgba(255,255,255,.12); }

.badges { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; }
.badges.league { margin-top: 6px; }
.badge {
  aspect-ratio: 1; border-radius: 50%; border: 2px solid rgba(255,255,255,.3);
  background: rgba(0,0,0,.25); display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: bold; color: rgba(255,255,255,.35);
}
.badge.won { border-color: #fff; color: #fff; box-shadow: 0 0 8px rgba(255,255,255,.5); }
.badge.current { border-color: var(--yellow); border-style: dashed; }
/* Insígnias dos ginásios: imagem do jogo, apagada até ganhar. */
.badge.img { background: rgba(0,0,0,.3); padding: 3px; overflow: hidden; }
.badge.img img { width: 100%; height: 100%; object-fit: contain; filter: grayscale(1) brightness(.45); opacity: .55; }
.badge.img.won { background: rgba(255,255,255,.08); }
.badge.img.won img { filter: drop-shadow(0 1px 2px rgba(0,0,0,.6)); opacity: 1; }

.items { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.item {
  border: 1px solid var(--border); border-radius: 8px; padding: 4px; display: flex; align-items: center;
  gap: 4px; font-size: 11px; position: relative; background: rgba(0,0,0,.15); padding-right: 14px;
}
.item img { width: 30px; height: 30px; image-rendering: pixelated; }
.item .count { position: absolute; top: 1px; right: 5px; font-weight: bold; font-size: 13px; }
.item.key { border-style: dashed; }
.items .hint { grid-column: 1 / -1; margin: 4px 0; }
.item.usable { cursor: pointer; border-color: var(--yellow); box-shadow: 0 0 8px var(--yellow); }

/* ---------- Modal / Toast ---------- */
.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,.7); display: flex; align-items: center;
  justify-content: center; z-index: 10; padding: 16px;
}
.modal-box {
  background: #23262f; border: 1px solid var(--border); border-radius: 12px; padding: 16px;
  width: min(720px, 100%); max-height: 90vh; overflow: auto;
}
.modal-box h3 { margin: 12px 0 6px; }
.hint { color: var(--muted); font-size: 13px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 8px; }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 20;
  background: #111; border: 1px solid var(--yellow); padding: 10px 18px; border-radius: 8px;
}

@media (max-width: 1000px) {
  /* No celular a página rola, mas a área do jogo continua com altura fixa. */
  body { grid-template-columns: 1fr; height: auto; overflow: visible; }
  .center { height: 100vh; height: 100svh; min-height: 520px; }
  .side.right { overflow: visible; }
  .scene-head { flex-basis: 140px; }
  h1 { font-size: 24px; }
  .side.left { flex-direction: row; flex-wrap: wrap; justify-content: center; }
  .logo br { display: none; }
  .gen-grid { grid-template-columns: repeat(3, minmax(80px, 110px)); }
}

/* ---------- Conquistas ---------- */
.achv-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; margin-top: 8px; }
.achv {
  display: flex; gap: 10px; align-items: center; padding: 10px; border-radius: 10px;
  border: 1px solid rgba(255,255,255,.2); background: rgba(0,0,0,.2); opacity: .55;
}
.achv.done { opacity: 1; border-color: var(--yellow); box-shadow: 0 0 8px rgba(255,203,5,.35); }
.achv.skin { font: inherit; color: inherit; text-align: left; cursor: pointer; }
.achv.skin canvas { width: 40px; height: 40px; flex: none; }
.achv.skin.equipped { border-color: #4caf50; box-shadow: 0 0 10px rgba(76,175,80,.6); }
.achv .icon, .achv-pop .icon { font-size: 28px; }
.achv b, .achv small, .achv-pop b, .achv-pop small { display: block; }
.achv small { color: var(--muted); font-size: 12px; }

.achv-pops { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 30; display: flex; flex-direction: column; gap: 8px; }
.achv-pop {
  display: flex; gap: 10px; align-items: center; background: #111; border: 2px solid var(--yellow);
  border-radius: 10px; padding: 8px 16px; box-shadow: 0 4px 16px rgba(0,0,0,.6);
  animation: pop-in .4s ease-out;
}
.achv-pop small { color: var(--yellow); font-size: 11px; text-transform: uppercase; }
@keyframes pop-in { from { transform: translateY(-30px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Efeitos ---------- */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 40; }
body.shake { animation: shake .6s cubic-bezier(.36,.07,.19,.97); }
/* Só na horizontal: tremer na vertical mudava a altura da página por um instante. */
@keyframes shake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(4px); }
  30%, 50%, 70% { transform: translateX(-8px); }
  40%, 60% { transform: translateX(8px); }
}
@media (prefers-reduced-motion: reduce) { body.shake { animation: none; } }

/* ---------- Creche / Torre Fantasma ---------- */
.away:not(:empty) { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.away-row {
  display: flex; align-items: center; gap: 8px; font-size: 12px; text-align: left;
  background: rgba(0,0,0,.2); border: 1px dashed var(--border); border-radius: 8px; padding: 4px 8px;
}
.away-row img { width: 40px; height: 40px; image-rendering: pixelated; opacity: .75; }
.away-row small { color: var(--muted); }

/* ---------- Caça-níquel do Game Corner ---------- */
.slots {
  display: flex; gap: 14px; padding: 18px; border-radius: 16px; margin-top: 10px;
  background: linear-gradient(#ffcb05, #e0a800); border: 4px solid #222; box-shadow: 0 8px 20px rgba(0,0,0,.6);
}
.reel {
  width: 120px; height: 120px; border-radius: 10px; background: #fff; border: 3px solid #222;
  display: flex; align-items: center; justify-content: center; box-shadow: inset 0 6px 12px rgba(0,0,0,.35);
}
.reel img { width: 96px; height: 96px; image-rendering: pixelated; }
.reel .seven { font-size: 80px; font-weight: bold; color: #e3350d; text-shadow: 3px 3px 0 #222; }
.reel.stopped { animation: reel-stop .25s ease-out; }
@keyframes reel-stop { 0% { transform: translateY(-10px); } 60% { transform: translateY(4px); } 100% { transform: none; } }

/* ---------- Modo TikTok: jogo em pé (9:16) no meio da tela do PC ---------- */
body.tiktok {
  grid-template-columns: 1fr;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(100vw, calc(100vh * 9 / 16));
  width: min(100vw, calc(100dvh * 9 / 16));
  margin: 0 auto;
  padding: 8px;
  gap: 6px;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 40%, transparent), 0 0 60px rgba(0,0,0,.8);
}
html:has(body.tiktok) { background: #050507; }
body.tiktok .lbl, body.tiktok .record { display: none; }
body.tiktok .side.left { flex-direction: row; align-items: center; justify-content: center; gap: 6px; }
body.tiktok .logo { font-size: 15px; margin: 0; }
body.tiktok .logo span { font-size: 18px; }
body.tiktok .logo br { display: none; }
body.tiktok .side.left .btn { padding: 6px 9px; font-size: 15px; }
body.tiktok .btn.attempt { font-size: 13px; padding: 4px 10px; }
body.tiktok .btn.attempt strong { display: inline; font-size: 16px; }
body.tiktok .center { padding: 6px; }
body.tiktok .scene-head { flex-basis: 128px; }
body.tiktok h1 { font-size: 22px; line-height: 30px; height: 30px; }
body.tiktok .subtitle { font-size: 13px; }
body.tiktok .actions { flex-basis: 60px; }
body.tiktok .btn.big { font-size: 18px; padding: 10px 26px; }
body.tiktok .card { padding: 12px 16px; }
body.tiktok .card p { font-size: 15px; }
body.tiktok .card img.big, body.tiktok .card canvas.big { width: 140px; height: 140px; }
body.tiktok .spotlight img, body.tiktok .spotlight canvas { width: 80px; height: 80px; }
body.tiktok .gen-grid { grid-template-columns: repeat(3, minmax(70px, 95px)); gap: 8px; }
body.tiktok .gen-btn { height: 66px; font-size: 15px; }
/* Embaixo: equipe numa linha, insígnias e mochila compactas, sem rolagem. */
body.tiktok .side.right { overflow: hidden; gap: 6px; }
body.tiktok .panel { padding: 6px 8px; }
body.tiktok .panel h2 { font-size: 13px; margin: 0 0 4px; }
body.tiktok .team { grid-template-columns: repeat(6, 1fr); gap: 4px; margin-bottom: 4px; }
body.tiktok .slot { aspect-ratio: 1.15; }
body.tiktok .slot .name { font-size: 8px; }
body.tiktok .away { display: none; }
body.tiktok #btn-pc { padding: 3px 8px; font-size: 11px; }
/* As 13 insígnias (8 ginásios + Liga) numa linha só. */
body.tiktok #badges { display: grid; grid-template-columns: repeat(13, 1fr); gap: 3px; }
body.tiktok .badges { display: contents; }
body.tiktok .badge { font-size: 8px; border-width: 1px; }
body.tiktok .badge.img { padding: 1px; }
body.tiktok .items { grid-template-columns: repeat(6, 1fr); gap: 4px; }
body.tiktok .item { padding: 2px; justify-content: center; }
body.tiktok .item span:not(.count) { display: none; }
body.tiktok .item img { width: 26px; height: 26px; }
body.tiktok .item .count { font-size: 11px; }
body.tiktok .achv-pops { top: 8px; }
.achv.layout { cursor: pointer; text-align: left; font: inherit; color: inherit; }
.achv.layout.equipped { outline: 2px solid var(--yellow); }

/* ---------- Telas de Mega Evolução, Movimento Z e Dynamax ---------- */
.tf {
  position: fixed; inset: 0; z-index: 50; overflow: hidden; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  animation: tf-in .3s ease-out both;
}
.tf.tf-out { animation: tf-fade .3s ease-in both; }
.tf-bg { position: absolute; inset: 0; background: #05060a; }
.tf-rays { position: absolute; inset: -50%; opacity: 0; animation: tf-spin 3.6s linear both, tf-rays-in .6s .2s ease-out both; }
.tf-stage { position: relative; width: min(60vmin, 420px); height: min(60vmin, 420px); display: flex; align-items: center; justify-content: center; }
.tf-stage img { position: absolute; width: 55%; height: 55%; object-fit: contain; image-rendering: pixelated; }
.tf-from { animation: tf-from 1.8s ease-in both; }
.tf-to { opacity: 0; animation: tf-to 1.3s 1.8s cubic-bezier(.2, 1.6, .4, 1) both; }
.tf-orb { position: absolute; width: 70%; height: 70%; border-radius: 50%; opacity: 0; animation: tf-orb 1.9s .3s ease-in both; }
.tf-badge { width: 22% !important; height: 22% !important; top: -6%; opacity: 0; animation: tf-badge 1.6s .1s ease-out both; }
.tf-flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; animation: tf-flash .7s 1.7s ease-out both; }
.tf-title {
  position: relative; margin-top: 2vmin; text-align: center; opacity: 0;
  animation: tf-title .5s 2s ease-out both;
}
.tf-title b { display: block; font-size: min(9vmin, 64px); color: #fff; text-shadow: 0 0 18px var(--tf-color), 0 4px 0 rgba(0,0,0,.6); letter-spacing: 2px; }
.tf-title small { display: block; font-size: min(4vmin, 24px); color: #fff; opacity: .9; margin-top: 4px; }

/* Mega: arco-íris girando e esfera multicolorida */
.tf-mega .tf-rays { background: repeating-conic-gradient(from 0deg, #ff5f6d 0 10deg, #ffc371 10deg 20deg, #47e6a0 20deg 30deg, #4facfe 30deg 40deg, #b06ab3 40deg 50deg); filter: blur(2px) saturate(1.4); }
.tf-mega .tf-orb { background: conic-gradient(#ff5f6d, #ffc371, #47e6a0, #4facfe, #b06ab3, #ff5f6d); box-shadow: 0 0 60px 20px rgba(255,255,255,.6); animation-name: tf-orb, tf-spin-orb; animation-duration: 1.9s, 1.2s; animation-delay: .3s, 0s; animation-iteration-count: 1, infinite; }

/* Z: dourado, raios e um Z gigante */
.tf-z .tf-bg { background: radial-gradient(circle, #3b2a00, #0b0700 70%); }
.tf-z .tf-rays { background: repeating-conic-gradient(from 0deg, rgba(255,203,5,.9) 0 6deg, transparent 6deg 18deg); }
.tf-z .tf-orb { background: radial-gradient(circle, rgba(255,255,255,.9), var(--tf-color) 45%, transparent 70%); }
.tf-z .tf-from { animation-name: tf-z-aura; }
.tf-z .tf-to { filter: drop-shadow(0 0 20px var(--tf-color)) drop-shadow(0 0 40px #ffcb05); }
.tf-z .tf-z {
  position: absolute; font-size: min(48vmin, 340px); font-weight: 900; color: #ffcb05; opacity: 0;
  text-shadow: 0 0 30px #fff, 0 0 60px #ffcb05, 0 0 90px var(--tf-color); font-family: Impact, "Arial Black", sans-serif;
  animation: tf-zletter 1.6s .4s ease-out both;
}

/* Dynamax: nuvens vermelhas e o Pokémon gigante */
.tf-dmax .tf-bg { background: radial-gradient(circle at 50% 60%, #6b0010, #12000a 70%); }
.tf-dmax .tf-rays { background: radial-gradient(circle at 30% 30%, rgba(255,40,80,.7), transparent 25%), radial-gradient(circle at 70% 40%, rgba(255,0,90,.6), transparent 25%), radial-gradient(circle at 50% 75%, rgba(255,60,60,.6), transparent 30%); filter: blur(20px); }
.tf-dmax .tf-orb { background: radial-gradient(circle at 35% 35%, #ff8a8a, #e3002b 45%, #5a0010 75%); box-shadow: 0 0 80px 30px rgba(255,0,60,.6); animation-name: tf-dmax-ball; }
.tf-dmax .tf-from { animation-name: tf-dmax-from; }
.tf-dmax .tf-to { width: 95% !important; height: 95% !important; filter: drop-shadow(0 0 25px #ff1744) drop-shadow(0 0 50px #ff1744); }

@keyframes tf-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes tf-fade { to { opacity: 0; } }
@keyframes tf-spin { to { transform: rotate(360deg); } }
@keyframes tf-spin-orb { to { filter: hue-rotate(360deg); } }
@keyframes tf-rays-in { to { opacity: .55; } }
@keyframes tf-from {
  0% { transform: scale(1); filter: brightness(1); }
  60% { transform: scale(1.05); filter: brightness(3) drop-shadow(0 0 20px #fff); }
  100% { transform: scale(.6); filter: brightness(8); opacity: 0; }
}
@keyframes tf-orb {
  0% { transform: scale(.2); opacity: 0; }
  40% { opacity: .95; }
  85% { transform: scale(1.1); opacity: .95; }
  100% { transform: scale(1.6); opacity: 0; }
}
@keyframes tf-badge { 0% { transform: translateY(20px) scale(.5); opacity: 0; } 30%, 80% { transform: none; opacity: 1; } 100% { opacity: 0; } }
@keyframes tf-flash { 0% { opacity: 0; } 20% { opacity: 1; } 100% { opacity: 0; } }
@keyframes tf-to { 0% { transform: scale(.3); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes tf-title { from { transform: translateY(20px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes tf-zletter {
  0% { transform: scale(3) rotate(-15deg); opacity: 0; }
  35% { transform: scale(1) rotate(0); opacity: 1; }
  80% { opacity: 1; }
  100% { transform: scale(1.3); opacity: 0; }
}
@keyframes tf-z-aura {
  0% { filter: none; }
  50% { filter: drop-shadow(0 0 20px #ffcb05) brightness(1.6); transform: scale(1.1); }
  100% { filter: drop-shadow(0 0 40px #fff) brightness(4); transform: scale(.8); opacity: 0; }
}
@keyframes tf-dmax-from { 0% { transform: scale(1); } 40% { transform: scale(.2); opacity: 1; filter: brightness(4) sepia(1) hue-rotate(-50deg) saturate(5); } 50%, 100% { transform: scale(0); opacity: 0; } }
@keyframes tf-dmax-ball { 0% { transform: scale(0); opacity: 0; } 30% { transform: scale(.25); opacity: 1; } 85% { transform: scale(1.3); opacity: 1; } 100% { transform: scale(2); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .tf * { animation-duration: .01s !important; animation-delay: 0s !important; } }
