/* =========================================================
   Cerimônia de sorteio (estilo campeonato)
   ========================================================= */
html.cer-lock { overflow: hidden; }

.cer {
  position: fixed;
  inset: 0;
  z-index: 100;
  color: var(--text);
  background:
    radial-gradient(ellipse 80% 55% at 50% -5%, rgba(40, 80, 160, .55), transparent 70%),
    radial-gradient(ellipse 70% 45% at 50% 110%, rgba(227, 183, 101, .2), transparent 70%),
    #03060e;
  opacity: 0;
  transition: opacity .3s ease;
  overflow: hidden;
  font-family: var(--font-body);
}
.cer.is-in { opacity: 1; }
.cer.is-out { opacity: 0; }

/* Fundo: holofotes e piso de arena */
.cer-bg { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.cer-beam {
  position: absolute;
  top: -25%;
  width: 34vmax;
  height: 150%;
  background: linear-gradient(180deg, rgba(166, 230, 255, .17), transparent 72%);
  filter: blur(22px);
  transform-origin: 50% 0;
  mix-blend-mode: screen;
}
.cer-beam.b1 { left: 4%; animation: cer-sweep 5.5s ease-in-out infinite alternate; }
.cer-beam.b2 { right: 4%; background: linear-gradient(180deg, rgba(251, 230, 176, .16), transparent 72%); animation: cer-sweep 6.5s ease-in-out infinite alternate-reverse; }
.cer-floor {
  position: absolute;
  left: -20%;
  right: -20%;
  bottom: -28%;
  height: 62%;
  background:
    repeating-linear-gradient(90deg, rgba(60, 200, 255, .09) 0 1px, transparent 1px 64px),
    repeating-linear-gradient(0deg, rgba(60, 200, 255, .09) 0 1px, transparent 1px 64px);
  transform: perspective(520px) rotateX(64deg);
  -webkit-mask-image: linear-gradient(transparent, #000 65%);
  mask-image: linear-gradient(transparent, #000 65%);
  animation: cer-floor 3.5s linear infinite;
}
.cer-fx { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 5; }

.cer-scroll { position: absolute; inset: 0; z-index: 2; overflow-y: auto; overscroll-behavior: contain; }
.cer-stage {
  min-height: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: max(64px, calc(env(safe-area-inset-top) + 56px)) 16px max(24px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 22px;
  transition: opacity .3s, filter .3s;
}
.cer.is-counting .cer-stage { opacity: .3; filter: blur(3px); }
.cer-stage.is-shake { animation: cer-shake .42s cubic-bezier(.36, .07, .19, .97); }

/* Cabeçalho */
.cer-head { text-align: center; }
.cer-eyebrow {
  display: inline-block;
  padding: 5px 13px;
  border-radius: 999px;
  border: 1px solid rgba(60, 200, 255, .35);
  background: rgba(60, 200, 255, .08);
  color: var(--blue-hi);
  font: 700 .72rem var(--font-display);
  letter-spacing: .3em;
  text-transform: uppercase;
}
.cer-title {
  margin-top: 12px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.9rem, 5.6vw, 3.5rem);
  line-height: 1.02;
  letter-spacing: .02em;
  text-transform: uppercase;
  background: linear-gradient(100deg, var(--gold-lo) 0%, var(--gold-hi) 32%, #fff 46%, var(--gold-hi) 60%, var(--gold) 100%);
  background-size: 260% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 4px 26px rgba(227, 183, 101, .35));
  animation: cer-title-in .7s cubic-bezier(.2, .9, .3, 1.2) both, cer-shine 3.2s linear infinite .7s;
}
.cer-title.is-stamp { animation: cer-stamp .6s cubic-bezier(.3, 1.6, .5, 1) both, cer-shine 2.4s linear infinite .6s; }
.cer-sub { margin-top: 8px; color: var(--text-2); font-weight: 500; }

/* Contagem regressiva */
.cer-count {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: grid;
  place-items: center;
  pointer-events: none;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(6rem, 24vw, 14rem);
  line-height: 1;
  color: var(--gold-hi);
  text-shadow: 0 0 40px rgba(227, 183, 101, .75), 0 0 130px rgba(60, 200, 255, .45);
}
.cer-count.is-go { font-size: clamp(3rem, 13vw, 7.5rem); color: #fff; text-transform: uppercase; }
.cer-count span { animation: cer-count .44s cubic-bezier(.2, .9, .3, 1) both; }

/* Botões do canto */
.cer-tools { position: absolute; top: max(12px, env(safe-area-inset-top)); right: 12px; z-index: 7; display: flex; gap: 8px; }
.cer-tool {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 40px;
  padding: 0 15px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: rgba(12, 21, 40, .82);
  color: var(--text-2);
  font: 600 .9rem var(--font-body);
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition: color .15s, border-color .15s;
}
.cer-tool:hover { color: var(--text); border-color: var(--line-3); }
.cer-tool:focus-visible, .cer-continue:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
.cer-tool svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.cer-sound { width: 40px; padding: 0; justify-content: center; }
.cer.is-ended .cer-skip { display: none; }
.cer-live { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Rodapé */
.cer-foot { display: flex; justify-content: center; margin-top: auto; padding-top: 6px; visibility: hidden; }
.cer.is-ended .cer-foot { visibility: visible; animation: pop .4s ease-out both .25s; }
.cer-continue {
  position: relative;
  overflow: hidden;
  min-height: 52px;
  padding: 0 34px;
  border: 0;
  border-radius: 14px;
  cursor: pointer;
  color: #1a1205;
  background: linear-gradient(180deg, var(--gold-hi), var(--gold));
  font: 800 1rem var(--font-display);
  letter-spacing: .08em;
  text-transform: uppercase;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .25) inset, 0 14px 34px -10px rgba(227, 183, 101, .65);
}
.cer-continue::after { content: ''; position: absolute; left: 0; bottom: 0; width: 100%; height: 3px; background: rgba(26, 18, 5, .45); transform: scaleX(0); transform-origin: left; }
.cer.is-auto .cer-continue::after { animation: cer-bar var(--auto, 8s) linear forwards; }

/* ---------- Times: pote e quadro ---------- */
.cer-teams .cer-main { display: grid; gap: 18px; align-items: start; }
@media (min-width: 980px) { .cer-teams .cer-main { grid-template-columns: 290px 1fr; gap: 26px; } }

.cer-drum-wrap { position: sticky; top: 0; z-index: 3; display: grid; place-items: center; padding: 2px 0 10px; }
@media (max-width: 979px) {
  .cer-drum-wrap { margin: 0 -16px; background: linear-gradient(rgba(3, 6, 14, .96) 78%, transparent); }
}
.cer-drum { --tc: var(--gold); position: relative; width: min(280px, 62vw); aspect-ratio: 1; display: grid; place-items: center; }
@media (max-width: 979px) { .cer-drum { width: min(210px, 56vw); } }
.cer-drum-rings { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.cer-drum-rings * { fill: none; transform-origin: 100px 100px; transition: stroke .25s; }
.cer-drum-rings .d1 { stroke: var(--tc); stroke-width: 2.5; stroke-dasharray: 44 16; animation: spin 6s linear infinite; filter: drop-shadow(0 0 8px var(--tc)); }
.cer-drum-rings .d2 { stroke: var(--blue); stroke-opacity: .6; stroke-width: 1.5; stroke-dasharray: 5 9; animation: spin 8s linear infinite reverse; }
.cer-drum-rings .d3 { fill: rgba(9, 16, 32, .96); stroke: color-mix(in srgb, var(--tc) 55%, transparent); stroke-width: 1.5; }
.cer-drum.is-spinning .d1 { animation-duration: .8s; }
.cer-drum.is-spinning .d2 { animation-duration: 1.1s; }
.cer-drum.is-landed { animation: cer-drum-hit .45s cubic-bezier(.3, 1.6, .5, 1); }
.cer-drum.is-landed::after { content: ''; position: absolute; inset: 19%; border-radius: 50%; border: 3px solid var(--tc); pointer-events: none; animation: cer-ring-out .65s ease-out forwards; }
.cer-drum-core { position: relative; width: 58%; display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; }
.cer-drum-pot { font: 700 .64rem var(--font-display); letter-spacing: .18em; text-transform: uppercase; color: var(--muted); }
.cer-drum-name {
  min-height: 2.3em;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.05rem, 3.4vw, 1.5rem);
  line-height: 1.1;
  color: var(--gold-hi);
  overflow-wrap: anywhere;
  transition: color .2s, text-shadow .2s;
}
.cer-drum.is-landed .cer-drum-name { color: #fff; text-shadow: 0 0 18px var(--tc); }
.cer-drum-name.flip { animation: flip .07s ease-out; }
.cer-drum-name svg { width: 58px; height: 58px; color: var(--gold-hi); filter: drop-shadow(0 0 14px rgba(227, 183, 101, .75)); animation: cer-stamp .6s cubic-bezier(.3, 1.6, .5, 1) both; }
.cer-drum-dest { min-height: 1.2em; font: 700 .78rem var(--font-display); letter-spacing: .06em; text-transform: uppercase; color: var(--tc); }
.cer-drum.is-final .d1 { animation-duration: 3s; }

.cer-board { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)); gap: 12px; }
@media (max-width: 520px) { .cer-board { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; } }
.cer-team {
  --tc: var(--gold);
  position: relative;
  min-width: 0;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid color-mix(in srgb, var(--tc) 40%, transparent);
  background: linear-gradient(180deg, color-mix(in srgb, var(--tc) 14%, rgba(12, 21, 40, .94)), rgba(10, 17, 33, .94));
  box-shadow: 0 18px 40px -22px #000;
  animation: cer-team-in .5s cubic-bezier(.2, .9, .3, 1.2) both;
  animation-delay: calc(.2s + var(--i, 0) * 70ms);
}
.cer-team.is-pulse { animation: cer-pulse .6s ease-out; }
.cer-team-head { display: flex; align-items: center; gap: 10px; min-width: 0; margin-bottom: 10px; }
.cer-crest {
  flex: none;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  background: var(--tc);
  color: #0a1020;
  font: 800 1rem var(--font-display);
}
.cer-team-name { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font: 700 1rem var(--font-display); }
.cer-slots { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; }
.cer-slot {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  height: 32px;
  padding: 0 10px;
  border-radius: 9px;
  border: 1px dashed rgba(140, 170, 220, .2);
  background: rgba(5, 10, 22, .5);
  color: var(--faint);
  font-size: .9rem;
}
.cer-slot-n { flex: none; width: 18px; display: grid; place-items: center; font: 700 .75rem var(--font-display); }
.cer-slot-n svg { width: 15px; height: 15px; }
.cer-slot-name { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-weight: 600; }
.cer-slot.is-filled { border-style: solid; border-color: color-mix(in srgb, var(--tc) 45%, transparent); background: color-mix(in srgb, var(--tc) 13%, rgba(8, 14, 28, .92)); color: var(--text); }
.cer-slot.is-filled .cer-slot-n { color: var(--tc); }
.cer-slot.is-cap .cer-slot-n, .cer-slot.is-cap .cer-slot-name { color: var(--gold-hi); }
.cer-slot.is-hit { animation: cer-slot-hit .5s cubic-bezier(.2, .9, .3, 1.3); }
.cer-chip {
  position: fixed;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  border-radius: 9px;
  background: var(--tc);
  color: #0a1020;
  font: 800 .92rem var(--font-display);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 0 28px var(--tc), 0 10px 30px -8px #000;
  pointer-events: none;
}

/* ---------- Reel (times girando) ---------- */
.cer-reel {
  --tc: var(--line-3);
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  min-height: 76px;
  padding: 12px 16px;
  border-radius: 16px;
  border: 1px solid color-mix(in srgb, var(--tc) 55%, transparent);
  background: rgba(8, 14, 28, .92);
  overflow: hidden;
  transition: box-shadow .25s, border-color .25s;
}
.cer-reel::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, .12) 50%, transparent 70%);
  background-size: 250% 100%;
  opacity: 0;
  pointer-events: none;
}
.cer-reel.is-spinning::before { opacity: 1; animation: cer-shine .7s linear infinite; }
.cer-reel-crest {
  flex: none;
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  background: var(--tc);
  color: #0a1020;
  font: 800 1.35rem var(--font-display);
}
.cer-reel-name { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font: 800 clamp(1.1rem, 3vw, 1.55rem) var(--font-display); color: var(--text); }
.cer-reel .cer-roll { animation: cer-reel-roll .09s ease-out; }
.cer-reel.is-locked { box-shadow: 0 0 0 1px var(--tc), 0 0 44px -8px var(--tc); }
.cer-reel.is-hit { animation: cer-reel-hit .5s cubic-bezier(.3, 1.6, .5, 1); }

