:root {
  --bg: #0b1020;
  --panel: rgba(17, 24, 39, 0.9);
  --panel-border: rgba(148, 163, 184, 0.15);
  --text: #ebf2ff;
  --muted: #aab6d3;
  --accent: #60a5fa;
  --accent-2: #22c55e;
  --danger: #ef4444;
  --draw: #f59e0b;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Inter, system-ui, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(96, 165, 250, 0.18), transparent 30%),
    radial-gradient(circle at top right, rgba(34, 197, 94, 0.16), transparent 28%),
    linear-gradient(180deg, #08101e 0%, #0f172a 100%);
  color: var(--text);
  min-height: 100vh;
}

.page-shell {
  max-width: 1120px;
  margin: 0 auto;
  padding: 40px 20px 72px;
}

/* --- HERO --- */
.hero {
  margin-bottom: 24px;
}

.eyebrow, .section-label {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.72rem;
  color: var(--accent);
  font-weight: 700;
}

.hero h1 {
  margin: 10px 0 12px;
  font-size: clamp(2.2rem, 5vw, 4.2rem);
  line-height: 0.95;
  max-width: 750px;
}

.hero-copy {
  margin: 0;
  max-width: 680px;
  color: var(--muted);
  font-size: 1.04rem;
  line-height: 1.6;
}

/* --- CARDS & STACKING --- */
.card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.search-card {
  padding: 24px;
  position: relative;
  z-index: 100; /* High z-index to stay above results */
}

.results {
  margin-top: 18px;
  display: grid;
  gap: 18px;
  position: relative;
  z-index: 10; /* Lower z-index so dropdowns float over it */
}

.summary-card,
.timeline-card,
.status-card {
  padding: 24px;
}

/* --- SEARCH & INPUTS --- */
.club-form {
  display: grid;
  gap: 20px;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 16px;
  align-items: start;
}

.field-group label {
  display: block;
  margin-bottom: 10px;
  font-weight: 700;
}

.search-box {
  position: relative;
}

.input-wrapper {
  display: flex;
  gap: 8px;
  position: relative;
}

input {
  flex: 1;
  padding: 15px 16px;
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(15, 23, 42, 0.8);
  color: var(--text);
  font-size: 1rem;
  outline: none;
}

input:focus {
  border-color: rgba(96, 165, 250, 0.75);
  box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.12);
}

.search-trigger {
  background: var(--accent);
  color: var(--bg);
  border: 0;
  border-radius: 12px;
  padding: 0 16px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s;
}

.search-trigger:hover {
  opacity: 0.9;
}

/* --- DROPDOWN (TYPEAHEAD) --- */
.typeahead {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: #0f172a;
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 16px;
  overflow: hidden;
  z-index: 1000;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
}

.typeahead button {
  width: 100%;
  background: transparent;
  color: var(--text);
  border: 0;
  padding: 14px 16px;
  text-align: left;
  cursor: pointer;
  border-bottom: 1px solid rgba(148, 163, 184, 0.08);
}

.typeahead button:hover {
  background: rgba(96, 165, 250, 0.12);
}

.typeahead button:last-child {
  border-bottom: 0;
}

.team-option-title {
  display: block;
  font-weight: 700;
  margin-bottom: 4px;
}

.team-option-meta {
  color: var(--muted);
  font-size: 0.9rem;
}

/* --- SELECTIONS & LAYOUT --- */
.selected-team {
  margin-top: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid rgba(148, 163, 184, 0.12);
  color: var(--text);
  min-height: 48px;
}

.selected-team.empty {
  color: var(--muted);
}

.versus {
  align-self: center;
  justify-self: center;
  font-weight: 800;
  font-size: 1.1rem;
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(96, 165, 250, 0.12);
  border: 1px solid rgba(96, 165, 250, 0.25);
  color: var(--accent);
}

/* --- BUTTONS --- */
.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

button { font: inherit; }

