/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Design tokens ── */
:root {
  --navy:       #1a1a2e;
  --accent:     #4a6fa5;
  --white:      #ffffff;
  --orange:     #f07020;
  --bg:         #f0f2f5;
  --card:       #ffffff;
  --text:       #1a1a1a;
  --muted:      #666666;
  --border:     #e0e0e0;
  --tab-h:      60px;
  --header-h:   56px;
  --max-w:      480px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ── Base ── */
html {
  height: -webkit-fill-available;
  width: 100%;
  overflow-x: hidden;
}
body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  width: 100%;
  min-height: 100vh;
  min-height: -webkit-fill-available;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}
body.has-tabs {
  padding-bottom: calc(var(--tab-h) + var(--safe-bottom) + 24px);
}
img, svg { max-width: 100%; }

/* ── App shell: center on desktop ── */
.app-shell {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  position: relative;
  min-height: 100vh;
  background: var(--bg);
  box-shadow: 0 0 40px rgba(0,0,0,0.08);
  overflow-x: hidden;
}

/* ── Header ── */
.app-header {
  position: sticky;
  top: 0;
  z-index: 200;
  background: var(--navy);
  height: var(--header-h);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.app-header .logo-mark {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
}
.logo-link {
  display: flex;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}
.app-header .brand {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
  flex: 1;
}
.app-header .brand-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--white);
  letter-spacing: 0.02em;
}
.app-header .brand-sub {
  font-size: 0.62rem;
  color: var(--accent);
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

/* ── Sport switcher (in header, on club/hs pages) ── */
.sport-switcher {
  display: flex;
  background: rgba(255,255,255,0.12);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
  flex-shrink: 0;
}
.sport-switch-btn {
  padding: 4px 12px;
  border: none;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  color: rgba(255,255,255,0.6);
  background: transparent;
  transition: all 0.15s;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  text-decoration: none;
  display: flex;
  align-items: center;
}
.sport-switch-btn.active,
.sport-switch-btn:hover {
  background: var(--white);
  color: var(--navy);
}
.sport-switch-btn.disabled {
  color: rgba(255,255,255,0.35);
  cursor: default;
}
.sport-switch-btn.disabled:hover {
  background: transparent;
  color: rgba(255,255,255,0.35);
}

/* ── Bottom tab bar ── */
.tab-bar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%) translateZ(0);
  -webkit-transform: translateX(-50%) translateZ(0);
  will-change: transform;
  width: 100%;
  max-width: var(--max-w);
  z-index: 300;
  background: var(--white);
  border-top: 1px solid var(--border);
  display: flex;
  height: calc(var(--tab-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  box-shadow: 0 -2px 10px rgba(0,0,0,0.08);
}
.tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
  padding: 8px 4px;
  border: none;
  background: none;
  font-family: inherit;
  color: var(--muted);
  transition: color 0.15s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  text-decoration: none;
}
.tab-item.active { color: var(--navy); }
.tab-item svg { width: 22px; height: 22px; stroke-width: 1.8; }
.tab-item .tab-label { font-size: 0.65rem; font-weight: 500; letter-spacing: 0.02em; }

/* ── Page content wrapper ── */
.page-content {
  padding: 16px;
}

/* ── Cards ── */
.card {
  background: var(--card);
  border-radius: 14px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  padding: 16px;
  margin-bottom: 12px;
}
.card-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid #f0f0f0;
  display: flex;
  align-items: center;
  gap: 6px;
}
.card-title svg {
  width: 16px;
  height: 16px;
  stroke: var(--accent);
  stroke-width: 2;
}

/* Tappable nav card (used on homepage) */
.nav-card {
  background: var(--card);
  border-radius: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  padding: 28px 20px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 18px;
  text-decoration: none;
  color: var(--text);
  border: 2px solid transparent;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
}
.nav-card:active {
  transform: scale(0.98);
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.nav-card:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 16px rgba(74,111,165,0.15);
}
.nav-card-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: var(--navy);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.nav-card-icon svg {
  width: 28px;
  height: 28px;
  stroke: var(--white);
  stroke-width: 1.8;
  fill: none;
}
.nav-card-icon.accent { background: var(--accent); }
.nav-card-body { flex: 1; min-width: 0; }
.nav-card-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 4px;
}
.nav-card-desc {
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.5;
}
.nav-card-arrow {
  color: var(--border);
  flex-shrink: 0;
}
.nav-card-arrow svg {
  width: 20px;
  height: 20px;
  stroke: var(--muted);
  stroke-width: 2;
  fill: none;
}
.nav-card.disabled {
  position: relative;
  cursor: default;
  opacity: 0.6;
  filter: grayscale(0.4);
  box-shadow: none;
}
.nav-card.disabled:hover,
.nav-card.disabled:active {
  border-color: transparent;
  box-shadow: none;
  transform: none;
}
.nav-card.disabled .nav-card-icon {
  background: var(--muted);
}
.nav-card-badge {
  position: absolute;
  top: -8px;
  right: 16px;
  background: var(--muted);
  color: var(--white);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 10px;
  border-radius: 999px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 20px;
  border: none;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
  -webkit-tap-highlight-color: transparent;
  min-height: 44px;
  text-decoration: none;
}
.btn-primary {
  background: var(--navy);
  color: var(--white);
}
.btn-primary:hover { background: #2a2a4a; }
.btn-accent {
  background: var(--accent);
  color: var(--white);
}
.btn-accent:hover { background: #3a5f95; }
.btn-outline {
  background: transparent;
  color: var(--navy);
  border: 1.5px solid var(--navy);
}
.btn-outline:hover { background: rgba(26,26,46,0.05); }
.btn-full { width: 100%; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ── Typography helpers ── */
.section-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 10px;
}
.empty {
  color: var(--muted);
  font-size: 0.85rem;
  padding: 24px 0;
  text-align: center;
}

/* ── Pill filters ── */
.pill-group { display: flex; flex-wrap: wrap; gap: 6px; }
.pill {
  padding: 5px 13px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  background: var(--white);
  color: var(--muted);
  font-family: inherit;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.pill.active {
  background: var(--navy);
  border-color: var(--navy);
  color: var(--white);
}

/* ── Badges ── */
.badge {
  display: inline-block;
  font-size: 0.68rem;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-primary { background: rgba(26,26,46,0.08); color: var(--navy); }
.badge-accent  { background: rgba(74,111,165,0.12); color: var(--accent); }
.badge-win     { background: #eafaf1; color: #1e8449; }
.badge-loss    { background: #fdedec; color: #c0392b; }

/* ── Inline text link (e.g. "My Team" inside an empty-state message) ── */
.text-link {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  font-weight: 600;
  -webkit-tap-highlight-color: transparent;
}