/* Ordem de escolha */
.cer-order-list { list-style: none; margin: 0 auto; padding: 0; width: min(580px, 100%); display: grid; gap: 10px; }
.cer-order-list li { display: flex; align-items: center; gap: 12px; animation: cer-team-in .45s cubic-bezier(.2, .9, .3, 1.2) both; animation-delay: calc(.2s + var(--i, 0) * 60ms); }
.cer-order-pos { flex: none; width: 52px; text-align: right; font: 800 1.35rem var(--font-display); color: var(--gold-hi); }
.cer-order-list .cer-reel { flex: 1; }

/* ---------- Primeira partida ---------- */
.cer-vs { display: grid; grid-template-columns: 1fr auto 1fr; align-items: start; gap: 20px; width: min(980px, 100%); margin: 0 auto; }
@media (max-width: 720px) { .cer-vs { grid-template-columns: 1fr; gap: 12px; } }
.cer-side { --side: var(--side-blue); display: flex; flex-direction: column; gap: 10px; min-width: 0; animation: slide-l .6s cubic-bezier(.2, .9, .3, 1.15) both .2s; }
.cer-side.is-red { --side: var(--side-red); animation-name: slide-r; }
.cer-side-label { text-align: center; font: 700 .8rem var(--font-display); letter-spacing: .26em; text-transform: uppercase; color: var(--side); }
.cer-side .cer-reel { background: linear-gradient(90deg, color-mix(in srgb, var(--side) 24%, rgba(8, 14, 28, .94)), rgba(8, 14, 28, .94)); }
.cer-side.is-red .cer-reel { background: linear-gradient(270deg, color-mix(in srgb, var(--side) 24%, rgba(8, 14, 28, .94)), rgba(8, 14, 28, .94)); }
.cer-roster { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; }
.cer-roster li {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 7px 12px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: rgba(8, 14, 28, .78);
  font-weight: 600;
  animation: pop .35s ease-out both;
  animation-delay: calc(var(--d, 0) * 70ms);
}
.cer-roster li.is-cap { color: var(--gold-hi); }
.cer-roster svg { flex: none; width: 15px; height: 15px; }
.cer-vs-mid { position: relative; align-self: center; width: 124px; height: 124px; margin: 0 auto; display: grid; place-items: center; opacity: .22; transform: scale(.8); transition: opacity .3s, transform .3s; }
.cer-vs-mid svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.cer-vs-mid .h1 { fill: rgba(9, 16, 32, .96); stroke: var(--gold); stroke-width: 2.5; }
.cer-vs-mid .h2 { fill: none; stroke: var(--blue); stroke-opacity: .5; stroke-width: 1.5; }
.cer-vs-mid .bl { stroke: var(--gold-hi); stroke-width: 5; stroke-linecap: round; opacity: .45; }
.cer-vs-text { position: relative; font: 800 2.3rem var(--font-display); color: #fff; text-shadow: 0 0 18px var(--side-blue), 0 0 30px var(--side-red); }
.cer-vs-mid.is-clash { opacity: 1; transform: none; animation: cer-stamp .55s cubic-bezier(.3, 1.6, .5, 1) both; }
.cer-vs-mid.is-clash::after { content: ''; position: absolute; inset: -12%; border-radius: 50%; border: 3px solid var(--gold-hi); pointer-events: none; animation: cer-ring-out .85s ease-out forwards; }
@media (max-width: 720px) { .cer-vs-mid { width: 96px; height: 96px; } .cer-vs-text { font-size: 1.8rem; } }
.cer-flash { position: absolute; inset: 0; z-index: 4; pointer-events: none; background: radial-gradient(circle at 50% 45%, rgba(255, 255, 255, .6), transparent 62%); animation: cer-flash .55s ease-out forwards; }
.cer-queue { width: min(620px, 100%); margin: 4px auto 0; display: grid; gap: 10px; text-align: center; }
.cer-queue[hidden] { display: none; }
.cer-queue-label { font: 700 .74rem var(--font-display); letter-spacing: .24em; text-transform: uppercase; color: var(--muted); }
.cer-queue ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.cer-queue li {
  --tc: var(--gold);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 14px 5px 6px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--tc) 45%, transparent);
  background: rgba(8, 14, 28, .88);
  font-weight: 600;
  animation: pop .38s cubic-bezier(.2, .9, .3, 1.3) both;
}
.cer-queue li .cer-crest { width: 26px; height: 26px; font-size: .8rem; }
.cer-queue-pos { padding-left: 6px; font: 800 .85rem var(--font-display); color: var(--gold-hi); }

