/**
 * styles.css — component classes layered on top of the Tailwind CDN build.
 *
 * The Tailwind CDN cannot compile @apply from an external stylesheet, so these
 * components are written in plain CSS using custom properties. Utility classes
 * in the markup still come from Tailwind.
 */

/* -------------------------------------------------------------------------- */
/* design tokens                                                              */
/* -------------------------------------------------------------------------- */

:root {
  --fph-surface: #ffffff;
  --fph-surface-raised: #ffffff;
  --fph-border: #e2e8f0;
  --fph-text: #0f172a;
  --fph-text-muted: #64748b;
  --fph-shadow: 0 1px 2px rgb(15 23 42 / 0.04), 0 8px 24px -12px rgb(15 23 42 / 0.12);
  --fph-shadow-lg: 0 2px 4px rgb(15 23 42 / 0.04), 0 16px 48px -16px rgb(15 23 42 / 0.24);
  --fph-radius: 1rem;

  /* accent palette — referenced by .fph-accent-* */
  --accent-indigo: #6366f1;
  --accent-emerald: #10b981;
  --accent-rose: #f43f5e;
  --accent-amber: #f59e0b;
  --accent-sky: #0ea5e9;
  --accent-violet: #8b5cf6;
  --accent-orange: #fb923c;
  --accent-slate: #64748b;
}

.dark {
  --fph-surface: #0f172a;
  --fph-surface-raised: #1e293b;
  --fph-border: #1e293b;
  --fph-text: #f8fafc;
  --fph-text-muted: #94a3b8;
  --fph-shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 8px 24px -12px rgb(0 0 0 / 0.6);
  --fph-shadow-lg: 0 2px 4px rgb(0 0 0 / 0.4), 0 16px 48px -16px rgb(0 0 0 / 0.8);
}

/* Accent helper — each sets --accent for its subtree. */
.fph-accent-indigo  { --accent: var(--accent-indigo); }
.fph-accent-emerald { --accent: var(--accent-emerald); }
.fph-accent-rose    { --accent: var(--accent-rose); }
.fph-accent-amber   { --accent: var(--accent-amber); }
.fph-accent-sky     { --accent: var(--accent-sky); }
.fph-accent-violet  { --accent: var(--accent-violet); }
.fph-accent-orange  { --accent: var(--accent-orange); }
.fph-accent-slate   { --accent: var(--accent-slate); }

/* -------------------------------------------------------------------------- */
/* accessibility                                                              */
/* -------------------------------------------------------------------------- */

.fph-skip-link {
  position: absolute;
  left: -9999px;
  z-index: 100;
  padding: 0.75rem 1rem;
  background: var(--accent-indigo);
  color: #fff;
  border-radius: 0 0 0.5rem 0;
  font-weight: 600;
}
.fph-skip-link:focus { left: 0; top: 0; }

/* Visible focus ring for every interactive element. */
:where(a, button, input, [tabindex]):focus-visible {
  outline: 2px solid var(--accent-indigo);
  outline-offset: 2px;
  border-radius: 0.5rem;
}

/* Respect reduced-motion preferences. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* -------------------------------------------------------------------------- */
/* header & navigation                                                        */
/* -------------------------------------------------------------------------- */

.fph-header {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(12px);
  background: rgb(255 255 255 / 0.85);
  border-bottom: 1px solid var(--fph-border);
}
.dark .fph-header { background: rgb(2 6 23 / 0.85); }

.fph-logo {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 0.6rem;
  background: linear-gradient(135deg, var(--accent-indigo), var(--accent-violet));
  font-size: 1rem;
}

.fph-nav-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 0.7rem;
  border-radius: 0.6rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--fph-text-muted);
  transition: background-color 0.18s ease, color 0.18s ease;
}
.fph-nav-link:hover { background: rgb(100 116 139 / 0.1); color: var(--fph-text); }
.fph-nav-link.is-active { color: var(--accent-indigo); background: rgb(99 102 241 / 0.1); }

.fph-badge {
  min-width: 1.15rem;
  padding: 0 0.3rem;
  border-radius: 999px;
  background: var(--accent-indigo);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 1.15rem;
  text-align: center;
}

/* -------------------------------------------------------------------------- */
/* buttons                                                                    */
/* -------------------------------------------------------------------------- */

