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

/* Touch improvements: remove 300ms delay, suppress blue tap flash */
button, input, a, select, textarea { touch-action: manipulation; }
button { -webkit-tap-highlight-color: transparent; }

:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface2: #22263a;
  --border: #2e3248;
  --text: #e8eaf0;
  --text-muted: #7a7f9a;
  --accent: #4f8ef7;
  --accent-glow: rgba(79, 142, 247, 0.18);
  --value-pos: #30d158;
  --value-neg: #ff453a;
  --radius: 14px;
  --radius-sm: 8px;
  --transition: 0.2s ease;
  --cta: #7c6af7;
  --cta-glow: rgba(124, 106, 247, 0.22);
}

/* Surface themes */
body.surface-hard  { --accent: #4f8ef7; --accent-glow: rgba(79,142,247,.18); }
body.surface-clay  { --accent: #f07830; --accent-glow: rgba(240,120,48,.18); }
body.surface-grass { --accent: #34c759; --accent-glow: rgba(52,199,89,.18); }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* ── Header ───────────────────────────────────────────────────────────────── */
header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 28px;
  height: 58px;
  gap: 24px;
}

.logo { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.logo-icon { font-size: 20px; color: var(--accent); }
.logo-text { font-size: 17px; font-weight: 700; letter-spacing: -0.3px; color: var(--text) !important; }
.logo-text .accent { color: var(--accent); }

.header-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* ── Auth buttons ─────────────────────────────────────────────────────────── */
.auth-btns {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 4px;
}

.auth-btn {
  font-size: 13px;
  font-weight: 600;
  border-radius: 8px;
  padding: 7px 16px;
  cursor: pointer;
  transition: all .2s ease;
  white-space: nowrap;
}

.auth-btn--login {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.auth-btn--login:hover {
  border-color: rgba(255,255,255,0.25);
  color: var(--text);
  background: rgba(255,255,255,0.05);
}

.auth-btn--signup {
  position: relative;
  border: none;
  color: #fff;
  background: linear-gradient(135deg, #7c6eff 0%, #a78bfa 50%, #7c6eff 100%);
  background-size: 200% 100%;
  background-position: 100% 0;
  overflow: hidden;
  transition: background-position .4s ease, transform .15s ease, box-shadow .2s ease;
  box-shadow: 0 0 0 0 rgba(124,110,255,.4);
}
.auth-btn--signup:hover {
  background-position: 0% 0;
  transform: translateY(-1px);
  box-shadow: 0 4px 18px rgba(124,110,255,.45);
}
.auth-btn--signup:active {
  transform: translateY(0);
}
.auth-btn--signup::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -75%;
  width: 50%;
  height: 200%;
  background: rgba(255,255,255,.18);
  transform: skewX(-20deg);
  transition: left .5s ease;
  pointer-events: none;
}
.auth-btn--signup:hover::after {
  left: 130%;
}

.cache-info {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

.btn-refresh {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  transition: var(--transition);
}
.btn-refresh:hover { color: var(--accent); border-color: var(--accent); }
.btn-refresh.loading { opacity: 0.5; pointer-events: none; }

.lang-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 5px 11px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
  transition: var(--transition);
}
.lang-btn:hover { color: var(--accent); border-color: var(--accent); }

/* ── Main ─────────────────────────────────────────────────────────────────── */
main {
  flex: 1;
  max-width: 860px;
  width: 100%;
  margin: 0 auto;
  padding: 30px 20px 60px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ── Surface bar ──────────────────────────────────────────────────────────── */
.hero-section {
  text-align: center;
  padding: 64px 24px 72px;
}
.hero-title {
  font-size: 42px;
  font-weight: 900;
  line-height: 1.15;
  letter-spacing: -1px;
  color: var(--text);
  margin-bottom: 16px;
}
.hero-accent { color: var(--accent); }
.hero-sub {
  font-size: 17px;
  color: var(--text-muted);
  margin-bottom: 32px;
}
.hero-btns {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}
.hero-btn {
  padding: 13px 28px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity .15s, transform .15s;
}
.hero-btn:hover { opacity: .85; transform: translateY(-1px); }
.hero-btn--primary {
  background: var(--accent);
  color: #fff;
  border: none;
}
.hero-btn--secondary {
  background: transparent;
  color: var(--text);
  border: 1.5px solid var(--border);
}
.hero-trust {
  margin-top: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .4px;
  color: var(--text-muted);
  opacity: .7;
  flex-wrap: wrap;
}
.hero-trust-sep { opacity: .4; }

/* ── Ticker ──────────────────────────────────────────────────────────────── */
.ticker-wrap {
  overflow: hidden;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
  margin-top: 28px;
  mask-image: linear-gradient(to right, transparent 0%, black 10%, black 90%, transparent 100%);
  -webkit-mask-image: linear-gradient(to right, transparent 0%, black 10%, black 90%, transparent 100%);
}
@keyframes ticker-scroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}
.ticker-track {
  display: flex;
  align-items: center;
  gap: 18px;
  width: max-content;
  animation: ticker-scroll 36s linear infinite;
}
.ticker-track:hover { animation-play-state: paused; }
.ticker-item {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  letter-spacing: .2px;
}
.ticker-dot { color: var(--accent); opacity: .5; font-size: 12px; }

@media (max-width: 480px) {
  .hero-title { font-size: 28px; }
  .hero-sub { font-size: 15px; }
  .hero-btns { flex-direction: column; align-items: center; }
  .hero-btn { width: 100%; max-width: 280px; }
  .hero-section { padding: 40px 16px 52px; }
}

.surface-bar {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.surface-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 9px 28px;
  border-radius: 99px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.3px;
  transition: var(--transition);
}
.surface-btn:not(.active):hover { color: var(--text); border-color: rgba(255,255,255,0.25); background: rgba(255,255,255,0.06); }
.surface-btn.active {
  background: var(--accent-glow);
  border-color: var(--accent);
  color: var(--accent);
}

/* ── Players row ──────────────────────────────────────────────────────────── */
.players-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 16px;
  align-items: start;
}

.player-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.player-card label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
}

.autocomplete-wrap { position: relative; }

.autocomplete-wrap input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 16px;
  outline: none;
  transition: var(--transition);
}
.autocomplete-wrap input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.autocomplete-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  list-style: none;
  max-height: 220px;
  overflow-y: auto;
  z-index: 200;
  display: none;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.autocomplete-list.open { display: block; }
.autocomplete-list li {
  padding: 10px 14px;
  cursor: pointer;
  font-size: 14px;
  transition: background var(--transition);
}
.autocomplete-list li:hover,
.autocomplete-list li.active { background: var(--accent-glow); color: var(--accent); }

.player-elo {
  font-size: 12px;
  color: var(--text-muted);
  min-height: 18px;
}
.player-elo span { color: var(--accent); font-weight: 600; }

.vs-badge {
  align-self: center;
  margin-top: 34px;
  font-size: 13px;
  font-weight: 800;
  color: var(--text-muted);
  letter-spacing: 2px;
  padding: 0 6px;
}

/* ── Odds inputs ──────────────────────────────────────────────────────────── */
.odds-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.odds-group {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
}

.odds-group h3 {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.odds-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.odds-row label {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.odds-row input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 16px;
  outline: none;
  transition: var(--transition);
}
.odds-row input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* ── Calculate button ─────────────────────────────────────────────────────── */
.btn-calc {
  background: var(--accent);
  border: none;
  color: #fff;
  padding: 14px 32px;
  border-radius: 99px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  align-self: center;
  letter-spacing: 0.2px;
  transition: opacity var(--transition), transform var(--transition);
  box-shadow: 0 4px 20px var(--accent-glow);
}
.btn-calc:hover { opacity: 0.88; transform: translateY(-1px); }
.btn-calc:active { transform: translateY(0); }

/* ── Results ──────────────────────────────────────────────────────────────── */
.results {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 16px;
  align-items: start;
}
.results.hidden { display: none; }

.result-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color var(--transition);
}
.result-card.winner { border-color: var(--accent); }

.result-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.result-prob {
  font-size: 48px;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
  letter-spacing: -1px;
}

.result-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-top: -6px;
}

