/* Dark is the default: the match console is used in a sports hall in the evening, and a white
   screen there is unusable. Light exists for the landing page, which people read at a desk.
   Only the surface colours swap; team colours come from the club and never change. */

/* Any class that sets display beats the browser's own [hidden] rule, and the element stays on
   screen with nothing in the JavaScript to explain why. The confirmation box shipped like that
   once — visible from page load, its close button doing nothing. One rule, never again. */
[hidden] { display: none !important; }

:root, :root[data-theme="dark"] {
  --bg: #020617; --card: #0f172a; --border: #1e293b;
  --text: #ffffff; --dim: #94a3b8; --muted: #64748b;
  --gold: #f59e0b; --shadow: 0 1px 3px rgba(0,0,0,.4);
  --team-a: #ff5500; --team-b: #00ff00;
}
:root[data-theme="light"] {
  --bg: #f8fafc; --card: #ffffff; --border: #e2e8f0;
  --text: #0f172a; --dim: #475569; --muted: #64748b;
  --gold: #b45309; --shadow: 0 1px 3px rgba(15,23,42,.08);
  --team-a: #ea580c; --team-b: #16a34a;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f8fafc; --card: #ffffff; --border: #e2e8f0;
    --text: #0f172a; --dim: #475569; --muted: #64748b;
    --gold: #b45309; --shadow: 0 1px 3px rgba(15,23,42,.08);
    --team-a: #ea580c; --team-b: #16a34a;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: 'Segoe UI', system-ui, sans-serif; line-height: 1.5; }
a { color: var(--gold); text-decoration: none; }
h1 { font-size: 26px; margin: 0 0 10px; }
h2 { font-size: 19px; margin: 0 0 8px; }
h3 { font-size: 15px; margin: 18px 0 6px; }

.nav { display: flex; justify-content: space-between; align-items: center; gap: 12px;
       padding: 12px 16px; background: var(--card); border-bottom: 2px solid var(--border); flex-wrap: wrap; }
.nav .logo { font-weight: 900; font-size: 17px; color: var(--text); }
.nav nav { display: flex; align-items: center; gap: 14px; font-size: 14px; }
.nav-user { color: var(--dim); font-size: 12px; }
.wrap { max-width: 860px; margin: 0 auto; padding: 20px 16px 60px; }
.foot { border-top: 1px solid var(--border); padding: 18px 16px; color: var(--dim);
        font-size: 12px; display: flex; justify-content: space-between; gap: 12px; }

.btn { display: inline-block; padding: 10px 16px; border-radius: 8px; border: none; background: var(--gold);
       color: #1a1300; font-weight: 800; cursor: pointer; font-size: 14px; }
.btn--ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn--big { padding: 14px 22px; font-size: 15px; }
.btn--wide { width: 100%; }

/* Full width of the column, edge to edge on a phone: the picture is the pitch and it earns it. */
.hero-img { display: block; width: 100%; height: auto; border-radius: 14px;
            border: 1px solid var(--border); box-shadow: var(--shadow); margin: 20px 0 4px; }
.app-shot { width: 100%; max-width: 200px; height: auto; display: block; margin: 0 auto 8px;
            border-radius: 12px; }
.shot-caption { text-align: center; font-size: 13px; font-weight: 700; color: var(--gold);
                margin: 0 0 12px; }

/* A 9:16 clip beside its text: on a phone it stacks and fills the width, on a desktop the
   portrait video keeps its natural size instead of stretching into a letterbox. */
.promo { display: flex; gap: 26px; align-items: center; flex-wrap: wrap; }
.promo > div { flex: 1; min-width: 240px; }
.promo-video { width: 100%; max-width: 280px; height: auto; border-radius: 14px;
               border: 1px solid var(--border); box-shadow: var(--shadow); display: block;
               background: #000; }
iframe.promo-video { aspect-ratio: 9 / 16; }

/* The YouTube stand-in. Same size and shape as the real player, so nothing shifts when it is
   swapped in on click. */
.promo-video.yt { aspect-ratio: 9 / 16; background-size: cover; background-position: center;
                  cursor: pointer; position: relative; }
.promo-video.yt:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.yt-play { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
           font-size: 34px; color: #fff; text-shadow: 0 2px 12px rgba(0,0,0,.6); }
.promo-video.yt::after { content: ''; position: absolute; inset: 0; border-radius: 13px;
                         background: radial-gradient(circle at center, rgba(0,0,0,.35), rgba(0,0,0,.05)); }
.yt-play { z-index: 1; }

.hero { padding: 30px 0 10px; }
.hero h1 { font-size: 38px; line-height: 1.15; }
.lead { color: var(--dim); font-size: 17px; max-width: 40em; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; margin: 18px 0 6px; }
.hero-alt { background: var(--card); border: 1px solid var(--border); border-left: 3px solid var(--gold);
            border-radius: 10px; padding: 12px 16px; margin: 18px 0 0; font-size: 14px;
            color: var(--dim); max-width: 40em; }
.hero-alt a { color: var(--gold); }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; margin: 28px 0; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 16px; }
.card h3 { margin-top: 0; color: var(--gold); }
.card p { color: var(--dim); font-size: 14px; margin: 0; }

.theme-toggle { background: transparent; border: 1px solid var(--border); color: var(--text);
                border-radius: 8px; width: 34px; height: 34px; cursor: pointer; font-size: 15px; }

/* Language picker. Eight of them in a row swallowed the header, so they fold into a native
   <details> — no script, and the links are still in the markup for anything that reads it. */
.langs { position: relative; }
.langs summary { list-style: none; cursor: pointer; border: 1px solid var(--border);
                 border-radius: 8px; padding: 7px 10px; font-size: 13px; font-weight: 700;
                 color: var(--text); user-select: none; }
.langs summary::-webkit-details-marker { display: none; }
.langs-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20;
              background: var(--card); border: 1px solid var(--border); border-radius: 10px;
              box-shadow: 0 8px 24px rgba(0,0,0,.35); padding: 6px; min-width: 150px;
              display: flex; flex-direction: column; }
.langs-menu a { padding: 8px 12px; border-radius: 6px; color: var(--text); font-size: 14px;
                white-space: nowrap; }
.langs-menu a:hover { background: var(--bg); }
.langs-menu a.on { color: var(--gold); font-weight: 700; }

section { margin: 0 0 46px; }
section h2 { font-size: 24px; margin-bottom: 14px; }

/* The three steps: pictures first on a phone, side by side once there is room. */
.steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 22px;
         grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.steps li { background: var(--card); border: 1px solid var(--border); border-radius: 14px;
            padding: 16px; box-shadow: var(--shadow); }
.steps img { width: 100%; height: auto; max-width: 260px; display: block; margin: 0 auto 10px; }
.steps h3 { margin: 0 0 6px; font-size: 16px; color: var(--gold); }
.steps p { color: var(--dim); font-size: 14px; margin: 0; }

.card { box-shadow: var(--shadow); }
.card p + p { margin-top: 10px; }

/* Screenshots are tall, so the grid fits as many 260px columns as it can rather than forcing
   four across. The one phone screenshot is ordered last in index.php — see the note there. */
.shots { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.shots figure { margin: 0; }
.shots img { width: 100%; height: auto; border-radius: 12px; border: 1px solid var(--border);
             box-shadow: var(--shadow); display: block; }
.shots figcaption { color: var(--dim); font-size: 13px; margin-top: 8px; }

/* Guide page: a jump list, numbered steps, and picture-beside-text rows that stack on a phone. */
.toc { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 36px; }
.toc a { background: var(--card); border: 1px solid var(--border); border-radius: 8px;
         padding: 7px 12px; font-size: 13px; font-weight: 600; color: var(--text); }
.toc a:hover { border-color: var(--gold); }

.steps-list { padding-left: 20px; color: var(--dim); }
.steps-list li { margin-bottom: 10px; }
.steps-list b, .guide-row b { color: var(--text); }

.guide-row { display: grid; grid-template-columns: minmax(0, 260px) 1fr; gap: 24px;
             align-items: start; }
.guide-row img { width: 100%; height: auto; border-radius: 12px; border: 1px solid var(--border);
                 box-shadow: var(--shadow); }
.guide-row ul, .guide-row p { color: var(--dim); }
.guide-row ul { padding-left: 20px; }
.guide-row li { margin-bottom: 8px; }
@media (max-width: 620px) { .guide-row { grid-template-columns: 1fr; } }

/* Waiting-list progress bar. */
.meter { background: var(--bg); border: 1px solid var(--border); border-radius: 999px;
         height: 14px; overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--gold); border-radius: 999px; }

textarea { background: var(--bg); border: 1px solid var(--border); color: var(--text);
           padding: 10px; border-radius: 8px; font-size: 15px; font-family: inherit;
           width: 100%; margin-top: 4px; resize: vertical; }

.faq { background: var(--card); border: 1px solid var(--border); border-radius: 10px;
       padding: 12px 16px; margin-bottom: 8px; }
.faq summary { cursor: pointer; font-weight: 700; }
.faq p { color: var(--dim); font-size: 14px; margin: 10px 0 0; }

.cta-band { background: var(--card); border: 1px solid var(--border); border-radius: 14px;
            padding: 30px; text-align: center; box-shadow: var(--shadow); }
.cta-band h2 { margin-bottom: 6px; }
.cta-band .lead { margin: 0 auto 18px; }

.panel { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 18px; margin: 0 0 16px; }
.panel--narrow { max-width: 440px; margin: 24px auto; }
.panel-row { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; }
.inline-form { display: inline-flex; align-items: center; gap: 8px; margin: 8px 0 0; }
label { display: block; margin: 0 0 12px; font-size: 13px; color: var(--dim); }
label.check, label.check input { display: inline-block; margin: 0; }
label.check { color: var(--text); font-size: 13px; }
input, select { background: var(--bg); border: 1px solid var(--border); color: var(--text); padding: 10px;
                border-radius: 8px; font-size: 15px; font-family: inherit; width: 100%; margin-top: 4px; }
input[type=checkbox] { width: auto; }
.hint { color: var(--dim); font-size: 12px; }
.dim { color: var(--dim); } .gold { color: var(--gold); } .small { font-size: 12px; }
.strong { font-weight: 800; } .right { text-align: right; } .grow { flex-grow: 1; }
.code { font-family: ui-monospace, monospace; letter-spacing: 3px; color: var(--gold); }

.alert { padding: 10px 14px; border-radius: 8px; margin: 0 0 14px; font-size: 14px; }
.alert--error { background: #dc2626; color: #fff; }
.alert--ok { background: #16a34a; color: #fff; }
.alert--info { background: var(--card); border: 1px solid var(--border); }

.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th { color: var(--muted); text-transform: uppercase; font-size: 10px; text-align: left; padding: 10px; }
.table td { padding: 10px; border-bottom: 1px solid var(--border); font-weight: bold; }

/* ---------------- match console ---------------- */
.console { max-width: 760px; margin: 0 auto; padding-bottom: 20px; }
.nav-tabs { display: flex; background: var(--card); border-bottom: 2px solid var(--border); }
.tab { flex: 1; padding: 16px 6px; text-align: center; cursor: pointer; font-weight: 800;
       text-transform: uppercase; color: var(--muted); font-size: 13px; border-bottom: 4px solid transparent; }
.tab.active { color: var(--team-a); border-bottom-color: var(--team-a); }
.pane { display: none; padding: 15px; flex-direction: column; gap: 12px; }
.pane.active { display: flex; }
.row { display: flex; gap: 10px; align-items: center; background: var(--card); padding: 12px;
       border-radius: 10px; border: 1px solid var(--border); flex-wrap: wrap; }
.col-stack { flex-direction: column; align-items: stretch; }
.flex-row { display: flex; gap: 8px; align-items: center; }
.space-between { justify-content: space-between; }
.grp { margin: 0; }
.mini { font-size: 9px; font-weight: 800; color: var(--muted); text-transform: uppercase; }
.inp { width: 80px; text-align: center; font-weight: bold; margin: 0; }
.inp.wide { width: 100px; font-size: 12px; }
.inp.left { text-align: left; width: auto; }
.timer { font-size: 22px; font-weight: 900; color: var(--gold); cursor: pointer; }

.score-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.score-val { font-size: 55px; font-weight: 900; line-height: 1; }
.score-val.small-num { font-size: 30px; }
.ca { color: var(--team-a); } .cb { color: var(--team-b); }
.court { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.col { display: flex; flex-direction: column; gap: 6px; }
.p-card { border: 1px solid var(--border); border-radius: 10px; padding: 8px 5px; text-align: center;
          cursor: pointer; background: var(--card); }
.p-card.sel { border: 2px solid var(--gold); background: rgba(245,158,11,.1); }
/* Substituted off but already on the scoresheet: still shown so the totals add up. */
.p-card.off { opacity: .5; }
.p-name { font-size: 11px; font-weight: 800; text-transform: uppercase; display: block; margin-bottom: 3px; color: var(--text); }
.p-pts { color: var(--team-a); font-size: 22px; }

.log { background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 10px;
       height: 110px; overflow-y: auto; font-size: 12px; color: var(--dim); }
.log.tall { height: 140px; }
.log-item { display: flex; justify-content: space-between; align-items: center;
            padding: 5px 0; border-bottom: 1px solid var(--border); }
.del { color: #ef4444; font-weight: 800; cursor: pointer; }

.admin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.admin-card { background: var(--card); padding: 10px; border-radius: 10px;
              display: flex; justify-content: space-between; align-items: center;
              border: 1px solid var(--border); gap: 10px; }
.admin-card.clickable { cursor: pointer; }
.admin-card.in { border-color: var(--team-b); background: rgba(34, 197, 94, .08); }

/* Fixed name column, so the colour and in/out buttons line up down the grid instead of
   drifting with the length of each nickname. Delete then sits alone at the far right, half a
   card away from the two buttons that get pressed every week — the one that cannot be undone
   should never be next to the ones that can. */
.admin-left { display: flex; align-items: center; gap: 8px; min-width: 0; flex: none; }
.pname { font-size: 12px; font-weight: bold; width: 108px; flex: none;
         overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team-btn { border: none; color: #fff; border-radius: 6px; font-size: 13px; font-weight: 900;
            width: 36px; height: 32px; cursor: pointer; flex-shrink: 0; }
.inout-btn { border: none; color: #fff; border-radius: 6px; font-size: 10px; font-weight: bold;
             width: 52px; height: 32px; cursor: pointer; flex-shrink: 0; }
.x-btn { background: #ef4444; border: none; color: #fff; border-radius: 6px; font-size: 11px;
         font-weight: bold; width: 34px; height: 32px; cursor: pointer; flex-shrink: 0;
         margin-left: auto; }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.swatch { width: 26px; height: 26px; border-radius: 6px; cursor: pointer; border: 2px solid transparent; }
.swatch.on { border-color: var(--text); }
.admin-card.out { border-color: #ef4444; background: rgba(239, 68, 68, .10); }
.admin-card.out .nm { color: #ef4444; }

.su-list { display: flex; flex-direction: column; gap: 6px; margin: 12px 0; }
/* A heading per group with its own count, so "who is missing" is read rather than worked out. */
.su-head { display: flex; justify-content: space-between; align-items: baseline;
           margin: 14px 0 2px; font-size: 11px; font-weight: 800; letter-spacing: .06em;
           text-transform: uppercase; color: var(--muted); }
.su-head b { color: var(--text); font-size: 13px; }
.su-head:first-child { margin-top: 0; }

/* Confirmation box for signing in and out. Fixed rather than a native <dialog>: this page is
   opened on whatever phone the group chat happened to reach. */
.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center;
         justify-content: center; padding: 16px; background: rgba(2, 6, 23, .72); }
.modal-box { background: var(--card); border: 1px solid var(--border); border-radius: 14px;
             box-shadow: var(--shadow); padding: 20px; width: 100%; max-width: 340px;
             display: flex; flex-direction: column; gap: 10px; text-align: center; }
.modal-name { font-size: 20px; font-weight: 900; }
.btn--danger { background: #ef4444; border-color: #ef4444; color: #fff; }
.stats-box { background: var(--card); border: 1px solid var(--border); border-radius: 10px;
             padding: 12px; margin-top: 16px; text-align: left; }
.stats-box summary { cursor: pointer; font-weight: 800; color: var(--gold);
                     text-transform: uppercase; font-size: 13px; }
.stats-box[open] summary { margin-bottom: 10px; }

.footer { background: var(--card); border-top: 2px solid var(--border); padding: 15px;
          position: sticky; bottom: 0; }
.scorer-label { text-align: center; font-size: 11px; color: var(--gold); font-weight: 800;
                margin-bottom: 10px; text-transform: uppercase; }
.pts-grid { display: grid; grid-template-columns: 1fr 2fr; gap: 10px; margin-bottom: 12px; }
.btn-pts { height: 55px; border-radius: 10px; border: none; font-weight: 900; font-size: 22px;
           cursor: pointer; color: #fff; }
.btn-pts.minus { background: #1e293b; color: #ef4444; }
.btn-pts.plus { background: var(--gold); color: #1a1300; }
