/* Shared card face (public/card.js). A real card: fixed 63:88 ratio, and every size inside is a share of the
   card width (cqw), so a card looks identical at any size, like a printed card scaled. Actions live outside. */
.tcg-card {
  --tone: var(--common-tone);
  --surface: var(--common-surface);
  --shine-x: 50%;
  --shine-y: 35%;
  --foil-rest: 0;
  --foil-active: 0;
  position: relative;
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 0;
  aspect-ratio: 63 / 88;
  container-type: inline-size;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 5% / 3.58%;
  background: none;
  color: var(--ink);
  font: inherit;
  font-weight: 400;
  text-align: left;
}
.tcg-card.inhabituel { --tone: var(--unusual-tone); --surface: var(--unusual-surface); }
.tcg-card.rare { --tone: var(--rare-tone); --surface: var(--rare-surface); --foil-rest: .09; --foil-active: .2; }
.tcg-card.epique { --tone: var(--epic-tone); --surface: var(--epic-surface); --foil-rest: .16; --foil-active: .34; }
.tcg-card.legendaire { --tone: var(--legend-tone); --surface: var(--legend-surface); --foil-rest: .23; --foil-active: .46; }
button.tcg-card { min-height: 0; cursor: pointer; transition: transform .15s, box-shadow .15s; }
button.tcg-card:hover { background: none; }
.tcg-face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  isolation: isolate;
  padding: 0 6cqw 4.5cqw;
  border: max(1px, .7cqw) solid var(--line);
  border-radius: inherit;
  background: var(--surface);
  line-height: 1.2;
}
.tcg-card:not(.commun) .tcg-face { border-color: var(--tone); }
.tcg-card.unowned .tcg-face { border-style: dashed; }
.tcg-face > * { position: relative; z-index: 1; display: block; flex: none; min-width: 0; }
.tcg-brand {
  margin: 0 -6cqw;
  padding: 2.8cqw 6cqw;
  background: var(--card-brand-orange);
  color: #ffffff;
  font-size: 5.6cqw;
  font-weight: 700;
  letter-spacing: .04em;
}
.tcg-name {
  height: 2.3em;
  margin: 4.5cqw 0 0;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  color: var(--card-name-ink);
  font-size: 9cqw;
  font-weight: 750;
  line-height: 1.15;
  letter-spacing: -.01em;
  overflow-wrap: anywhere;
  text-wrap: balance;
}
.tcg-quay, .tcg-place { height: 1.25em; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.tcg-quay { margin-top: 1.5cqw; color: var(--tone); font-size: 5.4cqw; font-weight: 650; }
.tcg-face > .tcg-art { flex: 1 1 0; min-height: 0; display: flex; align-items: center; justify-content: center; color: var(--tone); }
.tcg-art .town-icon, .tcg-art .stop-sign-icon { width: 38cqw; height: 38cqw; max-height: 100%; }
.tcg-art .line-number { font-size: 21cqw; }
.tcg-card.unowned .tcg-art { opacity: .5; }
.tcg-place { margin-bottom: 2.5cqw; color: var(--muted); font-size: 5.2cqw; }
.tcg-type {
  display: flex !important;
  justify-content: space-between;
  gap: 2cqw;
  margin-bottom: 2.5cqw;
  color: var(--tone);
  font-size: 4.6cqw;
  letter-spacing: .06em;
  text-transform: uppercase;
  white-space: nowrap;
}
.tcg-foot {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  gap: 2cqw;
  padding-top: 2.8cqw;
  border-top: 1px solid var(--line);
  color: var(--tone);
  font-size: 4.6cqw;
}
.tcg-foot .street-cred { min-height: 0; gap: 1.8cqw; color: var(--ink); font-size: 7.2cqw; font-weight: 750; }
.tcg-foot .street-cred > svg { width: 8.5cqw; height: 5.5cqw; }

/* Favorite: the only control laid over the card, in the orange band. 44 px hit area. */
/* « Non possédée » sticker: printed on the brand band, scaled with the card like the rest of the face. */
.tcg-missing {
  position: absolute;
  z-index: 3;
  top: max(2px, 2.7cqw);
  right: max(3px, 3cqw);
  padding: max(1px, .7cqw) max(5px, 2.4cqw);
  border: max(1px, .3cqw) dashed #ffffffb3;
  border-radius: 99px;
  background: #111111b8;
  color: #ffffff;
  font-size: max(9px, 4cqw);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: .02em;
  white-space: nowrap;
  pointer-events: none;
}
.tcg-card .card-favorite {
  position: absolute;
  z-index: 3;
  top: 0;
  right: 0;
  width: 44px;
  height: 44px;
  min-height: 0;
  padding: 0 3.5cqw 0 0;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  border: 0;
  border-radius: 0 12px 0 0;
  background: transparent;
  color: #ffffffb0;
  font-size: 9cqw;
  line-height: 12.3cqw;
}
.tcg-card .card-favorite:hover, .tcg-card .card-favorite[aria-pressed="true"] { color: #ffd23a; background: transparent; }
.tcg-card .card-favorite:focus-visible { outline: 2px solid #ffffff; outline-offset: -4px; }

/* Holographic surfaces: pure CSS, no textures or animation loop. Foil and glare sit above the whole face
   (brand band and line capsule included), like the varnish of a printed card; soft-light keeps the text readable. */
.tcg-card:is(.rare, .epique, .legendaire) .tcg-face::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  mix-blend-mode: soft-light;
  background-image:
    repeating-linear-gradient(115deg, #f69ea7 0%, #f4d98c 15%, #a3ddb3 30%, #99d9ed 45%, #b2a3e5 60%, #f69ea7 75%),
    repeating-linear-gradient(38deg, transparent 0 6cqw, #ffffff90 6.5cqw, transparent 7cqw 13cqw);
  background-size: 260% 260%, 100% 100%;
  background-position: var(--shine-x) var(--shine-y), center;
  background-blend-mode: soft-light;
  opacity: var(--foil-rest);
  transition: opacity 180ms ease;
}
.tcg-card.legendaire .tcg-face::before {
  background-image:
    repeating-linear-gradient(115deg, #f4c362 0%, #f6eba2 13%, #afd8d5 26%, #dcb3e4 39%, #f4c362 52%),
    repeating-linear-gradient(38deg, transparent 0 4cqw, #ffffffb0 4.5cqw, transparent 5cqw 9cqw);
}
.tcg-card:focus-within .tcg-face::before, .tcg-card:focus-visible .tcg-face::before { opacity: var(--foil-active); }
.tcg-card.unowned .tcg-face::before { opacity: calc(var(--foil-rest) * .5); }
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  article.tcg-card, button.battle-card, .card-ghost .battle-card {
    transform: perspective(850px) rotateX(var(--tilt-x, 0deg)) rotateY(var(--tilt-y, 0deg));
    transition: transform 180ms ease-out, box-shadow 180ms ease-out;
  }
  .tcg-card.is-tilting { z-index: 2; will-change: transform; box-shadow: 0 14px 28px -16px #0006; }
  .tcg-card.is-tilting .tcg-face::before { opacity: var(--foil-active); }
  .tcg-card.unowned.is-tilting .tcg-face::before { opacity: calc(var(--foil-active) * .5); }
  .tcg-face::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    mix-blend-mode: soft-light;
    background: radial-gradient(circle at var(--shine-x) var(--shine-y), rgb(255 255 255 / .5) 0%, rgb(255 255 255 / .14) 28%, transparent 60%);
    opacity: 0;
    transition: opacity 180ms ease-out;
  }
  .tcg-card.is-tilting .tcg-face::after { opacity: 1; }
}
/* Dark mode: a softer glare, so it reads as a reflection rather than a spotlight. */
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) and (prefers-color-scheme: dark) {
  .tcg-face::after { background: radial-gradient(circle at var(--shine-x) var(--shine-y), rgb(255 255 255 / .22) 0%, rgb(255 255 255 / .06) 28%, transparent 55%); }
}
@media (prefers-reduced-motion: reduce) {
  .tcg-card, .tcg-face::before, .tcg-face::after { transition: none; }
}

/* A card and what you can do with it: buttons sit under the card, never on it. */
.card-slot { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.card-actions { display: flex; flex-direction: column; gap: 8px; }
.card-actions button { width: 100%; min-height: 44px; padding: 9px; font-size: 12px; background: var(--panel); border-color: var(--line); }
.card-actions .ownership { margin: 0; }
.card-actions .copy-label { font-size: 12px; color: var(--muted); }
.card-actions .collection-card-footer button { width: auto; font-size: 11px; flex-shrink: 0; }
@media (max-width: 700px) { .card-actions .collection-card-footer button { width: 100%; } }
.card-front > .card-slot { height: 100%; }

/* Horoscope edition: a regular card with a permanent iridescent varnish and twinkling stars. */
.tcg-card.horoscope-card { --foil-rest: .32; --foil-active: .55; --horoscope-star: #c9a2ff; --horoscope-ink: #7a4fc0; }
.tcg-card.horoscope-card .tcg-quay { display: flex; flex-wrap: wrap; column-gap: .3em; height: auto; max-height: 2.5em; white-space: normal; }
.tcg-card.horoscope-card .tcg-quay > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tcg-card.horoscope-card .horoscope-tag, .horoscope-bonus { color: var(--horoscope-ink); }
.horoscope-bonus { font-size: .8em; font-weight: 700; white-space: nowrap; }
.tcg-card.horoscope-card .tcg-face::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  mix-blend-mode: soft-light;
  background-image:
    repeating-linear-gradient(120deg, #ff9ad5 0%, #c3a4ff 14%, #8fd8ff 28%, #9ff2c9 42%, #fff09a 56%, #ff9ad5 70%),
    repeating-linear-gradient(45deg, transparent 0 5cqw, #ffffffa0 5.5cqw, transparent 6cqw 11cqw);
  background-size: 260% 260%, 100% 100%;
  background-position: var(--shine-x) var(--shine-y), center;
  background-blend-mode: soft-light;
  opacity: var(--foil-rest);
  transition: opacity 180ms ease;
}
.horoscope-stars { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.horoscope-stars i { position: absolute; color: var(--horoscope-star); font-style: normal; font-size: 6cqw; line-height: 1; text-shadow: 0 0 2cqw var(--horoscope-star); opacity: .85; }
.horoscope-stars i:nth-child(1) { top: 20%; left: 8%; font-size: 7cqw; }
.horoscope-stars i:nth-child(2) { top: 27%; right: 9%; font-size: 5cqw; }
.horoscope-stars i:nth-child(3) { top: 46%; left: 14%; font-size: 4cqw; }
.horoscope-stars i:nth-child(4) { top: 40%; right: 16%; font-size: 8cqw; }
.horoscope-stars i:nth-child(5) { top: 60%; left: 6%; font-size: 5cqw; }
.horoscope-stars i:nth-child(6) { top: 58%; right: 7%; font-size: 4.5cqw; }
.horoscope-stars i:nth-child(7) { top: 33%; left: 47%; font-size: 3.5cqw; }
@media (prefers-reduced-motion: no-preference) {
  .horoscope-stars i { animation: horoscope-twinkle 2.6s ease-in-out infinite; }
  .horoscope-stars i:nth-child(2n) { animation-delay: -.9s; }
  .horoscope-stars i:nth-child(3n) { animation-delay: -1.7s; animation-duration: 3.4s; }
}
@keyframes horoscope-twinkle { 0%, 100% { opacity: .25; transform: scale(.7) rotate(0deg); } 50% { opacity: .95; transform: scale(1.1) rotate(20deg); } }
@media (prefers-color-scheme: dark) { .tcg-card.horoscope-card { --horoscope-star: #e2ccff; --horoscope-ink: #cfb2ff; } }
