/* Pike Match Scoring
 * Mobile-first. High contrast, large targets - this gets used outdoors in
 * poor light with cold hands. Respects the phone's light/dark setting.
 */

:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --ink: #16202a;
  --ink-soft: #5b6b7a;
  --line: #d9e0e6;
  --accent: #0f5c3f;        /* reed green */
  --accent-ink: #ffffff;
  --ok: #1a7f4b;
  --warn: #9a6400;
  --error: #a32020;
  --pending: #8a6d1f;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(16, 32, 42, 0.08), 0 4px 16px rgba(16, 32, 42, 0.05);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11161b;
    --surface: #1a222a;
    --ink: #e8eef3;
    --ink-soft: #9aabb8;
    --line: #2b3741;
    --accent: #2f9e6e;
    --accent-ink: #06130d;
    --ok: #46c489;
    --warn: #d9a441;
    --error: #ef7676;
    --pending: #d9a441;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}

/* --- Chrome ------------------------------------------------------------ */

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  padding: 12px 16px;
  background: var(--accent); color: var(--accent-ink);
  padding-top: max(12px, env(safe-area-inset-top));
}
.brand { font-weight: 700; color: inherit; text-decoration: none; letter-spacing: -0.01em; }
.brand span { font-weight: 400; opacity: 0.8; margin-left: 4px; }

.nav { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.nav a { color: inherit; text-decoration: none; font-size: 15px; padding: 6px 2px; position: relative; }
.nav a:hover, .nav a:focus-visible { text-decoration: underline; }
.nav .muted { opacity: 0.75; }

.badge {
  display: inline-block; min-width: 18px; margin-left: 5px; padding: 1px 6px;
  background: #fff; color: var(--accent);
  border-radius: 9px; font-size: 12px; font-weight: 700; text-align: center;
}

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

.foot {
  max-width: 760px; margin: 0 auto;
  padding: 24px 16px max(24px, env(safe-area-inset-bottom));
  color: var(--ink-soft); font-size: 13px; text-align: center;
}

/* --- Cards ------------------------------------------------------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 16px;
}
.card-narrow { max-width: 420px; margin-left: auto; margin-right: auto; }

h1 { font-size: 22px; margin: 0 0 4px; letter-spacing: -0.01em; }
h2 { font-size: 17px; margin: 0 0 12px; }
.sub { color: var(--ink-soft); margin: 0 0 12px; font-size: 14px; }
.hint { color: var(--ink-soft); font-size: 13px; margin: 6px 0 0; }

.match-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.running { text-align: right; flex-shrink: 0; }
.running-label { display: block; font-size: 12px; color: var(--ink-soft); }
.running-value { display: block; font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }

.live-dot {
  flex-shrink: 0; font-size: 12px; font-weight: 700; letter-spacing: 0.06em;
  padding: 4px 10px; border-radius: 999px;
  background: var(--line); color: var(--ink-soft);
}
.live-dot.is-live { background: var(--ok); color: #fff; }

/* --- Forms ------------------------------------------------------------- */

label {
  display: block; margin: 14px 0 6px;
  font-size: 14px; font-weight: 600;
}
.req { color: var(--error); font-weight: 500; font-size: 12px; }
.opt { color: var(--ink-soft); font-weight: 400; font-size: 12px; }

input[type="text"], input[type="password"], input[type="number"],
input[type="datetime-local"], input[type="file"], textarea {
  width: 100%; padding: 12px;
  font: inherit; color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line); border-radius: 8px;
}
input:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible {
  outline: 3px solid var(--accent); outline-offset: 2px;
}
/* 16px minimum stops iOS zooming the viewport on focus. */
input, textarea, button { font-size: 16px; }

.weight-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.weight-row label { margin-top: 0; }

