:root {
  --bg: #ffffff;
  --ink: #111113;
  --muted: #8a8d94;
  --line: rgba(17, 17, 19, 0.08);
  --cw: 300px; /* the card width, set again by the script on resize */
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: "Mona Sans Variable", "Mona Sans", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

.stage {
  position: relative;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(6px, 2.4vh, 22px);
  padding: 3vh 16px;
  user-select: none;
  -webkit-user-select: none;
}

.head { text-align: center; }
.eyebrow {
  margin: 0 0 4px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  letter-spacing: 0.02em;
  color: var(--muted);
}
.eyebrow .mark { width: 14px; height: 14px; }
.mark path, .brand path { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.title {
  margin: 0;
  font-size: clamp(18px, min(3.2vw, 4.4vh), 30px);
  font-weight: 620;
  font-stretch: 105%;
  letter-spacing: -0.02em;
}

/* the deck: a flat box that holds the 3D scene; its size is measured by the script */
.deck {
  position: relative;
  width: calc(var(--cw) * 1.5);
  height: calc(var(--cw) * 1.24);
  max-width: 100%;
  cursor: pointer;
}
.tilt {
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--cw);
  height: calc(var(--cw) / 1.586);
  margin-left: calc(var(--cw) / -2);
  margin-top: calc(var(--cw) / -3.172);
  transform-style: preserve-3d;
}
/* each card's own shadow, a blurred plane just under the deck */
.shadow {
  position: absolute;
  inset: 0;
  border-radius: calc(var(--cw) * 0.055);
  background: rgba(20, 22, 40, 0.5);
  filter: blur(14px);
  opacity: 0.2;
  will-change: transform, opacity, filter;
}

.card {
  position: absolute;
  inset: 0;
  padding: 0;
  border: 0;
  margin: 0;
  border-radius: calc(var(--cw) * 0.055);
  background: linear-gradient(135deg, var(--c1), var(--c2));
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  transform-style: preserve-3d;
  backface-visibility: hidden;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 1px 2px rgba(0, 0, 0, 0.12);
  outline: none;
}
.card:focus-visible { box-shadow: 0 0 0 2px #fff, 0 0 0 4px #6d63f2; }

.face {
  position: absolute;
  inset: 0;
  padding: calc(var(--cw) * 0.06) calc(var(--cw) * 0.065);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-align: left;
}
.row { display: flex; align-items: center; justify-content: space-between; }
.brand {
  display: inline-flex;
  align-items: center;
  gap: calc(var(--cw) * 0.018);
  font-size: calc(var(--cw) * 0.05);
  font-weight: 640;
  letter-spacing: -0.01em;
}
.brand svg { width: calc(var(--cw) * 0.055); height: calc(var(--cw) * 0.055); }
.wave { width: calc(var(--cw) * 0.07); height: calc(var(--cw) * 0.07); }
.wave path { fill: none; stroke: var(--sub); stroke-width: 1.5; stroke-linecap: round; }
.chip { width: calc(var(--cw) * 0.12); height: auto; }
.chip rect { fill: rgba(255, 214, 140, 0.55); stroke: rgba(120, 90, 40, 0.45); stroke-width: 1.1; }
.chip path { fill: none; stroke: rgba(120, 90, 40, 0.45); stroke-width: 1.1; }
.foot { align-items: flex-end; }
.kind { font-size: calc(var(--cw) * 0.046); font-weight: 560; }
.end {
  font-size: calc(var(--cw) * 0.046);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.08em;
  color: var(--sub);
}

/* the reflection: a soft band of light whose place follows the tilt */
.sheen {
  position: absolute;
  inset: -40%;
  background: linear-gradient(115deg, transparent 38%, rgba(255, 255, 255, 0.34) 48%, rgba(255, 255, 255, 0.08) 54%, transparent 62%);
  mix-blend-mode: soft-light;
  pointer-events: none;
  opacity: 0.6;
  will-change: transform;
}
.edge {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 1px solid rgba(255, 255, 255, 0.16);
  pointer-events: none;
}

.caption { text-align: center; min-height: 0; }
.cname { margin: 0; font-size: 13px; color: var(--muted); height: 1.25em; overflow: hidden; }
.roll { display: inline-block; }
.balance {
  margin: 2px 0 0;
  font-size: clamp(22px, min(4vw, 5.6vh), 38px);
  font-weight: 640;
  font-stretch: 102%;
  letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
}
.cur { color: var(--muted); font-weight: 520; margin-right: 0.08em; }
.hint { margin: 4px 0 0; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

.ghost {
  position: absolute;
  left: 0;
  top: 0;
  width: 22px;
  height: 22px;
  pointer-events: none;
  opacity: 0;
  z-index: 5;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.25));
}
.ghost path { fill: #0b0b0d; stroke: #fff; stroke-width: 1.2; stroke-linejoin: round; }

@media (max-width: 640px) {
  .stage { gap: 4px; padding: 2vh 12px; }
  .hint { font-size: 11px; }
}
