/* Gaffer.
 *
 * Phone first, because a thirteen year old sets his lineup on a phone twenty
 * minutes before kickoff. Nothing here needs a build step.
 *
 * No club crests, league wordmarks or player photographs anywhere: player
 * names and statistics are settled law for fantasy use, imagery is not.
 * DECISIONS #15. The only mark is Gaffer's own.
 */

:root {
  color-scheme: light dark;
  --ink: #16211b;
  --dim: #5c6b62;
  --paper: #f7f8f6;
  --raised: #ffffff;
  --line: #d9e0da;
  --accent: #14684a;
  --accent-ink: #ffffff;
  --warn: #8a5300;
  --bad: #9a2c2c;
  --lock: #7a6a3f;
  --pitch: #1d6b4a;
  --pitch-line: rgba(255, 255, 255, 0.42);
  --radius: 12px;
  --shadow: 0 1px 2px rgba(20, 34, 27, 0.07), 0 4px 14px rgba(20, 34, 27, 0.05);
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e7ede8;
    --dim: #94a49a;
    --paper: #0f1a14;
    --raised: #16231c;
    --line: #26342c;
    --accent: #4fba8d;
    --accent-ink: #06150e;
    --warn: #d9a441;
    --bad: #e3706b;
    --lock: #b8a469;
    --pitch: #14432f;
    --shadow: none;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
  font-synthesis-weight: none;
  /* The lineup screen is a grid of tap targets. A stray double-tap zoom in the
     middle of setting a shape is the difference between playing eleven and
     playing ten. */
  touch-action: manipulation;
  padding-bottom: env(safe-area-inset-bottom);
}

a { color: var(--accent); }

.skip {
  position: absolute;
  left: -9999px;
}
.skip:focus {
  left: 8px;
  top: 8px;
  z-index: 10;
  background: var(--raised);
  padding: 8px 12px;
  border-radius: 8px;
}

/* ------------------------------------------------------------------ chrome */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  padding-top: calc(10px + env(safe-area-inset-top));
  border-bottom: 1px solid var(--line);
  background: var(--raised);
  position: sticky;
  top: 0;
  z-index: 5;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  color: inherit;
  font-weight: 650;
  letter-spacing: -0.02em;
  font-size: 1.12rem;
}

/* The mark: a pitch centre circle with the halfway line through it. Drawn in
   CSS so there is one fewer request and nothing to 404. */
.mark {
  width: 20px;
  height: 20px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  position: relative;
  flex: none;
}
.mark::after {
  content: "";
  position: absolute;
  left: -6px;
  right: -6px;
  top: 50%;
  border-top: 2px solid var(--accent);
  transform: translateY(-1px);
}

.who {
  font-size: 0.82rem;
  color: var(--dim);
  text-align: right;
  min-width: 0;
}
.who strong { color: var(--ink); font-weight: 600; }

