:root {
  color-scheme: dark;
  --ink: #fff6e7;
  --soft: #d9cbb5;
  --quiet: #958975;
  --gold: #f3c76c;
  --green: #7ee0a4;
  --line: rgba(255, 246, 231, 0.22);
  --line-strong: rgba(255, 246, 231, 0.42);
  --glass: rgba(255, 255, 255, 0.055);
  --shadow: rgba(0, 0, 0, 0.58);
  --card-font: Cinzel, "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --card-text-font: "Iowan Old Style", "Cormorant Garamond", "Palatino Linotype", Palatino, Georgia, serif;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 50% -14%, rgba(243, 199, 108, 0.22), transparent 28rem),
    radial-gradient(circle at 14% 46%, rgba(126, 224, 164, 0.12), transparent 25rem),
    radial-gradient(circle at 88% 42%, rgba(117, 170, 255, 0.13), transparent 24rem),
    linear-gradient(135deg, #090e0d 0%, #11100c 46%, #161021 100%);
  overflow: hidden;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

button,
input {
  color: inherit;
  font: inherit;
  -webkit-tap-highlight-color: transparent;
}

button,
.nav-button,
.volume-control {
  touch-action: manipulation;
}

input[type="range"] {
  touch-action: pan-x;
}

.app,
.viewer,
.stage,
#card3d,
.card3d,
.card-face {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.stage,
#card3d,
.card3d,
.card-face,
.card-template,
.card-back-image,
.card-art,
.story-image {
  touch-action: none;
  -webkit-user-drag: none;
}

.app {
  display: grid;
  width: min(1240px, 100%);
  height: 100svh;
  margin: 0 auto;
  padding: clamp(10px, 1.8vw, 18px);
  grid-template-rows: auto minmax(0, 1fr);
  gap: clamp(8px, 1.4vw, 16px);
}

.topbar {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(0, 1fr) minmax(310px, 370px);
  gap: 12px;
  align-items: stretch;
}

.identity-grid,
.audio-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.025)),
    rgba(0, 0, 0, 0.2);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.2);
}

.identity-grid {
  display: grid;
  grid-template-columns: 150px 150px minmax(230px, 1fr) 96px;
  gap: 0;
  align-items: center;
  overflow: hidden;
}

.identity-grid > * {
  display: grid;
  min-width: 0;
  min-height: 52px;
  align-items: center;
  padding: 0 14px;
  border-right: 1px solid rgba(255, 246, 231, 0.12);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.identity-grid > *:last-child {
  border-right: 0;
}

.identity-brand {
  color: var(--ink);
  font-size: clamp(1.1rem, 2.4vw, 1.65rem);
  font-weight: 950;
  letter-spacing: 0;
}

.identity-set,
.identity-number {
  color: var(--soft);
  font-size: clamp(0.74rem, 1.2vw, 0.9rem);
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.identity-name {
  color: var(--gold);
  font-size: clamp(0.9rem, 1.5vw, 1.08rem);
  font-weight: 950;
  letter-spacing: 0;
  text-transform: uppercase;
}

.audio-panel {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
}

.music-button {
  min-height: 36px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--glass);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.2);
  color: var(--soft);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 900;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

.music-button:hover,
.music-button:focus-visible {
  outline: none;
  border-color: rgba(243, 199, 108, 0.72);
  background: rgba(243, 199, 108, 0.13);
  transform: translateY(-1px);
}

.music-button.is-on {
  border-color: rgba(126, 224, 164, 0.78);
  color: var(--green);
}

.volume-control {
  display: grid;
  min-width: 0;
  grid-template-columns: auto minmax(92px, 1fr) 3ch;
  gap: 8px;
  align-items: center;
  color: var(--soft);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.volume-control input {
  width: 100%;
  min-width: 0;
  accent-color: var(--gold);
  cursor: pointer;
}

.volume-value {
  color: var(--gold);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.sfx-meter {
  display: grid;
  min-width: 42px;
  min-height: 28px;
  place-items: center;
  border: 1px solid rgba(126, 224, 164, 0.26);
  border-radius: 999px;
  background: rgba(126, 224, 164, 0.08);
  color: var(--green);
  font-size: 0.7rem;
  font-weight: 950;
  text-transform: uppercase;
}

.sfx-meter.is-pulsing {
  animation: sfxPulse 300ms ease-out;
}

@keyframes sfxPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(126, 224, 164, 0.5);
    transform: scale(1);
  }
  60% {
    box-shadow: 0 0 0 8px rgba(126, 224, 164, 0);
    transform: scale(1.06);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(126, 224, 164, 0);
    transform: scale(1);
  }
}

.viewer {
  position: relative;
  display: grid;
  min-height: 0;
  grid-template-columns: clamp(48px, 6vw, 78px) minmax(0, 1fr) clamp(48px, 6vw, 78px);
  gap: clamp(6px, 1.4vw, 18px);
  align-items: center;
}

.stage {
  position: relative;
  display: grid;
  min-height: 0;
  height: 100%;
  place-items: center;
  cursor: grab;
  touch-action: none;
}

.stage.is-grabbing {
  cursor: grabbing;
}

#card3d {
  --mx: 50%;
  --my: 50%;
  --shine-x: 50%;
  --shine-y: 50%;
  --type-color: #c23b39;
  --type-soft: #ffcf7a;
  --type-bg: #fff0da;
  --type-shadow: rgba(194, 59, 57, 0.42);
  --type-rgb: 194, 59, 57;
  position: relative;
  display: block;
  width: min(430px, calc((100svh - 128px) * 0.686), calc(100vw - 180px));
  aspect-ratio: 968 / 1412;
  min-height: 0;
  outline: none;
  touch-action: none;
  filter:
    drop-shadow(0 28px 42px var(--shadow))
    drop-shadow(0 0 24px var(--type-shadow));
}

