/* ===== Spireling — game-specific styles =====
   Chrome (bar, glass, modals, toast) comes from shared/css/glass.css.
   This file re-tints the shell to the ember palette and lays out the arena,
   the hand, the reward flow and the climb strip. All state lives in spireling.js. */

:root {
  --accent-1: #ffb347;
  --accent-2: #ff6b5e;
  --on-accent: #1b0b06;
  --bg-1: #1a0f22;
  --bg-2: #07040b;
  --bg-glow-a: rgba(255, 150, 70, .20);
  --bg-glow-b: rgba(255, 90, 110, .12);
  --gold: #ffd166;
  /* One number drives the whole card scale. It grows with the viewport but is
     capped by 16vh so a tall desktop fills its space while a short laptop
     window never overflows vertically. Every card metric derives from --cw. */
  --cw: clamp(122px, min(13vw, 16vh), 172px);
  --card-h: calc(var(--cw) * 1.377);
}

/* Class-level display rules would beat the UA [hidden] rule otherwise. */
[hidden] { display: none !important; }

/* ---------- Ember sky ----------
   The shell is translucent, so the page itself carries the backdrop: a low
   furnace glow, drifting sparks and the spire's shadow. Kept on pseudo
   elements so the game needs no extra markup. */
.sp-page::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(58% 42% at 50% 112%, rgba(255, 132, 52, .30), transparent 72%),
    radial-gradient(34% 30% at 84% 6%, rgba(255, 84, 122, .16), transparent 74%),
    radial-gradient(40% 34% at 8% 20%, rgba(126, 78, 255, .12), transparent 76%),
    linear-gradient(180deg, #150b1d 0%, #0b0612 52%, #06030a 100%);
}
.sp-page::after {
  content: "";
  position: fixed;
  inset: -20% 0 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle, rgba(255, 190, 110, .85) 0 1px, transparent 1.7px),
    radial-gradient(circle, rgba(255, 120, 90, .55) 0 1.1px, transparent 1.8px);
  background-size: 320px 320px, 190px 190px;
  background-position: 0 0, 90px 40px;
  opacity: .20;
  animation: spSparks 24s linear infinite;
}
@keyframes spSparks {
  from { background-position: 0 0, 90px 40px; }
  to { background-position: 18px -320px, 74px -150px; }
}
.c-app { position: relative; z-index: 1; }
/* The shared shell paints a striped gradient across the viewport; the spire
   needs its own sky, so drop it here and let the page layer show through. */
.sp-page .c-app { background: transparent; }
.gc-back { z-index: 2; }

/* A dim spire silhouette and its furnace haze, fixed behind the app. */
.sp-sky {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.sp-sky__tower {
  position: absolute;
  left: 50%;
  bottom: -4%;
  width: min(92vw, 1040px);
  height: 86%;
  transform: translateX(-50%);
  background:
    repeating-linear-gradient(180deg, transparent 0 26px, rgba(255, 190, 120, .12) 26px 28px),
    linear-gradient(180deg, rgba(255, 170, 100, .20), rgba(255, 120, 80, .09) 46%, transparent 84%);
  clip-path: polygon(48% 0, 51% 8%, 55% 20%, 57% 42%, 62% 100%, 38% 100%, 43% 42%, 45% 20%, 49% 8%);
  filter: drop-shadow(0 0 44px rgba(255, 140, 70, .18));
  opacity: .95;
}
.sp-sky__tower::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 16%;
  width: 12px;
  height: 12px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(circle, #ffe6a8, rgba(255, 150, 70, .35) 55%, transparent 72%);
  box-shadow: 0 0 26px rgba(255, 170, 80, .5);
}
.sp-sky__haze {
  position: absolute;
  left: 50%;
  bottom: -24%;
  width: 92vw;
  height: 62vh;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 130, 50, .20), transparent 75%);
}

.c-app { --fpad: clamp(10px, 3vw, 28px); }
/* align-items: stretch lets the wrap fill the table's height, so the arena can
   grow to consume the vertical space instead of leaving a dead band above or
   below it. A too-tall board still scrolls from its top edge (min-height:auto).
   The bottom padding reserves room for the fixed .gc-back chip so the climb
   strip never slides under it when the arena stretches to the viewport base. */
.c-table {
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding-bottom: 52px;
}

