/* Outside the arena's clipping/stacking context, so the entire viewport celebrates. */
#celebration {
  position: fixed;
  inset: 0;
  z-index: 30;
  overflow: hidden;
  pointer-events: none;
  contain: strict;
}
#victory-confetti { position: absolute; inset: 0; }
.victory-dust { display: block; width: 100%; height: 100%; }
.clash-impact { position: absolute; left: 50%; top: 50%; width: 360px; height: 240px; transform: translate(-50%,-50%); pointer-events: none; }
.clash-wave { position: absolute; inset: 10% 0; border: 1px solid #e9ca876e; border-radius: 50%; opacity: 0; box-shadow: 0 0 18px #d9b66e13, inset 0 0 12px #d9b66e12; }
.clash-wave:nth-child(2) { inset: 18% 8%; border-color: #f1ddb240; }
.clash-core { position: absolute; left: -5%; width: 110%; top: 46%; height: 8%; background: radial-gradient(ellipse, #ffe7a4ad, #d9b66e33 25%, transparent 70%); opacity: 0; }
.clash-streak { position: absolute; left: 50%; top: 50%; width: 42%; height: 1px; transform-origin: left center; opacity: 0; background: linear-gradient(90deg, transparent, #ecd19c9c 20%, transparent); }
.drop-target::before { content: ''; position: absolute; inset: -16px; border-radius: 28px; border: 1px solid transparent; background: transparent; opacity: 0; pointer-events: none; transition: opacity 150ms, background 150ms, border-color 150ms; }
.drop-target.is-over::before { opacity: 1; border-color: #d9b66e35; background: radial-gradient(ellipse, #d9b66e19, transparent 75%); }
.drop-target.is-over { box-shadow: 0 0 26px #d9b66e24; transform: scale(1.045); }
.drag-ghost[data-result=correct] { background: #b9d8ad; color: #213321; }
.drag-ghost[data-result=wrong] { background: #deb1a0; color: #382621; }
@media(max-width:600px) { .clash-impact { width: 260px; height: 180px; } .drop-target::before { inset: -22px; } }
#celebration .victory-halo {
  left: -10%; top: -20%; width: 120%; height: 140%;
  opacity: .12;
  background: radial-gradient(ellipse at 50% 57%, #d9b66e0e, transparent 65%);
}
#celebration .victory-rays { opacity: 0; }
.showdown-portrait .fracture { inset: 0; border-radius: inherit; }
.fracture svg { display: block; width: 100%; height: 100%; overflow: visible; }
.fracture path {
  fill: none;
  stroke-linejoin: bevel;
  stroke-linecap: butt;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
}
.portrait-cracks .portrait-crack-shadow { stroke: #050907; opacity: .32; }
.portrait-cracks .portrait-crack-depth { stroke: #0a100d; opacity: .96; }
.portrait-cracks .portrait-crack-edge { stroke: #dedbc6; opacity: .7; }
.showdown-player.is-cracked .showdown-portrait > img { opacity: 1; filter: grayscale(1) brightness(.64); }
.showdown-player.is-cracked .showdown-portrait { border-color: #7a817457; box-shadow: none; }
.glass-layer { perspective: 550px; }
.glass-facet { position: absolute; inset: 0; background-position: center; background-size: cover; border-radius: 12px; filter: grayscale(.7) brightness(.88); backface-visibility: hidden; will-change: transform, opacity; }
.glass-facet::after { content: ''; position: absolute; inset: 0; background: linear-gradient(135deg, #edede51a, transparent 55%, #eef3eb0e); }
.original-fractures path { stroke: #e6ead5; stroke-width: .22; }
.compare-effects { display: inline-flex; align-items: center; gap: 8px; border: 0; border-bottom: 1px solid #d9b66e55; padding: 6px 0; background: none; color: var(--gold); font: inherit; cursor: pointer; }
.compare-effects:hover { color: var(--gold-bright); border-color: currentColor; }
.compare-effects:focus-visible, .effect-options button:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; }
.effect-review { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 22px; padding: 24px; text-align: center; }
.effect-heading h1 { font: 400 clamp(29px,4vw,42px)/1.12 Georgia,serif; letter-spacing: -.025em; margin: 10px 0; }
.effect-heading > p:last-child { margin: 0; font-size: 12px; color: var(--muted); }
.effect-options { display: flex; width: min(420px,100%); padding: 4px; gap: 4px; background: #111b15a8; border: 1px solid #d9b66e36; border-radius: 13px; }
.effect-options button { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 5px; min-height: 62px; border-radius: 9px; border: 1px solid transparent; background: transparent; color: var(--text); cursor: pointer; font: inherit; transition: background 120ms, border-color 120ms; }
.effect-options button strong { font-size: 14px; }
.effect-options button span { font-size: 10px; color: var(--muted); }
.effect-options button[aria-pressed=true] { background: #d9b66e18; border-color: #d9b66e8a; color: var(--gold-bright); box-shadow: inset 0 1px 0 #e9cf8f13; }
.effect-options button:hover { background: #d9b66e10; }
.effect-options button[aria-pressed=true] span { color: #d6c6a7; }
.effect-portrait { width: 100%; padding: 3px 0; }
.effect-portrait .duel-status { min-height: 15px; }
.effect-actions { display: flex; gap: 12px; }
.effect-note { margin: -10px 0 0; color: var(--muted); font-size: 10px; }
@media(max-width:600px) {
  .glass-facet { border-radius: 9px; }
  .effect-review { gap: 20px; padding: 18px 14px; }
  .effect-heading > p:last-child { font-size: 11px; max-width: 250px; margin: auto; line-height: 1.5; }
  .effect-options button span { font-size: 9px; }
  .effect-actions { gap: 8px; }
  .effect-actions button { min-height: 44px; padding: 10px 16px; font-size: 12px; }
  .effect-note { max-width: 230px; line-height: 1.5; }
}
@media(max-height:600px) and (min-width:601px) {
  .glass-facet { border-radius: 7px; }
  .effect-review { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: auto auto auto auto; align-content: center; gap: 9px 24px; padding: 12px 32px; }
  .effect-heading { grid-column: 1; grid-row: 1; }
  .effect-heading h1 { font-size: 27px; margin: 6px 0; }
  .effect-heading .eyebrow { font-size: 8px; }
  .effect-heading > p:last-child { font-size: 10px; }
  .effect-options { grid-column: 1; grid-row: 2 / 4; }
  .effect-options button { min-height: 55px; }
  .effect-options button span { font-size: 8px; }
  .effect-portrait { grid-column: 2; grid-row: 1 / 3; }
  .effect-actions { grid-column: 2; grid-row: 3; justify-content: center; gap: 8px; }
  .effect-actions button { min-height: 36px; padding: 7px 12px; font-size: 11px; }
  .effect-note { grid-column: 1 / 3; grid-row: 4; margin: 0; font-size: 9px; }
}
@media(prefers-reduced-motion:reduce) {
  #victory-confetti, .victory-rays, .glass-layer { display: none; }
}

.finish .flawless { overflow: visible; isolation: isolate; }
.flawless > span:not(.flawless-fire) { position: relative; z-index: 1; }
.flawless-fire { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.flawless-fire-glow { position: absolute; inset: -18px 3%; background: radial-gradient(ellipse,#ffb94b80,transparent 70%); border-radius: 50%; }
.flawless-fire-tongue { position: absolute; bottom: -7px; width: 32px; color: #ff9b36; transform-origin: 50% 100%; opacity: 0; }
.flawless-fire-tongue:nth-child(3n) { color: #ffd36e; }
.flawless-fire-tongue svg { display: block; width: 100%; height: 100%; }
.flawless-fire-ember { position: absolute; bottom: 6px; width: 3px; height: 5px; background: #ffe09a; border-radius: 50%; opacity: 0; }
@media(max-height:600px) { .flawless-fire-tongue { max-height: 42px; } }