.card-side {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: 7px;
  background: var(--type-bg);
  box-shadow:
    inset 0 0 0 1px rgba(255, 246, 231, 0.28),
    inset 0 0 36px rgba(0, 0, 0, 0.05);
}

.card-front {
  opacity: 1;
  visibility: visible;
}

.card-bg,
.card-tint,
.card-border,
.metal-border {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  user-select: none;
}

.card-bg,
.card-border {
  display: block;
}

.card-bg {
  z-index: 0;
}

.card-tint {
  z-index: 1;
  background:
    radial-gradient(circle at 72% 12%, rgba(255, 255, 255, 0.46), transparent 24%),
    linear-gradient(145deg, rgba(var(--type-rgb), 0.38), rgba(255, 255, 255, 0.08) 34%, rgba(var(--type-rgb), 0.18)),
    linear-gradient(180deg, var(--type-bg), rgba(255, 255, 255, 0.32) 48%, var(--type-bg));
  mix-blend-mode: multiply;
  opacity: 0.96;
}

.card-border {
  z-index: 5;
  filter: saturate(1.18) contrast(1.08);
}

.metal-border {
  z-index: 7;
  border: clamp(10px, 1.25vw, 16px) solid transparent;
  border-image: var(--metal-sheen) 1;
  filter:
    saturate(1.3)
    contrast(1.16)
    drop-shadow(0 0 8px rgba(255, 216, 91, 0.45));
  mix-blend-mode: screen;
  opacity: 0.82;
  animation: metalGlow 4.8s ease-in-out infinite alternate;
}

.metal-border,
.metal-border::before,
.metal-border::after {
  --metal-sheen: linear-gradient(112deg,
    #6d4204 0%,
    #b7780d 9%,
    #ffe58a 18%,
    #fff8c9 25%,
    #c99018 35%,
    #7a4a05 47%,
    #f2c148 58%,
    #fff1a3 66%,
    #9b6309 78%,
    #ffd766 89%,
    #6d4204 100%);
}

.metal-border::before,
.metal-border::after {
  content: "";
  position: absolute;
  border: clamp(4px, 0.62vw, 8px) solid transparent;
  border-image: var(--metal-sheen) 1;
  box-shadow:
    0 0 0 1px rgba(255, 246, 191, 0.28),
    0 0 12px rgba(255, 218, 95, 0.2),
    inset 0 0 14px rgba(255, 244, 168, 0.13);
}

.metal-border::before {
  left: 5.9%;
  top: 9.2%;
  width: 88.2%;
  height: 40.3%;
}

.metal-border::after {
  left: 5.8%;
  top: 53.1%;
  width: 88.5%;
  height: 35.5%;
}

.card-front::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 7;
  pointer-events: none;
  background:
    radial-gradient(circle at var(--shine-x) var(--shine-y), rgba(255, 255, 255, 0.72), transparent 16%),
    linear-gradient(112deg, transparent 28%, rgba(255, 246, 166, 0.35) 45%, transparent 59%);
  mix-blend-mode: screen;
  opacity: 0.28;
}

