:root {
  --bg: #0f1020;
  --panel: #1a1b28;
  --panel-2: #212233;
  --accent: #6842ff;
  --accent-2: #8f73ff;
  --text: #fff;
  --muted: #aaadbe;
  --secondary: #2a2b3d;
  --red-1: #ff6b86;
  --red-2: #e3174a;
  --yellow-1: #ffe066;
  --yellow-2: #f59f00;
  --green-1: #5eea9a;
  --green-2: #0f9f55;
  --blue-1: #5cc0ff;
  --blue-2: #1d5fff;
  --cw: clamp(54px, 8.4vw, 80px);
  --ch: calc(var(--cw) * 1.46);
  --ease-out: cubic-bezier(0.2, 0.9, 0.25, 1.15);
  --ease: cubic-bezier(0.25, 0.8, 0.25, 1);
  font-family:
    "Nunito",
    ui-rounded,
    "SF Pro Rounded",
    system-ui,
    -apple-system,
    "Segoe UI",
    sans-serif;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
}

body {
  font-weight: 700;
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
  color: inherit;
}

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

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

.cc {
  position: relative;
  max-width: 960px;
  margin: 0 auto;
  padding: 10px 12px 6px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 560px;
}

/* ---------- HUD ---------- */
.hud {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.brand h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 0.01em;
  background: linear-gradient(90deg, #ff8fa6, #ffe066, #6ff0a8, #7cc8ff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.brand-mark {
  display: grid;
  grid-template-columns: repeat(2, 9px);
  gap: 3px;
  transform: rotate(45deg);
}

.brand-mark i {
  width: 9px;
  height: 9px;
  border-radius: 3px;
  background: var(--red-2);
}
.brand-mark i:nth-child(2) {
  background: var(--yellow-2);
}
.brand-mark i:nth-child(3) {
  background: var(--blue-2);
}
.brand-mark i:nth-child(4) {
  background: var(--green-2);
}

.chips {
  display: flex;
  gap: 6px;
  flex: 1 1 auto;
  justify-content: flex-end;
  min-width: 0;
  flex-wrap: wrap;
}

.chip {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--panel-2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  font-size: 13px;
  white-space: nowrap;
}

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

.chip b {
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.chip-accent {
  background: linear-gradient(180deg, #7a58ff, #5635e6);
}
.chip-accent span {
  color: #ddd4ff;
}

.chip-daily.done {
  background: linear-gradient(180deg, #2fc77a, #13985a);
}
.chip-daily.done span {
  color: #d5ffe8;
}

.chip.bump {
  animation: bump 0.45s var(--ease-out);
}

.icon-btn {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 14px;
  background: var(--secondary);
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 3px 0 #1a1b29;
}

.icon-btn svg {
  width: 22px;
  height: 22px;
  stroke: #fff;
  stroke-width: 2.6;
  stroke-linecap: round;
  fill: none;
}

/* ---------- Table ---------- */
.table {
  position: relative;
  flex: 1 1 auto;
  border-radius: 26px;
  padding: 12px 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  isolation: isolate;
  overflow: hidden;
  background: radial-gradient(
    120% 90% at 50% 45%,
    #2d2468 0%,
    #1c1a3c 55%,
    #141428 100%
  );
  box-shadow:
    inset 0 0 0 2px rgba(143, 115, 255, 0.18),
    inset 0 -30px 60px rgba(0, 0, 0, 0.35),
    0 18px 40px rgba(0, 0, 0, 0.35);
}

.felt {
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: 0.5;
  background-image: radial-gradient(
    rgba(255, 255, 255, 0.05) 1.2px,
    transparent 1.6px
  );
  background-size: 18px 18px;
  pointer-events: none;
}

.table.shake {
  animation: shake 0.42s linear;
}

/* Opponents */
.opponents {
  display: flex;
  justify-content: center;
  gap: clamp(8px, 3vw, 36px);
  min-height: 96px;
}

.seat {
  position: relative;
  display: grid;
  grid-template-columns: auto auto;
  grid-template-rows: auto auto;
  column-gap: 8px;
  align-items: center;
  padding: 6px 12px 6px 6px;
  border-radius: 20px;
  background: rgba(26, 27, 40, 0.75);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.05);
  transition:
    transform 0.3s var(--ease-out),
    box-shadow 0.3s;
  min-width: 0;
}

.seat.turn {
  transform: translateY(2px) scale(1.04);
  box-shadow:
    inset 0 0 0 2px #ffd84d,
    0 0 24px rgba(255, 216, 77, 0.35);
}

.avatar {
  grid-row: 1 / span 2;
  position: relative;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #4a4b6a, #26273a);
  box-shadow:
    0 4px 10px rgba(0, 0, 0, 0.4),
    inset 0 0 0 3px rgba(255, 255, 255, 0.12);
  display: grid;
  place-items: center;
  overflow: visible;
}

.avatar svg,
.avatar img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.avatar img {
  width: 92%;
  height: 92%;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.35));
}

.seat-name {
  font-weight: 900;
  font-size: 15px;
  line-height: 1.1;
  white-space: nowrap;
}

.seat-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

.mini-fan {
  position: relative;
  width: 44px;
  height: 22px;
}

.mini-fan i {
  position: absolute;
  bottom: 0;
  width: 14px;
  height: 20px;
  border-radius: 4px;
  background: linear-gradient(160deg, #8f73ff, #4b27d6);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.5),
    inset 0 0 0 1.5px rgba(255, 255, 255, 0.5);
  transform-origin: 50% 120%;
}

.count-badge {
  min-width: 26px;
  padding: 2px 7px;
  border-radius: 999px;
  background: #fff;
  color: #1a1b28;
  font-weight: 900;
  font-size: 13px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.count-badge.low {
  background: #ff4d6d;
  color: #fff;
  animation: pulse 0.9s ease-in-out infinite;
}

.seat-score {
  color: #cfc3ff;
}

.thinking {
  position: absolute;
  top: -6px;
  right: -6px;
  display: none;
  gap: 3px;
  padding: 5px 7px;
  border-radius: 999px;
  background: #fff;
}

.seat.turn .thinking {
  display: flex;
}

.thinking i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #6842ff;
  animation: dot 0.9s infinite;
}
.thinking i:nth-child(2) {
  animation-delay: 0.15s;
}
.thinking i:nth-child(3) {
  animation-delay: 0.3s;
}

.bubble {
  position: absolute;
  left: 50%;
  top: 100%;
  z-index: 5;
  padding: 6px 12px;
  border-radius: 14px;
  background: #fff;
  color: #1a1b28;
  font-weight: 900;
  font-size: 14px;
  white-space: nowrap;
  transform: translate(-50%, 6px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
  animation: bubble 1.6s var(--ease-out) forwards;
  pointer-events: none;
}

.bubble::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -6px;
  border: 6px solid transparent;
  border-top: 0;
  border-bottom-color: #fff;
  transform: translateX(-50%);
}

.bubble.hot {
  background: #ffd84d;
}
.bubble.hot::before {
  border-bottom-color: #ffd84d;
}

/* Center */
.center {
  position: relative;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(18px, 5vw, 44px);
  min-height: calc(var(--ch) + 40px);
}

.dir-ring {
  position: absolute;
  left: 50%;
  top: 50%;
  width: calc(var(--ch) * 2.05);
  height: calc(var(--ch) * 2.05);
  margin: calc(var(--ch) * -1.025) 0 0 calc(var(--ch) * -1.025);
  color: var(--ring, #8f73ff);
  opacity: 0.55;
  pointer-events: none;
  transition: color 0.4s;
  animation: spin 14s linear infinite;
}

.dir-ring.ccw {
  animation-direction: reverse;
}

.dir-ring svg {
  width: 100%;
  height: 100%;
}

.dir-ring path {
  fill: none;
  stroke: currentColor;
  stroke-width: 5;
  stroke-linecap: round;
}

.pile {
  position: relative;
  width: var(--cw);
  height: var(--ch);
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  border-radius: calc(var(--cw) * 0.14);
}

.pile:disabled {
  cursor: default;
}

.pile-stack {
  position: absolute;
  inset: 0;
}

.pile-stack .card {
  position: absolute;
  left: 0;
  top: 0;
}

.draw-pile.ready .pile-stack {
  animation: nudge 1.2s ease-in-out infinite;
}

.draw-pile.ready::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: calc(var(--cw) * 0.2);
  box-shadow: 0 0 0 3px #ffd84d;
  animation: pulse 1s ease-in-out infinite;
  pointer-events: none;
}

.pile-count {
  position: absolute;
  right: -10px;
  bottom: -10px;
  min-width: 30px;
  padding: 3px 7px;
  border-radius: 999px;
  background: #fff;
  color: #1a1b28;
  font-size: 12px;
  font-weight: 900;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4);
}

.discard {
  position: relative;
  width: var(--cw);
  height: var(--ch);
}

.discard .card {
  position: absolute;
  left: 0;
  top: 0;
}

.discard.drop-ok::after {
  content: "";
  position: absolute;
  inset: -10px;
  border-radius: calc(var(--cw) * 0.22);
  border: 3px dashed #ffd84d;
  animation: pulse 0.8s ease-in-out infinite;
}

.color-orb {
  position: absolute;
  left: calc(50% + var(--cw) * 1.35 + 18px);
  top: 50%;
  width: 30px;
  height: 30px;
  margin-top: -15px;
  border-radius: 50%;
  background: conic-gradient(
    var(--red-2) 0 25%,
    var(--yellow-2) 0 50%,
    var(--green-2) 0 75%,
    var(--blue-2) 0
  );
  box-shadow:
    0 0 0 4px rgba(255, 255, 255, 0.9),
    0 0 20px var(--orb-glow, rgba(255, 255, 255, 0.3));
  transition:
    background 0.3s,
    transform 0.3s var(--ease-out);
}

.color-orb.pop {
  animation: bump 0.5s var(--ease-out);
}

/* Me */
.me {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.me-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  position: relative;
}

.me-id {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px 4px 4px;
  border-radius: 999px;
  background: rgba(26, 27, 40, 0.75);
  transition: box-shadow 0.3s;
}

.me-id.turn {
  box-shadow:
    inset 0 0 0 2px #ffd84d,
    0 0 20px rgba(255, 216, 77, 0.35);
}

.me-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: block;
  background: radial-gradient(circle at 35% 30%, #8a6a52, #5a3f2e);
  overflow: hidden;
}

.me-avatar svg {
  width: 100%;
  height: 100%;
}

.me-name {
  font-weight: 900;
  font-size: 15px;
}

.me-count {
  min-width: 26px;
  padding: 2px 7px;
  border-radius: 999px;
  background: #fff;
  color: #1a1b28;
  font-size: 13px;
  font-weight: 900;
  text-align: center;
}

.me-actions {
  display: flex;
  gap: 8px;
}

.pill {
  min-height: 44px;
  min-width: 44px;
  padding: 0 20px;
  border: 0;
  border-radius: 999px;
  background: var(--secondary);
  font-weight: 900;
  font-size: 16px;
  cursor: pointer;
  box-shadow:
    0 4px 0 #17182a,
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
  transition:
    transform 0.12s,
    box-shadow 0.12s,
    opacity 0.2s,
    filter 0.2s;
}

.pill:active:not(:disabled) {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #17182a;
}

.pill:disabled {
  opacity: 0.42;
  cursor: default;
  filter: saturate(0.4);
}

.pill-primary {
  background: linear-gradient(180deg, #7d5cff, #5a36f0);
  box-shadow:
    0 4px 0 #3a1fb0,
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.pill-primary:active:not(:disabled) {
  box-shadow: 0 1px 0 #3a1fb0;
}

.pill-big {
  min-height: 56px;
  padding: 0 44px;
  font-size: 22px;
}

.pill-one {
  background: linear-gradient(180deg, #ffe066, #f5a000);
  color: #3b2200;
  box-shadow:
    0 4px 0 #b36b00,
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.pill-one.hot:not(:disabled) {
  animation: wiggle 0.8s ease-in-out infinite;
}

.pill-one.catch {
  background: linear-gradient(180deg, #ff7a93, #e3174a);
  color: #fff;
  box-shadow: 0 4px 0 #99102f;
}

/* Hand */
.hand {
  position: relative;
  height: calc(var(--ch) + 34px);
  touch-action: none;
}

.hand .card {
  position: absolute;
  left: 0;
  bottom: 12px;
  transform: translate(var(--x, 0), var(--y, 0)) rotate(var(--r, 0deg));
  transform-origin: 50% 110%;
  transition:
    transform 0.28s var(--ease-out),
    filter 0.2s,
    box-shadow 0.2s;
  cursor: pointer;
  padding: 0;
  border: 0;
}

.hand.my-turn .card.dim {
  filter: brightness(0.62) saturate(0.7);
}

.hand .card.playable {
  --y: -14px;
}

.hand.my-turn .card.playable {
  box-shadow:
    0 0 0 3px #fff,
    0 0 18px rgba(255, 255, 255, 0.55),
    0 10px 18px rgba(0, 0, 0, 0.45);
}

.hand .card:focus-visible {
  --y: -22px;
  outline: 3px solid #ffd84d;
  outline-offset: 2px;
}

.hand .card.dragging {
  opacity: 0;
}

.hand .card.shake {
  animation: card-shake 0.35s linear;
}

.hand .card.fresh {
  animation: fresh 0.5s var(--ease-out);
}

/* ---------- Cards ---------- */
.card {
  --c1: #8f73ff;
  --c2: #4b27d6;
  position: relative;
  display: block;
  width: var(--cw);
  height: var(--ch);
  border-radius: calc(var(--cw) * 0.14);
  background:
    radial-gradient(rgba(255, 255, 255, 0.13) 1.2px, transparent 1.7px) 0 0 /
      8px 8px,
    linear-gradient(160deg, var(--c1), var(--c2));
  box-shadow:
    0 6px 14px rgba(0, 0, 0, 0.4),
    inset 0 0 0 calc(var(--cw) * 0.04) rgba(255, 255, 255, 0.92),
    inset 0 -8px 16px rgba(0, 0, 0, 0.18);
  color: #fff;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

.card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(
    155deg,
    rgba(255, 255, 255, 0.42) 0%,
    rgba(255, 255, 255, 0.08) 38%,
    rgba(255, 255, 255, 0) 40%
  );
  pointer-events: none;
}

.card.red {
  --c1: var(--red-1);
  --c2: var(--red-2);
  --ink: #d3103f;
}
.card.yellow {
  --c1: var(--yellow-1);
  --c2: var(--yellow-2);
  --ink: #d07f00;
}
.card.green {
  --c1: var(--green-1);
  --c2: var(--green-2);
  --ink: #0b8c49;
}
.card.blue {
  --c1: var(--blue-1);
  --c2: var(--blue-2);
  --ink: #1a52e6;
}
.card.wild {
  --c1: #3a3c5c;
  --c2: #17182a;
  --ink: #1a1b28;
}

.gem {
  position: absolute;
  left: 50%;
  top: 50%;
  width: calc(var(--cw) * 0.62);
  height: calc(var(--cw) * 0.62);
  margin: calc(var(--cw) * -0.31) 0 0 calc(var(--cw) * -0.31);
  border-radius: calc(var(--cw) * 0.13);
  background: linear-gradient(160deg, #ffffff, #e9e9f5);
  transform: rotate(45deg);
  box-shadow:
    0 3px 6px rgba(0, 0, 0, 0.25),
    inset 0 -3px 0 rgba(0, 0, 0, 0.08);
}

.card.wild .gem {
  background: conic-gradient(
    from 45deg,
    var(--red-2) 0 25%,
    var(--yellow-2) 0 50%,
    var(--green-2) 0 75%,
    var(--blue-2) 0
  );
  box-shadow:
    0 0 0 calc(var(--cw) * 0.035) #fff,
    0 3px 8px rgba(0, 0, 0, 0.4);
}

.sym {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--ink);
  font-weight: 900;
  font-size: calc(var(--cw) * 0.44);
  line-height: 1;
  letter-spacing: -0.03em;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.08);
}

.sym svg {
  width: calc(var(--cw) * 0.4);
  height: calc(var(--cw) * 0.4);
}

.card.wild .sym {
  color: #fff;
  font-size: calc(var(--cw) * 0.36);
  text-shadow:
    0 2px 0 rgba(0, 0, 0, 0.5),
    0 0 6px rgba(0, 0, 0, 0.5);
}

.u {
  text-decoration: underline;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.08em;
}

.corner {
  position: absolute;
  left: calc(var(--cw) * 0.1);
  top: calc(var(--cw) * 0.08);
  font-weight: 900;
  font-size: calc(var(--cw) * 0.22);
  line-height: 1;
  color: #fff;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.35);
}

.corner svg {
  width: calc(var(--cw) * 0.2);
  height: calc(var(--cw) * 0.2);
  display: block;
}

.corner.br {
  left: auto;
  top: auto;
  right: calc(var(--cw) * 0.1);
  bottom: calc(var(--cw) * 0.08);
  transform: rotate(180deg);
}

.corner .pin {
  display: block;
  width: calc(var(--cw) * 0.18);
  height: calc(var(--cw) * 0.18);
  border-radius: 30%;
  transform: rotate(45deg);
  background: conic-gradient(
    from 45deg,
    var(--red-2) 0 25%,
    var(--yellow-2) 0 50%,
    var(--green-2) 0 75%,
    var(--blue-2) 0
  );
  box-shadow: 0 0 0 1.5px #fff;
}

/* Card back */
.card.back {
  --c1: #8f73ff;
  --c2: #3d1fc4;
  background:
    repeating-linear-gradient(
      45deg,
      rgba(255, 255, 255, 0.07) 0 6px,
      transparent 6px 12px
    ),
    linear-gradient(160deg, var(--c1), var(--c2));
}

.back-emblem {
  position: absolute;
  left: 50%;
  top: 50%;
  width: calc(var(--cw) * 0.5);
  height: calc(var(--cw) * 0.5);
  margin: calc(var(--cw) * -0.25) 0 0 calc(var(--cw) * -0.25);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: calc(var(--cw) * 0.04);
  padding: calc(var(--cw) * 0.05);
  border-radius: calc(var(--cw) * 0.12);
  background: rgba(255, 255, 255, 0.95);
  transform: rotate(45deg);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.35);
}

.back-emblem i {
  border-radius: 30%;
  background: var(--red-2);
}
.back-emblem i:nth-child(2) {
  background: var(--yellow-2);
}
.back-emblem i:nth-child(3) {
  background: var(--blue-2);
}
.back-emblem i:nth-child(4) {
  background: var(--green-2);
}

.card.back.bk-starlight {
  --c1: #2b3a80;
  --c2: #0d1335;
  background:
    radial-gradient(#fff 1px, transparent 1.6px) 0 0 / 13px 13px,
    radial-gradient(rgba(255, 224, 102, 0.9) 1px, transparent 1.6px) 6px 6px /
      17px 17px,
    linear-gradient(160deg, var(--c1), var(--c2));
}

.card.back.bk-candy {
  --c1: #ff7eb6;
  --c2: #d6337a;
  background:
    repeating-linear-gradient(
      -45deg,
      rgba(255, 255, 255, 0.28) 0 7px,
      transparent 7px 14px
    ),
    linear-gradient(160deg, var(--c1), var(--c2));
}

.card.back.bk-gold {
  --c1: #ffe38a;
  --c2: #c98500;
  background:
    repeating-radial-gradient(
      circle at 50% 50%,
      rgba(255, 255, 255, 0.18) 0 4px,
      transparent 4px 9px
    ),
    linear-gradient(160deg, var(--c1), var(--c2));
}

/* Flying cards (animation layer) */
.fly {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 50;
  pointer-events: none;
  will-change: transform;
}

.fly .card {
  box-shadow: 0 16px 30px rgba(0, 0, 0, 0.45);
}

.flip-wrap {
  position: relative;
  width: var(--cw);
  height: var(--ch);
  transform-style: preserve-3d;
}

.flip-wrap > .card {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
}

.flip-wrap > .card.front-face {
  transform: rotateY(180deg);
}

/* FX */
.fx {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 30;
  overflow: hidden;
}

.particle {
  position: absolute;
  width: 9px;
  height: 9px;
  border-radius: 3px;
  will-change: transform, opacity;
}

.popup {
  position: absolute;
  transform: translate(-50%, -50%);
  font-weight: 900;
  font-size: 26px;
  color: #fff;
  text-shadow:
    0 3px 0 rgba(0, 0, 0, 0.35),
    0 0 12px rgba(0, 0, 0, 0.35);
  animation: popup 1.1s var(--ease-out) forwards;
  white-space: nowrap;
}

.popup.bad {
  color: #ff8fa6;
}
.popup.good {
  color: #ffe066;
}

.banner {
  position: absolute;
  left: 50%;
  top: 44%;
  z-index: 35;
  padding: 10px 26px;
  border-radius: 999px;
  background: linear-gradient(180deg, #7d5cff, #5a36f0);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  font-size: 22px;
  font-weight: 900;
  white-space: nowrap;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.6);
  pointer-events: none;
}

.banner.show {
  animation: banner 1.4s var(--ease-out) forwards;
}

.banner.warn {
  background: linear-gradient(180deg, #ff7a93, #e3174a);
}
.banner.gold {
  background: linear-gradient(180deg, #ffe066, #f5a000);
  color: #3b2200;
}

/* Ghost hand tutorial */
.ghost {
  position: absolute;
  z-index: 40;
  width: 54px;
  height: 54px;
  left: 0;
  top: 0;
  pointer-events: none;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.5));
}

.ghost svg {
  width: 100%;
  height: 100%;
  fill: #fff;
  stroke: #1a1b28;
  stroke-width: 2.5;
}

.tip {
  position: absolute;
  z-index: 41;
  left: 50%;
  transform: translateX(-50%);
  max-width: min(92%, 420px);
  padding: 8px 16px;
  border-radius: 16px;
  background: #fff;
  color: #1a1b28;
  font-size: 14px;
  font-weight: 800;
  text-align: center;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
  animation: tip-in 0.4s var(--ease-out);
  pointer-events: none;
}

.keys {
  margin: 0;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}

kbd {
  display: inline-block;
  min-width: 20px;
  padding: 1px 5px;
  margin: 0 1px;
  border-radius: 6px;
  background: var(--secondary);
  color: #fff;
  font: inherit;
  font-size: 11px;
  box-shadow: 0 2px 0 #151626;
}

/* ---------- Overlays ---------- */
.overlay {
  position: absolute;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 12px;
  background: rgba(10, 10, 24, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: fade 0.25s ease;
}

.overlay[hidden] {
  display: none;
}

.overlay-soft {
  background: rgba(10, 10, 24, 0.45);
}

.panel {
  position: relative;
  width: min(100%, 440px);
  max-height: 100%;
  overflow-y: auto;
  padding: 16px 22px 18px;
  border-radius: 28px;
  background: linear-gradient(180deg, #25263a, #1a1b28);
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.5),
    inset 0 0 0 2px rgba(143, 115, 255, 0.25);
  text-align: center;
  animation: panel-in 0.4s var(--ease-out);
}

.panel h2 {
  margin: 2px 0 4px;
  font-size: 30px;
  font-weight: 900;
}

.panel-small {
  width: min(100%, 360px);
}

.panel-small h2 {
  font-size: 22px;
}

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

.lead b {
  color: #fff;
}

.logo {
  position: relative;
  height: 70px;
  margin: 0 auto 2px;
  width: 170px;
}

.logo-card {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 46px;
  height: 66px;
  margin-left: -23px;
  border-radius: 9px;
  box-shadow:
    0 6px 12px rgba(0, 0, 0, 0.4),
    inset 0 0 0 2.5px #fff;
  transform-origin: 50% 130%;
  animation: logo-fan 0.8s var(--ease-out) both;
}

.lc-1 {
  background: linear-gradient(160deg, var(--red-1), var(--red-2));
  --rot: -27deg;
}
.lc-2 {
  background: linear-gradient(160deg, var(--yellow-1), var(--yellow-2));
  --rot: -9deg;
  animation-delay: 0.08s;
}
.lc-3 {
  background: linear-gradient(160deg, var(--green-1), var(--green-2));
  --rot: 9deg;
  animation-delay: 0.16s;
}
.lc-4 {
  background: linear-gradient(160deg, var(--blue-1), var(--blue-2));
  --rot: 27deg;
  animation-delay: 0.24s;
}

.daily {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 16px;
  background: var(--panel-2);
  text-align: left;
  font-size: 13px;
}

.daily-icon {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, #ffe066, #f5a000);
  color: #3b2200;
  font-weight: 900;
}

.daily-body {
  flex: 1;
  min-width: 0;
}

.bar {
  height: 8px;
  margin-top: 5px;
  border-radius: 999px;
  background: #121322;
  overflow: hidden;
}

.bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #6842ff, #b49cff);
  transition: width 0.6s var(--ease);
}

.setting {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 6px 0;
}

.setting-label {
  color: var(--muted);
  font-size: 14px;
}

.seg {
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  background: #121322;
}

.seg button {
  min-width: 48px;
  min-height: 40px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-weight: 900;
  cursor: pointer;
}

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

.house {
  margin: 10px 0 0;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
  text-align: left;
}

.house summary {
  min-height: 42px;
  display: flex;
  align-items: center;
  padding: 0 14px;
  cursor: pointer;
  color: var(--muted);
  font-size: 14px;
  list-style: none;
}

.house summary::-webkit-details-marker {
  display: none;
}

.house summary::after {
  content: "▾";
  margin-left: auto;
}

.house[open] summary::after {
  content: "▴";
}

.house > :not(summary) {
  margin-left: 14px;
  margin-right: 14px;
}

.house[open] {
  padding-bottom: 10px;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  font-size: 14px;
  cursor: pointer;
}

.toggle input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.toggle span {
  position: relative;
  flex: 0 0 auto;
  width: 44px;
  height: 26px;
  border-radius: 999px;
  background: #121322;
  box-shadow: inset 0 0 0 2px #34364f;
  transition: background 0.2s;
}

.toggle span::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #8b8ea6;
  transition:
    transform 0.25s var(--ease-out),
    background 0.2s;
}

.toggle input:checked + span {
  background: var(--accent);
  box-shadow: none;
}

.toggle input:checked + span::after {
  transform: translateX(18px);
  background: #fff;
}

.toggle input:focus-visible + span {
  outline: 3px solid #ffd84d;
  outline-offset: 2px;
}

.backs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding: 4px 0 10px;
  --cw: 44px;
}

.back-opt {
  position: relative;
  padding: 4px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  cursor: pointer;
  display: grid;
  justify-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--muted);
}

.back-opt[aria-checked="true"] {
  background: rgba(104, 66, 255, 0.35);
  color: #fff;
}

.back-opt:disabled {
  cursor: default;
}

.back-opt .lock {
  position: absolute;
  inset: 4px 4px auto;
  height: var(--ch);
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: rgba(10, 10, 24, 0.7);
  font-size: 10px;
  color: #fff;
  line-height: 1.2;
  padding: 2px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 0;
}

.stats div {
  padding: 8px 4px;
  border-radius: 12px;
  background: var(--panel-2);
  text-align: center;
}

.stats dt {
  color: var(--muted);
  font-size: 11px;
}

.stats dd {
  margin: 2px 0 0;
  font-size: 18px;
  font-weight: 900;
}

.panel-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 14px;
  padding-bottom: 4px;
}

.color-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 12px 0 14px;
}

