/* Formula Deck: a full-art, angular card face distinct from the Pokémon frame. */
.card.xlookup,
.card.xlookup .card__rotator {
  --card-aspect: 0.69;
  --card-radius: 6% / 4%;
  --card-edge: #b4ffd7;
  --card-glow: #49f5ac;
  --card-back: #071b18;
  /* Shared by the front, back, and every foil layer. Pokémon clip variables
     normally describe the art/title windows of a trading card; custom designs
     replace those slots with their own outside silhouette. */
  --design-card-shape: polygon(0 0, 90% 0, 100% 6%, 100% 100%, 8% 100%, 0 94%);
  --clip: var(--design-card-shape);
  --clip-invert: var(--design-card-shape);
  --clip-stage: var(--design-card-shape);
  --clip-stage-invert: var(--design-card-shape);
  --clip-trainer: var(--design-card-shape);
  --clip-trainer-invert: var(--design-card-shape);
  --clip-borders: var(--design-card-shape);
}

.card.xlookup {
  container-type: inline-size;
}

.card.xlookup.active {
  z-index: 1000 !important;
}

.card.xlookup .card__rotator {
  background: #081a17;
}

.card.xlookup .xlookup-back,
.card.xlookup .xlookup-front {
  clip-path: var(--design-card-shape);
}

.card.xlookup .card__shine,
.card.xlookup .card__glare {
  /* Foil covers the full custom card silhouette; the design's own mask makes
     clear areas for its lettering and panels. Do not use Pokémon art-window
     shapes for a custom face. */
  clip-path: var(--design-card-shape) !important;
}

