:root {
  --bg: #10131a;
  --panel: #181d27;
  --panel2: #1f2531;
  --ink: #e8ecf3;
  --muted: #8d98ab;
  --line: #2a3140;
  --accent: #f5a524;
  --accent2: #e0761a;
  --good: #35c07f;
  --bad: #e5484d;
  --hot: #ff6b3d;
}

* { box-sizing: border-box; }

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

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.25rem;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand { font-weight: 700; color: var(--ink); text-decoration: none; font-size: 1.1rem; }
.brand span { color: var(--accent); }

.bar nav { display: flex; gap: 1rem; flex-wrap: wrap; }
.bar nav a { color: var(--muted); text-decoration: none; font-size: 0.9rem; }
.bar nav a:hover { color: var(--accent); }

main { max-width: 1080px; margin: 0 auto; padding: 1.5rem 1.25rem 4rem; }

h1.page { font-size: 1.6rem; margin: 0.5rem 0 0.25rem; }
h2 { font-size: 1.05rem; margin: 0 0 0.9rem; }

.hero { text-align: center; padding: 2rem 0 1rem; }
.hero h1 { font-size: 2rem; margin: 0 0 0.5rem; }
.hero p { color: var(--muted); }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.15rem;
  margin-bottom: 1.25rem;
}

.panel.narrow { max-width: 24rem; margin: 1.5rem auto; }

.hint { color: var(--muted); font-size: 0.85rem; }
.hint a, main a { color: var(--accent); }
a:visited { color: inherit; }
.knote { color: var(--muted); font-size: 0.8rem; font-weight: 400; }
.empty { color: var(--muted); text-align: center; padding: 2rem 0; }
.mono { font-family: ui-monospace, Menlo, monospace; font-size: 0.85rem; }

.msg { min-height: 1.2rem; color: var(--muted); font-size: 0.9rem; }
.msg.bad { color: var(--bad); }

.flash, .ok, .okmsg {
  padding: 0.7rem 0.9rem;
  border-radius: 9px;
  margin: 0 0 1rem;
}
.flash { background: #3a1d1f; border: 1px solid #6b2b2f; color: #ffb3b5; }
.ok, .okmsg {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  border: 1px solid var(--accent);
  color: var(--accent);
}

input, select, textarea {
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel2);
  color: var(--ink);
  font: inherit;
  width: 100%;
}

input[type="checkbox"] { width: auto; }
label { display: block; font-size: 0.85rem; color: var(--muted); }
label input, label select, label textarea { margin-top: 0.25rem; color: var(--ink); }