.fph-btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1.1rem;
  border-radius: 0.7rem;
  background: var(--accent-indigo);
  color: #fff;
  font-size: 0.875rem;
  font-weight: 600;
  transition: transform 0.15s ease, background-color 0.18s ease, box-shadow 0.18s ease;
  box-shadow: 0 4px 14px -4px rgb(99 102 241 / 0.5);
}
.fph-btn-primary:hover { background: #4f46e5; transform: translateY(-1px); }
.fph-btn-primary:active { transform: translateY(0); }

.fph-btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1.1rem;
  border-radius: 0.7rem;
  border: 1px solid var(--fph-border);
  background: var(--fph-surface);
  color: var(--fph-text);
  font-size: 0.875rem;
  font-weight: 600;
  transition: transform 0.15s ease, border-color 0.18s ease;
}
.fph-btn-ghost:hover { transform: translateY(-1px); border-color: var(--accent-indigo); }

.fph-icon-btn {
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.6rem;
  color: var(--fph-text-muted);
  font-size: 0.9rem;
  transition: background-color 0.18s ease, color 0.18s ease;
}
.fph-icon-btn:hover { background: rgb(100 116 139 / 0.12); color: var(--fph-text); }

.fph-link {
  color: var(--accent-indigo);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.fph-link:hover { color: #4f46e5; }

.fph-fav-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.9rem;
  border-radius: 0.7rem;
  border: 1px solid var(--fph-border);
  background: var(--fph-surface);
  color: var(--fph-text-muted);
  font-size: 0.875rem;
  font-weight: 600;
  transition: all 0.18s ease;
}
.fph-fav-btn:hover { border-color: var(--accent-amber); color: var(--accent-amber); transform: translateY(-1px); }
.fph-fav-btn.is-active {
  border-color: var(--accent-amber);
  background: rgb(245 158 11 / 0.12);
  color: #b45309;
}
.dark .fph-fav-btn.is-active { color: var(--accent-amber); }

/* -------------------------------------------------------------------------- */
/* theme menu                                                                 */
/* -------------------------------------------------------------------------- */

.fph-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 0.5rem);
  z-index: 50;
  min-width: 9rem;
  padding: 0.35rem;
  border-radius: 0.85rem;
  border: 1px solid var(--fph-border);
  background: var(--fph-surface-raised);
  box-shadow: var(--fph-shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px) scale(0.97);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
}
.fph-menu.is-open { opacity: 1; visibility: visible; transform: translateY(0) scale(1); }

.fph-menu__item {
  display: block;
  width: 100%;
  padding: 0.5rem 0.7rem;
  border-radius: 0.55rem;
  text-align: left;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--fph-text);
  transition: background-color 0.15s ease;
}
.fph-menu__item:hover { background: rgb(100 116 139 / 0.12); }
.fph-menu__item.is-active { background: rgb(99 102 241 / 0.14); color: var(--accent-indigo); }

/* -------------------------------------------------------------------------- */
/* search                                                                     */
/* -------------------------------------------------------------------------- */

.fph-search-input {
  width: 100%;
  padding: 0.6rem 0.9rem 0.6rem 2.4rem;
  border-radius: 0.75rem;
  border: 1px solid var(--fph-border);
  background: var(--fph-surface);
  color: var(--fph-text);
  font-size: 0.875rem;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.dark .fph-search-input { background: rgb(30 41 59 / 0.6); }
.fph-search-input::placeholder { color: #94a3b8; }
.fph-search-input:focus {
  outline: none;
  border-color: var(--accent-indigo);
  box-shadow: 0 0 0 3px rgb(99 102 241 / 0.18);
}
/* Hide the native clear button so our own UI stays consistent. */
.fph-search-input::-webkit-search-cancel-button { -webkit-appearance: none; }

.fph-search__panel {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 0.5rem);
  z-index: 45;
  max-height: 22rem;
  overflow-y: auto;
  padding: 0.35rem;
  border-radius: 0.9rem;
  border: 1px solid var(--fph-border);
  background: var(--fph-surface-raised);
  box-shadow: var(--fph-shadow-lg);
  animation: fph-pop 0.18s ease;
}
.fph-search__panel[hidden] { display: none; }

.fph-search__item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.5rem 0.6rem;
  border-radius: 0.6rem;
  cursor: pointer;
  transition: background-color 0.14s ease;
}
.fph-search__item:hover,
.fph-search__item.is-active { background: rgb(99 102 241 / 0.12); }

.fph-search__status { padding: 1rem 0.75rem; text-align: center; font-size: 0.875rem; }

.fph-search__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0.6rem 0.25rem;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--fph-text-muted);
}

/* -------------------------------------------------------------------------- */
/* cards                                                                      */
/* -------------------------------------------------------------------------- */

