/* Rinkside — laid out on a fixed 921 x 1145 design canvas, then scaled to fit. */
:root {
  --bg: #000;
  --fg: #f4f4f4;
  --muted: #a3a3a3;
  --dim: #6f6f6f;
  --rule: #2c2c2c;
  --card: #1b1b1b;
  --win: #43b14b;
  --win-ink: #0f3d14;
  --loss: #d3233a;
  --otl: #c9ae7c;
  --future: #3e3e3e;
  --gold: #a68a52;
  --me-row: color-mix(in srgb, var(--primary) 45%, #2a2a2a);
  --primary: #0038a8;
  --accent: #ce1126;
  /* Fonts measured from the reference: headings Barlow Condensed Bold, small text Barlow Semi Condensed,
     numbers Rinkside Mono (fonts/build-font.py, chamfered athletic numerals). */
  --head: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --cond: 'Barlow Semi Condensed', 'Arial Narrow', sans-serif;
  --mono: 'Rinkside Mono', 'Barlow Semi Condensed', sans-serif;
  color-scheme: dark;
}

@font-face { font-family: 'Rinkside Mono'; src: url('fonts/RinksideMono.woff2') format('woff2'); font-display: block; }

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--fg); }
body { font-family: var(--cond); -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%; overflow-x: hidden; }

