/* ── FieldCard (full-bleed, portrait) ─────────────────────────────────────── */

:root {
  /* Shared by full cards, goalkeepers and static Android match cards. */
  --card-legendary-shadow: 0 0 16px rgba(255,215,0,0.55), 0 4px 16px rgba(0,0,0,0.5);
  --card-legendary-shadow-peak: 0 0 22px rgba(255,215,0,0.72), 0 4px 16px rgba(0,0,0,0.5);
}

.fc {
  width: 68px;
  height: 95px;
  border-radius: 10px;
  /* Keep the frame/glow outside the clipping layer.  WebKit can nibble the
     lower rounded corners when an overflow-hidden element is animated or
     rotated; only the artwork needs clipping. */
  overflow: visible;
  border: 2px solid var(--rarity-b, rgba(255,255,255,0.28));
  box-shadow: var(--rarity-s, 0 4px 12px rgba(0,0,0,0.4));
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  cursor: pointer;
  position: relative;
  font-family: 'Inter', sans-serif;
  text-align: left;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.15s, box-shadow 0.15s;
}

.fc--selected {
  border-color: #ff9800 !important;
  transform: translateY(-10px) scale(1.05);
  box-shadow: 0 16px 32px rgba(255,152,0,0.55) !important;
  z-index: 10;
}

.fc--dim { opacity: 0.45; }
.fc--locked { filter: grayscale(1) brightness(.78); }
.fc--destroyed { filter: grayscale(1) brightness(0.45); opacity: 0.6; pointer-events: none; }

.fc-destroyed-overlay {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 6px,
    rgba(0,0,0,0.35) 6px,
    rgba(0,0,0,0.35) 7px
  );
  z-index: 2;
  border-radius: inherit;
}

