/* ── Tokens ──────────────────────────────────────────────── */
:root {
  --bg:      #f8f8f7;
  --surface: #fcfcfb;
  --surface-2: #f2f3f2;
  --border:  #e3e5e8;
  --text-1:  #111110;
  --text-2:  #5f6670;
  --text-3:  #9299a3;
  --accent:  #e8293b;
  --live:    #22c55e;
  --live-dim: #dcfce7;
  --blue:    #3b82f6;
  --radius:  10px;
  --card-radius: 14px;
}

/* ── Reset ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: system-ui, sans-serif; background: var(--bg); color: var(--text-1); font-size: 15px; min-height: 100vh; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: none; background: none; }
body.nav-open { overflow: hidden; }

/* ── App shell ───────────────────────────────────────────── */
.app-shell {
  min-height: 100vh;
}

.app-main {
  min-width: 0;
  margin-left: 250px;
  min-height: 100vh;
}

/* ── Nav ─────────────────────────────────────────────────── */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  width: 250px;
  background: var(--bg);
  border-right: 1px solid var(--border);
  overflow-x: hidden;
  overflow-y: hidden;
  scrollbar-gutter: stable;
}

.nav-inner {
  flex: 1;
  min-height: 0;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 24px;
  overflow: hidden;
}

.nav-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.nav-logo { font-size: 1.1rem; font-weight: 800; }
.nav-logo span { color: var(--accent); }

.nav-close,
.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-1);
  font-size: .84rem;
  font-weight: 600;
}

.nav-close:hover,
.nav-toggle:hover {
  background: var(--surface-2);
}

.nav-overlay {
  display: none;
}

.nav-overlay[hidden] {
  display: none !important;
}

.nav-links {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-inner > .nav-links {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
}

.nav-links a {
  font-size: .875rem; font-weight: 500; color: var(--text-2);
  padding: 10px 12px; border-radius: 8px;
  display: flex; align-items: center; gap: 5px;
}

.nav-links a.nav-primary-link {
  font-weight: 650;
}

.nav-links a:hover { background: var(--surface-2); color: var(--text-1); }
.nav-links a.active { background: var(--surface-2); color: var(--text-1); font-weight: 600; }

.nav-live-badge {
  font-size: .68rem; font-weight: 700;
  color: var(--live); background: var(--live-dim);
  padding: 1px 7px; border-radius: 999px;
  display: flex; align-items: center; gap: 3px;
}

.nav-live-badge::before {
  content: ''; width: 5px; height: 5px;
  border-radius: 50%; background: var(--live);
  animation: pulse 1.4s ease-in-out infinite;
}

.nav-right {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.nav-user {
  font-size: .82rem;
  color: var(--text-2);
  line-height: 1.5;
}

.nav-user strong {
  color: var(--text-1);
}

.nav-signout-form {
  margin: 0;
}

.btn-ghost {
  font-size: .875rem; color: var(--text-2);
  padding: 6px 14px; border-radius: 6px;
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-ghost:hover { color: var(--text-1); border-color: var(--text-3); }

.mobile-nav-bar {
  display: none;
}

/* ── Layout ──────────────────────────────────────────────── */
.page { max-width: 1100px; margin: 0 auto; padding: 24px 20px; }

.two-col {
  display: grid;
  grid-template-columns: 1fr 290px;
  gap: 22px;
}

/* ── Auth pages ──────────────────────────────────────────── */
.auth-shell {
  max-width: 560px;
  margin: 24px auto 48px;
}

.auth-panel {
  overflow: hidden;
}

.auth-form-wrap {
  padding: 42px 38px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 18px;
  background: var(--surface);
}

.auth-intro h1 {
  font-size: 2rem;
  line-height: 1.05;
  margin-bottom: 10px;
}

.auth-intro p {
  color: var(--text-2);
  line-height: 1.6;
}

.auth-form {
  display: grid;
  gap: 14px;
}

.auth-form label {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text-2);
}

.auth-form input {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  font: inherit;
}

.auth-form input:focus {
  outline: 2px solid rgba(59, 130, 246, 0.16);
  border-color: var(--blue);
}

.auth-submit {
  margin-top: 8px;
  padding: 13px 16px;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}

.auth-submit:hover {
  filter: brightness(0.96);
}

.auth-alert {
  padding: 12px 14px;
  border: 1px solid #f4b6bd;
  border-radius: 10px;
  background: #fff2f4;
  color: #9e1d2b;
  font-size: 0.92rem;
}

.auth-switch {
  color: var(--text-2);
  font-size: 0.94rem;
}

.auth-switch a {
  color: var(--accent);
  font-weight: 700;
}

/* ── Card ────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--card-radius);
  overflow: hidden;
}

.card-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  font-size: .85rem; font-weight: 700;
}

.card-body { padding: 12px 16px; }

/* ── Badge ───────────────────────────────────────────────── */
.badge {
  font-size: .67rem; font-weight: 700; letter-spacing: .3px;
  text-transform: uppercase; padding: 2px 7px; border-radius: 4px;
}

.badge-live { background: var(--live-dim); color: var(--live); }
.badge-ft   { background: var(--surface-2); color: var(--text-3); }

/* ── Animations ──────────────────────────────────────────── */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .3; }
}

