/* ---------- קלף שחקן ---------- */
/* הכל נמדד ביחידות cqw (אחוז מרוחב הקלף), כך שהקלף נראה זהה בכל גודל.
   גובה הקלף = 137cqw. הרצועה התחתונה של התבנית מתחילה בערך ב-88cqw. */
.card {
  --ink: #3a2606;        /* צבע המספרים */
  --name: #3a2606;       /* צבע השם */
  --name-glow: rgba(255, 238, 170, .7);
  display: block;
  position: relative;
  width: 100%;
  aspect-ratio: 728 / 999;
  container-type: inline-size;
  direction: ltr;        /* תמיד: מדינה משמאל, ליגה באמצע, קבוצה מימין */
  font-family: "Bahnschrift", "Arial Narrow", "Segoe UI", system-ui, sans-serif;
  pointer-events: auto;
}
.card img { image-rendering: auto; }

.tier-silver { --ink: #18273a; --name: #f2f7fc; --name-glow: rgba(0, 0, 0, .55); }
.tier-bronze { --ink: #3b1c07; --name: #ffe8c9; --name-glow: rgba(0, 0, 0, .6); }
.tier-totw   { --ink: #f2d47c; --name: #f6e09a; --name-glow: rgba(0, 0, 0, .75); }
.tier-future { --ink: #f4f8ff; --name: #ffffff; --name-glow: rgba(36, 12, 110, .95); }
.tier-legend { --ink: #5a3f0c; --name: #3d2a05; --name-glow: rgba(255, 246, 215, .9); }   /* אגדות: כתב חום-זהב על לבן */
/* בלתי נשכחים: כתב שמנת חם על כחול-כהה, עם צל כהה */
.tier-hero   { --ink: #fff0dc; --name: #ffffff; --name-glow: rgba(8, 14, 30, .95); }
.tier-hero .card-rating,
.tier-hero .card-pos { text-shadow: 0 .6cqw 0 var(--name-glow), 0 0 1.4cqw rgba(8, 14, 30, .85); }
/* שחקן החודש: כתב לבן עם קו מתאר כהה, כי הרקע הוא טלאים בהירים וכהים */
.tier-potm   { --ink: #ffffff; --name: #ffffff; --name-glow: rgba(6, 12, 40, .95); }
.tier-potm .card-rating,
.tier-potm .card-pos { text-shadow: 0 .6cqw 0 var(--name-glow), 0 0 1.6cqw rgba(6, 12, 40, .9), 0 0 .5cqw rgba(6, 12, 40, .9); }

/* ביצועים: בגלריה יש עשרות קלפים על המסך, ולכן במצב רגיל הקלף הוא שכבה שטוחה בלי פילטרים.
   הצל הוא box-shadow (ולא filter), וההטיה התלת ממדית והברק מופעלים רק כשהקלף פעיל. */
.card-inner {
  position: absolute;
  inset: 0;
  transition: transform .25s var(--ease-out);
}
.card-inner::before {
  content: "";
  position: absolute;
  inset: 2% 3% 3%;
  border-radius: 12cqw / 9cqw;
  box-shadow: 0 2cqw 2.6cqw rgba(0, 0, 0, .5);
}
body.input-mouse .card:hover .card-inner,
body.input-mouse .slot:hover .card-inner,
body.input-mouse .sm-card:hover .card-inner,
.slot.nav-focus .card-inner,
.sm-card.nav-focus .card-inner,
.slot:active .card-inner,
.slot.pressed .card-inner {
  transform: perspective(900px) translateY(var(--ty, 0)) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) scale(var(--s, 1));
}

.card-bg { position: absolute; inset: 0; width: 100%; height: 100%; }

.card-photo {
  position: absolute;
  left: 21cqw;
  top: 12cqw;
  width: 76cqw;
  height: 76cqw;
  object-fit: contain;
  object-position: bottom;
}

/* Dynamic Image (קלפי פרומו): תמונת חצי גוף על כל שטח הקלף שמעל רצועת השם (88.6cqw), דוהה למטה,
   עם הילה בצבעי הקלף. כל הקבצים ממוסגרים זהה (קו העיניים ב-27cqw מראש התמונה), ולכן אין כאן התאמה לכל שחקן. */
.card-dyn .card-photo {
  left: 5.5cqw;
  top: 3cqw;
  width: 89.3cqw;
  height: 85.6cqw;
  object-fit: fill;
  -webkit-mask-image: linear-gradient(to bottom, #000 80%, transparent 99%);
  mask-image: linear-gradient(to bottom, #000 80%, transparent 99%);
  filter: drop-shadow(0 0 1.1cqw rgba(120, 220, 255, .6)) drop-shadow(0 0 2.4cqw rgba(255, 90, 210, .35));
}
.card-dyn .card-rating,
.card-dyn .card-pos { text-shadow: 0 .6cqw 0 var(--name-glow), 0 0 2.5cqw rgba(20, 0, 60, .9); }

.card-rating,
.card-pos {
  position: absolute;
  left: 7cqw;
  width: 24cqw;
  text-align: center;
  color: var(--ink);
  font-weight: 800;
  text-shadow: 0 .6cqw 0 var(--name-glow);
}
.card-rating { top: 15cqw; font-size: 21cqw; line-height: 1; letter-spacing: -.02em; }
.card-pos    { top: 38cqw; font-size: 9.5cqw; line-height: 1; letter-spacing: .06em; }
.card-pos::after {
  content: "";
  display: block;
  width: 62%;
  height: .9cqw;
  margin: 3cqw auto 0;
  background: var(--ink);
  opacity: .5;
  border-radius: 1cqw;
}

/* עמדות נוספות: תג תלוי על הקצה הימני של הקלף (חצי בחוץ, כמו הפלייסטייל משמאל), עם תא לכל עמדה. מופיע רק בקלף מוגדל */
.card-alts {
  --cell: min(12cqw, calc(46cqw / var(--n, 2)));    /* בהרבה עמדות התאים נהיים נמוכים יותר */
  --alt-fill: #d0b77f;
  --alt-line: #4d4228;
  --alt-ink: #4a3f26;
  --cut: 2.4cqw;
  position: absolute;
  left: 91.5cqw;
  top: 25cqw;
  width: 17cqw;
  padding: .7cqw;
  background: var(--alt-line);
  clip-path: polygon(var(--cut) 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, var(--cut) 100%, 0 calc(100% - var(--cut)), 0 var(--cut));
  pointer-events: none;
}
.card-alts-in {
  display: flex;
  flex-direction: column;
  background: var(--alt-fill);
  clip-path: polygon(1.7cqw 0, calc(100% - 1.7cqw) 0, 100% 1.7cqw, 100% calc(100% - 1.7cqw), calc(100% - 1.7cqw) 100%, 1.7cqw 100%, 0 calc(100% - 1.7cqw), 0 1.7cqw);
}
.card-alt {
  height: var(--cell);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: calc(var(--cell) * .56);
  font-weight: 800;
  line-height: 1;
  letter-spacing: .02em;
  color: var(--alt-ink);
}
.card-alt + .card-alt { box-shadow: inset 0 .5cqw 0 var(--alt-line); }
.tier-silver .card-alts { --alt-fill: #b8c4d2; --alt-line: #2f4258; --alt-ink: #22344a; }
.tier-bronze .card-alts { --alt-fill: #c4905f; --alt-line: #43210a; --alt-ink: #3b1c07; }
.tier-totw   .card-alts { --alt-fill: #2a2f4a; --alt-line: #f2d47c; --alt-ink: #f2d47c; }
.tier-future .card-alts { --alt-fill: #2a1a68; --alt-line: #6fdcff; --alt-ink: #c8f2ff; }
.tier-legend .card-alts { --alt-fill: #fbf6e6; --alt-line: #b8862e; --alt-ink: #5a3f0c; }
.tier-potm   .card-alts { --alt-fill: #13245a; --alt-line: #f7de14; --alt-ink: #ffffff; }
.tier-hero   .card-alts { --alt-fill: #1d3150; --alt-line: #ff8a3a; --alt-ink: #ffe2c4; }

/* פלייסטייל: תלוי על הקצה השמאלי של הקלף (חצי בחוץ), בגובה הרצועה של השם */
.card-style {
  position: absolute;
  left: -8cqw;
  top: 74.7cqw;
  width: 16cqw;
  height: auto;
  pointer-events: none;
}

/* הצבע של האייקון לפי סוג הקלף מגיע מהקובץ עצמו (CardData.playstyleImg). בקלף פרומו רק זוהר תכלת מסביב */
.tier-future .card-style { filter: drop-shadow(0 0 1.2cqw rgba(120, 200, 255, .6)); }

/* קלף מאמן: הפרצוף במרכז (אין עמודת דירוג), ושתי תגיות במקום שלוש */
.card-coach .card-photo { left: 12cqw; }
.card-coach .card-badges { gap: 19cqw; }

.card-name {
  position: absolute;
  left: 6cqw;
  right: 6cqw;
  top: 91cqw;
  height: 13cqw;
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  font-weight: 800;
  letter-spacing: .01em;
  color: var(--name);
  font-size: min(11.5cqw, calc(80cqw / (var(--len, 10) * .6)));
  text-shadow: 0 .7cqw 0 var(--name-glow);
}

.card-badges {
  position: absolute;
  left: 0;
  right: 0;
  top: 108cqw;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10cqw;
}
.badge {
  width: 15cqw;
  height: 15cqw;
  object-fit: contain;
}
.badge-flag { border-radius: 50%; box-shadow: 0 .8cqw 1cqw rgba(0, 0, 0, .4); }

/* ברק: נחתך בצורת הקלף עצמו באמצעות המסכה. קיים רק כשהקלף פעיל, כי מסכה לכל קלף יקרה */
.card-shine {
  display: none;
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
}
.tier-gold   .card-shine { -webkit-mask-image: url("../assets/img/gold-card.png");   mask-image: url("../assets/img/gold-card.png"); }
.tier-silver .card-shine { -webkit-mask-image: url("../assets/img/silver-card.png"); mask-image: url("../assets/img/silver-card.png"); }
.tier-bronze .card-shine { -webkit-mask-image: url("../assets/img/bronze-card.png"); mask-image: url("../assets/img/bronze-card.png"); }
.tier-totw   .card-shine { -webkit-mask-image: url("../assets/img/totw-card.png");   mask-image: url("../assets/img/totw-card.png"); }
.tier-future .card-shine { -webkit-mask-image: url("../assets/img/future-card.png"); mask-image: url("../assets/img/future-card.png"); }
.tier-legend .card-shine { -webkit-mask-image: url("../assets/img/legend-card.png"); mask-image: url("../assets/img/legend-card.png"); }
.tier-potm   .card-shine { -webkit-mask-image: url("../assets/img/potm-card.png");   mask-image: url("../assets/img/potm-card.png"); }
.tier-hero   .card-shine { -webkit-mask-image: url("../assets/img/hero-card.png");   mask-image: url("../assets/img/hero-card.png"); }
.tier-hero   .card-shine::after { background: linear-gradient(105deg, transparent 36%, rgba(255, 170, 90, .45) 50%, transparent 64%); }   /* ברק כתום */
.tier-legend .card-shine::after { background: linear-gradient(105deg, transparent 36%, rgba(255, 226, 140, .6) 50%, transparent 64%); }   /* ברק זהוב על הקלף הלבן */

.card-shine::before,
.card-shine::after { content: ""; position: absolute; inset: 0; }
.card-shine::before {
  background: radial-gradient(circle at var(--mx, 50%) var(--my, 28%), rgba(255, 255, 255, .5), rgba(255, 255, 255, 0) 52%);
  opacity: 0;
  transition: opacity .3s;
}
.card-shine::after {
  background: linear-gradient(105deg, transparent 36%, rgba(255, 255, 255, .55) 50%, transparent 64%);
  transform: translateX(-130%);
}
body.input-mouse .card:hover .card-shine,
.slot.nav-focus .card-shine,
.sm-card.nav-focus .card-shine,
.card.sweep .card-shine { display: block; }
body.input-mouse .card:hover .card-shine::before { opacity: 1; }
body.input-mouse .card:hover .card-shine::after,
.card.sweep .card-shine::after { animation: card-sweep .95s var(--ease-out) var(--sweep-delay, 0s); }
@keyframes card-sweep { to { transform: translateX(130%); } }

/* קלף שעוד לא נאסף: שחור לבן ועמום */
.card.locked .card-inner {
  filter: grayscale(1) brightness(.58) contrast(.92);
}
.card.locked .card-shine::before { opacity: 0 !important; }
.card.locked .card-shine::after { animation: none !important; }