/* One button system. Three sizes, three intents. Nothing else may
   redefine padding, height or radius — add a layout rule instead. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-height: 2.5rem;
  padding: 0 0.9rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel2);
  color: var(--ink);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.2;
  text-decoration: none;
  text-align: center;
  cursor: pointer;
  white-space: nowrap;
  width: auto;
  vertical-align: middle;
  transition: border-color .12s ease, background .12s ease, color .12s ease;
}
.btn.small { min-height: 2rem; padding: 0 0.6rem; font-size: 0.8rem; border-radius: 8px; }
.btn.big   { min-height: 3rem; width: 100%; padding: 0 1rem; font-size: 1rem; border-radius: 12px; }

.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn.primary { background: var(--accent); border-color: var(--accent); color: #1a1204; font-weight: 600; }
.btn.primary:hover { background: var(--accent2); border-color: var(--accent2); color: #1a1204; }

.btn.danger { color: var(--bad); }
.btn.danger:hover { border-color: var(--bad); color: var(--bad); }
.btn.primary.danger { background: var(--bad); border-color: var(--bad); color: #fff; }

.btn:disabled, .btn[disabled] { opacity: 0.4; cursor: not-allowed; }
.btn:disabled:hover, .btn[disabled]:hover { border-color: var(--line); color: var(--ink); }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 0.75rem; align-items: end; }
.grid .wide { grid-column: 1 / -1; }
.grid button { justify-self: start; }

.stack { display: flex; flex-direction: column; gap: 0.75rem; }
.row-form { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-bottom: 0.75rem; }
.row-form input, .row-form select { width: auto; flex: 1 1 10rem; }
.inline { display: inline; }
.check { display: flex; align-items: center; gap: 0.4rem; }

.tbl { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.tbl th { text-align: left; color: var(--muted); font-weight: 500; font-size: 0.78rem; padding: 0.4rem 0.5rem; border-bottom: 1px solid var(--line); }
.tbl td { padding: 0.5rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr.bad td { background: #2a1618; }
.tbl tr.champ td { background: #2b2410; }
.tbl .acts { display: flex; gap: 0.3rem; flex-wrap: wrap; }

.pill {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.72rem;
  background: var(--panel2);
  border: 1px solid var(--line);
  color: var(--muted);
}
.pill.ready, .pill.live { background: #123726; border-color: #245c40; color: #7fe0ae; }
.pill.in_progress { background: #3a2a0d; border-color: #6d5115; color: var(--accent); }
.pill.completed { background: #16233a; border-color: #2b4670; color: #8fb6f0; }
.pill.bad { background: #3a1d1f; border-color: #6b2b2f; color: #ffb3b5; }

.matchrow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 0.5rem;
  text-decoration: none;
  color: var(--ink);
}
.matchrow:hover { border-color: var(--accent); }
.matchrow .knote { display: block; }

.seedbox, .lanebox { width: 4.5rem; }

.pinbox { background: #2b2410; border: 1px solid #6d5115; border-radius: 12px; padding: 1rem; text-align: center; margin-bottom: 1.25rem; }
.pinbox .pin { font-size: 2.4rem; font-weight: 700; letter-spacing: 0.15em; color: var(--accent); margin: 0.25rem 0; }

.pindeck { display: flex; flex-direction: column; align-items: center; gap: 0.4rem; margin: 1rem 0; }
.prow { display: flex; gap: 0.4rem; justify-content: center; }
.pin {
  width: 2.9rem;
  height: 2.9rem;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: var(--panel2);
  color: var(--muted);
  font-weight: 700;
  cursor: pointer;
  font-size: 0.9rem;
}
.pin.standing { background: #f3f5f8; border-color: #fff; color: #10131a; }
.pin.down { background: var(--panel2); border-color: var(--line); color: #4a5468; }
.pin.dead { opacity: 0.25; cursor: not-allowed; }
.pin:disabled { cursor: not-allowed; }

.entrybar { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; justify-content: center; }
.count { font-size: 1.1rem; font-weight: 700; color: var(--accent); min-width: 5rem; text-align: center; }
#entry.done .pindeck, #entry.done .entrycol { opacity: 0.3; pointer-events: none; }

.sheet { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 0.7rem; margin-bottom: 0.7rem; }
.sheet.active { border-color: var(--accent); }
.sheethead { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.4rem; }
.sheethead .tot { font-size: 1.4rem; font-weight: 700; color: var(--accent); }

.frames { width: 100%; max-width: 620px; border-collapse: collapse; table-layout: fixed; }
.frames td { width: 9.5%; }
.frames td:last-child { width: 14%; }
.frames td { border: 1px solid var(--line); text-align: center; padding: 0; vertical-align: top; }
.frames td.sp { background: #3a1d1f; }
.frames .fno { font-size: 0.6rem; color: var(--muted); border-bottom: 1px solid var(--line); }
.frames .balls { display: flex; justify-content: flex-end; gap: 1px; padding: 1px; min-height: 1.3rem; }
.frames .balls i { display: inline-block; min-width: 0.85rem; font-style: normal; font-size: 0.72rem; border: 1px solid var(--line); border-radius: 2px; }
.frames .run { font-weight: 700; font-size: 0.85rem; padding: 0.15rem 0; border-top: 1px solid var(--line); }
.frames.mini .run { font-size: 0.75rem; }
.streak { color: var(--hot); font-size: 0.8rem; margin-top: 0.35rem; }

.alertbar { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 1rem; }
.alert { padding: 0.6rem 0.8rem; border-radius: 9px; font-weight: 600; font-size: 0.9rem; }
.alert.hot_game { background: #3a1f12; border: 1px solid #7a3d1d; color: #ffb08a; }
.alert.high_roller { background: #16233a; border: 1px solid #2b4670; color: #9dc4ff; }
.alert.fire_ball { background: #3a2a0d; border: 1px solid #6d5115; color: #ffd489; }

.pmatch { border: 1px solid var(--line); border-radius: 10px; padding: 0.7rem; margin-bottom: 0.6rem; }
.pmatch.in_progress { border-color: var(--accent); }
.pmhead { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.4rem; }
.pmhead .lane { color: var(--muted); font-size: 0.8rem; }
.pside { display: grid; grid-template-columns: 1fr auto; gap: 0.4rem; align-items: center; padding: 0.3rem 0; }
.pside.won { color: var(--good); }
.pside .bname { text-decoration: none; color: inherit; font-weight: 600; }
.pside .psc { font-size: 1.2rem; font-weight: 700; }
.pside .frames { grid-column: 1 / -1; }
.pside .sd, .bracket .sd {
  display: inline-block; min-width: 1.3rem; text-align: center;
  font-size: 0.7rem; color: var(--muted); border: 1px solid var(--line); border-radius: 4px;
}

.bracket .side { display: flex; justify-content: space-between; gap: 0.5rem; padding: 0.15rem 0; }
.bracket .side.won { color: var(--good); font-weight: 600; }
.bracket .side .sc { font-weight: 700; }
.bracket .pos { color: var(--muted); font-size: 0.8rem; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(6.5rem, 1fr)); gap: 1rem; margin-top: 1rem; }
.kpi { display: flex; flex-direction: column; }
.klabel { font-size: 0.75rem; color: var(--muted); }
.kvalue { font-size: 1.5rem; font-weight: 600; }

.leaders { display: grid; grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); gap: 1rem; margin-top: 1rem; }
.leadcard { display: flex; flex-direction: column; gap: 0.1rem; padding: 0.75rem; border: 1px solid var(--line); border-radius: 8px; }
.leadcard .kvalue { font-size: 1.35rem; line-height: 1.2; }
.leadname { font-size: 0.9rem; font-weight: 600; }

.profile { display: flex; gap: 1.25rem; align-items: center; flex-wrap: wrap; }
.avatar { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; }
.avatar.big { width: 96px; height: 96px; }
.logo { height: 28px; }

.sponsors { display: flex; flex-wrap: wrap; gap: 1rem; }
.sponsor { display: flex; align-items: center; gap: 0.6rem; border: 1px solid var(--line); border-radius: 10px; padding: 0.6rem 0.8rem; }
.sponsor img { height: 32px; }

.mediagrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); gap: 0.8rem; margin-bottom: 1rem; }
.mediagrid figure { margin: 0; }
.mediagrid img { width: 100%; border-radius: 8px; display: block; }
.mediagrid figcaption { font-size: 0.8rem; color: var(--muted); margin-top: 0.25rem; }
.vid { position: relative; padding-top: 56.25%; }
.vid iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; border-radius: 8px; }

details summary { cursor: pointer; list-style: none; display: inline-block; margin-bottom: 0.5rem; }
details summary::-webkit-details-marker { display: none; }

@media (max-width: 640px) {
  .frames .balls i { min-width: 0.8rem; font-size: 0.7rem; }
  .pin { width: 2.5rem; height: 2.5rem; }
  main { padding: 1rem 0.75rem 3rem; }
}

.fieldnote {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.72rem;
  color: var(--muted);
}
.lanebox { width: 5.5rem; text-align: center; }

.savestate {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--muted);
  transition: opacity 0.2s;
}
.savestate.ok { color: var(--good); }
.savestate.bad { color: var(--bad); }

.badfield {
  border-color: var(--bad) !important;
  background: #2a1618;
}

.tophead { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.trow { display: flex; align-items: center; gap: 0.75rem; }
.tlogo { height: 44px; width: auto; border-radius: 8px; background: #fff; padding: 3px; }
.tlogo.big { height: 84px; }
.tlogo.sm { height: 32px; }

.prose { white-space: normal; line-height: 1.6; }
.contactcard { margin-bottom: 1rem; }
.orgname { font-weight: 700; font-size: 1.05rem; margin: 0 0 0.4rem; }
.contactlist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.92rem; }
.contactlist a { color: var(--accent); text-decoration: none; }
.contactlist a:hover { text-decoration: underline; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.spl {
  color: #ff8a8a !important;
  border-color: #8a3a3e !important;
  background: #4a1f22;
  font-weight: 800;
}

.frames td.tap { cursor: pointer; }
.frames td.tap:hover { outline: 1px solid var(--accent); }
.frames td.editing { outline: 2px solid var(--accent); background: #3a2a0d; }

.pickerbar { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.6rem; }
.ballpicker { display: flex; gap: 0.3rem; }
.ballbtn.on { background: var(--accent); border-color: var(--accent); color: #1a1204; font-weight: 700; }
.editflag {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: #3a2a0d;
  border: 1px solid #6d5115;
  color: var(--accent);
  border-radius: 5px;
  padding: 0.1rem 0.4rem;
  vertical-align: middle;
}

.pushright { margin-left: auto; }
.pickerbar { width: 100%; }
.msg.ok { color: var(--good); }

.entrywrap {
  display: flex;
  gap: 2rem;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  margin: 1rem 0;
}

.entrycol {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  min-width: 13rem;
}
.entrycol .btn { width: 100%; text-align: center; }
.entrycol .count {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--accent);
  text-align: center;
  padding: 0.3rem 0;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel2);
}
.foulbox { justify-content: center; padding: 0.3rem 0; }
.decknote { color: var(--muted); font-size: 0.75rem; text-align: center; margin: 0.4rem 0 0; }

.scorelog { max-height: 22rem; overflow-y: auto; font-size: 0.85rem; }
.logrow {
  display: grid;
  grid-template-columns: 3.2rem 8rem 1fr 7rem;
  gap: 0.6rem;
  padding: 0.35rem 0.3rem;
  border-bottom: 1px solid var(--line);
  align-items: baseline;
}
.logrow .lt { color: var(--muted); font-family: ui-monospace, Menlo, monospace; font-size: 0.78rem; }
.logrow .lb { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logrow .lx { color: var(--ink); }
.logrow .lx em { color: var(--muted); font-style: normal; font-size: 0.78rem; }
.logrow .lo { color: var(--muted); font-size: 0.78rem; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logrow.update .lx { color: var(--accent); }
.logrow.delete .lx { color: var(--bad); }
.logrow.final { background: #14322a; }
.logrow.final .lx { color: var(--good); font-weight: 600; }

@media (max-width: 760px) {
  .entrywrap { gap: 1rem; }
  .entrycol { min-width: 0; width: 100%; }
  .logrow { grid-template-columns: 3rem 1fr; }
  .logrow .lo { grid-column: 2; text-align: left; }
}

.matchno {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 0.72rem;
  color: var(--muted);
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0.1rem 0.4rem;
  vertical-align: middle;
  white-space: nowrap;
}
h1.page .matchno { font-size: 0.8rem; }
.pmhead .matchno { margin-right: auto; }

.confirmbox {
  background: #3a2a0d;
  border: 1px solid #6d5115;
  border-radius: 10px;
  padding: 0.9rem 1rem;
}
.confirmq { margin: 0 0 0.4rem; font-size: 1.05rem; font-weight: 700; color: var(--accent); }
.confirmbtns { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.7rem; }

.swatchrow { display: flex; gap: 0.4rem; align-items: center; margin-top: 0.25rem; }
.swatchrow input[type="color"] {
  width: 3.2rem;
  height: 2.2rem;
  padding: 0.15rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel2);
  cursor: pointer;
}

body.light {
  --bg: #f4f6fa;
  --panel: #ffffff;
  --panel2: #eef1f6;
  --ink: #121722;
  --muted: #5b6678;
  --line: #d6dce6;
}
body.light .pin.standing { background: #12161f; border-color: #12161f; color: #fff; }
body.light .pin.down { background: #eef1f6; color: #98a2b3; }
body.light .flash { background: #fdecec; border-color: #f0b6b6; color: #a01d1d; }
body.light .ok, body.light .okmsg {
  background: color-mix(in srgb, var(--accent) 12%, #fff);
  border-color: var(--accent);
  color: #7a4a00;
}
body.light .frames td.sp, body.light .tbl tr.bad td { background: #fdecec; }
body.light .spl { background: #fdecec; color: #a01d1d !important; border-color: #f0b6b6 !important; }
body.light .btn.primary { color: #fff; }
body.light .confirmbox { background: #fff7e6; border-color: #e8c583; }
body.light .logrow.final { background: #e8f7ef; }
body.light .pill.completed { background: #e7eefb; border-color: #bcd0f0; color: #1c4587; }
body.light .pill.in_progress { background: #fff2d9; border-color: #e8c583; color: #8a5a17; }
body.light .pill.ready, body.light .pill.live { background: #e8f7ef; border-color: #a9dfc3; color: #14653b; }

.pickform { margin-bottom: 1rem; }
.pickform select[multiple] {
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.25rem;
  font-size: 0.9rem;
}
.pickform select[multiple] option { padding: 0.28rem 0.4rem; border-radius: 4px; }
.pickform select[multiple] option:checked { background: var(--accent); color: #1a1204; }
#bowlerfilter { margin-top: 0.25rem; }
.pickbar { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.6rem; }
.pickbar .btn.primary { margin-left: auto; }

.picklabel { margin-bottom: 0.2rem; }

}

.sideblock { margin-bottom: 1rem; }
.sidehead {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.3rem 0.1rem 0.5rem;
  border-bottom: 2px solid var(--accent);
  margin-bottom: 0.5rem;
}
.sidehead strong { font-size: 1.05rem; }
.sidetot { font-size: 1.5rem; font-weight: 800; color: var(--accent); }
.frames .fowner {
  font-size: 0.55rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-bottom: 1px solid var(--line);
  overflow: hidden;
  white-space: nowrap;
}

.settings .frow { display: grid; gap: 14px; margin-bottom: 16px; align-items: start; }
/* minmax(0, 1fr), not 1fr: a 1fr track cannot shrink below its content's
   minimum, and a date input's picker widget has a wide one — it would push out
   of its column and over the next field. */
