/* Strathyre Darts League
   Public pages: white on black. Admin screens and the finance pages: black on off-white
   (body.light), so it's obvious when you're in the admin side. */

:root {
    --bg: #000;
    --fg: #fff;
    --mute: #a3a3a3;
    --line: #1f1f1f;
    --line-strong: #3a3a3a;
    --owed: #ff9d7a;
    --ul: #555;
    --btn-border: #555;
    --btn-fg: #d4d4d4;
    --hover: #ddd;
    --field-bg: #111;
    --women: #ffb547;
    --men: #6cc4ff;
    --font: 'Barlow', system-ui, sans-serif;
    --font-cond: 'Barlow Condensed', sans-serif;
}

body.light {
    --bg: #f4f1ea;
    --fg: #0a0a0a;
    --mute: #5a5750;
    --line: #ddd8cc;
    --line-strong: #b9b3a4;
    --owed: #b3401e;
    --ul: #8f8a7c;
    --btn-border: #8f8a7c;
    --btn-fg: #2a2a2a;
    --hover: #444;
    --field-bg: #fff;
}

*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--fg);
    font: 16px/1.4 var(--font);
    font-variant-numeric: tabular-nums;
}

a { color: var(--fg); }
a:hover { color: var(--hover); }
button, input, select, textarea { font: inherit; color: inherit; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
    outline: 2px solid var(--fg);
    outline-offset: 2px;
}

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

/* Header and nav */
.site-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding-bottom: 8px; }
.brand { font-family: var(--font-cond); font-weight: 700; font-size: 22px; letter-spacing: .01em; text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; }
.nav { display: flex; gap: 20px; }
.nav a { display: inline-flex; align-items: center; min-height: 44px; text-decoration: none; color: var(--mute); font-weight: 500; border-bottom: 2px solid transparent; }
.nav a[aria-current] { color: var(--fg); font-weight: 600; border-bottom-color: var(--fg); }

/* Type */
.h2 { font-family: var(--font-cond); font-weight: 700; font-size: 32px; line-height: 1; margin: 0 0 4px; }
.sub { color: var(--mute); font-size: 15px; margin: 0 0 12px; }
.big { font-family: var(--font-cond); font-weight: 700; line-height: 1; }
.mute { color: var(--mute); font-size: 14px; }
.sec { padding-top: 40px; }
.sec.first { padding-top: 32px; }
.hero { padding: 24px 0 28px; border-bottom: 1px solid var(--line-strong); }
.hero-big { font-family: var(--font-cond); font-weight: 700; font-size: 104px; line-height: .85; letter-spacing: -.01em; }
/* Words with descenders (g, p) need room below, or they run into the line underneath */
.hero-big.descend { padding-bottom: .18em; }
.page-title { margin: 0; font-family: var(--font-cond); font-weight: 700; font-size: 64px; line-height: .9; }
.hero p { margin: 12px 0 0; }
.hero p.mute { margin-top: 2px; font-size: 15px; }
.stats3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px 16px; }
.stats3.tight { gap: 16px; margin-top: 20px; }
.stat-n { font-size: 22px; font-weight: 700; }
.owed { font-size: 22px; font-weight: 700; color: var(--owed); }
.owed-text { color: var(--owed); }

/* Links that look like the design's name buttons */
.nm { display: inline-flex; align-items: center; min-height: 44px; text-decoration: underline; text-decoration-color: var(--ul); text-underline-offset: 4px; background: none; border: 0; padding: 0; text-align: left; cursor: pointer; }
.nm:hover { text-decoration-color: currentColor; }
.back { display: inline-flex; align-items: center; min-height: 44px; color: var(--mute); text-underline-offset: 4px; }

/* Table */
.tbl { border-collapse: collapse; width: 100%; }
.tbl th { font-weight: 500; color: var(--mute); font-size: 13px; text-align: right; padding: 8px 6px; border-bottom: 1px solid var(--line-strong); }
.tbl td { padding: 0 6px; border-bottom: 1px solid var(--line); text-align: right; height: 46px; }
.tbl .l { text-align: left; }
.tbl abbr { text-decoration: none; }
.namecell { display: flex; flex-wrap: wrap; align-items: center; column-gap: 8px; }

