/* MatchEdge base styles and components. Rules: DESIGN.md. No shadow, blur or gradient in this file. */

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body, h1, h2, h3, h4, p, ul, ol, dl, dd, figure, blockquote { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; margin: 0; }
button { cursor: pointer; }
table { border-collapse: collapse; border-spacing: 0; }
[hidden] { display: none !important; }

html {
  font-family: var(--font-ui);
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
}
* { font-variant-numeric: tabular-nums; }

body {
  background: var(--paper);
  color: var(--ink);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}
body.has-tabbar { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px)); }
main { flex: 1 0 auto; display: block; padding-block: var(--space-5) 0; }

h1, h2, h3 {
  font-weight: 700;
  font-stretch: var(--stretch-heading);
  line-height: var(--lh-heading);
  letter-spacing: -0.01em;
}
h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); }
.section-title { font-size: var(--fs-section); font-weight: 700; line-height: 1.3; font-stretch: 100%; letter-spacing: 0; }
.display {
  font-size: var(--fs-display);
  font-weight: 800;
  font-stretch: var(--stretch-display);
  line-height: 1;
  letter-spacing: -0.02em;
}

a { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible { outline: var(--focus-ring); outline-offset: var(--focus-offset); }
:focus:not(:focus-visible) { outline: none; }

::selection { background: var(--rule-strong); color: var(--ink); }

/* ---------- utilities ---------- */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%);
  white-space: nowrap;
}
.visually-hidden-focusable:focus-visible {
  position: fixed; left: var(--space-2); top: var(--space-2); z-index: 100;
  width: auto; height: auto; margin: 0; padding: var(--space-3) var(--space-4);
  clip: auto; clip-path: none; overflow: visible;
  background: var(--ink); color: var(--surface); border-radius: var(--radius-control);
}
.num { font-variant-numeric: tabular-nums; text-align: right; }
.muted { color: var(--ink-3); }
.meta { color: var(--ink-3); font-size: var(--fs-meta); line-height: 1.4; }
.meta-sm { color: var(--ink-3); font-size: var(--fs-meta-sm); line-height: 1.4; }
.strong { font-weight: 700; }
.link-block { display: inline-flex; align-items: center; min-height: var(--touch); }
.text-sm { font-size: var(--fs-table); }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stack > * + * { margin-top: var(--space-4); }
.stack-sm > * + * { margin-top: var(--space-2); }
.stack-lg > * + * { margin-top: var(--space-5); }
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-4); }
.cluster-between { justify-content: space-between; }
.hide-phone { display: initial; }
.only-phone { display: none !important; }
@media (max-width: 719.98px) {
  .hide-phone { display: none !important; }
  .only-phone { display: initial !important; }
}

/* ---------- layout ---------- */
.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: var(--gutter); }
.layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-5); align-items: start; }
@media (min-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr) 300px; }
  .layout-wide-rail { grid-template-columns: minmax(0, 1fr) 340px; }
}
.page-head { padding-block: var(--space-4) var(--space-5); }
.page-head > * + * { margin-top: var(--space-2); }
.page-head .meta { font-size: var(--fs-body); color: var(--ink-2); }