.card.xlookup .xlookup-back {
  position: relative;
  transform: rotateY(180deg) translateZ(1px);
  backface-visibility: visible;
  align-content: center;
  justify-items: center;
  gap: 4cqw;
  background:
    linear-gradient(rgba(106, 249, 190, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(106, 249, 190, 0.08) 1px, transparent 1px),
    radial-gradient(circle at 50% 35%, #174c39, #081b19 68%);
  background-size: 24px 24px, 24px 24px, cover;
  color: #c3ffe0;
}

.xlookup-back-mark {
  width: 18cqw !important;
  height: 18cqw !important;
  display: grid !important;
  place-items: center;
  border: 1px solid rgba(164, 255, 207, 0.6);
  border-radius: 5cqw;
  color: #8fffc0;
  font: 800 11cqw/1 system-ui, sans-serif;
  box-shadow: 0 0 8cqw rgba(41, 240, 154, 0.25), inset 0 0 5cqw rgba(41, 240, 154, 0.12);
}

.xlookup-back-label {
  width: auto !important;
  font: 700 2.6cqw/1 system-ui, sans-serif;
  letter-spacing: 0.16em;
}

.card.xlookup .xlookup-front {
  background: #081613;
  --mask: var(--text-mask, linear-gradient(white, white)) !important;
}

:where(.card.xlookup) .xlookup-cover,
:where(.card.xlookup) .xlookup-cover * {
  width: auto;
  height: auto;
  min-width: 0;
  aspect-ratio: auto;
  grid-area: auto;
  display: block;
  overflow: visible;
  transform-style: flat;
}

.card.xlookup .xlookup-cover {
  position: relative;
  grid-area: 1 / 1;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow: hidden;
  padding: 7.5% 7% 5.5%;
  background:
    radial-gradient(ellipse at 85% 20%, rgba(30, 219, 142, 0.32), transparent 40%),
    radial-gradient(ellipse at 12% 52%, rgba(59, 139, 255, 0.3), transparent 42%),
    linear-gradient(145deg, #071a16, #0b3127 48%, #071716);
  color: #edfff6;
  font-family: system-ui, -apple-system, sans-serif;
}

.xlookup-grid {
  position: absolute;
  inset: 0;
  z-index: 0;
  background-image:
    linear-gradient(rgba(163, 255, 207, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(163, 255, 207, 0.055) 1px, transparent 1px);
  background-size: 7.5% 5.2%;
  mask-image: linear-gradient(135deg, black, transparent 92%);
}

.xlookup-glow {
  position: absolute;
  z-index: 0;
  width: 42%;
  aspect-ratio: 1;
  border: 1px solid rgba(136, 255, 196, 0.16);
  border-radius: 50%;
  pointer-events: none;
}

.xlookup-glow-a {
  top: 26%;
  right: -17%;
  box-shadow: 0 0 45px rgba(48, 255, 164, 0.14), inset 0 0 35px rgba(48, 255, 164, 0.1);
}

.xlookup-glow-b {
  top: 39%;
  right: -7%;
  width: 22%;
}

.xlookup-topline,
.xlookup-bottomline {
  position: relative;
  z-index: 1;
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  color: rgba(218, 255, 236, 0.72);
  font-size: 2.2cqw;
  font-weight: 750;
  letter-spacing: 0.14em;
}

.xlookup-logo {
  color: #a7ffd0;
  font: italic 800 6cqw/1 Georgia, serif;
  letter-spacing: -0.1em;
}

.xlookup-index {
  padding: 1.3cqw 1.8cqw;
  border: 1px solid rgba(181, 255, 217, 0.32);
  border-radius: 999px;
  color: #bdffdb;
}

.xlookup-heading {
  position: relative;
  z-index: 1;
  margin-top: 8%;
}

.xlookup-kicker {
  margin: 0 0 0.2rem;
  color: #92ffc2;
  font-size: 2.5cqw;
  font-weight: 800;
  letter-spacing: 0.2em;
}

.card.xlookup .xlookup-heading h2 {
  margin: 0;
  color: white;
  font: 900 13cqw/0.95 system-ui, sans-serif;
  letter-spacing: -0.075em;
  text-shadow: 0 1.8cqw 9cqw rgba(55, 255, 168, 0.22);
}

.card.xlookup .xlookup-heading > p:last-child {
  margin: 1.6cqw 0 0;
  color: rgba(236, 255, 245, 0.78);
  font-size: 3.2cqw;
  line-height: 1.3;
}

.xlookup-demo {
  position: relative;
  z-index: 1;
  display: flex !important;
  flex-direction: column;
  gap: 1.5cqw;
  margin-top: 7%;
}

.xlookup-search-value,
.xlookup-result {
  position: relative;
  display: grid !important;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 0.7cqw 2cqw;
  padding: 1.7cqw 2.2cqw;
  border: 1px solid rgba(171, 255, 209, 0.26);
  border-radius: 2.3cqw;
  background: rgba(3, 20, 16, 0.7);
}

.xlookup-search-value span,
.xlookup-result > span {
  grid-column: 1;
  color: #91dfb4;
  font-size: 1.9cqw;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.xlookup-search-value strong,
.xlookup-result strong {
  grid-column: 1;
  color: white;
  font-size: 4cqw;
  line-height: 1.1;
}

.xlookup-search-value i,
.xlookup-result i {
  grid-column: 2;
  grid-row: 1 / span 2;
  color: #84ffb7;
  font: normal 700 5.5cqw/1 system-ui, sans-serif;
}

.xlookup-arrays {
  display: grid !important;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1cqw;
}

.xlookup-array {
  display: grid !important;
  gap: 0.7cqw;
  min-width: 0;
  padding: 1.4cqw;
  border: 1px solid rgba(171, 255, 209, 0.16);
  border-radius: 2.1cqw;
  background: rgba(4, 22, 18, 0.72);
}

.xlookup-array > span:not(.xlookup-array-label) {
  overflow: hidden !important;
  padding: 0.8cqw 1cqw;
  border-radius: 1cqw;
  color: rgba(237, 255, 246, 0.78);
  font: 600 2.3cqw/1.15 ui-monospace, monospace;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.xlookup-array .xlookup-array-label {
  margin-bottom: 0.1rem;
  color: #8ac9a7;
  font-size: 1.6cqw;
  font-weight: 800;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.xlookup-array-label b {
  display: block !important;
  color: #ccffe0;
  font: 600 1em/1.2 ui-monospace, monospace;
  letter-spacing: 0;
}

.xlookup-array > .xlookup-match {
  background: rgba(38, 229, 142, 0.2);
  color: #aaffca;
  box-shadow: inset 2px 0 #67ffad;
}

.xlookup-flow {
  color: #90ffbe;
  font: 800 4.5cqw/1 system-ui, sans-serif;
  text-shadow: 0 0 3.5cqw rgba(64, 255, 165, 0.8);
}

.xlookup-result {
  border-color: rgba(105, 255, 171, 0.5);
  background: linear-gradient(100deg, rgba(19, 89, 59, 0.86), rgba(6, 40, 30, 0.82));
  box-shadow: 0 0 22px rgba(44, 255, 154, 0.12);
}

.xlookup-formula {
  position: relative;
  z-index: 1;
  display: grid !important;
  gap: 1.1cqw;
  margin-top: auto;
  padding-top: 6%;
}

.xlookup-formula > span {
  color: #91dfb4;
  font-size: 1.9cqw;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.xlookup-formula code {
  display: block !important;
  overflow: hidden !important;
  padding: 1.7cqw 1.9cqw;
  border: 1px solid rgba(171, 255, 209, 0.24);
  border-radius: 1.8cqw;
  background: rgba(2, 12, 11, 0.82);
  color: #bcffd6;
  font: 600 1.8cqw/1.3 ui-monospace, monospace;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.xlookup-bottomline {
  margin-top: 5%;
  color: rgba(201, 255, 222, 0.55);
  font-size: 1.55cqw;
  letter-spacing: 0.1em;
}

.card.xlookup:not(.masked) .card__shine {
  background: linear-gradient(120deg, transparent 15%, rgba(164, 255, 211, 0.48) 48%, transparent 80%);
  background-size: 220% 100%;
  background-position: var(--pointer-x) center;
  filter: none;
  mix-blend-mode: screen;
  opacity: calc(var(--card-opacity) * 0.42);
}

.card.xlookup:not(.masked) .card__shine::before {
  content: "";
  background: radial-gradient(circle at var(--pointer-x) var(--pointer-y), rgba(225, 255, 239, 0.9), transparent 52%);
  opacity: calc(var(--card-opacity) * 0.5);
  mix-blend-mode: screen;
}

.card.xlookup:not(.masked) .card__glare {
  mix-blend-mode: soft-light;
}

.card.xlookup.masked .card__shine,
.card.xlookup.masked .card__shine::before,
.card.xlookup.masked .card__shine::after {
  -webkit-mask-image: var(--text-mask, linear-gradient(white, white)) !important;
  mask-image: var(--text-mask, linear-gradient(white, white)) !important;
  -webkit-mask-size: 100% 100% !important;
  mask-size: 100% 100% !important;
}

/* Purchased back artwork fills the existing silhouette without changing its 3D transform. */
.card.xlookup .xlookup-back.custom-card-back { display:block; background:none; }