.live-dot {
  display: inline-block; width: 7px; height: 7px;
  border-radius: 50%; background: var(--live);
  animation: pulse 1.4s ease-in-out infinite;
}

/* ── Date strip (home) ───────────────────────────────────── */
.date-strip { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin-bottom: 16px; }
.date-strip::-webkit-scrollbar { display: none; }

.date-pill {
  flex-shrink: 0; display: flex; flex-direction: column; align-items: center;
  padding: 7px 13px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface);
  font-size: .72rem; color: var(--text-2); min-width: 48px; gap: 1px;
  cursor: pointer;
}

.date-pill strong { font-size: .85rem; font-weight: 700; color: var(--text-1); }
.date-pill.active { background: var(--text-1); border-color: var(--text-1); color: rgba(255,255,255,.6); }
.date-pill.active strong { color: #fff; }

/* ── Match rows ──────────────────────────────────────────── */
.comp-group { margin-bottom: 14px; }

.comp-label {
  padding: 9px 14px;
  background: var(--surface-2); border-bottom: 1px solid var(--border);
  font-size: .75rem; font-weight: 600; color: var(--text-2);
}

.match-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center; gap: 12px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  text-decoration: none; color: inherit;
  transition: background .12s;
}

.match-row:last-child { border-bottom: none; }
.match-row:hover      { background: var(--surface-2); }

.team-side { display: flex; align-items: center; gap: 8px; }
.team-side.away { flex-direction: row-reverse; text-align: right; }

.team-name { font-size: .875rem; font-weight: 500; }

.match-center { text-align: center; min-width: 64px; }

.score-box {
  font-size: .9rem; font-weight: 600; letter-spacing: 1px;
  display: flex; align-items: center; gap: 4px; justify-content: center;
}

.score-dash { color: var(--text-3); font-size: .8rem; }

.match-time { font-size: .72rem; color: var(--text-2); margin-top: 2px; }
.match-time.live { color: var(--live); font-weight: 700; }

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar { display: flex; flex-direction: column; gap: 16px; }

.section-link { font-size: .8rem; font-weight: 500; color: var(--accent); }
.section-link:hover { text-decoration: underline; }

/* League table */
.table-mini {
  width: 100%;
  border-collapse: collapse;
  font-size: .8rem;
  line-height: 1.25;
}

