﻿/* Shared stone card face — same as Legends Lab */
:root {
  --legend: #d4a84b;
  --legend-dim: rgba(212, 168, 75, 0.45);
  --ritual: #a56bff;
  --ritual-dim: rgba(165, 107, 255, 0.4);
  --spell: #2ec4b6;
  --spell-dim: rgba(46, 196, 182, 0.4);
  --token: #9aa4b2;
  --token-dim: rgba(154, 164, 178, 0.45);
  --curse: #b03040;
  --curse-dim: rgba(176, 48, 64, 0.45);
  --font-display: "Cinzel", "Times New Roman", serif;
  --font-deco: "Cinzel Decorative", "Cinzel", serif;
  --font-body: "Cormorant Garamond", "Palatino Linotype", serif;
  --card-w: 300px;
  --card-h: 420px;
}
.hidden { display: none !important; }

/* Playtest board: scale full stone cards into zone size */
.stone-card.pt-stone {
  /* design size always 300x420; parent scales via --stone-scale */
  width: var(--card-w);
  height: var(--card-h);
  transform: scale(var(--stone-scale, 0.38));
  transform-origin: top left;
  flex-shrink: 0;
  cursor: grab;
  pointer-events: auto;
}
.stone-card.pt-stone:active { cursor: grabbing; }
.stone-card.pt-stone.dragging { opacity: 0.65; }
.stone-card.pt-stone.face-back-only .stone-inner {
  /* hide face content, show back pattern via overlay */
}

.stone-scale-wrap {
  width: calc(var(--card-w) * var(--stone-scale, 0.38));
  height: calc(var(--card-h) * var(--stone-scale, 0.38));
  position: relative;
  flex-shrink: 0;
}
.stone-scale-wrap > .stone-card {
  position: absolute;
  top: 0;
  left: 0;
}
.stone-card.card-back .stone-inner {
  background-color: #3a342e;
  background-image:
    repeating-linear-gradient(45deg, #2a2622 0 8px, #332e2a 8px 16px),
    linear-gradient(165deg, rgba(255,255,255,0.08), transparent 50%);
  display: grid;
  place-items: center;
}
.stone-card.card-back .stone-inner > * { display: none !important; }
.stone-card.card-back .stone-inner::after {
  content: "⚔";
  display: grid;
  place-items: center;
  font-size: 3rem;
  color: var(--legend);
  z-index: 2;
  position: absolute;
  inset: 0;
}
/* ===== STONE CARD ===== */
.stone-card {
  --trim: var(--legend);
  --trim-dim: var(--legend-dim);
  --trim-deep: #8a6918;
  --ink: var(--legend); /* engraved text / symbols match type */
  position: relative;
  width: var(--card-w);
  height: var(--card-h);
  border-radius: 10px;
  background: #5a5854;
  border: none;
  box-shadow:
    0 18px 40px rgba(0, 0, 0, 0.48),
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    inset 0 -1px 3px rgba(0, 0, 0, 0.35);
  padding: 3px;
}
/* gladiator = main unit type (was "legend") */
.stone-card.type-gladiator,
.stone-card.type-legend {
  --trim: var(--legend);
  --trim-dim: var(--legend-dim);
  --trim-deep: #8a6918;
  --ink: #c9a24a;
}
.stone-card.type-token {
  --trim: var(--token);
  --trim-dim: var(--token-dim);
  --trim-deep: #5a6470;
  --ink: #c8d0dc;
}
.stone-card.type-ritual {
  --trim: var(--ritual);
  --trim-dim: var(--ritual-dim);
  --trim-deep: #5a2a9a;
  --ink: #b48cff;
}
.stone-card.type-spell,
.stone-card.type-curse,
.stone-card.type-trap {
  --trim: var(--spell);
  --trim-dim: var(--spell-dim);
  --trim-deep: #0e6e66;
  --ink: #3dd6c6;
}
/* Counter spells use the old trap red engraving */
.stone-card.type-spell.kind-counter {
  --trim: var(--curse);
  --trim-dim: var(--curse-dim);
  --trim-deep: #6a1820;
  --ink: #e06070;
}
.stone-card.no-cost .cost-fan,
.stone-card .cost-fan.hidden {
  display: none !important;
}

.stone-inner {
  position: relative;
  z-index: 1;
  height: 100%;
  border-radius: 8px;
  overflow: hidden;
  /*
   * Stylized painted stone (not photo rock):
   * soft grey base + light painted texture + clean chip overlay.
   */
  background-color: #6c6862;
  background-image:
    linear-gradient(165deg, rgba(255, 255, 255, 0.1) 0%, transparent 42%, rgba(0, 0, 0, 0.12) 100%),
    url("assets/stone-stylized.jpg");
  background-size: auto, cover;
  background-position: center, center;
  background-blend-mode: soft-light, normal;
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.2),
    inset 0 2px 8px rgba(255, 255, 255, 0.07),
    inset 0 -4px 12px rgba(0, 0, 0, 0.16);
  display: grid;
  grid-template-rows: auto minmax(0, 1.15fr) minmax(0, 0.9fr);
  padding: 0.4rem 0.5rem 0.3rem;
  gap: 0.18rem;
}
.stone-inner > * {
  z-index: 1;
}
/* Edge chips + flecks as a designed overlay (not random noise blobs) */
.stone-inner::before {
  content: "";
  pointer-events: none;
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: inherit;
  background: url("assets/stone-chips.svg") center / 100% 100% no-repeat;
  opacity: 0.9;
  mix-blend-mode: multiply;
}
/* Soft top light / depth wash only */
.stone-inner::after {
  content: "";
  pointer-events: none;
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: inherit;
  background:
    radial-gradient(ellipse 85% 50% at 50% 0%, rgba(255, 255, 255, 0.12), transparent 55%),
    radial-gradient(ellipse 70% 40% at 50% 100%, rgba(0, 0, 0, 0.14), transparent 60%);
  opacity: 1;
}

