:root {
  color-scheme: dark;
  --bg: #0f1020;
  --panel: #1a1b28;
  --panel-2: #212233;
  --accent: #6842ff;
  --accent-2: #8f73ff;
  --text: #fff;
  --muted: #aaadbe;
  --secondary: #2a2b3d;
  --gold: #ffd84d;
  --mint: #3be0c1;
  --mw: 40px;
  --mh: 56px;
  font-family:
    "Nunito",
    ui-rounded,
    "SF Pro Rounded",
    system-ui,
    -apple-system,
    "Segoe UI",
    sans-serif;
}
* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
html,
body {
  margin: 0;
  width: 100%;
  min-width: 0;
  background: var(--bg);
  color: var(--text);
}
body {
  padding: 10px;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}
.sr-only,
.sr-defs {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.s-S {
  --suit: #1d1f35;
}
.s-H {
  --suit: #e3264f;
}
.s-D {
  --suit: #1f74e0;
}
.s-C {
  --suit: #179a4c;
}

.sp-shell {
  width: min(1100px, 100%);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ---------- HUD ---------- */
.sp-hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  flex-wrap: wrap;
}
.sp-title {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  font-size: clamp(17px, 2.6vw, 22px);
  font-weight: 900;
  letter-spacing: -0.02em;
  white-space: nowrap;
}
.sp-logo {
  position: relative;
  width: 22px;
  height: 30px;
  border-radius: 5px;
  background: linear-gradient(150deg, #fff, #e9e4fb);
  box-shadow:
    -6px 2px 0 -1px #8a6bff,
    -6px 2px 0 0 #5330e0,
    0 3px 8px rgba(0, 0, 0, 0.4);
  transform: rotate(8deg);
  margin-left: 6px;
}
.sp-logo::after {
  content: "";
  position: absolute;
  inset: 7px 4px;
  background: #1d1f35;
  clip-path: path(
    "M7 0C9 4 14 6 14 9.5C14 11.5 12.5 13 10.5 13C9.5 13 8.5 12.5 8 11.5L9.5 16H4.5L6 11.5C5.5 12.5 4.5 13 3.5 13C1.5 13 0 11.5 0 9.5C0 6 5 4 7 0Z"
  );
}
.sp-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  padding: 4px 12px 5px;
  border-radius: 999px;
  background: linear-gradient(180deg, #262739, #1d1e2d);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 3px 10px rgba(0, 0, 0, 0.25);
  line-height: 1.05;
}
.chip span {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.chip strong {
  font-size: 17px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}
.chip-score strong {
  color: var(--gold);
}
.chip.bump {
  animation: bump 0.32s ease;
}
@keyframes bump {
  40% {
    transform: scale(1.12);
  }
}

/* ---------- stage / tableau ---------- */
.sp-stage {
  position: relative;
}
.sp-tableau {
  position: relative;
  min-height: 300px;
  padding: 10px;
  border-radius: 20px;
  background:
    radial-gradient(
      120% 90% at 50% 0%,
      rgba(104, 66, 255, 0.22),
      transparent 60%
    ),
    radial-gradient(
      80% 60% at 50% 110%,
      rgba(59, 224, 193, 0.08),
      transparent 70%
    ),
    linear-gradient(180deg, #1d1e30, #171827);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    inset 0 0 0 1px rgba(255, 255, 255, 0.04),
    0 12px 36px rgba(0, 0, 0, 0.35);
  outline: none;
  isolation: isolate;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}
.sp-tableau.kbd:focus-visible {
  box-shadow:
    inset 0 0 0 2px var(--accent-2),
    0 12px 36px rgba(0, 0, 0, 0.35);
}
.slot {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--cw);
  height: var(--ch);
  border-radius: calc(var(--cw) * 0.1);
  border: 2px dashed rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.025);
  transition:
    border-color 0.15s,
    background 0.15s;
}
.slot.target {
  border-color: rgba(143, 115, 255, 0.55);
  background: rgba(104, 66, 255, 0.12);
}
.slot.drop,
.slot.hint {
  border-color: var(--mint);
  background: rgba(59, 224, 193, 0.14);
}
.sp-tableau.kbd:focus-visible .slot.cursor {
  border: 3px solid #fff;
}
.slot.warn {
  animation: warn 0.6s ease;
}
@keyframes warn {
  0%,
  100% {
    border-color: rgba(255, 255, 255, 0.1);
  }
  30%,
  70% {
    border-color: #ff5a6e;
    background: rgba(255, 90, 110, 0.18);
  }
}

/* ---------- cards ---------- */
.card {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--cw);
  height: var(--ch);
  transition: transform 0.24s cubic-bezier(0.2, 0.85, 0.3, 1);
  transform-origin: 0 0;
  will-change: transform;
  touch-action: none;
  cursor: pointer;
}
.no-anim .card,
.card.no-t,
.card.dragging {
  transition: none !important;
}
.card.dragging {
  cursor: grabbing;
}
.card.leaving {
  pointer-events: none;
  transition-duration: 0.45s;
}
.ci {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transform: perspective(700px) rotateY(180deg);
  transition: transform 0.34s ease;
}
.card.up .ci {
  transform: perspective(700px) rotateY(0deg);
}
.no-anim .ci {
  transition: none;
}
.cf,
.cb {
  position: absolute;
  inset: 0;
  border-radius: calc(var(--cw) * 0.11);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.cf {
  color: var(--suit);
  background: linear-gradient(180deg, #ffffff 0%, #f6f4fd 55%, #e9e5f8 100%);
  border: 1px solid rgba(30, 22, 80, 0.2);
  box-shadow:
    inset 0 1px 0 #fff,
    0 1px 2px rgba(0, 0, 0, 0.35),
    0 4px 10px rgba(0, 0, 0, 0.18);
  overflow: hidden;
}
.cb {
  transform: rotateY(180deg);
  background:
    radial-gradient(
      circle at 50% 50%,
      transparent 0 13%,
      rgba(255, 255, 255, 0.5) 13.5% 16%,
      transparent 16.5% 27%,
      rgba(255, 255, 255, 0.28) 27.5% 29.5%,
      transparent 30%
    ),
    repeating-conic-gradient(
      from 0deg at 50% 50%,
      rgba(255, 255, 255, 0.14) 0 2deg,
      transparent 2deg 45deg
    ),
    repeating-linear-gradient(
      45deg,
      rgba(255, 255, 255, 0.07) 0 3px,
      transparent 3px 7px
    ),
    linear-gradient(155deg, #9a7dff 0%, #6842ff 45%, #4020c8 100%);
  border: 1px solid rgba(20, 8, 70, 0.6);
  box-shadow:
    inset 0 0 0 max(2px, calc(var(--cw) * 0.05)) rgba(255, 255, 255, 0.92),
    inset 0 0 0 max(3px, calc(var(--cw) * 0.07)) #4a2bd6,
    0 1px 2px rgba(0, 0, 0, 0.4),
    0 4px 10px rgba(0, 0, 0, 0.2);
}
.idx {
  position: absolute;
  left: 7%;
  top: 2%;
  display: flex;
  align-items: center;
  gap: 1px;
  font-size: var(--fs);
  font-weight: 900;
  line-height: 1.15;
  letter-spacing: -0.06em;
}
.idx b {
  font-weight: 900;
}
.idx .is {
  width: calc(var(--fs) * 0.78);
  height: calc(var(--fs) * 0.78);
  margin-left: 1px;
}
.pip {
  position: absolute;
  left: 50%;
  top: 60%;
  width: 52%;
  height: 52%;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 1px 0 rgba(255, 255, 255, 0.7));
}
.ace .pip {
  width: 64%;
  height: 64%;
  top: 58%;
}
.court {
  position: absolute;
  left: 14%;
  right: 14%;
  top: 30%;
  bottom: 9%;
  display: grid;
  place-items: center;
  align-content: center;
  border-radius: calc(var(--cw) * 0.08);
  background:
    radial-gradient(
      120% 80% at 30% 10%,
      rgba(255, 255, 255, 0.9),
      transparent 55%
    ),
    linear-gradient(160deg, #fff4c9, #ffd66b);
  border: 1.5px solid var(--suit);
  box-shadow: inset 0 -2px 0 rgba(160, 100, 0, 0.18);
  line-height: 0.9;
}
.court b {
  font-size: calc(var(--cw) * 0.38);
  font-weight: 900;
}
.court .cs {
  width: calc(var(--cw) * 0.24);
  height: calc(var(--cw) * 0.24);
}

.card.sel .cf {
  box-shadow:
    0 0 0 2px var(--gold),
    0 0 14px 3px rgba(255, 216, 77, 0.55);
}
.card.sel .ci {
  top: -3px;
  bottom: 3px;
}
.card.drop .cf,
.card.hint .cf {
  box-shadow:
    0 0 0 2px var(--mint),
    0 0 14px 3px rgba(59, 224, 193, 0.55);
}
.card.hint .cf {
  animation: hintPulse 0.8s ease-in-out 3;
}
@keyframes hintPulse {
  50% {
    box-shadow:
      0 0 0 3px var(--mint),
      0 0 22px 6px rgba(59, 224, 193, 0.7);
  }
}
.sp-tableau.kbd:focus-visible .card.cursor .cf,
.sp-tableau.kbd:focus-visible .card.cursor .cb {
  box-shadow:
    0 0 0 2px #fff,
    0 0 0 5px var(--accent);
}
.card.dragging .cf {
  box-shadow:
    0 0 0 2px var(--gold),
    0 14px 28px rgba(0, 0, 0, 0.5);
}
.card.shake .cf,
.card.shake .cb {
  animation: shake 0.4s ease;
}
@keyframes shake {
  20% {
    transform: translateX(-5px);
  }
  40% {
    transform: translateX(5px);
  }
  60% {
    transform: translateX(-3px);
  }
  80% {
    transform: translateX(2px);
  }
}
.card.shake .cb {
  animation-name: shakeBack;
}
@keyframes shakeBack {
  0%,
  100% {
    transform: rotateY(180deg);
  }
  25% {
    transform: rotateY(180deg) translateX(-4px);
  }
  75% {
    transform: rotateY(180deg) translateX(4px);
  }
}
.card.land .cf {
  animation: land 0.3s ease;
}
@keyframes land {
  40% {
    transform: scale(1.07);
    filter: brightness(1.08);
  }
}

/* ---------- effects ---------- */
.sp-fx {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 40;
  transition: opacity 0.8s;
}
.sp-fx.fade {
  opacity: 0;
}
.float-text {
  position: absolute;
  z-index: 45;
  transform: translate(-50%, -50%);
  font-size: 30px;
  font-weight: 900;
  color: var(--gold);
  text-shadow:
    0 3px 0 #a86a00,
    0 6px 16px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  animation: floatUp 1.2s ease-out forwards;
}
@keyframes floatUp {
  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%, -190%) scale(1);
  }
}
.sp-toast {
  position: absolute;
  left: 50%;
  top: 12px;
  z-index: 30;
  transform: translate(-50%, -8px);
  max-width: calc(100% - 24px);
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(33, 34, 51, 0.95);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.4);
  font-size: 14px;
  font-weight: 800;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.2s,
    transform 0.2s;
}
.sp-toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}
.sp-toast.good {
  background: linear-gradient(180deg, #7c5cff, #5a36f0);
}
.sp-toast.bad {
  background: linear-gradient(180deg, #ff6b7d, #d93a52);
}

/* ---------- bottom bar ---------- */
.sp-bottom {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
}
.sp-foundation {
  --fo: 13px;
  position: relative;
  width: calc(var(--mw) + 7 * var(--fo));
  height: var(--mh);
}
.fnd {
  position: absolute;
  left: calc(var(--i) * var(--fo));
  top: 0;
  width: var(--mw);
  height: var(--mh);
  border-radius: 6px;
  border: 1.5px dashed rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.02);
}
.fnd.full {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 3px 4px;
  border: 1px solid rgba(30, 22, 80, 0.25);
  background: linear-gradient(180deg, #fff, #ebe7fa);
  color: var(--suit);
  box-shadow: -2px 0 4px rgba(0, 0, 0, 0.3);
  line-height: 1;
}
.fnd.full b {
  font-size: 13px;
  font-weight: 900;
}
.fnd.full .fs {
  width: 11px;
  height: 11px;
}
.fnd.pop {
  animation: fndPop 0.5s cubic-bezier(0.3, 1.6, 0.5, 1);
}
@keyframes fndPop {
  0% {
    transform: scale(0.4) translateY(-20px);
    opacity: 0;
  }
  100% {
    transform: none;
    opacity: 1;
  }
}
.sp-actions {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  min-width: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(180deg, #34354b, var(--secondary));
  color: var(--text);
  font: inherit;
  font-size: 15px;
  font-weight: 900;
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 3px 0 #17182a,
    0 6px 14px rgba(0, 0, 0, 0.25);
  transition:
    transform 0.1s,
    filter 0.15s;
}
.btn:hover:not(:disabled) {
  filter: brightness(1.12);
}
.btn:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 1px 0 #17182a;
}
.btn:disabled {
  opacity: 0.45;
  cursor: default;
}
.btn:focus-visible,
.sp-stock:focus-visible,
.mode:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 3px;
}
.btn-primary {
  background: linear-gradient(180deg, #8466ff, var(--accent));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.25),
    0 3px 0 #3d1fb0,
    0 8px 18px rgba(104, 66, 255, 0.35);
}
.btn-ghost {
  background: transparent;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.18);
}
.btn-ico {
  font-size: 17px;
  line-height: 1;
}
.btn-big {
  min-height: 54px;
  padding: 0 38px;
  font-size: 19px;
}
.sp-stock {
  --po: 9px;
  position: relative;
  min-width: 48px;
  min-height: 48px;
  width: calc(var(--mw) + 4 * var(--po) + 8px);
  height: calc(var(--mh) + 8px);
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  border-radius: 8px;
}
.stock-piles i {
  position: absolute;
  top: 4px;
  right: calc(4px + var(--i) * var(--po));
  width: var(--mw);
  height: var(--mh);
  border-radius: 6px;
  background:
    radial-gradient(
      circle at 50% 50%,
      transparent 0 14%,
      rgba(255, 255, 255, 0.5) 15% 18%,
      transparent 19%
    ),
    repeating-linear-gradient(
      45deg,
      rgba(255, 255, 255, 0.08) 0 3px,
      transparent 3px 6px
    ),
    linear-gradient(155deg, #9a7dff, #6842ff 50%, #4020c8);
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.9),
    inset 0 0 0 3px #4a2bd6,
    -2px 1px 4px rgba(0, 0, 0, 0.35);
  transition: transform 0.15s;
}
.sp-stock:hover:not(:disabled) .stock-piles i:last-child {
  transform: translateY(-3px);
}
.sp-stock:disabled {
  cursor: default;
}
.sp-stock.empty .stock-piles::before {
  content: "";
  position: absolute;
  top: 4px;
  right: 4px;
  width: var(--mw);
  height: var(--mh);
  border-radius: 6px;
  border: 1.5px dashed rgba(255, 255, 255, 0.16);
}
.sp-stock.blocked .stock-piles i {
  filter: saturate(0.45) brightness(0.75);
}
.stock-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--gold);
  color: #2a1e00;
  font-size: 13px;
  font-weight: 900;
  line-height: 22px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  z-index: 2;
}
.sp-stock.empty .stock-badge {
  background: #3a3b52;
  color: var(--muted);
}
.sp-stock.hint {
  animation: stockHint 0.8s ease-in-out 3;
}
@keyframes stockHint {
  50% {
    transform: scale(1.1);
    filter: drop-shadow(0 0 10px var(--mint));
  }
}
.sp-stock.shake {
  animation: stockShake 0.45s ease;
}
@keyframes stockShake {
  25% {
    transform: translateX(-6px) rotate(-3deg);
  }
  50% {
    transform: translateX(6px) rotate(3deg);
  }
  75% {
    transform: translateX(-3px);
  }
}

