.ild-finish-card {
  --finish-ink: #caf9eb;
  --finish-highlight: #8eecd1;
  --finish-stroke: #64ceb879;
  --finish-top: #164c50;
  --finish-bottom: #092a35;
  --finish-glow: #65e4bf32;
  flex: 1 1 0;
  display: grid;
  place-items: center;
  position: relative;
  isolation: isolate;
  box-sizing: border-box;
  min-inline-size: 0;
  min-block-size: 0;
  inline-size: 100%;
  overflow: hidden;
  padding: clamp(4px, 1.65vmin, 24px);
  background: radial-gradient(ellipse at 50% 28%, var(--finish-glow), transparent 72%),
    linear-gradient(150deg, var(--finish-top), var(--finish-bottom) 85%);
  color: var(--finish-ink);
  text-align: center;
  container-type: size;
  animation: ild-finish-surface 420ms cubic-bezier(.22,.61,.36,1) both;
}
.ild-finish-card[hidden] { display: none !important; }
.ild-finish-card[data-champion="true"] {
  --finish-ink: #fff3cf;
  --finish-highlight: #ffdc84;
  --finish-stroke: #e9bd6a85;
  --finish-top: #37314d;
  --finish-bottom: #151a31;
  --finish-glow: #f2bc6252;
}
.ild-finish-content {
  box-sizing: border-box;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: min(2.1cqh, 10px);
  inline-size: min(100%, 370px);
  max-block-size: 100%;
  padding: min(4.8cqh, 5cqw, 25px) min(5cqw, 23px);
  border: 1px solid var(--finish-stroke);
  border-radius: min(8cqw, 25px);
  background: linear-gradient(165deg, #ffffff13, #0b132547 87%);
  box-shadow: 0 9px 26px #0004, inset 0 1px 0 #ffffff24;
  animation: ild-finish-enter 420ms cubic-bezier(.22,.61,.36,1) both;
}
.ild-finish-emblem {
  display: grid;
  place-items: center;
  flex: none;
  inline-size: clamp(26px, min(34cqw, 30cqh), 112px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 45% 35%, var(--finish-glow), #0002 72%);
  box-shadow: 0 0 25px var(--finish-glow), inset 0 0 0 1px var(--finish-stroke);
  color: var(--finish-highlight);
}
.ild-finish-emblem svg { width: 74%; height: 74%; filter: drop-shadow(0 3px 3px #03192866); }
.ild-finish-title {
  position: relative;
  display: block;
  color: var(--finish-ink);
  font-size: clamp(12px, min(10.15cqw, 13.5cqh), 48px);
  font-weight: 950;
  letter-spacing: -.045em;
  line-height: 1.1;
  white-space: nowrap;
}
.ild-finish-detail {
  color: var(--finish-ink);
  font-size: clamp(10px, min(5.4cqw, 7.8cqh), 20px);
  font-weight: 750;
  line-height: 1.16;
  overflow-wrap: anywhere;
}
.ild-finish-stat, .ild-finish-place {
  position: relative;
  border: 1px solid var(--finish-stroke);
  border-radius: 999px;
  padding: min(1.4cqh, 6px) min(4cqw, 15px);
  color: var(--finish-highlight);
  background: #11162b72;
  font-size: clamp(9px, min(5.6cqw, 8cqh), 20px);
  font-weight: 850;
  line-height: 1;
  white-space: nowrap;
}
.ild-finish-stat small { font-size: .68em; letter-spacing: .045em; }
.ild-finish-place { font-size: clamp(9px, min(4.5cqw, 6.5cqh), 14px); }
.ild-finish-sparks { position: absolute; inset: 0; overflow: hidden; border-radius: inherit; pointer-events: none; }
.ild-finish-sparks i {
  position: absolute;
  inset-inline-start: var(--x);
  inset-block-start: var(--y);
  inline-size: clamp(4px, 2.8cqw, 10px);
  aspect-ratio: 1;
  background: var(--finish-highlight);
  clip-path: polygon(50% 0,63% 37%,100% 50%,63% 63%,50% 100%,37% 63%,0 50%,37% 37%);
  opacity: .55;
  animation: ild-finish-spark 680ms ease-out both;
  animation-delay: var(--spark-delay, 0ms);
}
.ild-finish-sparks i:nth-child(1) { --x: 13%; --y: 16%; }
.ild-finish-sparks i:nth-child(2) { --x: 78%; --y: 21%; --spark-delay: 90ms; }
.ild-finish-sparks i:nth-child(3) { --x: 21%; --y: 35%; --spark-delay: 40ms; }
.ild-finish-sparks i:nth-child(4) { --x: 85%; --y: 38%; --spark-delay: 100ms; }
.ild-finish-sparks i:nth-child(5) { --x: 31%; --y: 11%; --spark-delay: 60ms; }
.ild-finish-sparks i:nth-child(6) { --x: 66%; --y: 10%; }
.ild-finish-sparks i:nth-child(7) { --x: 10%; --y: 78%; --spark-delay: 80ms; }
.ild-finish-sparks i:nth-child(8) { --x: 87%; --y: 82%; --spark-delay: 70ms; }
.ild-finish-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; width: min(100%, 880px); }
.ild-finish-summary .ild-finish-card { block-size: clamp(104px, 25vh, 215px); border-radius: 14px; }
.ild-finish-summary .ild-finish-content { box-shadow: none; background: transparent; border: 0; }
.ild-finish-summary .ild-finish-emblem { inline-size: clamp(21px, min(24cqw, 25cqh), 53px); }
.ild-finish-summary .ild-finish-title { font-size: clamp(12px, min(11cqw, 14cqh), 35px); }
@media (min-width: 780px) and (min-height: 420px) {
  .ild-finish-summary { grid-template-columns: repeat(var(--finish-columns, 2), minmax(0, 1fr)); }
  .ild-finish-summary .ild-finish-card { block-size: clamp(140px, 35vh, 250px); }
}
@media (max-height: 430px) {
  .ild-finish-summary { grid-template-columns: repeat(var(--finish-columns, 2), minmax(0, 1fr)); }
}
@keyframes ild-finish-enter {
  from { opacity: .25; transform: translateY(3px); }
  to { opacity: 1; transform: none; }
}
@keyframes ild-finish-surface {
  from { opacity: .08; }
  to { opacity: 1; }
}
@keyframes ild-finish-spark {
  from { opacity: 0; }
  to { opacity: .55; }
}

.ild-finish-result {
  box-sizing: border-box;
  height: 100vh;
  height: 100dvh;
  padding: clamp(6px, 2vmin, 24px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(8px, 2.4vmin, 21px);
  overflow: auto;
  background: radial-gradient(ellipse at top, #243156, #0c1224 74%);
  color: #faf8f3;
}
.ild-finish-result h2 { margin: 0; font-size: clamp(1.2rem, min(5vw, 8vh), 3rem); line-height: 1.05; font-weight: 950; }
.ild-finish-result { animation: ild-finish-surface 300ms ease-out both; }
.ild-finish-summary[data-count="3"] { --finish-columns: 3; }
.ild-finish-summary[data-count="4"] { --finish-columns: 4; }
.ild-finish-summary-slot { min-width: 0; }
.ild-finish-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.ild-finish-actions button {
  border: 1px solid #b8d9ff80;
  border-radius: 999px;
  padding: .55em 1.15em;
  background: #21487d;
  color: #f5faff;
  font-size: clamp(.82rem, 2.5vmin, 1.25rem);
  font-weight: 850;
  cursor: pointer;
}
.ild-finish-actions button:hover { background: #2c5c9b; }
.ild-finish-actions button:focus-visible { outline: 3px solid #f9d27a; outline-offset: 3px; }

.ild-answer-card {
  --finish-ink: #effff0;
  --finish-highlight: #8ff3a0;
  --finish-stroke: #8bf7a97a;
  --finish-top: #185b38;
  --finish-bottom: #07291c;
  --finish-glow: #63efa645;
  --answer-duration: 1500ms;
  animation: ild-answer-surface var(--answer-duration) linear both;
}
.ild-answer-card[data-correct="false"] {
  --finish-ink: #fff0ef;
  --finish-highlight: #ffadb2;
  --finish-stroke: #ff9b9e7a;
  --finish-top: #802b34;
  --finish-bottom: #371319;
  --finish-glow: #ff849348;
}
.ild-answer-card .ild-answer-content {
  inline-size: min(100%, 360px);
  gap: min(2cqh, 12px);
  animation: ild-answer-content 280ms cubic-bezier(.22,.61,.36,1) both;
}
@keyframes ild-answer-surface {
  0% { opacity: 0; animation-timing-function: cubic-bezier(.22,.61,.36,1); }
  20% { opacity: 1; }
  82% { opacity: 1; animation-timing-function: cubic-bezier(.55,0,.78,.36); }
  100% { opacity: 0; }
}
@keyframes ild-answer-content {
  from { transform: translateY(3px); }
  to { transform: none; }
}
.ild-answer-card .ild-finish-emblem { inline-size: clamp(24px, min(29cqw, 27cqh), 95px); }
.ild-answer-card .ild-finish-title {
  font-size: clamp(13px, min(8.8cqw, 14cqh), 38px);
  text-align: center;
  white-space: normal;
  text-wrap: balance;
}
.ild-answer-card .ild-finish-detail { max-inline-size: 32ch; }
.ild-answer-track {
  inline-size: min(45%, 122px);
  block-size: 3px;
  overflow: hidden;
  border-radius: 10px;
  background: #0005;
}
.ild-answer-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--finish-highlight);
  transform-origin: left;
  animation: ild-answer-time var(--answer-duration) linear both;
}
@keyframes ild-answer-time { to { transform: scaleX(0); } }
.ild-answer-card[data-compact="true"] {
  container-type: inline-size;
  border-radius: 12px;
  inline-size: min(100%, 52ch);
  padding: 4px;
}
.ild-answer-card[data-compact="true"] .ild-answer-content {
  inline-size: 100%;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 1px 9px;
  padding: 3px 7px;
  box-shadow: none;
  border: 0;
  background: transparent;
  text-align: left;
}
.ild-answer-card[data-compact="true"] .ild-finish-emblem {
  grid-row: 1 / span 3;
  inline-size: clamp(27px, 11cqw, 38px);
}
.ild-answer-card[data-compact="true"] .ild-finish-title {
  font-size: clamp(12px, 4.9cqw, 17px);
  text-align: left;
}
.ild-answer-card[data-compact="true"] .ild-finish-detail {
  font-size: clamp(10px, 3.8cqw, 14px);
  max-inline-size: none;
}
.ild-answer-card[data-compact="true"] .ild-finish-stat {
  justify-self: start;
  font-size: 11px;
  padding: 3px 7px;
}
.ild-round-stage {
  position: relative;
  isolation: isolate;
  overflow: clip;
  display: grid;
  flex: 1 1 0;
  min-width: 0;
  min-height: 0;
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
}
.ild-round-stage > * { grid-area: 1 / 1; }
.ild-round-question {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  animation: ild-question-enter 240ms cubic-bezier(.22,.61,.36,1) both;
}
.ild-round-stage[data-answering] > .ild-round-question {
  animation: ild-question-behind-answer 1500ms linear both;
  pointer-events: none;
}
.ild-round-stage[data-waiting] > .ild-round-question {
  animation: none;
  pointer-events: none;
}
.ild-round-stage > .ild-answer-card { z-index: 1; }
@keyframes ild-question-enter {
  from { opacity: .08; }
  to { opacity: 1; }
}
@keyframes ild-question-behind-answer {
  0% { opacity: 1; animation-timing-function: ease-out; }
  18%, 100% { opacity: .07; }
}
@media (prefers-reduced-motion: reduce) {
  .ild-finish-card, .ild-finish-result, .ild-finish-card .ild-finish-content, .ild-finish-sparks i,
  .ild-answer-track i, .ild-round-stage > .ild-round-question { animation: none !important; }
  .ild-round-stage[data-answering] > .ild-round-question { opacity: .07; }
}
@media (prefers-reduced-motion: no-preference) {
  .ild-result-motion { animation: ild-finish-surface 300ms ease-out both; }
}
