/* Base layout. scoreboard.css loads after this and restyles it as the Scoreboard design. */
:root {
  --bg: #f4f1ea;
  --card: #fffdf8;
  --ink: #16130f;
  --muted: #857f73;
  --faint: #cfc9bc;
  --line: #e0dbcf;
  --alert: #e5361f;
  --gold: #a8730d;
  --display: "Barlow Condensed", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  --body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --intro-bg: #14110d;
  --intro-fg: #f4f1ea;
  --intro-accent: #ff4a2e;
}

/* One color per sport. */
.s-baseball { --sport: #2f66d0; }
.s-football { --sport: #8a4f22; }
.s-basketball { --sport: #c2570c; }
.s-hockey { --sport: #0b7f92; }
.s-soccer { --sport: #248a3d; }

/* One color per streaming service. */
.watch, .svc { --net: var(--ink); --net-fg: var(--bg); }
.svc-espn { --net: #d2001a; --net-fg: #fff; }
.svc-fox { --net: #0b3fa8; --net-fg: #fff; }
.svc-paramount { --net: #0064ff; --net-fg: #fff; }
.svc-peacock { --net: #15131a; --net-fg: #ffd23f; }
.svc-prime { --net: #00a8e1; --net-fg: #04222e; }
.svc-appletv { --net: #48484c; --net-fg: #fff; }
.svc-hbomax { --net: #6a1fd0; --net-fg: #fff; }
.svc-netflix { --net: #b20710; --net-fg: #fff; }
.svc-youtube { --net: #ff0033; --net-fg: #fff; }
.svc-nflplus { --net: #013369; --net-fg: #fff; }
.svc-nba { --net: #1d428a; --net-fg: #fff; }
.svc-mlbtv { --net: #0a2d6e; --net-fg: #fff; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.35 var(--body); -webkit-font-smoothing: antialiased; }
button, input { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--alert); outline-offset: 2px; }

/* ---------- Intro: GGA unfolds into Good Game Alert ---------- */
#intro { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: var(--intro-bg); cursor: pointer; }
#intro .lockup { font: 800 clamp(72px, 23vw, 168px)/1 var(--display); text-transform: uppercase; color: var(--intro-fg); }
#intro .word { display: flex; align-items: center; white-space: nowrap; }
#intro .word + .word { margin-top: -0.16em; }
#intro b { display: inline-block; color: var(--intro-accent); opacity: 0; }
#intro span { display: inline-block; max-width: 0; opacity: 0; overflow: hidden; }
#intro i { width: 0.15em; height: 0.15em; margin-left: 0.1em; border-radius: 50%; background: var(--intro-accent); opacity: 0; }

#intro.play b { animation: slam 0.45s cubic-bezier(0.2, 1.5, 0.4, 1) both; }
#intro.play .word:nth-child(2) b { animation-delay: 0.15s; }
#intro.play .word:nth-child(3) b { animation-delay: 0.3s; }
#intro.play span { animation: unfold 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) 1s both; }
#intro.play .word:nth-child(2) span { animation-delay: 1.08s; }
#intro.play .word:nth-child(3) span { animation-delay: 1.16s; }
#intro.play i { animation: ping 0.9s ease-out 1.75s both; }
#intro.play { animation: lift 0.55s cubic-bezier(0.7, 0, 0.3, 1) 2.7s forwards; }
#intro.skip { animation: lift 0.35s cubic-bezier(0.7, 0, 0.3, 1) forwards; }

@keyframes slam { from { opacity: 0; transform: translateY(35%) scale(1.35); } to { opacity: 1; transform: none; } }
@keyframes unfold { from { max-width: 0; opacity: 0; } to { max-width: 3.4em; opacity: 1; } }
@keyframes ping {
  0% { opacity: 0; transform: scale(0.2); box-shadow: 0 0 0 0 color-mix(in srgb, var(--intro-accent) 70%, transparent); }
  40% { opacity: 1; transform: scale(1.25); }
  100% { opacity: 1; transform: none; box-shadow: 0 0 0 0.5em transparent; }
}
@keyframes lift { to { transform: translateY(-100%); } }
@keyframes fade { to { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  #intro b, #intro span, #intro i { opacity: 1; max-width: none; animation: none !important; }
  #intro.play { animation: fade 0.3s linear 1.1s forwards; }
}

/* ---------- Page ---------- */
.page { max-width: 720px; margin: 0 auto; padding: max(14px, env(safe-area-inset-top)) 16px max(40px, env(safe-area-inset-bottom)); }
header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 0 12px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.mark { font: 800 15px/1 var(--display); letter-spacing: 0.02em; color: #fff; background: var(--alert); padding: 9px 7px 8px; border-radius: 9px; }
.name { font: 800 30px/1 var(--display); letter-spacing: -0.005em; }
.name b { color: var(--alert); font-weight: inherit; }

.tools, .days, .chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; }
.tools::-webkit-scrollbar, .days::-webkit-scrollbar, .chips::-webkit-scrollbar { display: none; }
.tools { padding-bottom: 16px; }
.tool { font-size: 13px; font-weight: 600; padding: 7px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); white-space: nowrap; }
.tool b { color: var(--gold); margin-left: 4px; }
.days { gap: 18px; padding-bottom: 14px; }
.days button { font: 700 30px/1 var(--display); color: var(--faint); white-space: nowrap; }
.days button[aria-current="true"] { color: var(--ink); }
.chips { padding-bottom: 6px; }
.chip { font-size: 14px; font-weight: 600; padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); white-space: nowrap; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip[class*="s-"]::before { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--sport); margin-right: 7px; }
.chip[class*="s-"][aria-pressed="true"] { background: var(--sport); border-color: var(--sport); color: #fff; }
.chip[class*="s-"][aria-pressed="true"]::before { background: #fff; }
.chip.live[aria-pressed="true"] { background: var(--alert); border-color: var(--alert); color: #fff; }
.chip.live::before, .dot { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--alert); margin-right: 7px; vertical-align: 1px; }
.chip.live[aria-pressed="true"]::before { background: #fff; }
.divider { flex: none; width: 1px; background: var(--line); margin: 4px 2px; }

h2 { font: 600 13px/1 var(--body); letter-spacing: 0.2em; text-transform: uppercase; color: var(--muted); margin: 30px 0 4px; }
h2 small { font: inherit; letter-spacing: 0; margin-left: 8px; opacity: 0.7; }

/* ---------- Alerts ---------- */
.alerts { display: grid; gap: 8px; margin-top: 18px; }
.alert { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 12px 14px; border-radius: 14px; background: var(--alert); color: #fff; }
.alert .tag { font: 800 15px/1 var(--display); letter-spacing: 0.08em; padding: 5px 7px 4px; border-radius: 6px; background: rgba(255, 255, 255, 0.2); animation: blink 1.6s ease-in-out infinite; }
.alert .what { flex: 1; min-width: 0; font-weight: 600; }
.alert .what b { display: block; font: 800 20px/1.05 var(--display); letter-spacing: 0.01em; }
.alert .on { font-size: 13px; font-weight: 700; white-space: nowrap; opacity: 0.9; }
.alert .who { display: none; }
.alert .tm img, .alert .tm .nologo { width: 20px; height: 20px; object-fit: contain; }
@keyframes blink { 50% { opacity: 0.45; } }

/* ---------- Rows ---------- */
.row { display: grid; grid-template-columns: 140px minmax(0, 1fr) auto; align-items: center; gap: 6px 14px; padding: 14px 0 14px 12px; border-bottom: 1px solid var(--line); cursor: pointer; position: relative; }
.row::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 4px; border-radius: 2px; background: var(--sport); }
.row:last-child { border-bottom: 0; }
.t { display: grid; grid-template-columns: 24px 1fr auto; align-items: center; gap: 8px; height: 30px; font: 700 26px/1 var(--display); }
.t img, .t .nologo { width: 24px; height: 24px; object-fit: contain; }
.t img, .big img, .teamrow img { filter: drop-shadow(0 0 0.6px rgba(255, 255, 255, 0.85)); }
.t .abbr { white-space: nowrap; overflow: hidden; }
.t .abbr small { font-size: 14px; font-weight: 600; color: var(--muted); margin-right: 4px; }
.t .abbr i { font-style: normal; font-size: 12px; margin-left: 5px; vertical-align: 3px; }
.t .abbr i.fav { color: var(--gold); }
.t .sc { font-size: 30px; font-variant-numeric: tabular-nums; }
.t.dim .abbr, .t.dim .sc { color: var(--muted); }
.mid { min-width: 0; }
.st { font-weight: 600; }
.st .dot.idle { background: var(--faint); }
.lg { display: inline-flex; align-items: center; gap: 4px; font: 700 10px/1 var(--body); letter-spacing: 0.08em; text-transform: uppercase; color: #fff; background: var(--sport); padding: 3px 5px; border-radius: 4px; margin-left: 8px; vertical-align: 2px; }
.tagline { font-size: 10px; font-weight: 600; letter-spacing: 0.14em; color: var(--muted); margin-left: 6px; }
.sub { color: var(--muted); font-size: 15px; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.sub.gold { color: var(--gold); font-weight: 600; }
.math { grid-column: 1 / -1; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.math b { color: var(--ink); font-weight: 600; }
.math b, .math span { white-space: nowrap; }
/* The right column is fixed so points and watch boxes line up down the page. */
.right { display: flex; align-items: center; justify-content: flex-end; gap: 8px; width: 150px; flex: none; }
.pts { font: 700 15px/1 var(--display); width: 48px; height: 44px; display: flex; align-items: center; justify-content: center; box-sizing: border-box; border-radius: 8px; color: var(--muted); border: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.pts.warm { color: var(--gold); border-color: currentColor; }
.pts.hot { color: #fff; background: var(--alert); border-color: var(--alert); }
.watch { font-size: 12px; font-weight: 700; text-decoration: none; text-align: left; width: 94px; height: 44px; box-sizing: border-box; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 0 6px; border-radius: 11px; background: var(--net); color: var(--net-fg); border: 1.5px solid var(--net); line-height: 1.1; }
.watch.off { background: transparent; color: var(--ink); }
.watch.none { background: transparent; color: var(--muted); border-color: var(--line); }
.empty { color: var(--muted); padding: 40px 0; text-align: center; }
footer { color: var(--muted); font-size: 12px; margin-top: 36px; text-align: center; }

@media (max-width: 480px) {
  .row { grid-template-columns: 128px minmax(0, 1fr) auto; gap: 6px 10px; }
  .t { font-size: 24px; gap: 6px; }
  .t .sc { font-size: 27px; }
  /* Phone: the two boxes stack, same width, so they line up down the page. */
  .right { flex-direction: column; align-items: flex-end; gap: 6px; width: 80px; }
  .pts, .watch { width: 80px; height: 36px; }
  .name { font-size: 26px; }
}

/* ---------- Sheet ---------- */
#sheet { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
#sheet[hidden] { display: none; }
.backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.42); animation: fadein 0.2s ease-out; }
.panel { position: relative; width: min(100%, 560px); max-height: 92vh; overflow-y: auto; background: var(--card); border-radius: 26px 26px 0 0; padding: 22px 22px max(26px, env(safe-area-inset-bottom)); box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.25); animation: rise 0.28s cubic-bezier(0.2, 0.8, 0.2, 1); outline: none; }
@media (min-width: 600px) { #sheet { align-items: center; } .panel { border-radius: 26px; } }
@keyframes rise { from { transform: translateY(40px); opacity: 0; } }
@keyframes fadein { from { opacity: 0; } }
.panel .top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-weight: 600; margin-bottom: 10px; }
.panel .top em { font-style: normal; color: var(--muted); font-weight: 500; margin-left: 8px; }
.big { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto auto; align-items: center; gap: 10px; font: 800 36px/1.1 var(--display); }
.big img, .big .nologo { width: 34px; height: 34px; object-fit: contain; }
.big .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.big.dim .nm, .big.dim .num { color: var(--muted); }
.big .num { font-variant-numeric: tabular-nums; min-width: 1ch; text-align: right; }
.star { font-size: 20px; line-height: 1; color: var(--faint); padding: 4px; }
.star[aria-pressed="true"] { color: var(--gold); }
.wp { display: flex; align-items: center; gap: 10px; margin: 16px 0 4px; color: var(--muted); font-weight: 600; font-size: 14px; }
.wp .bar { flex: 1; display: flex; gap: 3px; height: 5px; }
.wp .bar span { border-radius: 3px; background: var(--faint); min-width: 3px; }
.wp .bar span.lead { background: var(--ink); }
table.lines { border-collapse: collapse; margin: 12px 0 4px; font-variant-numeric: tabular-nums; font-size: 14px; }
table.lines th { font-weight: 500; color: var(--muted); font-size: 12px; }
table.lines th, table.lines td { padding: 2px 9px 2px 0; text-align: center; min-width: 22px; }
table.lines td:first-child, table.lines th:first-child { text-align: left; font-weight: 700; color: var(--muted); padding-right: 16px; }
table.lines .tot { font-weight: 700; padding-left: 8px; }
.context { font-weight: 600; margin-top: 12px; }
.last { color: var(--muted); margin-top: 2px; }
.flags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.flag { font-size: 13px; font-weight: 700; padding: 5px 10px; border-radius: 999px; color: var(--gold); border: 1px solid currentColor; }
.flag.rare { color: #fff; background: var(--alert); border-color: var(--alert); }
.watchbtn { display: block; text-decoration: none; margin-top: 18px; padding: 15px 18px; border-radius: 18px; background: var(--net); color: var(--net-fg); font-weight: 700; font-size: 19px; }
.watchbtn small { display: block; font-weight: 500; font-size: 14px; opacity: 0.75; }
.watchbtn.plain { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.also { color: var(--muted); font-size: 13px; margin-top: 10px; }
.panel h3 { font: 800 30px/1 var(--display); margin: 0 0 6px; }
.panel h4 { font: 600 12px/1 var(--body); letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); margin: 22px 0 8px; }
.panel p { color: var(--muted); margin: 0 0 14px; }
.services { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.services .svc { text-align: left; padding: 12px 14px; border-radius: 14px; font-weight: 700; font-size: 14px; border: 1.5px solid var(--net); background: transparent; color: var(--ink); }
.services .svc[aria-pressed="true"] { background: var(--net); color: var(--net-fg); }
.done { display: block; width: 100%; margin-top: 16px; padding: 14px; border-radius: 16px; background: var(--ink); color: var(--bg); font-weight: 700; }

/* Scoring breakdown */
table.score { width: 100%; border-collapse: collapse; font-size: 14px; }
table.score td { padding: 7px 0; border-top: 1px solid var(--line); vertical-align: top; }
table.score td:nth-child(2) { width: 46px; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; padding-right: 12px; }
table.score td:first-child { width: 112px; font-weight: 600; }
table.score td:last-child { color: var(--muted); }
table.score tr.miss td:first-child, table.score tr.miss td:nth-child(2) { color: var(--muted); font-weight: 500; }
table.score tr.total td { font-weight: 800; color: var(--ink); border-top: 2px solid var(--ink); }
.fine { color: var(--muted); font-size: 13px; margin-top: 8px; }
.rule { padding: 10px 0; border-top: 1px solid var(--line); }
.rule b { display: flex; justify-content: space-between; gap: 10px; }
.rule span { display: block; color: var(--muted); font-size: 14px; margin-top: 2px; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; font-weight: 600; text-align: left; }
.switch i { flex: none; width: 42px; height: 24px; border-radius: 12px; background: var(--faint); position: relative; transition: background 0.15s; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform 0.15s; }
.switch[aria-pressed="true"] i { background: var(--alert); }
.switch[aria-pressed="true"] i::after { transform: translateX(18px); }

/* My teams */
#teamq { width: 100%; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--bg); margin-bottom: 10px; font-size: 16px; }
#teamleagues { margin-bottom: 6px; }
#teamlist { min-height: 240px; }
.teamrow { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto auto; align-items: center; gap: 10px; width: 100%; padding: 9px 0; border-top: 1px solid var(--line); text-align: left; font-weight: 600; }
.teamrow img, .teamrow .nologo { width: 28px; height: 28px; object-fit: contain; }
.teamrow .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.teamrow .lg { margin: 0; }
.teamrow .st2 { font-size: 20px; color: var(--faint); width: 28px; text-align: center; }
.teamrow[aria-pressed="true"] .st2 { color: var(--gold); }

/* Logos: leagues on chips and pills, networks on watch boxes */
.ll { width: 16px; height: 16px; object-fit: contain; margin-right: 6px; vertical-align: -3px; }
.lg .ll { width: 12px; height: 12px; margin: 0; }
.chip:has(.ll)::before { display: none; }
.chip[class*="s-"] { border-left: 3px solid var(--sport); }
.nl { width: 16px; height: 16px; border-radius: 3px; flex: none; }
.watch span { overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-height: 1.1; }
.watchbtn .nl { width: 20px; height: 20px; vertical-align: -4px; margin-right: 8px; }

/* Big plays */
.play { display: grid; grid-template-columns: 64px 20px minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; }
.play .when { color: var(--muted); font-size: 12px; white-space: nowrap; }
.play img { width: 20px; height: 20px; object-fit: contain; }
.play .txt b { margin-right: 4px; }
.play .sc { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.play.key .txt b { color: var(--alert); }
.clip { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); color: var(--ink); text-decoration: none; font-weight: 600; font-size: 14px; }
.clip span { color: var(--muted); font-weight: 500; }
