:root {
  --brand: #f26f1f;
  --brand-dark: #cd5e1a;
  --brand-light: #fdeee0;
  --g100: #f0ede8;
  --g200: #e8e4de;
  --g500: #888;
  --g600: #666;
  --g800: #333;
  --sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --brand-font: 'Bungee Shade', var(--sans);
  --headline-font: 'Outfit', var(--sans);
  --confirmed: #1a7a3c;
  --rumor: #b8860b;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--sans);
  background: #fff;
  color: #1a1a1a;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

#masthead {
  background: #fff;
  border-bottom: 1px solid var(--g200);
  text-align: center;
  padding: 2rem 1rem 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
  transition: padding 0.2s ease;
}

#masthead.scrolled { padding: 0.6rem 1rem; }

.wordmark-btn {
  background: none;
  border: none;
  padding: 0;
  margin: 0 auto;
  display: block;
  cursor: pointer;
}

.wordmark {
  font-family: var(--brand-font);
  font-size: 2.8rem;
  letter-spacing: 0.02em;
  line-height: 1;
  color: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: font-size 0.2s ease;
}

#masthead.scrolled .wordmark { font-size: 1.6rem; }

.tagline {
  margin-bottom: 0.6rem;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--g600);
  text-transform: uppercase;
  max-height: 2rem;
  overflow: hidden;
  transition: max-height 0.2s ease, opacity 0.15s ease, margin-bottom 0.2s ease;
}

#masthead.scrolled .tagline { max-height: 0; opacity: 0; margin-bottom: 0; }

/* ─── View tabs (News / Your Feed) ─────────────────────── */

#view-tabs {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0 1rem;
  margin-bottom: 0.85rem;
}

.view-tab {
  background: none;
  border: none;
  font: 700 0.9rem var(--sans);
  color: var(--g600);
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  cursor: pointer;
}

.view-tab.active { background: var(--brand-light); color: var(--brand); }

.follow-btn {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--brand);
  color: #fff;
  border: none;
  font: 700 0.85rem var(--sans);
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  cursor: pointer;
}

/* Same contrast fix as badge icons — black outline is nearly invisible on
   the brand-orange background. */
.follow-btn .ui-icon { filter: invert(1); }

.follow-btn:hover { background: var(--brand-dark); }

#feed-empty {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--g600);
}

#feed-empty p { margin-bottom: 1rem; }

/* ─── Loading animation (pixel player kicking a ball) ─────────────── */
/* Same technique as The Stoop's pigeon loader: a tiny pixel-grid SVG with
   image-rendering:pixelated, cycling through leg/ball position groups via
   staggered opacity keyframes to fake a 3-frame sprite animation. */

.feed-loading {
  padding: 2.5rem 1rem;
  text-align: center;
}

.kicker-svg {
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  display: block;
  margin: 0 auto 0.75rem;
}

@keyframes kick-1 { 0%, 32% { opacity: 1; } 33%, 100% { opacity: 0; } }
@keyframes kick-2 { 0%, 32% { opacity: 0; } 33%, 65% { opacity: 1; } 66%, 100% { opacity: 0; } }
@keyframes kick-3 { 0%, 65% { opacity: 0; } 66%, 99% { opacity: 1; } 100%, 0% { opacity: 0; } }

.kf-1 { animation: kick-1 1.5s infinite; }
.kf-2 { animation: kick-2 1.5s infinite; }
.kf-3 { animation: kick-3 1.5s infinite; }

.feed-loading-msg {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--g600);
}

/* ─── Follow-teams modal ───────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal {
  background: #fff;
  border-radius: 10px;
  width: 100%;
  max-width: 520px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--g200);
}

.modal-header h3 { font-size: 1.1rem; }

.modal-close {
  background: none;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  color: var(--g600);
}

.modal-intro {
  padding: 0.9rem 1.25rem 0;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--g600);
}

.modal-body { padding: 1rem 1.25rem; overflow-y: auto; }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  padding: 0.9rem 1.25rem;
  border-top: 1px solid var(--g200);
}

.modal-btn {
  font: 700 0.85rem var(--sans);
  padding: 0.5rem 1.1rem;
  border-radius: 999px;
  border: none;
  cursor: pointer;
}

.modal-btn-secondary {
  background: var(--g100);
  color: var(--g600);
}

.modal-btn-secondary:hover { background: var(--g200); }

.modal-btn-primary {
  background: var(--brand);
  color: #fff;
}

.modal-btn-primary:hover { background: var(--brand-dark); }

.follow-league { margin-bottom: 1.5rem; }
.follow-league:last-child { margin-bottom: 0; }

.follow-league-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  color: var(--brand);
  margin-bottom: 0.75rem;
  cursor: pointer;
}

.follow-group-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--g500);
  margin: 0.6rem 0 0.3rem;
}

.follow-clubs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.4rem;
}

.follow-club {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  cursor: pointer;
}

#app {
  max-width: 720px;
  margin: 0 auto;
  padding: 1.5rem 0 3rem;
}

/* ─── Games (live scores + fixtures) — cards reused inside the Scores &
   Fixtures view's Results panel ────────────────────────────────────────── */