.table-mini th {
  font-size: .67rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .3px; color: var(--text-3);
  padding: 8px 10px; text-align: right;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table-mini th:nth-child(-n+2) { text-align: left; }

.table-mini td {
  padding: 10px; text-align: right;
  border-bottom: 1px solid var(--border); color: var(--text-2);
  white-space: nowrap;
}

.table-mini td:first-child  { text-align: left; padding-left: 12px; }
.table-mini td:nth-child(2) { text-align: left; font-weight: 500; color: var(--text-1); }
.table-mini tr:last-child td { border-bottom: none; }
.table-mini tr:hover td      { background: var(--surface-2); }

.pts { font-weight: 700; color: var(--text-1); }
.cl-border td { border-top: 2px solid var(--blue) !important; }

/* Top scorers */
.scorer-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.scorer-row:last-child { border-bottom: none; }
.scorer-rank  { font-size: .72rem; font-weight: 700; color: var(--text-3); width: 16px; text-align: center; }
.scorer-info  { flex: 1; }
.scorer-name  { font-size: .85rem; font-weight: 500; }
.scorer-club  { font-size: .7rem; color: var(--text-3); }
.scorer-goals { font-weight: 700; }

/* ── Live page ───────────────────────────────────────────── */
.live-header { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.live-header h1 { font-size: 1.35rem; font-weight: 800; }

.live-count {
  background: var(--live-dim); color: var(--live);
  font-size: .72rem; font-weight: 700;
  padding: 2px 9px; border-radius: 999px;
}

.filter-tabs { display: flex; gap: 6px; margin-bottom: 16px; overflow-x: auto; scrollbar-width: none; }
.filter-tabs::-webkit-scrollbar { display: none; }

.filter-tab {
  flex-shrink: 0; padding: 5px 14px; border-radius: 999px;
  font-size: .8rem; font-weight: 500;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-2); cursor: pointer; white-space: nowrap;
}

.filter-tab:hover  { border-color: var(--text-3); color: var(--text-1); }
.filter-tab.active { background: var(--text-1); border-color: var(--text-1); color: #fff; }

.live-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px; margin-bottom: 28px;
}

.live-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  text-decoration: none; color: inherit; display: block;
  transition: box-shadow .15s, transform .12s;
}

.live-card:hover { box-shadow: 0 4px 14px rgba(0,0,0,.09); transform: translateY(-1px); }

.live-card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 13px;
  background: var(--surface-2); border-bottom: 1px solid var(--border);
  font-size: .72rem; font-weight: 600; color: var(--text-2);
}

.live-card-body { padding: 14px 13px; }

.match-teams {
  display: grid;
  grid-template-columns: 1fr 72px 1fr;
  align-items: center; gap: 6px;
}

.team-block { display: flex; flex-direction: column; gap: 4px; }
.team-block.l { align-items: flex-start; }
.team-block.r { align-items: flex-end; }
.team-nm { font-size: .875rem; font-weight: 600; }

.scoreboard { text-align: center; }

.score-main { font-size: 1.65rem; font-weight: 600; letter-spacing: 2px; line-height: 1; }
.score-sep  { color: var(--text-3); font-size: 1rem; margin: 0 2px; }

.min-badge {
  display: inline-flex; align-items: center; gap: 4px;
  margin-top: 5px; font-size: .68rem; font-weight: 700;
  color: var(--live); background: var(--live-dim);
  padding: 2px 7px; border-radius: 999px;
}

.min-dot {
  width: 5px; height: 5px; border-radius: 50%; background: var(--live);
  animation: pulse 1.4s ease-in-out infinite;
}

.events-strip {
  margin-top: 11px; padding-top: 10px;
  border-top: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 4px;
}

.event-item { display: flex; align-items: center; gap: 6px; font-size: .75rem; color: var(--text-2); }
.event-item.away { flex-direction: row-reverse; }
.event-min  { font-size: .67rem; color: var(--text-3); min-width: 24px; }
.event-name { font-weight: 500; color: var(--text-1); }

/* Upcoming */
.upcoming-label { font-size: .95rem; font-weight: 800; margin-bottom: 10px; }
.upcoming-list  { display: flex; flex-direction: column; gap: 8px; }

.upcoming-item {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center; gap: 10px;
  padding: 11px 16px;
  text-decoration: none; color: inherit;
  transition: background .12s;
}

.upcoming-item:hover { background: var(--surface-2); }