.prob-source { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: -4px; }
.prob-tag {
  font-size: 10px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase;
  color: var(--text-muted); background: rgba(255,255,255,.07);
  border-radius: 4px; padding: 2px 7px;
}
.prob-tag--pro { color: var(--accent); background: var(--accent-glow); }
.prob-form-lock {
  font-size: 11px; color: var(--text-muted); opacity: .4;
  text-decoration: line-through; cursor: pointer;
  display: flex; align-items: center; gap: 4px;
  transition: opacity .15s;
}
.prob-form-lock:hover { opacity: .65; }
.prob-lock-badge {
  text-decoration: none; font-size: 10px; font-weight: 700;
  background: var(--cta); color: #fff;
  border-radius: 4px; padding: 1px 6px; letter-spacing: .3px;
}

.result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-top: 1px solid var(--border);
  font-size: 14px;
  color: var(--text-muted);
}
.result-row strong { font-size: 16px; color: var(--text); font-weight: 700; }

/* Value indicator */
.value-block {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-muted);
}
.value-block.hidden { display: none; }
.value-block .value-label { font-weight: 600; }

.value-num {
  font-size: 15px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 6px;
}
.value-num.pos { color: var(--value-pos); background: rgba(48,209,88,.12); }
.value-num.neg { color: var(--value-neg); background: rgba(255,69,58,.12); }
.value-num.neutral { color: var(--text-muted); }

/* Divider */
.result-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 40px;
}

.elo-diff {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-align: center;
  white-space: nowrap;
}

/* ── Avatar ───────────────────────────────────────────────────────────────── */
.result-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.result-avatar, .h2h-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent-glow);
  border: 2px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: -0.5px;
  flex-shrink: 0;
}

.h2h-avatar {
  width: 52px;
  height: 52px;
  font-size: 17px;
}

