:root {
  --bg: #f6f7f4;
  --card: #ffffff;
  --ink: #1c2321;
  --muted: #6b7671;
  --line: #e2e6e1;
  --green: #16a34a;
  --green-dark: #128040;
  --red: #dc2626;
  --amber: #d97706;
  --blue: #2563eb;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: #14532d;
  color: #fff;
}

.brand {
  font-weight: 800;
  font-size: 20px;
  color: #fff;
  text-decoration: none;
}

header nav {
  display: flex;
  align-items: center;
  gap: 18px;
}

header nav a {
  color: #d1fae5;
  text-decoration: none;
  font-weight: 600;
}

header nav a:hover { color: #fff; }

.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: #d1fae5;
  font-size: 24px;
  line-height: 1;
  padding: 4px 8px;
  cursor: pointer;
}

.nav-toggle:hover { color: #fff; }

@media (max-width: 720px) {
  .nav-toggle { display: block; }

  header { flex-wrap: wrap; }

  header nav {
    display: none;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    gap: 0;
    padding: 8px 0 4px;
  }

  header.nav-open nav { display: flex; }

  header nav a,
  header nav form {
    padding: 10px 4px;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
  }

  header nav form button.link { padding: 0; }
}

.envbar {
  text-align: center;
  font-weight: 700;
  font-size: 13px;
  padding: 6px 12px;
  letter-spacing: 0.02em;
}
.envbar-local { background: #1e3a8a; color: #dbeafe; }
.envbar-staging { background: #b45309; color: #fff; }
.envbar-production { background: #166534; color: #bbf7d0; }

main {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 16px 64px;
}

h1 { font-size: 26px; margin: 8px 0 16px; }
h2 { font-size: 18px; margin: 0 0 12px; }
h3 { font-size: 15px; margin: 0 0 6px; }

.row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: space-between;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 20px;
}

.narrow { max-width: 440px; margin: 48px auto; }

table { width: 100%; border-collapse: collapse; }

th, td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }

tr.inactive td { opacity: 0.5; }

.muted { color: var(--muted); font-size: 13px; }

.hint { border-bottom: 1px dotted var(--muted); cursor: help; }

/* stats page */
.form-blocks { display: inline-flex; gap: 2px; }

.form-blocks span { width: 10px; height: 14px; border-radius: 2px; display: inline-block; }

.form-W { background: var(--green); }
.form-D { background: #d1d5db; }
.form-L { background: var(--red); }

.legend { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 8px 0 16px; font-size: 13px; }

.legend-item { display: inline-flex; align-items: center; gap: 6px; }

.legend-swatch, .swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  display: inline-block;
  margin: 0 2px 0 6px;
}

.split-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 24px; margin-bottom: 16px; }

.split-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 24px; }

.split-3 ol { margin: 0; padding-left: 20px; }

.heatmap-scroll { overflow-x: auto; padding-bottom: 8px; }

.pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.pill-confirmed, .pill-played, .pill-paid { background: #dcfce7; color: var(--green-dark); }
.pill-invited, .pill-planning, .pill-pending, .pill-sent { background: #fef3c7; color: var(--amber); }
.pill-teamsset { background: #dbeafe; color: #1e40af; }
.pill-declined, .pill-dropped_out, .pill-cancelled { background: #fee2e2; color: var(--red); }

.tag {
  font-size: 11px;
  background: #e0e7ff;
  color: #3730a3;
  border-radius: 4px;
  padding: 1px 6px;
  font-weight: 700;
}

button, .button {
  font: inherit;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 6px;
  padding: 8px 14px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  font-weight: 600;
}

button:hover, .button:hover { border-color: var(--muted); }

button.primary { background: var(--green); border-color: var(--green); color: #fff; }
button.primary:hover { background: var(--green-dark); }

button.danger { background: #fff; border-color: var(--red); color: var(--red); }
button.danger:hover { background: #fee2e2; }

button.small, .button.small { padding: 3px 10px; font-size: 12px; }

button.big { padding: 14px 22px; font-size: 17px; }

button.link {
  border: none;
  background: none;
  color: #d1fae5;
  padding: 0;
  font-weight: 600;
}

button.link:hover { color: #fff; }

.inline-form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

input, select {
  /* Explicit size/weight so inputs look the same whether or not they sit
     inside a <label> (which is 14px/600). 16px also stops iOS Safari zooming
     the page when an input is focused. */
  font: inherit;
  font-size: 16px;
  font-weight: 400;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

label { display: inline-flex; flex-direction: column; gap: 4px; font-size: 14px; font-weight: 600; }

.inline-form label { flex-direction: row; align-items: center; gap: 8px; }

.actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

.actions form { display: inline; }

.flash {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 16px;
}

.error { color: var(--red); font-weight: 600; }

.warn { color: var(--amber); font-weight: 600; font-size: 14px; }

.teams-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.team-row {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 10px;
  font-weight: 500;
}

.teams-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px 48px;
  margin-top: 16px;
}

.dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin: 0 6px;
  vertical-align: baseline;
}

.dot-red { background: #dc2626; }
.dot-black { background: #1c2321; }

.teams-summary ul { margin: 0; padding-left: 18px; }

/* draggable, saveable team ordering */
ul.team-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  min-width: 160px;
}

.team-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  margin-bottom: 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  user-select: none;
  -webkit-user-select: none;
}

.team-list li.dragging {
  opacity: 0.65;
  border-style: dashed;
  border-color: var(--muted);
}

.drag-handle {
  cursor: grab;
  color: var(--muted);
  touch-action: none; /* stop touch drags scrolling the page instead */
}

.split-form { display: flex; flex-direction: column; gap: 6px; padding: 10px 0; }

.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; }

details summary { cursor: pointer; }

pre {
  background: #f3f4f6;
  padding: 12px;
  border-radius: 6px;
  overflow-x: auto;
  font-size: 12px;
  white-space: pre-wrap;
}

/* Phones: tables opting in with .stack reflow into a list of cards — the
   header row disappears, each <tr> becomes a bordered block, and empty cells
   vanish. Cells that need context carry it themselves via data-label. */
@media (max-width: 640px) {
  table.stack thead { display: none; }

  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; }

  table.stack tr {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 8px 12px;
    margin-bottom: 10px;
  }

  table.stack td { border-bottom: none; padding: 3px 0; }

  table.stack td:first-child { font-weight: 700; }

  table.stack td:empty { display: none; }

  table.stack td[data-label]::before {
    content: attr(data-label);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
    margin-right: 6px;
  }

  /* Row actions become equal-width, thumb-sized buttons. */
  table.stack td.actions { display: flex; gap: 8px; padding-top: 8px; }
  table.stack td.actions > * { flex: 1; }
  table.stack td.actions form button, table.stack td.actions .button { width: 100%; text-align: center; }

  /* Inline forms stack: controls take the full row instead of squeezing. */
  .inline-form > select, .inline-form > input { flex: 1 1 100%; width: 100%; }
  .inline-form > button { flex: 1 1 auto; }
}

/* --- auth screens (layout `bare`): full-page, one card, branded backdrop --- */

body.auth {
  min-height: 100vh;
  background: radial-gradient(1200px 600px at 50% -10%, #1d6b3c 0%, #14532d 45%, #0d3b20 100%);
  display: flex;
  flex-direction: column;
}

main.auth-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: none;
  padding: 24px 16px;
}

.auth-card {
  background: var(--card);
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  padding: 40px 36px 28px;
  width: 100%;
  max-width: 400px;
}

.auth-brand { text-align: center; margin-bottom: 24px; }

.auth-ball {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #14532d;
  font-size: 28px;
  margin-bottom: 12px;
}

.auth-brand h1 { font-size: 22px; margin: 0; }

.auth-tagline { color: var(--muted); font-size: 14px; margin: 4px 0 0; }

.login-form { display: flex; flex-direction: column; gap: 14px; }

.login-form label { font-size: 14px; }

.login-form input { width: 100%; }

.pw-field { position: relative; display: block; }

.pw-field input { padding-right: 44px; }

.pw-toggle {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: none;
  padding: 6px 10px;
  font-size: 16px;
  opacity: 0.55;
}

.pw-toggle:hover { opacity: 1; border: none; }

.auth-submit { width: 100%; padding: 12px 14px; }

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 2px 0;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  border-top: 1px solid var(--line);
}

.auth-hint { color: var(--muted); font-size: 13px; text-align: center; margin: -4px 0 0; }

.auth-notice {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 16px;
  font-size: 14px;
}

.auth-error { color: var(--red); font-weight: 600; font-size: 14px; margin: 0 0 14px; }

.auth-footnote {
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  border-top: 1px solid var(--line);
  margin: 22px -36px 0;
  padding: 16px 36px 0;
}

.rsvp { text-align: center; }

/* The share page runs wider than the other narrow cards: it carries a match
 * report with a three-column table, and 440px squeezed it. Both cards match
 * so the page reads as one column. */
.view-page .narrow { max-width: 560px; }

.rsvp-date { font-size: 20px; font-weight: 800; margin: 4px 0 16px; }

.rsvp-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin: 24px 0 12px;
  flex-wrap: wrap;
}

/* drop-out-with-reason flows */
.dropout { margin: 4px 0 12px; }

.dropout summary {
  cursor: pointer;
  color: var(--red);
  font-weight: 600;
  padding: 8px;
}

.dropout-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  padding: 8px 0;
}

.dropout-form label { width: 100%; max-width: 320px; text-align: left; }

.dropout-form input { width: 100%; }

.dropout-inline { display: inline-flex; gap: 6px; align-items: center; }

.dropout-inline input { padding: 3px 8px; font-size: 13px; max-width: 140px; }

/* settings form */
.settings-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-width: 460px;
  margin-top: 16px;
}

.setting { display: flex; flex-direction: column; gap: 4px; }

.setting-label { font-weight: 600; font-size: 14px; }

.setting-hint { font-size: 13px; color: var(--muted); }

.settings-form input, .settings-form select { width: 100%; }

.settings-form button { align-self: flex-start; }

/* match report */
/* On the share page the report sits outside the rsvp card rather than nested
 * in it — no border inside a border — and left-aligned against a page that
 * otherwise centres everything. */
.report-wrap {
  max-width: 560px;
  margin: 0 auto 48px;
  text-align: left;
}

.report-wrap .card { margin: 0; }

.report-headline { font-size: 17px; font-weight: 600; margin: 0 0 12px; }

/* Pre-game odds as a single bar — the split reads faster than two numbers. */
.report-bar {
  display: flex;
  height: 10px;
  border-radius: 5px;
  overflow: hidden;
  margin-bottom: 6px;
  background: var(--line);
}

.report-bar-red { background: var(--red); }
.report-bar-black { background: var(--ink); }

.report-notes { margin: 12px 0; padding-left: 18px; }
.report-notes li { margin-bottom: 4px; }

.report-impact td { vertical-align: middle; }
.rank-up { color: var(--green-dark); font-weight: 600; }
.rank-down { color: var(--muted); }
.career-high { color: var(--amber); }

/* team-picking tools — open while planning, a quiet button once teams are set */
details.team-tools { margin-top: 12px; }

details.team-tools > summary {
  cursor: pointer;
  padding: 8px 0;
  font-weight: 600;
  color: var(--muted);
}

details.team-tools > summary:hover { color: var(--ink); }

/* Open by default while planning, where it's the main event, not a disclosure. */
details.team-tools[open] > summary { color: var(--ink); }

/* dashboard seasons */
details.season { margin-bottom: 16px; }

details.season > summary {
  cursor: pointer;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 15px;
}

details.season[open] > summary { border-radius: 8px 8px 0 0; margin-bottom: 0; }
details.season > summary:hover { border-color: var(--muted); }

/* --- landing page (the public front door at /) ----------------------------
   Its own shell: no app chrome, full-bleed sections, and a green band at top
   and bottom so it reads as the product rather than as a page of the app. */
body.landing { background: var(--card); }
main.landing-main { max-width: none; padding: 0; }

.lp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 16px 24px;
  background: #14532d;
  color: #fff;
}