.tabs {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 0 8px;
  border-bottom: 1px solid var(--line);
  background: var(--raised);
  position: sticky;
  top: 45px;
  z-index: 4;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  flex: none;
  padding: 11px 12px 9px;
  text-decoration: none;
  color: var(--dim);
  font-size: 0.9rem;
  font-weight: 550;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.tabs a[aria-current="page"] {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

main {
  max-width: 760px;
  margin: 0 auto;
  padding: 18px 16px 40px;
  outline: none;
}

.foot {
  max-width: 760px;
  margin: 0 auto;
  padding: 18px 16px calc(28px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: baseline;
  font-size: 0.8rem;
  color: var(--dim);
}

/* ------------------------------------------------------------------- type */
h1 { font-size: 1.5rem; letter-spacing: -0.021em; margin: 0 0 6px; }
h2 { font-size: 1.05rem; letter-spacing: -0.01em; margin: 26px 0 8px; }
h3 { font-size: 0.93rem; margin: 18px 0 6px; }
p { margin: 0 0 12px; }
.lede { color: var(--dim); margin-bottom: 18px; }
.credit { font-size: 0.8rem; color: var(--dim); }
.loading { color: var(--dim); }
ul { padding-left: 20px; margin: 0 0 12px; }
li { margin: 4px 0; }

.card {
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin: 0 0 14px;
  box-shadow: var(--shadow);
}
.card > :last-child { margin-bottom: 0; }

/* A stated reason the screen is empty, never a spinner that never resolves. */
.empty {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 20px 16px;
  color: var(--dim);
  text-align: left;
}
.empty strong { color: var(--ink); display: block; margin-bottom: 4px; }

.bad { color: var(--bad); }
.warn { color: var(--warn); }

/* ----------------------------------------------------------------- tables */
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
caption { text-align: left; color: var(--dim); font-size: 0.82rem; padding-bottom: 8px; }
th, td { text-align: right; padding: 8px 8px; border-bottom: 1px solid var(--line); }
th:first-child, td:first-child { text-align: left; }
thead th {
  font-size: 0.71rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--dim);
  font-weight: 600;
  border-bottom-width: 1px;
}
tbody tr:last-child td { border-bottom: none; }
td.num { font-weight: 600; }
td.zero { color: var(--dim); font-weight: 400; }
.scroll-x { overflow-x: auto; }

/* Prose tables are sentences, not numbers. */
.prose th, .prose td { text-align: left; vertical-align: top; }
.prose td:first-child { width: 34%; }

/* --------------------------------------------------------------- controls */
button, .btn {
  font: inherit;
  font-weight: 560;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--raised);
  color: var(--ink);
  padding: 10px 14px;
  cursor: pointer;
  min-height: 44px;
}
button:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary, button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.btn { display: inline-block; text-decoration: none; text-align: center; line-height: 24px; }
/* A button that reads as a link. For the secondary thing on a screen whose
   primary instruction is something else, where a second real button would
   compete with the one the kid is meant to press. Still a button element, and
   still 44px of target, because it is tapped on a phone. */
.btn-link {
  border: 0;
  background: none;
  color: var(--accent);
  font-weight: 500;
  padding: 10px 4px;
  text-decoration: underline;
}
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row.end { justify-content: flex-end; }
.spacer { flex: 1 1 auto; }

label.field { display: block; margin: 0 0 12px; }
label.field span {
  display: block;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--dim);
  margin-bottom: 5px;
  font-weight: 600;
}
select, input[type="text"], input[type="search"] {
  font: inherit;
  width: 100%;
  min-height: 44px;
  padding: 9px 11px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--raised);
  color: var(--ink);
}

/* A segmented control: the formation picker, and the slot picker on the rules
   screen. Radio inputs underneath, so arrow keys work and a screen reader
   announces it as one group. */
.seg { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; border: 0; padding: 0; }
.seg legend {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--dim);
  font-weight: 600;
  padding: 0 0 6px;
}
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 13px;
  font-size: 0.87rem;
  font-weight: 550;
  cursor: pointer;
  background: var(--raised);
  min-height: 38px;
  display: inline-flex;
  align-items: center;
}
.seg input:checked + label {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.seg input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 2px; }
.seg input:disabled + label { opacity: 0.4; cursor: not-allowed; }

/* -------------------------------------------------------------- the pitch */
.pitch {
  position: relative;
  background: var(--pitch);
  border-radius: var(--radius);
  padding: 14px 10px;
  display: grid;
  gap: 10px;
  /* Tall enough that five bands never squash, short enough to see the whole
     shape on a phone without scrolling. */
  min-height: 430px;
  overflow: hidden;
}
.pitch::before {
  /* Halfway line and centre circle. Decoration only. */
  content: "";
  position: absolute;
  left: 0; right: 0; top: 50%;
  border-top: 2px solid var(--pitch-line);
  pointer-events: none;
}
.pitch::after {
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  width: 92px; height: 92px;
  margin: -46px 0 0 -46px;
  border: 2px solid var(--pitch-line);
  border-radius: 50%;
  pointer-events: none;
}
.band {
  display: flex;
  justify-content: center;
  gap: 8px;
  position: relative;
  z-index: 1;
}

.slot {
  flex: 1 1 0;
  max-width: 116px;
  min-height: 74px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(8, 24, 17, 0.42);
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 6px 5px;
  text-align: center;
  cursor: pointer;
  font: inherit;
}
.slot .pos {
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  opacity: 0.82;
  font-weight: 700;
}
.slot .name {
  font-size: 0.78rem;
  line-height: 1.2;
  font-weight: 560;
  overflow-wrap: anywhere;
}
.slot .name.none { opacity: 0.6; font-weight: 400; font-style: italic; }
.slot.filled { background: rgba(8, 24, 17, 0.66); border-color: rgba(255, 255, 255, 0.5); }
.slot.locked { cursor: default; border-style: dashed; }
.slot .lockmark { font-size: 0.64rem; letter-spacing: 0.06em; opacity: 0.85; }
.slot:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* -------------------------------------------------------------- the meter */
.meter { margin: 0 0 12px; }
.meter .bar {
  height: 8px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}
