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

:root {
  --bg: #f6f3ee;
  --surface: #ffffff;
  --card-bg: #f0ece4;
  --border: #ddd9d2;
  --text: #1a1917;
  --text-muted: #78716c;
  --text-faint: #a8a29e;
  --accent: #15803d;
  --accent-dark: #0f5c2d;
  --accent-light: #dcfce7;
  --amber: #b45309;
  --amber-light: #fef3c7;
  --radius-sm: 4px;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 8px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.05);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 15px;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Header ── */
header {
  background: var(--text);
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #f6f3ee;
  text-decoration: none;
}
.logo em { color: #4ade80; font-style: normal; }

nav { display: flex; gap: 0.25rem; }
nav a {
  color: #a8a29e;
  text-decoration: none;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  transition: color 0.15s, background 0.15s;
}
nav a:hover { color: #f6f3ee; text-decoration: none; }
nav a.active { color: #f6f3ee; background: rgba(255,255,255,0.1); }

.nav-toggle {
  display: none;
  background: transparent;
  border: 0;
  padding: 0.5rem;
  cursor: pointer;
  margin-right: -0.5rem;
}
.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: #f6f3ee;
  border-radius: 2px;
  margin: 4px 0;
  transition: transform 0.18s, opacity 0.18s;
}

/* ── Layout ── */
.container { max-width: 1120px; margin: 0 auto; padding: 0 2rem; }
.page { padding: 2.5rem 0 4rem; }

/* ── Search ── */
.search-wrap { position: relative; }

.search-input {
  width: 100%;
  padding: 0.9rem 130px 0.9rem 1.25rem;
  font-size: 1rem;
  border: 2px solid var(--border);
  border-radius: 50px;
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-shadow: var(--shadow);
}
.search-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(21,128,61,0.12); }
.search-input::placeholder { color: var(--text-faint); }

.search-btn {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 50px;
  padding: 0.5rem 1.25rem;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.875rem;
}
.search-btn:hover { background: var(--accent-dark); }

/* ── Suggestion pills ── */
.pills { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.875rem; }
.pill {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50px;
  padding: 0.3rem 0.875rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}
.pill:hover { background: var(--accent-light); color: var(--accent-dark); border-color: var(--accent); }

/* ── Cards ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ── Stat display ── */
.stat-num {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
}
.stat-adj { color: var(--accent); }
.stat-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-top: 0.35rem;
  font-weight: 600;
}
.stat-ci { font-size: 0.8125rem; color: var(--text-faint); margin-top: 0.2rem; }

