/* Crowdcalls — design tokens + base styles. Dark-mode first. */
@import url("https://rsms.me/inter/inter.css");

:root {
  --bg: #0A0A0B;
  --bg-raised: #111114;
  --bg-card: #15161A;
  --bg-input: #1C1D22;
  --line: #23252B;
  --line-strong: #2F313A;
  --ink: #F4F5F7;
  --ink-mute: #9AA0AB;
  --ink-dim: #6B7280;
  --ink-faint: #3F434C;
  --accent: #7CFFB2;
  --accent-soft: #1F3329;
  --draft: #FFD66B;
  --draft-soft: #322A12;
  --locked: #8AA1FF;
  --locked-soft: #1B2240;
  --live: #FF6B6B;
  --live-soft: #2F1A1A;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Inter var", "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  font-feature-settings: "cv11", "ss01", "ss03";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

input { font-size: 16px; }
::selection { background: var(--accent); color: var(--bg); }

a { color: inherit; text-decoration: none; }

.app {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px 16px 48px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
@media (min-width: 640px) {
  .app { padding-left: 24px; padding-right: 24px; }
}

header.site {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  margin: -16px -16px 0;
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(10, 10, 11, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(35, 37, 43, 0.45);
}
@media (min-width: 640px) {
  header.site {
    padding-left: 24px;
    padding-right: 24px;
    margin-left: -24px;
    margin-right: -24px;
  }
}

.wordmark {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.025em;
  color: var(--ink);
}
.wordmark .accent { color: var(--accent); }
.wordmark .tld { color: var(--ink-dim); }

nav.top {
  display: flex;
  gap: 18px;
  font-size: 14px;
  color: var(--ink-mute);
}
nav.top a { transition: color 0.15s ease; }
nav.top a:hover { color: var(--ink); }

main { flex: 1; padding-top: 18px; }

footer.site {
  margin-top: 64px;
  padding-top: 20px;
  border-top: 1px solid rgba(35, 37, 43, 0.6);
  font-size: 12px;
  color: var(--ink-dim);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
}
footer.site .faint { color: var(--ink-faint); }

/* Headings + section header */
h1.hero {
  font-size: 28px;
  line-height: 1.15;
  letter-spacing: -0.03em;
  font-weight: 600;
  margin: 0;
}
h1.hero .mute { color: var(--ink-mute); }
@media (min-width: 640px) {
  h1.hero { font-size: 32px; }
}

.section { margin-bottom: 28px; }

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 0 4px;
  margin-bottom: 12px;
}
.eyebrow {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-dim);
}
.title {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.015em;
  margin: 0;
  color: var(--ink);
}
.meta {
  font-size: 12px;
  color: var(--ink-mute);
  margin-top: 2px;
}

.countdown {
  display: inline-flex;
  align-items: baseline;
  gap: 12px;
}
.countdown .label {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-dim);
}
.countdown .value {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}
.countdown .value .dim { color: var(--ink-dim); }

/* Card */
.card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}
.card-pad { padding: 20px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  padding: 0 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  background: var(--bg-input);
  color: var(--ink);
  border-color: var(--line);
}
.btn:hover { border-color: var(--line-strong); }
.btn-primary {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}
.btn-primary:hover { background: rgba(124, 255, 178, 0.9); }
.btn-disabled {
  background: var(--bg-input);
  color: var(--ink-dim);
  cursor: not-allowed;
  border-color: var(--line);
}
.btn-locked {
  background: var(--locked-soft);
  color: var(--locked);
  border-color: rgba(138, 161, 255, 0.3);
}
.btn-ghost {
  background: var(--bg);
  color: var(--ink-mute);
  border-color: var(--line);
  height: 36px;
  font-weight: 500;
  font-size: 13px;
}
.btn-ghost:hover { color: var(--ink); }

/* Fixture row */
.fixture {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  padding: 14px 12px;
  border-bottom: 1px solid rgba(35, 37, 43, 0.6);
}
.fixture:last-child { border-bottom: none; }
@media (min-width: 640px) {
  .fixture { padding-left: 24px; padding-right: 24px; gap: 12px; }
}
.fixture .side {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.fixture .side.home { justify-content: flex-end; }
.fixture .team {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex: 1 1 auto;
}
.fixture .side.home .team { text-align: right; }
.fixture .side.away .team { text-align: left; }
@media (min-width: 640px) {
  .fixture .team { font-size: 15px; }
  .fixture .side { gap: 12px; }
}
.fixture .kick {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 9px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-dim);
  line-height: 1.25;
  min-width: 52px;
  flex-shrink: 0;
}
.fixture .kick .time { color: var(--ink-mute); }