/* ── H2H strip ────────────────────────────────────────────────────────────── */
.h2h-strip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.h2h-strip.hidden { display: none; }

.h2h-loading {
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

.h2h-content.hidden { display: none; }

.h2h-header {
  display: flex;
  align-items: center;
  gap: 16px;
}

.h2h-center {
  flex: 1;
  text-align: center;
}

.h2h-score {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--text);
}

.h2h-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-top: 2px;
}

.h2h-surface-row {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 10px;
  flex-wrap: wrap;
}

.h2h-surf-badge {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--surface2);
  padding: 3px 10px;
  border-radius: 99px;
  border: 1px solid var(--border);
}

.h2h-surf-badge span { color: var(--text); font-weight: 700; }

.h2h-matches {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.h2h-match {
  display: grid;
  grid-template-columns: 90px 1fr auto auto;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  background: var(--surface2);
  border-radius: var(--radius-sm);
  font-size: 12px;
}

.h2h-match-date { color: var(--text-muted); }
.h2h-match-tourn { color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.h2h-match-winner { font-weight: 700; color: var(--accent); white-space: nowrap; }
.h2h-match-score { color: var(--text-muted); white-space: nowrap; }

/* ── Serve / return / pressure stats ─────────────────────────────────────── */
.serve-stats {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat-group-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 4px;
  margin-top: 4px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 10px;
  background: var(--surface2);
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 3px;
}

.stat-row-label {
  color: var(--text-muted);
}

.stat-row-val {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: var(--text);
}

.stat-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 99px;
}
.stat-badge--above { background: rgba(48,209,88,.15); color: var(--value-pos); }
.stat-badge--below { background: rgba(255,69,58,.12); color: var(--value-neg); }
.stat-badge--avg   { background: var(--surface); color: var(--text-muted); }

.stat-footnote {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 8px;
  line-height: 1.6;
  opacity: 0.85;
}

/* ── Serve section (below H2H) ───────────────────────────────────────────── */
.serve-section {
  display: block;
}
.serve-section.hidden { display: none; }

/* ── ATP Ratings section ─────────────────────────────────────────────────── */
.atp-ratings-section { display: block; margin-top: 12px; }
.atp-ratings-section.hidden { display: none; }
.atp-ratings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 8px;
}
.atp-ratings-col {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.atp-ratings-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.atp-pts-label {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-muted);
}
.atp-ratings-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-muted);
}
.atp-ratings-row strong { font-size: 15px; color: var(--text); font-weight: 700; }

.atp-official-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .4px;
  text-transform: uppercase;
  color: var(--text-muted);
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 4px;
  padding: 2px 7px;
  vertical-align: middle;
}
.atp-official-badge--sack {
  background: rgba(255,255,255,0.1);
  color: var(--text-muted);
}

/* ── Overall Summary ─────────────────────────────────────────────────────── */
.overall-summary { margin-top: 24px; }
.overall-summary.hidden { display: none; }
.os-header { margin-bottom: 16px; }
.os-title {
  font-size: 13px; font-weight: 700; letter-spacing: .8px;
  text-transform: uppercase; color: var(--text-muted);
}
.os-sub { font-size: 12px; color: var(--text-muted); opacity: .6; margin-top: 2px; }
.os-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
}
.os-col {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
}
.os-name {
  font-size: 14px; font-weight: 700; color: var(--text);
  margin-bottom: 12px; display: flex; align-items: center; gap: 8px;
}
.os-matches {
  font-size: 10px; font-weight: 600; color: var(--text-muted);
  background: rgba(255,255,255,.06); border-radius: 4px; padding: 1px 6px;
}
.os-nodata { font-size: 12px; color: var(--text-muted); }
@media (max-width: 600px) {
  .os-grid { grid-template-columns: 1fr; }
}

.serve-section-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.serve-section-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.serve-section-header { margin-bottom: 16px; }
.serve-section-title { color: var(--accent) !important; }
.serve-section-nodata { color: var(--text-muted); font-size: 13px; padding: 8px 0 4px; }

.serve-section-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Override serve-stats styles when inside the section (no top border needed) */
.serve-section-card .serve-stats {
  border-top: none;
  padding-top: 0;
}

@media (max-width: 680px) {
  .serve-section-grid { grid-template-columns: 1fr; }
}

/* ── Error ────────────────────────────────────────────────────────────────── */
.error-msg {
  background: rgba(255,69,58,.12);
  border: 1px solid rgba(255,69,58,.3);
  color: var(--value-neg);
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
}
.error-msg.hidden { display: none; }

/* ── Footer ───────────────────────────────────────────────────────────────── */
footer {
  text-align: center;
  padding: 14px 20px;
  font-size: 10px;
  color: var(--text-muted);
  opacity: 0.45;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 6px;
}
footer:hover { opacity: 0.75; transition: opacity 0.2s; }
.footer-sep { opacity: 0.4; }
footer .cache-info:empty + .footer-sep { display: none; }
.footer-link { color: inherit; text-decoration: none; }
.footer-link:hover { text-decoration: underline; }

