:root {
  /* taken from the club crest */
  --navy:       #263D80;
  --navy-deep:  #1B2E63;
  --navy-ink:   #111C40;
  --red:        #DF1E27;
  --red-deep:   #BB171E;

  --paper:  #F1F3F8;
  --card:   #FFFFFF;
  --ink:    #131C36;
  --muted:  #667090;
  --hair:   #DBE0EC;

  --radius: 10px;
  --pad:    18px;
  --nav-h:  66px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior-y: none;
}

h1, h2, h3, .num {
  font-family: "Barlow Condensed", Inter, sans-serif;
  font-weight: 600;
  margin: 0;
}

a { color: var(--navy); }

.app {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100vh;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
}

.boot { display: grid; place-content: center; min-height: 70vh; opacity: .5; }

/* ---------- top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px var(--pad);
  background: var(--navy);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 3px solid var(--red);
  padding-top: calc(11px + env(safe-area-inset-top));
}
.topbar img { height: 36px; width: auto; display: block; }
.topbar .club {
  font-family: "Barlow Condensed", sans-serif;
  font-weight: 700;
  font-style: italic;
  font-size: 21px;
  line-height: 1;
  letter-spacing: .01em;
}
.topbar .club small {
  display: block;
  font-style: normal;
  font-weight: 500;
  font-size: 10.5px;
  letter-spacing: .09em;
  color: #A9B8DF;
  font-family: Inter, sans-serif;
  margin-top: 3px;
}
.topbar .who { margin-left: auto; font-size: 12.5px; color: #B7C4E4; text-align: right; line-height: 1.35; }

/* ---------- layout ---------- */
.view { padding: var(--pad); display: grid; gap: 15px; }

.card {
  background: var(--card);
  border: 1px solid var(--hair);
  border-radius: var(--radius);
  padding: 16px;
}
.card h2 { font-size: 21px; }
.card .sub { color: var(--muted); font-size: 13.5px; margin: 3px 0 0; }