/* Engraved text helper */
.engrave {
  color: #1a1612;
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.12),
    0 -1px 0 rgba(0, 0, 0, 0.55);
}

/*
 * Draw-skip cost: 1â€“3 mini card faces fanned top-left.
 * 1 = upright Â· 2 = slight fan Â· 3 = wider fan (like a hand)
 */
.cost-fan {
  position: absolute;
  /* nudged up + right so cost-3 fan clears outer lip and art */
  top: 0.12rem;
  left: 0.55rem;
  z-index: 5;
  width: 2.7rem;
  height: 2.35rem;
  pointer-events: none;
}
.cost-card {
  position: absolute;
  left: 0;
  top: 0.1rem;
  width: 1.05rem;
  height: 1.5rem;
  border-radius: 2px;
  background:
    linear-gradient(155deg, rgba(255, 255, 255, 0.12), transparent 45%),
    color-mix(in srgb, var(--ink) 18%, #5a5650);
  border: 1.15px solid color-mix(in srgb, var(--ink) 70%, #1a1612);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.1),
    inset 0 0 0 1px rgba(0, 0, 0, 0.15);
  transform-origin: 50% 100%;
  opacity: 0;
  visibility: hidden;
}
.cost-card::after {
  content: "";
  position: absolute;
  inset: 18% 16%;
  border: 1px solid color-mix(in srgb, var(--ink) 35%, transparent);
  border-radius: 1px;
  opacity: 0.75;
}

.cost-fan[data-cost="1"] .cost-card-1,
.cost-fan[data-cost="2"] .cost-card-1,
.cost-fan[data-cost="2"] .cost-card-2,
.cost-fan[data-cost="3"] .cost-card-1,
.cost-fan[data-cost="3"] .cost-card-2,
.cost-fan[data-cost="3"] .cost-card-3 {
  opacity: 1;
  visibility: visible;
}

.cost-fan[data-cost="1"] .cost-card-1 {
  left: 0.65rem;
  top: 0.12rem;
  transform: rotate(0deg);
  z-index: 3;
}

.cost-fan[data-cost="2"] .cost-card-1 {
  left: 0.35rem;
  top: 0.2rem;
  transform: rotate(-12deg);
  z-index: 2;
}
.cost-fan[data-cost="2"] .cost-card-2 {
  left: 0.9rem;
  top: 0.12rem;
  transform: rotate(11deg);
  z-index: 3;
}

.cost-fan[data-cost="3"] .cost-card-1 {
  left: 0.2rem;
  top: 0.28rem;
  transform: rotate(-18deg);
  z-index: 1;
}
.cost-fan[data-cost="3"] .cost-card-2 {
  left: 0.65rem;
  top: 0.1rem;
  transform: rotate(0deg);
  z-index: 2;
}
.cost-fan[data-cost="3"] .cost-card-3 {
  left: 1.1rem;
  top: 0.26rem;
  transform: rotate(17deg);
  z-index: 3;
}

/* Rank badge â€” top-right, clear of art */
.rank-badge {
  position: absolute;
  top: 0.02rem;
  right: 0.18rem;
  z-index: 5;
  width: 2.15rem;
  height: 2.05rem;
  display: grid;
  place-items: center;
}
.rank-badge.hidden { display: none; }

/*
 * Spell kind badge: Continuous = ∞ · Equip = shield · Counter = circular arrows
 */
.kind-badge {
  position: absolute;
  top: 0.08rem;
  right: 0.22rem;
  z-index: 5;
  width: 2.05rem;
  height: 2.05rem;
  display: grid;
  place-items: center;
  pointer-events: none;
  color: var(--ink);
  filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.45));
}
.kind-badge.hidden { display: none; }
.kind-icon {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}
.kind-ring {
  fill: color-mix(in srgb, var(--ink) 14%, #3a3632);
  stroke: var(--ink);
  stroke-width: 2.4;
}
.kind-symbol {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
}
.kind-symbol.hidden { display: none !important; }
.kind-infinity {
  font-family: var(--font-deco), "Segoe UI Symbol", "Arial Unicode MS", sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1;
  color: var(--ink);
  transform: translateY(-0.02rem);
}
.shield-svg {
  width: 1.05rem;
  height: 1.05rem;
  display: block;
  overflow: visible;
}
.shield-body {
  fill: color-mix(in srgb, var(--ink) 78%, #fff 22%);
  stroke: var(--ink);
  stroke-width: 2;
  stroke-linejoin: round;
}
.shield-boss {
  fill: none;
  stroke: var(--ink);
  stroke-width: 2;
  stroke-linecap: round;
}
.counter-svg {
  width: 1.1rem;
  height: 1.1rem;
  display: block;
  overflow: visible;
}
.counter-arc {
  fill: none;
  stroke: var(--ink);
  stroke-width: 2.4;
  stroke-linecap: round;
}
.counter-head {
  fill: var(--ink);
  stroke: none;
}
.rank-icon {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.45));
}
.rank-tri {
  fill: color-mix(in srgb, var(--ink) 22%, #5a5650);
  stroke: var(--ink);
  stroke-width: 1.8;
}
.rank-num {
  position: relative;
  z-index: 1;
  font-family: var(--font-deco);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink);
  margin-top: 0.28rem;
  text-align: center;
  text-shadow:
    0 1px 0 rgba(0, 0, 0, 0.45),
    0 0 6px var(--trim-dim);
}