.fc-badge--destroyed {
  background: rgba(0,0,0,0.75);
  border: 1px solid rgba(255,255,255,0.15);
  font-size: 9px;
}
.fc--new { border-color: #66bb6a !important; box-shadow: 0 0 18px rgba(102,187,106,0.7) !important; }

/* Field size variant - larger cards on pitch */
.fc--field {
  width: 100px;
  height: 140px;
}

.fc--field .fc-rating { font-size: 26px; }
.fc--field .fc-name { font-size: 13px; }
.fc--field .fc-mini-stat { font-size: 11px; }

/* Rarity glow animations */
.fc--legendary {
  border-color: #ffd700 !important;
  animation: fc-legend-pulse 2.4s ease-in-out infinite;
}
@keyframes fc-legend-pulse {
  0%, 100% { box-shadow: var(--card-legendary-shadow); }
  50%       { box-shadow: var(--card-legendary-shadow-peak); }
}

.fc--rare { border-color: #ff9800 !important; }

/* Full-bleed art fills entire card */
.fc-art {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: 8px;
  background: linear-gradient(160deg, var(--card-color, #1a2a1a), #07090e);
}

.fc--goal-premium {
  --rarity-b: #8a6829;
  --rarity-s: 0 0 7px rgba(208, 169, 83, 0.28), 0 4px 16px rgba(0,0,0,0.52);
  border-color: #8a6829 !important;
}

.fc-goal-premium-frame {
  position: absolute;
  inset: 0;
  z-index: 18;
  pointer-events: none;
  border: 3px solid #d8b45c;
  border-radius: inherit;
  box-shadow: 0 0 0 1px #72511b, 0 0 7px rgba(208, 169, 83, 0.28);
}

/* Diagonal streak overlay matching mock */
.fc-art::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    125deg,
    rgba(255,255,255,0.14) 0%,
    transparent 35%,
    transparent 65%,
    rgba(255,255,255,0.05) 100%
  );
  z-index: 1;
  pointer-events: none;
}

.fc-art-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
}

.fc-art-img--background {
  position: absolute;
  inset: 0;
  background-position: top center;
  background-repeat: no-repeat;
  background-size: cover;
}

.fc-svg-wrap {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fc-default-avatar {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Legendary holographic shimmer */
.fc-legendary-shimmer {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    115deg,
    transparent 15%,
    rgba(255,100,200,0.15) 28%,
    rgba(255,215,0,0.22) 38%,
    rgba(100,255,180,0.18) 48%,
    rgba(100,180,255,0.18) 58%,
    rgba(200,100,255,0.15) 68%,
    transparent 80%
  );
  background-size: 220% 100%;
  animation: fc-shimmer 3s linear infinite;
  pointer-events: none;
  z-index: 1;
  mix-blend-mode: screen;
}
@keyframes fc-shimmer {
  0%   { background-position: 220% 0; }
  100% { background-position: -220% 0; }
}

/* Legendary border pulse */
.fc--legendary {
  animation: legendaryBorderPulse 3s ease-in-out infinite;
}
@keyframes legendaryBorderPulse {
  0%, 100% { box-shadow: var(--rarity-s); }
  50%       { box-shadow: var(--card-legendary-shadow-peak); }
}

/* Rare shine */
.fc-rare-shine {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    115deg,
    transparent 30%,
    rgba(255,152,0,0.14) 50%,
    transparent 70%
  );
  background-size: 200% 100%;
  animation: fc-rare-sweep 4s linear infinite;
  pointer-events: none;
  z-index: 1;
}
@keyframes fc-rare-sweep {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Top overlay: position badge (left) + primary rating (right) */
.fc-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 5px 5px 0;
  z-index: 2;
}

.fc-pos-badge {
  font-family: 'Inter', sans-serif;
  font-size: 8px;
  font-weight: 700;
  color: white;
  background: var(--type-c);
  border-radius: 4px;
  padding: 2px 5px;
  letter-spacing: 0.5px;
  line-height: 1.3;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.fc-rating {
  font-family: 'Bangers', cursive;
  font-size: 24px;
  line-height: 1;
  color: white;
  text-shadow: 0 2px 8px rgba(0,0,0,1), 0 0 16px rgba(0,0,0,0.9), 1px 1px 0 rgba(0,0,0,0.8);
  letter-spacing: 1px;
}

/* Bottom gradient overlay: name + stats */
.fc-bottom {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.95) 0%, rgba(0,0,0,0.7) 55%, transparent 100%);
  padding: 18px 4px 5px;
  z-index: 2;
}

.fc-name {
  font-family: 'Bangers', cursive;
  font-size: 12px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: white;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.15;
  text-shadow: 0 1px 6px rgba(0,0,0,1), 0 0 3px rgba(0,0,0,1);
  text-align: left;
}

.fc-stats-row {
  display: flex;
  gap: 3px;
  align-items: center;
  margin-top: 2px;
}

.fc-mini-stat {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  font-family: 'Inter', sans-serif;
  font-size: 10px;
  font-weight: 700;
  color: white;
  text-shadow: 0 1px 4px rgba(0,0,0,1);
  letter-spacing: 0.2px;
}

