:root {
  --bg: #e8ebf2;
  --panel: #ffffff;
  --text: #1a1f2e;
  --text-2: #4b5568;
  --muted: #6b7280;
  --line: rgba(15, 23, 42, 0.1);
  --gold: #b8942e;
  --gold-2: #96761f;
  --accent: #0d9668;
  --red: #dc2626;
  --silver: #7a8a9e;
  --bronze: #b87333;
  --nav: 68px;
  --radius: 14px;
  --font: "Outfit", system-ui, sans-serif;
  --display: "Bebas Neue", "Outfit", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

button, select { font-family: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }

.app {
  min-height: 100dvh;
  padding-bottom: calc(var(--nav) + var(--safe-b) + 12px);
}

.top {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: calc(12px + var(--safe-t)) 16px 10px;
  background: #1a1f2e;
  color: #fff;
}

.top-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.brand {
  font-family: var(--display);
  font-size: 28px;
  letter-spacing: 0.04em;
  line-height: 1;
}
.live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: #86efac;
}
.live.off { color: #fca5a5; }
.pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 0 currentColor;
  animation: pulse 1.6s ease-out infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(134, 239, 172, 0.5); }
  100% { box-shadow: 0 0 0 8px rgba(134, 239, 172, 0); }
}
.top-meta { text-align: right; }
.top-meta .md {
  font-family: var(--display);
  font-size: 26px;
  color: var(--gold);
  line-height: 1;
}
.top-meta .bonus { font-size: 12px; color: #d6dbe6; margin-top: 4px; }
.updated { margin: 8px 0 0; font-size: 12px; color: #9aa3b5; }

.content { padding: 14px 14px 24px; }

.page-head { margin-bottom: 12px; }
.page-head h2 { margin: 0; font-size: 20px; }
.page-head p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
}
.card h3 {
  margin: 0 0 10px;
  font-size: 13px;
  letter-spacing: 0.08em;
  color: var(--gold-2);
}

.banner {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
  background: #fff8e8;
  border: 1px solid rgba(184, 148, 46, 0.28);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 12px;
}
.banner.doa { background: #fff1f2; border-color: rgba(225, 29, 72, 0.25); }
.banner.captain { background: #fff7ed; }
.banner.derby { background: #eef2ff; border-color: rgba(79, 70, 229, 0.22); }
.banner h3 { margin: 0 0 4px; font-size: 15px; }
.banner p { margin: 0; font-size: 12px; color: var(--text-2); }

.md-strip {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 2px 0 12px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.md-strip::-webkit-scrollbar { display: none; }
.md-chip {
  flex: 0 0 auto;
  min-width: 46px;
  height: 38px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid var(--line);
  font-weight: 700;
  font-size: 13px;
}
.md-chip.active { background: #1a1f2e; color: #fff; border-color: #1a1f2e; }
.md-chip.done { color: var(--accent); }
.md-chip.future { opacity: 0.55; }

.filters { display: flex; gap: 8px; margin-bottom: 12px; }
.filters select {
  flex: 1;
  height: 42px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 0 10px;
  font-size: 14px;
}

.sales {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}
.sales-box {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
}
.sales-box .k { font-size: 11px; letter-spacing: 0.1em; color: var(--muted); }
.sales-box .v { font-family: var(--mono); font-size: 26px; font-weight: 700; margin-top: 2px; }
.sales-box.fibre .v { color: var(--gold-2); }

.match {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.match:last-child { border-bottom: 0; }
.match .side { font-size: 13px; font-weight: 600; }
.match .side.right { text-align: right; }
.match .score {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}
.match.win-home .side:first-child { color: var(--accent); }
.match.win-away .side.right { color: var(--accent); }
.help { color: var(--muted); font-size: 12px; }

.team-pill { display: inline-flex; align-items: center; gap: 6px; }
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.person {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.person:last-child { border-bottom: 0; }
.person b { display: block; font-size: 14px; }
.person .meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.person .nums { text-align: right; }
.person .fp { font-family: var(--mono); font-weight: 700; font-size: 16px; }
.person .acq { font-size: 12px; color: var(--muted); }
.badges { display: inline-flex; gap: 4px; margin-left: 4px; }
.badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  background: #eef1f6;
  color: var(--text-2);
  vertical-align: middle;
}
.badge.gold { background: #fff3d0; color: var(--gold-2); }
.badge.accent { background: #dcfce7; color: #166534; }

.stand-row, .mvp-row {
  display: grid;
  gap: 8px;
  align-items: center;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}
.stand-row { grid-template-columns: 28px 1fr auto auto; }
.mvp-row { grid-template-columns: 1fr auto; }
.stand-row:last-child, .mvp-row:last-child { border-bottom: 0; }
.stand-row.leader { background: rgba(184,148,46,0.08); margin: 0 -14px; padding-left: 14px; padding-right: 14px; }
.pos {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 800;
  background: #eef1f6;
}
.pos.gold { background: #f5d76e; color: #5c4308; }
.pos.silver { background: #d5dbe6; color: #334155; }
.pos.bronze { background: #e8b48a; color: #5a2e0c; }
.pt { font-family: var(--mono); font-weight: 700; font-size: 16px; }
.trend { font-size: 12px; }
.trend.up { color: var(--accent); }
.trend.down { color: var(--red); }
.trend.same { color: var(--muted); }
.form { display: flex; gap: 3px; margin-top: 4px; }
.form span {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  font-size: 9px;
  font-weight: 800;
  display: grid;
  place-items: center;
  color: #fff;
}
.form .W { background: var(--accent); }
.form .D { background: var(--silver); }
.form .L { background: var(--red); }
.stats { font-size: 11px; color: var(--muted); margin-top: 3px; }
.mvp-count { font-family: var(--mono); font-size: 18px; font-weight: 700; color: var(--gold-2); }

.tabs {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(var(--nav) + var(--safe-b));
  padding-bottom: var(--safe-b);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  background: #fff;
  border-top: 1px solid var(--line);
  z-index: 30;
}
.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}
.tab svg { width: 20px; height: 20px; }
.tab.active { color: #1a1f2e; }

[hidden] { display: none !important; }

.pair {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: #1a1f2e;
  color: #fff;
  display: grid;
  place-items: center;
  padding: 24px;
}
.pair[hidden] { display: none !important; }
.pair-card { max-width: 440px; text-align: center; }
.pair-card h1 { font-family: var(--display); font-size: 48px; margin: 8px 0 12px; }
.pair-card p { color: #c5ccda; }
.pair-live { color: #86efac; font-weight: 700; letter-spacing: 0.12em; }
.pair-urls {
  margin: 16px 0;
  display: grid;
  gap: 8px;
}
.pair-url {
  background: #11141c;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  padding: 12px;
  font-family: var(--mono);
  font-size: 15px;
  word-break: break-all;
}
.pair-qr { width: 220px; height: 220px; margin: 8px auto 0; background: #fff; border-radius: 12px; padding: 8px; }
.pair-help { font-size: 13px; }
.btn {
  margin-top: 16px;
  background: var(--gold);
  color: #1a1f2e;
  font-weight: 800;
  border-radius: 12px;
  padding: 12px 18px;
  font-size: 15px;
}

.empty, .error {
  background: #fff;
  border-radius: var(--radius);
  padding: 24px 16px;
  text-align: center;
  color: var(--text-2);
}
.error { color: var(--red); }

.bonus-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.bonus-row:last-child { border-bottom: 0; }

@media (min-width: 720px) {
  .content { max-width: 720px; margin: 0 auto; }
}