.card-nameplate {
  padding: 0.12rem 2.4rem 0.08rem 2.6rem;
  text-align: center;
  min-height: 1.45rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.card-name {
  margin: 0;
  width: 100%;
  font-family: var(--font-deco);
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.15;
  text-align: center;
  color: var(--ink);
  /* Thin black outline */
  -webkit-text-stroke: 0.6px #000;
  paint-order: stroke fill;
  text-shadow:
    -0.6px -0.6px 0 #000,
    0.6px -0.6px 0 #000,
    -0.6px 0.6px 0 #000,
    0.6px 0.6px 0 #000;
}

.art-frame {
  position: relative;
  margin: 0 0.35rem;
  border-radius: 4px;
  /* shallow recess only â€” no glowing trim frame */
  border: 1px solid rgba(0, 0, 0, 0.45);
  box-shadow:
    inset 0 2px 8px rgba(0, 0, 0, 0.45),
    0 1px 0 rgba(255, 255, 255, 0.06);
  background: #1a1612;
  overflow: hidden;
  min-height: 0;
}
.art-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}
.art-img.hidden { display: none; }
.art-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  text-align: center;
  color: color-mix(in srgb, var(--ink) 45%, rgba(200, 190, 170, 0.35));
  font-family: var(--font-display);
  letter-spacing: 0.12em;
  font-size: 0.65rem;
}
.art-glyph { font-size: 1.6rem; opacity: 0.55; color: var(--ink); }
.art-frame.has-art .art-placeholder { display: none; }

.lower-stack {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
  gap: 0;
  z-index: 3;
}