.card-art-frame {
  position: absolute;
  z-index: 2;
  left: 8.06%;
  top: 10.91%;
  width: 84%;
  height: 38.24%;
  overflow: hidden;
}

.card-art {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.front-copy {
  position: absolute;
  z-index: 3;
  left: 8.2%;
  top: 54.5%;
  width: 83.6%;
  height: 30.5%;
  display: grid;
  align-content: center;
  gap: 7%;
  padding: 0 5%;
  border-radius: 4px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0.34)),
    rgba(var(--type-rgb), 0.16);
  color: #26231d;
  font-size: clamp(0.55rem, 1.05vw, 0.92rem);
  font-weight: 780;
  line-height: 1.22;
  text-align: center;
}

.front-copy p,
.front-copy h2,
.front-copy h3 {
  margin: 0;
}

.front-copy p:nth-child(2) {
  color: #5a5142;
  font-weight: 680;
  font-size: 0.9em;
}

.front-title,
.front-hp,
.front-type,
.front-number {
  position: absolute;
  z-index: 6;
  color: #22201a;
  font-weight: 950;
  line-height: 1;
  pointer-events: none;
}

.front-title {
  left: 9.5%;
  top: 6.6%;
  max-width: 58%;
  overflow: hidden;
  font-size: clamp(0.64rem, 1.45vw, 1.18rem);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.front-hp {
  top: 6.8%;
  right: 13.4%;
  font-size: clamp(0.56rem, 1.25vw, 1.02rem);
}

.front-type {
  left: 8.7%;
  bottom: 5.6%;
  font-size: clamp(0.56rem, 1.2vw, 1rem);
}

.front-number {
  right: 11.2%;
  bottom: 5.9%;
  font-size: clamp(0.48rem, 1vw, 0.86rem);
}

.holo-layer,
.shine-layer {
  position: absolute;
  inset: 0;
  z-index: 8;
  pointer-events: none;
}

.holo-layer {
  background:
    radial-gradient(circle at var(--shine-x) var(--shine-y), rgba(255, 255, 255, 0.46), transparent 20%),
    conic-gradient(from 35deg at var(--shine-x) var(--shine-y),
      rgba(255, 69, 69, 0),
      rgba(255, 70, 70, 0.22),
      rgba(255, 222, 88, 0.24),
      rgba(82, 246, 164, 0.2),
      rgba(80, 200, 255, 0.23),
      rgba(174, 90, 255, 0.22),
      rgba(255, 69, 69, 0)),
    repeating-linear-gradient(116deg, rgba(255, 255, 255, 0.09) 0 2px, transparent 2px 10px);
  mix-blend-mode: screen;
  opacity: 0.44;
  animation: holoFlow 6s linear infinite;
}

.shine-layer {
  background: linear-gradient(112deg, transparent 18%, rgba(255, 255, 255, 0.42) 43%, transparent 58%);
  mix-blend-mode: screen;
  opacity: 0.22;
}

@keyframes holoFlow {
  0% {
    filter: hue-rotate(0deg);
    background-position: 0 0, 0% 50%, 0 0;
  }
  50% {
    filter: hue-rotate(90deg);
    background-position: 0 0, 100% 50%, 24px 18px;
  }
  100% {
    filter: hue-rotate(0deg);
    background-position: 0 0, 0% 50%, 0 0;
  }
}

@keyframes metalGlow {
  0% {
    opacity: 0.66;
    filter:
      saturate(1.18)
      contrast(1.06)
      drop-shadow(0 0 5px rgba(255, 216, 91, 0.3));
  }
  100% {
    opacity: 0.92;
    filter:
      saturate(1.42)
      contrast(1.22)
      drop-shadow(0 0 12px rgba(255, 236, 136, 0.58));
  }
}

.stage {
  perspective: 1500px;
}

#card3d {
  transform-style: preserve-3d;
  will-change: transform;
  filter:
    drop-shadow(0 36px 54px var(--shadow))
    drop-shadow(0 0 30px var(--type-shadow));
}