.stepper-group {
  position: relative;
  display: inline-block;
  flex-shrink: 0;
}
.stepper {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 8px;
  font-size: 20px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  user-select: none;
  background: transparent;
  border: 1px dashed var(--line);
  color: var(--ink-dim);
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease, transform 0.05s ease;
  font-family: inherit;
  padding: 0;
}
.stepper:hover { border-color: var(--line-strong); color: var(--ink-mute); }
.stepper:active { transform: scale(0.97); }
.stepper.filled {
  background: var(--bg-input);
  border: 1px solid var(--line);
  color: var(--ink);
  border-style: solid;
}
.stepper.draft {
  background: var(--draft-soft);
  border: 1px solid rgba(255, 214, 107, 0.4);
  color: var(--draft);
  border-style: solid;
}
.stepper.submitted {
  background: var(--locked-soft);
  border: 1px solid rgba(138, 161, 255, 0.4);
  color: var(--locked);
  border-style: solid;
}

/* +/- buttons that reveal on tap */
.stepper-btn {
  position: absolute;
  left: 50%;
  transform: translateX(-50%) scale(0.6);
  width: 36px;
  height: 24px;
  border-radius: 6px;
  background: var(--bg-input);
  border: 1px solid var(--line-strong);
  color: var(--ink);
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease, transform 0.12s ease;
  padding: 0;
  line-height: 1;
  z-index: 5;
}
.stepper-btn.up { top: -28px; }
.stepper-btn.down { bottom: -28px; }
.stepper-btn:active { background: var(--bg-raised); }
.stepper-group.active .stepper-btn {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) scale(1);
}
.stepper-btn:disabled { opacity: 0.35; pointer-events: none; cursor: not-allowed; }
.stepper-group.active .stepper-btn:disabled { opacity: 0.35; }

/* Extra bottom room inside the fixture card so the last row's
   − button has somewhere to live, clear of the sticky submit bar. */
#fixture-card { padding-bottom: 32px; }

/* Sticky submit bar */
.submit-bar {
  position: sticky;
  bottom: 12px;
  z-index: 10;
  margin-top: 12px;
  padding: 0 4px;
}
.submit-bar .inner {
  background: rgba(21, 22, 26, 0.92);
  backdrop-filter: blur(12px);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 12px 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.submit-bar .progress {
  font-size: 12px;
  color: var(--ink-mute);
}
.submit-bar .progress .filled { color: var(--ink); font-weight: 500; }
.submit-bar .progress .total { color: var(--ink-dim); }
.submit-bar .hint {
  margin: 8px 4px 0;
  font-size: 11px;
  color: var(--ink-dim);
}
.submit-bar .submitted-meta { color: var(--locked); }
.submit-bar .submitted-meta .when { color: var(--ink-dim); margin-left: 6px; }

/* Leaderboard */
.lb-head, .lb-row {
  display: grid;
  grid-template-columns: 40px 1fr 56px 56px 56px;
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
}
.lb-head {
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-dim);
  border-bottom: 1px solid var(--line);
}
.lb-row { border-top: 1px solid rgba(35, 37, 43, 0.6); font-size: 14px; }
.lb-row:first-of-type { border-top: none; }
.lb-row .rank { font-variant-numeric: tabular-nums; color: var(--ink-mute); }
.lb-row.top .rank { color: var(--ink); font-weight: 600; }
.lb-row .name { color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-row .pts { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.lb-row .num { text-align: right; color: var(--ink-mute); font-variant-numeric: tabular-nums; }
.lb-row.you { background: rgba(31, 51, 41, 0.4); }
.lb-row.you .name { color: var(--accent); font-weight: 600; }
.lb-row.you .name .badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(124, 255, 178, 0.15);
  color: var(--accent);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 500;
}
.lb-gap {
  text-align: center;
  color: var(--ink-faint);
  font-size: 10px;
  padding: 4px 16px;
}
.lb-footer {
  border-top: 1px solid var(--line);
  padding: 12px 16px;
  text-align: center;
  font-size: 11px;
  color: var(--ink-dim);
}

/* Status chips for post-lock */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 500;
}
.chip.live { background: var(--live-soft); color: var(--live); }
.chip.live .dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--live);
  animation: pulse 1.4s ease-in-out infinite;
}
.chip.final { background: var(--bg-input); color: var(--ink-mute); }
.chip.soon { background: var(--bg-input); color: var(--ink-dim); }
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.score-line {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.score-line .score {
  font-family: ui-monospace, monospace;
  font-size: 22px;
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.score-line .score .colon { color: var(--ink-dim); }
.score-line .score.empty { font-size: 16px; color: var(--ink-dim); }

/* League card */
.league-card p { color: var(--ink-mute); font-size: 14px; line-height: 1.5; margin: 0; }
.league-card .actions { margin-top: 16px; display: flex; flex-wrap: wrap; gap: 8px; }
.league-card .actions .btn { height: 36px; font-size: 13px; padding: 0 12px; }
.league-card .note { margin-top: 12px; font-size: 11px; color: var(--ink-dim); }

/* Share card */
.share-card {
  position: relative;
  overflow: hidden;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 28px;
}
.share-card::before {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(124, 255, 178, 0.04), transparent 60%);
  pointer-events: none;
}
.share-card .row > * { position: relative; }
.share-card .row + .row { margin-top: 24px; }
.share-card .big {
  font-size: 56px;
  line-height: 1;
  letter-spacing: -0.03em;
  font-weight: 600;
  color: var(--ink);
  margin: 4px 0 0;
}
.share-card .grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding-top: 20px;
}
.share-card .stat-num {
  font-size: 24px;
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  margin-top: 4px;
}
.share-card .stat-num .of { color: var(--ink-dim); font-size: 13px; font-weight: 400; margin-left: 4px; }
.share-card .stat-label {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-dim);
}
.share-card .tag {
  font-size: 14px;
  color: var(--ink-mute);
}