.fph-card {
  padding: 1rem;
  border-radius: var(--fph-radius);
  border: 1px solid var(--fph-border);
  background: var(--fph-surface);
  box-shadow: var(--fph-shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.dark .fph-card { background: var(--fph-surface-raised); }

.fph-card__title {
  margin-bottom: 0.75rem;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--fph-text-muted);
}

.fph-card--match:hover,
.fph-card--player:hover,
.fph-card--league:hover {
  transform: translateY(-2px);
  box-shadow: var(--fph-shadow-lg);
  border-color: rgb(99 102 241 / 0.35);
}

.fph-card--tile { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 1.1rem 0.75rem; }
/* Accent stripe along the top of stat tiles. */
.fph-card--tile { position: relative; overflow: hidden; }
.fph-card--tile::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--accent, var(--accent-slate));
}

.fph-card--player { display: block; text-align: center; }
.fph-card--league { text-align: center; }

.fph-card--fav { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }

.fph-card--live { border-color: rgb(244 63 94 / 0.45); box-shadow: 0 0 0 1px rgb(244 63 94 / 0.15), var(--fph-shadow); }

/* -------------------------------------------------------------------------- */
/* hero                                                                       */
/* -------------------------------------------------------------------------- */

.fph-hero,
.fph-hero-home {
  position: relative;
  overflow: hidden;
  margin-bottom: 1.5rem;
  padding: 1.5rem;
  border-radius: 1.5rem;
  border: 1px solid var(--fph-border);
  background: var(--fph-surface);
  box-shadow: var(--fph-shadow);
}
.dark .fph-hero, .dark .fph-hero-home { background: var(--fph-surface-raised); }
.fph-hero-home { padding: 2.5rem 1.5rem 2.75rem; margin-bottom: 2.5rem; }

/* Soft radial glow behind hero content. */
.fph-hero__glow {
  position: absolute;
  top: -50%;
  left: 50%;
  width: 40rem;
  height: 40rem;
  transform: translateX(-50%);
  background: radial-gradient(circle, rgb(99 102 241 / 0.16) 0%, transparent 62%);
  pointer-events: none;
}

.fph-hero__photo {
  width: 8rem;
  height: 8rem;
  border-radius: 1.25rem;
  object-fit: cover;
  border: 1px solid var(--fph-border);
  background: rgb(100 116 139 / 0.1);
  box-shadow: var(--fph-shadow);
}
@media (min-width: 640px) { .fph-hero__photo { width: 10rem; height: 10rem; } }

.fph-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  border: 1px solid rgb(99 102 241 / 0.2);
  background: rgb(99 102 241 / 0.1);
  color: var(--accent-indigo);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.dark .fph-eyebrow { color: #a5b4fc; }

/* Slightly tighter leading so the two-line headline reads as one block. */
.fph-hero__title { line-height: 1.12; text-wrap: balance; }

/* Gradient treatment on the closing phrase of the headline. */
.fph-hero__accent {
  background: linear-gradient(120deg, var(--accent-indigo), var(--accent-violet) 55%, var(--accent-sky));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  /* Fallback for engines that ignore background-clip on text. */
  -webkit-text-fill-color: transparent;
}

/*
 * Decorative pitch markings behind the hero. Pure CSS shapes at low opacity —
 * they hint at football without competing with the headline.
 */
.fph-hero__pitch {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  opacity: 0.5;
}
.fph-hero__circle,
.fph-hero__line,
.fph-hero__box {
  position: absolute;
  border: 1.5px solid rgb(99 102 241 / 0.16);
}
.dark .fph-hero__circle,
.dark .fph-hero__line,
.dark .fph-hero__box { border-color: rgb(148 163 184 / 0.14); }

.fph-hero__circle {
  top: 50%;
  left: 50%;
  width: 20rem;
  height: 20rem;
  margin: -10rem 0 0 -10rem;
  border-radius: 999px;
}
/* Halfway line. */
.fph-hero__line {
  top: 0;
  bottom: 0;
  left: 50%;
  width: 0;
  border-width: 0 0 0 1.5px;
}
/*
 * Second centre ring, echoing the first. An earlier version drew a penalty box
 * at the left edge, but cropped by the card it just read as a stray rectangle
 * rather than a pitch marking.
 */
.fph-hero__box {
  top: 50%;
  left: 50%;
  width: 30rem;
  height: 30rem;
  margin: -15rem 0 0 -15rem;
  border-radius: 999px;
  opacity: 0.6;
}
@media (max-width: 639px) { .fph-hero__box { display: none; } }

/* ---------------------------- hero quick picks --------------------------- */

.fph-quick {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

/* Overlapping avatars. */
.fph-facepile { display: flex; }
.fph-facepile__item {
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  overflow: hidden;
  border-radius: 999px;
  border: 2px solid var(--fph-surface);
  background: linear-gradient(135deg, rgb(99 102 241 / 0.18), rgb(139 92 246 / 0.18));
  box-shadow: var(--fph-shadow);
  transition: transform 0.2s ease, z-index 0s;
}
.dark .fph-facepile__item { border-color: var(--fph-surface-raised); }
/* Overlap each avatar onto the previous one. */
.fph-facepile__item + .fph-facepile__item { margin-left: -0.7rem; }
.fph-facepile__item:hover {
  transform: translateY(-3px) scale(1.08);
  z-index: 2;
}
.fph-facepile__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}
.fph-facepile__fallback {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--accent-indigo);
}