.fc-mini-stat--atk { color: #ffab91; }
.fc-mini-stat--def { color: #90caf9; }
.fc-mini-stat--goal { color: #e0f7fa; }

/* Upgrade pips */
.fc-pips {
  position: absolute;
  top: 5px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 3px;
  z-index: 3;
}

.fc-pip {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #ffd700;
  box-shadow: 0 0 4px rgba(255,215,0,0.8);
}

/* Status badges */
.fc-badge {
  position: absolute;
  bottom: 30px;
  right: 4px;
  font-size: 7px;
  font-weight: 900;
  padding: 1px 4px;
  border-radius: 4px;
  color: white;
  z-index: 3;
}
.fc-badge--new  { background: #2e7d32; }

/* ── Activatable ability indicator ────────────────────────────────────────── */

.fc--can-activate {
  border-color: #ffd600 !important;
  box-shadow: 0 0 10px rgba(255,214,0,0.55), var(--rarity-s, 0 4px 12px rgba(0,0,0,0.4)) !important;
  animation: fc-ability-pulse 1.4s ease-in-out infinite;
}

.fc--ability-hint {
  border-color: #fff176 !important;
  box-shadow: 0 0 0 3px rgba(255,241,118,0.42), 0 0 26px rgba(255,214,0,0.9), var(--rarity-s, 0 4px 12px rgba(0,0,0,0.4)) !important;
  animation: fc-tutorial-ability-pulse 0.9s ease-in-out infinite;
}

.fc--ability-hint .fc-ability-dot {
  background: #ffd600;
  color: #111;
  box-shadow: 0 0 0 4px rgba(255,214,0,0.25), 0 0 18px rgba(255,214,0,0.9);
}

@keyframes fc-ability-pulse {
  0%, 100% { box-shadow: 0 0 8px rgba(255,214,0,0.45); }
  50%       { box-shadow: 0 0 18px rgba(255,214,0,0.85); }
}

@keyframes fc-tutorial-ability-pulse {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-2px) scale(1.045); }
}

.fc-ability-dot {
  position: absolute;
  top: 50%;
  right: 3px;
  font-size: 11px;
  line-height: 1;
  z-index: 4;
  background: rgba(0,0,0,0.82);
  color: #ffd600;
  border-radius: 4px;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 4px rgba(0,0,0,0.7);
  animation: fc-ability-bounce 1.4s ease-in-out infinite;
  pointer-events: none;
}

.fc-ability-dot--limited {
  width: auto;
  min-width: 25px;
  padding: 0 4px;
  gap: 2px;
}

.fc-ability-count {
  font-family: 'Inter', sans-serif;
  font-size: 9px;
  font-weight: 900;
  line-height: 1;
  color: #fff59d;
}

@keyframes fc-ability-bounce {
  0%, 100% { transform: translateY(-50%) scale(1); }
  50%       { transform: translateY(-50%) scale(1.15); }
}

/* Face-down card */
.fc--back {
  border-radius: 10px;
  border: 2px solid rgba(255,255,255,0.12);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
  background: #081624;
}

.fc-back-art { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.fc--back-destroyed {
  border-color: #8493916b;
  box-shadow: 0 2px 5px #0008;
  /* Small tears follow the fracture exits without changing the card's footprint. */
  clip-path: polygon(0 0, 32% 0, 36% 5%, 40% 0, 100% 0, 100% 32%, 94% 36%, 100% 39%, 100% 100%, 70% 100%, 64% 95%, 61% 100%, 0 100%, 0 70%, 6% 67%, 0 63%, 0 43%, 6% 40%, 0 37%);
}
.fc--back-destroyed .fc-back-art { filter: grayscale(.9) brightness(.65); }
.fc-back-damage { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.fc-back-damage path { fill: none; stroke-linejoin: bevel; }
.fc-back-damage__edge { stroke: #c0cbc4; stroke-width: 6.5; opacity: .7; }
.fc-back-damage__split { stroke: #081019; stroke-width: 4.5; }

.fc-back-pattern {
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(
      45deg,
      rgba(0,230,118,0.04) 0px,
      rgba(0,230,118,0.04) 1px,
      transparent 1px,
      transparent 12px
    );
}

.fc-back-logo {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  z-index: 1;
}

.fc-back-ball { font-size: 24px; }
.fc-back-label {
  font-family: 'Bangers', cursive;
  font-size: 14px;
  letter-spacing: 3px;
  color: #00e676;
  line-height: 1;
}
.fc-back-sub {
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 2px;
  color: rgba(0,230,118,0.5);
}

/* ── Mobile scaling ──────────────────────────────────────────────────────── */

@media (max-height: 750px) {
  .fc--field {
    width: 76px;
    height: 106px;
  }
  .fc--field .fc-rating { font-size: 20px; }
  .fc--field .fc-name   { font-size: 11px; }
  .fc--field .fc-mini-stat { font-size: 9px; }

}

/* ── Phone-only: field cards 20% smaller (nie dotyczy desktop 650×900) ───── */

@media (max-width: 699px) {
  .fc--field {
    width: 80px;
    height: 112px;
  }
  .fc--field .fc-rating    { font-size: 21px; }
  .fc--field .fc-name      { font-size: 10px; }
  .fc--field .fc-mini-stat { font-size: 9px; }


  /* Three cards in a sector: keep them small enough to avoid clipping. */
  .msz-cards--full .fc--field {
    width: 57px;
    height: 80px;
  }
  .msz-cards--full .fc--field .fc-rating    { font-size: 16px; }
  .msz-cards--full .fc--field .fc-name      { font-size: 7px; }
  .msz-cards--full .fc--field .fc-mini-stat { font-size: 7px; }
  .msz-cards--full .fc--field .fc-bottom {
    padding: 13px 2px 3px;
  }
  .msz-cards--full .fc--field .fc-stats-row {
    width: 100%;
    gap: 1px;
    justify-content: flex-start;
    overflow: hidden;
  }
  .msz-cards--full .fc--field .fc-mini-stat {
    min-width: 0;
    flex: 0 1 auto;
    gap: 0;
    letter-spacing: 0;
    line-height: 1;
  }
  .msz-cards--full .fc--field .fc-mini-stat .game-icon {
    width: 5px;
    height: 5px;
  }
  .msz-cards--full .fc--field.fc--has-goal .fc-mini-stat {
    font-size: 6.5px;
  }
  .msz-cards--full .fc--field .fc-ability-dot {
    width: 13px;
    height: 13px;
    right: 1px;
    border-radius: 3px;
  }
  .msz-cards--full .fc--field .fc-ability-dot--limited {
    width: auto;
    min-width: 19px;
    padding: 0 2px;
  }
  .msz-cards--full .fc--field .fc-ability-count {
    font-size: 7px;
  }
  .msz-cards--full .fc--field .fc-ability-dot .game-icon {
    width: 10px;
    height: 10px;
  }
  .msz-cards--full .fc--field .fc-pips {
    top: 3px;
    gap: 2px;
  }
  .msz-cards--full .fc--field .fc-pip {
    width: 4px;
    height: 4px;
  }
  /* Premium + max level stacks two frames. Keep both signals subtle when
     three cards are compressed into one match sector. */
  .match-screen .msz-cards--full .fc--field.fc--goal-premium.fc--maxed {
    border-width: 1px;
    border-color: #d8b45c !important;
  }
  .match-screen .msz-cards--full .fc--field.fc--goal-premium.fc--maxed .fc-goal-premium-frame {
    border-width: 1px;
    box-shadow: inset 0 0 0 1px rgba(114, 81, 27, 0.72), 0 0 4px rgba(208, 169, 83, 0.24);
  }
  .msz-cards--full { gap: 2px !important; }
}

/* ── Portrait GK Card ────────────────────────────────────────────────────── */

.gk-card {
  flex: 1;
  min-width: 0;
  max-width: 180px;
  height: 50px;
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid var(--rarity-b, rgba(255,255,255,0.25));
  box-shadow: var(--rarity-s, 0 3px 10px rgba(0,0,0,0.4));
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  position: relative;
  background: linear-gradient(160deg, var(--gk-color, #0d1f12), #07090e);
}

.gk-card--legendary { animation: fc-legend-pulse 2.4s ease-in-out infinite; }

.gk-card--empty {
  background: rgba(255,255,255,0.04);
  border: 2px dashed rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.22);
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 50px;
}

/* Full-bleed avatar */
.gk-art {
  position: absolute;
  inset: 0;
}

.gk-art-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--gk-art-position, center 38%);
  display: block;
}

/* Diagonal shimmer same as FieldCard */
.gk-art::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    125deg,
    rgba(255,255,255,0.1) 0%,
    transparent 35%,
    transparent 65%,
    rgba(255,255,255,0.04) 100%
  );
  z-index: 1;
  pointer-events: none;
}

/* Top-left GK badge */
.gk-top {
  position: absolute;
  top: 5px;
  left: 5px;
  z-index: 2;
}

.gk-pos-badge {
  font-size: 8px;
  font-weight: 900;
  background: #00897b;
  color: white;
  padding: 2px 5px;
  border-radius: 4px;
  letter-spacing: 0.5px;
  line-height: 1.3;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

/* Bottom gradient + name + DEF */
.gk-bottom {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.95) 0%, rgba(0,0,0,0.65) 60%, transparent 100%);
  padding: 16px 6px 5px;
  z-index: 2;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px;
}

.gk-name {
  font-family: 'Bangers', cursive;
  font-size: 13px;
  letter-spacing: 1px;
  color: white;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1;
  text-shadow: 0 1px 6px rgba(0,0,0,1);
  flex: 1;
  min-width: 0;
}

.gk-def-val {
  font-family: 'Bangers', cursive;
  font-size: 14px;
  color: #90caf9;
  line-height: 1;
  text-shadow: 0 1px 4px rgba(0,0,0,1);
  flex-shrink: 0;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

/* ── Max-level (LVL 3) card ──────────────────────────────────────────────── */

.fc--maxed {
  border-color: #e0f0ff !important;
  animation: fc-maxed-border 2.2s ease-in-out infinite !important;
}

@keyframes fc-maxed-border {
  0%   { box-shadow: 0 0 10px rgba(160,220,255,0.6), 0 0 22px rgba(100,180,255,0.35), 0 4px 12px rgba(0,0,0,0.4); }
  33%  { box-shadow: 0 0 16px rgba(220,180,255,0.7), 0 0 32px rgba(160,120,255,0.45), 0 4px 12px rgba(0,0,0,0.4); }
  66%  { box-shadow: 0 0 16px rgba(160,255,210,0.7), 0 0 32px rgba(80,220,160,0.45), 0 4px 12px rgba(0,0,0,0.4); }
  100% { box-shadow: 0 0 10px rgba(160,220,255,0.6), 0 0 22px rgba(100,180,255,0.35), 0 4px 12px rgba(0,0,0,0.4); }
}

/* Rotating star-burst overlay */
.fc-maxed-overlay {
  position: absolute;
  inset: 0;
  background: conic-gradient(
    from 0deg,
    transparent 0deg,
    rgba(255,255,255,0.06) 20deg,
    transparent 40deg,
    rgba(200,230,255,0.05) 70deg,
    transparent 90deg,
    rgba(255,255,255,0.06) 120deg,
    transparent 140deg,
    rgba(200,230,255,0.05) 170deg,
    transparent 180deg,
    rgba(255,255,255,0.06) 200deg,
    transparent 220deg,
    rgba(200,230,255,0.05) 250deg,
    transparent 270deg,
    rgba(255,255,255,0.06) 300deg,
    transparent 320deg,
    rgba(200,230,255,0.05) 350deg,
    transparent 360deg
  );
  animation: fc-maxed-spin 6s linear infinite;
  pointer-events: none;
  z-index: 1;
  mix-blend-mode: screen;
  border-radius: inherit;
}

@keyframes fc-maxed-spin {
  to { transform: rotate(360deg); }
}

/* Crown badge replacing pips at max level */
.fc-maxed-crown {
  position: absolute;
  top: 4px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 9px;
  color: #e0f0ff;
  text-shadow: 0 0 6px rgba(160,220,255,0.9), 0 0 12px rgba(100,180,255,0.7);
  z-index: 3;
  animation: fc-crown-pulse 2.2s ease-in-out infinite;
  line-height: 1;
}

@keyframes fc-crown-pulse {
  0%, 100% { opacity: 0.8; transform: translateX(-50%) scale(1); }
  50%       { opacity: 1;   transform: translateX(-50%) scale(1.25); }
}
