@font-face {
  font-family: Prompt;
  src: url("/art/prompt-thai.woff2") format("woff2");
  font-display: swap;
}
:root {
  color-scheme: dark;
  --ink: #f3ebd8;
  --dim: #abae9f;
  --line: #38403a;
  --gold: #e6bf78;
  --mint: #a7ddc6;
  font-family: Prompt, system-ui, sans-serif;
  color: var(--ink);
  background: #0b1111;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  min-height: 100svh;
  background:
    radial-gradient(ellipse at 14% 32%, #31281c44, transparent 40%),
    radial-gradient(ellipse at 86% 25%, #2d463b33, transparent 45%), #0c1212;
}
button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}
button:focus-visible {
  outline: 3px solid #f4e6bb;
  outline-offset: 3px;
}
button:disabled {
  cursor: default;
}
button[hidden],
[hidden] {
  display: none !important;
}
.nav {
  border-bottom: 1px solid #9c967630;
  background: #101615;
}
.nav-in,
.wrap {
  max-width: 1280px;
  margin: auto;
  padding-inline: clamp(16px, 4.2vw, 64px);
}
.nav-in,
.nav-actions,
.brand,
.how,
.heading,
.mode,
.history header,
.wallet,
.selection,
.play,
.choice {
  display: flex;
  align-items: center;
}
.nav-in {
  height: 68px;
  justify-content: space-between;
}
.brand {
  gap: 13px;
  color: #f3e5c2;
  font:
    600 18px/1 Georgia,
    serif;
  letter-spacing: 0.18em;
}
.brand-mark {
  display: grid;
  place-content: center;
  width: 29px;
  height: 29px;
  border: 1px solid #ab8b58;
  border-radius: 8px 0 8px 0;
  transform: rotate(-8deg);
  color: var(--gold);
  font: normal 22px Georgia;
}
.nav-actions {
  gap: 12px;
}
.quiet,
.how {
  border: 1px solid #4b5046;
  background: #171e1b;
  border-radius: 30px;
  height: 38px;
}
.quiet {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 11px;
  font-size: 12px;
  color: #a2aa9d;
}
.quiet[aria-pressed="true"] {
  color: var(--gold);
  border-color: var(--gold);
}
.how {
  padding: 0 13px;
  gap: 8px;
  font-size: 13px;
}
.how span {
  font: 14px Georgia;
  border: 1px solid #a6a996;
  border-radius: 100%;
  width: 17px;
  height: 17px;
}
.wrap {
  padding-bottom: 48px;
}
.heading {
  justify-content: space-between;
  gap: 12px;
  margin: clamp(20px, 3.2vw, 45px) 0 clamp(16px, 2vw, 28px);
}
h1,
h2,
p {
  margin: 0;
}
h1 {
  font:
    500 clamp(31px, 3.55vw, 54px)/1.36 Georgia,
    "Thonburi",
    Prompt,
    serif;
  letter-spacing: -0.035em;
}
.heading p {
  font-size: clamp(12px, 1.18vw, 16px);
  color: var(--dim);
  margin-top: 5px;
}
.mode {
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
  background: #20322a;
  border: 1px solid #4b6654;
  border-radius: 18px;
  padding: 5px 12px;
  color: #cae1c6;
  font-size: 12px;
}
.mode i {
  background: #a5cc9b;
  width: 6px;
  height: 6px;
  border-radius: 50%;
}
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(245px, 29%);
  gap: 16px;
  align-items: stretch;
}
.arena {
  position: relative;
  display: block;
  width: 100%;
  align-self: start;
  isolation: isolate;
  aspect-ratio: 1.85;
  min-width: 0;
  overflow: hidden;
  border: 1px solid #88734f80;
  border-radius: 14px;
  background: #1b201d;
  box-shadow: 0 15px 38px #0003;
}
.arena picture,
.arena img,
.shade,
#effects,
.duelists {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.arena img {
  object-fit: cover;
}
.shade {
  pointer-events: none;
  background: linear-gradient(0deg, #0b1415ed, #11171777 22%, transparent 53%);
}
#effects {
  pointer-events: none;
}
#effects canvas {
  display: block;
  width: 100%;
  height: 100%;
}
.duelists {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  z-index: 2;
}
.duelist {
  --accent: var(--gold);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  border: 0;
  background: transparent;
  padding: 0 4px clamp(12px, 2.25vw, 31px);
  min-width: 0;
  isolation: isolate;
}
.duelist.lunar {
  --accent: var(--mint);
}
.duelist:after {
  content: "";
  position: absolute;
  inset: auto 16% 0;
  height: 3px;
  background: var(--accent);
  opacity: 0;
  box-shadow: 0 -3px 18px var(--accent);
}
.duelist[aria-pressed="true"]:after {
  opacity: 1;
}
.duelist:focus-visible {
  outline-offset: -4px;
}
.duelist:hover:not(:disabled) .name {
  color: var(--accent);
}
.name {
  font:
    500 clamp(19px, 2vw, 31px)/1.45 Georgia,
    "Thonburi",
    Prompt,
    serif;
  color: #fff5da;
  text-shadow: 0 2px 6px #000;
}
.choice {
  color: #e8e1ce;
  font-size: 11px;
  gap: 5px;
}
.choice i {
  width: 10px;
  height: 10px;
  border: 1px solid #b9b6aa;
  border-radius: 50%;
}
.duelist[aria-pressed="true"] .choice {
  color: var(--accent);
}
.duelist[aria-pressed="true"] .choice i {
  background: var(--accent);
  box-shadow: inset 0 0 0 2px #26312b;
}
.rune {
  color: var(--accent);
  display: grid;
  place-content: center;
  width: clamp(35px, 4.2vw, 64px);
  aspect-ratio: 0.8;
  border: 1px solid var(--accent);
  outline: 1px solid #c8b98366;
  outline-offset: -4px;
  border-radius: 5px;
  background: linear-gradient(125deg, #262b25ee, #0a1212f2);
  box-shadow: 0 3px 12px #0007;
  font: 400 clamp(22px, 3vw, 41px)/1 Georgia;
  margin-bottom: 3px;
}
.rune.flip {
  animation: flip 0.52s cubic-bezier(0.16, 0.78, 0.22, 1);
}
.duelist.victor .rune {
  box-shadow: 0 0 16px color-mix(in srgb, var(--accent) 45%, transparent);
  background: #31392d;
}
.versus {
  position: absolute;
  left: 50%;
  top: 48%;
  width: 48px;
  height: 48px;
  display: grid;
  place-content: center;
  transform: translate(-50%, -50%) rotate(45deg);
  border: 1px solid #ab986485;
  background: #171e1dcd;
  color: #e6d1a0;
}
.versus span {
  transform: rotate(-45deg);
  font: italic 17px Georgia;
}
.slip {
  display: flex;
  flex-direction: column;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(155deg, #232922, #171e1d 60%);
  overflow: hidden;
}
.wallet,
.slip-main {
  padding: clamp(16px, 2vw, 28px);
}
.wallet {
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  border-bottom: 1px solid var(--line);
}
.wallet > span,
.selection > span,
legend {
  font-size: 13px;
  color: #c2c5b6;
}
.wallet strong {
  font:
    500 clamp(26px, 2.5vw, 38px)/1.23 Georgia,
    serif;
}
.wallet i {
  font-style: normal;
  color: var(--gold);
  font-size: 0.7em;
}
.wallet b {
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.wallet small {
  font:
    13px Prompt,
    sans-serif;
  color: #bdb9a6;
}
.slip-main {
  display: flex;
  flex-direction: column;
  gap: 15px;
}
.selection {
  justify-content: space-between;
  gap: 8px;
}
.selection strong {
  color: var(--gold);
  font-size: 15px;
  font-weight: 500;
}
.selection strong.lunar {
  color: var(--mint);
}
fieldset {
  padding: 0;
  margin: 0;
  border: 0;
  min-width: 0;
}
legend {
  margin: 0 0 8px;
}
.stakes {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
}
.stakes button {
  min-height: 40px;
  border: 1px solid #555b4d;
  background: #242b25;
  border-radius: 7px;
  color: #dfdecf;
  font: 600 15px system-ui;
}
.stakes button[aria-pressed="true"] {
  color: #f4d99f;
  border-color: #b49459;
  background: #463b28;
}
.stakes button:disabled {
  opacity: 0.7;
}
.payout,
.feedback {
  font-size: 12px;
  color: var(--dim);
}
.payout b {
  color: #e4cf9f;
}
.play {
  justify-content: center;
  gap: 10px;
  width: 100%;
  border: 1px solid #e7c484;
  border-radius: 7px;
  min-height: 48px;
  background: linear-gradient(135deg, #f3d599, #d9b075);
  color: #2c2013;
  font-weight: 600;
  font-size: 16px;
  box-shadow: 0 3px 0 #806638;
}
.play:hover:enabled {
  filter: brightness(1.07);
}
.play:active:enabled {
  transform: translateY(1px);
}
.play:disabled {
  opacity: 0.65;
}
.feedback {
  min-height: 2.9em;
  text-align: center;
  line-height: 1.5;
}
.feedback.win {
  color: var(--mint);
}
.feedback.loss {
  color: #e8b8a7;
}
.refill {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #273630;
  padding: 8px;
}
.history {
  margin-top: 24px;
  padding: 18px 22px 20px;
  border: 1px solid #343c35;
  border-radius: 12px;
  background: #151c19;
}
.history header {
  justify-content: space-between;
}
.history h2,
dialog h2 {
  font-size: 17px;
  font-weight: 500;
}
.history header span,
.history > p {
  font-size: 12px;
  color: var(--dim);
}
.history > p {
  margin-top: 8px;
}
.history ol {
  list-style: none;
  display: flex;
  gap: 9px;
  padding: 0;
  margin: 10px 0 0;
  overflow-x: auto;
}
.history ol:empty {
  display: none;
}
.history li {
  flex: 0 0 auto;
  border: 1px solid #414a40;
  background: #1a241e;
  border-radius: 7px;
  padding: 7px 10px;
  color: #d9dcca;
  font-size: 12px;
}
.history li strong {
  color: #ead3a7;
}
.history li small {
  display: block;
  color: #b5beaf;
}
dialog {
  color: var(--ink);
  background: #1b2421;
  border: 1px solid #8b7e5e;
  border-radius: 12px;
  padding: 24px;
  width: min(90vw, 410px);
}
dialog::backdrop {
  background: #070d0dc9;
}
dialog ol {
  padding-left: 22px;
  font-size: 14px;
  line-height: 1.75;
}
dialog p {
  font-size: 12px;
  color: var(--dim);
  margin: 14px 0;
}
/* The seal shares the point where the two spells meet. */
.versus {
  top: 46%;
  pointer-events: none;
  transition: opacity 0.16s ease;
}
.arena[data-phase="charge"] .versus,
.arena[data-phase="cast"] .versus {
  opacity: 0;
}
.arena[data-phase="result"] .versus {
  --seal: #f3dfac;
  width: max-content;
  height: auto;
  padding: 0.25em 1.15em;
  transform: translate(-50%, -50%);
  border: 1px solid var(--seal);
  border-radius: 2px 12px;
  outline: 1px solid color-mix(in srgb, var(--seal) 50%, transparent);
  outline-offset: 3px;
  color: var(--seal);
  background: linear-gradient(120deg, #1c2421f0, #201e19f2);
  box-shadow: 0 3px 20px #050b0bd9;
  animation: seal-arrives 0.42s ease-out both;
}
.arena[data-winner="qilin"] .versus {
  --seal: #c0f4e2;
}
.arena[data-phase="result"] .versus span {
  transform: none;
  font:
    500 clamp(13px, 1.35vw, 19px)/1.5 Prompt,
    sans-serif;
}
.rune {
  position: relative;
  transform-style: preserve-3d;
}
.rune::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: inherit;
  background: linear-gradient(
    120deg,
    transparent 23%,
    #fff5d9 50%,
    transparent 77%
  );
  background-size: 280% 100%;
  opacity: 0;
  pointer-events: none;
}
.rune.flip::after {
  animation: gild 0.48s ease-out both;
}
.arena[data-phase="summon"] .duelist[aria-pressed="true"] .rune {
  animation: awaken 0.55s ease-out;
}
.arena[data-phase="charge"] .rune {
  animation: draw-power 0.47s ease-out both;
}
.duelist.victor .rune {
  border-color: #fff5db;
  box-shadow:
    0 0 0 2px var(--accent),
    0 0 22px color-mix(in srgb, var(--accent) 65%, transparent);
}
.spell-fallback,
.spell-fallback i {
  position: absolute;
  pointer-events: none;
}
.spell-fallback {
  inset: 0;
  display: none;
  overflow: hidden;
}
.arena:not(.lit) .spell-fallback {
  display: block;
}
.spell-fallback i {
  opacity: 0;
}
.breath-gold,
.breath-jade {
  left: 28%;
  top: 21%;
  width: 23%;
  height: 26%;
  background: linear-gradient(160deg, #ffbb48, #fff7b8 55%, #ee8731);
  clip-path: polygon(
    0 0,
    30% 26%,
    53% 38%,
    100% 100%,
    55% 63%,
    64% 75%,
    32% 43%
  );
  transform-origin: top left;
}
.breath-jade {
  left: 76%;
  width: 27%;
  scale: -1 1;
  background: linear-gradient(145deg, #60d6bb, #d8fffa 49%, #66d7bf);
}
.shock {
  left: 50%;
  top: 46%;
  width: 25%;
  aspect-ratio: 1;
  border: 2px solid #ffe3a8;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    #fffcdb 0,
    #f8db9966 9%,
    #ffd1970d 45%,
    transparent 70%
  );
  box-shadow:
    inset 0 0 15px #f9d099,
    0 0 12px #ffedb155;
}
.arena:not(.lit)[data-phase="cast"] .breath-gold,
.arena:not(.lit)[data-phase="cast"] .breath-jade {
  animation: flare 0.8s ease-out both;
}
.arena:not(.lit)[data-phase="cast"] .shock {
  animation: shockwave 0.65s 0.46s ease-out both;
}
.arena:not(.lit) #effects {
  visibility: hidden;
}
@media (prefers-reduced-motion: no-preference) {
  .arena:not(.lit) picture {
    animation: breathe 6s ease-in-out infinite alternate;
  }
  .arena:not(.lit)[data-phase="charge"] img {
    animation: draw-near 0.47s ease-out both;
  }
  .arena:not(.lit)[data-phase="cast"] img {
    animation: recoil 1.15s ease-out both;
  }
}
@keyframes breathe {
  to {
    transform: scale(1.024) translateY(0.3%);
  }
}
@keyframes draw-near {
  to {
    transform: scale(1.055);
  }
}
@keyframes recoil {
  0% {
    transform: scale(1.055);
  }
  43% {
    transform: scale(1.08);
  }
  50% {
    transform: scale(1.06) translate(-0.5%, 0.35%);
  }
  59% {
    transform: scale(1.045) translate(0.35%, -0.2%);
  }
  100% {
    transform: none;
  }
}
@keyframes flare {
  0% {
    opacity: 0;
    transform: scale(0.05);
  }
  48%,
  68% {
    opacity: 1;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(1);
  }
}
@keyframes shockwave {
  from {
    opacity: 1;
    transform: translate(-50%, -50%) scale(0.15);
  }
  to {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.75);
  }
}
@keyframes awaken {
  38% {
    transform: translateY(-6px) rotate(-4deg);
    box-shadow: 0 0 20px var(--accent);
  }
}
@keyframes draw-power {
  to {
    transform: translateY(-5px);
    box-shadow:
      inset 0 0 14px #ffffff21,
      0 0 18px var(--accent);
  }
}
@keyframes flip {
  0% {
    transform: perspective(420px) translateY(-8px) rotateY(87deg) scale(1.13);
  }
  55% {
    transform: perspective(420px) translateY(-3px) rotateY(-12deg) scale(1.08);
  }
  100% {
    transform: perspective(420px) rotateY(0);
  }
}
@keyframes gild {
  0% {
    opacity: 0;
    background-position: 100% 0;
  }
  38% {
    opacity: 0.65;
  }
  100% {
    opacity: 0;
    background-position: 0 0;
  }
}
@keyframes seal-arrives {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.18);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}
@media (max-width: 780px) {
  .layout {
    grid-template-columns: 1fr;
  }
  .wrap {
    max-width: 660px;
  }
  .nav-in {
    height: 52px;
  }
  .heading {
    margin: 17px 0 13px;
  }
  .arena {
    aspect-ratio: 1.7;
  }
  .slip {
    display: block;
  }
  .wallet {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 10px 15px;
  }
  .wallet strong {
    font-size: 24px;
  }
  .slip-main {
    padding: 13px 15px;
    gap: 10px;
  }
  .selection {
    font-size: 13px;
  }
  .feedback {
    min-height: 1.6em;
  }
  .history {
    margin-top: 14px;
  }
  .versus {
    width: 34px;
    height: 34px;
  }
  .versus span {
    font-size: 13px;
  }
  .duelist {
    padding-bottom: 12px;
  }
  .rune {
    width: 32px;
    font-size: 20px;
  }
  .quiet,
  .how {
    height: 33px;
  }
  .quiet {
    padding: 0 9px;
  }
  .brand {
    font-size: 15px;
  }
  .mode {
    font-size: 10px;
    padding: 4px 8px;
  }
}
@media (max-width: 360px) {
  .nav-in,
  .wrap {
    padding-inline: 11px;
  }
  .heading {
    gap: 5px;
  }
  h1 {
    font-size: 26px;
  }
  .heading p {
    font-size: 11px;
  }
  .name {
    font-size: 17px;
  }
}
@media (prefers-reduced-motion: reduce) {
  #effects,
  .arena .spell-fallback {
    display: none;
  }
  *,
  *:before,
  *:after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

.theatre {
  min-width: 0;
  align-self: start;
  border: 1px solid #88734f80;
  border-radius: 14px;
  overflow: hidden;
  background: #141c19;
}
.theatre .arena {
  border: 0;
  border-radius: 0;
}
.arena {
  --magic: #ffd582;
  --edge: #bb6d22;
  --pan: -4%;
}
.arena[data-side="qilin"] {
  --magic: #a9ffe2;
  --edge: #3d9e96;
  --pan: 4%;
}
.spell-desk {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 86px;
  padding: 12px clamp(12px, 1.5vw, 22px);
  border-top: 1px solid #5b5745;
  background: linear-gradient(110deg, #2b2c20, #18201d 55%);
}
.theatre:has([data-side="qilin"]) .spell-desk {
  background: linear-gradient(110deg, #1d312b, #18201d 55%);
}
.spell-emblem {
  flex: none;
  display: grid;
  place-items: center;
  width: 42px;
  height: 48px;
  font: 28px Georgia;
  color: #f3cd81;
  background: linear-gradient(150deg, #6f5031, #221d18 66%);
  clip-path: polygon(50% 0, 96% 24%, 96% 77%, 50% 100%, 4% 77%, 4% 24%);
}
.theatre:has([data-side="qilin"]) .spell-emblem {
  color: #aff3d9;
  background: linear-gradient(150deg, #456e61, #14241e 66%);
}
.spell-copy {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 2px;
}
.spell-copy strong {
  color: #fff1d4;
  font-weight: 500;
  font-size: clamp(16px, 1.6vw, 22px);
}
.spell-copy span,
.spell-actions small {
  color: #c0c6b3;
  font-size: 12px;
  line-height: 1.45;
}
.spell-actions {
  flex: none;
  display: grid;
  justify-items: center;
  gap: 4px;
}
.spell-actions button,
.trace-skip {
  border: 1px solid #9e8f6b;
  color: #f8e8c6;
  background: #232b25;
  border-radius: 7px;
  padding: 6px 14px;
  font-size: 13px;
}
.spell-actions button:enabled:hover,
.trace-skip:hover {
  background: #394138;
}
.spell-actions small {
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}
.spell-actions button:disabled {
  opacity: 0.55;
}
.trace-ui {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: none;
  background:
    linear-gradient(0deg, #080f157d, transparent 50%, #0810155c),
    radial-gradient(ellipse at 50% 52%, transparent 24%, #06101635);
}
.arena[data-phase="trace"] .trace-ui {
  display: block;
}
.arena:is([data-phase="trace"], [data-phase="invoke"]) .versus {
  opacity: 0;
}
.arena:is([data-phase="trace"], [data-phase="invoke"]) .duelists {
  opacity: 0.22;
}
.trace-hud,
.trace-skip {
  position: absolute;
  top: clamp(8px, 2%, 15px);
  background: #111a1bf0;
  border: 1px solid #94886d8f;
  color: #fff0d5;
  font-size: clamp(11px, 1.1vw, 15px);
  border-radius: 30px;
  min-height: 32px;
}
.trace-hud {
  left: 2%;
  padding: 4px 11px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.trace-pips {
  display: flex;
  gap: 5px;
}
.trace-pips i {
  display: block;
  width: 8px;
  height: 8px;
  transform: rotate(45deg);
  border: 1px solid #c3b9a1;
}
.trace-pips i[data-mark="perfect"],
.trace-pips i[data-mark="good"] {
  background: var(--magic);
  box-shadow: 0 0 6px var(--magic);
}
.trace-pips i[data-mark="miss"] {
  background: #a9887e;
  border-color: #c4a59f;
}
.trace-skip {
  right: 2%;
  padding: 4px 12px;
  min-width: 48px;
}
.trace-target {
  --approach: 2.1;
  position: absolute;
  translate: -50% -50%;
  width: clamp(49px, 6.5vw, 74px);
  aspect-ratio: 1;
  padding: 0;
  display: grid;
  place-content: center;
  border-radius: 50%;
  border: 2px solid var(--magic);
  background: radial-gradient(
    circle,
    #2e3532 18%,
    #111a1a 65%,
    var(--edge) 100%
  );
  color: var(--magic);
  box-shadow:
    0 0 0 4px #0d1619b8,
    0 0 20px var(--edge);
  touch-action: manipulation;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.trace-target::before {
  content: "";
  position: absolute;
  inset: -2px;
  border: 2px solid var(--magic);
  border-radius: inherit;
  opacity: 0.92;
  transform: scale(var(--approach));
  box-shadow:
    0 0 7px var(--edge),
    inset 0 0 7px var(--edge);
  pointer-events: none;
}
.trace-target::after {
  content: "";
  position: absolute;
  inset: 5px;
  border: 1px dashed var(--magic);
  border-radius: inherit;
  opacity: 0.68;
  pointer-events: none;
}
#trace-glyph {
  font: clamp(23px, 3.3vw, 38px)/1 Georgia;
}
#trace-hint {
  position: absolute;
  top: calc(100% + 7px);
  left: 50%;
  translate: -50% 0;
  white-space: nowrap;
  padding: 2px 9px;
  background: #0d1415f0;
  color: #fff0d4;
  border-radius: 10px;
  font-size: 12px;
}
.trace-target[data-state="ready"] {
  background: radial-gradient(circle, #fff7d7, var(--magic) 48%, var(--edge));
  color: #1d251d;
}
.trace-target[data-state="good"],
.trace-target[data-state="perfect"] {
  background: var(--magic);
  color: #17231c;
}
.trace-target:is([data-state="good"], [data-state="perfect"])::before {
  animation: trace-hit 0.33s ease-out both;
}
.trace-target[data-state="miss"] {
  filter: saturate(0.15);
  opacity: 0.8;
}
.trace-target[data-state="miss"]::before {
  opacity: 0;
}
@keyframes trace-hit {
  from {
    transform: scale(1);
    opacity: 1;
  }
  to {
    transform: scale(2);
    opacity: 0;
  }
}
.invocation {
  --length: .92s;
  position: absolute;
  inset: 0;
  z-index: 3;
  display: none;
  overflow: hidden;
  pointer-events: none;
  background: #0b0e10;
}
.arena[data-ultimate="true"] .invocation {
  --length: 1.31s;
}
.arena[data-phase="invoke"] .invocation {
  display: block;
  animation: cut-panel var(--length) both;
}
.invocation-art {
  position: absolute;
  inset: -4% -6%;
  background:
    linear-gradient(0deg, #080d11d9, transparent 42%),
    var(--plate) center/cover no-repeat;
  animation: cut-camera var(--length) ease-out both;
}
.invocation-streaks {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    112deg,
    transparent 27%,
    #fff4c019 46%,
    var(--magic) 49%,
    transparent 51%
  );
  mix-blend-mode: screen;
  animation: blade-sweep var(--length) both;
}
.invocation::after {
  content: "";
  position: absolute;
  inset: 4% 0;
  border-block: 1px solid color-mix(in srgb, var(--magic) 48%, transparent);
  background: linear-gradient(
    180deg,
    #0a0b0e65,
    transparent 5%,
    transparent 96%,
    #0a0b0e65
  );
}
.invocation-title {
  position: absolute;
  left: 5.5%;
  bottom: 10%;
  z-index: 1;
  display: grid;
  line-height: 1.24;
  color: #fff5e3;
  text-shadow:
    0 2px 8px #000,
    0 0 14px #131009;
}
.arena[data-side="dragon"] .invocation-title {
  left: auto;
  right: 5.5%;
  text-align: right;
}
.invocation-title strong {
  font:
    500 clamp(26px, 3.9vw, 57px)/1.32 Georgia,
    Prompt,
    serif;
}
.invocation-title small {
  font-size: clamp(10px, 1.05vw, 15px);
  color: var(--magic);
}
.arena[data-phase="trained"] .versus {
  width: auto;
  height: auto;
  white-space: nowrap;
  transform: translate(-50%, -50%);
  padding: 4px 14px;
  background: #15221eef;
  border-color: #b8b090;
}
.arena[data-phase="trained"] .versus span {
  transform: none;
  font:
    500 14px/1.5 Prompt,
    sans-serif;
}
@keyframes cut-panel {
  0% {
    clip-path: polygon(0 48%, 100% 37%, 100% 40%, 0 51%);
  }
  18%,
  84% {
    clip-path: polygon(0 4%, 100% 1%, 100% 96%, 0 99%);
  }
  100% {
    clip-path: polygon(0 57%, 100% 44%, 100% 44%, 0 57%);
  }
}
@keyframes cut-camera {
  from {
    transform: scale(1.16) translateX(var(--pan));
    filter: brightness(1.22);
  }
  to {
    transform: scale(1.02) translateX(0);
    filter: brightness(1);
  }
}
@keyframes blade-sweep {
  0% {
    opacity: 0.85;
    transform: translateX(-82%);
  }
  50% {
    opacity: 0.3;
  }
  100% {
    opacity: 0;
    transform: translateX(90%);
  }
}
@media (max-width: 780px) {
  .theatre .arena {
    aspect-ratio: 1.55;
  }
  .spell-desk {
    gap: 8px;
    min-height: 71px;
    padding: 9px 10px;
  }
  .spell-emblem {
    width: 30px;
    height: 36px;
    font-size: 22px;
  }
  .spell-copy span {
    font-size: 10.5px;
  }
  .spell-actions button {
    font-size: 12px;
    padding: 5px 10px;
    min-height: 36px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .trace-target::before {
    transform: scale(1.14);
  }
  .invocation-art,
  .invocation,
  .invocation-streaks {
    animation: none !important;
  }
  .invocation-streaks {
    display: none;
  }
}

#spell-particles {
  position: absolute;
  inset: 0;
  overflow: hidden;
  mix-blend-mode: screen;
}
#spell-particles i {
  position: absolute;
  left: 0;
  top: var(--lane);
  width: 16px;
  height: 3px;
  background: linear-gradient(90deg, transparent, #f0af3a, #fff8d8);
  border-radius: 80% 20%;
  filter: drop-shadow(0 0 4px #ffaf40);
  animation: ember-flight 0.95s var(--lag) linear infinite;
}
.arena[data-side="qilin"] #spell-particles i {
  width: 19px;
  height: 9px;
  left: auto;
  right: 0;
  border-radius: 0;
  background: linear-gradient(
    155deg,
    #fff6,
    #c3fff3 44%,
    #6ce8ca55 52%,
    #befff7
  );
  clip-path: polygon(0 70%, 66% 0, 100% 25%, 35% 100%);
  filter: none;
  animation-name: jade-flight;
}
@keyframes ember-flight {
  0% {
    left: 5%;
    transform: translateY(28px) rotate(-12deg) scale(var(--depth));
    opacity: 0;
  }
  25% {
    opacity: 0.9;
  }
  100% {
    left: 101%;
    transform: translateY(-35px) rotate(-14deg) scale(var(--depth));
    opacity: 0;
  }
}
@keyframes jade-flight {
  0% {
    right: 3%;
    transform: translateY(28px) rotate(29deg) scale(var(--depth));
    opacity: 0;
  }
  23% {
    opacity: 0.95;
  }
  100% {
    right: 102%;
    transform: translateY(-35px) rotate(-58deg) scale(var(--depth));
    opacity: 0.15;
  }
}
@media (prefers-reduced-motion: reduce) {
  #spell-particles {
    display: none;
  }
}
