/* 5-a-side Booker: muted blues, with black and white accents. */
:root {
  color-scheme: dark;
  --bg-top: #34497a;
  --bg-bottom: #243358;
  --surface: #41588c;        /* cards */
  --surface-soft: #4b639a;   /* hover / inner panels */
  --field: rgba(15, 20, 36, .28);
  --line: rgba(255, 255, 255, .12);
  --hero-a: #5f7bc2;
  --hero-b: #3f5a9f;
  --cornflower: #6f8bd0;     /* team blue */
  --powder: #c6d3f2;         /* light accent */
  --powder-strong: #dbe4f8;
  --ink: #0f1424;            /* black elements */
  --white: #fff;
  --text-soft: #e1e8f7;
  --muted: #c0cce9;
  --radius: 18px;
  --shadow: 0 6px 20px rgba(10, 16, 36, .25);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg-bottom); }
body {
  margin: 0; min-height: 100vh; color: var(--white);
  background: linear-gradient(180deg, var(--bg-top) 0%, var(--bg-bottom) 100%) no-repeat;
  background-color: var(--bg-bottom);
  font-family: Inter, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased;
}
svg.i { width: 1em; height: 1em; vertical-align: -.125em; flex: none; }

/* Header */
header {
  position: sticky; top: 0; z-index: 10;
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 20px; background: var(--ink); color: var(--white);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--white); text-decoration: none; cursor: pointer; }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; background: var(--cornflower); display: grid; place-items: center; }
.brand-mark svg { width: 16px; height: 16px; }
.brand-name { font-weight: 800; letter-spacing: .04em; text-transform: uppercase; font-size: .95rem; }
.brand-name span { font-weight: 400; opacity: .6; text-transform: none; letter-spacing: 0; margin-left: 4px; }
header .pill, header .who {
  background: transparent; color: var(--white); border: 1px solid rgba(255,255,255,.28);
  border-radius: 999px; padding: 6px 14px; font-size: .82rem; font-weight: 600;
}
header .pill:hover { background: rgba(255,255,255,.1); }
header .who:empty { display: none; }

main { max-width: 680px; margin: 0 auto; padding: 20px 16px 48px; }
h1 { font-size: 1.75rem; line-height: 1.15; letter-spacing: -.02em; margin: 6px 0 16px; font-weight: 800; }
h2 { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 12px; font-weight: 700; }
.muted { color: var(--muted); font-size: .9rem; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--powder); font-weight: 600; text-decoration: none; font-size: .9rem; background: none; border: 0; padding: 0; cursor: pointer; }
.back:hover { background: none; color: var(--white); }
.empty { text-align: center; padding: 36px 16px; color: var(--muted); }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 14px; box-shadow: var(--shadow); }

/* Game list */
.game {
  display: flex; gap: 14px; align-items: stretch; color: inherit; text-decoration: none; cursor: pointer;
  transition: transform .15s ease, background .15s ease;
}
.game:hover { transform: translateY(-2px); background: var(--surface-soft); }
.date-tile {
  flex: none; width: 58px; border-radius: 12px; background: var(--powder); color: var(--ink);
  display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 8px 0;
}
.date-tile.locked { background: var(--ink); color: var(--white); }
.date-tile .dow, .date-tile .mon { font-size: .68rem; text-transform: uppercase; letter-spacing: .1em; opacity: .7; font-weight: 600; }
.date-tile .day { font-size: 1.5rem; font-weight: 800; line-height: 1.1; }
.game-body { flex: 1; min-width: 0; }
.game .row { align-items: flex-start; }
.game-title { font-weight: 700; font-size: 1.02rem; }
.game-meta { color: var(--muted); font-size: .85rem; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.game-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; font-size: .82rem; color: var(--text-soft); font-weight: 600; }
.game-foot .muted { font-weight: 500; }

/* Progress */
.bar { height: 6px; background: rgba(255,255,255,.14); border-radius: 999px; overflow: hidden; margin-top: 10px; }
.bar > div { height: 100%; background: var(--powder); border-radius: 999px; transition: width .3s ease; }

