/* EverestBuzz — realistic playing cards
   Size any card with --cw (card width). Height follows the real 63 x 88 mm ratio. */

.pc {
  --ink-red: #b3121b;
  --ink-black: #15171c;
  --paper-noise: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 .07 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");

  position: relative;
  width: var(--cw, 72px);
  aspect-ratio: 63 / 88;
  font-size: calc(var(--cw, 72px) * 0.2);
  border-radius: calc(var(--cw, 72px) * 0.075);
  background:
    linear-gradient(118deg, rgba(255, 255, 255, 0.55) 0%, rgba(255, 255, 255, 0) 38%),
    var(--paper-noise),
    linear-gradient(170deg, #fffefa 0%, #f6f1e4 100%);
  border: 1px solid #d8d0bd;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.7),
    0 1px 1px rgba(20, 14, 6, 0.28),
    0 3px 8px rgba(20, 14, 6, 0.22),
    0 10px 22px rgba(20, 14, 6, 0.14);
  color: var(--ink-black);
  font-family: "Mukta", Georgia, serif;
  user-select: none;
  -webkit-user-select: none;
  overflow: hidden;
  flex: 0 0 auto;
}
.pc--red { color: var(--ink-red); }

/* Corner indices */
.pc__idx {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 0.9;
  width: 1.05em;
}
.pc__idx b { font-weight: 800; font-size: 1em; letter-spacing: -0.06em; }
.pc__idx i { font-style: normal; font-size: 0.82em; margin-top: 0.08em; }
.pc__idx--tl { top: 0.28em; left: 0.16em; }
.pc__idx--br { bottom: 0.28em; right: 0.16em; transform: rotate(180deg); }

/* Pip field */
.pc__field {
  position: absolute;
  inset: 13% 21%;
}
.pc__pip {
  position: absolute;
  transform: translate(-50%, -50%);
  font-size: 1.3em;
  line-height: 1;
}
.pc--r9 .pc__pip, .pc--r10 .pc__pip { font-size: 1.12em; }
.pc__pip--inv { transform: translate(-50%, -50%) rotate(180deg); }
.pc__pip--ace { font-size: 2.7em; }
.pc__pip--ace-s { font-size: 3.4em; }
.pc__ace-ring {
  position: absolute;
  left: 50%; top: 50%;
  width: 3.1em; height: 3.1em;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 0.05em solid currentColor;
  opacity: 0.35;
}
.pc__ace-ring::after {
  content: "";
  position: absolute;
  inset: 0.18em;
  border-radius: 50%;
  border: 0.03em dashed currentColor;
}

/* Court cards */
.pc__court {
  position: absolute;
  inset: 12% 17%;
  width: 66%;
  height: 76%;
}

/* Small cards: drop pip detail that would be illegible */
.pc--tiny .pc__field,
.pc--tiny .pc__court,
.pc--tiny .pc__idx--br { display: none; }
.pc--tiny .pc__idx--tl { top: 0.2em; left: 0.18em; font-size: 1.25em; }
.pc--tiny::after {
  content: attr(data-suit);
  position: absolute;
  right: 12%; bottom: 8%;
  font-size: 2em;
  line-height: 1;
}

/* Card back: crimson weave with a gold summit emblem, white printer's margin */
.pc--back {
  background: linear-gradient(170deg, #fffefa 0%, #f2ecdf 100%);
}
.pc--back::before {
  content: "";
  position: absolute;
  inset: 6.5%;
  border-radius: calc(var(--cw, 72px) * 0.045);
  background-color: #7f1d1d;
  background-image:
    radial-gradient(circle at 50% 50%, transparent 0 30%, rgba(0, 0, 0, 0.18) 70%),
    repeating-linear-gradient(45deg, rgba(227, 176, 75, 0.42) 0 1px, transparent 1px calc(var(--cw, 72px) * 0.085)),
    repeating-linear-gradient(-45deg, rgba(227, 176, 75, 0.42) 0 1px, transparent 1px calc(var(--cw, 72px) * 0.085));
  box-shadow: inset 0 0 0 calc(var(--cw, 72px) * 0.018) rgba(227, 176, 75, 0.7);
}
.pc--back::after {
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  width: 40%;
  aspect-ratio: 1.25;
  transform: translate(-50%, -50%);
  background: linear-gradient(180deg, #fbe7b0, #e3b04b);
  clip-path: polygon(0 100%, 30% 42%, 44% 62%, 64% 6%, 100% 100%);
  filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.3));
}

/* 3D flip wrapper used in the player's hand */
.flip {
  position: relative;
  width: var(--cw, 72px);
  aspect-ratio: 63 / 88;
  perspective: 700px;
}
.flip__inner {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transition: transform 0.55s cubic-bezier(.3, .7, .2, 1);
}
.flip.is-down .flip__inner { transform: rotateY(180deg); }
.flip__inner > .pc {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.flip__inner > .pc--back { transform: rotateY(180deg); }