/* ── Badges ── */
.badge {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: 50px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.badge-green { background: var(--accent-light); color: var(--accent-dark); }
.badge-amber { background: var(--amber-light); color: var(--amber); }
.badge-gray  { background: var(--card-bg); color: var(--text-muted); }

/* ── Section labels ── */
.section-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

h1 { font-size: 2rem; font-weight: 800; letter-spacing: -0.03em; line-height: 1.15; }
h2 { font-size: 1.4rem; font-weight: 700; letter-spacing: -0.02em; }
h3 { font-size: 1.1rem; font-weight: 600; }
h4 { font-size: 0.9rem; font-weight: 600; }

/* ── Grids ── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }

/* ── Divider ── */
.divider { height: 1px; background: var(--border); margin: 1.25rem 0; }

/* ── Ask bar ── */
.ask-bar {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
}
.ask-bar-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.625rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.ask-bar-label::before { content: '✦'; color: var(--accent); font-size: 0.6rem; }

/* ── Horizontal bar chart ── */
.bar-row { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.5rem; }
.bar-label { width: 4rem; text-align: right; color: var(--text-muted); font-size: 0.8rem; flex-shrink: 0; }
.bar-track { flex: 1; height: 10px; background: var(--card-bg); border-radius: 50px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--accent); border-radius: 50px; }
.bar-fill.alt { background: #93c5fd; }
.bar-val { width: 3rem; font-size: 0.8rem; color: var(--text-muted); }

/* ── Tags ── */
.tag {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  color: var(--text-muted);
  margin: 0.2rem;
}

/* ── Chat ── */
.chat-row { display: flex; margin-bottom: 1rem; }
.chat-bubble {
  max-width: 82%;
  padding: 0.875rem 1.1rem;
  border-radius: var(--radius);
  line-height: 1.55;
  font-size: 0.9375rem;
}
.chat-bubble.user {
  background: var(--accent);
  color: #fff;
  margin-left: auto;
  border-bottom-right-radius: 4px;
}
.chat-bubble.ai {
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}
.chat-meta { font-size: 0.75rem; color: var(--text-faint); margin-top: 0.3rem; }

/* ── Collapsible ── */
details summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-muted);
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  user-select: none;
  list-style: none;
  background: var(--card-bg);
}
details summary::-webkit-details-marker { display: none; }
details summary::before { content: '▶  '; font-size: 0.6rem; }
details[open] summary { border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
details[open] summary::before { content: '▼  '; }
details .details-body {
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  padding: 1.25rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.75;
}

/* ── Stat table ── */
.stat-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.stat-table th {
  text-align: left;
  font-size: 0.69rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: 700;
  padding: 0.5rem 0.875rem;
  border-bottom: 2px solid var(--border);
}
.stat-table td { padding: 0.625rem 0.875rem; border-bottom: 1px solid var(--card-bg); }
.stat-table tr:last-child td { border-bottom: none; }
.stat-table td.num { font-variant-numeric: tabular-nums; font-weight: 600; }
.stat-table td.better { color: var(--accent); font-weight: 700; }
.stat-table td.worse  { color: #dc2626; }

/* ── Player card ── */
.player-card { padding: 1.25rem; transition: box-shadow 0.15s; cursor: pointer; }
.player-card:hover { box-shadow: var(--shadow-md); }
.player-avatar {
  display: flex; align-items: center;
  margin-bottom: 0.875rem;
}
.player-name { font-weight: 700; font-size: 0.9375rem; margin-bottom: 0.15rem; }
.player-country { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 0.875rem; }

/* ── Confidence indicator ── */
.conf-track {
  height: 8px;
  background: var(--card-bg);
  border-radius: 50px;
  position: relative;
  overflow: visible;
}
.conf-fill {
  height: 100%;
  background: linear-gradient(to right, #bbf7d0, var(--accent));
  border-radius: 50px;
}
.conf-dot {
  position: absolute;
  top: -3px; width: 14px; height: 14px;
  background: var(--accent);
  border: 2px solid white;
  border-radius: 50%;
  transform: translateX(-50%);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* ── Inline highlight box ── */
.highlight-box {
  border-left: 3px solid var(--accent);
  background: var(--accent-light);
  padding: 1rem 1.25rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.9rem;
  line-height: 1.65;
  color: var(--accent-dark);
}

/* ── Footer ── */
footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 2rem;
  text-align: center;
  font-size: 0.8125rem;
  color: var(--text-muted);
}
footer strong { color: var(--text); }

/* ── Mobile (<= 768px) ── */
@media (max-width: 768px) {
  header { padding: 0 1rem; position: relative; }
  .nav-toggle { display: block; }
  .nav-toggle.is-open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
  .nav-toggle.is-open span:nth-child(2) { opacity: 0; }
  .nav-toggle.is-open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

  nav {
    display: none;
    position: absolute;
    top: 56px;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    background: var(--text);
    border-top: 1px solid rgba(255,255,255,0.08);
    padding: 0.4rem 0;
    z-index: 99;
    box-shadow: var(--shadow-md);
  }
  nav.is-open { display: flex; }
  nav a {
    padding: 0.875rem 1rem;
    border-radius: 0;
    font-size: 0.95rem;
  }
  nav a.active { background: rgba(255,255,255,0.06); }

  .container { padding: 0 1rem; }
  footer { padding: 1.25rem 1rem; line-height: 1.7; }
}

/* --- Wordmark image in header (added 8 May) --- */
.logo {
  display: inline-flex;
  align-items: center;
}
.logo img {
  height: 12rem;
  width: auto;
  display: block;
}

/* Preview banner — remove on August 12 launch */
.preview-banner {
  background: var(--amber);
  color: #fff;
  text-align: center;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.01em;
}
@media (max-width: 600px) {
  .preview-banner { font-size: 0.8rem; padding: 0.4rem 0.8rem; }
}
