/* hub.css — the TD dashboard (index.html) once a tournament is open:
   the Live Hub and Tournament Setup. No boxes: sections are headings over
   a rule, rows over hairlines. Colors come from td.css variables only, so
   the soft dark palette follows. body.hubpage is set by admin.js render();
   the tournament list keeps td.css as it is. */

body.hubpage .wrap { max-width: 1180px; padding: 22px 32px 64px; }
.sitehead { font-size: 14px; gap: 20px; align-items: center; margin-bottom: 26px; }
.sitehead h1 { font-size: 16px; font-weight: 600; letter-spacing: 0; }
.sitehead a.muted, .hubnav a { color: var(--muted); }

/* buttons that read as links: row actions, Copy, Set, Delete */
.linkbtn {
  font: inherit; color: var(--link); background: none; border: none;
  padding: 0; border-radius: 0; cursor: pointer;
}
.linkbtn:hover { text-decoration: underline; border: none; }
.linkbtn.muted { color: var(--muted); }
.linkbtn.warntext { color: var(--warn); }
.warntext { color: var(--warn); }
.hubpage .small { font-size: 13px; }
.hubpage .fg { color: var(--fg); }

/* header: name, when it closes, Setup | Live and the link actions */
.hubtitle { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.hubtitle h1 { font-size: 28px; font-weight: 600; letter-spacing: -0.01em; }
.hubtitle .slug { font-size: 12px; }
.hubnav {
  display: flex; align-items: flex-end; gap: 26px; margin-top: 14px;
  border-bottom: 1px solid var(--line); font-size: 14px;
}
.hubnav .linkbtn, .hubnav a { padding-bottom: 12px; }
/* the player page's box, a divider, then the More menu (New admin link)
   in the corner */
.hubnav .pubbox {
  display: inline-flex; align-items: center; gap: 2px; margin-bottom: 6px;
  padding: 2px 4px 2px 10px; border: 1px solid var(--line); border-radius: 8px;
}
.hubnav .pubbox > .pubstat:only-child { margin: 4px 6px 4px 0; }
.hubnav .pubbox .pubname { color: var(--fg); margin-right: 8px; }
.hubnav .pubbox .pubstat { margin: 0 6px 0 0; }
.hubnav .pubbox a.ico { padding: 0; }
.hubnav .navsep { width: 1px; height: 18px; background: var(--line); align-self: flex-end; margin: 0 -10px 12px; }
.navmore { position: relative; margin-bottom: 7px; }
.navmore > summary { list-style: none; }
.navmore > summary::-webkit-details-marker { display: none; }
.navmore[open] > summary { background: var(--hover-bg); color: var(--fg); }
.navpanel {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; min-width: 170px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 4px;
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.14);
}
.navpanel button { display: block; width: 100%; text-align: left; padding: 8px 10px; border-radius: 6px; color: var(--fg); white-space: nowrap; }
.navpanel button:hover { background: var(--hover-bg); }
/* whether players see the latest changes yet: a dot and a word */
.pubstat {
  display: inline-flex; align-items: center; gap: 6px; margin-left: 8px;
  font-size: 13px; color: var(--muted); white-space: nowrap;
}
.pubstat .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.pubstat.wait { color: var(--warn); }
.pubstat.wait .dot { background: var(--warn); }
.pubstat .mk { font-weight: 700; width: 12px; text-align: center; }
/* a symbol in place of a word (icons.js): its name is its title */
.ico {
  display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px;
  padding: 0; border: none; border-radius: 6px; background: none; color: var(--link); cursor: pointer; vertical-align: middle;
}
.ico:hover { background: var(--hover-bg); border: none; }
.ico.muted { color: var(--muted); }
.ico.muted:hover { color: var(--fg); }
.ico:disabled { color: var(--muted); opacity: .5; cursor: default; background: none; }
.icosm { display: inline-flex; align-items: center; justify-content: center; min-width: 34px; }
.roomtable .copyall { display: inline-flex; align-items: center; gap: 6px; }
.roomtable tfoot td { border-bottom: none; padding-top: 8px; }
.hubtab {
  font: inherit; font-size: 15px; color: var(--muted); background: none; border: none;
  border-radius: 0; padding: 0 0 10px; cursor: pointer;
}
.hubtab:hover { color: var(--fg); border: none; }
.hubtab.on { color: var(--fg); font-weight: 600; box-shadow: inset 0 -2px 0 var(--link); }
.hubtab .ndot { color: var(--warn); }

/* headings: sentence case over a rule, not td.css's small caps */
.hubpage h2 {
  font-size: 17px; font-weight: 600; text-transform: none; letter-spacing: 0;
  color: var(--fg); margin: 0;
}
.hubpage th { text-transform: none; letter-spacing: 0; font-size: 13px; font-weight: 500; }
.sechead {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  min-height: 48px; border-bottom: 1px solid var(--fg); font-size: 14px;
}
.hubpage .banner {
  border: none; background: var(--sel); border-radius: 10px; margin-top: 20px;
}

/* ================= Live Hub ================= */
.roundline { display: flex; align-items: baseline; gap: 18px; flex-wrap: wrap; padding-top: 28px; font-size: 14px; }
.biground { font-size: 44px; line-height: 1; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.biground .of { color: var(--muted); font-size: 26px; font-weight: 400; }
.livegrid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 56px; padding-top: 24px; align-items: start; }
.livemain { display: flex; flex-direction: column; gap: 36px; min-width: 0; }

/* Live now: one row per room */
.lrow {
  display: grid; grid-template-columns: minmax(90px, 170px) minmax(0, 1fr) auto 28px; gap: 12px;
  align-items: center; min-height: 46px; padding: 0 8px; margin: 0 -8px;
  border-bottom: 1px solid var(--line); border-radius: 8px;
}
.lrow:hover, .lrow:focus-within { background: var(--sel); }
.lrow .lroom { color: var(--muted); font-size: 14px; line-height: 1.3; }
.lrow .lgame { font-variant-numeric: tabular-nums; }
.lrow .lgame .linkbtn, .lrow .lgame .warntext { margin-left: 10px; font-size: 13px; }
.lrow .win { font-weight: 600; }
.lrow .lacts { display: flex; gap: 12px; font-size: 13px; opacity: 0; }
.lrow:hover .lacts, .lrow:focus-within .lacts { opacity: 1; }
.lrow .lmark { text-align: center; font-size: 16px; font-weight: 700; }
.lrow .lmark.warn { color: var(--warn); }
.lrow .lmark.muted { color: var(--muted); }
.lrow.bye .lroom, .lrow.bye .lgame { color: var(--muted); }

/* Live now with brackets (admin.js liveBracketsHtml): a heading per
   bracket, flowing in two balanced columns */