#stage { position: relative; width: 100%; }
/* remix background: the team's alternate logo tiled faintly (app.js), so the board still reads as before */
#remix { position: absolute; inset: 0; pointer-events: none; opacity: 0.13;
  -webkit-mask-image: linear-gradient(#000, rgba(0,0,0,.55) 30%, rgba(0,0,0,.55) 70%, #000);
          mask-image: linear-gradient(#000, rgba(0,0,0,.55) 30%, rgba(0,0,0,.55) 70%, #000); }
#remix svg { display: block; }
#board {
  position: absolute; left: 0; top: 0;
  width: 921px; height: 1145px;
  transform-origin: 0 0;
}

.abs { position: absolute; }
.mono { font-family: var(--mono); }
img.logo { object-fit: contain; display: block; }

/* ---------- header ---------- */
.hdr { left: 0; top: 0; width: 921px; height: 95px; }
.hdr .band { position: absolute; inset: 0 auto 0 0; width: 210px; height: 95px; }
.hdr .band img { position: absolute; left: 30px; top: -10px; width: 120px; height: 115px; }
.hdr .record {
  position: absolute; left: 217px; top: 11px;
  font: 400 53px/1 var(--mono); letter-spacing: -0.065em; white-space: nowrap;
}
.hdr .summary { position: absolute; left: 218px; top: 69px; font-size: 16.5px; font-weight: 500; white-space: nowrap; }
.hdr .summary b { font-weight: 700; }
.hdr .meta { position: absolute; right: 41px; top: 18px; text-align: right; color: #c8c8c8; font-size: 14px; font-weight: 500; line-height: 22.5px; white-space: nowrap; }
.hdr .meta div:first-child { font-size: 14.5px; margin-bottom: 3px; }

/* ---------- section titles ---------- */
.title { font: 700 22px var(--head); white-space: nowrap; }
.title .big { font: 400 21px var(--mono); margin-left: 14px; }
.note { color: var(--muted); font-size: 14px; font-weight: 500; white-space: nowrap; }
svg text { font-family: var(--cond); }

/* ---------- columns ---------- */
.col { top: 485px; }
.colhead {
  display: flex; justify-content: space-between; align-items: baseline;
  height: 26px; border-bottom: 1px solid var(--rule); margin-bottom: 0;
}
.colhead .t { font: 700 18px var(--head); }
.colhead .r { font: 400 15px var(--mono); color: #bdbdbd; }
.colhead .r.small { font: 600 10.5px var(--cond); letter-spacing: 0.12em; color: var(--muted); }
.colhead.big .t { font-size: 22px; }

/* division grids */
.div { margin-bottom: 18px; }
.drow { height: 27.2px; display: flex; align-items: center; }
.drow img.logo { width: 19px; height: 19px; margin: 0 0 0 6px; transform: scale(1.55); }
.drow .icons { display: flex; gap: 6px; margin-left: 14px; }
.icon { width: 18px; height: 18px; fill: var(--future); }
.icon.W { fill: var(--win); }
.icon.L { fill: var(--loss); }
.icon.O { fill: var(--otl); }
.icon.away { transform: translateY(0.5px); }

/* playoff picture */
.ppic .sub {
  display: flex; align-items: center; height: 22px; margin-top: 4px;
  font: 600 10.5px var(--cond); letter-spacing: 0.12em; color: var(--muted); text-transform: uppercase;
}
.ppic .sub .gp { margin-left: auto; width: 30px; text-align: right; }
.ppic .sub .pts { width: 40px; text-align: right; padding-right: 4px; }
.prow { display: flex; align-items: center; height: 26px; }
.prow.me { background: var(--me-row); }
.prow .lbl { width: 38px; padding-left: 5px; font: 600 10.5px var(--cond); letter-spacing: 0.06em; color: var(--muted); }
.prow img.logo { width: 20px; height: 20px; transform: scale(1.5); }
.prow .ab { margin-left: 10px; font: 700 17px var(--head); }
.prow .gp { margin-left: auto; width: 30px; text-align: right; font: 700 18.5px var(--head); }
.prow .pts { width: 40px; text-align: right; padding-right: 4px; font: 400 18.3px var(--mono); }
.cutline { height: 1.5px; margin: 1px 0 0; background: repeating-linear-gradient(to right, #8a8a8a 0 4px, transparent 4px 7px); }

.st { display: flex; gap: 8px; margin-top: 10px; }
.st .box { flex: 1; background: var(--card); border-radius: 4px; padding: 6px 7px 5px; height: 54px; }
.st .k { font: 700 10.5px var(--cond); letter-spacing: 0.1em; color: var(--otl); text-transform: uppercase; line-height: 1; }
.st .rk { font: 500 9.5px var(--cond); color: var(--muted); margin-top: 2px; line-height: 1; }
.st .v { font: 400 20.5px var(--mono); margin-top: 2px; line-height: 1; }
.st .v small { font-size: 11px; color: var(--muted); }

/* leaders */
.leaders { margin-top: 0; }
.lrow { display: flex; align-items: center; height: 55px; }
.lrow .face { width: 46px; height: 46px; border-radius: 50%; background: #1d1d1b; overflow: hidden; flex: none; border: 1.5px solid color-mix(in srgb, var(--primary) 80%, #fff); }
.lrow .face img { width: 100%; height: 100%; object-fit: cover; object-position: center top; }
.lrow .who { margin-left: 10px; line-height: 1; }
.lrow .k { font: 600 10px var(--cond); letter-spacing: 0.12em; color: var(--otl); text-transform: uppercase; }
.lrow .n { font: 700 18px var(--head); margin-top: 2px; }
.lrow .s { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.lrow .v { margin-left: auto; font: 400 26.6px var(--mono); padding-right: 2px; }

/* next 5 */
.ncard { position: relative; display: flex; align-items: center; height: 56px; margin-top: 7px; background: var(--card); border-radius: 4px; }
.ncard .date {
  position: relative; width: 73px; height: 56px; border: 1.5px solid var(--gold); border-right: 0; border-radius: 4px 0 0 4px;
  display: flex; align-items: center;
}
.ncard .dow {
  width: 20px; text-align: center; transform: rotate(-90deg); white-space: nowrap;
  font: 700 11px var(--cond); letter-spacing: 0.1em; color: var(--otl);
}
.ncard .day { flex: 1; text-align: center; font: 400 33px var(--mono); padding-right: 6px; }
.ncard .at { width: 32px; text-align: center; color: var(--muted); font: 500 15px var(--cond); }
.ncard img.logo { width: 38px; height: 38px; margin-left: 6px; transform: scale(1.35); }
.ncard .time { margin-left: auto; padding-right: 12px; font: 700 20px var(--head); }

/* last 5 */
.lgrow { display: flex; align-items: center; height: 39.3px; }
.lgrow img.logo { width: 26px; height: 26px; margin-left: 12px; transform: scale(1.7); }
.lgrow .res {
  width: 29px; height: 25px; margin-left: 21px; display: grid; place-items: center;
  font: 600 18px var(--head); border-radius: 1px;
}
.lgrow .res.W { background: var(--win); color: var(--win-ink); }
.lgrow .res.L { background: var(--loss); color: #fff; }
.lgrow .res.OT, .lgrow .res.SO { background: var(--otl); color: #3a2c12; font-size: 14px; }
.lgrow .sc { margin-left: 12px; font: 700 22px var(--head); }

/* footer */
.foot { left: 40px; top: 1118px; width: 840px; display: flex; align-items: center; font-size: 13.5px; font-weight: 500; color: #a8a8a8; white-space: nowrap; }
.foot .k { display: inline-flex; align-items: center; margin-right: 13px; }
.foot .sw { width: 9px; height: 9px; margin-right: 5px; display: inline-block; }
.foot .brand { margin-left: auto; font: 700 13.5px var(--head); letter-spacing: 0.15em; color: #bdbdbd; }

/* empty / error */
.msg { position: absolute; left: 40px; top: 40px; font-size: 22px; color: var(--muted); }

/* vertical rhythm, matched to the reference layout */
.drows { padding-top: 8px; }
.div { margin-bottom: 16px; }
.ppic .sub { height: 24px; margin-top: 0; }
.ppic .sub.first { margin-top: 10px; }
.st { margin-top: 8px; }
.lhead { margin-top: 16px; }
.leaders { padding-top: 10px; }
.nlist { padding-top: 5px; }
.l5head { margin-top: 15px; }
.llist { padding-top: 13px; }

/* team picker (not shown in wallpaper mode) */
.hdr .band[role="button"], .foot .brand { cursor: pointer; }
.picker {
  position: fixed; inset: 0; z-index: 10; background: rgba(0, 0, 0, 0.78);
  display: grid; place-items: center; padding: 16px; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.picker .sheet {
  width: min(720px, 100%); max-height: calc(100vh - 32px); overflow: auto;
  background: #121212; border: 1px solid var(--rule); border-radius: 8px; padding: 14px 16px 18px;
}
.picker .ph { display: flex; justify-content: space-between; align-items: center; font: 700 22px var(--head); }
.picker .x { background: none; border: 0; color: var(--muted); font-size: 28px; line-height: 1; cursor: pointer; padding: 0 4px; }
.picker .pgt { margin: 14px 0 6px; font: 700 11px var(--cond); letter-spacing: 0.12em; text-transform: uppercase; color: var(--otl); }
.picker .pgl { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 6px; }
.picker .pt {
  display: flex; align-items: center; gap: 10px; padding: 6px 8px; min-height: 44px;
  background: var(--card); border: 1px solid transparent; border-radius: 4px;
  color: var(--fg); font: 600 15px var(--cond); text-align: left; cursor: pointer;
}
.picker .pt img.logo { width: 30px; height: 30px; transform: scale(1.4); flex: none; }
.picker .pt:hover, .picker .pt:focus-visible { border-color: #555; outline: none; }
.picker .pt.on { border-color: var(--gold); }

/* ---------- detail popups (live page only) ---------- */
[data-pop] { cursor: pointer; }
.hit { fill: transparent; }
.hit:hover, .hit.is-active { fill: rgba(255, 255, 255, 0.07); }
.prow[data-pop]:hover, .lrow[data-pop]:hover, .lgrow[data-pop]:hover { background: rgba(255, 255, 255, 0.04); }
.prow.me[data-pop]:hover { background: color-mix(in srgb, var(--me-row) 85%, #fff); }
.ncard[data-pop]:hover, .st .box[data-pop]:hover { background: #242424; }
.icon[data-pop]:hover { filter: brightness(1.35); }
.is-active:not(.hit) { outline: 1px solid var(--gold); outline-offset: 1px; }
.record[data-pop]:hover, .summary[data-pop]:hover { opacity: 0.85; }

.pop {
  position: absolute; z-index: 20; width: min(268px, calc(100vw - 20px));
  background: #141414; border: 1px solid #2e2e2e; border-top: 2px solid var(--gold); border-radius: 4px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6); padding: 10px 12px 11px;
  font-family: var(--cond); color: var(--fg); animation: pop-in 0.12s ease-out;
}
@keyframes pop-in { from { opacity: 0; transform: translateY(3px); } }
.pop .px { position: absolute; top: 4px; right: 6px; background: none; border: 0; color: var(--dim); font-size: 20px; line-height: 1; cursor: pointer; padding: 2px 4px; }
.pop .px:hover { color: var(--fg); }
.pop .pk { font: 700 10.5px var(--cond); letter-spacing: 0.12em; text-transform: uppercase; color: var(--otl); padding-right: 18px; }
.pop .pt { display: flex; align-items: center; gap: 8px; margin-top: 5px; font: 700 18px/1.15 var(--head); }
.pop .pt img.logo { width: 26px; height: 26px; flex: none; transform: scale(1.35); }
.pop .pt .big { font-size: 24px; }
.pop .m { font-family: var(--mono); font-weight: 400; }
.pop .face.sm { width: 30px; height: 30px; border-radius: 50%; overflow: hidden; background: #1d1d1b; border: 1.5px solid color-mix(in srgb, var(--primary) 80%, #fff); flex: none; }
.pop .face.sm img { width: 100%; height: 100%; object-fit: cover; object-position: center top; }
.pop .ps { display: flex; align-items: center; gap: 8px; margin-top: 8px; padding: 6px 8px; background: var(--card); border-radius: 3px; }
.pop .ps .res { width: 26px; height: 22px; display: grid; place-items: center; font: 600 15px var(--head); border-radius: 1px; }
.pop .ps .res.W { background: var(--win); color: var(--win-ink); }
.pop .ps .res.L { background: var(--loss); color: #fff; }
.pop .ps .res.OT, .pop .ps .res.SO { background: var(--otl); color: #3a2c12; font-size: 12px; }
.pop .ps .res.live { width: auto; padding: 0 5px; background: var(--loss); color: #fff; font-size: 11px; letter-spacing: 0.08em; }
.pop .psc { font: 400 22px var(--mono); }
.pop .pst { margin-left: auto; color: var(--muted); font-size: 13px; font-weight: 500; text-align: right; }
.pop .prows { margin: 8px 0 0; display: grid; gap: 3px; }
.pop .prows div { display: flex; justify-content: space-between; gap: 12px; font-size: 13.5px; line-height: 1.35; }
.pop .prows dt { color: var(--muted); font-weight: 500; }
.pop .prows dd { margin: 0; text-align: right; font-weight: 600; }
.pop .prows dd.m { font: 400 14.5px var(--mono); }
.pop .pgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-top: 9px; }
.pop .pgrid div { background: var(--card); border-radius: 3px; padding: 5px 4px 4px; text-align: center; }
.pop .pgrid b { display: block; font-size: 17px; line-height: 1.1; }
.pop .pgrid span { font: 600 9.5px var(--cond); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.pop .plink { display: inline-block; margin-top: 9px; color: var(--otl); font: 700 11px var(--cond); letter-spacing: 0.1em; text-transform: uppercase; text-decoration: none; }
.pop .plink:hover { text-decoration: underline; }

.drow .dl { display: inline-flex; }
.colhead[data-pop]:hover .t, .title [data-pop]:hover, .meta [data-pop]:hover { color: #fff; text-decoration: underline; text-decoration-color: var(--gold); text-underline-offset: 3px; }
.pop .pnote { margin-top: 8px; color: var(--dim); font-size: 12px; line-height: 1.35; }

/* ---------- slots + customize mode ---------- */
.slot > .box { height: 100%; }
.st .slot .box { flex: none; }
.trow { display: flex; align-items: center; height: 27.2px; font-size: 14px; }
.trow .tn { width: 16px; color: var(--muted); font: 600 11px var(--cond); text-align: right; margin-right: 6px; }
.trow img.logo { width: 18px; height: 18px; transform: scale(1.45); }
.trow .ab { margin-left: 9px; font: 700 15px var(--head); }
.trow .gp { margin-left: auto; width: 26px; text-align: right; font: 700 15px var(--head); color: #cfcfcf; }
.trow .pts { width: 30px; text-align: right; font: 400 15px var(--mono); }
.trow.me { background: var(--me-row); }
.trow[data-pop]:hover, .drow[data-pop]:hover { background: rgba(255, 255, 255, 0.04); }
.lgrow .nd { margin-left: 18px; min-width: 64px; padding: 2px 6px; border: 1.5px solid var(--gold); border-radius: 3px;
  font: 700 12px var(--cond); letter-spacing: 0.08em; color: var(--otl); text-align: center; }
.lgrow .sc.nt { font-size: 18px; }
.ncard .time .res { display: inline-grid; place-items: center; width: 24px; height: 21px; margin-right: 4px; font: 600 15px var(--head); border-radius: 1px; vertical-align: 2px; }
.ncard .time .res.W { background: var(--win); color: var(--win-ink); }
.ncard .time .res.L { background: var(--loss); color: #fff; }
.ncard .time .res.OT, .ncard .time .res.SO { background: var(--otl); color: #3a2c12; font-size: 12px; }

body.editing .slot.editable { outline: 1.5px dashed rgba(201, 174, 124, 0.75); outline-offset: 2px; cursor: pointer; border-radius: 2px; }
body.editing .slot.editable:hover, body.editing .slot.is-active { outline-style: solid; outline-color: var(--gold); background: rgba(201, 174, 124, 0.06); }
body.editing [data-pop] { cursor: inherit; }
.slot .swap { display: none; }
body.editing .slot .swap {
  display: grid; place-items: center; position: absolute; top: -9px; right: -9px; z-index: 3;
  width: 26px; height: 26px; border-radius: 50%; border: 0; background: var(--gold); color: #141414;
  font: 700 15px var(--head); cursor: pointer; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
}
.editbar {
  position: fixed; left: 50%; bottom: max(14px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 15;
  display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 14px; max-width: calc(100vw - 20px);
  background: #141414; border: 1px solid #2e2e2e; border-top: 2px solid var(--gold); border-radius: 6px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7); font: 500 14px var(--cond); color: var(--muted);
}
.editbar span { margin-right: 4px; }
.editbar button { border: 1px solid #3a3a3a; background: var(--card); color: var(--fg); font: 700 13px var(--head); letter-spacing: 0.04em;
  padding: 7px 11px; border-radius: 4px; cursor: pointer; white-space: nowrap; min-height: 34px; }
.editbar button.on { background: var(--gold); border-color: var(--gold); color: #141414; }
@media (max-width: 520px) { .editbar span { display: none; } }
.pop.menu { width: min(300px, calc(100vw - 20px)); max-height: 60vh; overflow: auto; }
.pop .opts { display: grid; gap: 4px; margin-top: 8px; }
.pop .opt { text-align: left; border: 1px solid transparent; background: var(--card); color: var(--fg); font: 600 14.5px var(--cond);
  padding: 8px 10px; border-radius: 3px; cursor: pointer; min-height: 36px; }
.pop .opt:hover { border-color: #555; }
.pop .opt.on { border-color: var(--gold); color: #fff; }
.pop .opt.on::after { content: '  \2713'; color: var(--otl); }
.picker .ph .cust { margin-left: auto; margin-right: 8px; border: 1px solid var(--gold); background: none; color: var(--otl);
  font: 700 13px var(--head); letter-spacing: 0.05em; padding: 6px 10px; border-radius: 4px; cursor: pointer; }
.picker .ph .cust:hover { background: rgba(201, 174, 124, 0.12); }

/* ---------- phone layout (body.stack: under 700px wide) ---------- */
body.stack .hdr { width: 500px; }
body.stack .hdr .summary { left: 16px; top: 106px; }
body.stack .hdr .meta { left: 16px; right: auto; top: 134px; text-align: left; line-height: 21px; }
body.stack .hdr .meta div:first-child { margin-bottom: 0; }
body.stack .foot { flex-wrap: wrap; row-gap: 6px; }
body.stack .foot .brand { margin-left: 0; width: 100%; }

/* dashed edges drawn as gradients: CSS dashed borders vanish on phones when the board is scaled down */
.ncard .date::after { content: ''; position: absolute; top: -1.5px; bottom: -1.5px; right: 0; width: 1.5px;
  background: repeating-linear-gradient(to bottom, var(--gold) 0 3.5px, transparent 3.5px 6.5px); }

.st .k, .st .rk { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- scoring chances report ---------- */
.ch { margin-top: 8px; }
.ch .chh { display: flex; align-items: center; gap: 6px; padding: 4px 2px 8px; }
.ch .chh img.logo { width: 30px; height: 30px; transform: scale(1.35); }
.ch .chh > .m { font: 400 30px var(--mono); }
.ch .chh .cf { flex: 1; text-align: center; color: var(--muted); font: 600 10.5px/1.3 var(--cond); letter-spacing: 0.08em; text-transform: uppercase; }
.ch .chr { display: grid; grid-template-columns: 1fr 86px 1fr; align-items: stretch; min-height: 38px; margin-top: 2px; }
.ch .cl { display: flex; align-items: center; justify-content: center; gap: 5px; text-align: center; color: #cfcfcf;
  font: 700 10px/1.15 var(--cond); letter-spacing: 0.09em; text-transform: uppercase; }
.ch .cl i { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.ch .cv { display: flex; flex-direction: column; align-items: center; justify-content: center; background: var(--card); border-radius: 3px; padding: 3px 2px; }
.ch .cv.win { background: color-mix(in srgb, var(--tint, #3a3a3a) 28%, var(--card)); }
.ch .cv b { font-size: 19px; line-height: 1.05; }
.ch .cv small { color: var(--muted); font: 500 10.5px var(--cond); white-space: nowrap; }
.ch .chf { display: flex; justify-content: space-between; gap: 6px; margin-top: 8px; padding-top: 7px; border-top: 1px solid var(--rule);
  color: var(--muted); font: 600 10px var(--cond); letter-spacing: 0.04em; text-transform: uppercase; }
.ch .chf b { color: var(--fg); font-size: 12px; margin-left: 3px; }
.ch.compact .chh { padding-bottom: 4px; }
.ch.compact .chh > .m { font-size: 24px; }
.ch.compact .chh img.logo { width: 24px; height: 24px; }
.ch.compact .chr { min-height: 30px; }
.ch.compact .cv b { font-size: 16px; }
.ch.compact .cv small { font-size: 9.5px; }
.pop .ch { margin-top: 6px; }
