* {
  box-sizing: border-box;
}

:root {
  --page-bg: #0d0d0f;
  --text-main: #ffffff;
  --text-muted: rgba(255, 255, 255, 0.78);
  --gold-1: #f3dfae;
  --gold-2: #c9a86a;
  --gold-3: #6f5730;
  --gold-4: #9f7a43;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background:
    radial-gradient(circle at top, rgba(255,255,255,0.05), transparent 30%),
    linear-gradient(180deg, #111214, #09090b);
  color: var(--text-main);
}

.page {
  min-height: 100vh;
  padding: 28px;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 28px;
  align-items: start;
}

.player-card {
  position: relative;
  width: 100%;
  max-width: 290px;
  aspect-ratio: 0.69;
  margin: 0 auto;
  overflow: hidden;
  background: #181818;
  filter: drop-shadow(0 16px 24px rgba(0,0,0,0.45));
  clip-path: polygon(
    10% 7%,
    17% 4.2%,
    28% 2.7%,
    39% 4.2%,
    45% 2.1%,
    48% 0.7%,
    50% 0%,
    52% 0.7%,
    55% 2.1%,
    61% 4.2%,
    72% 2.7%,
    83% 4.2%,
    90% 7%,
    95.8% 12.5%,
    95.8% 85.5%,
    92.8% 92.8%,
    87.8% 97.8%,
    12.2% 97.8%,
    7.2% 92.8%,
    4.2% 85.5%,
    4.2% 12.5%
  );
}

.card-frame,
.card-inner,
.card-glow,
.card-shine {
  position: absolute;
  inset: 0;
  clip-path: inherit;
}

.card-frame {
  background:
    linear-gradient(145deg, var(--gold-1) 0%, var(--gold-2) 25%, var(--gold-3) 62%, var(--gold-1) 100%);
}

.card-inner {
  inset: 4px;
  background:
    radial-gradient(circle at 20% 18%, color-mix(in srgb, var(--team-primary) 72%, white 28%), transparent 37%),
    radial-gradient(circle at 80% 22%, color-mix(in srgb, var(--team-secondary) 52%, white 12%), transparent 36%),
    radial-gradient(circle at 50% 68%, rgba(255,255,255,0.08), transparent 34%),
    linear-gradient(
      180deg,
      color-mix(in srgb, var(--team-primary) 78%, #0b0b0b 22%) 0%,
      color-mix(in srgb, var(--team-primary) 64%, #111111 36%) 50%,
      color-mix(in srgb, var(--team-primary) 52%, #0a0a0a 48%) 100%
    );
  border: 1px solid rgba(255,255,255,0.06);
}

.card-glow {
  inset: 8px;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.10), transparent 18%),
    linear-gradient(180deg, transparent 60%, rgba(255,255,255,0.03));
  pointer-events: none;
}

.card-shine {
  inset: 10px;
  background:
    linear-gradient(115deg, rgba(255,255,255,0.18) 0%, rgba(255,255,255,0.03) 18%, transparent 28%),
    radial-gradient(circle at 50% 102%, color-mix(in srgb, var(--team-primary) 18%, transparent), transparent 26%);
  mix-blend-mode: screen;
  opacity: 0.8;
  pointer-events: none;
}

.card-header {
  position: absolute;
  top: 48px;
  left: 22px;
  right: 84px;
  z-index: 3;
  color: var(--card-title-color, #f4e4b8);
  text-shadow: 0 2px 8px rgba(0,0,0,0.55);
}

.player-name {
  font-size: 28px;
  font-weight: 900;
  line-height: 0.98;
  letter-spacing: 0.2px;
  word-break: break-word;
}

.player-subtitle {
  margin-top: 8px;
  display: inline-block;
  max-width: 100%;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  line-height: 1.25;
  letter-spacing: 0.85px;
  text-transform: uppercase;
  color: var(--card-subtitle-color, var(--text-muted));
  background: color-mix(in srgb, var(--team-primary) 24%, rgba(0,0,0,0.66));
  box-shadow:
    0 0 16px color-mix(in srgb, var(--team-primary) 55%, transparent),
    0 2px 10px rgba(0,0,0,0.5),
    inset 0 1px 0 rgba(255,255,255,0.22);
  text-shadow:
    0 0 10px color-mix(in srgb, var(--team-primary) 38%, transparent),
    0 1px 4px rgba(0,0,0,0.75);
}

.player-position {
  margin-top: 6px;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.9px;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--card-title-color, #f4e4b8) 88%, #ffffff 12%);
}

.team-logo {
  position: absolute;
  top: 42px;
  right: 20px;
  width: 54px;
  height: 54px;
  object-fit: contain;
  z-index: 4;
  border-radius: 10px;
  background: rgba(255,255,255,0.08);
  padding: 4px;
  box-shadow:
    0 4px 14px rgba(0,0,0,0.35),
    inset 0 1px 0 rgba(255,255,255,0.08);
}

.player-photo-wrap {
  position: absolute;
  left: 18px;
  right: 18px;
  top: 76px;
  height: 51%;
  z-index: 2;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  overflow: hidden;
}

.player-photo {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center bottom;
  filter: drop-shadow(0 10px 22px rgba(0,0,0,0.48));
}

.player-photo-placeholder {
  display: none;
  width: 72%;
  height: 78%;
  border-radius: 24px;
  border: 2px dashed rgba(255,255,255,0.18);
  background:
    radial-gradient(circle at 50% 30%, rgba(255,255,255,0.08), transparent 30%),
    linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.01));
  color: rgba(255,255,255,0.55);
  align-items: center;
  justify-content: center;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-size: 12px;
  font-weight: 700;
}

.player-photo-wrap.empty-photo .player-photo-placeholder {
  display: flex;
}

.bottom-panel {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 10px;
  z-index: 4;
  border-radius: 18px;
  padding: 10px 12px 9px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.09), rgba(255,255,255,0.03)),
    rgba(7,7,7,0.74);
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.08),
    0 8px 20px rgba(0,0,0,0.25);
  backdrop-filter: blur(4px);
}

