:root {
  --bg: #0f1020;
  --panel: #1a1b28;
  --panel-2: #212233;
  --accent: #6842ff;
  --text: #fff;
  --muted: #aaadbe;
  --secondary: #2a2b3d;
  --red-hi: #ff8a7a;
  --red: #ee2a3a;
  --red-lo: #9e0f22;
  --blk-hi: #6a6f8c;
  --blk: #2a2c3c;
  --blk-lo: #0b0b12;
  --gold: #ffd23f;
  --board-w: min(100%, 520px);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family:
    "Nunito",
    ui-rounded,
    "SF Pro Rounded",
    system-ui,
    -apple-system,
    "Segoe UI",
    sans-serif;
  font-weight: 700;
  -webkit-tap-highlight-color: transparent;
}

body {
  overflow-x: hidden;
  min-height: 100%;
  background:
    radial-gradient(
      ellipse 70% 55% at 50% 40%,
      rgba(104, 66, 255, 0.2),
      transparent 70%
    ),
    var(--bg);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

button {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 3px solid #b9a6ff;
  outline-offset: 3px;
}

/* ---------- Layout ---------- */
.ck {
  position: relative;
  max-width: 560px;
  margin: 0 auto;
  padding: 12px 16px 14px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  justify-items: center;
  gap: 10px;
}

.hud,
.status,
.actions {
  width: var(--board-w);
}

.stage {
  width: var(--board-w);
}

@media (min-width: 780px) {
  .ck {
    max-width: 900px;
    padding: 20px 24px;
    grid-template-columns: auto 280px;
    grid-template-areas:
      "stage hud"
      "stage status"
      "stage actions"
      "stage help"
      "stage .";
    grid-template-rows: auto auto auto auto 1fr;
    column-gap: 28px;
    row-gap: 14px;
    justify-content: center;
    align-items: start;
  }
  .stage {
    grid-area: stage;
    width: 540px;
    align-self: center;
  }
  .hud {
    grid-area: hud;
    width: 100%;
    flex-direction: column;
    margin-top: 12px;
  }
  .hud .chip {
    flex: none;
  }
  .chip-draw {
    flex-direction: row !important;
    justify-content: space-between !important;
    padding: 6px 16px !important;
  }
  .chip-draw strong {
    font-size: 18px !important;
  }
  .status {
    grid-area: status;
    width: 100%;
  }
  .actions {
    grid-area: actions;
    width: 100%;
    display: grid !important;
    grid-template-columns: 1fr 1fr;
  }
  .actions .mode-pill {
    grid-column: 1 / -1;
    justify-content: center;
    margin: 0 !important;
  }
  .actions #menu {
    grid-column: 1 / -1;
  }
  .help {
    grid-area: help;
    text-align: left !important;
  }
}

/* ---------- HUD ---------- */
.hud {
  display: flex;
  gap: 8px;
  justify-content: space-between;
}

.chip {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  padding: 5px 12px 5px 6px;
  border-radius: 999px;
  background: var(--panel-2);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    0 4px 12px rgba(0, 0, 0, 0.25);
  border: 2px solid transparent;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
  min-width: 0;
}

.chip-side {
  flex: 1 1 0;
}

.chip-top {
  flex-direction: row-reverse;
  padding: 5px 6px 5px 12px;
}

.chip-top .chip-text {
  align-items: flex-end;
}

.chip-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.1;
}

