@font-face {
  font-family: 'Titan One';
  src: url('fonts/titan-one.woff2') format('woff2');
  font-display: swap;
}

@font-face {
  font-family: 'Rubik';
  src: url('fonts/rubik.woff2') format('woff2');
  font-weight: 400 800;
  font-display: swap;
}

:root {
  --bg: #1a1126;
  --panel: #2a1a3d;
  --panel-edge: #120a1c;
  --line: #4a3565;
  --text: #fff6e5;
  --muted: #bdaed0;
  --ink: #1c1024;
  --cream: #fffaf0;
  --red: #d81f2a;
  --yellow: #ffc928;
  --green: #12924a;
  --blue: #1668d6;
  --felt: #45296a;
  --felt-deep: #2a1745;
  --card-w: 76px;
  --card-h: 114px;
  --display: 'Titan One', 'Arial Rounded MT Bold', 'Arial Black', sans-serif;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100dvh;
  background:
    radial-gradient(120% 70% at 50% 0%, #3a2259 0%, transparent 60%),
    repeating-linear-gradient(135deg, #ffffff05 0 2px, transparent 2px 14px),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font: 16px/1.4 'Rubik', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

#app {
  max-width: 560px;
  margin: 0 auto;
  padding: 24px 16px 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

#app.playing {
  max-width: 1040px;
  min-height: 100dvh;
  padding: 12px;
}

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 132px;
  padding: 4px 4px 0;
}

h1 {
  margin: 0;
  flex: none;
  padding: 6px 30px 10px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 0 5px var(--cream), 0 0 0 9px var(--ink), 0 14px 24px -8px #000c;
  font: 56px/1 var(--display);
  color: var(--yellow);
  -webkit-text-stroke: 3px var(--ink);
  paint-order: stroke fill;
  text-shadow: 4px 4px 0 var(--ink);
  transform: rotate(-9deg);
}

.fan {
  --card-w: 58px;
  --card-h: 87px;
  position: relative;
  flex: none;
  width: 190px;
  height: 120px;
}

.fan .card {
  position: absolute;
  left: calc(50% - var(--card-w) / 2);
  bottom: 4px;
  transform-origin: 50% 130%;
  transform: rotate(calc((var(--i) - 2) * 15deg));
}

h2 {
  margin: 0 0 12px;
  font: 22px/1.2 var(--display);
  letter-spacing: 0.3px;
}

.panel {
  background: linear-gradient(#ffffff0a, transparent 40%), var(--panel);
  border: 2px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  margin: 0;
  box-shadow: 0 6px 0 var(--panel-edge), 0 18px 30px -14px #000;
}

label {
  display: block;
  margin-bottom: 8px;
  font: 22px/1.2 var(--display);
  letter-spacing: 0.3px;
}

.row {
  display: flex;
  gap: 8px;
}

.row.end {
  justify-content: flex-end;
  margin-top: 16px;
}

.grow {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.muted {
  color: var(--muted);
}

p.muted {
  margin: 0;
}

input {
  flex: 1;
  min-width: 0;
  height: 48px;
  padding: 0 14px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: var(--panel-edge);
  color: var(--text);
  font: inherit;
  font-weight: 500;
}

input::placeholder {
  color: #9382a8;
}

input:focus-visible {
  outline: 3px solid var(--yellow);
  outline-offset: 1px;
}

button {
  --lip: #1b0f29;
  min-height: 48px;
  padding: 0 18px;
  border: 0;
  border-radius: 12px;
  background: #4d3769;
  color: var(--text);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 0 var(--lip);
  -webkit-tap-highlight-color: transparent;
}

button:active:not(:disabled) {
  translate: 0 3px;
  box-shadow: 0 1px 0 var(--lip);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

button.primary {
  --lip: #9a6a00;
  background: var(--yellow);
  color: var(--ink);
}

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

.list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.list li {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 60px;
  padding: 6px 0;
  border-top: 2px dashed #ffffff1c;
  font-weight: 600;
}

.list li:first-child {
  border-top: 0;
}

.avatar {
  flex: none;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--tone, #ffd9a8);
  color: var(--ink);
  font: 18px/1 var(--display);
  box-shadow: 0 0 0 2px var(--ink), 0 0 0 4px #ffffff2e;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--yellow);
  font-weight: 700;
}

.tag svg {
  width: 20px;
  height: 20px;
}

.seats {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.game {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.opponents {
  list-style: none;
  margin: 0;
  padding: 8px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.opponent {
  position: relative;
  flex: 1 1 170px;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 60px;
  padding: 8px 12px;
  background: var(--panel);
  border: 3px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 4px 0 var(--panel-edge);
}

.opponent.active {
  border-color: var(--yellow);
  background: #3a2452;
}

.opponent.active::before {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -13px;
  translate: -50% 0;
  border: 8px solid transparent;
  border-top-color: var(--yellow);
}

.opponent .who {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.opponent .name {
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.opponent .count {
  color: var(--muted);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.minis {
  flex: none;
  display: flex;
  padding-left: 10px;
}

.mini {
  width: 16px;
  height: 24px;
  margin-left: -10px;
  border-radius: 3px;
  background: radial-gradient(ellipse 60% 44% at 50% 50%, var(--red) 96%, transparent) var(--ink);
  box-shadow: 0 0 0 1.5px var(--cream), -2px 1px 3px #0008;
}

.badge {
  padding: 3px 10px 2px;
  border-radius: 999px;
  background: var(--yellow);
  color: var(--ink);
  font: 13px/1.2 var(--display);
  box-shadow: 0 0 0 2px var(--ink);
}

.opponent .badge {
  position: absolute;
  top: -11px;
  right: 12px;
}

button.catch {
  --lip: #7c0d15;
  position: absolute;
  right: 8px;
  top: 50%;
  translate: 0 -50%;
  min-height: 40px;
  background: var(--red);
  color: #fff;
}

button.catch:active:not(:disabled) {
  translate: 0 calc(-50% + 3px);
}

.table {
  position: relative;
  flex: 1;
  min-height: calc(var(--card-h) * 2.5);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(12px, 5vw, 44px);
  padding: 20px 20px 50px;
  border: 10px solid #170d24;
  border-radius: 220px;
  background: radial-gradient(ellipse at 50% 38%, var(--felt), var(--felt-deep) 72%);
  box-shadow:
    inset 0 0 0 2px #ffffff1a,
    inset 0 0 70px #0009,
    0 0 0 3px #3b2456,
    0 20px 40px -14px #000;
}

.table::before {
  content: '';
  position: absolute;
  inset: 12px;
  border: 2px dashed #ffffff24;
  border-radius: inherit;
  pointer-events: none;
}

.pile {
  --cur: var(--cream);
  position: relative;
  flex: none;
  width: calc(var(--card-h) * 1.5);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--cur) 45%, transparent), transparent);
}

.ring-red {
  --cur: var(--red);
}
.ring-yellow {
  --cur: var(--yellow);
}
.ring-green {
  --cur: var(--green);
}
.ring-blue {
  --cur: var(--blue);
}

.direction {
  position: absolute;
  inset: 0;
  color: color-mix(in srgb, var(--cur) 70%, #fff);
}

.direction.ccw {
  transform: scaleX(-1);
}

.direction svg {
  display: block;
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 1px 0 #0009);
}

.pile::before,
.pile::after {
  content: '';
  position: absolute;
  width: var(--card-w);
  height: var(--card-h);
  border-radius: calc(var(--card-w) * 0.13);
  background: #3a2452;
  box-shadow: inset 0 0 0 calc(var(--card-w) * 0.055) #e9dfd0, 0 3px 8px #0008;
  transform: rotate(-11deg);
}

.pile::after {
  transform: rotate(7deg) translate(3px, 2px);
}

.pile .card {
  z-index: 1;
  transform: rotate(var(--tilt, 0deg));
}

.status {
  position: absolute;
  left: 50%;
  bottom: 14px;
  translate: -50% 0;
}

.swatch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  padding: 3px 14px 3px 10px;
  border-radius: 999px;
  background: var(--ink);
  box-shadow: 0 0 0 2px var(--c);
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
}

.swatch svg {
  width: 16px;
  height: 16px;
  color: var(--c);
}

.swatch.yellow svg,
.swatch.red svg,
.swatch.green svg,
.swatch.blue svg {
  filter: brightness(1.25);
}

.red {
  --c: var(--red);
}
.yellow {
  --c: var(--yellow);
}
.green {
  --c: var(--green);
}
.blue {
  --c: var(--blue);
}
.wild {
  --c: #17101f;
}

.card {
  position: relative;
  flex: none;
  width: var(--card-w);
  height: var(--card-h);
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: calc(var(--card-w) * 0.13);
  background: linear-gradient(155deg, #ffffff38, transparent 42%), var(--c);
  color: var(--c);
  font: calc(var(--card-w) * 0.5) / 1 var(--display);
  box-shadow:
    inset 0 0 0 calc(var(--card-w) * 0.055) var(--cream),
    0 1px 0 #0008,
    0 7px 14px -5px #000c;
  display: grid;
  place-items: center;
  user-select: none;
}

button.card:active:not(:disabled) {
  box-shadow:
    inset 0 0 0 calc(var(--card-w) * 0.055) var(--cream),
    0 1px 0 #0008,
    0 7px 14px -5px #000c;
}

.card .oval {
  width: 70%;
  height: 84%;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--cream);
  box-shadow: inset 0 -3px 6px #0000002e, 0 0 0 1px #0003;
  transform: rotate(28deg);
}

.card .glyph {
  display: grid;
  place-items: center;
  transform: rotate(-28deg);
  -webkit-text-stroke: 0.09em var(--ink);
  paint-order: stroke fill;
  text-shadow: 0.06em 0.06em 0 var(--ink);
}

.card .glyph.mark {
  text-decoration: underline;
  text-decoration-thickness: 0.09em;
  text-underline-offset: 0.06em;
}

.card svg {
  display: block;
  overflow: visible;
}

.card .glyph svg {
  width: 1.2em;
  height: 1.2em;
  filter: drop-shadow(0.05em 0.05em 0 var(--ink));
}

.card .idx {
  position: absolute;
  top: 7%;
  left: 11%;
  color: var(--cream);
  font-size: 0.36em;
  -webkit-text-stroke: 0.16em var(--ink);
  paint-order: stroke fill;
}

.card .idx.br {
  inset: auto 11% 7% auto;
  transform: rotate(180deg);
}

.card .idx svg {
  width: 1.05em;
  height: 1.05em;
}

.card .pip {
  position: absolute;
  top: 8.5%;
  right: 11%;
  width: 0.24em;
  height: 0.24em;
  color: var(--cream);
}

.card .pip.bl {
  inset: auto auto 8.5% 11%;
}

.card.wild .oval {
  background: conic-gradient(from -28deg, var(--red) 0 25%, var(--blue) 0 50%, var(--green) 0 75%, var(--yellow) 0);
  box-shadow: 0 0 0 0.05em var(--cream);
}

.card.wild.four .oval {
  background: var(--cream);
}

.card.wild .glyph svg {
  width: 1.45em;
  height: 1.45em;
}

.wheel {
  display: block;
  width: 0.8em;
  height: 1.05em;
  border-radius: 50%;
  background: conic-gradient(var(--red) 0 25%, var(--blue) 0 50%, var(--green) 0 75%, var(--yellow) 0);
  box-shadow: 0 0 0 0.12em var(--cream);
  transform: rotate(28deg);
}

.card.back,
.card.ghost-back {
  --c: #17101f;
}

.card.back .oval,
.card.ghost-back .oval {
  background: var(--red);
  box-shadow: inset 0 -3px 6px #0000004d;
}

.card.back .glyph,
.card.ghost-back .glyph {
  color: var(--yellow);
  font-size: 0.56em;
  transform: rotate(-52deg);
  -webkit-text-stroke: 0.14em var(--ink);
}

.deck {
  box-shadow:
    inset 0 0 0 calc(var(--card-w) * 0.055) var(--cream),
    0 2px 0 #cfc3b4,
    0 3px 0 #17101f,
    0 5px 0 #cfc3b4,
    0 6px 0 #17101f,
    0 8px 0 #cfc3b4,
    0 9px 0 #17101f,
    0 16px 18px -6px #000c;
}

button.deck:active:not(:disabled) {
  translate: 0 4px;
  box-shadow:
    inset 0 0 0 calc(var(--card-w) * 0.055) var(--cream),
    0 2px 0 #cfc3b4,
    0 3px 0 #17101f,
    0 4px 0 #cfc3b4,
    0 5px 0 #17101f,
    0 10px 12px -6px #000c;
}

.deck:not(:disabled) {
  outline: 3px solid var(--yellow);
  outline-offset: 4px;
}

.card.back:disabled,
.card.dim:disabled {
  opacity: 1;
}

.card.dim {
  filter: brightness(0.78) saturate(0.9);
}

button.card.playable {
  transform: translateY(-12px);
  box-shadow:
    inset 0 0 0 calc(var(--card-w) * 0.055) var(--cream),
    0 0 0 3px var(--ink),
    0 0 0 6px var(--yellow),
    0 16px 16px -6px #000c;
}

.controls {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
}

.turn {
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--panel);
  border: 2px solid var(--line);
  font-weight: 700;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.turn:empty {
  visibility: hidden;
}

.turn.mine {
  background: var(--yellow);
  border-color: var(--ink);
  color: var(--ink);
  font-family: var(--display);
  font-weight: 400;
  font-size: 18px;
  box-shadow: 0 0 0 3px #ffc92840;
}

button.uno {
  --lip: #7c0d15;
  flex: none;
  padding: 0 22px;
  border-radius: 999px;
  background: var(--red);
  color: var(--yellow);
  font: 22px/1 var(--display);
  -webkit-text-stroke: 1.5px var(--ink);
  paint-order: stroke fill;
}

.hand {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  padding: 22px 8px 12px;
  border-radius: 22px;
  background: linear-gradient(#0000004d, #00000026);
  box-shadow: inset 0 2px 0 #0006, inset 0 0 0 1px #ffffff12;
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: #0d0714cc;
  backdrop-filter: blur(3px);
}

.dialog {
  position: relative;
  width: min(100%, 360px);
  padding: 26px 22px 24px;
  background: linear-gradient(#ffffff10, transparent 40%), var(--panel);
  border: 3px solid var(--cream);
  border-radius: 24px;
  box-shadow: 0 8px 0 var(--panel-edge), 0 30px 60px -10px #000;
  text-align: center;
}

.dialog h2 {
  font-size: 24px;
}

.winner {
  margin: 8px 0 22px;
  font-size: 34px !important;
  line-height: 1.1;
  color: var(--yellow);
  -webkit-text-stroke: 2px var(--ink);
  paint-order: stroke fill;
  text-shadow: 3px 3px 0 var(--ink);
  overflow-wrap: anywhere;
}

.spread {
  --card-w: 46px;
  --card-h: 69px;
  position: relative;
  height: 84px;
  margin: -62px auto 4px;
  width: 190px;
}

.spread .card {
  position: absolute;
  left: calc(50% - var(--card-w) / 2);
  bottom: 0;
  transform-origin: 50% 150%;
  transform: rotate(calc((var(--i) - 1.5) * 17deg));
}

.colors {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.pick {
  --lip: color-mix(in srgb, var(--c) 55%, #000);
  height: 84px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 3px solid var(--cream);
  border-radius: 16px;
  background: linear-gradient(155deg, #ffffff38, transparent 45%), var(--c);
  color: #fff;
  font: 18px/1 var(--display);
  -webkit-text-stroke: 3px var(--ink);
  paint-order: stroke fill;
}

.pick svg {
  width: 24px;
  height: 24px;
}

#toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  z-index: 7;
  translate: -50% 0;
  max-width: calc(100% - 32px);
  padding: 12px 18px;
  border: 2px solid var(--cream);
  border-radius: 14px;
  background: var(--red);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 5px 0 #7c0d15, 0 16px 30px -8px #000;
}

#fx {
  position: fixed;
  inset: 0;
  z-index: 6;
  overflow: hidden;
  pointer-events: none;
}

#fx > * {
  position: absolute;
  left: 0;
  top: 0;
}

.burst {
  padding: 4px 18px 8px;
  border-radius: 999px;
  background: var(--red);
  color: var(--yellow);
  font: 40px/1.1 var(--display);
  white-space: nowrap;
  -webkit-text-stroke: 3px var(--ink);
  paint-order: stroke fill;
  box-shadow: 0 0 0 4px var(--cream), 0 0 0 7px var(--ink), 0 14px 26px -6px #000;
}

.burst.caught {
  background: var(--ink);
  color: #fff;
  font-size: 30px;
}

.wash {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: radial-gradient(closest-side, transparent 55%, var(--c) 70%, transparent);
}

.confetti {
  width: 10px;
  height: 15px;
  border-radius: 2px;
  background: var(--c, var(--cream));
  box-shadow: inset 0 0 0 1.5px #fffaf0cc;
}

@media (max-width: 480px) {
  :root {
    --card-w: 56px;
    --card-h: 84px;
  }

  h1 {
    font-size: 44px;
    padding: 6px 22px 9px;
  }

  .masthead {
    min-height: 112px;
  }

  .fan {
    --card-w: 46px;
    --card-h: 69px;
    width: 150px;
    height: 96px;
  }

  .opponent {
    flex-basis: 150px;
    gap: 8px;
    padding: 6px 10px;
  }

  .opponent .avatar {
    width: 30px;
    height: 30px;
    font-size: 15px;
  }

  .mini:nth-child(n + 5) {
    display: none;
  }

  .table {
    border-width: 8px;
    border-radius: 120px;
    padding: 16px 12px 48px;
  }

  .hand {
    gap: 6px;
    padding: 20px 4px 10px;
  }

  .burst {
    font-size: 32px;
  }
}

@keyframes rise {
  from {
    opacity: 0;
    translate: 0 18px;
  }
}

@keyframes fan-in {
  from {
    opacity: 0;
    transform: rotate(0deg) translateY(30px);
  }
}

@keyframes stamp {
  from {
    opacity: 0;
    scale: 1.5;
  }
}

@keyframes pop {
  0% {
    opacity: 0;
    scale: 0.7;
  }
  70% {
    scale: 1.05;
  }
}

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

@keyframes orbit {
  to {
    rotate: 360deg;
  }
}

@keyframes glow {
  50% {
    box-shadow: 0 4px 0 var(--panel-edge), 0 0 0 6px #ffc92838, 0 0 26px #ffc92866;
  }
}

@keyframes beckon {
  50% {
    outline-offset: 8px;
    outline-color: #ffc92880;
  }
}

@keyframes ping {
  0% {
    box-shadow: 0 4px 0 var(--lip), 0 0 0 0 #ffc928cc;
  }
  100% {
    box-shadow: 0 4px 0 var(--lip), 0 0 0 14px #ffc92800;
  }
}

@media (prefers-reduced-motion: no-preference) {
  button {
    transition: translate 0.08s, box-shadow 0.08s, background-color 0.15s;
  }

  button.card {
    transition: transform 0.16s cubic-bezier(0.3, 1.4, 0.5, 1), filter 0.2s, box-shadow 0.16s;
  }

  button.card.playable:hover {
    transform: translateY(-22px) rotate(-2deg);
  }

  .pile {
    transition: background 0.4s;
  }

  .fresh .panel {
    animation: rise 0.45s cubic-bezier(0.2, 0.8, 0.2, 1) backwards;
  }

  .fresh .panel:nth-of-type(2) {
    animation-delay: 0.08s;
  }

  .fresh h1 {
    animation: stamp 0.4s cubic-bezier(0.3, 1.5, 0.5, 1) backwards;
  }

  .fresh .fan .card {
    animation: fan-in 0.55s cubic-bezier(0.2, 0.9, 0.3, 1.2) backwards;
    animation-delay: calc(0.15s + var(--i) * 0.07s);
  }

  .fresh .opponent {
    animation: rise 0.4s backwards;
  }

  .list li.new,
  .badge.new {
    animation: pop 0.35s cubic-bezier(0.3, 1.4, 0.5, 1) backwards;
  }

  .overlay.enter {
    animation: fade 0.25s backwards;
  }

  .overlay.enter .dialog {
    animation: pop 0.4s cubic-bezier(0.3, 1.4, 0.5, 1) backwards;
  }

  .overlay.enter .pick {
    animation: pop 0.35s cubic-bezier(0.3, 1.4, 0.5, 1) backwards;
    animation-delay: calc(0.08s + var(--i) * 0.06s);
  }

  .overlay.enter .spread .card {
    animation: fan-in 0.6s cubic-bezier(0.2, 0.9, 0.3, 1.2) backwards;
    animation-delay: calc(0.25s + var(--i) * 0.08s);
  }

  .direction svg {
    animation: orbit 18s linear infinite;
  }

  .opponent.active {
    animation: glow 1.8s ease-in-out infinite;
  }

  .deck:not(:disabled) {
    animation: beckon 1.4s ease-in-out infinite;
  }

  button.uno:not(:disabled),
  button.catch {
    animation: ping 1.1s ease-out infinite;
  }

  #toast:not([hidden]) {
    animation: rise 0.25s backwards;
  }
}

.rules {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 14px;
}

.rule {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  font-family: inherit;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
}

.rule:has(:disabled) {
  cursor: default;
}

.switch {
  appearance: none;
  flex: none;
  position: relative;
  width: 52px;
  height: 30px;
  padding: 0;
  margin: 0;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: var(--panel-edge);
  cursor: inherit;
  transition: background 0.2s, border-color 0.2s;
}

.switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--muted);
  transition: translate 0.2s cubic-bezier(0.3, 1.4, 0.5, 1), background 0.2s;
}

.switch:checked {
  background: var(--green);
  border-color: var(--cream);
}

.switch:checked::after {
  translate: 22px 0;
  background: var(--cream);
}

.switch:disabled {
  opacity: 1;
}

.state {
  min-width: 34px;
  color: var(--muted);
  font-size: 14px;
  text-align: right;
}

.state.on {
  color: var(--yellow);
}

.help {
  margin: 6px 0 0 64px !important;
  font-size: 14px;
  line-height: 1.4;
}

.chips {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chips li {
  padding: 4px 10px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: var(--panel-edge);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.pending {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  margin-left: 8px;
  padding: 3px 12px;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  box-shadow: 0 0 0 2px var(--cream);
  font: 16px/1 var(--display);
  -webkit-text-stroke: 2px var(--ink);
  paint-order: stroke fill;
  vertical-align: middle;
}

.swaps {
  display: grid;
  gap: 10px;
}

.swap {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 60px;
  padding: 0 14px;
  border: 2px solid var(--line);
  text-align: left;
}

.swap .count {
  color: var(--muted);
  font-size: 14px;
}

@media (prefers-reduced-motion: no-preference) {
  .overlay.enter .swap {
    animation: pop 0.35s cubic-bezier(0.3, 1.4, 0.5, 1) backwards;
    animation-delay: calc(0.08s + var(--i) * 0.06s);
  }
}