.game-card {
  flex-shrink: 0;
  width: 160px;
  scroll-snap-align: start;
  border: 1px solid var(--g200);
  border-radius: 8px;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.game-league {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--brand);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.game-team {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.game-logo { width: 22px; height: 22px; object-fit: contain; }
.game-logo-empty { display: inline-block; background: var(--g100); border-radius: 50%; }

.game-team-name {
  flex: 1;
  font-weight: 600;
  font-size: 0.85rem;
}

.game-team-winner .game-team-name { font-weight: 800; }

.game-team-score {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  min-width: 1.2rem;
  text-align: right;
}

/* Simple color code for the winning side of a completed match: the score
   itself gets a green circle instead of just bolder text. Draws and games
   that haven't finished never set `winner` on either side, so this never
   shows up where it wouldn't make sense. */
.game-team-winner .game-team-score {
  min-width: 1.5rem;
  height: 1.5rem;
  background: var(--confirmed);
  color: #fff;
  border-radius: 50%;
}

.game-status {
  font-size: 0.75rem;
  color: var(--g600);
  margin-top: 0.15rem;
}

.game-live {
  color: #c0392b;
  font-weight: 700;
}

.game-final { font-weight: 700; }

/* ─── Horizontal scroll container (used by Scores & Fixtures) ─────────── */

.carousel {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 0 1rem 0.5rem;
}

.carousel::-webkit-scrollbar { display: none; }

/* ─── Feed cards ───────────────────────────────────────── */

.feed-card {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  padding: 1.8rem;
  border-bottom: 1px solid var(--g200);
  margin-bottom: 1rem;
  transition: background 0.15s ease;
}

.feed-card:hover {
  background: var(--g100);
}

.feed-card-icon {
  flex-shrink: 0;
  width: 28px;
  padding-top: 0.15rem;
}

.feed-card-icon .ui-icon { width: 20px; height: 20px; }

.ui-icon {
  width: 14px;
  height: 14px;
  vertical-align: -2px;
}

.feed-card-body { flex: 1; min-width: 0; margin-right: 1.5rem; }

.feed-card-thumb {
  flex-shrink: 0;
  width: 84px;
  height: 84px;
  object-fit: cover;
  border-radius: 6px;
  background: var(--g100);
}

.feed-card-thumb-mobile { display: none; }

.feed-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.3rem;
}

.club-badge {
  background: var(--brand);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
}

.outlet {
  font-weight: 700;
  color: var(--brand);
  font-size: 0.85rem;
}

.time {
  color: var(--g500);
  font-size: 0.85rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  color: #fff;
}

/* Badge icons are the black OpenMoji variant on a dark/saturated pill
   background — invert to white so the outline is actually visible, same
   contrast fix the badge text already relies on. Still monochrome, not a
   reintroduction of color. */
.badge .ui-icon { width: 14px; height: 14px; vertical-align: 0; filter: invert(1); }

.badge-confirmed { background: var(--confirmed); }
.badge-rumor { background: var(--rumor); }
.badge-fan { background: var(--g600); }

.headline {
  display: block;
  font: 700 1.15rem/1.35 var(--headline-font);
  color: #1a1a1a;
  text-decoration: none;
}

.headline:hover { text-decoration: underline; }

.excerpt {
  display: block;
  margin-top: 0.4rem;
  font: 400 1rem/1.5 var(--sans);
  color: #444;
}

#feed-status {
  padding: 1rem;
  color: var(--g600);
  text-align: center;
}

/* ─── Scores & Fixtures view (Results / Upcoming / Standings / Stats) ──── */

#scores-subtabs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0 1rem;
  margin-bottom: 1rem;
}

.scores-league-toggle {
  display: flex;
  width: fit-content;
  gap: 0.35rem;
  margin: 0 auto 1.5rem;
  background: var(--g100);
  border-radius: 999px;
  padding: 0.2rem;
}

.scores-league-btn {
  background: none;
  border: none;
  font: 700 0.75rem var(--sans);
  color: var(--g600);
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  cursor: pointer;
}

