/* Football draft: phone-first, light theme, big tap targets. No external fonts. */
:root {
  --field: #0f3d2e;
  --field-2: #17573f;
  --ink: #16202a;
  --muted: #5d6b78;
  --line: #dde3e8;
  --bg: #eef2ee;
  --card: #ffffff;
  --accent: #f2a900;
  --accent-ink: #3d2b00;
  --go: #1f8a4c;
  --go-soft: #e3f5ea;
  --bad: #b3261e;
  --bad-soft: #fdecea;
  --warn: #8a5a00;
  --radius: 14px;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

[hidden] { display: none !important; }

h1, h2 { margin: 0 0 8px; line-height: 1.2; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.1rem; }
p { margin: 0 0 8px; }

.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.center { text-align: center; }
.warn { color: var(--warn); font-weight: 600; }

/* ---------- top bar ---------- */
.topbar {
  background: var(--field);
  color: #fff;
  padding: calc(12px + env(safe-area-inset-top, 0px)) 16px 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.brand { display: flex; flex-direction: column; }
.brand-title { font-weight: 800; font-size: 1.25rem; letter-spacing: 0.02em; }
.brand-sub { font-size: 0.8rem; opacity: 0.8; }
.you-are {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  padding: 6px 6px 6px 14px;
  font-weight: 600;
}
.linkish {
  background: transparent;
  border: 0;
  color: #fff;
  text-decoration: underline;
  font: inherit;
  font-weight: 400;
  font-size: 0.875rem;
  padding: 8px 10px;
  min-height: 36px;
  cursor: pointer;
}

/* ---------- on-the-clock banner ---------- */
.sticky-banner {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 10;
  padding: 8px 12px;
  background: var(--bg);
}
.on-clock {
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-weight: 700;
  font-size: 1.05rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}
.on-clock.mine {
  background: var(--accent);
  border-color: #d18f00;
  color: var(--accent-ink);
  animation: pulse 1.6s ease-in-out infinite;
}
.clock-you { font-size: 1.2rem; margin-top: 4px; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(242, 169, 0, 0.55); }
  50% { box-shadow: 0 0 0 8px rgba(242, 169, 0, 0); }
}
@media (prefers-reduced-motion: reduce) { .on-clock.mine { animation: none; } }

/* ---------- layout ---------- */
.wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 12px 12px 32px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.wrap > section { display: flex; flex-direction: column; gap: 12px; }
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}
.hero h1 { color: var(--field); }

.net-note {
  background: #fff7e0;
  color: var(--warn);
  border: 1px solid #f0d58a;
  border-radius: 10px;
  padding: 10px 12px;
  font-weight: 600;
}
.error {
  background: var(--bad-soft);
  color: var(--bad);
  border: 1px solid #f1b8b4;
  border-radius: 10px;
  padding: 10px 12px;
  font-weight: 600;
}