.fph-quick__caption {
  font-size: 0.75rem;
  color: var(--fph-text-muted);
}

.fph-quick__chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem;
}
.fph-quick__chip {
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--fph-border);
  background: var(--fph-surface);
  color: var(--fph-text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  transition: color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}
/* --fph-border is near-invisible on the hero's dark panel, which made these
   read as plain text rather than tappable chips. */
.dark .fph-quick__chip {
  background: rgb(30 41 59 / 0.75);
  border-color: rgb(148 163 184 / 0.28);
  color: #cbd5e1;
}
.fph-quick__chip:hover {
  color: var(--accent-indigo);
  border-color: var(--accent-indigo);
  transform: translateY(-1px);
}

.fph-team-pill {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.45rem 0.8rem;
  border-radius: 0.7rem;
  border: 1px solid var(--fph-border);
  background: rgb(100 116 139 / 0.05);
  font-size: 0.8125rem;
}

/* -------------------------------------------------------------------------- */
/* tabs                                                                       */
/* -------------------------------------------------------------------------- */

.fph-tabs {
  position: sticky;
  top: 3.6rem;
  z-index: 30;
  display: flex;
  gap: 0.25rem;
  margin-bottom: 1.5rem;
  padding: 0.3rem;
  overflow-x: auto;
  border-radius: 0.9rem;
  border: 1px solid var(--fph-border);
  background: rgb(255 255 255 / 0.9);
  backdrop-filter: blur(12px);
  scrollbar-width: none;
}
.fph-tabs::-webkit-scrollbar { display: none; }
.dark .fph-tabs { background: rgb(15 23 42 / 0.9); }