/* ── Info icon with tooltip ───────────────────────────────────────────────── */
.info-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 9px;
  font-weight: 700;
  cursor: help;
  position: relative;
  vertical-align: middle;
  margin-left: 4px;
  font-style: normal;
  text-transform: none;
  letter-spacing: 0;
}

.info-icon.html-tip::after { display: none; }

.info-icon .tip-html {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 12px;
  font-weight: 400;
  padding: 9px 13px;
  border-radius: var(--radius-sm);
  white-space: normal;
  width: 230px;
  line-height: 1.55;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  z-index: 100;
  pointer-events: none;
}

.info-icon:hover .tip-html { display: block; }

.info-icon::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 12px;
  font-weight: 400;
  padding: 9px 13px;
  border-radius: var(--radius-sm);
  white-space: normal;
  width: 230px;
  line-height: 1.55;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s;
  z-index: 400;
  text-transform: none;
  letter-spacing: 0;
}

.info-icon:hover::after { opacity: 1; }

/* ── Usage badge ──────────────────────────────────────────────────────────── */
.usage-badge {
  font-size: 12px;
  font-weight: 700;
  padding: 7px 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  white-space: nowrap;
  letter-spacing: 0.2px;
  cursor: pointer;
}
.usage-badge[data-tier="free"]    { color: var(--text); background: var(--surface2); border-color: var(--border); }
.usage-badge[data-tier="premium"] { color: #fff; background: var(--accent); border-color: var(--accent); }
.usage-badge[data-tier="pro"]     { color: #fff; background: var(--cta); border-color: var(--cta); }
.usage-badge[data-tier="empty"]   { color: #fff; background: var(--value-neg); border-color: var(--value-neg); }

/* ── Limit Modal ──────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}

.modal-title {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 12px;
  color: var(--text);
}

.modal-desc {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 20px;
  line-height: 1.5;
}

.pcard-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.pcard {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  position: relative;
}
.pcard:hover { border-color: rgba(255,255,255,0.2); background: rgba(255,255,255,0.04); }

.pcard--highlight {
  border-color: var(--accent);
  background: var(--accent-glow);
}

.pcard-badge {
  position: absolute;
  top: -9px;
  right: 14px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  background: var(--accent);
  color: #fff;
  padding: 2px 8px;
  border-radius: 99px;
}

.pcard-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 4px;
}

.pcard-name { font-weight: 700; font-size: 15px; color: var(--text); }
.pcard-price { font-weight: 800; font-size: 16px; color: var(--accent); }
.pcard-price small { font-size: 11px; font-weight: 400; color: var(--text-muted); }
.pcard-desc { font-size: 13px; color: var(--text-muted); }
.pcard-saving {
  font-size: 12px;
  color: var(--value-pos);
  margin-top: 6px;
  font-weight: 600;
}

.pkg-section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.pkg-slider-wrap {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  margin-bottom: 8px;
}

.pkg-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: var(--border);
  border-radius: 99px;
  outline: none;
  cursor: pointer;
  margin-bottom: 6px;
}
.pkg-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--cta);
  cursor: pointer;
  box-shadow: 0 0 0 4px var(--cta-glow);
  transition: box-shadow var(--transition);
}
.pkg-slider::-webkit-slider-thumb:hover {
  box-shadow: 0 0 0 6px var(--cta-glow);
}

.pkg-slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.pkg-slider-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.pkg-slider-count {
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
}

.pkg-slider-price {
  font-size: 20px;
  font-weight: 800;
  color: var(--cta);
}

.pkg-buy-btn {
  width: 100%;
  background: var(--cta);
  border: none;
  color: #fff;
  padding: 11px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity var(--transition);
}
.pkg-buy-btn:hover { opacity: 0.85; }

.modal-later {
  width: 100%;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  transition: var(--transition);
}
.modal-later:hover { color: var(--text); border-color: var(--text-muted); }

/* ── Tab navigation (in header) ───────────────────────────────────────────── */
.app-nav {
  display: flex;
  align-items: center;
  gap: 0;
  flex: 1;
  justify-content: center;
}

.nav-tab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  border-radius: var(--radius-sm);
  letter-spacing: 0.1px;
}
.nav-tab:hover { color: var(--text); background: var(--surface2); }
.nav-tab { font-weight: 500; line-height: 1; vertical-align: middle; }
.nav-tab.active { color: var(--text); font-weight: 500; box-shadow: inset 0 -2px 0 var(--text-muted); }

/* ── Tab content ──────────────────────────────────────────────────────────── */
.tab-content {
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.tab-content.hidden { display: none !important; }

.tab-heading {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
}

/* ── Recent analyses ──────────────────────────────────────────────────────── */
.recent-empty {
  color: var(--text-muted);
  font-size: 14px;
  text-align: center;
  padding: 50px 0;
}

.recent-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.recent-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  cursor: pointer;
  transition: border-color var(--transition);
}
.recent-card:hover { border-color: var(--accent); }

.recent-card-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.recent-player {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}
.recent-player--right { flex-direction: row-reverse; }

.recent-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent-glow);
  border: 1px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  color: var(--accent);
  flex-shrink: 0;
}