.settings .frow.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.settings .frow.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.settings .frow .check { align-self: center; }
@media (max-width: 900px) { .settings .frow.c4, .settings .frow.c3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .settings .frow.c4, .settings .frow.c3 { grid-template-columns: 1fr; } }

.panel.card > h2 { margin: 0; }
.card.collapsed > h2 { margin: 0; }
.card > h2 .cardtoggle {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 0; margin: 0;
  background: none; border: 0; cursor: pointer;
  font: inherit; color: inherit; text-align: left;
}
.card > h2 .cardtoggle::before {
  content: '\25BE';
  font-size: .8em; line-height: 1; opacity: .7;
  transition: transform .15s ease;
}
.card.collapsed > h2 .cardtoggle::before { transform: rotate(-90deg); }
.card > h2 .cardtoggle:hover { color: var(--accent); }
.card.collapsed > *:not(h2) { display: none; }
.card.collapsed { padding-bottom: 14px; }

.hcpnote { display: block; font-size: .62em; font-weight: 500; opacity: .7; letter-spacing: 0; }

.picklist {
  max-height: 372px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  margin: 10px 0;
  background: var(--panel2);
}
.pickgrid {
  display: grid;
  grid-template-columns: 26px minmax(140px, 1.6fr) minmax(180px, 2fr) 46px 108px 52px 110px 130px 76px;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  min-width: 940px;
  box-sizing: border-box;
}
.pickhead {
  position: sticky;
  top: 0;
  z-index: 2;
  height: 32px;
  background: var(--panel2);
  border-bottom: 1px solid var(--line);
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  box-shadow: 0 1px 0 var(--line);
}
.pickhead span { opacity: .7; }
.picklist .pickrow {
  height: 34px;
  cursor: pointer;
  border-bottom: 1px solid var(--line);
}
.picklist .pickrow:last-child { border-bottom: 0; }
.picklist .pickrow:hover { background: var(--panel); }
.picklist .pickrow.on { background: color-mix(in srgb, var(--accent) 16%, transparent); }
.picklist .pickrow input { margin: 0; }
.picklist .pn { font-weight: 600; }
.picklist .pn, .picklist .pe, .picklist .pc {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.picklist .pe { font-size: .8rem; opacity: .72; }
.picklist .pc { font-size: .8rem; opacity: .82; }

.gamelist .mno { font-variant-numeric: tabular-nums; font-weight: 700; }
.gamelist td { vertical-align: top; }
.gside { padding: 2px 0; }
.gside.won { font-weight: 700; color: var(--accent); }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
h3.substand { margin: 26px 0 10px; font-size: 1rem; }

.pickfilters {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
  margin: 10px 0;
  overflow-x: auto;
  padding-bottom: 2px;
}
.pickfilters > * { flex: 0 0 auto; }
.pickfilters input[type=search] { flex: 1 1 150px; min-width: 110px; }
.pickfilters input, .pickfilters select { font-size: .82rem; padding: 6px 8px; }
.pickfilters select { max-width: 112px; }
.pickfilters .rangef { display: inline-flex; align-items: center; gap: 3px; }
.pickfilters .rangef b { font-size: .74rem; font-weight: 600; opacity: .7; }
.pickfilters .rangef input { width: 52px; padding: 6px 4px; text-align: center; }
.pickfilters #fclearall { margin-left: auto; }
.pickselect { height: auto; }

.sheet .fno .owner { display: block; font-size: .58rem; font-weight: 600; opacity: .65; letter-spacing: 0; }

.tbl.cols td:first-child { white-space: nowrap; }

.rwhen { float: right; font-size: .78rem; font-weight: 600; opacity: .75; }

.settings .frow.c2 { grid-template-columns: repeat(2, 1fr); }
.settings .frow.dates { column-gap: 28px; max-width: 620px; }

.settings .frow > label { min-width: 0; }
.settings .frow input,
.settings .frow select,
.settings .frow textarea {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}
.settings .frow input[type=checkbox],
.settings .frow input[type=radio] {
  width: auto;
  flex: 0 0 auto;
}
.settings .frow .check { min-width: 0; }
.settings .frow .check > span { white-space: nowrap; }
.settings .frow.hcp { grid-template-columns: minmax(160px, auto) 1fr 1fr; }
@media (max-width: 900px) { .settings .frow.hcp { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .settings .frow.hcp { grid-template-columns: 1fr; } }
.settings .frow .swatchrow input[type=color] { width: 3.2rem; }
@media (max-width: 560px) { .settings .frow.c2 { grid-template-columns: 1fr; } }

.stagebox { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; margin-bottom: 16px; }
.stagebox h3 { margin: 0 0 10px; font-size: 1rem; display: flex; align-items: center; gap: 8px; }

.sheet.manual { border: 2px solid var(--bad, #c0392b); }
.manualgrid input { width: 100%; box-sizing: border-box; text-align: center; font: inherit; padding: 3px 0; }
.manualgrid .mballs { display: flex; gap: 2px; }
.manualgrid .mb { text-transform: uppercase; font-weight: 700; }
.manualgrid .mr { margin-top: 3px; font-variant-numeric: tabular-nums; }
.manualbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 10px; }
.manualbar .mt { width: 84px; text-align: center; font-weight: 700; font-size: 1.05rem; padding: 5px; }
.fmobar { margin-top: 8px; }
.fmoconfirm { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-top: 8px; }
.fmoconfirm p { margin: 8px 0; font-size: .88rem; }

.sheetpage { max-width: 900px; margin: 0 auto; }
.printbar { display: flex; gap: 8px; margin-bottom: 16px; }
.printhead { display: flex; align-items: center; gap: 16px; border-bottom: 2px solid var(--line); padding-bottom: 12px; margin-bottom: 18px; }
.printhead h1 { margin: 0; font-size: 1.5rem; }
.printhead p { margin: 4px 0 0; font-size: .82rem; color: var(--muted); }
.plogo { height: 54px; width: auto; }
.printround { margin-bottom: 22px; break-inside: avoid; }
.printround h2 { font-size: 1rem; margin: 0 0 8px; display: flex; justify-content: space-between; align-items: baseline; border-bottom: 1px solid var(--line); padding-bottom: 5px; }
.printround h2 span { font-size: .8rem; font-weight: 500; color: var(--muted); }
.ptbl { width: 100%; border-collapse: collapse; font-size: .85rem; }
.ptbl th { text-align: left; font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 4px 6px; border-bottom: 1px solid var(--line); }
.ptbl td { padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.ptbl .c-game { width: 72px; font-variant-numeric: tabular-nums; font-weight: 700; }
.ptbl .c-lane { width: 90px; }
.vs { display: grid; grid-template-columns: 1fr 26px 1fr; gap: 8px; align-items: start; }
.pv { text-align: center; color: var(--muted); font-size: .78rem; padding-top: 2px; }
.proster { margin: 4px 0 0; padding-left: 18px; font-size: .78rem; color: var(--muted); }
.proster li { padding: 1px 0; }
.printfoot { margin-top: 20px; padding-top: 10px; border-top: 1px solid var(--line); font-size: .78rem; color: var(--muted); }

@media print {
  header.bar, .printbar, footer { display: none !important; }
  body { background: #fff !important; color: #000 !important; }
  main { padding: 0 !important; max-width: none !important; }
  .sheetpage { max-width: none; }
  .printhead, .printround h2, .ptbl th, .ptbl td, .printfoot { border-color: #999 !important; }
  .printhead p, .printround h2 span, .proster, .pv, .printfoot { color: #444 !important; }
  .printround { page-break-inside: avoid; }
  a { color: #000 !important; text-decoration: none; }
}

.orgbar { display: flex; align-items: center; gap: 10px; padding: 6px 20px; font-size: .8rem;
          background: color-mix(in srgb, var(--accent) 14%, transparent); border-bottom: 1px solid var(--line); }
.orgbar a { font-size: .78rem; color: var(--accent); text-decoration: underline; }
.orgbar a:visited { color: var(--accent); }
.orgbar a:hover { color: var(--ink); }
.invitelink { width: 100%; font-family: ui-monospace, Menlo, monospace; font-size: .82rem; padding: 8px; }

.joincard { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.joincard > div { flex: 1 1 260px; }
.joinqr { width: 180px; height: 180px; border-radius: 12px; background: #fff; padding: 8px; }
.joinwrap { max-width: 560px; margin: 0 auto; }
.joinform label { display: block; margin: 12px 0; }
.joinform input, .joinform select, .joinform textarea {
  width: 100%; box-sizing: border-box; margin-top: 4px; font-size: 16px; padding: 11px 12px; border-radius: 10px;
}
.joinform .hp { position: absolute; left: -9999px; }
@media print { .joincard { break-inside: avoid; } }

.signin { position: relative; }
.signin > summary {
  list-style: none; cursor: pointer;
  color: var(--muted); font-size: 0.9rem;
}
.signin > summary::-webkit-details-marker { display: none; }
.signin > summary::after { content: ' \25BE'; font-size: .75em; opacity: .7; }
.signin > summary:hover { color: var(--accent); }
.signinmenu {
  position: absolute; right: 0; top: 1.8rem; z-index: 40;
  display: flex; flex-direction: column; min-width: 230px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 6px; box-shadow: 0 10px 30px rgba(0,0,0,.35);
}
.signinmenu a {
  display: block; padding: 9px 10px; border-radius: 8px;
  color: var(--ink) !important; text-decoration: none;
}
.signinmenu a:hover { background: var(--panel2); }
.signinmenu strong { display: block; font-size: .88rem; }
.signinmenu span { display: block; font-size: .74rem; color: var(--muted); }

a > .joinqr { display: block; transition: transform .12s ease, box-shadow .12s ease; }
a:hover > .joinqr { transform: scale(1.02); box-shadow: 0 0 0 3px var(--accent); }

.matchrow .trowright { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }

.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px 24px; margin: 0; }
.facts > div { min-width: 0; }
.facts dt { font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 2px; }
.facts dd { margin: 0; font-size: .92rem; }
.facts dd .knote { display: block; margin-top: 2px; }

.kindtag {
  align-self: flex-start; flex: 0 0 auto;
  font-size: .62rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  padding: 3px 7px; border-radius: 6px; border: 1px solid var(--line); color: var(--muted);
}
.matchrow.isleague .kindtag { border-color: var(--accent); color: var(--accent); }

.panel.card > h2 .cardtoggle {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 0; margin: 0; min-height: 0;
  background: none; border: 0; cursor: pointer;
  font: inherit; color: inherit; text-align: left;
}
.panel.card > h2 .cardtoggle::before {
  content: '\25BE'; font-size: .8em; line-height: 1; opacity: .7;
  transition: transform .15s ease;
}
.panel.card.collapsed > h2 .cardtoggle::before { transform: rotate(-90deg); }
.panel.card > h2 .cardtoggle:hover { color: var(--accent); }
.panel.card.collapsed > *:not(h2) { display: none; }
.panel.card.collapsed { padding-bottom: 14px; }

.hero.mkt { text-align: center; padding: 26px 0 6px; }
.hero.mkt h1 { font-size: 2.1rem; margin: 0 0 8px; }
.hero.mkt .lede { font-size: 1.05rem; color: var(--muted); margin: 0; }

.signinrow {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px; margin: 22px 0 28px;
}
.signincard {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 20px 16px; text-align: center; text-decoration: none;
  border: 1px solid var(--line); border-radius: 14px; background: var(--panel);
  color: var(--ink) !important;
  transition: border-color .12s ease, transform .12s ease;
}
.signincard:hover { border-color: var(--accent); transform: translateY(-2px); }
.signincard .sicon { font-size: 1.9rem; line-height: 1; }
.signincard strong { font-size: 1.02rem; }
.signincard .sdesc { font-size: .8rem; color: var(--muted); min-height: 2.2em; }
.signincard .btn { margin-top: 6px; pointer-events: none; }

.mktgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px 24px; }
.mktgrid h3 { margin: 0 0 4px; font-size: .96rem; color: var(--accent); }
.mktgrid p { margin: 0; font-size: .88rem; color: var(--muted); line-height: 1.5; }
.mktfoot { text-align: center; margin-top: 22px; }

.mktsec > h2 { margin: 0 0 18px; font-size: 1.15rem; }
.mktsec { padding: 22px 24px; }
.mktgrid { align-items: start; }
.mktgrid > div { break-inside: avoid; }
.mktcta { text-align: center; margin: 4px 0 8px; }
.mktcta .btn { padding: 0 1.4rem; min-height: 3rem; font-size: 1rem; border-radius: 12px; }

.mktgrid.two { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); max-width: 820px; }
@media (min-width: 900px) { .mktgrid.two { grid-template-columns: 1fr 1fr; } }

.sitefoot { text-align: center; padding: 28px 16px 36px; }
.sitefoot a { font-size: .8rem; color: var(--muted) !important; text-decoration: none; border-bottom: 1px dotted var(--line); }
.sitefoot a:hover { color: var(--accent) !important; border-color: var(--accent); }
@media print { .sitefoot { display: none; } }

.navcount {
  display: inline-block; min-width: 1.1rem; padding: 0 4px;
  border-radius: 8px; background: var(--bad); color: #fff;
  font-size: .68rem; font-weight: 700; text-align: center; line-height: 1.25rem;
}
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0 18px; }
.fbcard { padding: 16px 18px; }
.fbhead { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; }
.fbmsg { white-space: pre-wrap; margin: 6px 0 10px; }
.fbcard .row-form { margin-top: 10px; gap: 8px; flex-wrap: wrap; }
.fbcard .row-form input[type=text] { flex: 1 1 180px; min-width: 140px; }

/* A scorecard is 10 frames wide — it should not stretch to the page. */
.sheet { max-width: 640px; }
.sheet .sheethead { max-width: 640px; }
.sheet .kpis { max-width: 640px; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.sheet .kpis .kpi { padding: 6px 4px; text-align: center; }
.sheet .kpis .klabel { font-size: .62rem; }
.sheet .kpis .kvalue { font-size: 1rem; }
@media (max-width: 680px) {
  .sheet .kpis { grid-template-columns: repeat(3, 1fr); }
}

/* Public board: keep name, score and frames in one tight block instead of
   letting the score drift to the far edge of a wide page. */
.pmatch { max-width: 680px; }
.pmatch .pmhead { max-width: 640px; }
.pside { max-width: 640px; }

.topsearch { flex: 0 1 320px; margin: 0 auto 0 24px; }
.topsearch input {
  width: 100%; box-sizing: border-box;
  padding: 7px 12px; border-radius: 999px;
  font-size: .85rem; background: var(--panel2);
}
.topsearch input:focus { outline: 2px solid var(--accent); outline-offset: 0; }
.searchbig { display: flex; gap: 10px; margin: 14px 0 18px; }
.searchbig input { flex: 1 1 auto; font-size: 1rem; padding: 12px 14px; border-radius: 10px; }
@media (max-width: 760px) { .topsearch { display: none; } }

.panel.adminonly { border-left: 3px solid var(--accent); }
.panel.adminonly .facts dd .knote { display: block; }

.facts > div.wide { grid-column: 1 / -1; }

.frames td.roll { border-left: 2px solid var(--accent); background: rgba(245, 158, 11, 0.08); }
.frames td.roll .fno { color: var(--accent); font-weight: 700; }
.frames.hasroll { max-width: 100%; }
.rollbtns { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }

.crumbs { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; margin: 0.25rem 0 0.35rem; font-size: 0.82rem; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--accent); }
.crumbs .csep { color: var(--line); }
.crumbs .chere { color: var(--ink); }

.kindtag {
  display: inline-block; vertical-align: middle; margin-right: 0.4rem;
  padding: 0.15rem 0.5rem; border-radius: 999px;
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
}
/* Kind tags sit right beside a status pill, so they must not borrow a status
   colour: amber is "Bowling", blue is "Final", green is "Live", red is bad. */
.kindtag.tour   { background: #2a1533; border: 1px solid #6b3a86; color: #dda8f0; }
.kindtag.league { background: #0f2e2c; border: 1px solid #1f6a63; color: #6fe0d2; }

.tbl tr.rowlink { cursor: pointer; }
.tbl tr.rowlink:hover td { background: var(--panel2); }

.weekcard { border: 1px solid var(--line); border-radius: 10px; padding: 0.75rem; margin-bottom: 0.6rem; }
.weekcard.won  { border-left: 3px solid var(--good); }
.weekcard.lost { border-left: 3px solid var(--bad); }
.weekcard.split, .weekcard.pending { border-left: 3px solid var(--line); }
.wkhead { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; margin-bottom: 0.5rem; }
.wkhead .pushright { margin-left: auto; }
.wkgames, .wksheets { font-size: 0.85rem; }
.wksheets { margin-top: 0.4rem; }
.wkgames td.winner { color: var(--good); font-weight: 700; }
.blindcell { color: var(--muted); }

.privname { color: var(--muted); cursor: default; border-bottom: 1px dotted var(--line); }
.privtoggle { display: flex; gap: 0.6rem; align-items: flex-start; padding: 0.7rem 0.85rem;
  border: 1px solid var(--line); border-radius: 10px; background: var(--panel2); }
.privtoggle input { margin-top: 0.25rem; }
.privtoggle .fieldnote { display: block; margin-top: 0.15rem; }

.avatar.sm { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; vertical-align: middle;
  background: var(--panel2); border: 1px solid var(--line); flex: 0 0 auto; }
.whoname { display: inline-flex; align-items: center; gap: 0.45rem; }
.sheethead .avatar.sm, .scHead .avatar.sm { margin-right: 0.35rem; }
@media print { .avatar.sm { border: 1px solid #999; } }

.bnum {
  display: inline-block; margin-left: 0.35rem; padding: 0.05rem 0.4rem;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--panel2); color: var(--muted);
  font-size: 0.68rem; font-weight: 600; letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums; vertical-align: middle; white-space: nowrap;
}

.orgbar.aspublic { background: #2b2410; border-bottom: 1px solid #6d5115; color: var(--accent); }
.orgbar.aspublic .knote { color: #c8a24a; }
.orgbar .pushright { margin-left: auto; }
.orgbar { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }

/* WCAG 2.2: the privacy and terms links on the dark page */
.legal-links a { color: var(--ink); }
