/* You're the Star — mobile-first.
   Designed for phones (99% of traffic) and progressively enhanced upward.
   Brand: deep teal #0E3A34, gold #F2B134 (from the star logo). */

:root {
  --teal: #0E3A34;
  --teal-mid: #15514A;
  --gold: #F2B134;
  --gold-soft: #FFDA8C;
  --bg: #F7F8F7;
  --card: #FFFFFF;
  --line: #E2E6E4;
  --text: #16211F;
  --muted: #667874;
  --ok: #1B7F5A;
  --bad: #C0392B;
  --radius: 12px;
  --tap: 44px; /* minimum comfortable tap target */
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;              /* 16px+ stops iOS zooming on input focus */
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  padding-bottom: env(safe-area-inset-bottom);
}

/* ---------- header ---------- */
.site-header {
  background: var(--teal);
  color: #fff;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  position: sticky;
  top: 0;
  z-index: 50;
  padding-top: calc(12px + env(safe-area-inset-top));
}
.site-header a { color: #fff; text-decoration: none; }
.site-header .brand { font-weight: 700; font-size: 17px; }
.site-header .brand .star { color: var(--gold); }
.site-header .spacer { flex: 1; }
.site-header .hdr-link { font-size: 14px; opacity: .9; }

.wrap { padding: 16px; max-width: 720px; margin: 0 auto; }

h1 { font-size: 22px; margin: 0 0 4px; line-height: 1.25; }
h2 { font-size: 18px; margin: 24px 0 10px; }
h3 { font-size: 16px; margin: 18px 0 8px; }
.sub { color: var(--muted); font-size: 14px; margin: 0 0 16px; }

/* ---------- cards ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
}
.card.tight { padding: 10px 12px; }

/* ---------- messages ---------- */
.msg { padding: 12px 14px; border-radius: var(--radius); margin-bottom: 12px; font-size: 15px; }
.msg.err  { background: #FDECEA; color: #8E2A20; border: 1px solid #F5C6C0; }
.msg.ok   { background: #E7F5EF; color: #146349; border: 1px solid #BFE6D6; }
.msg.info { background: #EAF1F5; color: #1F4A5C; border: 1px solid #C6DCE6; }

/* ---------- forms ---------- */
label { display: block; margin-bottom: 10px; font-size: 15px; }
input[type=text], input[type=email], input[type=password],
input[type=date], input[type=time], input[type=number], select, textarea {
  width: 100%;
  min-height: var(--tap);
  padding: 10px 12px;
  font-size: 16px;              /* keep at 16px: smaller triggers iOS zoom */
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
}
input[type=number].sm { width: 84px; min-width: 84px; }

button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap);
  padding: 12px 18px;
  font-size: 16px;
  font-weight: 600;
  border: 0;
  border-radius: 10px;
  background: var(--teal);
  color: #fff;
  cursor: pointer;
  text-decoration: none;
}
button.secondary, .btn.secondary { background: #fff; color: var(--teal); border: 1px solid var(--line); }
button.danger { background: var(--bad); }
button:disabled { opacity: .45; }
button.full { width: 100%; }

/* checkbox/radio rows get a proper tap target */
.check-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-height: var(--tap);
  padding: 8px 0;
}
.check-row input { width: 22px; height: 22px; margin-top: 2px; flex: none; }

/* ---------- player / row cards (replaces wide tables on mobile) ---------- */
.row-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 8px;
}
.row-card .who { flex: 1; min-width: 0; }
.row-card .name { font-weight: 600; }
.row-card .meta { font-size: 13px; color: var(--muted); }
.row-card .pts { font-weight: 700; font-variant-numeric: tabular-nums; }

.pill {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  vertical-align: middle;
}
.pill.boss { background: var(--gold-soft); color: #6b4a00; }
.pill.cap  { background: var(--teal); color: #fff; }
.pill.bench{ background: #E9EDEB; color: var(--muted); }

/* segmented picker: Start / Bench / Out */
.seg { display: flex; gap: 4px; flex: none; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label {
  margin: 0;
  min-width: 46px;
  min-height: var(--tap);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}
.seg input:checked + label { background: var(--teal); border-color: var(--teal); color: #fff; }
.seg input:checked + label.bench { background: var(--muted); border-color: var(--muted); }
.seg input:checked + label.cap   { background: var(--gold); border-color: var(--gold); color: #3a2a00; }

/* ---------- sticky action bar ---------- */
.sticky-bar {
  position: sticky;
  bottom: 0;
  background: #fff;
  border-top: 1px solid var(--line);
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  margin: 16px -16px 0;
  z-index: 40;
}
.counters { display: flex; gap: 12px; font-size: 13px; margin-bottom: 8px; flex-wrap: wrap; }
.counters span { color: var(--muted); }
.counters b { font-variant-numeric: tabular-nums; }
.counters .full-ok b { color: var(--ok); }
.counters .over b { color: var(--bad); }

/* ---------- search / filter ---------- */
.filter { position: sticky; top: 56px; background: var(--bg); padding: 8px 0; z-index: 30; }

/* ---------- tables: scroll rather than squash ---------- */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -16px; padding: 0 16px; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; background: #fff; }
table.data th, table.data td { padding: 10px 8px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data th { background: #F0F3F2; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
table.data tr:last-child td { border-bottom: 0; }

/* ---------- leaderboard ---------- */
.lb-rank { width: 30px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.lb-me { background: #FFF8E9; border-color: var(--gold); }

nav.links a { display: block; padding: 14px 12px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 8px; text-decoration: none; color: var(--text); font-weight: 600; }
nav.links a:after { content: "›"; float: right; color: var(--muted); }

footer.site-footer { padding: 24px 16px calc(24px + env(safe-area-inset-bottom)); text-align: center; color: var(--muted); font-size: 13px; }
footer.site-footer a { color: var(--muted); }

/* ---------- desktop ---------- */
@media (min-width: 768px) {
  .wrap { padding: 24px; }
  h1 { font-size: 28px; }
  .sticky-bar { position: static; margin: 16px 0 0; border-radius: var(--radius); border: 1px solid var(--line); }
  table.data th, table.data td { white-space: normal; }
}
