:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --ink: #14181f;
  --muted: #667085;
  --faint: #98a2b3;
  --line: #e7e9ee;
  --line-soft: #f0f2f5;
  --accent: #d90429;
  --accent-soft: #fff1f2;
  --gold: #f5b301;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
  --top: 68px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: Inter, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
}
body.lock { overflow: hidden; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
img { display: block; max-width: 100%; }

.shell { width: min(1180px, calc(100% - 32px)); margin: 0 auto; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  min-height: var(--top);
  display: flex;
  align-items: center;
  gap: 22px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
  font-weight: 800;
  letter-spacing: -0.03em;
  font-size: 18px;
}
.mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--accent);
  color: white;
  display: grid;
  place-items: center;
}
.nav { display: flex; gap: 4px; }
.nav a {
  position: relative;
  text-decoration: none;
  color: #3f4754;
  font-weight: 600;
  font-size: 14px;
  padding: 20px 12px 18px;
}
.nav a.active { color: var(--accent); }
.nav a.active::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 0;
  height: 2px;
  background: var(--accent);
  border-radius: 2px 2px 0 0;
}
.search {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f3f4f6;
  border-radius: 999px;
  padding: 0 14px;
  min-width: min(280px, 34vw);
  color: var(--muted);
}
.search input {
  border: 0;
  background: transparent;
  width: 100%;
  height: 40px;
  outline: none;
}
.search input::-webkit-search-cancel-button { cursor: pointer; }

.layout {
  display: grid;
  grid-template-columns: 272px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
  padding: 22px 0 48px;
}