.swatch {
  position: relative;
  min-height: 72px;
  border: 0;
  border-radius: 20px;
  font-size: 18px;
  font-weight: 900;
  cursor: pointer;
  color: #fff;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.25);
  box-shadow:
    0 5px 0 rgba(0, 0, 0, 0.35),
    inset 0 2px 0 rgba(255, 255, 255, 0.35);
  transition: transform 0.15s var(--ease-out);
}

.swatch:hover {
  transform: translateY(-2px);
}

.swatch:active {
  transform: translateY(3px);
}

.swatch span {
  position: absolute;
  left: 10px;
  top: 8px;
  font-size: 11px;
  opacity: 0.8;
}

.swatch.best::after {
  content: "Most in hand";
  position: absolute;
  left: 50%;
  bottom: 6px;
  transform: translateX(-50%);
  font-size: 10px;
  white-space: nowrap;
  opacity: 0.9;
}

.sw-red {
  background: linear-gradient(160deg, var(--red-1), var(--red-2));
}
.sw-yellow {
  background: linear-gradient(160deg, var(--yellow-1), var(--yellow-2));
  color: #3b2200;
  text-shadow: none;
}
.sw-green {
  background: linear-gradient(160deg, var(--green-1), var(--green-2));
}
.sw-blue {
  background: linear-gradient(160deg, var(--blue-1), var(--blue-2));
}