/* ---------- site header ---------- */
.site-header { background: var(--surface); border-bottom: 1px solid var(--rule); }
.config-banner { background: var(--surface); border-bottom: 2px solid var(--ink); }
.config-banner-inner { padding-block: var(--space-3); overflow-wrap: anywhere; }
.site-header-inner { display: flex; align-items: stretch; gap: var(--space-5); min-height: var(--header-h); }
.logo {
  display: inline-flex; align-items: center; gap: var(--space-2);
  min-height: var(--touch);
  align-self: center;
  color: var(--ink); text-decoration: none;
}
.logo:hover { text-decoration: none; }
.logo-mark { position: relative; width: 18px; height: 18px; background: var(--ink); flex: none; }
.logo-mark::after { content: ''; position: absolute; top: 0; right: 0; width: 7px; height: 7px; background: var(--signal); }
.logo-word {
  font-size: 20px; font-weight: 800; font-stretch: var(--stretch-wordmark);
  letter-spacing: -0.02em; line-height: 1;
}
.site-nav { display: flex; align-items: stretch; gap: var(--space-1); }
.site-nav a {
  position: relative; display: inline-flex; align-items: center;
  padding-inline: var(--space-3); min-height: var(--touch);
  color: var(--ink-2); font-size: var(--fs-table); font-weight: 400; text-decoration: none;
  transition: color var(--motion);
}
.site-nav a:hover { color: var(--ink); text-decoration: none; }
.site-nav a[aria-current="page"] { color: var(--ink); font-weight: 700; }
.site-nav a[aria-current="page"]::after {
  content: ''; position: absolute; left: var(--space-3); right: var(--space-3); bottom: -1px; height: 2px; background: var(--ink);
}
.site-header-end { margin-left: auto; display: flex; align-items: center; gap: var(--space-3); }
.auth-slot:empty { display: none; }
.auth-link { white-space: nowrap; }
.header-cta-short { display: none; }
.combo-count {
  display: inline-block; min-width: 20px; padding: 0 var(--space-1);
  background: var(--paper); color: var(--ink); border-radius: var(--radius-tag);
  font-size: var(--fs-meta-sm); font-weight: 700; line-height: 20px; text-align: center;
}
@media (max-width: 719.98px) {
  .site-nav, .site-header .combo-link { display: none; }
  .site-header-inner { gap: var(--space-3); }
}
/* Phone header: the logo, the account button and (landing) the slate button must share 320px without a sideways scroll. The sign-out
   button next to "Account" on the verify and error pages is left out; the account page has it. */
@media (max-width: 479.98px) {
  .site-header-inner { gap: var(--space-2); }
  .site-header-end { gap: var(--space-2); min-width: 0; }
  .site-header-end .btn { padding-inline: var(--space-3); }
  .site-header .logo-word { font-size: 18px; }
  .site-header .auth-link-extra { display: none; }
  .header-cta-long { display: none; }
  .header-cta-short { display: inline; }
}

/* ---------- phone tab bar ---------- */
.tab-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  display: none; grid-auto-flow: column; grid-auto-columns: 1fr;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--surface); border-top: 1px solid var(--rule);
}
.tab-bar a {
  position: relative; display: flex; align-items: center; justify-content: center;
  min-height: var(--tabbar-h); padding-inline: var(--space-1);
  color: var(--ink-2); font-size: var(--fs-table); text-decoration: none;
  transition: color var(--motion);
}
.tab-bar a:hover { text-decoration: none; }
.tab-bar a[aria-current="page"] { color: var(--ink); font-weight: 700; }
.tab-bar a[aria-current="page"]::before { content: ''; position: absolute; top: -1px; left: 0; right: 0; height: 2px; background: var(--ink); }
@media (max-width: 719.98px) { .tab-bar { display: grid; } }

/* ---------- footer ---------- */
.site-footer { margin-top: var(--space-7); padding-block: var(--space-5) var(--space-6); border-top: 1px solid var(--rule); }
.site-footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: var(--space-3) var(--space-6); }
.site-footer p { color: var(--ink-2); font-size: var(--fs-meta); max-width: 44ch; }
.site-footer ul { display: flex; flex-wrap: wrap; gap: 0 var(--space-4); }
.site-footer li a {
  display: inline-flex; align-items: center; justify-content: center; min-height: var(--touch); min-width: var(--touch);
  color: var(--ink-2); font-size: var(--fs-meta);
}
.site-footer li a:hover { color: var(--ink); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: var(--touch); padding: 0 var(--space-4);
  border: 1px solid transparent; border-radius: var(--radius-control);
  font-size: var(--fs-table); font-weight: 600; line-height: 1.2; text-decoration: none; white-space: nowrap;
  background: transparent; color: var(--ink);
  transition: background-color var(--motion), color var(--motion), border-color var(--motion), opacity var(--motion);
}
.btn:hover { text-decoration: none; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.btn-primary:hover:not([disabled]) { background: var(--ink-2); border-color: var(--ink-2); }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--rule-strong); }
.btn-secondary:hover:not([disabled]) { background: var(--paper); }
.btn-secondary[aria-pressed="true"] { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.btn-signal { background: var(--signal); color: var(--surface); border-color: var(--signal); }
.btn-signal:hover:not([disabled]) { background: var(--signal-text); border-color: var(--signal-text); }
.btn-icon { width: var(--touch); padding: 0; font-size: 20px; font-weight: 400; }
.btn-block { display: flex; width: 100%; }
.btn-link {
  min-height: var(--touch); padding: 0; border: 0; background: none;
  font-weight: 400; text-decoration: underline; text-underline-offset: 3px;
}

/* ---------- tags ---------- */
.tag {
  display: inline-block; padding: 2px 6px; border-radius: var(--radius-tag);
  font-size: var(--fs-table); font-weight: 700; line-height: 1.4; white-space: nowrap;
  color: var(--ink-3); background: transparent;
}
.tag-gap-hi { background: var(--signal-bg); color: var(--signal-text); }
.tag-gap-mid { background: transparent; color: var(--signal-text); }
.tag-muted { color: var(--ink-3); font-weight: 400; }

/* ---------- Pro lock (a value the viewer's plan does not include; never orange, orange is for gaps) ---------- */
.tag-lock, .lock-inline { display: inline-flex; align-items: center; gap: var(--space-1); }
.tag-lock { border: 1px dashed var(--rule-strong); font-weight: 600; }
.lock-inline { color: var(--ink-3); font-weight: 600; }
.lock-icon { flex: none; }
.lock-note {
  display: flex; align-items: flex-start; gap: var(--space-3); padding: var(--space-4);
  background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius-panel); color: var(--ink-2);
}
.lock-note.is-flat { padding: 0; border: 0; background: none; }
.lock-note > .lock-icon { width: 16px; height: 16px; margin-top: 3px; color: var(--ink-3); }
.lock-note-body { min-width: 0; }
.lock-note-body > * + * { margin-top: var(--space-1); }
.lock-note-title { font-weight: 700; color: var(--ink); overflow-wrap: anywhere; }
.lock-note-links a { display: inline-flex; align-items: center; min-height: var(--touch); }