.recent-name { font-size: 14px; font-weight: 600; color: var(--text); }
.recent-prob { font-size: 17px; font-weight: 800; color: var(--accent); }
.recent-vs   { font-size: 11px; font-weight: 700; color: var(--text-muted); letter-spacing: 1px; flex-shrink: 0; }

.recent-card-bot {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.recent-surf-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 99px;
  border: 1px solid var(--accent);
  background: var(--accent-glow);
  color: var(--accent);
}

.recent-time { font-size: 12px; color: var(--text-muted); }

/* ── Pricing tab ──────────────────────────────────────────────────────────── */
.pricing-intro {
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
  margin-top: -8px;
}

.pplan-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 4px;
}

.pplan {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 16px;
  padding: 28px 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 0;
  position: relative;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.pplan:hover { border-color: rgba(255,255,255,0.2); box-shadow: 0 4px 24px rgba(0,0,0,0.18); }
.pplan--popular {
  border-color: var(--cta);
  background: var(--cta-glow);
  box-shadow: 0 4px 32px rgba(0,0,0,0.22);
  transform: translateY(-3px);
}
.pplan--current { border-color: #d9f200; box-shadow: 0 0 0 1px #d9f200; }

.pplan-badge {
  position: absolute;
  top: -11px;
  left: 20px;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 3px 12px;
  border-radius: 99px;
  color: #fff;
}
.pplan-badge--active { background: #d9f200; color: #1a1a1a; }
.pplan-badge--pop    { background: var(--cta); }

.pplan-name {
  font-size: 19px;
  font-weight: 800;
  color: var(--text);
  margin-top: 6px;
  margin-bottom: 6px;
}
.pplan-price {
  font-size: 32px;
  font-weight: 800;
  color: var(--cta);
  line-height: 1.1;
  margin-bottom: 4px;
}
.pplan-price small {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-muted);
}
.pplan-limit {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  background: var(--surface2);
  border-radius: 8px;
  padding: 6px 12px;
  margin-bottom: 16px;
  display: inline-block;
}
.pplan-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0 0 14px;
}
.pplan-features {
  list-style: none;
  padding: 0;
  margin: 0 0 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pplan-features li {
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}
.pplan-features li::before {
  content: '✓';
  font-weight: 800;
  color: #c4b5fd;
  font-size: 12px;
  flex-shrink: 0;
}
.pplan-feature--off {
  opacity: 0.35;
}
.pplan-feature--off::before {
  content: '✕' !important;
  color: var(--text-muted) !important;
}
.ff-tip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 10px;
  color: var(--text-muted);
  cursor: pointer;
  margin-left: 4px;
  vertical-align: middle;
  position: relative;
}
.ff-tip-popup {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface-3, #2a2a3a);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  color: var(--text);
  width: 220px;
  z-index: 100;
  line-height: 1.5;
  text-align: left;
  pointer-events: none;
}

@keyframes shimmer {
  0%   { transform: translateX(-100%) skewX(-15deg); }
  100% { transform: translateX(300%) skewX(-15deg); }
}

.pplan-btn {
  margin-top: auto;
  padding: 11px;
  border-radius: 10px;
  border: 2px solid var(--cta);
  background: var(--cta);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity var(--transition);
  position: relative;
  overflow: hidden;
}
.pplan-btn::after {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 35%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.28), transparent);
  transform: translateX(-100%) skewX(-15deg);
  animation: shimmer 2.2s infinite;
}
.pplan-btn:hover { opacity: 0.85; }
.pplan-btn--active {
  background: #d9f200;
  border-color: #d9f200;
  color: #1a1a1a;
  cursor: default;
  animation: none;
}
.pplan-btn--active::after { display: none; }

.pricing-credits-box {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 16px;
  padding: 28px;
}

.pricing-credits-title {
  font-size: 17px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 18px;
}
.pricing-credits-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: -12px;
  margin-bottom: 18px;
}

@media (max-width: 680px) {
  .pplan-grid { grid-template-columns: 1fr; }
  .recent-name { font-size: 13px; }
}

/* ── Form factor section ─────────────────────────────────────────────────── */
.ff-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ff-heading {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 2px;
}

.ff-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 13px;
}

.ff-player {
  font-weight: 700;
  color: var(--text);
  min-width: 140px;
}