/* The shared back chip is a light pill; tint it for the dark arena. */
.gc-back {
  border-color: rgba(255, 255, 255, .18);
  background: rgba(18, 9, 20, .62);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #ffe9d6;
  box-shadow: 0 2px 12px rgba(0, 0, 0, .45);
  opacity: .85;
}
.gc-back:hover { color: #fff; opacity: 1; }

/* ---------- Frame ---------- */
.sp-wrap {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  width: min(96vw, 760px);
  margin: 0 auto;
}
/* A roomy desktop gets a real table width instead of a phone column. */
@media (min-width: 1000px) {
  .sp-wrap { width: min(94vw, 1200px); }
}

.sp-arena {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  gap: 12px;
  padding: 18px;
  border-radius: 24px;
  overflow: hidden;
  background:
    radial-gradient(120% 90% at 82% -10%, rgba(255, 150, 80, .18), transparent 60%),
    radial-gradient(90% 70% at 12% 110%, rgba(120, 70, 255, .10), transparent 70%),
    linear-gradient(168deg, rgba(48, 24, 34, .82), rgba(13, 8, 18, .90));
  border: 1px solid rgba(255, 168, 108, .22);
  box-shadow:
    0 22px 60px rgba(0, 0, 0, .55),
    inset 0 1px 0 rgba(255, 255, 255, .10),
    inset 0 0 0 1px rgba(0, 0, 0, .18);
}
/* Furnace haze and the spire's silhouette, painted behind the fight. */
.sp-arena::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(30% 46% at 86% 62%, rgba(255, 140, 60, .22), transparent 70%),
    radial-gradient(24% 30% at 10% 88%, rgba(255, 90, 120, .12), transparent 72%);
}
.sp-arena::after {
  content: "";
  position: absolute;
  right: 3%;
  top: -6%;
  width: 46%;
  height: 96%;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 154, 84, .17), rgba(255, 120, 90, .05) 58%, transparent);
  clip-path: polygon(46% 0, 54% 12%, 62% 22%, 66% 44%, 72% 100%, 20% 100%, 26% 44%, 30% 22%, 38% 12%);
  opacity: .75;
}

/* ---------- Enemy ---------- */
.sp-foe {
  position: relative;
  display: flex;
  align-items: center;
  gap: 18px;
  /* On a tall screen the arena grows; this pushes the surplus into the space
     between the foe and the player cluster, so the enemy holds the top of the
     arena and your hero/hand anchor to the bottom (a real battler layout). */
  margin-bottom: auto;
  padding: 12px 20px 12px 12px;
  border-radius: 20px;
  background:
    linear-gradient(90deg, rgba(255, 110, 90, .12), rgba(12, 6, 16, .18) 55%),
    radial-gradient(70% 120% at 14% 50%, rgba(255, 120, 80, .14), transparent 70%);
  border: 1px solid rgba(255, 120, 100, .20);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06);
}
.sp-foe.is-boss { border-color: rgba(255, 110, 80, .34); }
.sp-foe__art {
  position: relative;
  flex: none;
  width: 142px;
  height: 130px;
  display: grid;
  place-items: center;
}
.sp-foe__art::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 52%;
  width: 126px;
  height: 126px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 130, 90, .30), transparent 68%);
  animation: spAura 3.4s ease-in-out infinite;
}
.sp-foe.is-boss .sp-foe__art::before {
  background: radial-gradient(circle, rgba(255, 150, 70, .42), transparent 68%);
}
.sp-foe__art::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 104px;
  height: 18px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 120, 70, .40), transparent 78%);
}
.sp-foe__art svg {
  position: relative;
  z-index: 1;
  width: 106px;
  height: 106px;
  display: block;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, .45)) drop-shadow(0 0 10px rgba(255, 120, 80, .35));
  animation: spBob 3.2s ease-in-out infinite;
}
@keyframes spBob {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-5px) scale(1.012); }
}
@keyframes spAura {
  0%, 100% { opacity: .7; transform: translate(-50%, -50%) scale(.94); }
  50% { opacity: 1; transform: translate(-50%, -50%) scale(1.06); }
}
.sp-foe.is-lunge { animation: spLunge .42s ease; }
@keyframes spLunge {
  0%, 100% { transform: none; }
  28% { transform: translateY(6px) scale(.985); }
  55% { transform: translateY(-10px) scale(1.015); }
}
.sp-foe__meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.sp-foe__top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.sp-foe__name {
  font-size: 17.5px;
  font-weight: 800;
  letter-spacing: -.01em;
  color: #fff1e2;
}
.sp-foe__hd { font-size: 11.5px; color: var(--c-muted); font-weight: 600; }

/* Intent chip */
.sp-intent {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  border: 1px solid rgba(255, 255, 255, .14);
  color: #ffe6d6;
  background: rgba(255, 255, 255, .06);
}
.sp-intent__ico { display: inline-flex; opacity: .9; }
.sp-intent__ico svg { width: 15px; height: 15px; display: block; }
.sp-intent--atk {
  color: #ffc0b2;
  border-color: rgba(255, 95, 109, .48);
  background: rgba(255, 95, 109, .16);
}
.sp-intent--def {
  color: #b6dcff;
  border-color: rgba(110, 178, 255, .45);
  background: rgba(110, 178, 255, .14);
}
.sp-intent--buf {
  color: #ecc0ff;
  border-color: rgba(206, 130, 255, .45);
  background: rgba(206, 130, 255, .14);
}
.sp-intent--atk.is-heavy {
  border-color: rgba(255, 95, 109, .68);
  animation: spIntentPulse 1.6s ease-in-out infinite;
}
@keyframes spIntentPulse {
  0%, 100% { box-shadow: 0 0 8px rgba(255, 80, 90, .18); }
  50% { box-shadow: 0 0 18px rgba(255, 80, 90, .45); }
}