.card3d .card-face {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: 9px;
  background: #080808;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  transform-style: preserve-3d;
  transition: opacity 90ms linear, visibility 90ms linear;
}

.card3d .card-front {
  opacity: 1;
  transform: translateZ(8px);
  visibility: visible;
}

.card3d .card-back {
  opacity: 0;
  transform: rotateY(180deg) translateZ(8px);
  visibility: hidden;
}

.card3d.is-showing-back .card-front {
  opacity: 0;
  visibility: hidden;
}

.card3d.is-showing-back .card-back {
  -webkit-backface-visibility: visible;
  backface-visibility: visible;
  opacity: 1;
  visibility: visible;
}

.card-template,
.card-back-image {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  user-select: none;
}

.card3d .card-art-frame {
  left: 8.1%;
  top: 10.1%;
  width: 83.8%;
  height: 39.1%;
  border-radius: 2px;
  box-shadow:
    0 0 0 1px rgba(255, 238, 153, 0.28),
    inset 0 0 18px rgba(255, 255, 255, 0.08);
}

.card3d .front-copy {
  left: 8.8%;
  top: 55.4%;
  width: 82.4%;
  height: 15.8%;
  gap: 7%;
  padding: 0 7%;
  border-radius: 2px;
  background:
    radial-gradient(circle at 50% 28%, rgba(255, 255, 255, 0.16), transparent 58%),
    rgba(0, 0, 0, 0.12);
  color: rgba(255, 250, 225, 0.92);
  font-size: clamp(0.48rem, 0.92vw, 0.82rem);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.72);
}

.card3d .front-copy p:nth-child(2) {
  color: rgba(255, 243, 205, 0.78);
}

.card3d .front-title,
.card3d .front-hp,
.card3d .front-type,
.card3d .front-number {
  color: rgba(255, 245, 205, 0.96);
  text-shadow:
    0 1px 2px rgba(0, 0, 0, 0.78),
    0 0 12px rgba(255, 221, 103, 0.24);
}

.card3d .front-title {
  left: 9.5%;
  top: 6.4%;
  max-width: 58%;
}

.card3d .front-hp {
  top: 6.6%;
  right: 13.5%;
}

.card3d .front-type {
  left: 8.8%;
  bottom: 6.2%;
}

.card3d .front-number {
  right: 11.4%;
  bottom: 6.3%;
}

.card3d .holo-layer {
  opacity: 0.32;
}

.card3d .shine-layer {
  opacity: 0.18;
}

.card-back::after,
.back-holo {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  content: "";
}

.back-holo {
  background:
    radial-gradient(circle at var(--shine-x) var(--shine-y), rgba(255, 255, 255, 0.52), transparent 18%),
    conic-gradient(from 45deg at var(--shine-x) var(--shine-y),
      rgba(255, 255, 255, 0),
      rgba(255, 225, 108, 0.16),
      rgba(93, 225, 255, 0.15),
      rgba(255, 255, 255, 0));
  mix-blend-mode: screen;
  opacity: 0.38;
}

.card-back::after {
  background: linear-gradient(112deg, transparent 22%, rgba(255, 255, 255, 0.24) 44%, transparent 58%);
  mix-blend-mode: screen;
  opacity: 0.24;
}

.card-edge {
  position: absolute;
  z-index: -1;
  display: block;
  background:
    linear-gradient(90deg, rgba(79, 52, 8, 0.95), rgba(248, 205, 83, 0.96) 45%, rgba(82, 52, 8, 0.95));
  box-shadow: 0 0 16px rgba(255, 202, 64, 0.18);
  backface-visibility: hidden;
}

