/* Wager Cards — the physical deck: card faces, flip, piles, chips, mirror. */

.wc-stage { position: relative; min-width: 0; min-height: 0; display: grid; }
.wc-slot {
  container-type: size;
  display: grid; place-items: center;
  min-height: 0; height: 100%;
  padding: 4px 0;
}

.wc-card {
  container-type: inline-size;
  position: relative;
  width: min(100cqw, calc((100cqh - 8px) * 0.714), 440px);
  aspect-ratio: 5 / 7;
  perspective: 1800px;
  cursor: default;
  will-change: transform, opacity;
}
.wc-app[data-phase="claim"] .wc-card:not(.is-flipped),
.wc-app[data-phase="open"] .wc-card:not(.is-flipped),
.wc-app[data-phase="mirror"] .wc-card:not(.is-flipped) { cursor: pointer; }

.wc-card-inner {
  position: absolute; inset: 0;
  transform-style: preserve-3d;
  transition: transform 0.5s cubic-bezier(0.25, 0.8, 0.25, 1);
}
.wc-card.is-flipped .wc-card-inner { transform: rotateY(180deg); }
.wc-card.no-anim .wc-card-inner { transition: none; }

.wc-face {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  border-radius: 18px;
  background: var(--paper);
  border: 1px solid rgba(0, 0, 0, 0.09);
  box-shadow:
    0 1px 1px rgba(0, 0, 0, 0.04),
    0 2px 6px rgba(0, 0, 0, 0.05),
    0 18px 44px rgba(0, 0, 0, 0.11);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  overflow: hidden;
}
/* a fine inset frame, like a printed card */
.wc-face::before {
  content: ""; position: absolute; inset: 9px;
  border: 1px solid rgba(0, 0, 0, 0.07);
  border-radius: 12px;
  pointer-events: none;
}
.wc-face--back { transform: rotateY(180deg); background: #fff; }

/* corner indices */
.wc-corner {
  position: absolute;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
}
.wc-corner svg { width: 14px; height: 14px; }
.wc-corner span { writing-mode: vertical-rl; transform: rotate(180deg); }
.wc-corner--tl { top: 20px; left: 18px; }
.wc-corner--br { bottom: 20px; right: 18px; transform: rotate(180deg); }
.wc-card[data-kind="claim"] .wc-corner { color: var(--blue); }
.wc-card[data-kind="open"] .wc-corner { color: var(--amber-ink); }
.wc-card[data-kind="mirror"] .wc-corner { color: #48484a; }

.wc-face-body {
  flex: 1; display: flex; flex-direction: column; justify-content: center;
  padding: 0 clamp(40px, 13cqw, 58px);
}
.wc-kind {
  margin: 0 0 clamp(10px, 4cqw, 18px);
  font-size: clamp(10.5px, 2.9cqw, 12px); font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
}
.wc-kind--claim { color: var(--blue); }
.wc-kind--open { color: var(--amber-ink); }
.wc-kind--mirror { color: #48484a; }
.wc-statement {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(19px, 6.6cqw, 30px);
  font-weight: 500;
  line-height: 1.22;
  letter-spacing: -0.012em;
  color: var(--ink);
  text-wrap: pretty;
  font-variant-numeric: lining-nums;
}
.wc-face-foot {
  display: flex; justify-content: space-between;
  margin: 0; padding: 0 clamp(40px, 13cqw, 58px) 22px;
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint);
}

/* ---------- the answer side ---------- */
.wc-back-scroll {
  position: relative; flex: 1; min-height: 0;
  overflow-y: auto;
  padding: clamp(20px, 7cqw, 30px) clamp(20px, 7.5cqw, 32px) 26px;
  scrollbar-width: thin;
  -webkit-mask-image: linear-gradient(#000 calc(100% - 26px), transparent);
  mask-image: linear-gradient(#000 calc(100% - 26px), transparent);
}
.wc-back-scroll:focus-visible { outline-offset: -4px; border-radius: 14px; }
.wc-back-head { margin-bottom: 12px; }
.wc-eyebrow {
  display: flex; align-items: center; gap: 6px;
  margin: 0 0 4px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
}
.wc-eyebrow svg { width: 11px; height: 11px; }
.wc-card[data-kind="claim"] .wc-eyebrow svg { color: var(--blue); }
.wc-card[data-kind="open"] .wc-eyebrow svg { color: var(--amber); }
.wc-concept {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(21px, 6.4cqw, 28px); font-weight: 600; letter-spacing: -0.015em; line-height: 1.12;
}
.wc-verdict {
  display: flex; gap: 10px; align-items: flex-start;
  margin: 0 0 12px; padding: 10px 12px;
  border-radius: 12px;
}
.wc-verdict.is-right { background: var(--right-soft); }
.wc-verdict.is-wrong { background: var(--wrong-soft); }
.wc-verdict-icon {
  flex: none; width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center; color: #fff;
}
.wc-verdict-icon svg { width: 15px; height: 15px; }
.wc-verdict.is-right .wc-verdict-icon { background: var(--right); }
.wc-verdict.is-wrong .wc-verdict-icon { background: var(--wrong); }
.wc-verdict-main { margin: 0; font-size: 14.5px; font-weight: 700; }
.wc-verdict.is-right .wc-verdict-main { color: var(--right); }
.wc-verdict.is-wrong .wc-verdict-main { color: var(--wrong); }
.wc-verdict-sub { margin: 2px 0 0; font-size: 13px; line-height: 1.45; color: #3a3a3c; }
.wc-verdict-cal { margin: 4px 0 0; font-size: 13px; line-height: 1.45; color: #3a3a3c; }
.wc-verdict-cal strong { font-variant-numeric: tabular-nums; }
.wc-verdict-cal.is-pos strong { color: var(--blue); }
.wc-verdict-cal.is-neg strong { color: var(--wrong); }
.wc-verdict-cal.is-off strong { color: var(--muted); }
.wc-verdict-cal span { color: var(--muted); }
.wc-pts { font-weight: 700; color: var(--amber-ink); white-space: nowrap; }

.wc-explain { margin: 0 0 14px; font-size: clamp(13.5px, 3.6cqw, 15px); line-height: 1.55; color: #2c2c2e; }
.wc-twist, .wc-ask {
  margin: 0 0 12px; padding: 11px 13px 12px;
  border-radius: 12px;
}
.wc-twist { background: var(--amber-soft); }
.wc-twist--machines { background: var(--alt); }
.wc-ask { background: var(--blue-soft); }
.wc-twist h4, .wc-ask h4 {
  display: flex; align-items: center; gap: 6px;
  margin: 0 0 4px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
}
.wc-twist h4 { color: var(--amber-ink); }
.wc-twist--machines h4 { color: #48484a; }
.wc-ask h4 { color: var(--blue); }
.wc-twist h4 svg, .wc-ask h4 svg { width: 15px; height: 15px; }
.wc-twist p, .wc-ask p { margin: 0; font-size: clamp(13px, 3.5cqw, 14.5px); line-height: 1.5; color: #2c2c2e; }
.wc-ask p { font-weight: 500; }
.wc-src { margin: 4px 0 0; font-size: 11.5px; line-height: 1.5; color: var(--muted); }
.wc-src span { font-weight: 600; }
.wc-src a { color: var(--blue); text-decoration: none; }
.wc-src a:hover { text-decoration: underline; }
.wc-mirror-bonus { margin: 0 0 8px; font-size: 13px; color: var(--muted); }
.wc-mirror-bonus strong { color: var(--amber-ink); }

/* ---------- deck pile + discard ---------- */
.wc-deckpile, .wc-discard {
  position: absolute; bottom: 10px;
  width: 92px; height: 128px;
  pointer-events: none;
}
.wc-deckpile { left: 0; }
.wc-discard { right: 0; }
.wc-cardback {
  position: absolute; inset: 0;
  border-radius: 10px;
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.13) 0 1.5px, transparent 1.5px 8px),
    repeating-linear-gradient(-45deg, rgba(255, 255, 255, 0.13) 0 1.5px, transparent 1.5px 8px),
    var(--blue);
  box-shadow: inset 0 0 0 5px #fff, inset 0 0 0 6px rgba(0, 94, 162, 0.4), 0 1px 3px rgba(0, 0, 0, 0.14);
}
.wc-cardback::after {
  content: ""; position: absolute; left: 50%; top: 50%;
  width: 18px; height: 18px; margin: -9px 0 0 -9px;
  border: 2px solid #fff; transform: rotate(45deg); border-radius: 2px;
}
.wc-cardback:nth-child(1) { transform: translate(0, 0) rotate(-3deg); }
.wc-cardback:nth-child(2) { transform: translate(3px, -3px) rotate(-1deg); }
.wc-cardback:nth-child(3) { transform: translate(6px, -6px) rotate(1.5deg); }
.wc-pile-count {
  position: absolute; left: 0; right: -6px; bottom: -22px; margin: 0;
  text-align: center; font-size: 11.5px; font-weight: 600; color: var(--muted);
}
.wc-pile-count::after { content: " in the deck"; font-weight: 500; }
.wc-deckpile.is-shuffling .wc-cardback:nth-child(2) { animation: wc-riffle-a 0.5s var(--ease); }
.wc-deckpile.is-shuffling .wc-cardback:nth-child(3) { animation: wc-riffle-b 0.5s var(--ease); }
@keyframes wc-riffle-a { 40% { transform: translate(-30px, -6px) rotate(-12deg); } }
@keyframes wc-riffle-b { 40% { transform: translate(34px, -10px) rotate(12deg); } }

.wc-discard::before, .wc-discard::after {
  content: ""; position: absolute; inset: 0; border-radius: 10px;
  background: var(--paper); border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  opacity: 0; transition: opacity 0.3s ease;
}
.wc-discard::before { transform: rotate(6deg); }
.wc-discard::after { transform: rotate(-4deg) translate(4px, -2px); }
.wc-discard[data-count="1"]::after,
.wc-discard[data-count="2"]::after, .wc-discard[data-count="2"]::before,
.wc-discard[data-count="3"]::after, .wc-discard[data-count="3"]::before { opacity: 1; }

@media (max-width: 1179px) {
  .wc-deckpile, .wc-discard { display: none; }
}

/* Phones: keep the card's width, let it grow taller so answers fit. */
@media (max-width: 899px) {
  .wc-card {
    aspect-ratio: auto;
    width: min(100cqw, 440px);
    height: min(calc(100cqh - 8px), calc(min(100cqw, 440px) * 1.62));
  }
}

/* ---------- chips in stacks ---------- */
.wc-stack-chip {
  position: absolute; left: 50%;
  width: 44px; height: 15px; margin-left: -22px;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.16));
}
.wc-stack-chip svg { display: block; width: 100%; height: 100%; }
.wc-stack-chip.is-flying { filter: drop-shadow(0 6px 8px rgba(0, 0, 0, 0.2)); }
@media (max-width: 899px) {
  .wc-stake .wc-stack-chip { width: 38px; height: 13px; margin-left: -19px; bottom: calc(var(--i) * 4.5px); }
}

/* ---------- the mirror ---------- */
.wc-card[data-kind="mirror"] .wc-face--front {
  background:
    linear-gradient(115deg, rgba(255, 255, 255, 0) 30%, rgba(255, 255, 255, 0.85) 46%, rgba(255, 255, 255, 0) 60%) no-repeat,
    linear-gradient(160deg, #fdfdfd 0%, #e9e9ed 38%, #f7f7f9 55%, #d9d9de 100%);
  background-size: 260% 100%, 100% 100%;
  background-position: 140% 0, 0 0;
  border-color: rgba(0, 0, 0, 0.14);
}
@media (prefers-reduced-motion: no-preference) {
  .wc-card[data-kind="mirror"] .wc-face--front { animation: wc-sheen 1.6s 0.25s var(--ease) both; }
}
@keyframes wc-sheen { from { background-position: 140% 0, 0 0; } to { background-position: -60% 0, 0 0; } }
.wc-mirror-word {
  display: flex; flex-direction: column; align-items: flex-start;
  margin: 0 0 14px;
  font-family: var(--serif); font-size: clamp(26px, 9cqw, 40px); font-weight: 600; letter-spacing: 0.06em; line-height: 0.95;
  color: #3a3a3c;
}
.wc-mirror-word .is-reflected {
  transform: scaleY(-1);
  opacity: 0.22;
  -webkit-mask-image: linear-gradient(to top, #000, transparent 85%);
  mask-image: linear-gradient(to top, #000, transparent 85%);
}
.wc-statement--mirror { font-size: clamp(18px, 5.6cqw, 25px); }
.wc-mirror-detail { margin: 12px 0 0; font-size: clamp(13px, 3.6cqw, 15px); line-height: 1.5; color: #3a3a3c; }

/* ---------- reduced motion: cross-fade instead of turning ---------- */
@media (prefers-reduced-motion: reduce) {
  .wc-card-inner { transition: none; }
  .wc-card.is-flipped .wc-card-inner { transform: none; }
  .wc-face--back { transform: none; opacity: 0; }
  .wc-card.is-flipped .wc-face--back { opacity: 1; }
  .wc-card.is-flipped .wc-face--front { opacity: 0; }
}