/* ---------- Bars ---------- */
.sp-bar {
  position: relative;
  height: 20px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .46);
  border: 1px solid rgba(255, 255, 255, .10);
  overflow: hidden;
}
/* Tick marks turn the fill into readable segments. */
.sp-bar::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: repeating-linear-gradient(90deg,
    transparent 0 calc(10% - 1px),
    rgba(6, 3, 10, .42) calc(10% - 1px) 10%);
}
.sp-bar i {
  position: absolute;
  top: 0; bottom: 0; left: 0;
  border-radius: 999px;
  transition: width .28s ease;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .30);
}
.sp-bar--foe i { background: linear-gradient(90deg, #ff4d6a, #ff9f5c); }
.sp-bar--hero i { background: linear-gradient(90deg, #45d99b, #b9f36a); }
.sp-bar span {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .02em;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .8);
  font-variant-numeric: tabular-nums;
}

/* ---------- Status tags ---------- */
.sp-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-height: 0;
}
.sp-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  color: #f6e6d6;
  background: rgba(255, 255, 255, .07);
  border: 1px solid rgba(255, 255, 255, .10);
  white-space: nowrap;
}
.sp-tag b { color: #fff; }
.sp-tag__ico { display: inline-flex; opacity: .8; }
.sp-tag__ico svg { width: 11px; height: 11px; display: block; }
.sp-tag--str { color: #ffcaa6; border-color: rgba(255, 160, 90, .40); background: rgba(255, 140, 70, .12); }
.sp-tag--dex { color: #b8ecff; border-color: rgba(110, 200, 255, .38); background: rgba(90, 180, 255, .12); }
.sp-tag--vuln { color: #ffb0b0; border-color: rgba(255, 110, 110, .40); background: rgba(255, 90, 90, .12); }
.sp-tag--weak { color: #d6c7ff; border-color: rgba(170, 140, 255, .40); background: rgba(150, 120, 255, .12); }
.sp-tag--poison { color: #b6f5a8; border-color: rgba(120, 220, 110, .40); background: rgba(100, 200, 90, .12); }
.sp-tag--rage { color: #ffb066; border-color: rgba(255, 140, 60, .50); background: rgba(255, 120, 50, .14); }
.sp-tag--thorns { color: #d7ffb0; border-color: rgba(170, 230, 120, .42); background: rgba(140, 210, 90, .12); }

/* ---------- Hero ---------- */
.sp-hero {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 14px 10px 12px;
  border-radius: 18px;
  background:
    linear-gradient(150deg, rgba(255, 200, 110, .09), rgba(10, 6, 14, .30)),
    radial-gradient(60% 120% at 8% 50%, rgba(255, 180, 90, .12), transparent 70%);
  border: 1px solid rgba(255, 210, 150, .16);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06);
}
.sp-orb {
  flex: none;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  align-content: center;
  line-height: 1;
  background:
    radial-gradient(circle at 36% 28%, #ffe9a8, #ffb347 46%, #c46a1c 100%);
  color: #2a1400;
  box-shadow:
    0 0 18px rgba(255, 172, 70, .45),
    inset 0 -3px 8px rgba(120, 50, 0, .45),
    inset 0 2px 4px rgba(255, 255, 255, .55);
  border: 1px solid rgba(255, 235, 180, .7);
  animation: spOrb 3.2s ease-in-out infinite;
}
@keyframes spOrb {
  0%, 100% { box-shadow: 0 0 18px rgba(255, 172, 70, .42), inset 0 -3px 8px rgba(120, 50, 0, .45), inset 0 2px 4px rgba(255, 255, 255, .55); }
  50% { box-shadow: 0 0 28px rgba(255, 190, 90, .62), inset 0 -3px 8px rgba(120, 50, 0, .45), inset 0 2px 4px rgba(255, 255, 255, .55); }
}
.sp-orb b { font-size: 24px; font-weight: 900; font-variant-numeric: tabular-nums; }
.sp-orb small { font-size: 8.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; opacity: .72; }
.sp-hero__meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 7px; }
.sp-hero__top { display: flex; align-items: center; gap: 8px; }
.sp-hero__name { font-size: 15px; font-weight: 800; color: #fff2e0; }
.sp-shield {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 800;
  color: #cfeaff;
  background: rgba(90, 170, 255, .16);
  border: 1px solid rgba(120, 190, 255, .42);
  white-space: nowrap;
}
.sp-shield b { color: #fff; }
.sp-relics {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  justify-content: flex-end;
  max-width: 112px;
}
.sp-relic {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 40% 30%, rgba(255, 220, 150, .30), rgba(30, 18, 30, .9));
  border: 1px solid rgba(255, 200, 120, .40);
  box-shadow: 0 0 8px rgba(255, 180, 90, .18);
}
.sp-relic svg { width: 16px; height: 16px; display: block; }

/* ---------- Flask belt ---------- */
.sp-belt {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 2px;
}
.sp-belt::before {
  content: "Flasks";
  margin-right: 2px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: rgba(255, 220, 190, .45);
}
.sp-flask {
  --fc: #ffb347;
  appearance: none;
  font: inherit;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 13px 5px 8px;
  border-radius: 999px;
  color: #ffe9d2;
  background: linear-gradient(165deg, color-mix(in srgb, var(--fc) 22%, rgba(18, 10, 26, .82)), rgba(12, 7, 18, .9));
  border: 1px solid color-mix(in srgb, var(--fc) 46%, rgba(255, 255, 255, .12));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12), 0 4px 12px rgba(0, 0, 0, .35);
  cursor: pointer;
  transition: transform .14s ease, box-shadow .14s ease, filter .14s ease;
}
.sp-flask.is-ember { --fc: #ff8a5c; }
.sp-flask.is-iron { --fc: #6fb6ff; }
.sp-flask.is-vital { --fc: #58e08a; }
.sp-flask.is-storm { --fc: #ffd166; }
.sp-flask.is-venom { --fc: #8fe06a; }
.sp-flask.is-fury { --fc: #ff6b9a; }
.sp-flask__ico { display: inline-flex; color: var(--fc); }
.sp-flask__ico svg { width: 18px; height: 18px; display: block; }
.sp-flask__name { font-size: 12px; font-weight: 800; letter-spacing: .02em; }
.sp-flask.is-empty {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .03);
  border: 1px dashed rgba(255, 255, 255, .12);
  box-shadow: none;
  cursor: default;
}
.sp-belt:not(.is-live) .sp-flask:not(.is-empty) { opacity: .5; filter: saturate(.6); pointer-events: none; }
.sp-belt.is-live .sp-flask:not(.is-empty):hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(0, 0, 0, .4), 0 0 0 1px color-mix(in srgb, var(--fc) 55%, transparent);
}
.sp-belt.is-live .sp-flask:not(.is-empty):active { transform: translateY(0) scale(.97); }

/* ---------- Hand ---------- */
.sp-hand {
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  gap: 10px;
  min-height: calc(var(--card-h) + 24px);
  /* The row scrolls sideways, so the browser clips it vertically too. The top
     padding is the headroom .sp-card:hover grows into (11.8px at scale 1.07). */
  padding: 24px 6px 10px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 190, 120, .3) transparent;
}
/* Two zero-basis spacers take up the slack, so a short hand stays centred while
   a big hand overflows from the left where the scroller can actually reach it. */
.sp-hand::before,
.sp-hand::after {
  content: "";
  flex: 1 1 0;
  min-width: 0;
  align-self: stretch;
}
.sp-hand::-webkit-scrollbar { height: 5px; }
.sp-hand::-webkit-scrollbar-thumb { background: rgba(255, 190, 120, .28); border-radius: 99px; }
/* The empty state is the one place the spacers must stand down. */
.sp-hand:empty::before { display: none; }
.sp-hand:empty::after {
  content: "No cards left in hand";
  flex: 0 0 auto;
  align-self: center;
  color: var(--c-muted);
  font-size: 12.5px;
}

.sp-card {
  --ct: #ff7a6b;
  --ch: 24;
  position: relative;
  flex: 0 0 auto;
  width: var(--cw);
  height: calc(var(--cw) * 1.377);
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: calc(var(--cw) * .0738) calc(var(--cw) * .0738) calc(var(--cw) * .0656);
  border-radius: calc(var(--cw) * .123);
  text-align: left;
  font: inherit;
  color: #f8eee2;
  cursor: pointer;
  appearance: none;
  overflow: hidden;
  transform: rotate(var(--rot, 0deg)) translateY(var(--dy, 0px));
  transform-origin: 50% 118%;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .09), transparent 30%),
    linear-gradient(168deg, color-mix(in srgb, var(--ct) 16%, #241528), #100a18 76%);
  border: 1px solid color-mix(in srgb, var(--ct) 45%, rgba(255, 255, 255, .10));
  box-shadow:
    0 10px 18px rgba(0, 0, 0, .42),
    inset 0 1px 0 rgba(255, 255, 255, .14);
  transition: transform .16s cubic-bezier(.2, .8, .3, 1.2), box-shadow .16s ease, opacity .14s ease, border-color .16s ease;
}
/* Light sweeps across the card on hover. */
.sp-card::after {
  content: "";
  position: absolute;
  top: -60%;
  left: -80%;
  width: 55%;
  height: 220%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .20), transparent);
  transform: rotate(16deg);
  transition: left .5s ease;
  pointer-events: none;
}
.sp-card:hover::after { left: 135%; }
.sp-card:hover,
.sp-card:focus-visible {
  /* Grow, never move: straightening and lifting pulled the card out from under
     the cursor, so hovering an edge made :hover flip on and off. The offset
     turns the 1.07 scale into one anchored on the card's bottom edge: the 118%
     pivot sits 18% below the base, so the correction is 0.07 x 0.18 x height =
     --cw x .01735 (2.12px at the 122px base). */
  transform: rotate(var(--rot, 0deg)) translateY(calc(var(--dy, 0px) + var(--cw) * .01735)) scale(1.07);
  z-index: 5;
  border-color: color-mix(in srgb, var(--ct) 75%, #fff 10%);
  box-shadow:
    0 18px 30px rgba(0, 0, 0, .5),
    0 0 0 1px color-mix(in srgb, var(--ct) 65%, transparent),
    0 0 26px color-mix(in srgb, var(--ct) 30%, transparent);
  outline: none;
}
.sp-card:active {
  transform: rotate(var(--rot, 0deg)) translateY(calc(var(--dy, 0px) + var(--cw) * .00743)) scale(1.03);
}
.sp-card.is-off { opacity: .42; filter: saturate(.55); }
.sp-card.is-off:hover {
  transform: rotate(var(--rot, 0deg)) translateY(var(--dy, 0px));
  box-shadow: 0 10px 18px rgba(0, 0, 0, .42), inset 0 1px 0 rgba(255, 255, 255, .14);
}
.sp-card.is-off:hover::after { left: -80%; }
.sp-card--attack { --ct: #ff7a6b; }
.sp-card--skill { --ct: #6fb6ff; }
.sp-card--power { --ct: #c98bff; }

.sp-card__cost {
  position: absolute;
  top: calc(var(--cw) * .0574);
  left: calc(var(--cw) * .0574);
  z-index: 2;
  width: calc(var(--cw) * .2213);
  height: calc(var(--cw) * .2213);
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: calc(var(--cw) * .1025);
  font-weight: 900;
  color: #2a1400;
  background: radial-gradient(circle at 36% 28%, #ffeaa8, #ffb347 58%, #d1832a);
  border: 1px solid rgba(255, 240, 200, .8);
  box-shadow: 0 2px 6px rgba(0, 0, 0, .45);
}
.sp-card__art {
  position: relative;
  display: grid;
  place-items: center;
  height: calc(var(--cw) * .4918);
  margin: calc(var(--cw) * -.0738) calc(var(--cw) * -.0738) 1px;
  border-bottom: 1px solid color-mix(in srgb, var(--ct) 24%, transparent);
  background:
    radial-gradient(80% 90% at 50% 108%, hsla(var(--ch), 85%, 60%, .22), transparent 70%),
    linear-gradient(180deg, hsla(var(--ch), 60%, 30%, .18), transparent 80%);
  overflow: hidden;
}
.sp-card__art::before {
  content: "";
  position: absolute;
  width: calc(var(--cw) * .4426);
  height: calc(var(--cw) * .4426);
  border-radius: 50%;
  border: 1px solid hsla(var(--ch), 90%, 72%, .20);
  background: radial-gradient(circle, hsla(var(--ch), 90%, 60%, .12), transparent 70%);
}
.sp-card__halo {
  position: absolute;
  left: 50%;
  bottom: calc(var(--cw) * -.2295);
  width: calc(var(--cw) * .7541);
  height: calc(var(--cw) * .7541);
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(circle, hsla(var(--ch), 90%, 64%, .38), transparent 68%);
}
.sp-card__glyph {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: hsla(var(--ch), 90%, 76%, 1);
  filter: drop-shadow(0 0 8px hsla(var(--ch), 90%, 60%, .45));
}
.sp-card__glyph svg { width: calc(var(--cw) * .3033); height: calc(var(--cw) * .3033); display: block; }
.sp-card__name {
  font-size: calc(var(--cw) * .1025);
  font-weight: 800;
  letter-spacing: -.01em;
  line-height: 1.15;
  color: #fff4e6;
}
.sp-card__text {
  font-size: calc(var(--cw) * .0943);
  line-height: 1.36;
  color: #e3d5c6;
}
.sp-card__text b { color: #fff; font-weight: 900; }
.sp-card__mark {
  position: absolute;
  right: calc(var(--cw) * -.082);
  bottom: calc(var(--cw) * .082);
  width: calc(var(--cw) * .6885);
  height: calc(var(--cw) * .6885);
  color: hsla(var(--ch), 92%, 70%, .07);
  pointer-events: none;
  z-index: 0;
}
.sp-card__mark svg { width: 100%; height: 100%; }
.sp-card__name,
.sp-card__text,
.sp-card__foot { position: relative; z-index: 1; }
.sp-card__foot {
  margin-top: auto;
  padding-top: calc(var(--cw) * .0328);
  border-top: 1px solid color-mix(in srgb, var(--ct) 18%, transparent);
  font-size: calc(var(--cw) * .0738);
  font-weight: 800;
  letter-spacing: .10em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--ct) 80%, #fff);
  opacity: .85;
}
.sp-card__plus {
  position: absolute;
  top: calc(var(--cw) * .0328);
  right: calc(var(--cw) * .0492);
  font-size: calc(var(--cw) * .0902);
  font-weight: 900;
  color: var(--gold);
}

/* Deal-in stagger. The class is only set when a fresh hand hits the table, so
   playing a card does not replay the animation for the whole hand. */
.sp-hand.is-dealt .sp-card {
  animation: spDeal .42s cubic-bezier(.2, .8, .3, 1.1) backwards;
  animation-delay: calc(var(--i, 0) * 45ms);
}
@keyframes spDeal {
  from { opacity: 0; transform: rotate(var(--rot, 0deg)) translateY(26px) scale(.9); }
  to { opacity: 1; transform: rotate(var(--rot, 0deg)) translateY(var(--dy, 0px)) scale(1); }
}

/* Card being played: a streak of light from the hand to the foe. */
.sp-bolt {
  position: fixed;
  z-index: 60;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(circle at 40% 35%, #fff6d8, #ffb347 45%, #ff5f6b 78%, transparent 82%);
  box-shadow: 0 0 18px rgba(255, 160, 80, .8), 0 0 40px rgba(255, 100, 90, .45);
}
.sp-bolt::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 60%;
  width: 70px;
  height: 4px;
  transform: translateY(-50%);
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, rgba(255, 170, 90, .55));
}
.sp-bolt--skill {
  background: radial-gradient(circle at 40% 35%, #eaf7ff, #6fb6ff 45%, #7a6bff 78%, transparent 82%);
  box-shadow: 0 0 18px rgba(110, 182, 255, .75), 0 0 40px rgba(120, 107, 255, .4);
}
.sp-bolt--power {
  background: radial-gradient(circle at 40% 35%, #fff0ff, #c98bff 45%, #ff6bd6 78%, transparent 82%);
  box-shadow: 0 0 18px rgba(201, 139, 255, .75), 0 0 40px rgba(255, 107, 214, .38);
}

/* ---------- Turn footer ---------- */
.sp-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 2px;
}
.sp-pile {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--c-muted);
  white-space: nowrap;
}
.sp-pile b { color: #ffe9cc; font-variant-numeric: tabular-nums; }
.sp-end {
  appearance: none;
  font: inherit;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: .01em;
  padding: 10px 34px;
  border-radius: 999px;
  cursor: pointer;
  color: #2a1400;
  background: linear-gradient(180deg, #ffe1a0, #ffb347 62%, #e2912f);
  border: 1px solid rgba(255, 240, 200, .75);
  box-shadow:
    0 6px 18px rgba(255, 160, 60, .28),
    inset 0 1px 0 rgba(255, 255, 255, .55);
  transition: transform .12s ease, box-shadow .12s ease, filter .12s ease;
}
.sp-end:hover { filter: brightness(1.06); box-shadow: 0 8px 24px rgba(255, 160, 60, .38), inset 0 1px 0 rgba(255, 255, 255, .6); }
.sp-end:active { transform: translateY(1px); }
.sp-end.is-wait { filter: saturate(.4) brightness(.8); cursor: default; }

/* ---------- Climb strip ---------- */
.sp-route {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2px;
  padding: 8px 11px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(22, 12, 28, .72), rgba(10, 6, 16, .55));
  border: 1px solid rgba(255, 200, 150, .14);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), 0 6px 16px rgba(0, 0, 0, .25);
  overflow: hidden;
}
.sp-route::before {
  content: "";
  position: absolute;
  left: 24px;
  right: 24px;
  top: 50%;
  height: 2px;
  transform: translateY(-50%);
  background: linear-gradient(90deg, rgba(255, 170, 100, .35), rgba(255, 120, 100, .20) 72%, transparent);
}
.sp-node {
  position: relative;
  flex: 1 1 0;
  max-width: 34px;
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: rgba(255, 200, 160, .30);
  background: radial-gradient(circle at 40% 30%, rgba(40, 22, 44, .95), rgba(12, 7, 18, .98));
  border: 1px solid rgba(255, 255, 255, .07);
  box-shadow: 0 0 0 3px rgba(8, 5, 12, .55);
  transition: background .2s ease, color .2s ease, border-color .2s ease;
}
.sp-node svg { width: 17px; height: 17px; display: block; }
.sp-node.is-done {
  color: rgba(255, 190, 130, .75);
  background: radial-gradient(circle at 40% 30%, #3a2018, #180c12);
  border-color: rgba(255, 160, 90, .25);
}
.sp-node.is-camp { color: #ffb45c; border-color: rgba(255, 160, 80, .35); }
.sp-node.is-boss {
  color: #ff7a72;
  border-color: rgba(255, 90, 90, .45);
  box-shadow: 0 0 0 3px rgba(8, 5, 12, .55), 0 0 12px rgba(255, 80, 80, .18);
}
.sp-node.is-now {
  color: #2a1400;
  background: linear-gradient(165deg, #ffe1a0, #ffab3d);
  border-color: rgba(255, 245, 210, .85);
  box-shadow: 0 0 0 3px rgba(255, 180, 80, .18), 0 0 18px rgba(255, 175, 70, .55);
}
.sp-node.is-now.is-boss { border-color: rgba(255, 230, 200, .85); }
.sp-node.is-now::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 1px solid rgba(255, 190, 100, .45);
  animation: spNow 2.2s ease-out infinite;
}
@keyframes spNow {
  0% { opacity: .8; transform: scale(.85); }
  100% { opacity: 0; transform: scale(1.35); }
}

/* ---------- Floating numbers ---------- */
.sp-float {
  position: absolute;
  right: 20px;
  top: 10px;
  z-index: 5;
  font-size: 19px;
  font-weight: 900;
  letter-spacing: -.02em;
  pointer-events: none;
  color: #ff9a8a;
  text-shadow: 0 2px 8px rgba(0, 0, 0, .75);
  animation: spFloat .85s ease-out forwards;
}
.sp-float--block { color: #8fd0ff; }
.sp-float--heal { color: #7ff0a8; }
.sp-float--poison { color: #a8f08f; }
.sp-float--buff { color: #e0b6ff; }
@keyframes spFloat {
  0% { opacity: 0; transform: translateY(8px) scale(.82); }
  22% { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-34px) scale(1.04); }
}
.is-hit { animation: spShake .32s ease; }
@keyframes spShake {
  0%, 100% { transform: translateX(0); }
  18% { transform: translateX(-5px); }
  42% { transform: translateX(4px); }
  66% { transform: translateX(-3px); }
  84% { transform: translateX(2px); }
}
.is-heal { animation: spHeal .5s ease; }
@keyframes spHeal {
  0%, 100% { box-shadow: none; }
  40% { box-shadow: 0 0 22px rgba(120, 240, 160, .35); }
}

/* ---------- Flow cards (rewards, campfire, relics) ---------- */
/* Modal cards keep the fixed base scale; only the in-arena hand grows with the
   viewport, so --cw is pinned here and the fluid value stays with the arena. */
.sp-flow { width: min(94vw, 640px); --cw: 122px; }
.sp-flow .c-modal__body { padding-bottom: 10px; }
/* No action row? Don't leave an empty bordered strip behind the card. */
.sp-flow .c-modal__foot:empty { display: none; }
.sp-rewards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  justify-items: center;
  margin: 8px 0 2px;
}
.sp-rewards .sp-card { width: 100%; max-width: 148px; }
.sp-opts { display: grid; gap: 9px; margin: 8px 0 2px; }
.sp-opt {
  appearance: none;
  font: inherit;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 13px;
  cursor: pointer;
  color: #fff0e0;
  background: linear-gradient(160deg, rgba(255, 180, 100, .10), rgba(18, 10, 22, .55));
  border: 1px solid rgba(255, 190, 130, .22);
  transition: border-color .14s ease, transform .14s ease, background .14s ease;
}
.sp-opt:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 205, 150, .5);
  background: linear-gradient(160deg, rgba(255, 180, 100, .16), rgba(18, 10, 22, .55));
}
.sp-opt__glyph {
  flex: none;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: var(--gold);
  background: rgba(255, 170, 80, .10);
  border: 1px solid rgba(255, 190, 120, .25);
}
.sp-opt__glyph svg { width: 21px; height: 21px; display: block; }
.sp-opt__name { display: block; font-size: 14px; font-weight: 800; }
.sp-opt__desc { display: block; font-size: 12px; line-height: 1.45; color: var(--c-muted); margin-top: 2px; }
.sp-opt.is-off { opacity: .45; cursor: default; }
.sp-opt.is-off:hover { transform: none; border-color: rgba(255, 190, 130, .22); }

.sp-forge {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 8px;
  margin: 8px 0 4px;
}
.sp-forge .sp-card { width: 100%; height: 164px; }
.sp-forge .sp-card__art { height: 52px; }
.sp-forge .sp-card__glyph svg { width: 28px; height: 28px; }
.sp-empty { margin: 10px 0; color: var(--c-muted); font-size: 13px; }

.sp-end-screen { text-align: center; padding: 6px 0 2px; }
.sp-end-screen__mark { color: var(--gold); }
.sp-end-screen__mark svg { width: 62px; height: 62px; display: block; margin: 0 auto 4px; }
.sp-end-screen h3 { margin: 2px 0 4px; font-size: 22px; color: #fff4e6; letter-spacing: -.01em; text-transform: none; }
.sp-end-screen__sub { margin: 0 0 12px; font-size: 13px; color: var(--c-muted); }
.sp-end-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 0 0 6px;
}
.sp-end-stats div {
  padding: 9px 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, .045);
  border: 1px solid rgba(255, 255, 255, .08);
}
.sp-end-stats b { display: block; font-size: 19px; color: #fff; font-variant-numeric: tabular-nums; }
.sp-end-stats span { font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--c-muted); }

/* ---------- Route modal ---------- */
.sp-map-panel { width: min(94vw, 520px); }
.sp-map { display: grid; gap: 6px; margin: 4px 0 12px; }
.sp-map__row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 11px;
  border-radius: 10px;
  background: rgba(255, 255, 255, .035);
  border: 1px solid rgba(255, 255, 255, .06);
  color: var(--c-muted);
  font-size: 12.5px;
}
.sp-map__row.is-now { border-color: rgba(255, 190, 110, .5); background: rgba(255, 170, 80, .10); color: #fff3e2; }
.sp-map__row.is-done { opacity: .55; }
.sp-map__n {
  flex: none;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  font-size: 11px;
  font-weight: 800;
  background: rgba(255, 255, 255, .06);
  color: #ffe9cc;
}
.sp-map__ic { flex: none; display: grid; place-items: center; color: var(--gold); }
.sp-map__ic svg { width: 16px; height: 16px; }
.sp-map__name { flex: 1; min-width: 0; font-weight: 700; }
.sp-map__state { font-size: 10.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--c-muted); }

/* ---------- Rules modal sizing ---------- */
.sp-rules-panel { width: min(94vw, 590px); }

/* ---------- Small screens ---------- */
@media (max-width: 620px) {
  /* Compact the shared bar so four buttons stay on one row. */
  .sp-page .c-bar { padding: 8px 12px; gap: 8px 10px; }
  .sp-page .c-bar__title { font-size: 15px; }
  .sp-page .c-bar__controls { gap: 6px; }
  .sp-page .c-bar__controls .c-btn { padding: 6px 9px; font-size: 12px; }
  .sp-page .c-bar__stats { gap: 13px; font-size: 12.5px; }

  .c-table { padding-bottom: 52px; }
  .sp-wrap { width: min(96vw, 520px); gap: 8px; }
  .sp-arena { padding: 10px; gap: 8px; border-radius: 18px; }
  .sp-foe { gap: 10px; padding: 8px 10px 8px 8px; border-radius: 14px; }
  .sp-foe__art { width: 88px; height: 82px; }
  .sp-foe__art::before { width: 82px; height: 82px; }
  .sp-foe__art::after { width: 66px; }
  .sp-foe__art svg { width: 70px; height: 70px; }
  .sp-foe__name { font-size: 14.5px; }
  .sp-intent { font-size: 10.5px; padding: 3px 8px 3px 6px; }
  .sp-intent__ico svg { width: 12px; height: 12px; }
  .sp-hero { gap: 9px; padding: 7px 10px 7px 8px; border-radius: 13px; }
  .sp-orb { width: 48px; height: 48px; }
  .sp-orb b { font-size: 18px; }
  .sp-relics { max-width: 54px; }
  .sp-belt { gap: 5px; min-height: 28px; }
  .sp-belt::before { display: none; }
  .sp-flask { gap: 4px; padding: 3px 8px 3px 6px; }
  .sp-flask__ico svg { width: 14px; height: 14px; }
  .sp-flask__name { font-size: 10px; }
  .sp-flask.is-empty { width: 26px; height: 26px; }
  .sp-hand {
    justify-content: flex-start;
    align-items: flex-end;
    gap: 6px;
    min-height: 142px;
    padding: 8px 2px 2px;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
  }
  .sp-hand::-webkit-scrollbar { display: none; }
  .sp-card {
    width: 92px;
    height: 124px;
    padding: 6px 6px 5px;
    border-radius: 11px;
    transform: none;
    transform-origin: 50% 100%;
    scroll-snap-align: start;
  }
  .sp-card:hover,
  .sp-card:focus-visible,
  .sp-card:active { transform: scale(1.04); }
  .sp-card.is-off:hover { transform: none; }
  .sp-card__art { height: 40px; margin: -6px -6px 1px; }
  .sp-card__art::before { width: 36px; height: 36px; }
  .sp-card__glyph svg { width: 26px; height: 26px; }
  .sp-card__name { font-size: 11px; }
  .sp-card__text { font-size: 9.5px; line-height: 1.28; }
  .sp-card__foot { font-size: 7.5px; }
  .sp-card__cost { top: 4px; left: 4px; width: 22px; height: 22px; font-size: 11px; }
  .sp-foot { gap: 8px; }
  .sp-end { padding: 8px 22px; font-size: 13px; }
  .sp-pile { font-size: 10px; }
  .sp-route { padding: 5px 7px; gap: 2px; }
  .sp-node { max-width: 26px; }
  .sp-node svg { width: 13px; height: 13px; }
  .sp-rewards { gap: 7px; }
  .sp-rewards .sp-card { height: 132px; }
  .sp-forge .sp-card { height: 132px; }
  .sp-flow .c-modal__foot .c-btn { flex: 1; }
  .sp-floater-right { right: 10px; }
}

@media (max-width: 400px) {
  .sp-card { width: 84px; height: 116px; }
  .sp-card__art { height: 36px; }
  .sp-card__text { font-size: 9px; }
  .sp-rewards .sp-card { height: 128px; }
  .sp-foe__art { width: 76px; height: 72px; }
  .sp-foe__art::before { width: 70px; height: 70px; }
  .sp-foe__art svg { width: 60px; height: 60px; }
  .sp-end-stats b { font-size: 17px; }
}