.sp-help {
  margin: 0;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.5;
}
kbd {
  display: inline-block;
  min-width: 18px;
  margin: 0 1px;
  padding: 0 4px;
  border-radius: 5px;
  background: var(--secondary);
  color: #fff;
  font: inherit;
  font-size: 11px;
  text-align: center;
  box-shadow: 0 2px 0 #151626;
}

/* ---------- overlay ---------- */
.sp-overlay {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 12px;
  border-radius: 20px;
  background: rgba(12, 12, 28, 0.62);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity 0.25s;
}
.sp-overlay.show {
  opacity: 1;
}
.sp-overlay[hidden] {
  display: none;
}
.sp-overlay[data-kind="win"] {
  background: rgba(12, 12, 28, 0.4);
}
.sp-card {
  width: min(420px, 100%);
  max-height: 100%;
  overflow: auto;
  padding: 20px 20px 18px;
  border-radius: 24px;
  text-align: center;
  background: linear-gradient(180deg, #25263a, var(--panel));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 24px 60px rgba(0, 0, 0, 0.55);
  animation: cardIn 0.4s cubic-bezier(0.25, 1.4, 0.5, 1);
}
@keyframes cardIn {
  from {
    transform: scale(0.85) translateY(12px);
    opacity: 0;
  }
}
.sp-card h2 {
  margin: 6px 0 4px;
  font-size: clamp(24px, 5vw, 30px);
  font-weight: 900;
  letter-spacing: -0.02em;
  background: linear-gradient(180deg, #fff, #c9bdff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.sp-card p {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}
.sp-card-art {
  position: relative;
  height: 74px;
  margin: 0 auto;
  width: 130px;
}
.art-card {
  position: absolute;
  top: 6px;
  left: 44px;
  width: 44px;
  height: 62px;
  border-radius: 7px;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.45);
}
.art-card.a1 {
  transform: rotate(-16deg) translateX(-30px);
  background:
    radial-gradient(
      circle at 50% 50%,
      transparent 0 14%,
      rgba(255, 255, 255, 0.5) 15% 18%,
      transparent 19%
    ),
    repeating-linear-gradient(
      45deg,
      rgba(255, 255, 255, 0.08) 0 3px,
      transparent 3px 6px
    ),
    linear-gradient(155deg, #9a7dff, #6842ff 50%, #4020c8);
  box-shadow:
    inset 0 0 0 2px #fff,
    inset 0 0 0 3px #4a2bd6,
    0 8px 18px rgba(0, 0, 0, 0.45);
}
.art-card.a2,
.art-card.a3 {
  background: linear-gradient(180deg, #fff, #ebe7fa);
}
.art-card.a2 {
  transform: rotate(0deg) translateY(-4px);
}
.art-card.a3 {
  transform: rotate(16deg) translateX(30px);
}
.art-card.a2::before,
.art-card.a3::before {
  position: absolute;
  left: 5px;
  top: 3px;
  font-weight: 900;
  font-size: 15px;
}
.art-card.a2::before {
  content: "K";
  color: #1d1f35;
}
.art-card.a3::before {
  content: "A";
  color: #e3264f;
}
.art-card.a2::after,
.art-card.a3::after {
  content: "";
  position: absolute;
  left: 11px;
  top: 22px;
  width: 22px;
  height: 22px;
  background: currentColor;
}
.art-card.a2::after {
  color: #1d1f35;
  clip-path: path(
    "M11 1C14 6 21 9 21 14C21 17 19 19 16 19C14.5 19 13 18 12 17L13 21H9L10 17C9 18 7.5 19 6 19C3 19 1 17 1 14C1 9 8 6 11 1Z"
  );
}
.art-card.a3::after {
  color: #e3264f;
  clip-path: path(
    "M11 20C5 15 1 12 1 7.5C1 4 3.5 1.5 6.5 1.5C8.5 1.5 10 2.7 11 4.5C12 2.7 13.5 1.5 15.5 1.5C18.5 1.5 21 4 21 7.5C21 12 17 15 11 20Z"
  );
}
.sp-modes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 4px 0 8px;
}
.mode {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-height: 44px;
  padding: 10px 4px 9px;
  border: 0;
  border-radius: 16px;
  background: linear-gradient(180deg, #2f3046, #26273a);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.06),
    0 3px 0 #17182a;
  transition:
    transform 0.12s,
    box-shadow 0.15s;
}
.mode b {
  font-size: 15px;
  font-weight: 900;
}
.mode small {
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
}
.mode[aria-checked="true"] {
  background: linear-gradient(180deg, #3b2f86, #2d2466);
  box-shadow:
    inset 0 0 0 2px var(--accent-2),
    0 3px 0 #1b1450,
    0 6px 18px rgba(104, 66, 255, 0.35);
}
.mode[aria-checked="true"] small {
  color: #d9d0ff;
}
.mode-suits {
  display: flex;
  gap: 1px;
  height: 22px;
  align-items: center;
}
.mode-suits i {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  background: #fff;
  color: var(--suit);
}
.ms {
  width: 14px;
  height: 14px;
}
.sp-card p.sp-modestats {
  min-height: 1.4em;
  margin: 0 0 14px;
  font-size: 12px;
}
.sp-results {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin: 0 0 14px;
}
.sp-results div {
  padding: 8px 4px;
  border-radius: 14px;
  background: var(--panel-2);
}
.sp-results dt {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.sp-results dd {
  margin: 2px 0 0;
  font-size: 19px;
  font-weight: 900;
  color: var(--gold);
}
.sp-card-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* ---------- responsive ---------- */
@media (max-width: 640px) {
  body {
    padding: 8px;
  }
  .sp-hud {
    justify-content: center;
  }
  .sp-title {
    font-size: 18px;
  }
  .chip {
    min-width: 0;
    flex: 1;
    padding: 3px 8px 4px;
  }
  .sp-chips {
    width: 100%;
    flex-wrap: nowrap;
  }
  .chip strong {
    font-size: 15px;
  }
  .sp-tableau {
    padding: 6px;
    border-radius: 14px;
  }
  :root {
    --mw: 32px;
    --mh: 45px;
  }
  .sp-foundation {
    --fo: 7px;
  }
  .sp-stock {
    --po: 5px;
  }
  .btn {
    padding: 0 12px;
  }
  .btn-txt {
    display: none;
  }
  .sp-bottom {
    gap: 6px;
  }
  .sp-actions {
    gap: 6px;
  }
  .sp-help {
    font-size: 11px;
  }
  .sp-results dd {
    font-size: 16px;
  }
}
@media (max-width: 360px) {
  .sp-title {
    font-size: 16px;
  }
  .chip span {
    font-size: 9px;
  }
  .sp-foundation {
    --fo: 5px;
  }
  .btn {
    padding: 0 10px;
  }
  .mode b {
    font-size: 13px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0ms !important;
  }
}