.ff-value {
  font-size: 15px;
  font-weight: 800;
  min-width: 44px;
}
.ff-positive { color: #4ade80; }
.ff-negative { color: #f87171; }

.ff-label {
  color: var(--text-muted);
  font-size: 12px;
}

.ff-na {
  color: var(--text-muted);
  font-style: italic;
  font-size: 12px;
}

.ff-locked {
  cursor: pointer;
  border-radius: 8px;
  padding: 6px 8px;
  margin: -6px -8px;
  transition: background .15s;
}
.ff-locked:hover { background: var(--accent-glow); }

.ff-lock-label {
  color: var(--text-muted);
  font-size: 13px;
}

.ff-unavailable .ff-player { opacity: .6; }

.ff-pro-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  background: var(--bg);
  border-radius: 10px;
  border: 1px solid var(--border);
}

.ff-pro-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.ff-corr { font-size: 13px; font-weight: 700; }

.ff-pro-detail { font-size: 13px; color: var(--text-muted); }
.ff-pro-detail strong { color: var(--text); }

.ff-pro-meta {
  font-size: 11px;
  color: var(--text-muted);
  opacity: .7;
  margin-top: 2px;
}

/* ── Lock popup ──────────────────────────────────────────────────────────── */
.lock-popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.lock-popup {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 32px 28px;
  max-width: 380px;
  width: 90%;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
}

.lock-popup-close {
  position: absolute;
  top: 14px;
  right: 16px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  padding: 4px 8px;
}
.lock-popup-close:hover { color: var(--text); }

.lock-popup-icon { font-size: 32px; }

.lock-popup-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
  margin: 0;
}

.lock-popup-text {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.65;
  margin: 0;
}

.lock-popup-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 11px 24px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity .15s;
  margin-top: 4px;
}
.lock-popup-btn:hover { opacity: .85; }

/* ── About tab ────────────────────────────────────────────────────────────── */
.about-wrap {
  max-width: 780px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 190px 1fr;
  gap: 40px;
  padding: 16px 0 48px;
  align-items: start;
}

.about-left {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  position: sticky;
  top: 24px;
}

.about-avatar {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: var(--accent-glow);
  border: 2px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 800;
  color: var(--accent);
  margin-bottom: 6px;
}

.about-name {
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
  margin: 0;
}

.about-role {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: var(--text-muted);
  margin: 0;
}

.about-location {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0;
}

.about-right {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.about-quote {
  margin: 0;
  padding-left: 18px;
  border-left: 3px solid var(--accent);
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.55;
  font-style: normal;
}

.about-para {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.75;
  margin: 0;
}

.about-mission {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.about-mission-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.4px;
  color: var(--accent);
}

.about-mission p {
  font-size: 14px;
  color: var(--text);
  line-height: 1.65;
  margin: 0;
  font-weight: 500;
}

.about-contact {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.about-contact-btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  padding: 10px 20px;
  border-radius: 10px;
  text-decoration: none;
  transition: opacity .15s;
}
.about-contact-btn:hover { opacity: .85; }

.about-contact-email {
  font-size: 13px;
  color: var(--text-muted);
  font-family: monospace;
}

@media (max-width: 620px) {
  .about-wrap {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  .about-left {
    position: static;
    flex-direction: row;
    text-align: left;
    align-items: center;
    gap: 14px;
  }
  .about-avatar {
    width: 56px;
    height: 56px;
    font-size: 18px;
    flex-shrink: 0;
    margin-bottom: 0;
  }
}

/* ── Auth Modal ───────────────────────────────────────────────────────────── */
.auth-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.auth-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 32px 28px 28px;
  width: 100%;
  max-width: 360px;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 18px;
  box-shadow: 0 24px 60px rgba(0,0,0,.4);
  animation: auth-in .22s ease;
}

@keyframes auth-in {
  from { opacity: 0; transform: translateY(12px) scale(.97); }
  to   { opacity: 1; transform: none; }
}

.auth-modal-close {
  position: absolute;
  top: 14px; right: 16px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background .15s;
}
.auth-modal-close:hover { background: var(--border); color: var(--text); }

.auth-tab-bar {
  display: flex;
  background: var(--bg);
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
}

.auth-tab-btn {
  flex: 1;
  padding: 8px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
}
.auth-tab-btn.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
}

