/* Sporda — design tokens
 * See DESIGN_SYSTEM.md for source notes and inspirational references.
 * Every value can be overridden per-screen by setting CSS vars on a wrapper. */

@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=JetBrains+Mono:wght@500;600&display=swap");

:root {
  /* Palette — dark default */
  --bg-base: #0A0F0C;
  --bg-surface: #121915;
  --bg-elevated: #1A2320;
  --bg-inset: #080C0A;
  --border-hairline: #1F2A24;
  --border-strong: #2B3832;

  --accent: #C8FF3E;
  --accent-press: #B5E835;
  --accent-ink: #0A1400;

  --text-primary: #F5F7F4;
  --text-secondary: #9AA59F;
  --text-muted: #5E6963;

  --live: #FF3B5C;
  --positive: #4ADE80;
  --draw: #9AA59F;
  --negative: #FF7185;
  --warning: #FFB547;

  /* Type */
  --font-ui: "Manrope", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;

  /* Radii */
  --r-input: 12px;
  --r-button: 14px;
  --r-pill: 999px;
  --r-card: 18px;
  --r-card-lg: 24px;
  --r-sheet: 28px;
  --r-circle: 50%;

  /* Motion */
  --ease: cubic-bezier(0.2, 0.0, 0.0, 1.0);
  --dur-fast: 120ms;
  --dur-base: 220ms;
  --dur-slow: 380ms;

  /* Shadows */
  --shadow-card: 0 1px 0 rgba(255,255,255,0.04) inset, 0 8px 24px rgba(0,0,0,0.35);
  --shadow-fab: 0 8px 24px rgba(200,255,62,0.30);
  --shadow-sheet: 0 -8px 32px rgba(0,0,0,0.5);

  /* Hero gradient — used by match hero cards, big standings card, special
   * banners, share-image frames, countdown widget. Defaults to dark; light
   * mode swaps in a pale lime-tinted off-white so the SAME component reads
   * as branded on either bg. AMOLED inherits the dark default. */
  --hero-grad: linear-gradient(135deg, #182320 0%, #243A30 100%);
  --hero-grad-rich: linear-gradient(135deg, #182320 0%, #1F2D26 60%, #243A30 100%);
}

/* AMOLED — pure-black base, identical accent. Activate with html[data-theme="amoled"]. */
html[data-theme="amoled"] {
  --bg-base: #000000;
  --bg-surface: #0A0A0A;
  --bg-elevated: #141414;
  --bg-inset: #000000;
  --border-hairline: #161616;
  --border-strong: #242424;
}

/* Light — first pass. Activate with html[data-theme="light"]. */
html[data-theme="light"] {
  --bg-base: #F6F8F5;
  --bg-surface: #FFFFFF;
  --bg-elevated: #FFFFFF;
  --bg-inset: #EDF1EC;
  --border-hairline: #E7EBE6;
  --border-strong: #C5CDC4;
  --accent: #5BC410;        /* deeper than the dark-mode lime so it reads on white */
  --accent-press: #4FAD0D;
  --accent-ink: #FFFFFF;
  --text-primary: #0E1410;
  --text-secondary: #5E6963;
  --text-muted: #9AA59F;
  --shadow-card: 0 1px 0 rgba(0,0,0,0.02) inset, 0 4px 12px rgba(14,20,16,0.05);
  /* Pale lime-tinted hero gradient so hero cards still feel branded but
   * stay readable on a white page. */
  --hero-grad: linear-gradient(135deg, #F4F8F0 0%, #E5EFE0 100%);
  --hero-grad-rich: linear-gradient(135deg, #F4F8F0 0%, #ECF2E5 60%, #E0EBD8 100%);
}

/* Reset just what we need */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; font-family: var(--font-ui); -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
[role="button"] { cursor: pointer; }

/* Phone frame — used by every artboard */
.phone {
  width: 390px;
  height: 844px;
  background: var(--bg-base);
  color: var(--text-primary);
  border-radius: 48px;
  overflow: hidden;
  position: relative;
  font-family: var(--font-ui);
  display: flex;
  flex-direction: column;
  box-shadow:
    0 0 0 12px #0E0E0E,
    0 0 0 13px #1F1F1F,
    0 30px 60px rgba(0,0,0,0.5);
}

.phone .viewport {
  flex: 1;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
}

/* Status bar */
.sbar {
  height: 54px;
  padding: 0 28px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding-bottom: 8px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  flex-shrink: 0;
}
.sbar .glyphs { display: flex; gap: 6px; align-items: center; }
.sbar .glyphs svg { width: 16px; height: 11px; }

/* Notch */
.notch {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  width: 110px;
  height: 30px;
  background: #000;
  border-radius: 16px;
  z-index: 10;
}

/* Scroll body */
.body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: 100px;
  scrollbar-width: none;
}
.body::-webkit-scrollbar { display: none; }

/* Bottom nav */
.bnav {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 88px;
  background: linear-gradient(180deg, rgba(10,15,12,0) 0%, var(--bg-base) 40%);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 16px 24px 16px;
  z-index: 5;
}
.bnav .slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  flex: 1;
  position: relative;
  padding-top: 12px;
}
.bnav .slot.active { color: var(--text-primary); }
.bnav .slot.active::after {
  content: "";
  position: absolute;
  top: 6px;
  width: 4px; height: 4px; border-radius: 50%;
  background: var(--accent);
}
.bnav .fab {
  width: 56px;
  height: 56px;
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: -24px;
  box-shadow: var(--shadow-fab);
  flex: none;
}

/* Generic utility */
.card {
  background: var(--bg-surface);
  border-radius: var(--r-card);
  padding: 16px;
}
.row { display: flex; align-items: center; }
.col { display: flex; flex-direction: column; }
.gap-4 { gap: 4px; } .gap-6 { gap: 6px; } .gap-8 { gap: 8px; }
.gap-12 { gap: 12px; } .gap-16 { gap: 16px; } .gap-24 { gap: 24px; }
.flex-1 { flex: 1; }
.center { display: flex; align-items: center; justify-content: center; }

.tag-micro {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 14px;
  border-radius: var(--r-pill);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid transparent;
  transition: all var(--dur-fast) var(--ease);
}
.pill.outline {
  border-color: var(--border-strong);
  color: var(--text-secondary);
}
.pill.active {
  background: var(--accent);
  color: var(--accent-ink);
}
.pill.live {
  background: rgba(255, 59, 92, 0.12);
  color: var(--live);
}
.pill.live .dot { width: 6px; height: 6px; background: var(--live); border-radius: 50%; animation: pulse 1.2s ease-in-out infinite; }

@keyframes pulse { 0%,100% { opacity: 0.45; } 50% { opacity: 1; } }

/* Crest monograms — placeholder team identity */
.crest {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.02em;
  color: white;
  text-shadow: 0 1px 0 rgba(0,0,0,0.2);
  flex: none;
  position: relative;
  overflow: hidden;
}
.crest.lg { width: 56px; height: 56px; font-size: 18px; }
.crest.xl { width: 72px; height: 72px; font-size: 22px; }
.crest::after {
  /* Subtle 2-stop sheen for premium feel */
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.18) 0%, transparent 50%);
}