/* Badges */
.badges { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: .74rem; font-weight: 700; white-space: nowrap; }
.badge.open { background: rgba(198, 211, 242, .2); color: var(--powder-strong); }
.badge.full { background: transparent; color: var(--white); border: 1px solid rgba(255,255,255,.6); }
.badge.locked { background: var(--ink); color: var(--white); }
.badge.you { background: var(--white); color: var(--ink); }

/* Game hero */
.hero {
  background: linear-gradient(135deg, var(--hero-a) 0%, var(--hero-b) 100%);
  color: var(--white); border-radius: 22px; padding: 22px 20px; margin: 12px 0 14px;
  border: 1px solid rgba(255,255,255,.14); box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.hero::after {
  content: ''; position: absolute; right: -60px; top: -60px; width: 200px; height: 200px;
  border-radius: 50%; border: 28px solid rgba(255,255,255,.07);
}
.hero h1 { margin: 0 0 6px; }
.hero .meta { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .9rem; color: var(--text-soft); }
.hero .meta span { display: inline-flex; align-items: center; gap: 6px; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; position: relative; z-index: 1; }
.stat { background: rgba(15, 20, 36, .18); border: 1px solid rgba(255,255,255,.14); border-radius: 12px; padding: 10px 12px; }
.stat .label { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-soft); }
.stat .value { font-size: 1.15rem; font-weight: 800; margin-top: 2px; display: flex; align-items: center; gap: 6px; }
.lockchip { display: inline-flex; align-items: center; gap: 8px; margin-top: 14px; padding: 7px 12px; border-radius: 999px; background: var(--white); color: var(--ink); font-size: .82rem; font-weight: 600; position: relative; z-index: 1; }
.lockchip.locked { background: var(--ink); color: var(--white); }

/* Status line ("You're in") */
.status { display: flex; align-items: center; gap: 12px; font-weight: 600; }
.status .dot { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--white); color: var(--ink); }
.status .dot.wait { background: transparent; color: var(--white); border: 1.5px solid rgba(255,255,255,.7); }
.status .dot.closed { background: var(--ink); color: var(--white); }
.status small { display: block; font-weight: 400; color: var(--muted); }

/* Buttons */
button, .btn {
  font: inherit; font-weight: 600; background: var(--white); color: var(--ink); border: 0; white-space: nowrap;
  border-radius: 12px; padding: 12px 18px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: background .15s ease, transform .05s ease;
}
button:hover { background: var(--powder-strong); }
button:active { transform: scale(.98); }
button:disabled { opacity: .45; cursor: default; }
button.secondary { background: rgba(255,255,255,.1); color: var(--white); border: 1px solid var(--line); }
button.secondary:hover { background: rgba(255,255,255,.18); }
button.dark, button.danger { background: var(--ink); color: var(--white); }
button.dark:hover, button.danger:hover { background: #222a40; }
button.small { padding: 6px 12px; font-size: .82rem; border-radius: 9px; }
button.ghost { background: transparent; color: var(--muted); padding: 6px 8px; font-size: .82rem; }
button.ghost:hover { color: var(--white); background: rgba(255,255,255,.1); }
button.link { background: none; color: var(--powder); padding: 0; }

/* Form fields */
input, select {
  font: inherit; width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--field); color: var(--white); outline: none; transition: border-color .15s, box-shadow .15s;
}
input::placeholder { color: rgba(225, 232, 247, .6); }
input:focus, select:focus { border-color: var(--powder); box-shadow: 0 0 0 4px rgba(198, 211, 242, .18); }
select option { background: var(--surface); color: var(--white); }
form .fields { display: grid; gap: 12px; margin-bottom: 14px; grid-template-columns: 1fr 1fr; }
form .fields .wide { grid-column: 1 / -1; }
label { font-size: .75rem; font-weight: 600; color: var(--text-soft); display: grid; gap: 6px; }
.join { display: flex; gap: 8px; }
.join input { flex: 1; }