.side-card, .card, .panel-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.side-card { padding: 8px; margin-bottom: 12px; }
.side-label {
  margin: 8px 8px 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--faint);
}
.side-link, .chip {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  background: transparent;
  border-radius: 12px;
  padding: 8px;
  text-align: left;
}
.side-link img, .league-head img, .club img, .ev img {
  width: 22px;
  height: 22px;
  object-fit: contain;
}
.side-link .meta, .league-head p, .muted { color: var(--muted); }
.side-link .copy { min-width: 0; flex: 1; }
.side-link strong, .side-link span { display: block; }
.side-link strong {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.side-link span, .count-pill {
  font-size: 12px;
  color: var(--muted);
}
.side-link.active, .side-link:hover, .match:hover { background: #fafbfc; }
.side-link.active { background: var(--accent-soft); }
.side-link.active strong { color: var(--accent); }
.count-pill {
  min-width: 22px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.page-head { margin-bottom: 14px; }
.kicker {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
h1 { margin: 0; font-size: 32px; letter-spacing: -0.04em; line-height: 1.15; }
.lede { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.title-row { display: flex; justify-content: space-between; gap: 12px; align-items: flex-end; }

.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin: 16px 0;
  flex-wrap: wrap;
}
.datebar, .filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.icon-btn, .ghost, .seg button, .primary {
  border: 1px solid var(--line);
  background: white;
  border-radius: 12px;
  height: 38px;
  padding: 0 12px;
  font-weight: 600;
  font-size: 14px;
}
.icon-btn { width: 38px; padding: 0; font-size: 20px; line-height: 1; }
.ghost.on, .seg button.on, .side-link.live-on {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: transparent;
}
.date-label {
  min-width: 118px;
  text-align: center;
  font-weight: 700;
}
.seg {
  display: flex;
  background: #eceef2;
  border-radius: 12px;
  padding: 3px;
  gap: 2px;
}
.seg button {
  border: 0;
  background: transparent;
  height: 32px;
  border-radius: 9px;
  color: #3f4754;
}
.seg button.on { background: white; color: var(--ink); box-shadow: var(--shadow); }
.seg em {
  font-style: normal;
  margin-left: 4px;
  color: var(--accent);
  font-size: 12px;
}
.total { color: var(--muted); font-size: 13px; margin-left: 4px; }

.card { margin-bottom: 12px; overflow: hidden; }
.league-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: #f8f9fb;
  border: 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
}
.league-head .copy { flex: 1; min-width: 0; }
.league-head strong { display: block; font-size: 14px; }
.league-head p { margin: 2px 0 0; font-size: 12px; }
.match { display: flex; align-items: stretch; background: white; }
.match + .match { border-top: 1px solid var(--line-soft); }
.match-hit {
  flex: 1;
  min-width: 0;
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 6px;
  align-items: center;
  padding: 8px 4px 8px 12px;
  border: 0;
  background: transparent;
  text-align: left;
}
.st { color: var(--faint); font-size: 12px; font-weight: 700; }
.st b, .st small { display: block; }
.st small { font-weight: 600; font-size: 10px; margin-top: 2px; color: var(--faint); }
.st.is-live { color: var(--accent); }
.st.is-live b::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 5px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 0 rgba(217, 4, 41, 0.45);
  animation: pulse 1.3s ease infinite;
  vertical-align: 1px;
}
.st.is-time { color: var(--ink); font-variant-numeric: tabular-nums; }
.side {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) 28px;
  gap: 8px;
  align-items: center;
  min-height: 28px;
}
.side img { width: 20px; height: 20px; object-fit: contain; }
.tname {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 600;
}
.sc {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-size: 15px;
  font-weight: 700;
}
.side.win .tname, .side.win .sc { font-weight: 800; }
.side.lose .tname, .side.lose .sc { color: var(--faint); font-weight: 500; }
.board-score p.is-live { color: var(--accent); }
.star {
  width: 42px;
  border: 0;
  background: transparent;
  display: grid;
  place-items: center;
}
.star svg { width: 18px; height: 18px; fill: none; stroke: #c5c9d2; stroke-width: 1.7; stroke-linejoin: round; }
.star.on svg { fill: var(--gold); stroke: var(--gold); }
.flash .sc { animation: pop 0.5s ease; }

.banner, .notice, .empty {
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 12px;
  font-size: 14px;
}
.banner, .notice { background: #fff7e8; color: #8a5a00; border: 1px solid #ffe1a8; }
.empty {
  background: white;
  border: 1px dashed var(--line);
  color: var(--muted);
  text-align: center;
  padding: 36px 16px;
}
.empty h2 { margin: 0 0 6px; color: var(--ink); font-size: 18px; }
.skeleton {
  height: 84px;
  border-radius: 16px;
  background: linear-gradient(90deg, #eceef2 25%, #f7f8fa 37%, #eceef2 63%);
  background-size: 400% 100%;
  animation: shine 1.2s ease infinite;
  margin-bottom: 12px;
}

.select {
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: white;
  padding: 0 12px;
  font-weight: 600;
  max-width: 100%;
}
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  text-align: right;
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--faint);
  font-weight: 700;
  padding: 10px 8px;
}
th.team, td.teamcell { text-align: left; }
td {
  padding: 9px 8px;
  border-top: 1px solid var(--line-soft);
  text-align: right;
  font-variant-numeric: tabular-nums;
}
td.rank { text-align: center; font-weight: 800; width: 42px; }
td.teamcell { font-weight: 600; }
.teamline { display: flex; align-items: center; gap: 8px; min-width: 160px; }
.teamline img { width: 20px; height: 20px; object-fit: contain; }
td.pts { font-weight: 800; }
.group-title { margin: 0; padding: 12px 14px 0; font-size: 13px; color: var(--muted); }
tr.zone-ucl td.rank { box-shadow: inset 3px 0 #3b82f6; }
tr.zone-uel td.rank { box-shadow: inset 3px 0 #f59e0b; }
tr.zone-up td.rank { box-shadow: inset 3px 0 #10b981; }
tr.zone-down td.rank { box-shadow: inset 3px 0 var(--accent); }
.form { display: flex; gap: 3px; justify-content: flex-end; }
.fm {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  display: grid;
  place-items: center;
  font-style: normal;
  font-size: 10px;
  font-weight: 800;
  color: white;
  background: var(--faint);
}
.fm.w { background: #12b76a; }
.fm.d { background: #98a2b3; }
.fm.l { background: var(--accent); }

#drawer { position: fixed; inset: 0; z-index: 40; }
#drawer[hidden] { display: none; }
.backdrop { position: absolute; inset: 0; background: rgba(16, 24, 40, 0.46); border: 0; }
.panel {
  position: absolute;
  top: 0;
  right: 0;
  width: min(460px, 100%);
  height: 100%;
  background: #f6f7f9;
  overflow: auto;
  box-shadow: -12px 0 40px rgba(16, 24, 40, 0.12);
}
.panel-top {
  position: sticky;
  top: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  z-index: 1;
}
.board {
  margin: 14px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px;
  align-items: center;
}
.club { display: grid; justify-items: center; gap: 8px; text-align: center; min-width: 0; }
.club img { width: 52px; height: 52px; object-fit: contain; }
.club span { font-weight: 700; font-size: 14px; }
.board-score { text-align: center; min-width: 92px; }
.board-score strong {
  font-size: 32px;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}
.board-score .vs { font-size: 28px; }
.board-score p { margin: 2px 0 0; color: var(--muted); font-size: 12px; font-weight: 700; }
.facts { margin: 0 14px 14px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.tabs { display: flex; gap: 6px; padding: 0 14px; }
.tabs button { flex: 1; }
.panel .card { margin: 14px; }
.ev { display: grid; grid-template-columns: 52px auto minmax(0, 1fr) 22px; gap: 8px; align-items: center; padding: 10px 12px; }
.ev + .ev { border-top: 1px solid var(--line-soft); }
.ev-min { font-weight: 800; font-size: 13px; font-variant-numeric: tabular-nums; }
.badge {
  font-size: 11px;
  font-weight: 800;
  border-radius: 999px;
  padding: 3px 7px;
  background: #eef2f6;
  color: #344054;
  white-space: nowrap;
}
.badge.goal { background: #e9f9ef; color: #087443; }
.badge.card-y { background: #fff6d8; color: #946200; }
.badge.card-r { background: var(--accent-soft); color: var(--accent); }
.badge.sub { background: #eef4ff; color: #1849a9; }
.ev-body { min-width: 0; }
.ev-body b, .ev-body small { display: block; }
.ev-body b { font-size: 14px; }
.ev-body small { color: var(--muted); font-size: 12px; }
.stat { display: grid; grid-template-columns: 52px minmax(0, 1fr) 52px; gap: 8px; align-items: center; padding: 9px 12px; }
.stat + .stat { border-top: 1px solid var(--line-soft); }
.stat b { font-variant-numeric: tabular-nums; font-size: 13px; }
.stat b.right { text-align: right; }
.stat-mid { text-align: center; font-size: 12px; color: var(--muted); }
.bar { height: 6px; background: #eceef2; border-radius: 99px; margin-top: 6px; overflow: hidden; display: flex; }
.bar i { display: block; height: 100%; background: var(--accent); }
.bar em { display: block; height: 100%; background: #98a2b3; flex: 1; }
.lineup { padding: 12px; }
.lineup-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.lineup-head img { width: 24px; height: 24px; object-fit: contain; }
.pitch {
  background:
    radial-gradient(circle at 50% 50%, transparent 28px, rgba(255,255,255,.18) 29px, transparent 30px),
    linear-gradient(#1f8a4d, #166b3a);
  border-radius: 14px;
  min-height: 250px;
  padding: 10px 6px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 6px;
}
.prow { display: flex; justify-content: space-around; }
.pchip { width: 68px; color: white; text-align: center; font-size: 10px; font-weight: 600; }
.pchip b {
  width: 22px;
  height: 22px;
  margin: 0 auto 3px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.28);
  font-size: 11px;
}
.xi { list-style: none; margin: 10px 0 0; padding: 0; }
.xi li { display: grid; grid-template-columns: 28px 1fr auto; gap: 8px; padding: 6px 0; border-top: 1px solid var(--line-soft); font-size: 14px; }
.xi em { color: var(--faint); font-style: normal; font-size: 12px; }
.subs { margin-top: 8px; color: var(--muted); font-size: 13px; }
.foot {
  margin-top: 18px;
  color: var(--faint);
  font-size: 12px;
  line-height: 1.5;
}

#toasts { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 50; display: grid; gap: 8px; width: min(420px, calc(100% - 24px)); }
.toast {
  background: #14181f;
  color: white;
  border-radius: 14px;
  padding: 12px 14px;
  font-weight: 700;
  box-shadow: 0 10px 30px rgba(16, 24, 40, 0.25);
}

@keyframes pulse {
  50% { opacity: 0.35; }
}
@keyframes pop {
  from { color: var(--accent); transform: scale(1.18); }
}
@keyframes shine {
  0% { background-position: 100% 0; }
  100% { background-position: 0 0; }
}

@media (max-width: 860px) {
  .layout { grid-template-columns: minmax(0, 1fr); padding-top: 14px; }
  aside, main, .side-scroll, .side-card { min-width: 0; max-width: 100%; }
  .side-scroll {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    margin-bottom: 8px;
  }
  .side-card { display: flex; gap: 8px; margin: 0; padding: 0; border: 0; background: transparent; box-shadow: none; }
  .side-label { display: none; }
  .side-link {
    width: auto;
    background: white;
    border: 1px solid var(--line);
    white-space: nowrap;
    padding: 8px 10px;
  }
  .side-link .copy > span { display: none; }
  h1 { font-size: 26px; }
}
@media (max-width: 720px) {
  .shell { width: min(1180px, calc(100% - 20px)); }
  .topbar-inner { flex-wrap: wrap; padding: 10px 0; gap: 10px; }
  .nav a { padding: 8px 8px 10px; }
  .search { order: 3; width: 100%; min-width: 0; margin-left: 0; }
  .col-opt { display: none; }
  .board-score strong { font-size: 26px; }
}
