:root {
  --bg: #0b1020;
  --bg-2: #141b33;
  --card: #161d36;
  --line: #26304f;
  --text: #e8ecf8;
  --muted: #93a0c2;
  --accent: #38bdf8;
  --display: "Anton", "Noto Sans", sans-serif;
  --live: #ff4d5e;
  --green: #34d399;
  --yellow: #fbbf24;
  --red: #ef4444;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Noto Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.4;
}

body {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 12px env(safe-area-inset-bottom, 12px);
  min-height: 100vh;
}

/* Top bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 4px 10px;
  background: linear-gradient(var(--bg) 70%, transparent);
}
.brand { display: flex; align-items: center; gap: 9px; font-size: 19px; text-decoration: none; color: inherit; cursor: pointer; }
.brand .mark { color: var(--accent); flex: 0 0 auto; }
.brand .emblem { height: 26px; width: auto; flex: 0 0 auto; }
.brand span {
  font-family: var(--display); font-weight: 400; letter-spacing: .5px;
  background: linear-gradient(90deg, #38bdf8, #818cf8);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

.refresh-toggle {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--muted);
  background: var(--bg-2); border: 1px solid var(--line);
  padding: 5px 10px; border-radius: 999px; cursor: pointer;
}
.refresh-toggle input { accent-color: var(--accent); }

/* Tabs */
.tabs { display: flex; gap: 8px; padding: 4px 0 12px; }
.tab {
  flex: 1; text-align: center; text-decoration: none;
  color: var(--muted); font-weight: 600; font-size: 14px;
  padding: 9px 0; border-radius: 10px; background: var(--bg-2);
  border: 1px solid transparent;
}
.tab.active { color: var(--text); background: var(--card); border-color: var(--line); }

/* Date strip */
.datebar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px; background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 12px; padding: 6px;
}
.datebar button {
  background: none; border: none; color: var(--muted); cursor: pointer;
  width: 40px; height: 36px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
}
.datebar button:active { background: var(--line); }
.datebar .date-label { font-weight: 700; font-size: 14px; }
.datebar .date-sub { display: block; font-size: 11px; color: var(--muted); font-weight: 500; text-align: center; }

/* Section headings */
.section-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); margin: 18px 2px 8px;
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--live); animation: pulse 1.4s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .3; } }

/* Match card */
.card {
  display: block; text-decoration: none; color: inherit;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; padding: 12px 14px; margin-bottom: 10px;
}
.card:active { background: var(--bg-2); }
.card .meta { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-bottom: 8px; }
.card .status-live { color: var(--live); font-weight: 700; }
.card .status-live::before { content: "● "; }