.info-grid {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.name-item,
.meta-item,
.stat-item {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px 10px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 5px;
  border-top: 1px solid rgba(255,255,255,0.14);
  padding-top: 6px;
}

.label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.95px;
  color: rgba(255,255,255,0.66);
}

.value {
  margin-top: 2px;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.15;
  color: #fff2cd;
  word-break: break-word;
}

.name-item {
  align-items: center;
  text-align: center;
}

.name-item .value {
  margin-top: 0;
  font-size: 16px;
  line-height: 1.1;
  font-weight: 800;
}

.stat-item {
  align-items: center;
  justify-content: center;
  text-align: center;
  border-radius: 8px;
  padding: 2px 0;
}

.stat-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.85px;
  color: rgba(255,255,255,0.72);
}

.stat-value {
  margin-top: 1px;
  font-size: 15px;
  font-weight: 900;
  line-height: 1.05;
  color: #fff2cd;
}

.stat-item.stat-high {
  background: linear-gradient(180deg, rgba(17, 76, 41, 0.88), rgba(10, 44, 24, 0.88));
}

.stat-item.stat-high .stat-label {
  color: #dafde7;
}

.stat-item.stat-high .stat-value {
  color: #66ff99;
}

.stat-item.stat-mid {
  background: linear-gradient(180deg, rgba(93, 72, 16, 0.88), rgba(60, 45, 8, 0.88));
}

.stat-item.stat-mid .stat-label {
  color: #fff5cd;
}

.stat-item.stat-mid .stat-value {
  color: #ffd84d;
}

.stat-item.stat-low {
  background: linear-gradient(180deg, rgba(96, 31, 31, 0.88), rgba(66, 17, 17, 0.88));
}

.stat-item.stat-low .stat-label {
  color: #ffd8d8;
}

.stat-item.stat-low .stat-value {
  color: #ff6b6b;
}

.stat-item.stat-neutral {
  background: rgba(255, 255, 255, 0.06);
}

.meta-item {
  align-items: center;
  text-align: center;
}

.error-box {
  max-width: 480px;
  margin: 60px auto;
  padding: 18px 20px;
  border-radius: 14px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  color: #fff;
  text-align: center;
}

@media (max-width: 640px) {
  .page {
    padding: 16px;
  }

  .cards-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .player-card {
    max-width: 320px;
  }
}