.fph-tab {
  flex-shrink: 0;
  padding: 0.5rem 0.9rem;
  border-radius: 0.65rem;
  font-size: 0.8125rem;
  font-weight: 600;
  white-space: nowrap;
  color: var(--fph-text-muted);
  transition: background-color 0.18s ease, color 0.18s ease;
}
.fph-tab:hover { background: rgb(100 116 139 / 0.1); color: var(--fph-text); }
.fph-tab.is-active { background: var(--accent-indigo); color: #fff; }

/* -------------------------------------------------------------------------- */
/* chips, counts, avatars                                                     */
/* -------------------------------------------------------------------------- */

.fph-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
}
.fph-chip--slate   { background: rgb(100 116 139 / 0.14); color: #475569; }
.fph-chip--indigo  { background: rgb(99 102 241 / 0.14);  color: #4338ca; }
.fph-chip--emerald { background: rgb(16 185 129 / 0.14);  color: #047857; }
.fph-chip--rose    { background: rgb(244 63 94 / 0.14);   color: #be123c; }
.fph-chip--amber   { background: rgb(245 158 11 / 0.16);  color: #b45309; }
.fph-chip--sky     { background: rgb(14 165 233 / 0.14);  color: #0369a1; }
.fph-chip--violet  { background: rgb(139 92 246 / 0.14);  color: #6d28d9; }
.fph-chip--orange  { background: rgb(251 146 60 / 0.16);  color: #c2410c; }

/* Lighter chip text in dark mode for contrast against dark surfaces. */
.dark .fph-chip--slate   { color: #cbd5e1; }
.dark .fph-chip--indigo  { color: #a5b4fc; }
.dark .fph-chip--emerald { color: #6ee7b7; }
.dark .fph-chip--rose    { color: #fda4af; }
.dark .fph-chip--amber   { color: #fcd34d; }
.dark .fph-chip--sky     { color: #7dd3fc; }
.dark .fph-chip--violet  { color: #c4b5fd; }
.dark .fph-chip--orange  { color: #fdba74; }

.fph-count {
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: rgb(100 116 139 / 0.14);
  color: var(--fph-text-muted);
  font-size: 0.75rem;
  font-weight: 700;
}

.fph-avatar {
  display: grid;
  place-items: center;
  width: 3.5rem;
  height: 3.5rem;
  margin-inline: auto;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent-indigo), var(--accent-violet));
  color: #fff;
  font-size: 1.1rem;
  font-weight: 700;
}
.fph-avatar--sm { width: 3rem; height: 3rem; font-size: 0.95rem; margin: 0; }
.fph-avatar--xs { width: 2.25rem; height: 2.25rem; font-size: 0.75rem; margin: 0; }

/*
 * Circular portrait for trending cards. Provider cutouts are transparent PNGs
 * with inconsistent aspect ratios, so the frame fixes the size and the image
 * covers it — anchored towards the top so faces stay in view.
 */
.fph-player-photo__frame {
  display: grid;
  place-items: center;
  width: 4.5rem;
  height: 4.5rem;
  margin-inline: auto;
  overflow: hidden;
  border-radius: 999px;
  background: linear-gradient(135deg, rgb(99 102 241 / 0.16), rgb(139 92 246 / 0.16));
}
.fph-player-photo__frame--sm { width: 3rem; height: 3rem; margin: 0; flex-shrink: 0; }
.fph-player-photo__frame--xs { width: 2.25rem; height: 2.25rem; margin: 0; flex-shrink: 0; }

.fph-player-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  transition: transform 0.3s ease;
}
.fph-card--player:hover .fph-player-photo { transform: scale(1.07); }
/* Centre the initials fallback if the image errors out. */
.fph-player-photo__frame .fph-placeholder {
  width: 100%;
  height: 100%;
  border-radius: 999px;
  font-size: 1.1rem;
}

/* Fallback tile used when an image fails to load. */
.fph-placeholder {
  display: inline-grid;
  place-items: center;
  background: rgb(100 116 139 / 0.15);
  color: var(--fph-text-muted);
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 0.5rem;
}

.fph-league-badge {
  display: inline-grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  margin-inline: auto;
  border-radius: 0.75rem;
  background: linear-gradient(135deg, rgb(99 102 241 / 0.18), rgb(139 92 246 / 0.18));
  color: var(--accent-indigo);
  font-size: 0.7rem;
  font-weight: 800;
}

/*
 * League crest. Unlike player cutouts these are logos of wildly different
 * shapes (wide wordmarks, tall shields), so they must be *contained* rather
 * than cropped — object-fit: cover would slice the crest.
 */
/*
 * Provider crests are a mix of dark-on-transparent (Premier League) and
 * white-on-transparent (Champions League, Liga Portugal). Neither reads on both
 * themes, so the frame supplies its own contrast plate: near-white in light
 * mode, a light slate plate in dark mode. That keeps every crest legible
 * without recolouring the artwork itself.
 */
.fph-league-badge__frame {
  display: grid;
  place-items: center;
  width: 3.25rem;
  height: 3.25rem;
  margin-inline: auto;
  padding: 0.4rem;
  border-radius: 0.75rem;
  background: #f8fafc;
  border: 1px solid var(--fph-border);
}
.dark .fph-league-badge__frame {
  background: #e2e8f0;
  border-color: rgb(148 163 184 / 0.25);
}

/*
 * White-on-transparent crests (Serie A, Champions League, Liga Portugal) are
 * invisible on a light plate, so they get a dark one instead — in BOTH themes,
 * because the artwork's own colour is what decides this, not the page theme.
 */
.fph-league-badge__frame--on-dark,
.dark .fph-league-badge__frame--on-dark {
  background: #1e293b;
  border-color: rgb(148 163 184 / 0.2);
}
.fph-league-badge__img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  transition: transform 0.3s ease;
}
.fph-card--league:hover .fph-league-badge__img { transform: scale(1.08); }
/* Centre the short-code fallback if the badge image errors out. */
.fph-league-badge__frame .fph-placeholder {
  width: 100%;
  height: 100%;
  border-radius: 0.5rem;
  background: transparent;
  color: var(--accent-indigo);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}
/* On a dark plate the short code needs a light ink instead. */
.fph-league-badge__frame--on-dark .fph-placeholder { color: #cbd5e1; }

/* -------------------------------------------------------------------------- */
/* league page                                                                */
/* -------------------------------------------------------------------------- */

/* Hero crest — same contrast-plate logic as the home page league cards. */
.fph-league-crest {
  display: grid;
  place-items: center;
  width: 7rem;
  height: 7rem;
  margin-inline: auto;
  padding: 0.9rem;
  border-radius: 1.25rem;
  background: #f8fafc;
  border: 1px solid var(--fph-border);
}
.dark .fph-league-crest { background: #e2e8f0; border-color: rgb(148 163 184 / 0.25); }
.fph-league-crest--on-dark,
.dark .fph-league-crest--on-dark { background: #1e293b; border-color: rgb(148 163 184 / 0.2); }
.fph-league-crest__img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}
.fph-league-crest .fph-placeholder {
  width: 100%; height: 100%;
  background: transparent;
  color: var(--accent-indigo);
  font-size: 1.4rem;
}

.fph-social-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.7rem;
  border-radius: 0.6rem;
  border: 1px solid var(--fph-border);
  background: var(--fph-surface);
  color: var(--fph-text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  transition: color 0.18s ease, border-color 0.18s ease, transform 0.15s ease;
}
.dark .fph-social-link { background: rgb(30 41 59 / 0.6); }
.fph-social-link:hover {
  color: var(--accent-indigo);
  border-color: var(--accent-indigo);
  transform: translateY(-1px);
}

/* Season picker above the standings. */
.fph-season-bar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1rem;
}
.fph-season-bar__label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fph-text-muted);
}
.fph-season-select {
  padding: 0.45rem 2rem 0.45rem 0.75rem;
  border-radius: 0.65rem;
  border: 1px solid var(--fph-border);
  background-color: var(--fph-surface);
  color: var(--fph-text);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  /* Custom chevron so the control matches the app rather than the OS. */
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.6rem center;
  background-size: 0.9rem;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.dark .fph-season-select { background-color: var(--fph-surface-raised); }
.fph-season-select:hover { border-color: var(--accent-indigo); }
.fph-season-select:focus {
  outline: none;
  border-color: var(--accent-indigo);
  box-shadow: 0 0 0 3px rgb(99 102 241 / 0.18);
}
.fph-season-select:disabled { opacity: 0.6; cursor: progress; }

.fph-spinner--sm { width: 1rem; height: 1rem; border-width: 2px; }

/* Club cards on the Clubs tab. */
.fph-card--club { transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease; }
.fph-card--club:hover {
  transform: translateY(-2px);
  box-shadow: var(--fph-shadow-lg);
  border-color: rgb(99 102 241 / 0.35);
}

/*
 * Standings as rows, not a <table>. On desktop this is an 8-column grid; below
 * 640px the columns collapse and each stat shows its caption via ::before, so
 * the data stays readable on a phone instead of overflowing sideways.
 */
.fph-standings__head,
.fph-standings__row {
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr) repeat(5, 2.25rem) 4.5rem;
  align-items: center;
  gap: 0.5rem;
}

.fph-standings__head {
  padding: 0 0.85rem 0.4rem;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fph-text-muted);
  text-align: center;
}
.fph-standings__head > :nth-child(2) { text-align: left; }
.fph-standings__head > :last-child { text-align: right; }

.fph-standings__row {
  padding: 0.65rem 0.85rem;
  border-radius: var(--fph-radius);
  border: 1px solid var(--fph-border);
  background: var(--fph-surface);
  box-shadow: var(--fph-shadow);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
.dark .fph-standings__row { background: var(--fph-surface-raised); }
.fph-standings__row:hover {
  transform: translateY(-1px);
  border-color: rgb(99 102 241 / 0.35);
  box-shadow: var(--fph-shadow-lg);
}

.fph-standings__rank {
  display: grid;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 0.5rem;
  background: rgb(100 116 139 / 0.12);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--fph-text-muted);
}
.fph-rank--first {
  background: linear-gradient(135deg, var(--accent-amber), #fbbf24);
  color: #422006;
}

.fph-standings__club { display: flex; align-items: center; gap: 0.6rem; min-width: 0; }
.fph-standings__stat {
  text-align: center;
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  color: var(--fph-text-muted);
}
.fph-standings__points {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.25rem;
}
.fph-standings__bar {
  display: block;
  width: 100%;
  height: 0.25rem;
  border-radius: 999px;
  background: rgb(100 116 139 / 0.16);
  overflow: hidden;
}
.fph-standings__bar-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--accent-indigo);
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Form pips (W/D/L). */
.fph-form-pip {
  display: inline-grid;
  place-items: center;
  width: 0.95rem;
  height: 0.95rem;
  border-radius: 0.25rem;
  font-size: 0.55rem;
  font-weight: 800;
  color: #fff;
}
.fph-form-pip--w { background: var(--accent-emerald); }
.fph-form-pip--d { background: var(--accent-slate); }
.fph-form-pip--l { background: var(--accent-rose); }

/* Phone layout: drop the caption row and inline the stat labels. */
@media (max-width: 639px) {
  .fph-standings__head { display: none; }
  .fph-standings__row {
    grid-template-columns: 2rem minmax(0, 1fr) auto;
    grid-template-areas:
      'rank club pts'
      'stats stats stats';
    row-gap: 0.5rem;
  }
  .fph-standings__rank   { grid-area: rank; }
  .fph-standings__club   { grid-area: club; }
  .fph-standings__points { grid-area: pts; }
  .fph-standings__stat {
    grid-area: auto;
    display: inline-flex;
    align-items: baseline;
    gap: 0.2rem;
    font-size: 0.75rem;
  }
  /* Show the column caption next to each number when stacked. */
  .fph-standings__stat::before {
    content: attr(data-label);
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    opacity: 0.6;
  }
  .fph-standings__row > .fph-standings__stat:nth-of-type(1) { grid-column: 1 / 2; }
}

/*
 * League fanart is landscape, so those strips get wider tiles. The parent sets
 * grid-auto-columns, so the override has to live on the grid, not the item.
 */
.fph-gallery:has(.fph-gallery__item--wide) { grid-auto-columns: 18rem; }
.fph-gallery__item--wide { height: 10rem; }

/* -------------------------------------------------------------------------- */
/* progress bars & rating dial                                                */
/* -------------------------------------------------------------------------- */

.fph-progress {
  height: 0.5rem;
  overflow: hidden;
  border-radius: 999px;
  background: rgb(100 116 139 / 0.16);
}
.fph-progress__fill {
  height: 100%;
  border-radius: 999px;
  background: var(--accent, var(--accent-indigo));
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Conic-gradient dial for the average rating. */
.fph-dial {
  position: relative;
  display: grid;
  place-items: center;
  width: 6.5rem;
  height: 6.5rem;
  border-radius: 999px;
  background: conic-gradient(var(--accent-indigo) var(--dial, 0%), rgb(100 116 139 / 0.16) 0);
}
.fph-dial::after {
  content: '';
  position: absolute;
  inset: 0.5rem;
  border-radius: 999px;
  background: var(--fph-surface);
}
.dark .fph-dial::after { background: var(--fph-surface-raised); }
.fph-dial__value {
  position: relative;
  z-index: 1;
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--fph-text);
}

/* -------------------------------------------------------------------------- */
/* timeline                                                                   */
/* -------------------------------------------------------------------------- */

.fph-timeline {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding-left: 1.75rem;
  list-style: none;
}
/* Vertical rail behind the markers. */
.fph-timeline::before {
  content: '';
  position: absolute;
  left: 0.4rem;
  top: 0.5rem;
  bottom: 0.5rem;
  width: 2px;
  border-radius: 999px;
  background: linear-gradient(to bottom, rgb(99 102 241 / 0.4), rgb(100 116 139 / 0.15));
}

.fph-timeline__item { position: relative; }
.fph-timeline__marker {
  position: absolute;
  left: -1.51rem;
  top: 1.1rem;
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 999px;
  background: var(--accent, var(--accent-slate));
  border: 2px solid var(--fph-surface);
  box-shadow: 0 0 0 2px rgb(100 116 139 / 0.2);
}
.dark .fph-timeline__marker { border-color: var(--fph-surface-raised); }

/* -------------------------------------------------------------------------- */
/* trophies                                                                   */
/* -------------------------------------------------------------------------- */

.fph-trophy { position: relative; overflow: hidden; }
.fph-trophy::after {
  content: '';
  position: absolute;
  top: -3rem;
  right: -3rem;
  width: 7rem;
  height: 7rem;
  border-radius: 999px;
  background: var(--accent, var(--accent-slate));
  opacity: 0.09;
  pointer-events: none;
}
.fph-trophy:hover { transform: translateY(-2px); box-shadow: var(--fph-shadow-lg); }
.fph-trophy__icon { font-size: 1.6rem; line-height: 1; }
.fph-trophy__count {
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: var(--accent, var(--accent-slate));
  color: #fff;
  font-size: 0.7rem;
  font-weight: 800;
}

/* -------------------------------------------------------------------------- */
/* gallery                                                                    */
/* -------------------------------------------------------------------------- */

.fph-gallery {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 13rem;
  gap: 0.75rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  scroll-snap-type: x mandatory;
}
.fph-gallery__item {
  height: 9rem;
  overflow: hidden;
  border-radius: 0.9rem;
  border: 1px solid var(--fph-border);
  background: rgb(100 116 139 / 0.08);
  scroll-snap-align: start;
}
.fph-gallery__item img { transition: transform 0.3s ease; }
.fph-gallery__item:hover img { transform: scale(1.05); }

/* -------------------------------------------------------------------------- */
/* live indicator                                                             */
/* -------------------------------------------------------------------------- */

.fph-live-dot {
  display: inline-block;
  width: 0.45rem;
  height: 0.45rem;
  margin-right: 0.3rem;
  border-radius: 999px;
  background: var(--accent-rose);
  animation: fph-pulse 1.6s ease-in-out infinite;
}

/* -------------------------------------------------------------------------- */
/* loading states                                                             */
/* -------------------------------------------------------------------------- */

.fph-skeleton {
  background: linear-gradient(90deg,
    rgb(100 116 139 / 0.08) 25%,
    rgb(100 116 139 / 0.16) 37%,
    rgb(100 116 139 / 0.08) 63%);
  background-size: 400% 100%;
  animation: fph-shimmer 1.4s ease infinite;
}

.fph-spinner {
  width: 1.75rem;
  height: 1.75rem;
  border: 2.5px solid rgb(100 116 139 / 0.2);
  border-top-color: var(--accent-indigo);
  border-radius: 999px;
  animation: fph-spin 0.7s linear infinite;
}

/* -------------------------------------------------------------------------- */
/* toasts                                                                     */
/* -------------------------------------------------------------------------- */

.fph-toast-host {
  position: fixed;
  bottom: 1.25rem;
  left: 50%;
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transform: translateX(-50%);
  pointer-events: none;
}

.fph-toast {
  padding: 0.65rem 1.1rem;
  border-radius: 0.75rem;
  background: #0f172a;
  color: #fff;
  font-size: 0.8125rem;
  font-weight: 500;
  box-shadow: var(--fph-shadow-lg);
  animation: fph-toast-in 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}
.dark .fph-toast { background: #e2e8f0; color: #0f172a; }
.fph-toast--emerald { background: var(--accent-emerald); color: #fff; }
.fph-toast--amber { background: var(--accent-amber); color: #431407; }
.fph-toast--out { animation: fph-toast-out 0.3s ease forwards; }

/* -------------------------------------------------------------------------- */
/* footer                                                                     */
/* -------------------------------------------------------------------------- */

.fph-footer {
  margin-top: 4rem;
  padding: 2.5rem 0 2rem;
  border-top: 1px solid var(--fph-border);
  background: rgb(248 250 252 / 0.6);
}
.dark .fph-footer { background: rgb(2 6 23 / 0.4); }

.fph-footer__grid {
  display: grid;
  gap: 2rem;
  grid-template-columns: 1fr;
}
/* Brand column gets the extra room once there is space for it. */
@media (min-width: 640px) {
  .fph-footer__grid { grid-template-columns: repeat(2, 1fr); }
  .fph-footer__brand { grid-column: 1 / -1; }
}
@media (min-width: 1024px) {
  .fph-footer__grid { grid-template-columns: 2fr 1fr 1fr; gap: 3rem; }
  .fph-footer__brand { grid-column: auto; }
}

.fph-footer__heading {
  margin-bottom: 0.85rem;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--fph-text);
}

.fph-footer__list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  list-style: none;
}

/*
 * Links and the search <button> share this class, so the button needs its
 * default styling stripped to sit flush with the anchors.
 */
.fph-footer__link {
  display: inline-block;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-size: 0.8125rem;
  text-align: left;
  color: var(--fph-text-muted);
  cursor: pointer;
  transition: color 0.18s ease, transform 0.18s ease;
}
.fph-footer__link:hover {
  color: var(--accent-indigo);
  transform: translateX(2px);
}

/* Small pulsing dot signalling that the app is backed by a live API. */
.fph-status-dot {
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 999px;
  background: var(--accent-emerald);
  box-shadow: 0 0 0 2px rgb(16 185 129 / 0.2);
  animation: fph-pulse 2.4s ease-in-out infinite;
}

.fph-footer__bar {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 2.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--fph-border);
  font-size: 0.75rem;
  color: var(--fph-text-muted);
}
@media (min-width: 640px) {
  .fph-footer__bar {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
  }
}

/* -------------------------------------------------------------------------- */
/* prose                                                                      */
/* -------------------------------------------------------------------------- */

.fph-prose {
  font-size: 0.875rem;
  line-height: 1.7;
  color: var(--fph-text-muted);
  white-space: pre-line;
}

/* -------------------------------------------------------------------------- */
/* animations                                                                 */
/* -------------------------------------------------------------------------- */

.fph-fade-in { animation: fph-fade-in 0.32s cubic-bezier(0.16, 1, 0.3, 1); }

@keyframes fph-fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fph-pop {
  from { opacity: 0; transform: translateY(-6px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes fph-shimmer {
  0%   { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}
@keyframes fph-spin { to { transform: rotate(360deg); } }
@keyframes fph-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.45; transform: scale(1.3); }
}
@keyframes fph-toast-in {
  from { opacity: 0; transform: translateY(16px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes fph-toast-out {
  to { opacity: 0; transform: translateY(10px) scale(0.96); }
}