.swap-list {
  display: grid;
  gap: 8px;
  margin: 12px 0 14px;
}

.swap-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 60px;
  padding: 6px 16px 6px 6px;
  border: 0;
  border-radius: 18px;
  background: var(--panel-2);
  cursor: pointer;
  text-align: left;
  font-weight: 900;
}

.swap-btn .avatar {
  width: 48px;
  height: 48px;
}

.swap-btn .count-badge {
  margin-left: auto;
}

.panel-result h2 {
  font-size: 32px;
}

.result-badge {
  width: 96px;
  height: 96px;
  margin: -6px auto 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 35% 30%, #4a4b6a, #26273a);
  box-shadow:
    0 0 0 5px #ffd84d,
    0 10px 30px rgba(255, 216, 77, 0.35);
  animation: pop-in 0.6s var(--ease-out);
}

.result-badge.lose {
  box-shadow:
    0 0 0 5px #8b8ea6,
    0 10px 30px rgba(0, 0, 0, 0.35);
}

.result-badge svg,
.result-badge img {
  width: 90%;
  height: 90%;
  object-fit: contain;
}

.result-points {
  font-size: 40px;
  font-weight: 900;
  color: #ffe066;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.3);
  margin-bottom: 8px;
}

.result-points:empty {
  display: none;
}

