/* Sports Desk — International Typographic Style: grid, flush-left sans, black/white + one red. */
:root {
  --bg: #ffffff;
  --ink: #111111;
  --ink-2: #4a4a4a;
  --ink-3: #8a8a8a;
  --rule: #111111;
  --hair: #d9d9d9;
  --panel: #f4f4f2;
  --red: #e30613;
  --red-ink: #ffffff;
  --win: #111111;
  --loss: #8a8a8a;
  --focus: #e30613;
  --font: "Helvetica Neue", Helvetica, "Inter", Arial, system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --gutter: 24px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121212; --ink: #f2f2f2; --ink-2: #bdbdbd; --ink-3: #7d7d7d; --rule: #f2f2f2; --hair: #2e2e2e;
    --panel: #1c1c1c; --red: #ff3b3b; --win: #f2f2f2; --loss: #7d7d7d; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121212; --ink: #f2f2f2; --ink-2: #bdbdbd; --ink-3: #7d7d7d; --rule: #f2f2f2; --hair: #2e2e2e;
  --panel: #1c1c1c; --red: #ff3b3b; --win: #f2f2f2; --loss: #7d7d7d; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 var(--font);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
h2 { margin: 0; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; font-weight: 700; }
code { font-family: var(--mono); font-size: .9em; }

/* ------------------------------------------------------------------ masthead */
.masthead { border-bottom: 3px solid var(--rule); position: sticky; top: 0; z-index: 20; background: var(--bg); }
.mast-inner {
  max-width: 1320px; margin: 0 auto; padding: 14px var(--gutter) 12px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 28px; height: 28px; background: var(--red); position: relative; flex: none; }
.brand-mark::after { content: ""; position: absolute; left: 7px; right: 7px; bottom: 7px; height: 4px; background: var(--red-ink); }
.brand-title { font-size: 22px; font-weight: 700; letter-spacing: -.02em; line-height: 1; }
.mast-controls { display: flex; align-items: center; gap: 8px; }
.datenav { display: flex; align-items: stretch; border: 1px solid var(--rule); }
.datenav select, .datenav input { border: 0; border-left: 1px solid var(--rule); border-right: 1px solid var(--rule); background: var(--bg); color: var(--ink); padding: 6px 8px; font: inherit; font-weight: 700; min-width: 0; }
.datenav [hidden] { display: none; }
.icon-btn { border: 0; background: transparent; padding: 6px 10px; cursor: pointer; line-height: 1; display: inline-flex; align-items: center; }
@media (hover: hover) { .icon-btn:hover { background: var(--panel); } }
.icon-btn:disabled, .btn:disabled { opacity: .35; cursor: default; }
.statusline { max-width: 1320px; margin: 0 auto; padding: 0 var(--gutter) 8px; font-size: 12px; color: var(--ink-2); display: flex; gap: 14px; flex-wrap: wrap; }
.statusline .dot { display: inline-block; width: 8px; height: 8px; background: var(--ink-3); margin-right: 6px; vertical-align: 1px; }
.statusline .dot.live { background: var(--red); animation: pulse 1s infinite alternate; }
.statusline .warn { color: var(--red); }
@keyframes pulse { to { opacity: .3; } }

/* ------------------------------------------------------------------ buttons */
.btn { border: 1px solid var(--rule); background: var(--bg); padding: 7px 14px; cursor: pointer; font-weight: 700; font-size: 13px; letter-spacing: .02em; }
.btn:hover { background: var(--ink); color: var(--bg); }
.btn.primary { background: var(--red); border-color: var(--red); color: var(--red-ink); }
.btn.primary:hover { filter: brightness(.92); background: var(--red); color: var(--red-ink); }
.btn.ghost { border-color: var(--hair); }
.btn.small { padding: 3px 9px; font-size: 12px; font-weight: 600; }
.btn.wide { width: 100%; padding: 14px; font-size: 15px; }
.btn[disabled] { opacity: .45; cursor: default; }

/* ------------------------------------------------------------------ layout */
.layout { max-width: 1320px; margin: 0 auto; padding: 0 var(--gutter) 80px; display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 40px; }
.section { padding-top: 28px; }
.sec-head { display: grid; grid-template-columns: 44px 1fr auto; align-items: baseline; border-top: 1px solid var(--rule); padding-top: 8px; margin-bottom: 14px; }
.sec-num { font-size: 13px; font-weight: 700; color: var(--red); }
.sec-meta { font-size: 12px; color: var(--ink-2); }
.col-preview { padding-top: 28px; }
.preview-sticky { position: sticky; top: 108px; }
.tabs { display: none; }
.copybar { display: none; }

/* ------------------------------------------------------------------ cards */
.cards { display: grid; gap: 14px; }
.card { border: 1px solid var(--hair); border-top: 3px solid var(--rule); background: var(--bg); }
.card.off { border-top-color: var(--hair); }
.card.off .card-body, .card.off .wording { display: none; }
.card-top { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 10px 12px 0; }
.incl { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.incl input, .fact input, .srow input { position: absolute; opacity: 0; pointer-events: none; width: 1px; height: 1px; }
.fact, .srow, .incl { position: relative; }
.box { width: 18px; height: 18px; border: 2px solid var(--rule); display: inline-block; position: relative; flex: none; background: var(--bg); }
input:checked + .box { background: var(--rule); }
input:checked + .box::after { content: ""; position: absolute; left: 4px; top: 0px; width: 5px; height: 10px; border: solid var(--bg); border-width: 0 2px 2px 0; transform: rotate(45deg); }
input:focus-visible + .box { outline: 2px solid var(--focus); outline-offset: 2px; }
.team { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); font-weight: 600; }
.card-tools { display: flex; gap: 4px; }
.card-tools .icon-btn { padding: 4px 6px; font-size: 14px; color: var(--ink-2); }
.scoreline { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: end; padding: 6px 12px 10px; }
.big { font-size: 46px; line-height: .9; font-weight: 700; letter-spacing: -.035em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.big .res { color: var(--red); margin-right: 8px; }
.big.loss .res { color: var(--ink-3); }
.big.none { font-size: 22px; color: var(--ink-3); letter-spacing: 0; font-weight: 600; }
.matchup { padding-bottom: 3px; min-width: 0; }
.matchup .opp { font-size: 18px; font-weight: 700; letter-spacing: -.01em; line-height: 1.15; }
.matchup .meta { font-size: 12px; color: var(--ink-2); margin-top: 2px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.chip { display: inline-block; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; padding: 1px 6px; border: 1px solid var(--hair); color: var(--ink-2); }
.chip.box-l { border-color: var(--rule); color: var(--ink); }
.chip.red { border-color: var(--red); color: var(--red); }
.links a { color: var(--ink-2); font-size: 12px; }
.warnline { margin: 0 12px 8px; font-size: 12px; color: var(--red); }

.card-body { border-top: 1px solid var(--hair); }
.fgroup { display: grid; grid-template-columns: 76px 1fr; border-bottom: 1px solid var(--hair); }
.fgroup:last-child { border-bottom: 0; }
.fgroup-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; color: var(--ink-3); padding: 10px 12px; }
.fitems { padding: 4px 12px 4px 0; display: grid; }
.fact { display: grid; grid-template-columns: 22px 1fr auto; gap: 8px; align-items: start; padding: 6px 0; cursor: pointer; }
.fact + .fact { border-top: 1px dotted var(--hair); }
.fact .box { width: 16px; height: 16px; margin-top: 2px; }
.fact input:checked + .box::after { left: 3px; top: -1px; }
.fact-main { min-width: 0; }
.fact-label { font-weight: 600; }
.fact-detail { color: var(--ink-2); font-size: 13px; }
.reasons { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.reason { font-size: 11px; color: var(--ink-2); background: var(--panel); padding: 0 6px; }
.reason.hot { color: var(--red); background: transparent; border: 1px solid var(--red); }
.meter { display: grid; justify-items: end; gap: 3px; padding-top: 2px; }
.bars { display: grid; grid-template-columns: repeat(4, 6px); gap: 2px; align-items: end; height: 16px; }
.bars i { display: block; background: var(--hair); }
.bars i:nth-child(1) { height: 5px; } .bars i:nth-child(2) { height: 8px; } .bars i:nth-child(3) { height: 12px; } .bars i:nth-child(4) { height: 16px; }
.bars i.on { background: var(--ink); }
.meter.standout .bars i.on { background: var(--red); }
.tier { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; color: var(--ink-3); }
.meter.standout .tier { color: var(--red); }
.meter.strong .tier { color: var(--ink); }
.showall { font-size: 12px; color: var(--ink-2); background: none; border: 0; padding: 6px 0; cursor: pointer; text-decoration: underline; text-align: left; }

.manual { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 10px 12px; }
.seg { display: inline-flex; border: 1px solid var(--rule); }
.seg button { border: 0; background: var(--bg); padding: 4px 12px; font-weight: 700; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--rule); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.manual input { width: 60px; border: 1px solid var(--hair); padding: 4px 6px; background: var(--bg); }

.wording { border-top: 1px solid var(--rule); padding: 10px 12px 12px; background: var(--panel); }
.wording p { margin: 0 0 8px; font-size: 15px; line-height: 1.5; }
/* side-by-side layout: the paragraph is already in the preview (highlighted on hover) */
@media (min-width: 981px) { .wording p { display: none; } .wording { padding-top: 8px; padding-bottom: 8px; } }
.wording textarea { width: 100%; min-height: 110px; border: 1px solid var(--rule); padding: 8px; background: var(--bg); line-height: 1.5; resize: vertical; }
.wording-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.wording-actions .hint { font-size: 12px; color: var(--ink-3); margin-left: auto; }
.edited { color: var(--red); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }

details.more { margin-top: 18px; border-top: 1px solid var(--hair); }
details.more summary { cursor: pointer; padding: 10px 0; font-size: 13px; font-weight: 700; list-style: none; }
details.more summary::before { content: "+"; display: inline-block; width: 18px; color: var(--red); }
details.more[open] summary::before { content: "–"; }
details.more summary::-webkit-details-marker { display: none; }

.empty { border: 1px dashed var(--hair); padding: 18px; color: var(--ink-2); font-size: 14px; }

/* ------------------------------------------------------------------ schedule */
.sday { margin-bottom: 18px; }
.sday-head { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 4px; color: var(--ink-2); }
.srow { display: grid; grid-template-columns: 22px 64px 1fr; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--hair); align-items: start; cursor: pointer; }
.srow .box { width: 16px; height: 16px; margin-top: 2px; }
.srow input:checked + .box::after { left: 3px; top: -1px; }
.stime { font-weight: 700; font-variant-numeric: tabular-nums; }
.stext { min-width: 0; }
.stext .line { font-weight: 600; }
.stext .sub { font-size: 12px; color: var(--ink-2); }
.srow.dead .line { font-weight: 400; color: var(--ink-2); }
.srow.dead .stime { color: var(--ink-3); }

/* ------------------------------------------------------------------ notes / fields */
.field { display: grid; gap: 4px; margin-bottom: 12px; }
.field > span { font-size: 12px; font-weight: 700; color: var(--ink-2); }
.field input, .field textarea, .field select { width: 100%; border: 1px solid var(--hair); padding: 8px; background: var(--bg); }
.field textarea { resize: vertical; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.check { display: flex; gap: 8px; align-items: center; font-size: 14px; margin: 4px 0 12px; }

/* ------------------------------------------------------------------ preview */
.preview { border: 1px solid var(--rule); padding: 18px 20px; background: var(--bg); min-height: 200px; max-height: calc(100vh - 230px); overflow: auto; font-size: 15px; line-height: 1.55; }
.preview p { margin: 0 0 12px; }
.preview p.list-head { margin-bottom: 4px; }
.preview ul { margin: 0 0 12px; padding-left: 18px; }
.preview li { margin: 2px 0; }
.preview .hl { background: color-mix(in srgb, var(--red) 12%, transparent); outline: 1px solid color-mix(in srgb, var(--red) 35%, transparent); }
.preview-actions { display: flex; gap: 8px; margin-top: 10px; }
.preview-actions .btn.primary { flex: 1; padding: 11px; font-size: 14px; }

/* ------------------------------------------------------------------ dialog / toast */
dialog { border: 3px solid var(--rule); padding: 0; max-width: 640px; width: calc(100% - 32px); background: var(--bg); color: var(--ink); }
dialog::backdrop { background: rgba(0, 0, 0, .35); }
.dlg { padding: 18px 20px 20px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%) translateY(20px); background: var(--ink); color: var(--bg); padding: 10px 16px; font-weight: 700; font-size: 14px; opacity: 0; pointer-events: none; transition: .2s; z-index: 50; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ------------------------------------------------------------------ narrow screens */
@media (max-width: 980px) {
  :root { --gutter: 16px; }
  .layout { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .tabs { display: grid; grid-template-columns: repeat(3, 1fr); position: sticky; top: 0; z-index: 15; background: var(--bg); border-bottom: 1px solid var(--rule); }
  .tabs button { border: 0; background: var(--bg); padding: 11px 0; font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; cursor: pointer; color: var(--ink-3); border-bottom: 3px solid transparent; }
  .tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--red); }
  [data-pane] { display: none; }
  body[data-tab="results"] [data-pane="results"], body[data-tab="schedule"] [data-pane="schedule"], body[data-tab="preview"] [data-pane="preview"] { display: block; }
  .masthead { position: static; }
  .preview-sticky { position: static; }
  .preview { max-height: none; }
  .copybar { display: block; position: fixed; left: 0; right: 0; bottom: 0; padding: 10px var(--gutter) calc(10px + env(safe-area-inset-bottom)); background: var(--bg); border-top: 1px solid var(--rule); z-index: 30; }
  .preview-actions .btn.primary { display: none; }
  /* the tab already names these sections */
  #sec-results .sec-head, #sec-schedule .sec-num, .col-preview .sec-num, .col-preview h2 { display: none; }
  .col-preview .sec-head { grid-template-columns: 1fr; justify-items: end; }
  .big { font-size: 38px; }
  .fgroup { grid-template-columns: 1fr; }
  .fgroup-label { padding: 8px 12px 0; }
  .fitems { padding: 0 12px 4px; }
  .field-row { grid-template-columns: 1fr; }
  #sec-schedule .sec-head { display: none; }
  .fgroup-label { font-size: 11.5px; }
  .reason { font-size: 12px; }
  .chip { font-size: 11.5px; }
}
#refreshBtn .ico { display: none; }
.nw { white-space: nowrap; }
dialog h2:focus { outline: none; }
/* touch screens: finger-sized hit areas without changing the look */
@media (pointer: coarse), (max-width: 520px) {
  .card-tools .icon-btn { min-width: 40px; min-height: 40px; justify-content: center; margin: -9px 0; }
  .btn.small { min-height: 38px; padding: 6px 14px; font-size: 13px; }
  .incl { min-height: 40px; min-width: 40px; padding: 0 11px; margin: -11px -11px; }
  .showall { min-height: 40px; }
  .card a { padding: 10px 0; }
}
@media (max-width: 520px) {
  .mast-inner { gap: 10px; }
  .mast-controls { width: 100%; }
  .datenav { flex: 1 1 auto; min-width: 0; }
  .datenav select, .datenav input { flex: 1 1 auto; min-width: 0; width: 100%; }
  #refreshBtn .lbl { display: none; }
  #refreshBtn .ico { display: inline; font-size: 16px; }
  #refreshBtn { padding: 6px 11px; }
  .scoreline { grid-template-columns: 1fr; gap: 4px; }
  /* the line already says the time */
  .srow { grid-template-columns: 22px 1fr; }
  .srow .stime { display: none; }
}