/* Player list */
ol.players { list-style: none; margin: 0; padding: 0; counter-reset: p; }
ol.players li { counter-increment: p; display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
ol.players li:last-child { border-bottom: 0; }
ol.players li::before {
  content: counter(p); width: 28px; height: 28px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-size: .78rem; font-weight: 700; background: var(--powder); color: var(--ink);
}
ol.players.waiting li::before { background: transparent; color: var(--white); border: 1px solid rgba(255,255,255,.4); }
ol.players li .name { flex: 1; font-weight: 600; display: flex; align-items: center; gap: 8px; min-width: 0; }
.subhead { margin-top: 20px; }

/* Teams */
.teams { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.team { border-radius: 14px; padding: 14px; color: var(--white); border: 1px solid rgba(255,255,255,.12); }
.team.a { background: var(--cornflower); }
.team.b { background: var(--ink); }
.team h3 { margin: 0 0 10px; font-size: .78rem; text-transform: uppercase; letter-spacing: .1em; display: flex; justify-content: space-between; }
.team ul { list-style: none; margin: 0; padding: 0; }
.team li { padding: 6px 0; border-top: 1px solid rgba(255,255,255,.16); font-weight: 600; }
.team li:first-child { border-top: 0; }

/* Organiser */
.admin { background: #364b7c; border: 1px dashed rgba(255,255,255,.35); position: relative; padding-top: 26px; }
.admin-tag {
  position: absolute; top: -10px; left: 16px; background: var(--ink); color: var(--white);
  font-size: .66rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; padding: 3px 10px; border-radius: 999px;
}
.admin .actions { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 4px; }

.notice { border-left: 4px solid var(--powder); }
#toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 20;
  background: var(--white); color: var(--ink); padding: 12px 20px; border-radius: 999px;
  font-weight: 600; font-size: .9rem; max-width: 90%; box-shadow: 0 10px 30px rgba(0,0,0,.3);
}

/* Organiser sign-in sheet */
.sheet { position: fixed; inset: 0; z-index: 30; background: rgba(10, 14, 28, .6); display: flex; align-items: center; justify-content: center; padding: 16px; backdrop-filter: blur(3px); }
.sheet .card { width: 100%; max-width: 360px; margin: 0; }
.sheet .row button { margin-left: 8px; }

@media (max-width: 480px) {
  h1 { font-size: 1.5rem; }
  form .fields { grid-template-columns: 1fr; }
}

/* WhatsApp share buttons */
a.btn { text-decoration: none; }
.btn.small { padding: 6px 12px; font-size: .82rem; border-radius: 9px; }
.btn.wa { background: var(--white); color: var(--ink); }
.btn.wa:hover { background: var(--powder-strong); }
.btn.wa.outline { background: transparent; color: var(--white); border: 1px solid rgba(255,255,255,.4); }
.btn.wa.outline:hover { background: rgba(255,255,255,.1); }
.share { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.share > :only-child { grid-column: 1 / -1; }
.btn-row { display: flex; gap: 8px; }
@media (max-width: 380px) { .share { grid-template-columns: 1fr; } }
.share .btn { min-width: 0; padding: 12px 10px; font-size: .9rem; white-space: normal; text-align: center; }

/* Location map */
.map { border-radius: 14px; overflow: hidden; border: 1px solid var(--line); background: var(--field); aspect-ratio: 16 / 10; }
.map iframe { display: block; width: 100%; height: 100%; border: 0; filter: saturate(.85); }
.btn.outline { background: transparent; color: var(--white); border: 1px solid rgba(255,255,255,.4); }
.btn.outline:hover { background: rgba(255,255,255,.1); }
.small-print { font-size: .78rem; margin: 10px 0 0; line-height: 1.4; }

/* ---------- Home: players | organisers ---------- */
body[data-mode="home"] main { max-width: none; padding: 0; }
.split { display: grid; grid-template-columns: 1fr 1fr; min-height: calc(100vh - 58px); min-height: calc(100dvh - 58px); }
.half {
  position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center;
  padding: 40px 28px; color: var(--white); text-decoration: none; isolation: isolate;
}
.half::after {
  content: ''; position: absolute; z-index: -1; right: -90px; bottom: -90px; width: 300px; height: 300px;
  border-radius: 50%; border: 40px solid rgba(255,255,255,.07); transition: transform .4s ease;
}
.half:hover::after { transform: scale(1.12); }
.half.players { background: linear-gradient(160deg, #7590d4 0%, #4d68ad 100%); }
.half.organisers { background: linear-gradient(160deg, #1d2645 0%, var(--ink) 100%); }
.half-inner { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 14px; }
.half h1 { font-size: 2.3rem; margin: 0; }
.half p { margin: 0; color: var(--text-soft); font-size: 1rem; }
.kicker {
  display: inline-flex; align-items: center; gap: 8px; align-self: flex-start;
  font-size: .75rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  padding: 6px 12px; border-radius: 999px; background: rgba(255,255,255,.14);
}
.teaser {
  display: grid; gap: 2px; padding: 12px 14px; border-radius: 14px;
  background: rgba(15, 20, 36, .18); border: 1px solid rgba(255,255,255,.14); font-size: .92rem;
}
.half.organisers .teaser { background: rgba(255,255,255,.06); }
.teaser .label { font-size: .68rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 700; }
.cta {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 10px; margin-top: 4px;
  padding: 13px 20px; border-radius: 12px; font-weight: 700; transition: gap .2s ease;
}
.half.players .cta { background: var(--ink); color: var(--white); }
.half.organisers .cta { background: var(--white); color: var(--ink); }
.half:hover .cta { gap: 16px; }

@media (max-width: 720px) {
  .split { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; }
  .half { padding: 28px 22px; }
  .half h1 { font-size: 1.9rem; }
  .half-inner { gap: 12px; }
}

/* ---------- Spaces ---------- */
.page-title { margin-top: 10px; }
header .pill { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
header .pill.quiet { cursor: default; opacity: .75; }
header .pill.quiet:hover { background: transparent; }
body[data-mode="organiser"] header { box-shadow: inset 0 -3px 0 var(--cornflower); }
.stats.dash { margin: 0 0 6px; }
.stats.dash .stat { background: var(--surface); }

/* Organiser sign-in */
.login { max-width: 400px; margin: 0 auto; }
.login-card { display: grid; gap: 12px; text-align: center; padding: 28px 22px; margin-top: 14px; }
.login-card h1 { margin: 0; font-size: 1.5rem; }
.login-card p { margin: 0 0 4px; }
.login-icon { width: 56px; height: 56px; border-radius: 16px; margin: 0 auto 4px; background: var(--ink); display: grid; place-items: center; }
.login-icon svg { width: 26px; height: 26px; }
@media (max-width: 720px) {
  .half { padding: 20px 22px; }
  .half p { display: none; }
  .half h1 { font-size: 1.7rem; }
  .half-inner { gap: 10px; }
  .teaser { padding: 10px 12px; font-size: .88rem; }
  .cta { padding: 11px 18px; }
}

/* Payment */
.pay-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.pay-each { font-size: 2rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.pay-each span { font-size: .95rem; font-weight: 600; color: var(--muted); }
.pay-icon { width: 44px; height: 44px; border-radius: 12px; background: var(--powder); color: var(--ink); display: grid; place-items: center; flex: none; }
.pay-icon svg { width: 22px; height: 22px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; font-size: .74rem; font-weight: 700;
  background: transparent; color: var(--muted); border: 1px solid rgba(255,255,255,.3); white-space: nowrap;
}
.chip.on { background: var(--powder); color: var(--ink); border-color: var(--powder); }
button.chip:hover { background: rgba(255,255,255,.12); }
button.chip.on:hover { background: var(--powder-strong); }
