:root {
  color-scheme: light;
  --bg: #f3f6fa;
  --bg-2: #e8eef6;
  --paper: #ffffff;
  --ink: #0f172a;
  --muted: #5b6b7c;
  --line: #dce4ee;
  --line-strong: #c9d4e3;
  --teal: #2563eb;
  --teal-2: #1d4ed8;
  --teal-soft: #dbeafe;
  --rose: #be123c;
  --rose-soft: #ffe4e6;
  --off: #475569;
  --off-soft: #e2e8f0;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 10px 24px rgba(15, 23, 42, 0.06);
  --radius: 18px;
  --font: "Anuphan", "Sarabun", system-ui, sans-serif;
  --display: "Outfit", "Anuphan", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  background:
    radial-gradient(ellipse 70% 40% at 8% -12%, #dbeafe 0%, transparent 55%),
    radial-gradient(ellipse 50% 30% at 100% 0%, #e0e7ff 0%, transparent 50%),
    var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.page {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.top {
  padding: 1.25rem 1.25rem 0.5rem;
}
.top-inner {
  max-width: 52rem;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.nav {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}
.nav-link, .nav-drop summary {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  border-radius: 999px;
  padding: 0.42rem 0.85rem;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  line-height: 1.2;
}
.nav-link.is-active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}
.nav-link:hover:not(.is-active),
.nav-drop summary:hover {
  border-color: var(--teal);
  background: var(--teal-soft);
}
.nav-drop { position: relative; }
.nav-drop summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.nav-drop summary::-webkit-details-marker { display: none; }
.nav-drop summary::after {
  content: "";
  width: 0.4rem;
  height: 0.4rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  margin-top: -0.15rem;
}
.nav-drop[open] summary {
  border-color: var(--teal);
  background: var(--teal-soft);
}
.nav-drop-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 16.5rem;
  max-height: min(70vh, 28rem);
  overflow-y: auto;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 0.4rem;
  z-index: 40;
}
.nav-drop-panel a {
  display: block;
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  font-weight: 600;
  font-size: 0.88rem;
}
.nav-drop-panel a:hover,
.nav-drop-panel a.is-active {
  background: var(--teal-soft);
  color: var(--teal-2);
}
.nav-drop-label {
  margin: 0.45rem 0.75rem 0.2rem;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.04em;
}
.prog-strip {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  padding: 0.75rem 0 0.15rem;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.prog-strip::-webkit-scrollbar { display: none; }
.prog-chip {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  border-radius: 999px;
  padding: 0.38rem 0.8rem;
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.prog-chip.is-active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}
.prog-chip:hover:not(.is-active) { border-color: var(--ink); }
.league-title {
  text-align: left;
  padding: 0.35rem 0 0.15rem;
}
.league-title h1 {
  font-size: 1.15rem !important;
  color: var(--ink) !important;
  font-family: var(--display) !important;
  letter-spacing: -0.03em !important;
}
.league-title p {
  font-family: var(--font) !important;
  font-size: 0.82rem !important;
  font-weight: 500 !important;
  color: var(--muted) !important;
  letter-spacing: 0 !important;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: inherit;
  min-width: 0;
}
.mark {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  filter: drop-shadow(0 6px 12px rgba(37, 99, 235, 0.28));
}
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-name {
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.brand-sub {
  font-size: 0.75rem;
  color: var(--muted);
}
.top-note {
  margin: 0;
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
}

.toolbar { padding: 0.5rem 1.25rem 0; }
.toolbar-inner {
  max-width: 52rem;
  margin: 0 auto;
}

.date-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: nowrap;
}
.date-heading {
  flex: 1;
  min-width: 10rem;
  text-align: center;
}
.date-heading h1 {
  margin: 0;
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0;
}
.date-heading p {
  margin: 0.15rem 0 0;
  font-family: var(--display);
  font-size: 1.15rem;
  font-weight: 650;
  letter-spacing: -0.03em;
  color: var(--ink);
}

.icon-btn, .today-btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  transition: transform 0.12s, background 0.12s, border-color 0.12s;
}
.icon-btn {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 12px;
  display: grid;
  place-items: center;
}
.today-btn {
  height: 2.5rem;
  padding: 0 0.95rem;
  border-radius: 999px;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.85rem;
}
.icon-btn:hover, .today-btn:hover {
  border-color: var(--teal);
  background: var(--teal-soft);
}
.icon-btn:active, .today-btn:active { transform: scale(0.96); }

input[type="date"] {
  height: 2.5rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  padding: 0 0.7rem;
  font-family: inherit;
  font-size: 0.85rem;
}
input[type="date"]:focus {
  outline: 2px solid rgba(37, 99, 235, 0.25);
  border-color: var(--teal);
}

.day-strip {
  display: flex;
  gap: 0.45rem;
  overflow-x: auto;
  padding: 0.9rem 0 0.35rem;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.day-strip::-webkit-scrollbar { display: none; }

.day-chip {
  flex: 0 0 auto;
  min-width: 3.4rem;
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 14px;
  padding: 0.45rem 0.55rem 0.5rem;
  cursor: pointer;
  text-align: center;
  font-family: inherit;
  color: var(--ink);
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.day-chip .w { display: block; font-size: 0.68rem; color: var(--muted); font-weight: 500; }
.day-chip .n {
  display: block;
  font-family: var(--display);
  font-size: 1.05rem;
  font-weight: 650;
  letter-spacing: -0.03em;
  margin-top: 0.05rem;
  font-variant-numeric: tabular-nums;
}
.day-chip.is-today .w { color: var(--teal); }
.day-chip.is-active {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
}
.day-chip.is-active .w,
.day-chip.is-active .n { color: #fff; }
.day-chip:hover:not(.is-active) { border-color: var(--teal); }

.chips {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  padding: 0.35rem 0 0.15rem;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  border-radius: 999px;
  padding: 0.38rem 0.8rem;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.chip.is-active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}
.chip:hover:not(.is-active) { border-color: var(--ink); }

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.75rem 0 0.15rem;
  font-size: 0.78rem;
  color: var(--muted);
}
.stat-pill {
  background: var(--bg-2);
  border-radius: 999px;
  padding: 0.2rem 0.65rem;
}

.main {
  flex: 1;
  width: 100%;
  max-width: 52rem;
  margin: 0 auto;
  padding: 0.85rem 1.25rem 2.5rem;
}

.league-block {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 0.9rem;
  overflow: hidden;
  animation: rise 0.35s ease both;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.league-head {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.85rem 1rem 0.7rem;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  color: inherit;
}
a.league-head:hover {
  background: #f8fafc;
}
.league-more {
  margin-left: auto;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--teal);
  white-space: nowrap;
}
.league-crest-wrap {
  position: relative;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}
.league-logo,
.league-logo-fallback {
  width: 28px;
  height: 28px;
  border-radius: 8px;
}
.league-logo {
  position: absolute;
  inset: 0;
  object-fit: contain;
  background: var(--bg);
  padding: 3px;
}
.league-logo-fallback {
  background: var(--teal-soft);
  color: var(--teal);
  display: grid;
  place-items: center;
  font-size: 0.7rem;
  font-weight: 700;
}
.hot-tag {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--teal-2);
  background: var(--teal-soft);
  border-radius: 999px;
  padding: 0.12rem 0.4rem;
}
.league-head h2 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.league-meta {
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
}

.match {
  display: grid;
  grid-template-columns: 4.4rem 1fr 2.1rem;
  gap: 0.15rem 0.75rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--line);
  align-items: center;
}
.match:last-child { border-bottom: 0; }
.match:hover { background: #f8fafc; }

.ko {
  text-align: center;
}
.ko-time {
  font-family: var(--display);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--teal);
  font-variant-numeric: tabular-nums;
}
.match.is-ns .ko-time { color: var(--teal); }
.match.is-ft .ko-time,
.match.is-ft .ko-badge {
  color: #1e293b;
}
.match.is-live .ko-time { color: var(--rose); }
.ko-badge {
  display: inline-block;
  margin-top: 0.2rem;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.12rem 0.4rem;
  border-radius: 999px;
  background: var(--bg-2);
  color: var(--muted);
}
.ko-badge.is-live {
  background: var(--rose-soft);
  color: var(--rose);
}
.ko-badge.is-ft {
  background: #e2e8f0;
  color: #1e293b;
}
.ko-badge.is-off {
  background: var(--off-soft);
  color: var(--off);
}

.sides {
  min-width: 0;
  display: grid;
  gap: 0.35rem;
}
.team {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
}
.crest-wrap {
  position: relative;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}
.abbr, .crest {
  width: 28px;
  height: 28px;
  border-radius: 8px;
}
.abbr {
  background: var(--bg);
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 700;
  display: grid;
  place-items: center;
  letter-spacing: 0.02em;
}
.crest {
  position: absolute;
  inset: 0;
  object-fit: contain;
  background: #fff;
}
.team-name {
  font-size: 0.95rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.score {
  display: grid;
  gap: 0.35rem;
  justify-items: end;
  font-family: var(--display);
  font-size: 1.05rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.04em;
  color: var(--ink);
}
.score span {
  min-height: 28px;
  display: grid;
  align-items: center;
}
.score.is-empty span { visibility: hidden; }

.empty, .error {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2.4rem 1.4rem;
  text-align: center;
}
.empty h2, .error h2 {
  margin: 0.4rem 0 0.35rem;
  font-size: 1.1rem;
}
.empty p, .error p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}
.empty .emoji { font-size: 1.8rem; }
.error { border-color: #f0c4cf; }
.retry {
  margin-top: 1rem;
  border: 0;
  background: var(--teal);
  color: #fff;
  font-family: inherit;
  font-weight: 600;
  border-radius: 999px;
  padding: 0.5rem 1.1rem;
  cursor: pointer;
}

.skeleton-wrap { display: grid; gap: 0.9rem; }
.skeleton-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
}
.sk-line, .sk-row {
  background: linear-gradient(90deg, #e8eef6, #f8fafc, #e8eef6);
  background-size: 200% 100%;
  animation: shimmer 1.2s ease infinite;
  border-radius: 8px;
}
.sk-line { height: 12px; margin-bottom: 0.9rem; }
.sk-w-sm { width: 38%; }
.sk-row { height: 42px; margin-bottom: 0.5rem; }
@keyframes shimmer {
  from { background-position: 100% 0; }
  to { background-position: -100% 0; }
}

.seo {
  margin-top: 2rem;
  padding: 1.25rem 1.3rem 1.4rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.seo h2 {
  margin: 0 0 0.7rem;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.seo p {
  margin: 0 0 0.7rem;
  font-size: 0.92rem;
  line-height: 1.7;
  color: #334155;
}
.seo p:last-child { margin-bottom: 0; }
.seo a { color: var(--teal-2); font-weight: 600; }
.seo-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.9rem;
  list-style: none;
  margin: 0.9rem 0 0;
  padding: 0;
}
.seo-links a {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--teal-2);
  text-decoration: none;
}
.seo-links a:hover { text-decoration: underline; }

.foot {
  padding: 1.4rem 1.25rem 2rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.75rem;
}
.foot p { margin: 0.85rem 0 0; }
.foot-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.35rem 0.85rem;
  max-width: 52rem;
  margin: 0 auto 0.4rem;
}
.foot-nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.75rem;
  font-weight: 600;
}
.foot-nav a:hover { color: var(--teal-2); }

@media (max-width: 720px) {
  .date-nav { flex-wrap: wrap; }
  input[type="date"] { margin-left: auto; }
}
@media (max-width: 640px) {
  .top-note { display: none; }
  .date-heading p { font-size: 1.02rem; }
  .main, .toolbar, .top { padding-left: 0.9rem; padding-right: 0.9rem; }
  .match { grid-template-columns: 3.8rem 1fr 1.8rem; padding-left: 0.85rem; padding-right: 0.85rem; }
  input[type="date"] { display: none; }
  .league-more { display: none; }
  .nav-drop-panel { right: -0.4rem; min-width: min(18rem, calc(100vw - 1.8rem)); }
}
