@import url("./tokens.css");

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { color-scheme: dark; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; background: var(--background); color: var(--text); font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; font-size: 14px; -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
p { line-height: 1.6; }
:focus-visible { outline: 2px solid var(--red-light); outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { animation: none !important; transition: none !important; } }
.icon { width: 18px; height: 18px; vertical-align: middle; flex-shrink: 0; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.red-text { color: var(--red-light); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: fixed; top: -100px; left: 12px; z-index: 100; padding: 12px 16px; background: #fff; color: #000; border-radius: 6px; }
.skip-link:focus { top: 12px; }
.noscript { padding: 24px; text-align: center; }

/* Header */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 24px; min-height: 68px; padding: 0 32px; padding-top: env(safe-area-inset-top); border-bottom: 1px solid var(--line); background: rgba(17, 17, 19, .92); backdrop-filter: blur(12px); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 800; font-size: 21px; letter-spacing: -.6px; white-space: nowrap; }
.brand-mark { width: 34px; height: 34px; border-radius: 9px; }
.brand-light { font-weight: 400; }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.button { min-height: 40px; padding: 9px 15px; border-radius: 8px; border: 1px solid transparent; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-size: 13px; font-weight: 700; text-decoration: none; background: transparent; }
.button.red { background: var(--red); color: #fff; }
.button.red:hover { background: #e4475b; }
.button.secondary { border-color: var(--line-strong); }
.button.secondary:hover { background: var(--hover); }
.language-picker { position: relative; display: flex; align-items: center; height: 40px; border: 1px solid var(--line-strong); border-radius: 8px; background: #151518; }
.language-picker:hover { background: var(--hover); }
.language-picker:focus-within { outline: 2px solid var(--red-light); outline-offset: 2px; }
.language-picker > .icon { position: absolute; left: 11px; width: 16px; color: var(--muted); pointer-events: none; }
.language-picker > .chevron { left: auto; right: 9px; width: 14px; }
.language-picker select { appearance: none; -webkit-appearance: none; height: 100%; padding: 0 30px 0 34px; border: 0; background: transparent; font-size: 13px; font-weight: 600; cursor: pointer; max-width: 190px; }
.language-picker select:focus { outline: none; }
.language-picker option { background: #151518; color: var(--text); }

/* Layout */
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 28px; max-width: 1280px; margin: 0 auto; padding: 28px 32px 40px; }
main:focus { outline: none; }
.hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; padding: 8px 0 24px; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: 1.4px; text-transform: uppercase; }
.tiny-square { width: 7px; height: 7px; background: var(--red); border-radius: 2px; flex-shrink: 0; }
.hero h1 { margin: 14px 0 10px; font-size: clamp(32px, 5vw, 52px); line-height: 1.02; letter-spacing: -1.6px; }
.hero h1 span { color: var(--red-light); }
.hero p { margin: 0; color: var(--muted); font-size: 15px; max-width: 520px; }
.updated { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; white-space: nowrap; min-height: 18px; }
main, .side { min-width: 0; }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: #3ecf7a; box-shadow: 0 0 0 0 rgba(62, 207, 122, .6); animation: pulse 2s infinite; }
.pulse.stale { background: #e0a43a; animation: none; }
@keyframes pulse { 70% { box-shadow: 0 0 0 7px rgba(62, 207, 122, 0); } 100% { box-shadow: 0 0 0 0 rgba(62, 207, 122, 0); } }

/* Controls */
.controls { display: grid; gap: 12px; margin-bottom: 18px; }
.day-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.day-tabs, .status-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.day-tabs button, .status-tabs button { display: inline-flex; align-items: center; gap: 7px; min-height: 38px; padding: 8px 14px; border: 1px solid var(--line-strong); border-radius: 999px; background: transparent; font-size: 13px; font-weight: 600; color: var(--muted); }
.day-tabs button:hover, .status-tabs button:hover { color: var(--text); background: var(--hover); }
.day-tabs button.active, .status-tabs button.active { background: var(--text); border-color: var(--text); color: #0d0d0f; }
.day-tabs .live-tab .icon { width: 16px; color: var(--red-light); }
.day-tabs .live-tab.active { background: var(--red); border-color: var(--red); color: #fff; }
.day-tabs .live-tab.active .icon { color: #fff; }
.status-tabs button { min-height: 32px; padding: 5px 12px; font-size: 12px; }
.count { font-size: 11px; opacity: .7; font-variant-numeric: tabular-nums; }
.search { display: flex; align-items: center; gap: 8px; min-width: 260px; height: 40px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 8px; background: #151518; color: var(--muted); }
.search:focus-within { border-color: var(--red-light); }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; font-size: 13px; color: var(--text); }
.search input:focus { outline: none; }

/* Match list */
.fixtures { border: 1px solid var(--line); border-radius: 14px; background: #111113; overflow: hidden; }
.list-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.list-toolbar h2 { margin: 0; font-size: 15px; }
.league-heading { display: flex; align-items: center; gap: 10px; margin: 0; padding: 11px 18px; background: #161619; border-bottom: 1px solid var(--line); font-size: 13px; }
.league-heading small { color: var(--muted); font-weight: 400; }
.league-total { margin-left: auto; color: var(--muted); font-size: 11px; font-weight: 500; }
.match-row { display: grid; grid-template-columns: 64px minmax(0, 1fr) 44px 30px; align-items: center; gap: 12px; width: 100%; padding: 11px 18px; border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left; }
.match-row:hover { background: var(--hover); }
.league-group:last-child .match-row:last-child { border-bottom: 0; }
.match-time { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.match-time.live { color: var(--red-light); }
.match-time { min-width: 0; }
.match-time.off { font-size: 9px; line-height: 1.2; text-transform: uppercase; letter-spacing: .3px; overflow-wrap: anywhere; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--red); animation: blink 1.4s infinite; }
@keyframes blink { 50% { opacity: .25; } }
.teams, .scores { display: grid; gap: 6px; }
.teams span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.finished .teams span:not(.winner) { color: #c3c3cc; }
.teams .winner { font-weight: 700; }
.scores { justify-items: end; font-variant-numeric: tabular-nums; font-size: 15px; }
.scores.live b { color: var(--red-light); }
.row-lock { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; color: var(--muted); background: #1a1a1e; }
.match-row:hover .row-lock { color: var(--red-light); }
.row-lock .icon { width: 15px; }
.empty-state { display: grid; justify-items: center; gap: 4px; padding: 48px 24px; text-align: center; color: var(--muted); }
.empty-state h3 { margin: 8px 0 0; color: var(--text); font-size: 16px; }
.empty-state p { margin: 0 0 12px; }
.empty-state .icon { width: 28px; height: 28px; }
.skeleton-list { display: grid; }
.skeleton { height: 62px; border-bottom: 1px solid var(--line); background: linear-gradient(90deg, #131316 0%, #1b1b1f 50%, #131316 100%); background-size: 200% 100%; animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* App card */
.side { position: relative; }
.app-card { position: sticky; top: 92px; display: grid; gap: 12px; padding: 24px; border: 1px solid #3a2228; border-radius: 16px; background: radial-gradient(120% 80% at 100% 0%, #3a1820 0%, #151215 55%); }
.app-card-icon img { width: 64px; height: 64px; border-radius: 15px; box-shadow: 0 10px 30px rgba(207, 52, 70, .25); }
.app-card h2 { margin: 2px 0 0; font-size: 22px; line-height: 1.2; letter-spacing: -.4px; }
.app-card p { margin: 0; color: #c9b9bd; }
.locked-preview { position: relative; display: grid; gap: 9px; padding: 14px; border: 1px solid var(--line-strong); border-radius: 10px; background: #121214; overflow: hidden; }
.locked-preview div { display: flex; gap: 4px; height: 8px; filter: blur(1.5px); }
.locked-preview i { display: block; height: 100%; border-radius: 4px; background: var(--red); }
.locked-preview i + i { background: #4a4a55; }
.locked-preview div:nth-child(1) i:first-child { width: 68%; }
.locked-preview div:nth-child(2) i:first-child { width: 44%; }
.locked-preview div:nth-child(3) i:first-child { width: 61%; }
.locked-preview div:nth-child(4) i:first-child { width: 52%; }
.locked-preview i + i { flex: 1; }
.lock-icon { position: absolute; inset: 0; margin: auto; width: 22px; height: 22px; padding: 4px; box-sizing: content-box; border-radius: 50%; background: #0d0d0f; color: var(--text); }
.text-link { color: #e9b7bf; font-size: 13px; font-weight: 600; text-decoration: none; }
.text-link:hover { color: #fff; text-decoration: underline; }
.store-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.store-buttons.wide .store-button { flex: 1; }
.store-button { display: inline-flex; align-items: center; gap: 10px; min-height: 48px; padding: 7px 16px 7px 12px; border-radius: 10px; background: #fff; color: #0d0d0f; text-decoration: none; font-weight: 700; font-size: 15px; line-height: 1.05; }
.store-button:hover { background: #ececf1; }
.store-button small { display: block; font-size: 10px; font-weight: 500; }
.store-button .icon { width: 20px; height: 20px; fill: currentColor; stroke-width: 1.4; }

/* Dialog */
dialog { width: min(480px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 0; border: 1px solid var(--line-strong); border-radius: 16px; background: #141417; color: var(--text); }
.dialog-body { padding: 26px; }
dialog::backdrop { background: rgba(0, 0, 0, .72); backdrop-filter: blur(3px); }
dialog h2 { margin: 18px 0 4px; font-size: 19px; }
dialog p { margin: 0 0 14px; color: var(--muted); }
.icon-button { display: grid; place-items: center; width: 36px; height: 36px; border: 1px solid var(--line-strong); border-radius: 8px; background: transparent; }
.icon-button:hover { background: var(--hover); }
.dialog-close { position: absolute; top: 14px; right: 14px; }
.dialog-close .icon { width: 16px; }
dialog .eyebrow { padding-right: 40px; }
.dialog-score { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; margin: 22px 0 18px; text-align: center; }
.dialog-score > strong { font-size: 15px; overflow-wrap: anywhere; }
.dialog-score div { display: grid; gap: 4px; }
.dialog-score b { font-size: 34px; letter-spacing: -1px; font-variant-numeric: tabular-nums; }
.dialog-score span { font-size: 12px; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0 0 16px; }
.facts div { padding: 10px 12px; border-radius: 8px; background: #1b1b1f; }
.facts dt { color: var(--muted); font-size: 11px; }
.facts dd { margin: 3px 0 0; font-weight: 600; font-size: 13px; }

/* Footer */
.footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; max-width: 1280px; margin: 0 auto; padding: 22px 32px calc(28px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.footer nav { display: flex; gap: 18px; }
.footer a { text-decoration: none; }
.footer a:hover { color: var(--text); text-decoration: underline; }

@media (max-width: 1020px) {
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .app-card { position: static; grid-template-columns: auto 1fr; align-items: center; column-gap: 16px; }
  .app-card > :not(.app-card-icon) { grid-column: 1 / -1; }
  .app-card .locked-preview { display: none; }
  .hero { padding-top: 0; }
}
@media (max-width: 640px) {
  .topbar { padding: 0 16px; gap: 12px; min-height: 60px; }
  .brand { font-size: 18px; }
  .brand-mark { width: 30px; height: 30px; }
  .header-cta { padding: 0; width: 40px; font-size: 0; gap: 0; }
  .header-cta .icon { width: 18px; }
  .language-picker select { max-width: 132px; padding-right: 26px; }
  .workspace { padding: 18px 16px 28px; gap: 18px; }
  .hero { flex-direction: column; align-items: flex-start; gap: 12px; padding-bottom: 8px; }
  .search { min-width: 0; width: 100%; }
  .match-row { grid-template-columns: 52px minmax(0, 1fr) 36px; padding: 11px 14px; gap: 10px; }
  .row-lock { display: none; }
  .league-heading, .list-toolbar { padding-inline: 14px; }
  .list-toolbar .small { display: none; }
  .app-card { padding: 18px; }
  .app-card h2 { font-size: 18px; }
  .store-button { flex: 1; justify-content: center; }
  .footer { padding-inline: 16px; flex-direction: column; align-items: flex-start; }
}