.share-actions { display: flex; gap: 8px; margin-top: 24px; }
.share-actions .btn { flex: 1; }
.share-actions .btn.copy { flex: 0; }

/* FAQ */
.faq-list { border: 1px solid var(--line); border-radius: 14px; background: var(--bg-card); overflow: hidden; }
.faq-item { padding: 20px; border-bottom: 1px solid rgba(35, 37, 43, 0.6); }
.faq-item:last-child { border-bottom: none; }
@media (min-width: 640px) { .faq-item { padding: 24px; } }
.faq-q { font-size: 15px; font-weight: 600; color: var(--ink); margin: 0 0 8px; }
.faq-a { color: var(--ink-mute); font-size: 14px; line-height: 1.55; }
.faq-a p { margin: 0 0 8px; }
.faq-a p:last-child { margin-bottom: 0; }
.faq-a strong { color: var(--ink); font-weight: 600; }
.faq-a ol { margin: 4px 0 0; padding-left: 18px; }

/* Small util */
.link-accent { color: var(--accent); font-weight: 500; font-size: 12px; }
.link-accent:hover { opacity: 0.85; }
.no-grow { flex-shrink: 0; }

/* ============================================================
   Identity chip in header
   ============================================================ */
.id-chip {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  border: 1px solid rgba(124, 255, 178, 0.3);
  color: var(--accent);
  transition: background 0.15s ease;
}
.id-chip:hover { background: rgba(124, 255, 178, 0.18); }
.id-chip.ghost {
  background: var(--bg-input);
  border-color: var(--line);
  color: var(--ink);
}
.id-chip.ghost:hover { border-color: var(--line-strong); }

/* ============================================================
   Empty state / inline messages
   ============================================================ */
.empty-state {
  padding: 32px 20px;
  text-align: center;
  color: var(--ink-mute);
  font-size: 14px;
}
.empty-state.warn { color: var(--draft); }

/* ============================================================
   Toast
   ============================================================ */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-raised);
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  padding: 12px 18px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 100;
  max-width: calc(100vw - 32px);
  text-align: center;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ============================================================
   Modals
   ============================================================ */
.modal-root:empty { display: none; }
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 11, 0.72);
  backdrop-filter: blur(8px);
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
}
@media (min-width: 640px) {
  .modal-overlay { align-items: center; }
}
.modal-sheet {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 18px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
  animation: sheetIn 0.18s ease;
}
@keyframes sheetIn {
  from { transform: translateY(12px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}
.modal-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.modal-title {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.015em;
  margin: 0 0 4px;
  color: var(--ink);
}
.modal-text {
  margin: 0;
  font-size: 13px;
  color: var(--ink-mute);
  line-height: 1.5;
}
.modal-text.faint { color: var(--ink-dim); font-size: 12px; }
.modal-text.warn  { color: var(--draft); }
.modal-text.good  { color: var(--accent); }
.modal-input {
  width: 100%;
  background: var(--bg-input);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  font-family: inherit;
  font-size: 15px;
  outline: none;
  transition: border-color 0.15s ease;
}
.modal-input:focus { border-color: var(--accent); }
.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}
.modal-actions .btn { flex: 1; }
.code-pill {
  display: inline-block;
  align-self: flex-start;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.18em;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 12px 18px;
  border-radius: 10px;
  border: 1px solid rgba(124, 255, 178, 0.3);
}
.link-pill {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12px;
  color: var(--ink-mute);
  background: var(--bg-input);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  word-break: break-all;
}

/* ============================================================
   League list
   ============================================================ */
.league-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: -8px -8px 8px;
}
.league-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 8px;
  border-radius: 8px;
  transition: background 0.15s ease;
}
.league-row:hover { background: rgba(124, 255, 178, 0.04); }
.league-meta { min-width: 0; }
.league-name { color: var(--ink); font-weight: 500; font-size: 14px; }
.league-code {
  color: var(--ink-dim);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: 2px;
}
.league-code strong {
  color: var(--ink-mute);
  font-family: ui-monospace, monospace;
  letter-spacing: 0.16em;
  font-weight: 600;
  margin-left: 4px;
}

/* Guest tag on leaderboard rows */
.lb-row .name .badge.guest-tag {
  background: var(--bg-input);
  color: var(--ink-dim);
}