.edge-right {
  top: 0;
  right: -8px;
  width: 16px;
  height: 100%;
  transform: rotateY(90deg);
}

.edge-left {
  top: 0;
  left: -8px;
  width: 16px;
  height: 100%;
  transform: rotateY(90deg);
}

.edge-top {
  top: -8px;
  left: 0;
  width: 100%;
  height: 16px;
  transform: rotateX(90deg);
}

.edge-bottom {
  bottom: -8px;
  left: 0;
  width: 100%;
  height: 16px;
  transform: rotateX(90deg);
}

.webgl-fallback {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.28);
  color: var(--soft);
  font-weight: 800;
}

.nav-button {
  display: grid;
  width: clamp(42px, 5vw, 58px);
  height: clamp(84px, 18vh, 162px);
  place-items: center;
  justify-self: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.035)),
    rgba(0, 0, 0, 0.24);
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.26);
  cursor: pointer;
  font-size: clamp(2rem, 4vw, 3.1rem);
  font-weight: 650;
  line-height: 1;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

.nav-button:hover,
.nav-button:focus-visible {
  outline: none;
  border-color: rgba(243, 199, 108, 0.8);
  background: rgba(243, 199, 108, 0.13);
  transform: translateY(-2px);
}

@media (max-width: 980px) {
  .app {
    padding: 10px;
    gap: 8px;
  }

  .topbar {
    grid-template-columns: 1fr;
  }

  .identity-grid {
    grid-template-columns: 92px minmax(0, 1fr) 78px;
  }

  .identity-brand,
  .identity-set,
  .identity-number {
    min-height: 34px;
    padding: 0 10px;
  }

  .identity-brand {
    grid-column: 1;
    grid-row: 1;
  }

  .identity-set {
    grid-column: 2;
    grid-row: 1;
  }

  .identity-number {
    grid-column: 3;
    grid-row: 1;
  }

  .identity-name {
    grid-column: 1 / -1;
    grid-row: 2;
    min-height: 34px;
    padding: 0 10px;
    border-top: 1px solid rgba(255, 246, 231, 0.12);
    border-right: 0;
  }

  .identity-set {
    border-right: 1px solid rgba(255, 246, 231, 0.12);
  }

  .audio-panel {
    grid-template-columns: auto minmax(0, 1fr) auto;
    padding: 7px 9px;
  }

  .viewer {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .stage {
    grid-area: 1 / 1;
  }

  #card3d {
    width: min(calc(100vw - 94px), calc((100svh - 174px) * 0.686));
  }

  .nav-button {
    position: absolute;
    z-index: 10;
    top: 50%;
    width: 38px;
    height: 92px;
    transform: translateY(-50%);
  }

  .nav-button:hover,
  .nav-button:focus-visible {
    transform: translateY(calc(-50% - 2px));
  }

  .nav-button.prev {
    left: 0;
  }

  .nav-button.next {
    right: 0;
  }
}