.row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px; padding: 3px 0; }
.team { display: flex; align-items: center; gap: 10px; min-width: 0; }
.team img { width: 24px; height: 24px; object-fit: contain; border-radius: 3px; background: #fff1; flex: 0 0 auto; }
.team .name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.team.winner .name { color: #fff; }
.score { font-family: var(--display); font-weight: 400; font-size: 20px; min-width: 22px; text-align: right; font-variant-numeric: tabular-nums; letter-spacing: .5px; }
.score.dim { color: var(--muted); font-weight: 600; }
.card .foot { font-size: 11px; color: var(--muted); margin-top: 8px; display: flex; gap: 6px; flex-wrap: wrap; }
.pill { background: var(--bg-2); border: 1px solid var(--line); padding: 2px 7px; border-radius: 6px; }

/* Standings */
.group { margin-bottom: 18px; }
.group h3 { font-size: 14px; margin: 0 2px 6px; }
table.standings { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
table.standings th, table.standings td { padding: 7px 6px; font-size: 12px; text-align: center; }
table.standings th { color: var(--muted); font-weight: 600; background: var(--bg-2); }
table.standings td.team-cell, table.standings th.team-cell { text-align: left; }
table.standings td.team-cell { display: flex; align-items: center; gap: 7px; }
table.standings img { width: 18px; height: 18px; object-fit: contain; }
table.standings tr { border-top: 1px solid var(--line); }
table.standings td.pts { font-weight: 800; }
.qual { width: 3px; border-radius: 2px; display: inline-block; height: 16px; margin-right: 2px; }

/* Match detail */
.detail-head { text-align: center; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px; margin-bottom: 14px; }
.detail-teams { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; }
.detail-teams .t { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.detail-teams .t img { width: 46px; height: 46px; object-fit: contain; }
.detail-teams .t .name { font-weight: 700; font-size: 13px; }
.detail-teams .sc { font-family: var(--display); font-size: 38px; font-weight: 400; font-variant-numeric: tabular-nums; letter-spacing: 1px; }
.detail-status { margin-top: 10px; font-size: 13px; color: var(--muted); }
.detail-status.live { color: var(--live); font-weight: 700; }
.countdown {
  margin-top: 10px; font-family: var(--display); font-size: 24px; letter-spacing: 1.5px;
  color: var(--accent); font-variant-numeric: tabular-nums;
}

.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { display: grid; grid-template-columns: 38px 22px 1fr; align-items: center; gap: 8px; padding: 7px 4px; border-bottom: 1px solid var(--line); font-size: 13px; }
.timeline .clk { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 12px; }
.timeline.away-right li.away { direction: rtl; }
.timeline.away-right li.away * { direction: ltr; }

.statline { margin: 6px 0; }
.statline .lbls { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.statline .bar { display: flex; height: 7px; border-radius: 4px; overflow: hidden; background: var(--bg-2); }
.statline .bar .h { background: var(--accent); }
.statline .bar .a { background: #818cf8; }

.lineups { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.lineups h4 { margin: 0 0 6px; font-size: 13px; }
.lineups ul { list-style: none; padding: 0; margin: 0; font-size: 12px; }
.lineups li { padding: 3px 0; color: var(--muted); display: flex; gap: 6px; }
.lineups li .num { color: var(--text); width: 20px; font-variant-numeric: tabular-nums; }
.lineups li.sub { opacity: .55; }

.back { display: inline-flex; align-items: center; gap: 6px; color: var(--accent); text-decoration: none; font-weight: 600; font-size: 14px; margin: 4px 2px 10px; }

.deep-btn, .link-btn {
  background: var(--bg-2); border: 1px solid var(--line); color: var(--text);
  padding: 9px 14px; border-radius: 10px; font-size: 13px; font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.deep-btn { width: 100%; margin: 6px 0 14px; }
.deep-btn:active { background: var(--line); }

.card-block { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin-bottom: 14px; }
.card-block h3 { margin: 0 0 10px; font-size: 14px; }

/* Status / chrome */
.loading, .empty, .error { text-align: center; color: var(--muted); padding: 40px 16px; }
.error { color: #fca5a5; }

.statusbar { display: flex; align-items: center; justify-content: space-between; padding: 14px 4px 18px; font-size: 12px; color: var(--muted); }
.link-btn { padding: 6px 12px; }

/* ---- Motion: subtle, professional, reduced-motion aware ---- */
@keyframes fadeInUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.view > .section-title,
.card, .group, .card-block, .detail-head, .datebar {
  animation: fadeInUp .32s cubic-bezier(.2, .7, .3, 1) both;
}
.card { transition: transform .16s ease, background .16s ease, border-color .16s ease; }
@media (hover: hover) { .card:hover { transform: translateY(-1px); border-color: #33406b; } }

.tab { transition: background .2s ease, color .2s ease, border-color .2s ease; }
.datebar button { transition: background .15s ease, color .15s ease; }
.statline .bar .h, .statline .bar .a { transition: width .5s cubic-bezier(.2, .7, .3, 1); }

.loading { animation: pulseFade 1.2s ease-in-out infinite; }
@keyframes pulseFade { 0%, 100% { opacity: .45; } 50% { opacity: .9; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

.eventicon { display: flex; align-items: center; justify-content: center; }

/* Event markers — vector/CSS, no emoji */
.mk { display: inline-block; vertical-align: middle; }
.mk-goal {
  width: 11px; height: 11px; border-radius: 50%;
  background: #fff;
  box-shadow: inset 0 0 0 1.5px var(--bg), 0 0 0 1.5px var(--line);
}
.mk-goal.og { box-shadow: inset 0 0 0 1.5px var(--bg), 0 0 0 1.5px var(--red); }
.mk-card { width: 9px; height: 13px; border-radius: 2px; }
.mk-yc { background: var(--yellow); }
.mk-rc { background: var(--red); }
.mk-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--muted); }

/* ---- Skeleton placeholders (shown before a match has data) ---- */
.sk { position: relative; overflow: hidden; background: var(--bg-2); border-radius: 6px; display: inline-block; }
.sk::after {
  content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .06), transparent);
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer { 100% { transform: translateX(100%); } }
.sk-line { height: 12px; }
.card-block.is-skeleton h3 { color: var(--muted); }
.sk-note { font-size: 11px; color: var(--muted); text-align: center; margin-top: 12px; }
.sk-bar { display: block; height: 100%; border-radius: 0; }