.upcoming-team { display: flex; align-items: center; gap: 7px; font-size: .875rem; font-weight: 500; }
.upcoming-team.r { flex-direction: row-reverse; }
.upcoming-time {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  text-align: center;
}
.upcoming-date { font-size: .78rem; color: var(--text-3); white-space: nowrap; }
.upcoming-score { font-size: .9rem; font-weight: 600; white-space: nowrap; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 860px) { .two-col { grid-template-columns: 1fr; } }
@media (max-width: 560px) { .live-grid { grid-template-columns: 1fr; } }

@media (max-width: 860px) {
  .app-main {
    margin-left: 0;
  }

  .nav {
    transform: translateX(-100%);
    transition: transform .2s ease;
  }

  body.nav-open .nav {
    transform: translateX(0);
  }

  .nav-close,
  .nav-toggle,
  .mobile-nav-bar {
    display: inline-flex;
  }

  .mobile-nav-bar {
    position: sticky;
    top: 0;
    z-index: 90;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 20px 10px;
    background: rgba(248, 248, 247, 0.94);
    backdrop-filter: blur(10px);
  }

  .nav-overlay {
    position: fixed;
    inset: 0;
    z-index: 95;
    background: rgba(17, 17, 16, 0.34);
  }

  body.nav-open .nav-overlay {
    display: block;
  }

  .page {
    padding-top: 12px;
  }

  .auth-form-wrap {
    padding: 28px 22px;
  }

  .auth-intro h1 {
    font-size: 1.8rem;
  }
}


/* Match detail */
.match-back { margin-bottom: 14px; }
.match-back a { font-size: .85rem; color: var(--text-2); }
.match-back a:hover { color: var(--text-1); }

.match-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(260px, .9fr);
  gap: 20px;
  margin-top: 20px;
}

.match-sidebar { display: flex; flex-direction: column; gap: 16px; }
.match-loading,
.timeline-empty {
  color: var(--text-2);
  font-size: .92rem;
}

.match-meta-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 22px;
}

.match-league {
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--text-3);
  margin-bottom: 6px;
}

.match-date {
  font-size: .95rem;
  color: var(--text-2);
}

.match-scoreboard-lg {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
}

.match-team-panel.away {
  text-align: right;
}

.match-team-name {
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.2;
}

.match-score-panel {
  text-align: center;
  min-width: 170px;
}

.match-score-lg {
  font-size: 2.7rem;
  font-weight: 800;
  letter-spacing: .04em;
  line-height: 1;
}

.match-score-placeholder {
  color: var(--text-3);
  font-size: 1.4rem;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.match-subline {
  margin-top: 8px;
  color: var(--text-2);
  font-size: .86rem;
}

.info-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.info-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.info-row:last-child {
  padding-bottom: 0;
  border-bottom: none;
}

.info-label {
  color: var(--text-3);
  font-size: .77rem;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.info-value {
  text-align: right;
  color: var(--text-1);
  font-weight: 600;
}

.timeline-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 52px 14px 1fr;
  gap: 12px;
  align-items: start;
}

.timeline-minute {
  color: var(--text-3);
  font-size: .82rem;
  font-weight: 700;
  text-align: right;
  padding-top: 2px;
}

.timeline-marker {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  margin-top: 6px;
  position: relative;
}

.timeline-marker::after {
  content: "";
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  height: calc(100% + 28px);
  background: var(--border);
}

.timeline-item:last-child .timeline-marker::after {
  display: none;
}

.timeline-content {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
}

.timeline-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.timeline-title-row strong {
  font-size: .92rem;
}

.timeline-type {
  font-size: .72rem;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .06em;
}

.timeline-subtitle {
  color: var(--text-2);
  font-size: .83rem;
}

.timeline-item.away .timeline-marker {
  background: var(--blue);
}

@media (max-width: 860px) {
  .match-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .match-scoreboard-lg {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .match-team-panel,
  .match-team-panel.away {
    text-align: center;
  }

  .match-score-panel {
    min-width: 0;
  }
}