@media (max-width: 440px) {
  .identity-grid {
    grid-template-columns: 8ch minmax(0, 1fr) 7ch;
  }

  .identity-brand {
    font-size: 1.02rem;
  }

  .identity-set,
  .identity-number,
  .identity-name {
    font-size: 0.72rem;
  }

  .audio-panel {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .music-button {
    min-height: 32px;
    padding: 6px 10px;
    font-size: 0.74rem;
  }

  .volume-control {
    grid-template-columns: auto minmax(70px, 1fr) 3ch;
    font-size: 0.7rem;
  }
}

/* Portrait-first deck layout. The app is tuned for phones, then centered on larger screens. */
.app {
  width: min(430px, 100%);
  padding: 10px;
  gap: 8px;
}

.topbar {
  grid-template-columns: 1fr;
  gap: 8px;
}

.identity-grid {
  grid-template-columns: 8ch minmax(0, 1fr) 7ch;
}

.identity-brand,
.identity-set,
.identity-number {
  min-height: 34px;
  padding: 0 10px;
}

.identity-brand {
  grid-column: 1;
  grid-row: 1;
  font-size: 1.02rem;
}

.identity-set {
  grid-column: 2;
  grid-row: 1;
  border-right: 1px solid rgba(255, 246, 231, 0.12);
}

.identity-number {
  grid-column: 3;
  grid-row: 1;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.identity-name {
  grid-column: 1 / -1;
  grid-row: 2;
  min-height: 34px;
  padding: 0 10px;
  border-top: 1px solid rgba(255, 246, 231, 0.12);
  border-right: 0;
  font-size: 0.78rem;
}

.identity-set,
.identity-number {
  font-size: 0.72rem;
}

.audio-panel {
  grid-template-columns: 1fr;
  padding: 8px 10px;
}

.volume-control {
  grid-template-columns: auto minmax(0, 1fr) 3ch;
  gap: 10px;
  font-size: 0.74rem;
}

.viewer {
  grid-template-columns: 1fr;
  gap: 0;
}

.stage {
  grid-area: 1 / 1;
  padding-bottom: 72px;
  perspective: 1450px;
}

#card3d {
  width: min(378px, calc(100vw - 42px), calc((100svh - 196px) * 0.68515));
  aspect-ratio: 1038 / 1515;
}

.card-template,
.card-back-image,
.card-art {
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
  user-select: none;
}

.card3d .card-art-frame {
  left: 7.6%;
  top: 9.7%;
  width: 84.8%;
  height: 39.9%;
  background: rgba(0, 0, 0, 0.42);
}

.card3d .card-art {
  object-fit: contain;
  object-position: center center;
}

.card3d .front-copy {
  left: 10%;
  top: 54.4%;
  width: 80%;
  height: 17.6%;
  gap: 5%;
  padding: 0 5%;
  font-family: var(--card-font);
  font-size: clamp(0.5rem, 2.15vw, 0.78rem);
  font-weight: 700;
  line-height: 1.16;
}

.card3d .front-copy.is-medium {
  font-size: clamp(0.47rem, 2vw, 0.72rem);
  line-height: 1.12;
}

.card3d .front-copy.is-dense {
  font-size: clamp(0.43rem, 1.88vw, 0.66rem);
  line-height: 1.08;
  gap: 4%;
}

.card3d .front-title,
.card3d .front-hp,
.card3d .front-type,
.card3d .front-number {
  font-family: var(--card-font);
  font-variant-numeric: tabular-nums;
}

.card3d .front-title {
  left: 9.4%;
  top: var(--title-top, 5.45%);
  max-width: 58%;
  font-size: clamp(0.72rem, 3.05vw, 1.04rem);
}

.card3d .front-hp {
  top: var(--hp-top, 5.62%);
  right: 13.2%;
  font-size: clamp(0.58rem, 2.4vw, 0.86rem);
}

.card3d .front-type {
  left: 9%;
  bottom: 6.3%;
  font-size: clamp(0.58rem, 2.4vw, 0.86rem);
}

.card3d .front-number {
  right: 11.2%;
  bottom: 6.4%;
  min-width: 4ch;
  text-align: right;
  font-size: clamp(0.55rem, 2.25vw, 0.82rem);
}

.nav-button {
  position: absolute;
  z-index: 12;
  top: auto;
  bottom: 10px;
  width: 56px;
  height: 52px;
  border-radius: 999px;
  transform: none;
  font-size: 2.15rem;
}

.nav-button:hover,
.nav-button:focus-visible {
  transform: translateY(-1px);
}

.nav-button.prev {
  left: calc(50% - 76px);
}

.nav-button.next {
  right: calc(50% - 76px);
}

.viewer {
  grid-template-rows: minmax(0, 1fr) auto;
}

.stage {
  grid-area: auto;
  grid-row: 1;
  padding-bottom: 0;
}

.nav-row {
  grid-row: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 62px;
  padding-bottom: 2px;
}

.nav-button,
.nav-button.prev,
.nav-button.next {
  position: relative;
  left: auto;
  right: auto;
  top: auto;
  bottom: auto;
  width: 58px;
  height: 52px;
  transform: none;
}

.nav-button.front-face {
  width: 74px;
  border-color: rgba(243, 199, 108, 0.64);
  color: var(--gold);
}

.control-icon {
  position: relative;
  display: block;
  width: 22px;
  height: 22px;
}

.pause-icon::before,
.pause-icon::after {
  content: "";
  position: absolute;
  top: 2px;
  width: 6px;
  height: 18px;
  border-radius: 2px;
  background: currentColor;
  box-shadow: 0 0 10px rgba(243, 199, 108, 0.28);
}

.pause-icon::before {
  left: 4px;
}

.pause-icon::after {
  right: 4px;
}

.play-icon::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 2px;
  width: 0;
  height: 0;
  border-top: 9px solid transparent;
  border-bottom: 9px solid transparent;
  border-left: 14px solid currentColor;
  filter: drop-shadow(0 0 8px rgba(243, 199, 108, 0.28));
}