.auth-error {
  font-size: 13px;
  color: #f87171;
  background: rgba(248,113,113,.1);
  border: 1px solid rgba(248,113,113,.25);
  border-radius: 8px;
  padding: 9px 12px;
  text-align: center;
}
.auth-success {
  font-size: 13px;
  color: #4ade80;
  background: rgba(74,222,128,.1);
  border: 1px solid rgba(74,222,128,.25);
  border-radius: 8px;
  padding: 9px 12px;
  text-align: center;
}
.auth-user { display: flex; align-items: center; gap: 8px; position: relative; }
.avatar-menu {
  position: absolute; top: calc(100% + 8px); right: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: 0 4px 20px rgba(0,0,0,.35);
  min-width: 160px; z-index: 300; overflow: hidden;
}
.avatar-menu-btn {
  display: block; width: 100%; padding: 13px 16px;
  font-size: 14px; font-weight: 600; text-align: left;
  color: var(--value-neg); background: none; border: none; cursor: pointer;
}
.avatar-menu-btn:hover { background: rgba(255,255,255,.06); }
.auth-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--cta);
  color: #fff;
  font-size: 13px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.auth-email {
  font-size: 13px; font-weight: 600; color: var(--text);
  max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.auth-logout-btn {
  background: none; border: 1px solid var(--border); border-radius: 7px;
  color: var(--text-muted); font-size: 14px; padding: 4px 9px;
  cursor: pointer; transition: all .15s;
}
.auth-logout-btn:hover { border-color: #f87171; color: #f87171; }
.auth-field input:not([disabled]):focus {
  border-color: var(--accent);
  opacity: 1;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.auth-field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
}
.auth-field input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 16px;
  color: var(--text);
  outline: none;
  transition: border-color .15s;
  width: 100%;
  box-sizing: border-box;
}
.auth-field input:focus { border-color: var(--accent); }

.auth-submit {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  background: var(--accent);
  color: #fff;
  margin-top: 4px;
  transition: opacity .15s;
}
.auth-submit:hover { opacity: .85; }
.auth-submit:disabled { opacity: .45; cursor: not-allowed; }
.auth-submit--signup {
  background: linear-gradient(135deg, #7c6eff, #a78bfa);
}
.auth-legal {
  margin-top: 12px;
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.5;
}
.auth-legal a {
  color: #a78bfa;
  text-decoration: underline;
}

/* ── Utility ──────────────────────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 680px) {
  .players-row { grid-template-columns: 1fr; }
  .vs-badge { margin: 0; align-self: center; }
  .odds-inputs { grid-template-columns: 1fr; }
  .results { grid-template-columns: 1fr; }
  .result-divider { display: none; }
  .result-prob { font-size: 36px; }
}

/* ── Billing Toggle ───────────────────────────────────────────────────────── */
.billing-toggle-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 0 0 28px;
}
.billing-lbl {
  font-size: 14px;
  color: var(--text-muted);
  transition: color .2s;
}
.billing-lbl--active { color: var(--text); font-weight: 600; }
.billing-switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.billing-switch input { opacity: 0; width: 0; height: 0; }
.billing-slider {
  position: absolute; inset: 0;
  background: var(--surface2);
  border-radius: 24px;
  cursor: pointer;
  transition: background .2s;
}
.billing-slider::before {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  left: 3px; top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s;
}
.billing-switch input:checked + .billing-slider { background: var(--accent); }
.billing-switch input:checked + .billing-slider::before { transform: translateX(20px); }
.billing-save-badge {
  display: inline-block;
  background: #d9f200;
  color: #1a1a1a;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
  margin-left: 4px;
  vertical-align: middle;
}
.pplan-renew {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  margin-bottom: 4px;
}
.pkg-best-badge {
  display: inline-block;
  background: #d9f200;
  color: #1a1a1a;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
  margin-left: 6px;
  vertical-align: middle;
}

/* ── Mobile optimizations ─────────────────────────────────────────────────── */
@media (max-width: 640px) {

  /* Header compact (app-nav hidden by 768px rule, bottom nav takes over) */
  .btn-refresh { display: none; }
  .auth-email  { display: none; }
  .usage-badge { font-size: 11px; padding: 5px 9px; }
  .auth-btn    { padding: 7px 10px; font-size: 12px; }
  .lang-btn    { padding: 6px 9px; }

  /* ── Main layout ── */
  main { padding: 14px 12px 60px; gap: 16px; }

  /* ── Analyse: Surface buttons ── */
  .surface-btn {
    flex: 1;
    padding: 11px 6px;
    font-size: 14px;
    min-height: 44px;
  }

  /* ── Analyse: VS badge when players stacked ── */
  .vs-badge { text-align: center; width: 100%; font-size: 12px; }

  /* ── Analyse: Autocomplete inputs ── */
  .autocomplete-wrap input { min-height: 48px; }
  .autocomplete-list li {
    padding: 13px 14px;
    min-height: 44px;
  }

  /* ── Analyse: Odds inputs ── */
  .odds-row input { min-height: 48px; padding: 12px; }

  /* ── Analyse: Calculate button — full width ── */
  .btn-calc {
    width: 100%;
    padding: 16px;
    font-size: 17px;
    align-self: stretch;
    border-radius: 14px;
  }

  /* ── Results ── */
  .result-card { padding: 18px 16px; }
  .result-prob { font-size: 40px; }

  /* ── H2H ── */
  .h2h-match {
    grid-template-columns: 65px 1fr auto;
    gap: 6px;
    font-size: 11px;
    padding: 8px;
  }
  .h2h-match-score { display: none; }
  .h2h-score { font-size: 22px; }

  /* ── Pricing ── */
  .pplan--popular { transform: none; }
  .pplan { padding: 22px 18px 18px; }
  .pplan-btn { min-height: 48px; padding: 14px; font-size: 15px; }
  .pricing-credits-box { padding: 20px 16px; }
  .billing-toggle-wrap { gap: 8px; }

  /* Credit slider — bigger touch target */
  .pkg-slider { height: 6px; }
  .pkg-slider::-webkit-slider-thumb { width: 28px; height: 28px; }
  .pkg-slider::-moz-range-thumb {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--cta);
    border: none;
    cursor: pointer;
  }
  .pkg-buy-btn { min-height: 48px; font-size: 15px; }
  .modal-later { min-height: 44px; }

  /* ── Limit modal ── */
  .modal-box {
    padding: 20px 16px;
    max-height: 90vh;
    overflow-y: auto;
  }

  /* ── Auth modal — bottom sheet on mobile ── */
  .auth-modal-overlay {
    align-items: flex-end;
    padding: 0;
  }
  .auth-modal {
    border-radius: 20px 20px 0 0;
    max-width: 100%;
    margin: 0;
    padding: 28px 20px max(28px, env(safe-area-inset-bottom));
  }
  .auth-submit { min-height: 48px; font-size: 16px; }

  /* ── Lock popup ── */
  .lock-popup {
    width: calc(100% - 32px);
    padding: 24px 20px;
    border-radius: 16px;
  }
  .lock-popup-btn { min-height: 44px; }
  .lock-popup-close { min-width: 44px; min-height: 44px; display: flex; align-items: center; justify-content: center; }

  /* ── Recent ── */
  .recent-card { padding: 14px; }

  /* ── About ── */
  .about-wrap { padding: 12px 0 32px; }

  /* ── Tab heading ── */
  .tab-heading { font-size: 20px; }

  /* ── FAQ ── */
  .faq-q { min-height: 44px; }
}