.standings {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
  text-align: left;
}

.standings li {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 6px 6px;
  border-radius: 14px;
  background: var(--panel-2);
  font-size: 14px;
}

.standings li.lead-row {
  box-shadow: inset 0 0 0 2px #ffd84d;
}

.standings .mini-av {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  overflow: hidden;
  background: radial-gradient(circle at 35% 30%, #4a4b6a, #26273a);
  display: grid;
  place-items: center;
}

.standings .mini-av svg,
.standings .mini-av img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.standings .gain {
  color: #7dffb1;
  font-size: 12px;
  margin-left: 6px;
}

.standings .bar {
  margin-top: 4px;
  height: 6px;
}

.standings .pts {
  font-weight: 900;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}

.unlock {
  margin: 12px 0 0;
  padding: 10px;
  border-radius: 14px;
  background: linear-gradient(
    90deg,
    rgba(255, 224, 102, 0.2),
    rgba(104, 66, 255, 0.2)
  );
  color: #ffe066;
  font-size: 14px;
}

/* ---------- Animations ---------- */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
@keyframes pulse {
  50% {
    opacity: 0.55;
    transform: scale(1.04);
  }
}
@keyframes bump {
  40% {
    transform: scale(1.22);
  }
}
@keyframes dot {
  50% {
    transform: translateY(-3px);
    opacity: 0.4;
  }
}
@keyframes nudge {
  50% {
    transform: translateY(-4px);
  }
}
@keyframes wiggle {
  0%,
  100% {
    transform: rotate(0);
  }
  20% {
    transform: rotate(-6deg) scale(1.06);
  }
  40% {
    transform: rotate(6deg) scale(1.06);
  }
  60% {
    transform: rotate(-3deg);
  }
}
@keyframes shake {
  20% {
    transform: translate(-7px, 2px);
  }
  40% {
    transform: translate(6px, -2px);
  }
  60% {
    transform: translate(-4px, 1px);
  }
  80% {
    transform: translate(3px, 0);
  }
}
@keyframes card-shake {
  25% {
    translate: -6px 0;
  }
  50% {
    translate: 6px 0;
  }
  75% {
    translate: -3px 0;
  }
}
@keyframes fresh {
  from {
    scale: 0.6;
    opacity: 0;
  }
}
@keyframes bubble {
  0% {
    opacity: 0;
    transform: translate(-50%, 14px) scale(0.5);
  }
  15%,
  80% {
    opacity: 1;
    transform: translate(-50%, 6px) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, 0) scale(0.9);
  }
}
@keyframes popup {
  0% {
    opacity: 0;
    transform: translate(-50%, -30%) scale(0.5);
  }
  20% {
    opacity: 1;
    transform: translate(-50%, -60%) scale(1.15);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -160%) scale(1);
  }
}
@keyframes banner {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.5);
  }
  15%,
  75% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -70%) scale(0.95);
  }
}
@keyframes tip-in {
  from {
    opacity: 0;
    transform: translate(-50%, 8px);
  }
}
@keyframes fade {
  from {
    opacity: 0;
  }
}
@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.94);
  }
}
@keyframes pop-in {
  0% {
    transform: scale(0.3);
  }
  60% {
    transform: scale(1.12);
  }
}
@keyframes logo-fan {
  from {
    transform: rotate(0) translateY(10px);
    opacity: 0;
  }
  to {
    transform: rotate(var(--rot));
  }
}
.logo-card {
  transform: rotate(var(--rot));
}

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  .cc {
    padding: 8px 8px 6px;
    min-height: 660px;
  }
  .panel {
    padding: 14px 16px 14px;
  }
  .panel h2,
  .panel-result h2 {
    font-size: 25px;
  }
  .result-badge {
    width: 74px;
    height: 74px;
  }
  .result-points {
    font-size: 30px;
    margin-bottom: 6px;
  }
  .standings li {
    padding: 4px 8px 4px 4px;
  }
  .lead {
    font-size: 14px;
    margin-bottom: 8px;
  }
  .brand h1 {
    font-size: 17px;
  }
  .chip {
    padding: 5px 9px;
    font-size: 12px;
  }
  .chip span {
    font-size: 10px;
  }
  .chip-daily {
    display: none;
  }
  .table {
    padding: 10px 8px 8px;
    border-radius: 22px;
  }
  .opponents {
    gap: 6px;
  }
  .seat {
    grid-template-columns: auto;
    justify-items: center;
    padding: 6px 6px 6px;
    row-gap: 2px;
  }
  .avatar {
    grid-row: auto;
    width: 50px;
    height: 50px;
  }
  .seat-name {
    font-size: 13px;
  }
  .seat-score {
    display: none;
  }
  .mini-fan {
    display: none;
  }
  .center {
    min-height: calc(var(--ch) + 70px);
  }
  .color-orb {
    left: calc(50% + var(--cw) + 30px);
  }
  .keys {
    display: none;
  }
  .pill {
    padding: 0 16px;
  }
}

@media (max-width: 420px) {
  .brand h1 {
    display: none;
  }
  .chips {
    justify-content: flex-start;
  }
  .me-name {
    display: none;
  }
  .pill-big {
    padding: 0 34px;
  }
}

@media (min-height: 800px) and (max-width: 640px) {
  :root {
    --cw: clamp(54px, 17vw, 76px);
  }
  .center {
    min-height: calc(var(--ch) + 110px);
  }
}

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