/* brackets fill left to right, row by row: an odd one out sits at the left */
.bcols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 32px; align-items: start; }
.bgroup { padding-bottom: 6px; min-width: 0; }
.bhead { display: flex; align-items: center; gap: 8px; padding: 14px 0 4px; font-size: 13px; }
.bhead i { width: 9px; height: 9px; }
.bhead .spacer { flex: 1; }
.brow {
  display: grid; grid-template-columns: minmax(0, 1fr) 20px; gap: 8px; align-items: center;
  min-height: 38px; padding: 3px 8px; margin: 0 -8px; border-top: 1px solid var(--line); border-radius: 8px; font-size: 13px;
}
.brow:hover, .brow:focus-within { background: var(--sel); }
.bgame { display: flex; flex-direction: column; min-width: 0; font-variant-numeric: tabular-nums; }
.bteams { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bteams .win { font-weight: 600; }
.broom { display: flex; gap: 10px; font-size: 11px; color: var(--muted); }
.broom .lacts { display: flex; gap: 10px; opacity: 0; }
.brow:hover .lacts, .brow:focus-within .lacts { opacity: 1; }
.broom .linkbtn, .broom a { font-size: 11px; }
.bnote { font-size: 11px; color: var(--warn); line-height: 1.35; white-space: normal; }
.brow .lmark { text-align: center; font-size: 15px; font-weight: 700; }
.brow .lmark.warn { color: var(--warn); }
.brow .lmark.muted { color: var(--muted); }
.brow.bye .bteams { color: var(--muted); }
.bplain .brow { font-size: 14px; }
/* the rail's bracket list */
.blist { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.bline { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto auto; gap: 8px; align-items: center; padding: 2px 0; }
.bline .linkbtn { font-size: 13px; }

/* Uploads grid: rooms down, rounds across */
.ugrid { width: auto; font-variant-numeric: tabular-nums; margin-top: 4px; }
.ugrid th, .ugrid td { border-bottom: none; padding: 0; }
.ugrid tr + tr td { border-top: 1px solid var(--line); }
.ugrid th { font-size: 13px; color: var(--muted); text-align: center; padding: 10px 0 8px; width: 40px; }
.ugrid th.now { color: var(--fg); font-weight: 700; }
.ugrid .uroom { text-align: left; color: var(--muted); font-size: 14px; padding: 6px 16px 6px 0; min-width: 12ch; width: auto;
  white-space: nowrap; overflow-wrap: normal; max-width: 26ch; overflow: hidden; text-overflow: ellipsis; }
.ugrid td.ucell { text-align: center; padding: 3px 0; }
.umark {
  display: inline-grid; place-items: center; width: 32px; height: 28px; border-radius: 8px;
  border: none; background: none; padding: 0; font: inherit; font-weight: 700; color: var(--fg);
}
button.umark { cursor: pointer; }
button.umark:hover { background: var(--hover-bg); border: none; }
.umark.warn { color: var(--warn); }
.umark.muted { color: var(--muted); }
.umark.sel { background: var(--sel); box-shadow: inset 0 0 0 1.5px var(--link); }
/* a cell's mark: the count of uploads floats beside it, so the marks line
   up down a column; an unfinished upload is a pie filled to the share of
   questions reached */
.uin { display: inline-flex; align-items: flex-start; position: relative; line-height: 1; }
.uin sup.ucount { position: absolute; left: 100%; top: -3px; margin-left: 1px; font-size: 10px; font-weight: 700; }
.upie { display: inline-block; width: 14px; height: 14px; border-radius: 50%; box-sizing: border-box; vertical-align: -2px;
  background: conic-gradient(var(--warn) var(--p), transparent 0); box-shadow: inset 0 0 0 1.5px var(--warn); }
.legend { font-size: 13px; margin-top: 10px; }

/* grouped by bracket: a heading row per bracket, phase names over the rounds */
.ugrid tr.ugroup td { border-top: none; padding: 12px 0 4px; font-size: 12px; text-align: left; }
.ugrid tr.ugroup td i { margin-right: 8px; }
.ugrid tr.ugroup td .muted { margin-left: 8px; }
.ugrid tr.uphase th { padding: 8px 0 2px; font-size: 12px; font-weight: 400; text-align: left; }
.ugrid tr.uphase th span { display: block; margin: 0 2px; padding: 0 4px 2px; border-bottom: 2px solid var(--line); }
/* the open cell's files, floating over the grid under its row (placeCellPop) */
.ugridbox { position: relative; }
.cellpop { position: absolute; left: 0; z-index: 30; width: min(620px, 100%); }
.cellpop .pop { box-shadow: 0 10px 32px rgba(0, 0, 0, 0.16); }
.pop {
  border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; background: var(--bg);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08); display: flex; flex-direction: column; gap: 12px;
  font-size: 14px; max-width: 620px;
}
.pop .phead { display: flex; align-items: baseline; gap: 12px; }
.pfile { display: flex; flex-direction: column; gap: 6px; padding-top: 12px; border-top: 1px solid var(--line); }
.pfile.old { opacity: 0.6; }
.pline { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.pline select { font-size: 13px; padding: 3px 6px; max-width: 200px; }
.pmove { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.pmeta { font-size: 13px; overflow-wrap: anywhere; }
.pacts { display: flex; gap: 14px; align-items: center; font-size: 13px; }

/* Fix buzzes, under its file */
.pacts .linkbtn.on { color: var(--fg); font-weight: 600; }
.fixbuzz { display: grid; gap: 14px; padding: 8px 0 2px; font-size: 14px; }
.fxtabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); }
.fxtab { border: none; border-bottom: 2px solid transparent; border-radius: 0; color: var(--muted); padding: 4px 12px; font-size: 13px; }
.fxtab:hover { color: var(--fg); border: none; border-bottom: 2px solid var(--line); }
.fxtab.on { color: var(--fg); font-weight: 600; border-bottom-color: var(--link); }
/* inside the uploads grid's own table, so its cell rules are undone here */
table.fxteam { width: 100%; font-variant-numeric: tabular-nums; }
.cellpanel table.fxteam th, .cellpanel table.fxteam td {
  width: auto; padding: 4px 8px; border-top: none; border-bottom: 1px solid var(--line);
  text-align: right; white-space: nowrap; vertical-align: middle; font-size: 14px; }
.cellpanel table.fxteam th { font-size: 12px; color: var(--muted); }
.cellpanel table.fxteam th:first-child, .cellpanel table.fxteam td:first-child { text-align: left; padding-left: 0; }
.cellpanel table.fxteam th:first-child { color: var(--fg); font-size: 14px; text-transform: none; letter-spacing: 0; }
.cellpanel table.fxteam td:last-child, .cellpanel table.fxteam th:last-child { width: 1%; padding-right: 0; }
.fxteam select { font-size: 13px; padding: 2px 6px; }
.fxteam tr.chg td { background: var(--chg); }
.cellpanel table.fxteam tr.chg td:first-child { box-shadow: inset 3px 0 0 var(--chg-line); padding-left: 8px; }
.fixbuzz .was { color: var(--muted); text-decoration: line-through; font-size: 12px; margin-right: 4px; }
.fxbuzzes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; font-variant-numeric: tabular-nums; }
.fxbh { font-size: 12px; font-weight: 600; color: var(--muted); padding: 2px 0; }
.fxrow { display: grid; grid-template-columns: 26px 1fr 30px; gap: 8px; align-items: center; padding: 3px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.fxrow > span:first-child { text-align: right; }
.fxrow.chg { background: var(--chg); box-shadow: inset 3px 0 0 var(--chg-line); }
.fxrow select { font-size: 13px; padding: 1px 4px; width: 100%; }
.fxacts { display: flex; gap: 12px; align-items: center; }

/* Add a game */
.addpanel { display: grid; gap: 8px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.addpanel[hidden] { display: none; }
.addpanel label { display: flex; align-items: center; gap: 8px; }
.addlist { display: grid; gap: 4px; }
.addfile { display: flex; gap: 10px; font-size: 13px; }

/* full protests, below the grid */
.hubpage details.drawer { border: none; border-radius: 0; margin-top: 0; }
.hubpage details.drawer > summary { padding: 12px 0; border-bottom: 1px solid var(--fg); }
.hubpage details.drawer > summary:hover { background: none; }
.hubpage details.drawer > summary .dtitle {
  font-size: 17px; text-transform: none; letter-spacing: 0; color: var(--fg);
}
.hubpage details.drawer > .inner { padding: 4px 0 0; }
.hubpage .protest .pill.warn { color: var(--warn); border-color: var(--warn); }

/* the rail */
.liverail { display: flex; flex-direction: column; }
.railblock {
  display: flex; flex-direction: column; gap: 12px; padding: 18px 0 20px;
  border-top: 1px solid var(--line);
}
.railblock:first-child { border-top: none; padding-top: 0; }
.railblock .advance { height: 48px; width: 100%; font-size: 16px; }
.setround { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.setround input { width: 64px; }
.railtoggle { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.railtoggle input { width: 18px; height: 18px; margin: 0; }
.railhead { display: flex; justify-content: space-between; align-items: baseline; font-size: 14px; }
.railhead b { font-size: 15px; }
/* Moderator packets: a chip per round, dark when moderators can open it */
.pkchips { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 3px; }
.pkchips span { height: 22px; display: inline-grid; place-items: center; border-radius: 6px;
  font-size: 12px; font-variant-numeric: tabular-nums; color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); }
.pkchips span.on { background: var(--fg); color: var(--bg); box-shadow: none; font-weight: 600; }
.pkchips span.on.some { background: color-mix(in srgb, var(--fg) 45%, var(--bg)); }
/* Auto-advance's "?" and its tooltip */
.railtoggle .advhelp { width: 22px; height: 22px; margin: -3px 0 0 4px; }
.tipwrap { position: relative; display: inline-block; }
.advtip { display: none; position: absolute; z-index: 20; top: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  width: 260px; padding: 8px 11px; border-radius: 8px; background: var(--fg); color: var(--bg);
  font-size: 12.5px; font-weight: 400; line-height: 1.45; white-space: normal; box-shadow: 0 4px 16px rgba(0,0,0,.18); pointer-events: none; }
.advtip::before { content: ''; position: absolute; top: -5px; left: 50%; margin-left: -5px; border: 5px solid transparent; border-top: 0; border-bottom-color: var(--fg); }
.tipwrap:hover .advtip, .tipwrap:focus-within .advtip { display: block; }
@media (max-width: 600px) { .advtip { left: auto; right: -120px; transform: none; } .advtip::before { left: auto; right: 125px; } }
.startlist { display: flex; flex-direction: column; gap: 5px; font-size: 13px; }
.sroom { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.sroom .dot { width: 8px; height: 8px; border-radius: 99px; flex: none; box-shadow: inset 0 0 0 1.5px var(--muted); }
.sroom.on { color: var(--fg); }
.sroom.on .dot { background: var(--fg); box-shadow: none; }
.sroom.bye .dot { box-shadow: inset 0 0 0 1px var(--line); }
.pcompact { display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.pcompact .given, .hubpage .given { font-family: ui-monospace, Consolas, monospace; font-size: 13px; color: var(--fg); }
.pcompact select { height: 34px; margin-top: 4px; }
.statbtns { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.statpick { display: grid; gap: 4px; margin: 6px 0 10px; }
.statstages { display: grid; gap: 4px; padding-left: 22px; }
.statstages label:has(input:disabled) { opacity: .5; }
.statbtns > button, .dlwrap > button { height: 40px; width: 100%; }
.dlwrap { position: relative; }
.dlpanel {
  position: absolute; right: 0; top: 46px; width: 270px; z-index: 5; padding: 6px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.14); display: flex; flex-direction: column;
}
.dlpanel[hidden] { display: none; }
.dlpanel button {
  display: flex; justify-content: space-between; align-items: baseline; gap: 10px; width: 100%;
  border: none; background: none; color: var(--fg); text-align: left; padding: 8px 10px; border-radius: 6px;
}
.dlpanel button:hover:not(:disabled) { background: var(--hover-bg); border: none; }
.dlpanel button:disabled { color: var(--muted); }
.dlpanel button .muted { font-size: 12px; }
.dlpanel button.sep { margin-top: 5px; box-shadow: 0 -1px 0 var(--line); border-radius: 0 0 6px 6px; }

/* ================= Tournament Setup ================= */
.setupgrid { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 56px; padding-top: 28px; align-items: start; }
.steplist { display: flex; flex-direction: column; gap: 2px; }
.stepbtn {
  display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 8px; width: 100%;
  padding: 9px 10px; border: none; border-radius: 10px; background: none;
  color: var(--fg); text-align: left; font: inherit; cursor: pointer;
}
.stepbtn:hover { background: var(--hover-bg); border: none; }
.stepbtn.on { background: var(--sel); }
.stepbtn .mark { font-weight: 700; color: var(--warn); }
.stepbtn .mark.done { color: var(--fg); }
.stepbtn .stext { display: flex; flex-direction: column; }
.stepbtn.on .slabel { font-weight: 600; }
.stepbtn .sdetail { font-size: 13px; color: var(--muted); }
.stepstart { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 18px; display: flex; flex-direction: column; gap: 8px; }
.stepstart button { height: 44px; width: 100%; }

#setupsec { min-width: 0; }
#setupsec h2 {
  font-size: 20px; padding-bottom: 10px; margin: 0 0 12px; border-bottom: 1px solid var(--fg);
}
#setupsec h2 ~ h2 { margin-top: 36px; }
#setupsec .setupintro { margin-top: 0; }
/* Password-protected stats: the switches the password above unlocks */
#setupsec .pwstats { margin-top: 14px; padding-left: 14px; border-left: 1px solid var(--line); }
/* the (i) beside Scoresheets, and the example it opens */
.infobtn { width: 20px; height: 20px; padding: 0; border-radius: 50%; font: italic 600 12px/18px Georgia, 'Times New Roman', serif;
  color: var(--muted); text-align: center; }
.infobtn[aria-expanded="true"] { color: var(--fg); border-color: var(--fg); }
#setupsec .sheetex { margin: 10px 0 4px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--hover-bg); max-width: 100%; overflow-x: auto; }
#setupsec .sheetex p { margin: 0 0 10px; font-size: 14px; max-width: 62ch; }
/* MODAQ settings: the same compact rows, no box around them */
.hubpage #fmtpanel.card { border: none; padding: 6px 0 0; }
.hubpage #fmtpanel.card:hover { background: none; }
.roomtable input.inlinename {
  background: transparent; border: none; border-bottom: 1px dashed var(--pick-line);
  border-radius: 0; padding: 4px 2px; width: 100%; max-width: 260px;
}
.roomtable input.inlinename:focus { border-bottom-color: var(--link); }
.roomtable td.linkpair { white-space: nowrap; }
.roomtable td.linkpair > * { vertical-align: middle; }
.roomtable td.linkpair a { margin-left: 4px; }
.roomtable td.linkpair a:not(.ico) { margin-left: 10px; }

@media (max-width: 900px) {
  .livegrid, .setupgrid { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .lrow .lacts, .broom .lacts { opacity: 1; }
  .bcols { grid-template-columns: minmax(0, 1fr); }
}
/* Packets: the heading row (title, round count, Add / Remove) carries the rule */
#setupsec .pkhead { align-items: center; border-bottom: 1px solid var(--fg); padding-bottom: 10px; margin-bottom: 0; }
#setupsec .pkhead h2 { border: 0; padding: 0; margin: 0; }
#setupsec .pkhead ~ h2 { margin-top: 36px; }
#setupsec .secnote { margin-top: 10px; }
/* the status line is a notice pinned to the bottom of the window, not a
   line of text above the tournament name */
#msg {
  position: fixed; left: 50%; bottom: 20px; transform: translate(-50%, 12px); z-index: 20;
  max-width: min(560px, calc(100vw - 32px)); min-height: 0; margin: 0;
  padding: 10px 16px; border-radius: 10px; background: var(--fg); color: var(--bg);
  font-size: 14px; box-shadow: 0 6px 20px rgba(0,0,0,0.18); cursor: pointer;
  opacity: 0; pointer-events: none; transition: opacity .15s, transform .15s;
}
#msg.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
#msg.bad { background: var(--bad); color: var(--bg); }
@media (prefers-reduced-motion: reduce) { #msg { transition: none; } }
/* ?debug only: the test-roster loader */
.debugrow { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); font-size: 13px; }

/* ================= Schedule step (schededit.js) ================= */
/* .lane-0..3 / .lane-x colors live in td.css (the room pages use them too) */
i.lane-x, .sglane > i, .sgtgroup > i, .sgmapcard i {
  display: inline-block; width: 8px; height: 8px; border-radius: 2px; background: var(--lc); flex: none;
}
.sgchips .chip i { margin-right: 6px; }
.small { font-size: 12px; }
.linkbtn { border: none; background: none; padding: 0; color: var(--link); font: inherit; font-size: 14px; cursor: pointer; }
.linkbtn:hover { text-decoration: underline; }

/* picker (schededit.js renderCreator): a column of label / setting rows,
   a section per phase, the round count big above Generate */
.pkpick { display: grid; gap: 14px; max-width: 720px; margin: 4px 0 6px; font-size: 14px; }
.pkgrid { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 12px 16px; align-items: baseline; }
.pkgrid select { width: auto; max-width: 100%; }
.pkl { color: var(--muted); }
.pksec { font-size: 15px; font-weight: 600; margin: 10px 0 0; padding-top: 12px; border-top: 1px solid var(--line); display: flex; gap: 10px; align-items: baseline; }
.pkname { font: inherit; font-weight: 600; border: 1px solid transparent; border-radius: 6px; padding: 1px 6px; margin-left: -7px; background: none; color: var(--fg); width: auto; }
.pkname:hover, .pkname:focus { border-color: var(--line); }
.pkrounds { font-size: 13px; font-weight: 400; color: var(--muted); }
.pktools { margin-left: auto; display: flex; gap: 14px; }
.pktools .linkbtn { font-size: 13px; font-weight: 400; }
.pkadd { font-size: 14px; }
.pkhelp { display: block; font-size: 13px; color: var(--muted); margin-top: 4px; max-width: 60ch; }
.pknote { color: var(--fg); }
.pkwarn { display: grid; gap: 4px; font-size: 13px; color: var(--warn); }
.pkwarn span::before { content: "! "; font-weight: 700; }
.pkrow { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.pkrow input.pkcount, .pkshared input { width: 56px; }
.pkrow input.pksizes { width: 160px; font-variant-numeric: tabular-nums; }
.pkcheck { display: inline-flex; gap: 8px; align-items: center; }
.pkshared { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.pktotalbox { margin: 6px 0 0; padding-top: 12px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; }
.pktotal { font-size: 22px; color: var(--fg); }
.pktotal b { font-weight: 600; }
.pktotal span { font-size: 15px; color: var(--muted); }
.pkfoot { gap: 16px; align-items: center; }
.pkaddphase { flex-direction: column; align-items: stretch; gap: 10px; }
.pkhand { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.pkhandcard { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; display: grid; gap: 2px; align-content: start; }
.pkhandhead { font-weight: 600; margin-bottom: 4px; display: flex; justify-content: space-between; align-items: baseline; }
.pkhandhead .muted { font-weight: 400; font-size: 13px; }
.pkhandrow { display: grid; grid-template-columns: 10px 22px minmax(0, 1fr) auto; align-items: center; gap: 6px; padding: 2px 4px; margin: 0 -4px; border-radius: 6px; cursor: grab; }
.pkhandrow:hover { background: var(--hover-bg); }
.pkhandgrip { color: var(--muted); font-size: 11px; letter-spacing: -3px; opacity: .6; user-select: none; }
.pkhandrow.drop-before { box-shadow: inset 0 2px 0 var(--link); }
.pkhandrow.drop-after { box-shadow: inset 0 -2px 0 var(--link); }
.pkhandcard.drop-end { outline: 2px solid var(--link); outline-offset: -2px; }
select.pkhandsel { width: auto; padding: 2px 6px; font-size: 13px; }
.pkhandseed { color: var(--muted); font-size: 13px; text-align: right; font-variant-numeric: tabular-nums; }
.pkhandname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pkhandseg { display: inline-flex; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
.pkhandseg button { border: 0; border-radius: 0; padding: 2px 9px; min-height: 0; font-size: 13px; background: transparent; color: var(--muted); }
.pkhandseg button + button { border-left: 1px solid var(--line); }
.pkhandseg button:not(:disabled):not(.on):hover { background: var(--hover-bg); color: var(--fg); }
.pkhandseg button.on { background: var(--fg); color: var(--bg); cursor: default; }
.pkhandseg button:disabled:not(.on) { opacity: .45; }
@media (max-width: 560px) {
  .pkgrid { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .pkgrid .pkl { margin-top: 8px; }
}
/* picker */
.sgnotice { display: flex; gap: 12px; align-items: center; padding: 8px 12px; border-radius: 8px; background: var(--sel); margin-bottom: 12px; font-size: 14px; }
.sgfillcheck { align-items: flex-start; justify-content: space-between; margin: 8px 0; }
.sgfillcheck ul { margin: 6px 0; padding-left: 20px; }
.sgfillcheck li { margin: 2px 0; }
.sgfillcheck .row { flex-shrink: 0; }
.sgcreatorhead { margin-bottom: 8px; }
.sgfmts { display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.sgfmt { display: flex; gap: 10px; align-items: baseline; padding: 10px 2px; border-bottom: 1px solid var(--line); cursor: pointer; }
.sgopts { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; margin: 14px 0 6px; font-size: 14px; color: var(--muted); }
.sgopts label { display: flex; gap: 8px; align-items: center; }
.sgopts select { font-size: 14px; }
.sgseed b { color: var(--fg); font-variant-numeric: tabular-nums; }
.sgpreview { font-size: 13px; color: var(--muted); margin: 4px 0 12px; }

/* editor chrome */
.sghead { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.sgviews { margin: 0; }
.sgchips { margin-bottom: 8px; }
.sgbar { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; padding: 8px 12px; border-radius: 10px; background: var(--sel); margin-bottom: 10px; font-size: 14px; }
.sgbar.unsaved { background: color-mix(in srgb, var(--warn) 12%, var(--bg)); }
.sgbar.unsaved > b { color: var(--warn); }
.sgbar .primary { padding: 4px 14px; }
.sgdel { color: var(--bad); }
.sgroomspanel { display: grid; gap: 4px; padding: 10px 12px; border-radius: 10px; background: var(--hover-bg); margin-bottom: 10px; }
.sgroomspanel[hidden] { display: none; }
.sgbody { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 20px; align-items: start; }
/* the Schedule heading, with the Full screen symbol in its corner */
.schedhead { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--fg); margin: 0 0 12px; }
#setupsec .schedhead h2 { border: none; margin: 0; }
.iconbtn {
  display: inline-grid; place-items: center; width: 32px; height: 32px; padding: 0;
  border: none; border-radius: 8px; background: none; color: var(--muted); cursor: pointer;
}
.iconbtn:hover { background: var(--hover-bg); color: var(--fg); border: none; }
.iconbtn[hidden] { display: none; }
/* Full screen (schededit.js setFull): the step covers the page, under
   the modals and the message, and the grid takes all the height left */
#schedsec.sgfull {
  position: fixed; inset: 0; z-index: 8; background: var(--bg); padding: 14px 20px 16px;
  display: flex; flex-direction: column; overflow: hidden;
}
#schedsec.sgfull > * { flex: none; }
#schedsec.sgfull > .sgexit { position: absolute; top: 8px; right: 16px; }
#schedsec.sgfull > .sghead { padding-right: 216px; }
/* Fit, and the TD's own zoom, beside the way out */
.sgzoom {
  position: absolute; top: 8px; right: 56px; display: inline-flex; align-items: center; gap: 2px;
  height: 32px; padding: 0 4px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px;
}
.sgzoom button { width: 26px; height: 24px; padding: 0; border: none; border-radius: 6px; font-size: 16px; line-height: 1; color: var(--fg); }
.sgzoom button:hover { background: var(--hover-bg); border: none; }
.sgzoom b { min-width: 44px; text-align: center; font-weight: 500; font-variant-numeric: tabular-nums; }
.sgzoom .fit { width: auto; padding: 0 9px; font-size: 13px; }
.sgzoom .fit.on { background: var(--sel); font-weight: 600; }
.sgzoom i { width: 1px; height: 18px; background: var(--line); margin: 0 3px; }
.sgclear { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.sgclear::before { content: "\2713"; color: var(--ok); font-weight: 700; }
/* the grid takes the whole width; the panel floats over its corner when it is wanted */
#schedsec.sgfull > .sgbody { flex: 1; min-height: 0; position: relative; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); align-items: stretch; }
#schedsec.sgfull .sgscroll { max-height: none; height: 100%; }
#schedsec.sgfull .sgside {
  position: absolute; top: 10px; right: 10px; z-index: 6; width: 280px; max-height: calc(100% - 20px); overflow: auto;
  display: flex; flex-direction: column; gap: 12px; order: 0;
  padding: 12px; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 28px rgba(0, 0, 0, 0.22);
}
#schedsec.sgfull .sgside[hidden] { display: none; }
.sgsidehide { align-self: flex-end; font-size: 13px; }
@media (max-width: 1100px) { .sgbody { grid-template-columns: minmax(0, 1fr); } }
.sgscroll { overflow: auto; max-height: min(78vh, 1100px); border: 1px solid var(--line); border-radius: 10px; background: var(--bg); overscroll-behavior: contain; }

/* the grid: sticky round column and header rows */
.sgphase { width: max-content; min-width: 100%; }
.sgphasehead { position: sticky; left: 0; display: flex; gap: 10px; align-items: baseline; border: none; background: none; padding: 12px 12px 8px; font: inherit; color: var(--fg); cursor: pointer; }
.sgphasehead .caret { font-size: 11px; color: var(--muted); width: 10px; }
.sgphasehead .muted { font-size: 13px; }
.sggrid { display: grid; column-gap: 4px; padding: 0 10px 12px 0; font-size: 13px; }
.sgcorner { position: sticky; left: 0; top: 0; z-index: 4; background: var(--bg); }
.sgcorner2 { top: 30px; }
.sglane { position: sticky; top: 0; z-index: 3; height: 30px; box-sizing: border-box; display: flex; align-items: center; gap: 6px;
  padding: 0 8px; border-radius: 8px 8px 0 0; background: var(--lt); font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; }
.sglane-byes { background: var(--bg); color: var(--muted); font-weight: 400; }
/* the right edge of a lane's heading: drag to set the width of its columns */
.sgresize { position: absolute; top: 0; right: 0; bottom: 0; width: 9px; cursor: col-resize; touch-action: none; }
.sgresize::after { content: ""; position: absolute; top: 7px; bottom: 7px; right: 3px; width: 2px; border-radius: 2px; background: currentColor; opacity: 0.28; }
.sgresize:hover::after, .sgresize.on::after { opacity: 0.9; background: var(--link); }
.sgroom { position: sticky; top: 30px; z-index: 3; height: 26px; border: none; border-bottom: 1px solid var(--line); border-radius: 0;
  background: var(--bg); padding: 0 8px; text-align: left; font: inherit; font-size: 11px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.sgroom:hover, .sgroom.on { color: var(--fg); }
.sgroom.on { box-shadow: inset 0 -2px 0 var(--link); }
.sgroom-byes { cursor: default; }
.sgrnd { position: sticky; left: 0; z-index: 2; background: var(--bg); border-top: 1px solid var(--line); padding: 6px 4px 6px 12px;
  display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--muted); }
.sgrnd.on { color: var(--bad); font-weight: 600; }
.sgrnd .rowtools { visibility: hidden; display: flex; gap: 2px; margin: 0; }
.sgrnd:hover .rowtools, .sgrnd:focus-within .rowtools { visibility: visible; }
.sgcell { position: relative; border-top: 1px solid var(--line); padding: 5px 22px 5px 6px; border-radius: 6px; min-width: 0;
  display: flex; flex-direction: column; gap: 1px; cursor: grab; }
.sggrid.dense .sgcell { flex-direction: row; align-items: center; gap: 3px; padding: 3px 20px 3px 5px; }
.sgcell:hover { background: var(--hover-bg); }
.sgcell.on { background: var(--sel); box-shadow: inset 0 0 0 2px var(--link); }
.sgcell.again { box-shadow: inset 0 0 0 1.5px var(--warn); }
.sgcell.empty { cursor: default; padding: 4px; }
.sgcell.empty:hover { background: none; }
.sgadd { width: 100%; height: 100%; min-height: 24px; border: 1px dashed transparent; border-radius: 6px; background: none;
  font: inherit; font-size: 11px; color: var(--muted); cursor: pointer; padding: 0; }
.sgcell.empty:hover .sgadd { border-color: var(--line); }
.sgcell.empty.on .sgadd { border-color: var(--link); }
.sgh { position: absolute; right: 2px; top: 3px; width: 18px; height: 18px; border: none; border-radius: 4px; padding: 0;
  background: none; color: var(--muted); font-size: 13px; line-height: 1; cursor: grab; opacity: 0; }
.sgcell:hover .sgh, .sgcell.on .sgh, .sgh:focus { opacity: 1; }
.sgh:hover { background: var(--pick); color: var(--fg); }
.sgtag { font-size: 10px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* the Shared rooms lane: a game wears its bracket's color; a picked chip fades the others */
.sgcell.mx { box-shadow: inset 3px 0 0 var(--lc); background: color-mix(in srgb, var(--lt) 70%, transparent); padding-left: 9px; }
.sgcell.mx:hover { background: var(--lt); }
.sgcell.mx .sgtag { color: var(--lc); font-weight: 600; font-size: 10.5px; }
.sgcell.mx.on { box-shadow: inset 3px 0 0 var(--lc), inset 0 0 0 2px var(--link); }
.sgcell.dim { opacity: 0.28; }
.sgifneeded { color: var(--warn); font-weight: 600; }
.sgslot { display: block; max-width: 100%; text-align: left; border: none; border-radius: 4px; margin: 0 -3px; padding: 1px 3px;
  background: none; font: inherit; font-size: 13px; color: var(--fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.sggrid.dense .sgslot { font-size: 12px; margin: 0; flex: 0 1 auto; }
.sgv { color: var(--muted); font-size: 11px; }
.sgslot:hover { background: var(--pick); }
.sgslot.ph { color: var(--muted); font-style: italic; }
.sgslot.none { color: var(--muted); font-style: italic; opacity: .7; }
.sgslot.bad { color: var(--bad); font-weight: 600; }
.sgslot.on { background: var(--sel); box-shadow: inset 0 0 0 1.5px var(--link); }
.sgslot.bye { background: var(--hover-bg); margin: 0; font-size: 12px; }
.sgbyes { border-top: 1px solid var(--line); padding: 5px 4px; display: flex; flex-direction: column; gap: 2px; min-width: 0; border-radius: 6px; }

/* dragging: valid targets outlined, the rest dimmed */
.sg-drag-slot .sgslot:not(.dragging), .sg-drag-slot .sgbyes, .sg-drag-slot .sgcell.empty .sgadd { outline: 1px dashed color-mix(in srgb, var(--link) 45%, transparent); outline-offset: -1px; }
.sg-drag-slot .sgh { opacity: 0; }
.sg-drag-game .sgcell:not(.dragging) { outline: 1px dashed color-mix(in srgb, var(--link) 45%, transparent); outline-offset: -2px; }
.sg-drag-game .sgbyes, .sg-drag-game .sgrnd { opacity: .4; }
.dragging { opacity: .45; }
.drop-ok, .sg-drag-slot .drop-ok, .sg-drag-game .drop-ok { outline: 2px solid var(--link) !important; outline-offset: -2px; background: var(--sel); }

/* by team */
.sgteams { display: grid; width: max-content; min-width: 100%; font-size: 12px; padding-bottom: 10px; }
.sgteams > .sgcorner { padding: 8px 10px; color: var(--muted); }
.sgthead { position: sticky; top: 0; z-index: 2; background: var(--bg); padding: 8px 6px; color: var(--muted); border-bottom: 1px solid var(--line); }
.sgthead.later { background: var(--hover-bg); }
.sgtgroup { grid-column: 1 / -1; position: sticky; left: 0; width: max-content; display: flex; gap: 8px; align-items: center; padding: 12px 10px 4px; font-size: 13px; font-weight: 600; }
.sgtname { position: sticky; left: 0; z-index: 1; background: var(--bg); padding: 6px 10px; border-top: 1px solid var(--line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.sgtc { border: none; border-top: 1px solid var(--line); background: none; padding: 5px 6px; text-align: left; font: inherit; font-size: 12px;
  color: var(--fg); cursor: pointer; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.sgtc small { display: block; font-size: 10px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.sgtc:hover { background: var(--hover-bg); }
.sgtc.bad { background: color-mix(in srgb, var(--bad) 12%, var(--bg)); color: var(--bad); }
.sgtc.later { background: var(--hover-bg); color: var(--muted); font-style: italic; }
.sgtc.muted { color: var(--muted); font-style: italic; }

/* brackets */
.sgmap { display: flex; gap: 16px; padding: 18px; align-items: flex-start; width: max-content; }
.sgmapcol { display: flex; flex-direction: column; gap: 8px; width: 250px; }
.sgmaphead { font-size: 12px; }
.sgarrow { align-self: center; color: var(--muted); font-size: 20px; }
.sgmapcard { display: flex; flex-direction: column; gap: 3px; text-align: left; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg); font: inherit; font-size: 13px; color: var(--fg); cursor: pointer; }
.sgmapcard > span:first-child { display: flex; gap: 8px; align-items: center; }
.sgmapcard .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 224px; }
.sgmapcard:hover { border-color: var(--link); }
.sgmapcard.static { cursor: default; }
/* Brackets view: a pool card lists its teams; pick two in different pools to trade */
.sgmapnote { max-width: 250px; margin-bottom: 2px; }
.sgmappool:hover { border-color: var(--line); }
.sgmaphd { display: flex; gap: 8px; align-items: center; font: inherit; color: var(--fg); background: none; border: none; padding: 0; cursor: pointer; text-align: left; }
.sgmaphd:hover b { color: var(--link); }
.sgmaprows { display: flex; flex-direction: column; margin: 4px 0 2px; min-width: 224px; }
.sgmaprow { display: flex; justify-content: space-between; align-items: center; gap: 8px; font: inherit; font-size: 14px; color: var(--fg);
  background: none; border: none; border-radius: 6px; padding: 3px 8px; margin: 0 -8px; text-align: left; line-height: 1.35; }
button.sgmaprow { cursor: pointer; }
button.sgmaprow:hover { background: var(--sel); }
.sgmaprow.on { background: var(--sel); box-shadow: inset 0 0 0 1.5px var(--link); }
.sgtradehint { color: var(--link); }
/* By team: a team row drags onto another pool's team to trade them */
.sgtname[draggable="true"] { cursor: grab; }
.sgtname[draggable="true"]::before { content: "⋮⋮"; color: var(--muted); margin-right: 6px; letter-spacing: -2px; }
.sgtname.dragging { opacity: 0.4; }
.sgtname.drop-ok { box-shadow: inset 0 0 0 2px var(--link); background: var(--sel); }

/* side panel + checks */
.sgside { display: flex; flex-direction: column; gap: 12px; position: sticky; top: 12px; font-size: 14px; }
.sgpanel { display: flex; flex-direction: column; gap: 6px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; }
.sglabel { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); padding-top: 4px; }
.sglabel select, .sglabel input { font-size: 13px; }
.sgpick { display: flex; flex-wrap: wrap; gap: 4px; }
.sgpick button.on { border-color: var(--link); }
.sgptitle { font-size: 15px; font-weight: 600; line-height: 1.3; }
/* the panel's actions: a line of links */
.sglinks { display: flex; flex-wrap: wrap; align-items: center; font-size: 14px; }
.sglinks .dot { color: var(--muted); margin: 0 8px; }
.sgrow { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.sgrow select, .sgrow input { flex: 1; min-width: 0; font-size: 14px; }
.sgpool { display: flex; justify-content: space-between; align-items: center; gap: 8px; border-top: 1px solid var(--line); padding-top: 8px; font-size: 14px; }
.sgpool i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; background: var(--lc); margin-right: 6px; }
/* the trade box: every other pool as a plain list */
.tp { display: flex; flex-direction: column; gap: 8px; }
.tp-find { font: inherit; font-size: 14px; width: 100%; }
.tp-pools { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px 20px; }
.tp-ph { display: flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 600; color: var(--muted); padding-bottom: 4px; margin-bottom: 2px; border-bottom: 1px solid var(--line); }
.tp-ph i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; background: var(--lc); }
.tp-ph .n { font-weight: 400; margin-left: auto; }
.tp-t { display: block; width: calc(100% + 16px); margin: 0 -8px; padding: 3px 8px; text-align: left; font: inherit; font-size: 14px; color: var(--fg);
  background: none; border: none; border-radius: 6px; cursor: pointer; line-height: 1.35; }
.tp-t:hover, .tp-t:focus-visible { background: var(--sel); color: var(--link); }
.tp-foot { display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--line); padding-top: 8px; font-size: 13px; }
.tp-pool[hidden], .tp-t[hidden] { display: none; }
.sgchecktitle { padding-bottom: 6px; border-bottom: 1px solid var(--fg); }
.sgcheck { display: grid; grid-template-columns: 16px minmax(0, 1fr); gap: 6px; width: 100%; text-align: left; border: none; border-bottom: 1px solid var(--line);
  background: none; padding: 6px 0; font: inherit; font-size: 13px; color: var(--fg); cursor: pointer; }
.sgcheck.ok, .sgcheck.off { cursor: default; }
.sgcheck.off > span:last-child { font-weight: 600; }
/* a problem under its check: a link to where it is */
.sgcheckitem { display: block; width: 100%; text-align: left; font: inherit; font-size: 13px; color: var(--link); background: none;
  border: none; padding: 2px 0 2px 22px; cursor: pointer; }
.sgcheckitem.muted { color: var(--muted); cursor: default; }
.sgcheck .bad, .sgcheck .warnc, .sgcheck .ok { font-weight: 700; }
.sgfix { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 4px 0 8px 22px; border-bottom: 1px solid var(--line); font-size: 13px; }
.sgfix select { font-size: 13px; }
.warnc { color: var(--warn); }
.sghelp { line-height: 1.45; }
/* narrow (the usual Setup width): the panel and checks sit in a band
   above the grid, so the grid gets the whole width */
#schedsec { container-type: inline-size; }
@container (max-width: 1150px) {
  .sgbody { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .sgside { order: -1; position: static; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 12px;
    max-height: 210px; }
  .sgside .sgpanel { overflow: auto; }
  .sgside .sgchecks { overflow: auto; max-height: 210px; }
  .sghelp { display: none; }
  /* while trading, the band grows to hold the lists and the checks step aside */
  .sgside.trading { max-height: none; grid-template-columns: minmax(0, 1fr); }
  .sgside.trading .sgpanel { overflow: visible; }
  .sgside.trading .sgchecks { display: none; }
}
#schedsec.sgfull .tp-pools { grid-template-columns: minmax(0, 1fr); }
.sgchipphase { font-size: 12px; color: var(--muted); margin: 0 2px 0 8px; }

/* ---------- the home page (index.html with no tournament open) ----------
   body.hubpage.homepage, set by admin.js showList(): the Live tab's grid.
   Left, the create form and this device's tournaments as a tight list
   that folds. Right, the rail (sidebar.js): what is live, and the past
   tournaments — a blue name is a link, a grey one has nothing to open. */
body.homepage .sitehead a[href="index.html"].muted { display: none; } /* "All tournaments": already here */
.homegrid { padding-top: 0; }
/* the one thing the page is for: labelled fields a size up, and the hub's
   filled button */
.newrow { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: flex-end; margin-bottom: 24px; }
.newrow label { display: grid; gap: 4px; flex: 1 1 180px; max-width: 280px; min-width: 0; font-size: 13px; font-weight: 600; }
.newrow input { height: 44px; font-size: 16px; font-weight: 400; width: 100%; min-width: 0; }
.newrow .advance { height: 44px; padding: 0 20px; font-size: 16px; }
.newrow .newhint { flex-basis: 100%; font-size: 13px; min-height: 1.5em; }
details.fold > summary {
  cursor: pointer; list-style: none; display: flex; align-items: center; gap: 10px;
  min-height: 40px; border-bottom: 1px solid var(--fg); font-size: 14px;
}
details.fold > summary::-webkit-details-marker { display: none; }
details.fold:not([open]) > summary { border-bottom-color: var(--line); }
details.fold > summary h2 { flex: 1; }
.trow {
  display: flex; gap: 14px; align-items: baseline; flex-wrap: wrap;
  padding: 4px 0; font-size: 14px; line-height: 1.4; border-bottom: 1px solid var(--line);
}
.trow .nm { flex: 1 1 160px; min-width: 0; font-weight: 600; }
.trow .st, .trow .linkbtn, .trow a:not(.nm) { font-size: 13px; }
.trow .st { color: var(--muted); }
.trow.none { color: var(--muted); display: block; }
/* the rail's lists: name left, date right; it scrolls in place when long */
.tside { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow-y: auto; }
.tside[hidden] { display: none; }
.tlist { display: flex; flex-direction: column; gap: 7px; font-size: 14px; }
.tlist .it { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.tlist span.it { color: var(--muted); }
.tlist .it small { color: var(--muted); font-size: 13px; white-space: nowrap; }
.tlist .yr { font-size: 12px; color: var(--muted); margin-top: 6px; }
.tlist .yr:first-child { margin-top: 0; }
.tlist .sethead { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.tlist .sethead small { color: var(--muted); font-size: 13px; white-space: nowrap; }
.tlist .itset .sites {
  display: flex; flex-direction: column; gap: 5px; margin: 5px 0 2px 3px;
  padding-left: 11px; border-left: 2px solid var(--line);
}
.tlist .dot { display: inline-block; width: 8px; height: 8px; border-radius: 99px; background: var(--ok); margin-right: 8px; }
@media (max-width: 760px) {
  .homegrid { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .tside { position: static; max-height: 360px; }
}

/* ---------- about.html ---------- */
body.aboutpage .wrap { max-width: 820px; }
.about { padding-top: 18px; }
.about p { max-width: 66ch; margin-bottom: 12px; }
.about .sechead { margin-top: 26px; }
.arow {
  display: grid; grid-template-columns: minmax(120px, 200px) minmax(0, 1fr); gap: 4px 16px; align-items: baseline;
  padding: 10px 8px; margin: 0 -8px; border-bottom: 1px solid var(--line); border-radius: 8px; color: var(--fg);
}
.arow:hover { background: var(--sel); text-decoration: none; }
.arow b { color: var(--link); font-weight: 600; }
.arow span { color: var(--muted); font-size: 14px; }
@media (max-width: 560px) { .arow { grid-template-columns: minmax(0, 1fr); } }
.credits { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; padding: 22px 0 8px; }
.credit { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; color: var(--fg); }
.credit:hover { text-decoration: none; }
.credit:hover b { color: var(--link); }
.credit b { font-weight: 600; font-size: 14px; }
.credit .logo {
  display: grid; place-items: center; width: 88px; max-width: 100%; aspect-ratio: 1;
  border: 1px solid var(--line); border-radius: 50%; overflow: hidden;
  color: var(--fg); font-weight: 700; font-size: 18px;
}
.credit:hover .logo { border-color: var(--link); }
.credit .logo img { width: 60%; height: 60%; object-fit: contain; }
@media (max-width: 560px) { .credits { gap: 2px; } .credit b { font-size: 11px; overflow-wrap: normal; } .credit .logo { width: 56px; font-size: 13px; } }
.hubpage .banner.playoffnote { align-items: baseline; font-size: 14px; }
.playoffnote > div > div + div { margin-top: 4px; }
/* Brackets view: renaming a bracket under its card */
.sgrenamebtn { align-self: flex-start; margin: 2px 0 6px 4px; }
.sgrename { margin: 2px 0 6px; gap: 6px; }
.sgrename input { font-size: 14px; padding: 3px 8px; }
/* Rooms: the bye room qb-td added for the schedule's byes */
#setupsec .byesec { margin-top: 22px; padding-top: 14px; border-top: 1px solid var(--line); }
#setupsec .byesec p { font-size: 13px; margin: 6px 0 0; }
#setupsec .byelink strong { font-size: 16px; }

/* Fix stats: Lineups, the moderator's Starters condensed */
.lucards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin: 8px 0 14px; font-size: 13px; }
.lucard { display: grid; gap: 6px; align-content: start; }
.luhead { display: flex; justify-content: space-between; gap: 8px; padding-bottom: 4px; border-bottom: 1px solid var(--line); }
.lustart { display: grid; }
.lup {
  display: flex; align-items: center; gap: 8px; text-align: left; font: inherit; color: var(--muted);
  background: none; border: none; border-radius: 0; padding: 2px 0; cursor: pointer;
}
.lup:hover { color: var(--fg); border: none; }
.lup .box {
  width: 14px; height: 14px; border-radius: 3px; border: 1.5px solid var(--muted); flex: none;
  display: grid; place-items: center; font-size: 10px; line-height: 1;
}
.lup.on { color: var(--fg); }
.lup.on .box { background: var(--link); border-color: var(--link); color: var(--bg); }
.lusubs { display: grid; gap: 2px; padding-top: 4px; border-top: 1px solid var(--line); }
.lusub { display: flex; gap: 8px; align-items: baseline; }
.lusub .muted { width: 28px; flex: none; font-variant-numeric: tabular-nums; }
.lusub .xbtn { margin-left: auto; }
.luaddwrap { position: relative; }
/* the Add substitution form floats over the panel, so nothing below moves */
.luadd {
  position: absolute; z-index: 6; top: calc(100% + 4px); left: 0; width: max-content;
  display: flex; flex-wrap: nowrap; gap: 6px; align-items: center; padding: 8px 10px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 6px 18px rgb(0 0 0 / 0.14);
}
.luadd select { font-size: 13px; padding: 2px 4px; max-width: 140px; }
.lucards > .lucard:nth-child(2) .luadd { left: auto; right: 0; }

/* a game's Download menu, beside Fix stats */
.fdl { position: relative; }
.fdl > summary { list-style: none; cursor: pointer; }
.fdl > summary::-webkit-details-marker { display: none; }
.fdlpanel {
  position: absolute; z-index: 8; top: calc(100% + 4px); left: 0; display: grid; gap: 2px; min-width: 110px;
  padding: 6px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.14);
}
.fdlpanel a, .fdlpanel button { padding: 3px 8px; border-radius: 5px; text-align: left; }
.fdlpanel a:hover, .fdlpanel button:hover { background: var(--hover-bg); text-decoration: none; }
.pprev { align-self: flex-start; }