/* Touch: remove hover effects that break on mobile */
@media (hover: none) {
  .pkg-slider::-webkit-slider-thumb:hover {
    box-shadow: 0 0 0 4px var(--cta-glow);
  }
  /* Info icon tooltip: show on focus for touch */
  .info-icon:focus::after { opacity: 1; }
}

/* ── FAQ ──────────────────────────────────────────────────────────────────── */
.faq-header {
  padding: 40px 0 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}
.faq-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 6px;
}
.faq-subtitle {
  font-size: 14px;
  color: var(--text-muted);
}

.faq-section {
  margin-top: 0;
}

.faq-item {
  border-bottom: 1px solid var(--border);
}

.faq-q {
  width: 100%;
  background: transparent;
  border: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 0;
  cursor: pointer;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  gap: 16px;
  transition: color var(--transition);
}
.faq-q:hover { color: var(--accent); }

.faq-arrow {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  transition: transform 0.25s ease;
  color: var(--text-muted);
}

.faq-item.open .faq-arrow { transform: rotate(180deg); color: var(--accent); }
.faq-item.open .faq-q { color: var(--accent); }

.faq-a {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease;
}
.faq-item.open .faq-a { max-height: 300px; }

.faq-a p {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.7;
  padding-bottom: 18px;
  margin: 0;
}

.optional-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
}

/* ── Logo image ───────────────────────────────────────────────────────────── */
.logo-img {
  height: 28px;
  width: 28px;
  object-fit: contain;
}

/* ── Bottom Navigation (mobile only) ─────────────────────────────────────── */
.bottom-nav { display: none; }

@media (max-width: 768px) {
  /* Hide top nav, simplify header to single row */
  .app-nav         { display: none; }
  .auth-btn--login  { display: none; }
  .auth-logout-btn  { display: none; }
  .header-inner {
    flex-wrap: nowrap;
    height: 54px;
    padding: 0 16px;
    gap: 8px;
  }

  /* Extra bottom padding so content clears the bottom nav */
  main {
    padding-bottom: calc(60px + env(safe-area-inset-bottom) + 16px) !important;
  }

  /* Show bottom nav */
  .bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--surface);
    border-top: 1px solid var(--border);
    z-index: 200;
    padding-bottom: env(safe-area-inset-bottom);
  }

  .bottom-nav-item {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    padding: 0 2px;
    cursor: pointer;
    transition: color 0.15s;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    white-space: nowrap;
    letter-spacing: 0.1px;
  }

  .bottom-nav-item.active {
    color: var(--accent);
    font-weight: 700;
  }

  /* Auth button: red when showing "Abmelden" */
  .bottom-nav-item.bottom-nav-logout {
    color: var(--value-neg);
  }
}

/* ── How to Bet ────────────────────────────────────────────────────────────── */
.how-to-bet {
  padding: 56px max(20px, calc(50vw - 530px)) 48px;
  border-top: 1px solid var(--border);
  width: 100vw;
  position: relative;
  left: 50%;
  transform: translateX(-50%);
  box-sizing: border-box;
}

.htb-heading {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 24px;
}

.htb-steps {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
}

.htb-step {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.htb-num {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 1px;
}

.htb-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.35;
}

.htb-text {
  font-size: 13.5px;
  color: var(--text-muted);
  line-height: 1.65;
  margin-top: 2px;
}

.htb-text u {
  text-decoration-color: rgba(255,255,255,0.5);
  text-underline-offset: 2px;
}

@media (max-width: 700px) {
  .how-to-bet { padding: 36px 16px 28px; }
  .htb-steps {
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    gap: 14px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
  }
  .htb-steps::-webkit-scrollbar { display: none; }
  .htb-step {
    flex-direction: column;
    flex: 0 0 220px;
    padding: 16px;
    gap: 8px;
  }
  .htb-body { display: flex; flex-direction: column; gap: 4px; }
}