/* ---------- Animações ---------- */
@keyframes cer-sweep { from { transform: rotate(-24deg); } to { transform: rotate(24deg); } }
@keyframes cer-floor { to { background-position: 0 64px, 0 64px; } }
@keyframes cer-shake {
  10%, 90% { transform: translate(-1px, 1px); }
  20%, 80% { transform: translate(3px, -2px); }
  30%, 50%, 70% { transform: translate(-5px, 2px); }
  40%, 60% { transform: translate(5px, -1px); }
}
@keyframes cer-title-in { from { opacity: 0; transform: scale(1.35); letter-spacing: .3em; } to { opacity: 1; transform: none; } }
@keyframes cer-stamp { from { opacity: 0; transform: scale(2.2) rotate(-4deg); } 60% { opacity: 1; transform: scale(.94); } to { opacity: 1; transform: none; } }
@keyframes cer-shine { from { background-position: 120% 0; } to { background-position: -130% 0; } }
@keyframes cer-count { from { opacity: 0; transform: scale(2.4); } 35% { opacity: 1; } 70% { opacity: 1; transform: scale(.95); } to { opacity: 0; transform: scale(.7); } }
@keyframes cer-bar { from { transform: scaleX(1); } to { transform: scaleX(0); } }
@keyframes cer-drum-hit { 0% { transform: scale(.92); } 50% { transform: scale(1.06); } to { transform: none; } }
@keyframes cer-ring-out { from { opacity: 1; transform: scale(.8); } to { opacity: 0; transform: scale(1.8); } }
@keyframes cer-team-in { from { opacity: 0; transform: translateY(24px) scale(.94); } to { opacity: 1; transform: none; } }
@keyframes cer-pulse { 0% { box-shadow: 0 0 0 2px var(--tc), 0 0 50px -6px var(--tc); } to { box-shadow: 0 18px 40px -22px #000; } }
@keyframes cer-slot-hit { 0% { transform: scale(1.12); background: color-mix(in srgb, var(--tc) 60%, transparent); box-shadow: 0 0 22px var(--tc); } to { transform: none; } }
@keyframes cer-reel-roll { from { opacity: .3; transform: translateY(-45%); filter: blur(2px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes cer-reel-hit { 0% { transform: scale(1.1); } to { transform: none; } }
@keyframes cer-flash { from { opacity: 1; } to { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .cer-beam, .cer-floor { animation: none; }
}