/* ---------- panel ---------- */
.panel { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-panel); }
.panel-head { padding: var(--space-4) var(--space-4) 0; }
.panel-body { padding: var(--space-4); }
.panel-body > * + * { margin-top: var(--space-3); }
.panel-foot { padding: var(--space-3) var(--space-4); border-top: 1px solid var(--rule); font-size: var(--fs-table); }
.stat-value { font-size: var(--fs-h2); font-weight: 700; font-stretch: var(--stretch-heading); line-height: var(--lh-heading); }
.stat-label { color: var(--ink-3); font-size: var(--fs-meta); }

/* ---------- row (one match = one row, ~56px) ---------- */
.rows { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-panel); overflow: hidden; }
.row-item { border-bottom: 1px solid var(--rule); }
.row-item:last-child { border-bottom: 0; }
.row { display: flex; align-items: center; gap: var(--space-2); min-height: 56px; padding: var(--space-1) var(--space-4); transition: background-color var(--motion); }
.row-toggle {
  flex: 1 1 auto; min-width: 0;
  display: grid; grid-template-columns: 56px minmax(0, 1fr) minmax(0, 1.5fr) 104px 16px;
  align-items: center; column-gap: var(--space-3);
  min-height: 56px; padding: var(--space-2) 0;
  background: none; border: 0; text-align: left; color: inherit; text-decoration: none;
}
.row-toggle:hover { text-decoration: none; }
.row-toggle:not([aria-expanded])::after { content: ''; width: 16px; }
.row-toggle[aria-expanded]::after {
  content: ''; width: 7px; height: 7px; margin-left: 4px;
  border-right: 1.5px solid var(--ink-3); border-bottom: 1.5px solid var(--ink-3);
  transform: rotate(45deg);
}
.row-toggle[aria-expanded="true"]::after { transform: rotate(-135deg); }
/* the gap tag is right-aligned in a fixed column so play names line up across rows */
.row-toggle > .tag { justify-self: end; }
.row-time { color: var(--ink-3); font-size: var(--fs-table); }
.row-teams { display: flex; flex-direction: column; min-width: 0; font-size: var(--fs-table); line-height: 1.3; }
.row-teams > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-teams .is-fav, .row-teams strong { font-weight: 700; }
.row-play { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.row-play-name { font-size: var(--fs-table); font-weight: 700; }
.row-why { color: var(--ink-3); font-size: var(--fs-meta); }
.row-match { color: var(--ink-3); font-size: var(--fs-meta); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-act { flex: none; }
.row-detail { padding: var(--space-3) var(--space-4) var(--space-4) calc(var(--space-4) + 56px + var(--space-3)); border-top: 1px solid var(--rule); }
.row-detail-grid { display: flex; flex-wrap: wrap; gap: var(--space-4) var(--space-6); align-items: flex-start; }
.row-more { display: block; width: 100%; min-height: var(--touch); padding: var(--space-3) var(--space-4); text-align: left; background: none; border: 0; border-top: 1px solid var(--rule); font-size: var(--fs-table); text-decoration: none; }
@media (hover: hover) {
  .row:hover { background: var(--paper); }
  .row-more:hover { background: var(--paper); }
}
@media (max-width: 719.98px) {
  .row { padding-inline: var(--space-4); }
  .row-toggle { grid-template-columns: 48px minmax(0, 1fr) auto; column-gap: var(--space-2); }
  .row-toggle::after { display: none; }
  .row-teams, .row-why { display: none; }
  .row-detail { padding-left: var(--space-4); }
}
@media (min-width: 720px) { .row-match { display: none; } }

/* ---------- table ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; font-size: var(--fs-table); font-variant-numeric: tabular-nums; }
.table th {
  padding: var(--space-2) var(--space-4); text-align: left;
  color: var(--ink-3); font-size: var(--fs-meta-sm); font-weight: 400; white-space: nowrap;
  border-bottom: 1px solid var(--rule);
}
.table td { padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--rule); min-height: var(--touch); }
.table tr:last-child td { border-bottom: 0; }
.table th.num, .table td.num { text-align: right; }
.table td.is-gap-hi, .table td.is-gap-mid { color: var(--signal-text); font-weight: 700; }
.table td.is-muted { color: var(--ink-3); }
.table tr.is-highlight td { background: var(--signal-bg); }
.table tr.is-highlight td:first-child { font-weight: 700; }

/* ---------- 1X2 bar ---------- */
.bar-1x2 { display: flex; width: 100%; gap: 0; }
.bar-cell { flex: 1 1 0; min-width: 2.75em; padding-right: var(--space-2); }
.bar-cell[data-seg="h"] { flex-grow: var(--h, 1); }
.bar-cell[data-seg="d"] { flex-grow: var(--d, 1); }
.bar-cell[data-seg="a"] { flex-grow: var(--a, 1); }
.bar-num { display: block; font-size: var(--fs-section); font-weight: 400; line-height: 1.3; color: var(--ink-3); }
.bar-label { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-meta); color: var(--ink-3); }
.bar-fill { display: block; height: 4px; margin-top: var(--space-2); margin-right: -1px; background: var(--bar-light); }
.bar-cell[data-seg="d"] .bar-fill { background: var(--bar-mid); }
.bar-1x2[data-fav="h"] [data-seg="h"] .bar-fill,
.bar-1x2[data-fav="d"] [data-seg="d"] .bar-fill,
.bar-1x2[data-fav="a"] [data-seg="a"] .bar-fill { background: var(--ink); }
.bar-1x2[data-fav="h"] [data-seg="h"] .bar-num,
.bar-1x2[data-fav="d"] [data-seg="d"] .bar-num,
.bar-1x2[data-fav="a"] [data-seg="a"] .bar-num { color: var(--ink); font-weight: 700; }
.bar-1x2.is-large .bar-num { font-size: 36px; line-height: 1.1; font-stretch: var(--stretch-heading); color: var(--ink-2); }
.bar-1x2.is-large[data-fav="h"] [data-seg="h"] .bar-num,
.bar-1x2.is-large[data-fav="d"] [data-seg="d"] .bar-num,
.bar-1x2.is-large[data-fav="a"] [data-seg="a"] .bar-num { color: var(--ink); }
.bar-1x2.is-large .bar-label { font-size: var(--fs-table); color: var(--ink-2); margin-top: var(--space-1); }
.bar-1x2.is-large .bar-fill { margin-top: var(--space-3); }
.bar-1x2.is-compact { width: 180px; max-width: 100%; }
.bar-1x2.is-compact .bar-num { font-size: var(--fs-table); }
.bar-1x2.is-compact .bar-label { display: none; }
.bar-1x2.is-compact .bar-cell { min-width: 2.2em; }
@media (max-width: 719.98px) { .bar-1x2.is-large .bar-num { font-size: 28px; } }

/* horizontal meter: one value out of 100, width from --w (0-100) */
.meter { display: block; height: 6px; background: var(--rule); border-radius: var(--radius-tag); overflow: hidden; }
.meter-fill { display: block; height: 100%; width: calc(var(--w, 0) * 1%); background: var(--ink); }

/* ---------- segmented toggle and tabs ---------- */
.seg { display: inline-flex; border: 1px solid var(--ink-3); border-radius: var(--radius-control); overflow: hidden; background: var(--surface); }
.seg > button, .seg > a {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: var(--touch); min-width: var(--touch); padding: 0 var(--space-4);
  background: var(--surface); color: var(--ink); border: 0; font-size: var(--fs-table); font-weight: 600; text-decoration: none;
  transition: background-color var(--motion), color var(--motion);
}
.seg > * + * { border-left: 1px solid var(--ink-3); }
.seg > [aria-pressed="true"], .seg > [aria-current="true"] { background: var(--ink); color: var(--surface); }
.seg > :focus-visible { outline-offset: -2px; }
@media (hover: hover) { .seg > :not([aria-pressed="true"]):hover { background: var(--paper); } }

.tabs { display: flex; gap: var(--space-1); overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--rule); }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative; flex: none; display: inline-flex; align-items: center;
  min-height: var(--touch); padding: 0 var(--space-3);
  background: none; border: 0; color: var(--ink-2); font-size: var(--fs-section); text-decoration: none;
  transition: color var(--motion);
}
.tab:hover { text-decoration: none; color: var(--ink); }
.tab[aria-selected="true"], .tab[aria-current="true"] { color: var(--ink); font-weight: 700; }
.tab[aria-selected="true"]::after, .tab[aria-current="true"]::after {
  content: ''; position: absolute; left: var(--space-3); right: var(--space-3); bottom: -1px; height: 2px; background: var(--ink);
}
.tab:focus-visible { outline-offset: -2px; }