.primary-btn, .secondary-btn {
  border: 0;
  border-radius: 16px;
  padding: 14px 18px;
  cursor: pointer;
  font-weight: 700;
}

.primary-btn {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: white;
}

.secondary-btn {
  background: rgba(148, 163, 184, 0.12);
  color: var(--text);
  border: 1px solid rgba(148, 163, 184, 0.18);
}

.primary-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

/* --- RESULTS DISPLAY --- */
.summary-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.summary-header h2 { margin: 4px 0 0; }

.pill {
  white-space: nowrap;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(96, 165, 250, 0.12);
  color: var(--accent);
  font-weight: 700;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.mini-stat {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.1);
  border-radius: 20px;
  padding: 18px;
}

.mini-stat h3 {
  margin: 10px 0 8px;
  font-size: 1.3rem;
}

.mini-label, .mini-sub {
  margin: 0;
  color: var(--muted);
}

.record-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.record-chip {
  padding: 10px 12px;
  border-radius: 14px;
  font-weight: 800;
  min-width: 72px;
  text-align: center;
}

.record-chip.win, .result-badge.win { background: rgba(34, 197, 94, 0.15); color: #86efac; }
.record-chip.loss, .result-badge.loss { background: rgba(239, 68, 68, 0.14); color: #fca5a5; }
.record-chip.draw, .result-badge.draw { background: rgba(245, 158, 11, 0.16); color: #fcd34d; }

.matches-list {
  display: grid;
  gap: 12px;
}

.match-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  align-items: center;
  padding: 16px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.1);
  border-radius: 18px;
}

.result-badge {
  width: 58px;
  height: 58px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.match-topline {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.scoreline { font-size: 1rem; }
.competition, .match-subline { color: var(--muted); }

.match-subline {
  margin-top: 6px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* --- UTILS --- */
.hidden { display: none !important; }

@media (max-width: 860px) {
  .field-grid, .summary-grid { grid-template-columns: 1fr; }
  .versus { width: 44px; height: 44px; }
}

#reset-button {
  margin-left: auto;
  background-color: darkred;
}

.summary-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.share-btn {
  padding: 0.4rem 1rem;
  border-radius: 999px;
  border: 1.5px solid var(--accent, #3b82f6);
  background: transparent;
  color: var(--accent, #3b82f6);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.share-btn:hover {
  background: var(--accent, #3b82f6);
  color: #fff;
}

.site-nav {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(11, 16, 32, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

.nav-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 20px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--text);
  font-weight: 800;
  font-size: 1rem;
}

.nav-brand-icon {
  font-size: 18px;
}

.nav-brand-text {
  color: var(--text);
}

.nav-links {
  display: flex;
  gap: 4px;
}

.nav-link {
  padding: 6px 14px;
  border-radius: 999px;
  text-decoration: none;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
  transition: color 0.15s, background 0.15s;
}

.nav-link:hover {
  color: var(--text);
  background: rgba(148, 163, 184, 0.08);
}

.nav-link.active {
  color: var(--accent);
  background: rgba(96, 165, 250, 0.1);
}

.popular-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.popular-card {
  display: block;
  text-decoration: none;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  padding: 22px;
  transition: border-color 0.15s, transform 0.15s;
}

.popular-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.popular-card-title {
  margin: 0 0 4px;
  font-size: 1.1rem;
  color: var(--text);
}

.popular-card-teams {
  margin: 0 0 10px;
  font-size: 0.85rem;
  color: var(--accent);
  font-weight: 600;
}

.popular-card-desc {
  margin: 0 0 16px;
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.5;
}

.popular-card-cta {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent);
}

.about-card {
  padding: 32px;
  max-width: 680px;
}

.about-card h2 {
  margin: 0 0 8px;
  font-size: 1.1rem;
}

.about-card p {
  margin: 0 0 28px;
  color: var(--muted);
  line-height: 1.7;
}

.about-card a {
  color: var(--accent);
}