/* ---------- buttons ---------- */
.btn, .name-btn, .chip {
  font: inherit;
  cursor: pointer;
  border-radius: 12px;
  border: 0;
  touch-action: manipulation;
}
.btn {
  min-height: 44px;
  padding: 10px 16px;
  font-weight: 700;
  background: var(--field);
  color: #fff;
}
.btn:disabled { background: #c9d1d8; color: #6d7882; cursor: default; }
.btn.yes { background: var(--go); }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.danger { background: var(--bad); }
.btn.wide { width: 100%; }

.name-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.name-btn {
  min-height: 56px;
  padding: 12px;
  font-size: 1.1rem;
  font-weight: 700;
  background: var(--go-soft);
  color: var(--field);
  border: 2px solid #b7dfc6;
  overflow-wrap: anywhere;
}
.name-btn:active { background: #c9ebd6; }

/* ---------- draft order ---------- */
.order-list { margin: 0 0 8px; padding-left: 1.6em; font-size: 1.1rem; font-weight: 600; }
.order-list li { padding: 4px 0; }
.order-list li.is-me { color: var(--go); }

/* ---------- my team ---------- */
.slot-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.slot {
  border: 1px dashed #b9c3cc;
  border-radius: 10px;
  padding: 6px;
  min-height: 56px;
  display: flex;
  flex-direction: column;
  font-size: 0.8rem;
  overflow: hidden;
}
.slot.filled { border-style: solid; border-color: #9fd1b2; background: var(--go-soft); }
.slot-label { font-weight: 800; font-size: 0.72rem; color: var(--muted); }
.slot.filled .slot-label { color: var(--go); }
.slot-name { font-weight: 600; line-height: 1.15; overflow-wrap: anywhere; }
.slot:not(.filled) .slot-name { color: #9aa6b1; font-weight: 400; }
.slot-meta { color: var(--muted); font-size: 0.7rem; }

/* ---------- recent picks ---------- */
.recent-list { list-style: none; margin: 0; padding: 0; }
.recent-list li {
  display: flex;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  align-items: baseline;
}
.recent-list li:last-child { border-bottom: 0; }
.pick-no { font-weight: 800; color: var(--muted); min-width: 2.4em; }
.pick-who { font-weight: 700; }
.pick-player { flex: 1; text-align: right; }

/* ---------- board ---------- */
.filters {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 10px;
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  min-height: 40px;
  min-width: 48px;
  padding: 8px 12px;
  background: #e8edf1;
  color: var(--ink);
  font-weight: 700;
}
.chip.on { background: var(--field); color: #fff; }
.search {
  width: 100%;
  min-height: 46px;
  font: inherit;
  font-size: 1rem;
  padding: 10px 14px;
  border: 1px solid #c4ced6;
  border-radius: 12px;
  background: #fff;
}
.board { display: flex; flex-direction: column; }
.player-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.player-row:last-child { border-bottom: 0; }
.player-row.greyed { opacity: 0.5; }
.p-name { font-weight: 700; overflow-wrap: anywhere; }
.p-meta { color: var(--muted); font-size: 0.85rem; }
.p-reason { color: var(--bad); font-size: 0.8rem; font-weight: 600; }
.injury-tag {
  display: inline-block;
  margin-left: 4px;
  padding: 0 6px;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 800;
  line-height: 1.5;
  vertical-align: 2px;
  letter-spacing: 0.02em;
}
.injury-tag.red { background: var(--bad-soft); color: var(--bad); }
.injury-tag.amber { background: #fff4d6; color: var(--warn); }
.p-proj { display: flex; flex-direction: column; align-items: flex-end; min-width: 3em; }
.p-proj-num { font-weight: 800; font-variant-numeric: tabular-nums; }
.p-proj-label { font-size: 0.7rem; color: var(--muted); }
.btn.pick { min-width: 64px; }
.confirm {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  background: var(--go-soft);
  border-radius: 10px;
  padding: 10px;
}
.confirm-q { flex: 1 1 100%; font-weight: 700; }
.confirm .btn { flex: 1; }

/* ---------- leaderboard ---------- */
.leaderboard { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.leader { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.leader.first { border-color: var(--accent); }
.leader.is-me .leader-name { color: var(--go); }
.leader-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 10px 14px;
  background: #fff;
  border: 0;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.leader.first .leader-head { background: #fff6dc; }
.rank {
  width: 2em;
  height: 2em;
  border-radius: 50%;
  background: #e8edf1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  flex: none;
}
.leader.first .rank { background: var(--accent); color: var(--accent-ink); }
.leader-name { flex: 1; font-weight: 700; font-size: 1.05rem; overflow-wrap: anywhere; }
.leader-total { font-weight: 800; font-size: 1.3rem; font-variant-numeric: tabular-nums; }
.leader-players { border-top: 1px solid var(--line); padding: 4px 14px 8px; background: #fafbfc; }
.lp { display: flex; gap: 10px; padding: 6px 0; border-bottom: 1px solid #edf0f3; font-size: 0.95rem; }
.lp:last-child { border-bottom: 0; }
.lp-slot { width: 3em; font-weight: 800; color: var(--muted); flex: none; }
.lp-name { flex: 1; overflow-wrap: anywhere; }
.lp-pts { font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------- commissioner page ---------- */
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.field label { font-size: 0.85rem; color: var(--muted); font-weight: 600; }
.text-input {
  width: 100%;
  min-height: 46px;
  font: inherit;
  padding: 10px 14px;
  border: 1px solid #c4ced6;
  border-radius: 12px;
  background: #fff;
}
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.row-actions .btn { flex: 1 1 auto; }
.check {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  font-weight: 600;
}
.check input { width: 22px; height: 22px; }
.roster-list { list-style: none; margin: 0; padding: 0; }
.roster-list li { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--line); }
.roster-list li:last-child { border-bottom: 0; }
.round-line { font-size: 0.95rem; }

@media (min-width: 560px) {
  .name-grid { grid-template-columns: repeat(3, 1fr); }
  .slot-grid { grid-template-columns: repeat(8, minmax(0, 1fr)); }
  .filters { flex-direction: row; align-items: center; }
  .filters .search { flex: 1; }
}

.shuffle-note {
  margin: 0.75rem 0 0;
  padding: 0.6rem 0.8rem;
  border-radius: 8px;
  background: #e7f4ec;
  color: #134e2e;
  font-weight: 600;
}

#order-card.flash {
  animation: order-flash 1.2s ease-out;
}

@keyframes order-flash {
  0% { box-shadow: 0 0 0 4px #f5b301; background: #fff7d6; }
  100% { box-shadow: 0 0 0 0 transparent; background: #fff; }
}
