/* Spider — navy felt with a spun web. game.js places every card; --cw and --ch are the card size. */
.sp-table {
  position: absolute;
  top: 2px; right: 4px; bottom: 2px; left: 4px;
  max-width: 940px;
  margin: 0 auto;
  border-radius: 16px;
  background:
    repeating-radial-gradient(circle at 50% 0, transparent 0 37px, rgba(255, 241, 214, 0.05) 37px 38px),
    repeating-conic-gradient(from 90deg at 50% 0, rgba(255, 241, 214, 0.05) 0 0.35deg, transparent 0.35deg 15deg),
    radial-gradient(130% 100% at 50% 30%, transparent 50%, rgba(5, 10, 22, 0.55)),
    #1A3D73;
  box-shadow: inset 0 0 0 1px rgba(255, 196, 61, 0.34), inset 0 0 0 4px rgba(11, 22, 43, 0.35), 0 10px 30px rgba(0, 0, 0, 0.3);
  direction: ltr;
  overflow: hidden;
  isolation: isolate;
}
.sp-board { position: absolute; top: 9px; right: 5px; bottom: 7px; left: 5px; --cw: 28px; --ch: 39px; }

.sp-slot, .sp-card {
  position: absolute;
  top: 0; left: 0;
  width: var(--cw);
  height: var(--ch);
  padding: 0;
  border-radius: calc(var(--cw) * 0.12);
}
.sp-slot {
  box-sizing: border-box;
  border: 1.5px solid rgba(255, 241, 214, 0.14);
  background: rgba(11, 22, 43, 0.24);
}
.sp-slot.is-runs { width: calc(var(--cw) * 4.5); border: 1.5px dashed rgba(255, 196, 61, 0.42); background: rgba(11, 22, 43, 0.34); }
.sp-slot.is-stock { border-color: rgba(255, 241, 214, 0.3); }

.sp-card {
  border: 0;
  background: linear-gradient(160deg, #FFFDF6, #FFF1D6 70%, #F4E2BF);
  box-shadow: 0 0 0 1px rgba(11, 22, 43, 0.55), 0 2px 3px rgba(5, 10, 22, 0.35);
  color: #13233F;
  font-family: var(--font-text);
  cursor: pointer;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
  transition: transform 0.28s var(--ease-out, cubic-bezier(0.2, 0.8, 0.2, 1)), filter 0.2s;
}
.sp-card.is-red { color: #D62F32; }
.sp-card.is-stuck { filter: brightness(0.8) saturate(0.85); }
.sp-still .sp-card, .sp-card.is-drag { transition: none; }
.sp-card.is-drag { box-shadow: 0 0 0 1px rgba(11, 22, 43, 0.5), 0 10px 18px rgba(5, 10, 22, 0.5); }
.sp-card:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }

/* the back: red with a little web; it fades away when a card turns over */
.sp-card::after {
  content: "";
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  border-radius: inherit;
  background:
    repeating-radial-gradient(circle at 50% 0, transparent 0 4px, rgba(255, 241, 214, 0.34) 4px 5px),
    repeating-conic-gradient(from 90deg at 50% 0, rgba(255, 241, 214, 0.3) 0 3deg, transparent 3deg 30deg),
    linear-gradient(160deg, #EE4A4D, #B9262A);
  box-shadow: inset 0 0 0 2px #FFF1D6, inset 0 0 0 3px rgba(11, 22, 43, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s;
  transition-delay: inherit;
}
.sp-card.is-down::after { opacity: 1; }
.sp-card.is-down { cursor: default; }
.sp-still .sp-card::after { transition: none; }

/* one large index, readable when only a sliver shows */
.sp-ix {
  position: absolute;
  top: calc(var(--cw) * 0.04); left: 0; right: 0;
  display: flex; align-items: center; justify-content: center;
  line-height: 1;
  pointer-events: none;
}
.sp-ix b { font-size: calc(var(--cw) * 0.6); font-weight: 800; letter-spacing: -0.06em; }
.sp-ix b.is-ten { letter-spacing: -0.12em; margin-left: -0.08em; }
.sp-ix i { display: none; font-style: normal; font-size: calc(var(--cw) * 0.36); margin-left: calc(var(--cw) * 0.05); }
.sp-pip {
  position: absolute;
  left: 0; right: 0; bottom: calc(var(--ch) * 0.03);
  text-align: center;
  font-size: calc(var(--cw) * 0.62);
  line-height: 1.1;
  pointer-events: none;
}
.sp-card.is-face .sp-pip {
  left: 14%; right: 14%; bottom: 7%;
  border: 1.5px solid currentColor;
  border-radius: calc(var(--cw) * 0.1);
  background: rgba(255, 196, 61, 0.42);
  font-family: var(--font-display);
  font-size: calc(var(--cw) * 0.4);
  line-height: 1.45;
}
/* wide cards have room for the suit beside the rank */
@media (min-width: 620px) {
  .sp-ix { justify-content: flex-start; left: calc(var(--cw) * 0.08); }
  .sp-ix b { font-size: calc(var(--cw) * 0.42); }
  .sp-ix i { display: block; }
}

/* the house spider hangs between the finished runs and the stock */
.sp-spider {
  position: absolute;
  top: -9px; left: 60%;
  width: calc(var(--cw) * 0.95);
  min-width: 26px;
  height: calc(var(--ch) * 0.92);
  z-index: 2000;
  pointer-events: none;
  display: flex; align-items: flex-end;
  transform: translateX(-50%);
}
.sp-spider::before {
  content: "";
  position: absolute;
  left: 50%; top: -400px; bottom: 60%;
  width: 1.5px; margin-left: -0.75px;
  background: rgba(255, 241, 214, 0.7);
}
.sp-spider svg { position: relative; display: block; width: 100%; height: auto; }
@keyframes sp-drop {
  0%, 100% { transform: translate(-50%, 0); }
  30% { transform: translate(-50%, calc(var(--ch) * 2.2)); }
  42% { transform: translate(-50%, calc(var(--ch) * 1.9)); }
  56% { transform: translate(-50%, calc(var(--ch) * 2.2)); }
}
.sp-spider.is-drop { animation: sp-drop 1.5s cubic-bezier(0.3, 0.1, 0.3, 1); }

@keyframes sp-no { 0%, 100% { margin-left: 0; } 25% { margin-left: -3px; } 75% { margin-left: 3px; } }
.sp-card.is-no { animation: sp-no 0.22s linear; }

@media (prefers-reduced-motion: reduce) {
  .sp-card, .sp-card::after { transition: none; }
  .sp-card.is-no, .sp-spider.is-drop { animation: none; }
}