.lp-brand { font-weight: 800; font-size: 20px; color: #fff; text-decoration: none; }
.lp-nav { display: flex; align-items: center; gap: 20px; }
.lp-nav a { color: #d1fae5; text-decoration: none; font-weight: 600; font-size: 15px; }
.lp-nav a:hover { color: #fff; }

.lp-login {
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 999px;
  padding: 6px 16px;
}
.lp-login:hover { background: rgba(255, 255, 255, 0.12); }

.lp-hero {
  padding: 72px 24px 64px;
  text-align: center;
  background: radial-gradient(900px 420px at 50% -20%, #1d6b3c 0%, #14532d 55%, #0d3b20 100%);
  color: #fff;
}

.lp-hero h1 {
  margin: 0 auto 16px;
  max-width: 14ch;
  font-size: clamp(34px, 6vw, 56px);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.lp-lede {
  margin: 0 auto;
  max-width: 62ch;
  font-size: clamp(16px, 2.2vw, 19px);
  color: #d1fae5;
}

.lp-cta-row {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 32px 0 20px;
}

.lp-cta {
  display: inline-block;
  background: var(--green);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  padding: 13px 26px;
  border-radius: 999px;
}
.lp-cta:hover { background: var(--green-dark); }

.lp-cta-alt {
  display: inline-block;
  color: #fff;
  font-weight: 600;
  text-decoration: none;
  padding: 13px 22px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.4);
}
.lp-cta-alt:hover { background: rgba(255, 255, 255, 0.12); }

.lp-proof { margin: 0; color: #a7d8bb; font-size: 14px; }

.lp-section { padding: 64px 24px; }
.lp-section-alt { background: var(--bg); }
.lp-section > h2 {
  margin: 0 auto 36px;
  max-width: 1040px;
  font-size: clamp(24px, 3.4vw, 32px);
  letter-spacing: -0.01em;
}

.lp-steps {
  list-style: none;
  margin: 0 auto;
  padding: 0;
  max-width: 1040px;
  display: grid;
  gap: 28px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.step { display: flex; gap: 16px; align-items: flex-start; }
.step h3 { margin: 0 0 6px; font-size: 17px; }
.step p { margin: 0; color: var(--muted); font-size: 15px; }

.step-n {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lp-points {
  margin: 0 auto;
  max-width: 1040px;
  display: grid;
  gap: 24px;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.point {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 24px 22px;
}
.point-icon { font-size: 24px; }
.point h3 { margin: 10px 0 8px; font-size: 17px; }
.point p { margin: 0; color: var(--muted); font-size: 15px; }

/* Prose shares the 1040px column every other section uses, so its first line
   starts under the heading rather than floating in the middle of it. */
.lp-narrow { max-width: 1040px; margin: 0 auto; }
.lp-prose { margin: 0 0 14px; max-width: 62ch; font-size: 17px; }
.lp-muted { color: var(--muted); font-size: 15px; }

.lp-fit {
  margin: 0 auto;
  max-width: 1040px;
  display: grid;
  gap: 24px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}
.lp-fit h3 { margin: 0 0 12px; font-size: 17px; }
.lp-fit ul { margin: 0; padding-left: 20px; color: var(--muted); }
.lp-fit li { margin-bottom: 8px; }

.lp-closing {
  padding: 64px 24px 72px;
  text-align: center;
  background: #14532d;
  color: #fff;
}
.lp-closing h2 { margin: 0 0 14px; font-size: clamp(24px, 3.4vw, 32px); }
.lp-closing p { margin: 0 auto 24px; max-width: 58ch; color: #d1fae5; }

.lp-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 20px 24px;
  background: #0d3b20;
  color: #a7d8bb;
  font-size: 14px;
}
.lp-footer a { color: #d1fae5; font-weight: 600; }

html { scroll-behavior: smooth; }

/* On a phone the two section anchors wrap onto their own lines and push the
   hero off-screen. They're a convenience on a page you can just scroll, so
   drop them and keep the header to brand + Log in on one row. */
@media (max-width: 560px) {
  .lp-header { flex-wrap: nowrap; padding: 12px 16px; }
  .lp-brand { font-size: 17px; white-space: nowrap; }
  .lp-nav a:not(.lp-login) { display: none; }
  .lp-hero { padding: 48px 20px 44px; }
  .lp-section { padding: 48px 20px; }
  .lp-closing { padding: 48px 20px 56px; }
}