.scores-league-btn.active { background: #fff; color: var(--brand); box-shadow: 0 1px 3px rgba(0,0,0,0.1); }

.scores-subheading {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--g600);
  padding: 0 1rem;
  margin: 1.5rem 0 0.75rem;
}

.scores-subheading:first-child { margin-top: 0; }

.scores-season { font-weight: 600; text-transform: none; letter-spacing: normal; color: var(--g500); }

.scores-empty {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--g600);
}

/* Top scorers: a soccer-ball icon per goal instead of a bar/track — this is
   a no-build-step vanilla app, and reusing the existing ball asset avoids
   both a charting library and a new graphic. */
.bar-chart {
  padding: 0 1rem;
  margin-bottom: 3rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.bar-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.bar-label {
  flex: 0 0 160px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #1a1a1a;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-label-team { color: var(--g500); font-weight: 500; }

.goal-balls {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 3px;
}

.goal-ball { width: 14px; height: 14px; flex-shrink: 0; }

.bar-value {
  flex: 0 0 auto;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--g600);
  min-width: 2ch;
  text-align: right;
}

.stats-season-note {
  padding: 0 1rem;
  margin: -0.5rem 0 1.25rem;
  font-size: 0.8rem;
  color: var(--g500);
}

.scores-table-wrap {
  padding: 0 1rem;
  overflow-x: auto;
}

.standings-table {
  width: 100%;
  min-width: 480px;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.standings-table th, .standings-table td {
  padding: 0.45rem 0.5rem;
  text-align: center;
  border-bottom: 1px solid var(--g100);
  white-space: nowrap;
}

.standings-table th {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--g500);
}

.standings-team {
  text-align: left;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.standings-logo { width: 18px; height: 18px; object-fit: contain; }

.standings-pts { font-weight: 700; color: var(--brand); }

.standings-row-qualify { background: rgba(26, 122, 60, 0.08); }
.standings-row-wildcard { background: rgba(184, 134, 11, 0.08); }

.standings-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 0 1rem;
  margin-bottom: 1rem;
  font-size: 0.75rem;
  color: var(--g600);
}

.standings-legend span { display: inline-flex; align-items: center; gap: 0.35rem; }

.legend-dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.legend-qualify { background: var(--confirmed); }
.legend-wildcard { background: var(--rumor); }

/* Results/Upcoming grid — wraps to fill the width instead of scrolling
   sideways, and shows every match rather than a horizontally-clipped slice. */
.scores-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
  padding: 0 1rem;
  margin-bottom: 0.5rem;
}

.scores-grid .game-card { width: 100%; }

/* ─── Icon nav (Feed / Results / Upcoming / Standings / Stats) ──────────
   One persistent nav, always visible above the feed and the Scores &
   Fixtures view alike (never hidden/swapped) — story-bubble circles,
   the same "quick-access shortcut circles above the feed" pattern as
   The Stoop's #feed-shortcuts (a filled circle per item, icon centered
   inside, label below), not a text-pill row. */

.icon-nav {
  display: flex;
  gap: 0.5rem;
  padding: 0.85rem 1rem 1rem;
  margin-bottom: 1.5rem;
}

.icon-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

.icon-nav-circle {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--g100);
  border: 1.5px solid var(--g200);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.icon-nav-item:hover .icon-nav-circle { background: var(--g200); }

.icon-nav-icon { width: 22px; height: 22px; }

.icon-nav-label {
  font: 700 0.7rem var(--sans);
  color: var(--g600);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.icon-nav-item.active .icon-nav-circle {
  background: var(--brand-light);
  border-color: var(--brand);
}

.icon-nav-item.active .icon-nav-label { color: var(--brand); }

@media (max-width: 640px) {
  .wordmark { font-size: 2rem; letter-spacing: 0; gap: 0.4rem; }
  #masthead.scrolled .wordmark { font-size: 1.4rem; }
  .feed-card { width: 94%; margin-left: auto; margin-right: auto; }
  .feed-card > .feed-card-thumb { display: none; }
  .feed-card-excerpt-row { display: flex; gap: 0.65rem; align-items: flex-start; margin-top: 0.4rem; }
  .feed-card-excerpt-row .excerpt { margin-top: 0; }
  .feed-card-thumb-mobile {
    display: block;
    flex-shrink: 0;
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: 6px;
    background: var(--g100);
  }
  .bar-label { flex-basis: 96px; font-size: 0.72rem; }
  .icon-nav { gap: 0.75rem; padding: 0 0.5rem; }
  .icon-nav-circle { width: 46px; height: 46px; }
  .icon-nav-icon { width: 19px; height: 19px; }
  .icon-nav-label { font-size: 0.62rem; }
}

@media (max-width: 400px) {
  .wordmark { font-size: 1.7rem; }
}