/* ---------- note (model prose) ---------- */
.note { font-family: var(--font-note); font-size: 19px; line-height: 1.5; font-weight: 400; color: var(--ink); }
.note > * + * { margin-top: var(--space-3); }
.note-sm { font-size: 17px; }

/* ---------- forms ---------- */
.field > * + * { margin-top: var(--space-1); }
.label { display: block; font-size: var(--fs-meta); font-weight: 600; color: var(--ink-2); }
.help { color: var(--ink-3); font-size: var(--fs-meta); }
.input, .select {
  display: block; width: 100%; min-height: var(--touch); padding: 0 var(--space-3);
  background: var(--surface); color: var(--ink); border: 1px solid var(--ink-3); border-radius: var(--radius-control);
  font-size: 16px; transition: border-color var(--motion);
}
.input::placeholder { color: var(--ink-3); opacity: 1; }
.input:hover, .select:hover { border-color: var(--ink); }
.input[aria-invalid="true"] { border-color: var(--ink); border-width: 2px; }
.select { appearance: none; -webkit-appearance: none; padding-right: var(--space-6); background-image: none; }
.select-wrap { position: relative; }
.select-wrap > .select { border-color: var(--ink-3); }
.select-wrap::after {
  content: ''; position: absolute; right: var(--space-4); top: 50%; width: 7px; height: 7px; margin-top: -6px;
  border-right: 1.5px solid var(--ink-3); border-bottom: 1.5px solid var(--ink-3); transform: rotate(45deg); pointer-events: none;
}

/* ---------- states ---------- */
.skeleton { display: block; min-height: 1em; background: var(--rule); border-radius: var(--radius-tag); }
.skeleton-row { height: 56px; border-radius: 0; border-bottom: 1px solid var(--surface); }
.state { padding: var(--space-6) var(--space-4); text-align: center; color: var(--ink-2); }
.state > * + * { margin-top: var(--space-3); }
.state-title,
.state h1, .state h2, .state h3 {
  font-size: var(--fs-section); font-weight: 700; font-stretch: 100%; line-height: 1.3; letter-spacing: 0; color: var(--ink);
}

/* ---------- marquee pause control (landing) ---------- */
.marquee-controls {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: var(--touch); min-width: var(--touch); padding: 0 var(--space-4);
  background: var(--surface); color: var(--ink); border: 1px solid var(--ink-3); border-radius: var(--radius-control);
  font-size: var(--fs-table); font-weight: 600; line-height: 1.2; white-space: nowrap;
  transition: background-color var(--motion), color var(--motion);
}
.marquee-controls:hover { background: var(--paper); }

/* ---------- motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation: none !important; scroll-behavior: auto !important; }
}