.meter .bar i {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.18s ease;
}
.meter .lab {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--dim);
  margin-bottom: 5px;
}

/* Chips: the slot minimums, the formations a squad can field. */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  color: var(--dim);
  background: var(--raised);
}
.chip.ok { border-color: var(--accent); color: var(--accent); }
.chip.short { border-color: var(--bad); color: var(--bad); }

/* ------------------------------------------------------------ disclosures */
details.working {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0;
  margin: 0 0 8px;
  background: var(--raised);
}
details.working > summary {
  cursor: pointer;
  padding: 11px 13px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
  font-weight: 550;
  min-height: 44px;
  align-content: center;
  flex-wrap: wrap;
}
details.working > summary::-webkit-details-marker { display: none; }
details.working > summary .pts { font-variant-numeric: tabular-nums; font-weight: 700; }
details.working > div { padding: 0 13px 12px; }

/* ------------------------------------------------------------------ toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  max-width: min(520px, calc(100vw - 32px));
  background: var(--ink);
  color: var(--paper);
  padding: 11px 15px;
  border-radius: 10px;
  font-size: 0.9rem;
  z-index: 20;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.26);
}
.toast.bad { background: var(--bad); color: #fff; }

/* ------------------------------------------------------------------ sheet */
dialog.sheet {
  border: none;
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 0;
  width: min(560px, 100vw);
  max-height: 82vh;
  margin: auto auto 0;
  background: var(--raised);
  color: var(--ink);
}
dialog.sheet::backdrop { background: rgba(6, 14, 10, 0.5); }
dialog.sheet header {
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  background: var(--raised);
}
dialog.sheet header h2 { margin: 0; font-size: 1rem; }
dialog.sheet .body { padding: 8px 10px calc(16px + env(safe-area-inset-bottom)); overflow-y: auto; }

.pick {
  display: flex;
  width: 100%;
  gap: 10px;
  align-items: baseline;
  text-align: left;
  border: none;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: none;
  padding: 12px 8px;
}
.pick:last-child { border-bottom: none; }
.pick .meta { color: var(--dim); font-size: 0.8rem; }
.pick[aria-disabled="true"] { opacity: 0.45; }

@media (min-width: 620px) {
  .slot { min-height: 82px; }
  .pitch { min-height: 500px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ------------------------------------------------------------------- home
 *
 * The marketing page uses the SAME components as the app: same card, same
 * table, same button. The only additions are a hero and two layouts, because
 * a landing page built out of its own parts drifts from the product within a
 * month and then misrepresents it.
 */
.hero {
  padding: 26px 0 22px;
}
.hero h1 {
  font-size: clamp(1.9rem, 7vw, 2.7rem);
  line-height: 1.08;
  letter-spacing: -0.03em;
  margin: 0 0 12px;
}
.hero-lede {
  font-size: 1.05rem;
  color: var(--dim);
  max-width: 34em;
  margin-bottom: 20px;
}

/* Two ninety minutes side by side. One column on a phone, because a
   comparison you have to scroll sideways is not a comparison. */
.compare {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin: 16px 0 14px;
}
@media (min-width: 560px) {
  .compare { grid-template-columns: 1fr 1fr; }
}
.compare-col {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 13px 14px;
}
.compare-col h3 { margin: 0 0 2px; font-size: 1rem; }
.compare-col .credit { margin-bottom: 10px; }
.compare-col td { padding: 6px 4px; font-size: 0.9rem; }
.compare-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-top: 11px;
  margin-top: 4px;
  border-top: 2px solid var(--line);
  font-variant-numeric: tabular-nums;
}
.compare-total strong { font-size: 1.25rem; }

.verdict {
  font-size: 1.08rem;
  font-weight: 560;
  margin: 4px 0 10px;
}

.steps { display: grid; gap: 16px; }
.step { display: flex; gap: 13px; align-items: flex-start; }
.step h3 { margin: 1px 0 4px; font-size: 0.98rem; }
.step p { margin: 0; color: var(--dim); }
.step-n {
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}

.card.cta { border-color: var(--accent); }

/* A player somebody has already drafted. Dimmed rather than hidden: a kid
   scrolling the board at the draft table needs to see that Haaland is gone,
   and a row that vanishes reads as a bug or a search that went wrong. */
tr.gone td { opacity: 0.45; }
tr.gone td:first-child { text-decoration: line-through; }
