:root {
  --primary-red: #C8102E;
  --text-dark: #222;
  --text-light: #fff;
  --card-bg: #fff;
  --overlay-bg: #f9f9f9;
}

/* Base */
body {
  font-family: Arial, sans-serif;
  margin: 0;
  background: #e5e5e5;
  overflow-x: hidden;
}
h2 {
  text-align: center;
  margin: 16px 0;
  color: var(--text-dark);
}

/* Player Card */
.stats-card {
  max-width: 360px;
  margin: 0 auto 16px;
  background: var(--card-bg);
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  cursor: pointer;
  overflow: hidden;
}
.card-header {
  display: flex;
  align-items: center;
  padding: 12px;
  background: var(--primary-red);
  color: var(--text-light);
}
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  margin-right: 12px;
  border: 2px solid var(--text-light);
}
.info .name {
  margin: 0;
  font-size: 1rem;
  font-weight: bold;
}
.info .team {
  margin: 2px 0 0;
  font-size: 0.85rem;
  opacity: 0.85;
}
.card-body {
  display: flex;
  justify-content: space-between;
  padding: 12px;
  opacity: 0;
  transition: opacity 0.4s ease-in-out;
}
.card-body .stat {
  flex: 1;
  text-align: center;
}
.card-body .number {
  font-size: 1.2rem;
  font-weight: bold;
  color: var(--text-dark);
}
.card-body .label {
  display: block;
  margin-top: 4px;
  font-size: 0.75rem;
  color: #666;
}

/* Overlay */
.overlay {
  position: fixed;
  bottom: -100%;
  left: 0; right: 0;
  height: 80%;
  background: var(--overlay-bg);
  border-top-left-radius: 16px;
  border-top-right-radius: 16px;
  box-shadow: 0 -4px 12px rgba(0,0,0,0.2);
  display: flex;
  flex-direction: column;
  padding: 16px;
  z-index: 1000;
  overflow-y: auto;
  transition: bottom 0.4s ease-in-out;
}
.overlay.open {
  bottom: 0;
}
.btn-close {
  position: absolute;
  top: 12px;
  right: 16px;
  font-size: 1.5rem;
  color: #888;
  cursor: pointer;
}
.btn-close {
  /* already have position & cursor… */
  z-index: 2;    /* <<< ensure it sits above the header image */
}

/* HEADER BACKDROP */
.overlay-header {
  position: relative;
  text-align: center;
  margin-bottom: 16px;
  padding: 24px 16px 16px;
}
.overlay-background {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  border-top-left-radius: 16px;
  border-top-right-radius: 16px;
  background-size: cover;
  background-position: center;
  opacity: 0.15;
  pointer-events: none;
  z-index: 0;
}
.overlay-avatar,
.overlay-name,
.overlay-team {
  position: relative;
  z-index: 1;
}
.overlay-avatar {
  width: 60px;
  height: 60px;
  margin: 0 auto 8px;
  border-radius: 50%;
  border: 2px solid var(--primary-red);
}
.overlay-header h3 {
  margin: 4px 0;
  font-size: 1.2rem;
  color: var(--text-dark);
}
.overlay-header p {
  margin: 0;
  font-size: 0.9rem;
  color: #555;
}

/* Sections */
.stats-block,
.advanced-block {
  background: var(--card-bg);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}
.stats-block h4,
.advanced-block h4 {
  margin: 0 0 8px;
  font-size: 1rem;
  color: var(--text-dark);
  text-align: left;
  border-bottom: 2px solid #ddd;
  padding-bottom: 4px;
}

/* Advanced stats grid */
.advanced-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  text-align: center;
}
.advanced-stats-grid .number {
  font-weight: bold;
  font-size: 1.1rem;
  color: var(--text-dark);
}
.advanced-stats-grid .label {
  font-size: 0.75rem;
  color: #666;
}

/* Last-5 & Career tables */
.last5-table,
.career-totals {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.9rem;
  margin-top: 8px;
  background: #fff;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}
.last5-table th,
.last5-table td,
.career-totals th,
.career-totals td {
  padding: 8px 10px;
}
.last5-table thead th,
.career-totals thead th {
  background: #f4f4f4;
  font-weight: 600;
  border-bottom: 1px solid #e0e0e0;
}
.last5-table tbody tr:nth-child(odd),
.career-totals tbody tr:nth-child(odd) {
  background: #fafafa;
}
.last5-table th:first-child,
.last5-table td:first-child,
.career-totals th:first-child,
.career-totals td:first-child {
  text-align: left;
  padding-left: 16px;
}
.last5-table th:last-child,
.last5-table td:last-child,
.career-totals th:last-child,
.career-totals td:last-child {
  padding-right: 16px;
}

@media (max-width: 480px) {
  .last5-table th:nth-child(4),
  .last5-table td:nth-child(4),
  .last5-table th:nth-child(7),
  .last5-table td:nth-child(7),
  .career-totals th:nth-child(5),
  .career-totals td:nth-child(5) {
    display: none;
  }
  .overlay {
    padding: 12px;
  }
}
.no-scroll {
  overflow: hidden;
  height: 100%; /* lock viewport height if needed */
}
a.stats-trigger {
  cursor: pointer;
  text-decoration: underline;
  color: inherit;
}