.chip-label {
  color: #fff;
  font-size: 14px;
  font-weight: 900;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chip-sub {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.chip strong {
  font-size: 22px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  margin-left: auto;
}

.chip-top strong {
  margin-left: 0;
  margin-right: auto;
}

.chip-draw {
  flex-direction: column;
  gap: 0;
  padding: 3px 12px;
  justify-content: center;
}

.chip-draw .chip-label {
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.chip-draw strong {
  font-size: 16px;
  margin: 0;
  line-height: 1.1;
}

.chip-piece {
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
}

.chip-turn {
  position: absolute;
  top: -9px;
  left: 50%;
  transform: translateX(-50%) scale(0.6);
  opacity: 0;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #1a1030;
  background: var(--gold);
  transition:
    opacity 0.2s,
    transform 0.2s;
}

.chip.is-turn .chip-turn {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}

.chip.is-turn {
  border-color: var(--gold);
  box-shadow:
    0 0 0 3px rgba(255, 210, 63, 0.15),
    0 6px 18px rgba(255, 210, 63, 0.2);
}

.chip.bump strong {
  animation: bump 0.5s ease;
}

.chip.pulse .chip-sub {
  display: inline-block;
  animation: sub-flash 0.6s ease;
}

/* ---------- Status ---------- */
.status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0;
  min-height: 34px;
  padding: 4px 14px;
  border-radius: 999px;
  background: rgba(104, 66, 255, 0.14);
  color: #ddd5ff;
  font-size: 14px;
  font-weight: 800;
  text-align: center;
  transition: background 0.2s;
}

.status.is-alert {
  background: rgba(255, 210, 63, 0.16);
  color: #ffe58c;
}

.status.is-thinking .status-dot {
  animation: think 0.9s ease-in-out infinite;
}

.status-dot {
  flex: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
}

/* ---------- Pieces ---------- */
.piece,
.chip-piece,
.status-dot {
  position: relative;
}

.piece-red {
  background:
    radial-gradient(
      circle at 35% 26%,
      rgba(255, 255, 255, 0.85) 0 6%,
      rgba(255, 255, 255, 0) 22%
    ),
    radial-gradient(
      circle at 50% 50%,
      var(--red) 0 44%,
      var(--red-lo) 45% 49%,
      #ff4b57 50% 58%,
      var(--red-lo) 59% 63%,
      var(--red) 64% 100%
    );
  box-shadow:
    inset 0 -4px 0 rgba(90, 0, 16, 0.45),
    inset 0 3px 2px rgba(255, 205, 195, 0.55),
    0 4px 6px rgba(0, 0, 0, 0.45);
}

.piece-black {
  background:
    radial-gradient(
      circle at 35% 26%,
      rgba(255, 255, 255, 0.6) 0 6%,
      rgba(255, 255, 255, 0) 22%
    ),
    radial-gradient(
      circle at 50% 50%,
      var(--blk) 0 44%,
      var(--blk-lo) 45% 49%,
      #3c3f55 50% 58%,
      var(--blk-lo) 59% 63%,
      var(--blk) 64% 100%
    );
  box-shadow:
    inset 0 -4px 0 rgba(0, 0, 0, 0.55),
    inset 0 3px 2px rgba(170, 180, 230, 0.4),
    0 4px 6px rgba(0, 0, 0, 0.5);
}

.piece {
  display: block;
  border-radius: 50%;
}

.crown {
  position: absolute;
  inset: 22% 20% 24%;
  width: 60%;
  height: 54%;
  fill: var(--gold);
  stroke: #9a5a00;
  stroke-width: 1.4;
  stroke-linejoin: round;
  filter: drop-shadow(0 1.5px 0 rgba(0, 0, 0, 0.45));
  pointer-events: none;
}

/* ---------- Board ---------- */
.stage {
  position: relative;
}

.frame {
  position: relative;
  padding: 5.2%;
  border-radius: 22px;
  background:
    repeating-linear-gradient(
      92deg,
      rgba(255, 255, 255, 0.035) 0 3px,
      rgba(0, 0, 0, 0.05) 3px 7px,
      rgba(255, 255, 255, 0) 7px 13px
    ),
    linear-gradient(160deg, #8a4a22, #5e2c10 45%, #3f1c08);
  box-shadow:
    inset 0 2px 0 rgba(255, 210, 160, 0.35),
    inset 0 -4px 0 rgba(0, 0, 0, 0.35),
    0 18px 34px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(0, 0, 0, 0.4);
}

.frame.shake {
  animation: shake 0.36s ease;
}

.files,
.ranks {
  position: absolute;
  display: flex;
  color: rgba(255, 226, 190, 0.6);
  font-size: clamp(8px, 2.2vw, 11px);
  font-weight: 900;
  pointer-events: none;
}

.files {
  left: 5.2%;
  right: 5.2%;
  bottom: 0;
  height: 5.2%;
  align-items: center;
}

.ranks {
  top: 5.2%;
  bottom: 5.2%;
  left: 0;
  width: 5.2%;
  flex-direction: column;
  align-items: center;
}

.files span,
.ranks span {
  flex: 1 1 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.board {
  position: relative;
  aspect-ratio: 1;
  border-radius: 6px;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  box-shadow:
    0 0 0 3px #2a1206,
    0 0 0 5px rgba(255, 200, 140, 0.25);
}

.squares,
.pieces,
.fx {
  position: absolute;
  inset: 0;
}

.squares {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
}

.sq {
  position: relative;
  appearance: none;
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
}

.sq-light {
  background:
    repeating-linear-gradient(
      84deg,
      rgba(160, 100, 40, 0.09) 0 2px,
      rgba(255, 255, 255, 0) 2px 6px
    ),
    linear-gradient(135deg, #f6dcae, #e5bd82);
}

.sq-dark {
  cursor: pointer;
  background:
    repeating-linear-gradient(
      96deg,
      rgba(0, 0, 0, 0.1) 0 2px,
      rgba(255, 255, 255, 0.03) 2px 5px
    ),
    linear-gradient(135deg, #8a4b25, #5f2d13);
  box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.35);
}

.sq:focus-visible {
  outline: none;
  z-index: 2;
  box-shadow:
    inset 0 0 0 3px #fff,
    inset 0 0 0 6px rgba(104, 66, 255, 0.9);
}

.sq.is-last::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 214, 90, 0.26);
  box-shadow: inset 0 0 0 2px rgba(255, 214, 90, 0.4);
}

.sq.is-selected::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(130, 100, 255, 0.4);
  box-shadow: inset 0 0 0 3px #a58dff;
}

.sq.is-target::after {
  content: "";
  position: absolute;
  inset: 32%;
  border-radius: 50%;
  background: radial-gradient(circle, #d4c8ff, #8466ff);
  box-shadow:
    0 0 0 4px rgba(132, 102, 255, 0.3),
    0 0 16px 4px rgba(132, 102, 255, 0.55);
  animation: target-pulse 1s ease-in-out infinite alternate;
}

.sq.is-target.is-jump::after {
  background: radial-gradient(circle, #fff3b8, #ffb400);
  box-shadow:
    0 0 0 4px rgba(255, 180, 0, 0.3),
    0 0 18px 5px rgba(255, 180, 0, 0.55);
}

.pieces {
  pointer-events: none;
}

.pc {
  position: absolute;
  left: 0;
  top: 0;
  width: 12.5%;
  height: 12.5%;
  padding: 1.3%;
  transform: translate(calc(var(--x) * 100%), calc(var(--y) * 100%));
  transition: transform 0.2s cubic-bezier(0.3, 0.9, 0.4, 1.1);
  will-change: transform;
}

.pc > .piece {
  width: 100%;
  height: 100%;
  transition:
    transform 0.18s ease,
    filter 0.2s;
}

.pc.is-lifted {
  z-index: 3;
}

.pc.is-lifted > .piece {
  transform: scale(1.1) translateY(-4%);
  box-shadow:
    0 12px 16px rgba(0, 0, 0, 0.5),
    inset 0 -4px 0 rgba(0, 0, 0, 0.35);
}

.pc.is-dragging {
  transition: none;
  z-index: 5;
}

.pc.is-dragging > .piece {
  transform: scale(1.18);
}

.pc.can-move > .piece::after {
  content: "";
  position: absolute;
  inset: -6%;
  border-radius: 50%;
  border: 3px solid rgba(255, 210, 63, 0.95);
  box-shadow: 0 0 12px rgba(255, 210, 63, 0.7);
  animation: ring 1s ease-in-out infinite alternate;
}

.pc.is-taken > .piece {
  filter: grayscale(0.7) brightness(0.6);
  transform: scale(0.85);
}

.pc.pop > .piece {
  animation: place-pop 0.3s cubic-bezier(0.2, 1.8, 0.4, 1);
}

.pc.crowned > .piece {
  animation: crown-pop 0.6s cubic-bezier(0.2, 1.6, 0.4, 1);
}

.pc.crowned .crown {
  animation: crown-drop 0.55s cubic-bezier(0.2, 1.6, 0.4, 1);
}

.pc.gone {
  transition: none;
}

.pc.gone > .piece {
  animation: vanish 0.3s ease forwards;
}

.pc.wiggle > .piece {
  animation: wiggle 0.35s ease;
}

.board.is-over .pc:not(.winner) > .piece {
  filter: brightness(0.55) saturate(0.7);
}

.fx {
  pointer-events: none;
  z-index: 7;
}

.spark {
  position: absolute;
  width: 3%;
  height: 3%;
  border-radius: 50%;
  background: var(--c, #ffd23f);
  box-shadow: 0 0 8px var(--c, #ffd23f);
  animation: spark 0.6s ease-out forwards;
}

.flash {
  position: absolute;
  width: 12.5%;
  height: 12.5%;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.9),
    rgba(255, 220, 120, 0) 70%
  );
  animation: flash 0.45s ease-out forwards;
}

.ring-fx {
  position: absolute;
  width: 12.5%;
  height: 12.5%;
  border-radius: 50%;
  border: 4px solid var(--gold);
  animation: ring-out 0.7s ease-out forwards;
}

/* ---------- Actions ---------- */
@media (max-width: 779px) {
  .actions .mode-pill {
    display: none;
  }
  .actions .btn {
    flex: 1 1 0;
    padding: 0 10px;
  }
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  align-items: center;
}

.btn {
  appearance: none;
  border: 0;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 999px;
  font-weight: 900;
  font-size: 15px;
  cursor: pointer;
  transition:
    transform 0.12s ease,
    filter 0.15s,
    background 0.15s;
  white-space: nowrap;
}

.btn:active {
  transform: translateY(2px) scale(0.97);
}

.btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.btn-primary {
  background: linear-gradient(180deg, #8264ff, var(--accent));
  box-shadow:
    0 5px 0 #4424c4,
    0 10px 22px rgba(104, 66, 255, 0.45);
}

.btn-primary:hover {
  filter: brightness(1.08);
}

.btn-secondary {
  background: var(--secondary);
  box-shadow:
    0 4px 0 #1a1b29,
    inset 0 1px 0 rgba(255, 255, 255, 0.07);
}

.btn-secondary:hover:not(:disabled) {
  background: #34354b;
}

.btn-big {
  min-height: 54px;
  padding: 0 40px;
  font-size: 20px;
}

.btn svg {
  width: 17px;
  height: 17px;
  margin: -3px 6px 0 -2px;
  vertical-align: middle;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mode-pill {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(104, 66, 255, 0.16);
  color: #cfc4ff;
  font-size: 13px;
  font-weight: 800;
  margin-right: auto;
}

.help {
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
  text-align: center;
  line-height: 1.8;
}

.touch-help {
  display: none;
}

@media (hover: none) and (pointer: coarse) {
  .keys-help {
    display: none;
  }
  .touch-help {
    display: inline;
  }
}

kbd {
  display: inline-block;
  min-width: 20px;
  padding: 0 5px;
  margin: 0 1px;
  border-radius: 6px;
  background: var(--secondary);
  color: #e6e6f5;
  font: inherit;
  font-size: 11px;
  line-height: 18px;
  text-align: center;
  box-shadow: 0 2px 0 #14141f;
}

.link {
  appearance: none;
  background: none;
  border: 0;
  color: #b9a6ff;
  text-decoration: underline;
  cursor: pointer;
  font-size: 12.5px;
  min-height: 32px;
  padding: 0 6px;
}

/* ---------- Overlays ---------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  background: rgba(10, 10, 26, 0.72);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  overflow-y: auto;
  animation: fade-in 0.25s ease;
}

.overlay[hidden] {
  display: none;
}

.card {
  position: relative;
  width: min(100%, 400px);
  margin: auto;
  padding: 20px 20px 22px;
  border-radius: 26px;
  background: linear-gradient(180deg, #27284c, var(--panel));
  box-shadow:
    0 20px 50px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  text-align: center;
  animation: card-in 0.4s cubic-bezier(0.2, 1.5, 0.4, 1);
}

.card h2 {
  margin: 4px 0;
  font-size: clamp(28px, 7vw, 38px);
  font-weight: 900;
  letter-spacing: -0.01em;
  background: linear-gradient(180deg, #fff 30%, #d7ccff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 3px 0 #3a2a99);
}

.lead {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.4;
}

.logo {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 4px;
}

.logo .piece {
  width: 46px;
  height: 46px;
  animation: logo-hop 1.6s ease-in-out infinite;
}

.logo .piece:nth-child(2) {
  animation-delay: 0.15s;
}

.logo .piece:nth-child(3) {
  animation-delay: 0.3s;
}

.option {
  display: flex;
  gap: 4px;
  padding: 4px;
  margin: 0 auto 10px;
  border-radius: 999px;
  background: #11121f;
  align-items: center;
  max-width: 100%;
}

.option[hidden] {
  display: none;
}

.option-label {
  color: var(--muted);
  font-size: 13px;
  padding: 0 2px 0 10px;
}

.seg {
  flex: 1 1 0;
  appearance: none;
  border: 0;
  min-height: 40px;
  padding: 0 8px;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
  transition:
    background 0.15s,
    color 0.15s;
}

.seg[aria-checked="true"] {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 3px 10px rgba(104, 66, 255, 0.5);
}

.toggle {
  appearance: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 48px;
  margin: 0 0 12px;
  padding: 6px 8px 6px 16px;
  border: 0;
  border-radius: 18px;
  background: #11121f;
  cursor: pointer;
  text-align: left;
}

.toggle-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.toggle-text strong {
  font-size: 14px;
  font-weight: 900;
}

.toggle-text small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.toggle-knob {
  position: relative;
  flex: none;
  width: 52px;
  height: 30px;
  border-radius: 999px;
  background: #3a3b52;
  transition: background 0.2s;
}

.toggle-knob::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
  transition: transform 0.2s cubic-bezier(0.3, 1.5, 0.5, 1);
}

.toggle[aria-checked="true"] .toggle-knob {
  background: var(--accent);
}

.toggle[aria-checked="true"] .toggle-knob::after {
  transform: translateX(22px);
}

.card .btn-big {
  width: 100%;
  margin-top: 4px;
}

.card-end {
  overflow: hidden;
}

.end-badge {
  position: relative;
  width: 76px;
  height: 76px;
  margin: 4px auto 6px;
  border-radius: 50%;
  animation: end-badge 0.7s cubic-bezier(0.2, 1.6, 0.4, 1);
}

.end-badge.is-draw {
  background: conic-gradient(var(--red) 0 50%, var(--blk) 50% 100%);
  box-shadow:
    inset 0 0 0 5px rgba(255, 255, 255, 0.2),
    0 4px 10px rgba(0, 0, 0, 0.4);
}

.end-score {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 0 0 14px;
  flex-wrap: wrap;
}

.end-score span {
  padding: 4px 12px;
  border-radius: 999px;
  background: #11121f;
  color: var(--muted);
  font-size: 13px;
}

.end-score b {
  color: #fff;
  font-weight: 900;
}

.end-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.end-actions .btn-big {
  flex: 1 1 100%;
}

.end-actions .btn-secondary {
  flex: 1 1 0;
}

.burst {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.confetti {
  position: absolute;
  top: 18%;
  left: 50%;
  width: 9px;
  height: 14px;
  border-radius: 3px;
  background: var(--c);
  animation: confetti 1.3s cubic-bezier(0.15, 0.7, 0.4, 1) forwards;
}

@media (max-width: 380px) {
  .ck {
    padding: 10px 10px 12px;
  }
  .chip {
    gap: 5px;
    padding-right: 9px;
  }
  .chip-top {
    padding: 5px 5px 5px 9px;
  }
  .chip-piece {
    width: 26px;
    height: 26px;
  }
  .chip-label {
    font-size: 12.5px;
  }
  .chip-sub {
    font-size: 10px;
  }
  .chip strong {
    font-size: 18px;
  }
  .chip-draw {
    padding: 3px 8px;
  }
  .btn {
    padding: 0 13px;
    font-size: 14px;
  }
  .mode-pill {
    display: none;
  }
  .seg {
    font-size: 13px;
    padding: 0 6px;
  }
}

/* ---------- Keyframes ---------- */
@keyframes bump {
  40% {
    transform: scale(1.45);
  }
}

@keyframes sub-flash {
  40% {
    transform: scale(1.2);
    color: #ff9d8f;
  }
}

@keyframes think {
  50% {
    transform: scale(0.7);
    opacity: 0.6;
  }
}

@keyframes target-pulse {
  from {
    transform: scale(0.85);
    opacity: 0.8;
  }
  to {
    transform: scale(1.05);
    opacity: 1;
  }
}

@keyframes ring {
  from {
    opacity: 0.55;
  }
  to {
    opacity: 1;
  }
}

@keyframes place-pop {
  0% {
    transform: scale(1.18);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes crown-pop {
  0% {
    transform: scale(1);
  }
  40% {
    transform: scale(1.3);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes crown-drop {
  from {
    transform: translateY(-80%) scale(1.6);
    opacity: 0;
  }
}

@keyframes vanish {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  30% {
    transform: scale(1.2);
    opacity: 1;
  }
  100% {
    transform: scale(0.1) rotate(40deg);
    opacity: 0;
  }
}

@keyframes wiggle {
  20% {
    transform: rotate(-10deg);
  }
  50% {
    transform: rotate(9deg);
  }
  80% {
    transform: rotate(-4deg);
  }
}

@keyframes spark {
  from {
    transform: translate(0, 0) scale(1);
    opacity: 1;
  }
  to {
    transform: translate(var(--dx), var(--dy)) scale(0.2);
    opacity: 0;
  }
}

@keyframes flash {
  from {
    transform: scale(0.4);
    opacity: 1;
  }
  to {
    transform: scale(1.8);
    opacity: 0;
  }
}

@keyframes ring-out {
  from {
    transform: scale(0.6);
    opacity: 1;
  }
  to {
    transform: scale(1.9);
    opacity: 0;
  }
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-8px);
  }
  40% {
    transform: translateX(7px);
  }
  60% {
    transform: translateX(-5px);
  }
  80% {
    transform: translateX(3px);
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

@keyframes card-in {
  from {
    transform: scale(0.8) translateY(20px);
    opacity: 0;
  }
}

@keyframes logo-hop {
  0%,
  60%,
  100% {
    transform: translateY(0);
  }
  30% {
    transform: translateY(-10px);
  }
}

@keyframes end-badge {
  from {
    transform: scale(0) rotate(-180deg);
  }
}

@keyframes confetti {
  0% {
    transform: translate(-50%, 0) rotate(0);
    opacity: 1;
  }
  100% {
    transform: translate(calc(-50% + var(--dx)), var(--dy)) rotate(var(--rot));
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .spark,
  .flash,
  .ring-fx,
  .confetti {
    display: none;
  }
}