/* ---------- scoreboard hero ---------- */
.board {
  background: linear-gradient(150deg, var(--navy) 0%, var(--navy-deep) 100%);
  color: #fff;
  border-radius: var(--radius);
  padding: 20px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 18px;
  align-items: center;
  position: relative;
  overflow: hidden;
}
.board::after {
  content: "";
  position: absolute;
  right: -34px; top: -26px;
  width: 168px; height: 168px;
  background: url("/logo.png") no-repeat center / contain;
  opacity: .07;
  pointer-events: none;
}
.board .rate {
  font-family: "Barlow Condensed", sans-serif;
  font-weight: 700;
  font-style: italic;
  font-size: 70px;
  line-height: .8;
  font-variant-numeric: tabular-nums;
}
.board .rate span { font-size: 25px; }
.board .caption { font-size: 13.5px; color: #B7C4E4; position: relative; }
.board .caption b { color: #fff; font-weight: 600; }
.board .split { display: flex; gap: 17px; margin-top: 9px; font-size: 12px; color: #A9B8DF; position: relative; }
.board .split b {
  display: block;
  font-family: "Barlow Condensed", sans-serif;
  font-size: 21px;
  color: #fff;
  font-weight: 600;
}

/* ---------- rows ---------- */
.rowitem {
  display: flex;
  gap: 11px;
  align-items: center;
  padding: 11px 0;
  border-bottom: 1px solid var(--hair);
}
.rowitem:last-child { border-bottom: 0; padding-bottom: 0; }
.rowitem .grow { flex: 1; min-width: 0; }
.rowitem .title { font-weight: 500; }
.rowitem .meta { font-size: 12.5px; color: var(--muted); }
.rowitem .acts { display: flex; gap: 5px; align-items: center; flex: none; }

.datechip {
  width: 44px;
  flex: none;
  text-align: center;
  border: 1px solid var(--hair);
  border-radius: 8px;
  overflow: hidden;
}
.datechip .d { font-family: "Barlow Condensed", sans-serif; font-size: 21px; line-height: 1.15; }
.datechip .m {
  font-size: 10px;
  letter-spacing: .04em;
  background: var(--navy);
  color: #fff;
  padding: 1px 0 2px;
}

.jersey {
  width: 30px; height: 30px;
  flex: none;
  display: grid;
  place-content: center;
  border-radius: 50%;
  background: var(--navy);
  color: #fff;
  font-family: "Barlow Condensed", sans-serif;
  font-weight: 700;
  font-size: 15px;
}
.jersey.off { background: var(--hair); color: var(--muted); }

.empty { color: var(--muted); font-size: 13.5px; padding: 6px 0; }

/* ---------- pills ---------- */
.pill {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 500;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--paper);
  color: var(--muted);
  white-space: nowrap;
}
.pill.ok     { background: #DEE6FA; color: var(--navy); }
.pill.late   { background: #FDE9CE; color: #8A5606; }
.pill.absent { background: #FBDEDF; color: var(--red-deep); }

/* ---------- forms ---------- */
label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }
.field { margin-bottom: 11px; }
input, select, textarea {
  width: 100%;
  font: inherit;
  font-size: 16px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--hair);
  border-radius: 8px;
  padding: 10px 12px;
}
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--navy);
  outline-offset: 1px;
}
textarea { min-height: 72px; resize: vertical; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }

button {
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  border: 0;
  border-radius: 8px;
  padding: 11px 16px;
  background: var(--navy);
  color: #fff;
}
button:disabled { opacity: .5; cursor: default; }
button.wide  { width: 100%; }
button.ghost { background: #fff; color: var(--navy); border: 1px solid var(--hair); }
button.small { padding: 6px 10px; font-size: 12.5px; border-radius: 7px; }
button.red   { background: var(--red); }
button.red.ghost { background: #fff; color: var(--red-deep); border-color: #F2C9CB; }

.btnrow { display: flex; gap: 8px; flex-wrap: wrap; }

.codeinput {
  font-family: "Barlow Condensed", sans-serif;
  font-weight: 700;
  font-size: 34px;
  letter-spacing: .22em;
  text-align: center;
  text-transform: uppercase;
  padding: 12px;
}

/* ---------- QR panel ---------- */
.qrpanel {
  background: var(--navy);
  border-radius: var(--radius);
  padding: 20px 20px 0;
  text-align: center;
  color: #fff;
  overflow: hidden;
}
.qrpanel canvas {
  background: #fff;
  padding: 11px;
  border-radius: 8px;
  width: min(290px, 74vw) !important;
  height: auto !important;
}
.qrpanel .band {
  background: var(--red);
  margin: 18px -34px 0;
  padding: 9px 34px 10px;
  transform: skewY(-2.5deg);
}
.qrpanel .code {
  font-family: "Barlow Condensed", sans-serif;
  font-weight: 700;
  font-style: italic;
  font-size: 38px;
  letter-spacing: .18em;
  line-height: 1.05;
  transform: skewY(2.5deg);
}
.qrpanel .hint { font-size: 12.5px; color: #B7C4E4; margin: 12px 0 18px; }

#reader { border-radius: 8px; overflow: hidden; }

/* ---------- table ---------- */
.tablewrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th, .table td { text-align: left; padding: 7px 6px; border-bottom: 1px solid var(--hair); white-space: nowrap; }
.table th { font-weight: 500; color: var(--muted); font-size: 11.5px; }
.table td.n, .table th.n { text-align: right; font-variant-numeric: tabular-nums; }
.table td.rate { font-family: "Barlow Condensed", sans-serif; font-size: 17px; font-weight: 600; }

/* ---------- bottom nav ---------- */
.nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: #fff;
  border-top: 1px solid var(--hair);
  display: flex;
  z-index: 30;
}
.nav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 10.5px;
  color: var(--muted);
  text-decoration: none;
  position: relative;
}
.nav a.on { color: var(--navy); }
.nav a.on::before {
  content: "";
  position: absolute;
  top: 0; left: 22%; right: 22%;
  height: 3px;
  background: var(--red);
  transform: skewX(-16deg);
}
.nav svg { width: 21px; height: 21px; }

/* ---------- login / setup ---------- */
.gate {
  min-height: 100vh;
  display: grid;
  align-content: center;
  gap: 18px;
  padding: 30px 24px calc(30px + env(safe-area-inset-bottom));
  background: linear-gradient(165deg, var(--navy) 0%, var(--navy-ink) 100%);
  color: #fff;
}
.gate .crest { text-align: center; }
.gate .crest img { width: 118px; height: auto; }
.gate .crest h1 {
  font-style: italic;
  font-weight: 700;
  font-size: 27px;
  margin-top: 12px;
  line-height: 1.05;
}
.gate .crest p { color: #A9B8DF; font-size: 13px; margin: 5px 0 0; }
.gate .box { background: #fff; color: var(--ink); border-radius: var(--radius); padding: 18px; }
.gate .box a { font-size: 12.5px; }

/* ---------- toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--nav-h) + 18px);
  transform: translate(-50%, 14px);
  background: var(--navy-ink);
  color: #fff;
  padding: 10px 15px;
  border-radius: 8px;
  font-size: 13.5px;
  max-width: 88vw;
  opacity: 0;
  pointer-events: none;
  transition: opacity .16s ease, transform .16s ease;
  z-index: 50;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { background: var(--red-deep); }

@media (prefers-reduced-motion: reduce) {
  .toast { transition: none; }
}
