:root {
  --bg: #0e1116;
  --card: #161b22;
  --card-2: #1b212a;
  --line: #242c37;
  --text: #e8ebf0;
  --muted: #8d97a6;
  --green: #3fb27f;
  --amber: #e2a43c;
  --grey: #8d97a6;
  --live: #ef6f5f;
  --tap: 44px;
  --gutter: 16px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

/* ---------- top ---------- */
.top {
  position: sticky; top: 0; z-index: 5; background: var(--bg);
  padding: env(safe-area-inset-top) var(--gutter) 0;
  border-bottom: 1px solid var(--line);
}
.bar, .search, .days, .chips, main { max-width: 1180px; margin-left: auto; margin-right: auto; }
.bar { display: flex; align-items: center; gap: 8px; height: 46px; }
h1 { margin: 0; margin-right: auto; font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }
.icon-btn {
  width: var(--tap); height: var(--tap); margin-right: -10px; border: 0; background: none;
  display: grid; place-items: center; color: var(--muted); border-radius: 12px;
}
.icon-btn:hover, .icon-btn:focus-visible { color: var(--text); }
.toggle {
  display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px 0 8px; border-radius: 17px;
  border: 1px solid var(--line); background: none; color: var(--muted); font-size: 13.5px; font-weight: 600;
}
.toggle .tk { width: 26px; height: 16px; border-radius: 8px; background: #2b3441; position: relative; transition: background .15s; }
.toggle .tk::after { content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%; background: #c9cfd9; transition: transform .15s; }
.toggle[aria-pressed="true"] { color: var(--text); border-color: color-mix(in srgb, var(--green) 55%, transparent); }
.toggle[aria-pressed="true"] .tk { background: var(--green); }
.toggle[aria-pressed="true"] .tk::after { transform: translateX(10px); background: #fff; }

.search {
  position: relative; display: flex; align-items: center; height: 40px;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 0 2px 0 12px; color: var(--muted);
}
.search:focus-within { border-color: #3a4656; }
.search input {
  flex: 1; min-width: 0; height: 100%; border: 0; background: none; outline: 0; padding: 0 8px; font-size: 16px; color: var(--text);
  -webkit-appearance: none; appearance: none;
}
.search input::-webkit-search-cancel-button { -webkit-appearance: none; display: none; }
.search input::placeholder { color: #66707f; }
.clear { width: 38px; height: 38px; border: 0; background: none; color: var(--muted); display: grid; place-items: center; border-radius: 10px; }

.days, .chips {
  display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.days::-webkit-scrollbar, .chips::-webkit-scrollbar { display: none; }
.days { padding: 8px 0 4px; scroll-snap-type: x proximity; }
.day {
  flex: 0 0 auto; height: 30px; padding: 0 11px; border-radius: 15px; border: 0; background: none; color: var(--muted);
  display: inline-flex; align-items: center; gap: 5px; font-size: 14px; font-weight: 600; scroll-snap-align: center;
}
.day .dn { font-variant-numeric: tabular-nums; }
.day[aria-pressed="true"] { background: var(--text); color: var(--bg); }
.chips { padding: 4px 0 10px; }
.chip-btn {
  flex: 0 0 auto; height: 32px; padding: 0 12px; border-radius: 16px; border: 1px solid var(--line); background: none; color: var(--muted);
  display: inline-flex; align-items: center; gap: 7px; font-size: 14px; font-weight: 600; white-space: nowrap;
}
.chip-btn .n { font-size: 12.5px; font-variant-numeric: tabular-nums; color: #5f6978; }
.chip-btn[aria-pressed="true"] { color: var(--text); border-color: #4a5568; background: var(--card-2); }
.chip-btn[aria-pressed="true"] .n { color: var(--muted); }

/* ---------- list ---------- */
main { padding: 0 var(--gutter) 56px; }
.list { display: grid; grid-template-columns: minmax(0, 1fr); column-gap: 28px; align-items: start; }
.list > .sec, .list > .hour, .list > .hint, .list > .note { grid-column: 1 / -1; }
.sec {
  margin: 18px 0 2px; padding: 0; border: 0; background: none; text-align: left; width: 100%;
  font-size: 12.5px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted);
  display: flex; align-items: center; gap: 8px; min-height: 28px;
}
.sec .count { font-weight: 500; color: #5f6978; font-variant-numeric: tabular-nums; }
.sec .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--live); }
.sec .caret { margin-left: auto; width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); transition: transform .2s; }
.sec[aria-expanded="true"] .caret { transform: rotate(-135deg); }
.hour { margin: 10px 0 0; font-size: 12px; font-weight: 600; color: #5f6978; font-variant-numeric: tabular-nums; }
.hint { margin: 12px 0 0; color: var(--muted); font-size: 13.5px; }
.note { margin: 28px 0; color: var(--muted); text-align: center; font-size: 15px; }
.note b { color: var(--text); font-weight: 600; }
.note button { margin-top: 12px; }
.minor { margin: 20px 0 0; color: #5f6978; font-size: 13px; text-align: center; }

.row {
  --c: var(--grey);
  display: grid; grid-template-columns: minmax(0, 1fr) 44px; align-items: center; column-gap: 4px;
  border-bottom: 1px solid var(--line); min-width: 0;
}
.row.v-have { --c: var(--green); }
.row.v-needs, .row.v-check { --c: var(--amber); }
.main {
  display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; align-items: center; column-gap: 10px;
  min-height: 68px; padding: 8px 0; border: 0; background: none; text-align: left; width: 100%; min-width: 0; color: inherit;
}
.main:focus-visible { outline: 2px solid #4a5568; outline-offset: -2px; border-radius: 8px; }
.when { display: flex; flex-direction: column; justify-content: center; gap: 2px; min-width: 0; font-variant-numeric: tabular-nums; }
.when b { font-size: 13.5px; font-weight: 600; color: var(--muted); line-height: 1.15; white-space: nowrap; }
.when i { font-style: normal; font-size: 11.5px; color: var(--muted); line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.when.live b { color: var(--live); letter-spacing: 0.04em; }
.teams { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.team { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; align-items: center; column-gap: 9px; height: 24px; }
.logo { width: 22px; height: 22px; object-fit: contain; display: block; }
.logo.none { visibility: hidden; }
.tname { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 15px; font-weight: 500; line-height: 24px; }
.tname .rk { color: var(--muted); font-size: 11.5px; font-weight: 500; margin-right: 5px; font-variant-numeric: tabular-nums; }
.team.lost .tname, .team.lost .score { color: var(--muted); }
.score { min-width: 2ch; text-align: right; font-weight: 700; font-size: 15px; font-variant-numeric: tabular-nums; }
.chip { display: flex; justify-content: flex-end; min-width: 0; max-width: 108px; }
.chip.empty { display: none; }
.chip-t {
  display: block; max-width: 100%; height: 24px; line-height: 22px; padding: 0 9px; border-radius: 12px; font-size: 12px; font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: var(--c); background: color-mix(in srgb, var(--c) 13%, transparent); border: 1px solid color-mix(in srgb, var(--c) 38%, transparent);
}
.row:not(.v-have):not(.v-needs):not(.v-check) .chip-t { color: var(--muted); }
.main:has(.chip.empty) { grid-template-columns: 52px minmax(0, 1fr); }
.slot { display: grid; place-items: center; width: 44px; }
.play {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--green); color: #07140d; text-decoration: none;
}
.play svg { width: 18px; height: 18px; fill: currentColor; margin-left: 2px; }
.play:active { filter: brightness(0.9); }
.play:focus-visible, .watch:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }

.more { grid-column: 1 / -1; display: grid; grid-template-rows: 0fr; transition: grid-template-rows .22s ease; }
.row.open .more { grid-template-rows: 1fr; }
.more-in { overflow: hidden; min-height: 0; visibility: hidden; transition: visibility 0s .22s; }
.row.open .more-in { visibility: visible; transition-delay: 0s; padding-bottom: 14px; }
.how { margin: 2px 0 0; font-size: 14.5px; color: #c4cad4; overflow-wrap: anywhere; }
.also { margin: 6px 0 0; font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.btns { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.watch {
  display: flex; align-items: center; justify-content: center; min-height: var(--tap); padding: 6px 16px; border-radius: 12px;
  text-decoration: none; font-weight: 600; font-size: 15px; text-align: center;
  color: var(--bg); background: var(--c); border: 1px solid var(--c);
}
.row:not(.v-have) .watch { color: var(--text); background: transparent; border-color: color-mix(in srgb, var(--c) 55%, transparent); }
.watch.alt { color: var(--text) !important; background: transparent !important; border-color: var(--line) !important; font-weight: 500; }
.watch:active { filter: brightness(0.9); }
.follows { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 8px; }
.follow {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0; border: 0; background: none; color: var(--muted); font-size: 13.5px; min-width: 0;
}
.follow svg { width: 18px; height: 18px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.follow span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 150px; }
.follow[aria-pressed="true"] { color: var(--amber); }
.follow[aria-pressed="true"] svg { fill: currentColor; }

button.plain {
  min-height: var(--tap); padding: 0 18px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--text); font-weight: 600;
}

@media (min-width: 560px) { :root { --gutter: 24px; } .btns { flex-direction: row; flex-wrap: wrap; } .watch { flex: 0 1 auto; } }
@media (min-width: 820px) { .list { grid-template-columns: repeat(2, minmax(0, 1fr)); } .chip { max-width: 140px; } }
@media (min-width: 1140px) { .list { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 560px) { .chip { max-width: 140px; } }

/* ---------- services sheet ---------- */
.sheet { position: fixed; inset: 0; z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.scrim { position: absolute; inset: 0; background: rgba(5, 8, 12, 0.66); }
.panel {
  position: relative; width: 100%; max-width: 560px; max-height: 88vh; max-height: 88dvh; overflow: auto;
  background: var(--card); border: 1px solid var(--line); border-bottom: 0; border-radius: 18px 18px 0 0;
  padding: 16px var(--gutter) calc(20px + env(safe-area-inset-bottom));
}
.panel-head { display: flex; align-items: center; justify-content: space-between; height: 44px; }
.panel h2 { margin: 0; font-size: 19px; }
.done { height: var(--tap); padding: 0 14px; margin-right: -10px; border: 0; background: none; color: var(--green); font-weight: 700; font-size: 16px; }
.panel-note { margin: 2px 0 8px; color: var(--muted); font-size: 14px; }
.svc-list { display: block; }
.svc {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 12px; min-height: 52px;
  border-top: 1px solid var(--line); cursor: pointer;
}
.svc:first-child { border-top: 0; }
.svc .nm { min-width: 0; }
.svc .nm small { display: block; color: var(--muted); font-size: 12.5px; }
.svc input { position: absolute; opacity: 0; pointer-events: none; }
.sw { width: 46px; height: 28px; border-radius: 14px; background: #2b3441; position: relative; transition: background .15s; }
.sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #c9cfd9; transition: transform .15s; }
.svc input:checked + .sw { background: var(--green); }
.svc input:checked + .sw::after { transform: translateX(18px); background: #fff; }
.svc input:focus-visible + .sw { outline: 2px solid var(--text); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) { .sw, .sw::after, .toggle .tk, .toggle .tk::after, .more, .more-in, .caret { transition: none !important; } }

/* Row layout v2.1: teams get the width; time sits over the verdict chip on the right. */
.main {
  grid-template-columns: minmax(0, 1fr) minmax(0, 118px);
  grid-template-areas: "teams when" "teams chip"; row-gap: 6px; column-gap: 12px;
}
.main:has(.chip.empty) { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "teams when"; }
.teams { grid-area: teams; }
.when { grid-area: when; flex-direction: row; justify-content: flex-end; align-items: baseline; gap: 6px; align-self: end; }
.main:has(.chip.empty) .when { align-self: center; }
.when b { font-size: 12.5px; }
.chip { grid-area: chip; align-self: start; max-width: 118px; }