/* Form dots */
.form-dots { display: inline-flex; gap: 4px; }
.fdot { width: 8px; height: 8px; border-radius: 50%; }
.fdot.W { background: var(--positive); }
.fdot.D { background: var(--draw); opacity: 0.5; }
.fdot.L { background: var(--negative); }

/* Score numerals */
.score {
  font-family: var(--font-ui);
  font-weight: 800;
  font-size: 40px;
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.score.sm { font-size: 22px; }
.score.lg { font-size: 56px; }

.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* Section heads */
h1.screen-title {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0;
}
h2.section-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.005em;
  margin: 0 0 12px;
}

/* Sub-tab underline strip */
.subtabs {
  display: flex;
  gap: 24px;
  border-bottom: 1px solid var(--border-hairline);
  padding: 0 20px;
  overflow-x: auto;
  scrollbar-width: none;
}
.subtabs::-webkit-scrollbar { display: none; }
.subtab {
  position: relative;
  padding: 14px 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
  flex: none;
}
.subtab.active {
  color: var(--text-primary);
  font-weight: 700;
}
.subtab.active::after {
  content: "";
  position: absolute;
  bottom: -1px; left: 0; right: 0;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
}

/* Stat bar */
.statrow {
  display: grid;
  grid-template-columns: 32px 1fr 32px;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
}
.statrow .lbl { text-align: center; font-size: 11px; color: var(--text-secondary); font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; grid-column: 1 / -1; margin-bottom: 4px; }
.statrow .v { font-size: 13px; font-weight: 700; }
.statrow .v.l { text-align: right; }
.statrow .bar { height: 4px; background: var(--border-hairline); border-radius: 2px; position: relative; overflow: hidden; }
.statrow .bar .fill-l, .statrow .bar .fill-r { position: absolute; top: 0; bottom: 0; }
.statrow .bar .fill-l { left: 0; background: var(--accent); border-radius: 2px 0 0 2px; }
.statrow .bar .fill-r { right: 0; background: var(--text-secondary); opacity: 0.5; border-radius: 0 2px 2px 0; }