/* Lines */
.line { display: flex; justify-content: space-between; gap: 12px; align-items: center; min-height: 46px; border-bottom: 1px solid var(--line); }
.line .right { display: flex; align-items: center; gap: 12px; min-width: 0; }
.line.wrap { flex-wrap: wrap; padding: 6px 0; }
.line-row { display: grid; grid-template-columns: 72px minmax(0, 1fr) auto; gap: 12px; align-items: center; min-height: 46px; border-bottom: 1px solid var(--line); }
.line-row.four { grid-template-columns: 72px minmax(0, 1fr) auto auto; }
.line-row.expense { grid-template-columns: 64px minmax(0, 1fr) auto; }
.v { color: var(--mute); }

/* Buttons and tags */
.ed { display: inline-flex; align-items: center; justify-content: center; background: none; border: 1px solid var(--btn-border); border-radius: 3px; padding: 0 12px; min-height: 44px; min-width: 44px; font-size: 14px; color: var(--btn-fg); cursor: pointer; text-decoration: none; }
.ed:hover { border-color: var(--fg); color: var(--fg); }
.tag { display: inline-block; border: 1px solid var(--btn-border); color: var(--btn-fg); font-size: 12px; font-weight: 600; line-height: 1; padding: 4px 7px; border-radius: 3px; white-space: nowrap; }
.badge { display: inline-block; color: #000; font-size: 12px; font-weight: 700; line-height: 1; padding: 4px 7px; border-radius: 3px; white-space: nowrap; }
.badge.w { background: var(--women); }
.badge.m { background: var(--men); }
.res-w { background: var(--fg); color: var(--bg); font-weight: 700; padding: 3px 8px; border-radius: 3px; font-size: 14px; }
.res-l { border: 1px solid var(--btn-border); color: var(--btn-fg); padding: 2px 7px; border-radius: 3px; font-size: 14px; }

/* Player page */
.panels { display: flex; flex-direction: column; gap: 12px; padding-top: 32px; }
.panel { border: 1px solid var(--btn-border); border-radius: 4px; padding: 16px; }
.panel.next { border-color: var(--fg); }
.panel .big { font-size: 40px; margin-top: 6px; }
.week-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.week-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 52px; border-radius: 4px; font-size: 18px; font-weight: 700; line-height: 1.1; text-decoration: none; border: 2px solid var(--fg); color: var(--fg); }
.week-btn small { font-size: 12px; font-weight: 500; }
.week-btn.paid { border: 1px solid var(--line-strong); color: #8a8a8a; text-decoration: line-through; text-decoration-thickness: 2px; }
body.light .week-btn.paid { color: #7a766c; }

/* Finance */
.finance-balance { font-family: var(--font-cond); font-weight: 700; font-size: 88px; line-height: .9; }
.owing-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 12px; align-items: center; padding: 4px 0 10px; border-bottom: 1px solid var(--line); }
.owing-row .mute { grid-column: 1 / -1; }
.week-row { padding: 2px 0 10px; border-bottom: 1px solid var(--line); }
.week-row .top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.week-row .mid { display: flex; justify-content: space-between; gap: 12px; }
.missed { margin-top: 4px; font-size: 14px; color: var(--owed); }

/* Flash and forms */
.flash { margin: 8px 0 16px; padding: 12px 16px; border: 1px solid var(--fg); border-radius: 4px; }
.errors { margin: 8px 0 16px; padding: 12px 16px; border: 2px solid var(--owed); border-radius: 4px; color: var(--fg); }
.errors p { margin: 0 0 4px; font-weight: 700; }
.errors ul { margin: 0; padding-left: 20px; }

.label { display: block; font-weight: 600; margin-bottom: 4px; }
.field { width: 100%; min-height: 44px; padding: 8px 12px; background: var(--field-bg); border: 1px solid var(--fg); border-radius: 3px; }
textarea.field { min-height: 160px; font-family: ui-monospace, Menlo, monospace; font-size: 15px; line-height: 1.5; }
select.field { appearance: auto; }
/* Date inputs ignore width on iOS and push past the edge unless told off */
input[type="date"].field { -webkit-appearance: none; appearance: none; display: block; min-width: 0; max-width: 100%; text-align: left; }
input[type="date"].field::-webkit-date-and-time-value { text-align: left; min-height: 1.4em; }
.date-sm { flex: 0 1 160px; width: 160px; }
.hint { color: var(--mute); font-size: 14px; margin: 4px 0 0; }
.stack > * + * { margin-top: 16px; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.cols > * { min-width: 0; }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 20px; background: var(--fg); color: var(--bg); border: 1px solid var(--fg); border-radius: 3px; font-weight: 700; cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--hover); color: var(--bg); }
.btn.ghost { background: transparent; color: var(--fg); border-color: var(--btn-border); font-weight: 600; }
.btn.ghost:hover { border-color: var(--fg); color: var(--fg); background: transparent; }
.btn.danger { background: var(--owed); border-color: var(--owed); color: #fff; }
body:not(.light) .btn.danger { color: #000; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.card { border: 1px solid var(--line-strong); border-radius: 4px; padding: 16px; }
.card + .card { margin-top: 16px; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 4px 12px; }
.checks label { display: flex; align-items: center; gap: 8px; min-height: 36px; }
.checks input { width: 20px; height: 20px; }

/* Admin */
.admin-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 16px; padding-bottom: 4px; }
.admin-nav { display: flex; flex-wrap: wrap; gap: 0 18px; border-bottom: 1px solid var(--line-strong); padding-bottom: 4px; margin-bottom: 8px; }
.admin-nav a { display: inline-flex; align-items: center; min-height: 44px; text-decoration: none; color: var(--mute); font-weight: 500; border-bottom: 2px solid transparent; }
.admin-nav a[aria-current] { color: var(--fg); font-weight: 700; border-bottom-color: var(--fg); }
.admin-tag { display: inline-block; background: var(--fg); color: var(--bg); font-size: 12px; font-weight: 700; line-height: 1; padding: 4px 7px; border-radius: 3px; margin-left: 8px; vertical-align: middle; }
.linkbtn { background: none; border: 0; padding: 0; text-decoration: underline; text-underline-offset: 4px; cursor: pointer; color: var(--mute); min-height: 44px; }
.plain { list-style: none; margin: 0; padding: 0; }
.check-ok::before { content: '✓ '; font-weight: 700; }
.check-todo::before { content: '○ '; color: var(--mute); }
.bar { height: 6px; background: var(--fg); border-radius: 3px; min-width: 2px; }
.weekblock { padding: 12px 0; border-bottom: 1px solid var(--line); }
.weekblock h3 { margin: 0; font-size: 16px; display: flex; justify-content: space-between; gap: 12px; }
.weekblock ul { margin: 8px 0 0; padding-left: 20px; }
.okline::before { content: '✓ '; font-weight: 700; }
.badline { color: var(--owed); font-weight: 600; }
table.plain-tbl { border-collapse: collapse; width: 100%; }
table.plain-tbl td, table.plain-tbl th { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: left; }
table.plain-tbl th { color: var(--mute); font-weight: 500; font-size: 14px; }

@media (max-width: 420px) {
    .hero-big { font-size: 88px; }
    .cols { grid-template-columns: 1fr; }
}

/* League leaders */
tr.lead-w { background: #ffb5471f; }
tr.lead-m { background: #6cc4ff1f; }
tr.lead-w .nm { color: var(--women); font-weight: 700; }
tr.lead-m .nm { color: var(--men); font-weight: 700; }
tr .nm { font-weight: 500; }