.nav-button:hover,
.nav-button:focus-visible {
  transform: translateY(-1px);
}

#card3d.is-story-card {
  width: min(390px, calc(100vw - 20px), calc((100svh - 206px) * 1.333));
  aspect-ratio: 1448 / 1086;
}

.story-image {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
  user-select: none;
  pointer-events: none;
}

.is-story-card .holo-layer {
  opacity: 0.2;
}

.is-story-card .shine-layer {
  opacity: 0.16;
}

/* Current portrait layout and card typography. */
.identity-grid {
  grid-template-columns: minmax(82px, auto) minmax(0, 1fr) minmax(54px, auto);
  grid-template-areas:
    "brand brand number"
    "set name name";
}

.identity-grid > * {
  min-height: 34px;
  padding: 0 9px;
}

.identity-brand {
  grid-area: brand;
  font-size: clamp(0.94rem, 3.8vw, 1.08rem);
  line-height: 1;
  border-right: 1px solid rgba(255, 246, 231, 0.12);
}

.identity-set {
  grid-area: set;
  font-size: clamp(0.64rem, 2.7vw, 0.74rem);
  border-top: 1px solid rgba(255, 246, 231, 0.12);
  border-right: 1px solid rgba(255, 246, 231, 0.12);
}

.identity-number {
  grid-area: number;
  min-width: 58px;
  padding-right: 10px;
  font-size: clamp(0.68rem, 2.8vw, 0.78rem);
  border-right: 0;
}

.identity-name {
  grid-area: name;
  min-height: 32px;
  font-size: clamp(0.78rem, 3.1vw, 0.9rem);
  border-top: 1px solid rgba(255, 246, 231, 0.12);
  border-right: 0;
}

.card3d .front-copy {
  z-index: 11;
  top: var(--copy-top, 55.25%);
  height: var(--copy-height, 13.35%);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.22em;
  padding: 0.42em 6.5%;
  font-family: var(--card-text-font);
  font-size: clamp(0.66rem, 2.95vw, 1.06rem);
  font-weight: 760;
  line-height: 1.08;
  overflow: visible;
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 249, 214, 0.14), transparent 62%),
    linear-gradient(180deg, rgba(22, 18, 12, 0.88), rgba(7, 7, 6, 0.72));
  box-shadow:
    inset 0 0 0 1px rgba(255, 226, 137, 0.18),
    inset 0 0 18px rgba(var(--type-rgb), 0.14),
    0 8px 16px rgba(0, 0, 0, 0.1);
  color: rgba(255, 250, 225, 0.97);
  text-shadow:
    0 1px 2px rgba(0, 0, 0, 0.86),
    0 0 10px rgba(255, 235, 168, 0.1);
}

.card3d .front-copy p {
  position: relative;
  z-index: 1;
}

.card3d .front-copy.is-medium {
  font-size: clamp(0.56rem, 2.42vw, 0.86rem);
  line-height: 1.04;
}

.card3d .front-copy.is-dense {
  font-size: clamp(0.54rem, 2.34vw, 0.76rem);
  line-height: 1.01;
  gap: 0.16em;
}

.card3d .front-title {
  font-size: clamp(0.82rem, 3.35vw, 1.14rem);
}

.card3d .front-hp,
.card3d .front-type,
.card3d .front-number {
  z-index: 11;
  font-size: clamp(0.64rem, 2.52vw, 0.9rem);
}

.card3d .front-title {
  z-index: 11;
}