/*
 * Power sword â€” bottom-left of the card.
 * Blade points down and is clipped by stone-inner overflow (card edge).
 */
.power-sword {
  position: absolute;
  left: 0.15rem;
  bottom: -1.85rem; /* tip cut off by card bottom */
  width: 3.6rem;
  height: 6.2rem;
  z-index: 7; /* above text so blade/number stay readable */
  pointer-events: none;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.45));
}
.power-sword.hidden { display: none; }
.sword-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.sword-metal {
  fill: color-mix(in srgb, var(--ink) 35%, #7a756c);
  stroke: color-mix(in srgb, var(--ink) 55%, #1f1c18);
  stroke-width: 1.05;
}
.sword-grip {
  fill: #3a342e;
  stroke: #14110e;
  stroke-width: 0.8;
}
.sword-blade {
  fill: color-mix(in srgb, var(--ink) 28%, #9a958c);
  stroke: color-mix(in srgb, var(--ink) 50%, #1f1c18);
  stroke-width: 1.05;
}
.sword-fuller {
  stroke: color-mix(in srgb, var(--ink) 40%, rgba(25, 22, 18, 0.55));
  stroke-width: 2;
}
/* Power on the visible blade above the card edge cut */
.power-num {
  position: absolute;
  left: 50%;
  top: 2.65rem;
  transform: translateX(-50%);
  z-index: 4;
  font-family: var(--font-deco);
  font-size: 1.55rem;
  font-weight: 800;
  line-height: 1;
  color: #000;
  text-align: center;
  text-shadow: none;
  letter-spacing: 0.02em;
}

.text-box {
  position: relative;
  z-index: 4;
  margin: 0 0.35rem 0.1rem;
  padding: 0.55rem 0.55rem 0.4rem;
  border-radius: 3px;
  border: 1px solid color-mix(in srgb, var(--ink) 28%, rgba(0, 0, 0, 0.55));
  background: #2c2a28;
  box-shadow:
    inset 0 2px 10px rgba(0, 0, 0, 0.4),
    0 -1px 0 color-mix(in srgb, var(--ink) 25%, transparent);
  min-height: 0;
  overflow: hidden;
  flex: 1;
  /* block (not flex) so the sword shape-outside float works */
  display: block;
  text-align: center;
}
/*
 * Bottom band only: slim clear so text can sit right next to the blade.
 * Matching left + right floats (must precede .card-text) so text-align:center
 * still sits mid-box; left clears the blade, right mirrors for balance.
 */
.sword-clear {
  display: none;
  /* Blade is much narrower than the full sword asset (~3.6rem) */
  width: 1.35rem;
  height: 100%;
  shape-outside: polygon(
    0 70%,
    100% 70%,
    100% 100%,
    0 100%
  );
  shape-margin: 0.05rem;
  pointer-events: none;
}
.stone-card:not(.no-power) .sword-clear {
  display: block;
}
.stone-card:not(.no-power) .sword-clear-left {
  float: left;
}
.stone-card:not(.no-power) .sword-clear-right {
  float: right;
}
.stone-card.no-power .sword-clear {
  display: none;
}
.card-text {
  display: block;
  margin: 0;
  font-family: var(--font-body);
  font-size: 1.05rem;
  font-weight: 500;
  line-height: 1.28;
  color: color-mix(in srgb, var(--ink) 55%, #d8d0c4);
  text-align: center;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  word-break: normal;
  box-sizing: border-box;
  /* --text-vpad set by JS: top strut centers the block without killing sword floats */
  --text-vpad: 0px;
}
/* Full-width strut so line boxes still wrap around sword clears (inline-level). */
.card-text::before {
  content: "";
  display: inline-block;
  width: 100%;
  height: var(--text-vpad, 0px);
  vertical-align: top;
  pointer-events: none;
}

/* Type label under description */
.type-footer {
  flex-shrink: 0;
  text-align: center;
  padding: 0.2rem 0.35rem 0.15rem;
  margin: 0 0.2rem;
}
.type-footer span {
  font-family: var(--font-display);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.4);
}

/* Spells / curses: no sword */
.stone-card.no-power .stone-inner {
  grid-template-rows: auto minmax(0, 1.25fr) minmax(0, 1fr);
}
.stone-card.no-power .power-sword { display: none; }
.stone-card.no-power .text-box { padding-top: 0.55rem; }