/* Lineup pitch */
.pitch {
  background:
    repeating-linear-gradient(180deg, transparent 0 17%, rgba(255,255,255,0.025) 17% 18%, transparent 18% 33%, rgba(255,255,255,0.04) 33% 34%),
    linear-gradient(180deg, #143524 0%, #0F2A1C 100%);
  border-radius: 14px;
  position: relative;
  overflow: hidden;
}
.pitch::before {
  /* center circle + halfway line */
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  width: 90px; height: 90px;
  border: 1.5px solid rgba(255,255,255,0.10);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}
.pitch::after {
  content: "";
  position: absolute;
  top: 50%; left: 12px; right: 12px;
  height: 1.5px;
  background: rgba(255,255,255,0.10);
}
.player {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.player .num {
  width: 28px; height: 28px;
  background: rgba(255,255,255,0.95);
  color: #0E1410;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}
.player .nm {
  font-size: 9px; font-weight: 600;
  background: rgba(0,0,0,0.55);
  padding: 1px 5px;
  border-radius: 4px;
  white-space: nowrap;
}

/* List row */
.lrow {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-hairline);
  font-size: 15px;
}
.lrow:last-child { border-bottom: 0; }
.lrow .chev { color: var(--text-muted); margin-left: auto; }
.lrow .val { color: var(--text-secondary); margin-left: auto; font-size: 14px; }

/* Toggle */
.toggle {
  width: 40px; height: 24px;
  background: var(--bg-inset);
  border-radius: 999px;
  position: relative;
  flex: none;
  transition: background var(--dur-fast) var(--ease);
}
.toggle::after {
  content: "";
  position: absolute;
  top: 3px; left: 3px;
  width: 18px; height: 18px;
  background: var(--text-primary);
  border-radius: 50%;
  transition: transform var(--dur-fast) var(--ease);
}
.toggle.on { background: var(--accent); }
.toggle.on::after { transform: translateX(16px); }

/* Searchbar */
.searchbar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-inset);
  height: 44px;
  padding: 0 16px;
  border-radius: var(--r-pill);
  color: var(--text-muted);
  font-size: 14px;
}
.searchbar input {
  border: 0; background: none; outline: none; color: var(--text-primary);
  font: inherit; flex: 1; padding: 0;
}
.searchbar input::placeholder { color: var(--text-muted); }