.btn {
  display: inline-block; padding: 14px 18px;
  font-weight: 600; border: 1px solid transparent; border-radius: 8px;
  cursor: pointer; text-align: center;
}
.btn:disabled { opacity: 0.55; cursor: progress; }
.btn-block { width: 100%; margin-top: 18px; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-approve { background: var(--ok); color: #fff; flex: 1; }
.btn-reject { background: var(--error); color: #fff; flex: 1; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }

/* --- Flashes and status ------------------------------------------------ */

.flash {
  padding: 12px 14px; border-radius: 8px; margin-bottom: 16px;
  font-size: 14px; border: 1px solid;
}
.flash-ok    { background: rgba(26,127,75,0.10);  border-color: var(--ok);    color: var(--ok); }
.flash-error { background: rgba(163,32,32,0.10);  border-color: var(--error); color: var(--error); }

.submit-status { margin-top: 10px; font-size: 14px; min-height: 1.4em; }
.submit-status.is-working { color: var(--ink-soft); }
.submit-status.is-ok      { color: var(--ok); font-weight: 600; }
.submit-status.is-error   { color: var(--error); font-weight: 600; }

/* --- Catch list -------------------------------------------------------- */

.catch-list { list-style: none; margin: 0; padding: 0; }
.catch-item {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 0; border-bottom: 1px solid var(--line);
}
.catch-item:last-child { border-bottom: 0; }
.ci-weight { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 95px; }
.ci-time { color: var(--ink-soft); font-size: 13px; }
.ci-status { margin-left: auto; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.ci-note { flex-basis: 100%; font-size: 13px; color: var(--ink-soft); }

.status-pending  .ci-status { color: var(--pending); }
.status-approved .ci-status { color: var(--ok); }
.status-rejected .ci-status { color: var(--error); }

/* --- Leaderboard ------------------------------------------------------- */

.board { width: 100%; border-collapse: collapse; }
.board th, .board td { padding: 11px 6px; text-align: left; border-bottom: 1px solid var(--line); }
.board th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-soft); }
.board .c-pos { width: 40px; font-variant-numeric: tabular-nums; color: var(--ink-soft); }
.board .c-fish { width: 52px; text-align: center; font-variant-numeric: tabular-nums; }
.board .c-weight { width: 110px; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.board tbody tr:first-child .c-pos,
.board tbody tr:first-child .c-weight { color: var(--accent); }
.board .loading { color: var(--ink-soft); text-align: center; padding: 24px 0; }

.chip {
  display: inline-block; margin-left: 8px; padding: 1px 7px;
  background: rgba(217,164,65,0.18); color: var(--pending);
  border-radius: 999px; font-size: 11px; font-weight: 600; white-space: nowrap;
}
.board-meta {
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin: 12px 0 0; font-size: 12px; color: var(--ink-soft);
}

/* --- Review ------------------------------------------------------------ */

.tabs { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.tab {
  padding: 8px 14px; border-radius: 999px; text-decoration: none;
  background: var(--surface); color: var(--ink-soft);
  border: 1px solid var(--line); font-size: 14px;
}
.tab.is-active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.review-card { transition: opacity 0.3s ease; }
.rc-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.rc-angler { font-weight: 700; font-size: 17px; }
.rc-number { margin-left: 8px; font-size: 12px; color: var(--ink-soft); }
.rc-weight { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }

.rc-photos { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.rc-photos figure { margin: 0; }
.rc-photos img {
  width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover;
  border-radius: 8px; border: 1px solid var(--line); background: var(--bg);
}
.rc-photos figcaption { font-size: 12px; color: var(--ink-soft); margin-top: 4px; }

.rc-meta { margin: 14px 0 0; font-size: 14px; }
.rc-meta > div { display: flex; gap: 8px; padding: 3px 0; flex-wrap: wrap; }
.rc-meta dt { color: var(--ink-soft); min-width: 130px; }
.rc-meta dd { margin: 0; }
.rc-flags dd { color: var(--warn); font-weight: 600; }

.rc-actions { margin-top: 14px; }
.rc-buttons { display: flex; gap: 10px; margin-top: 10px; }

/* --- Admin utilities ---------------------------------------------------
 * These exist as classes rather than style="" attributes because the CSP
 * sets style-src 'self' - inline style attributes are blocked outright.
 */

.row-actions { margin-left: auto; display: flex; gap: 6px; }
.btn-sm { padding: 6px 10px; font-size: 13px; }
.mt-lg { margin-top: 20px; }
.ci-label { font-weight: 700; min-width: auto; }

.check-row {
  display: flex; gap: 10px; align-items: center;
  font-weight: 400; margin: 8px 0;
}
.check-row input[type="checkbox"] {
  width: auto; margin: 0; flex-shrink: 0;
  /* Comfortable target for a gloved finger */
  min-width: 22px; min-height: 22px;
}

select.field {
  width: 100%; padding: 12px;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--bg); color: var(--ink); font: inherit;
}

@media (max-width: 420px) {
  .match-head { flex-direction: column; }
  .running { text-align: left; }
  .row-actions { margin-left: 0; flex-basis: 100%; }
}
