:root {
  --bg: #f6f7fb;
  --bg-grad-1: rgba(99, 102, 241, .14);
  --bg-grad-2: rgba(236, 72, 153, .10);
  --surface: #ffffff;
  --surface-2: #f1f3f9;
  --border: #e3e6ef;
  --text: #0f1222;
  --muted: #5d6478;
  --faint: #8a90a3;
  --accent: #5b5bf0;
  --accent-2: #8b5cf6;
  --accent-ink: #ffffff;
  --up: #16a34a;
  --down: #e11d48;
  --warn-bg: #fff7e6;
  --warn-border: #f5d48a;
  --warn-text: #7a5300;
  --err-bg: #fff1f2;
  --err-border: #fecdd3;
  --err-text: #9f1239;
  --shadow: 0 1px 2px rgba(16, 18, 34, .04), 0 8px 24px rgba(16, 18, 34, .06);
  --shadow-hover: 0 2px 4px rgba(16, 18, 34, .06), 0 16px 40px rgba(16, 18, 34, .12);
  --radius: 18px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0d16;
    --bg-grad-1: rgba(99, 102, 241, .20);
    --bg-grad-2: rgba(236, 72, 153, .12);
    --surface: #141725;
    --surface-2: #1c2033;
    --border: #262b42;
    --text: #eef0f8;
    --muted: #a3a9be;
    --faint: #737a92;
    --accent: #7c7cff;
    --accent-2: #a78bfa;
    --up: #22c55e;
    --down: #fb7185;
    --warn-bg: #2a2110;
    --warn-border: #5c4614;
    --warn-text: #f5cf7a;
    --err-bg: #2a1118;
    --err-border: #5c1d2c;
    --err-text: #fda4af;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    --shadow-hover: 0 2px 4px rgba(0, 0, 0, .35), 0 16px 40px rgba(0, 0, 0, .45);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b0d16;
  --bg-grad-1: rgba(99, 102, 241, .20);
  --bg-grad-2: rgba(236, 72, 153, .12);
  --surface: #141725;
  --surface-2: #1c2033;
  --border: #262b42;
  --text: #eef0f8;
  --muted: #a3a9be;
  --faint: #737a92;
  --accent: #7c7cff;
  --accent-2: #a78bfa;
  --up: #22c55e;
  --down: #fb7185;
  --warn-bg: #2a2110;
  --warn-border: #5c4614;
  --warn-text: #f5cf7a;
  --err-bg: #2a1118;
  --err-border: #5c1d2c;
  --err-text: #fda4af;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  --shadow-hover: 0 2px 4px rgba(0, 0, 0, .35), 0 16px 40px rgba(0, 0, 0, .45);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  font-family: "Inter", "Noto Sans Georgian", system-ui, -apple-system, "Segoe UI", sans-serif;
  background:
    radial-gradient(1200px 600px at 10% -10%, var(--bg-grad-1), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, var(--bg-grad-2), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 16px; }

/* ---------- top bar ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 18px 0; }
.brand { text-decoration: none; display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -.01em; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; box-shadow: var(--shadow);
}
.icon-btn {
  width: 38px; height: 38px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface); display: grid; place-items: center; cursor: pointer; transition: transform .15s;
}
.icon-btn:hover { transform: translateY(-1px); }

/* ---------- hero / input ---------- */
.hero { padding: 40px 0 28px; text-align: center; }
.hero h1 {
  font-size: clamp(30px, 5vw, 52px); line-height: 1.08; letter-spacing: -.035em; margin: 0 0 12px; font-weight: 800;
}
.hero h1 .grad { background: linear-gradient(90deg, var(--accent), var(--accent-2), #ec4899); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { color: var(--muted); margin: 0 auto 28px; max-width: 560px; }
.search {
  display: flex; gap: 8px; align-items: center; max-width: 820px; margin: 0 auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 8px; box-shadow: var(--shadow);
  transition: border-color .15s, box-shadow .15s;
}
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent), var(--shadow); }
.search svg.lead { flex: none; margin-left: 10px; color: var(--faint); }
.search input[type="url"], .search input[type="text"] {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; padding: 12px 6px; font-size: 16px;
}
.search select {
  flex: none; border: 1px solid var(--border); background: var(--surface-2); border-radius: 12px; padding: 10px 8px; font-size: 14px; cursor: pointer;
}
.btn {
  flex: none; display: inline-flex; align-items: center; gap: 8px; border: 0; cursor: pointer; font-weight: 600;
  padding: 12px 20px; border-radius: 14px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--accent-ink);
  transition: transform .15s, opacity .15s, box-shadow .15s; box-shadow: 0 6px 20px color-mix(in srgb, var(--accent) 35%, transparent);
}
.btn:hover { transform: translateY(-1px); }
.btn:disabled { opacity: .6; cursor: progress; transform: none; }
.btn.ghost { background: var(--surface); color: var(--text); border: 1px solid var(--border); box-shadow: none; padding: 9px 14px; font-weight: 500; font-size: 14px; text-decoration: none; }
.examples { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 16px; }
.chip-btn {
  border: 1px solid var(--border); background: color-mix(in srgb, var(--surface) 70%, transparent); backdrop-filter: blur(8px);
  border-radius: 999px; padding: 6px 12px; font-size: 13px; color: var(--muted); cursor: pointer; transition: color .15s, border-color .15s;
}
.chip-btn:hover { color: var(--text); border-color: var(--accent); }

/* ---------- progress ---------- */
.progress { max-width: 820px; margin: 20px auto 0; display: none; }
.progress.on { display: block; }
.progress-track { height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; border: 1px solid var(--border); }
.progress-bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .35s ease; border-radius: 999px; }
.progress-bar.indeterminate { width: 35%; animation: slide 1.1s ease-in-out infinite; }
@keyframes slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(300%); } }
.progress-label { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin-top: 8px; }

/* ---------- alerts ---------- */
.alert { max-width: 820px; margin: 20px auto 0; border-radius: 14px; padding: 12px 16px; font-size: 14px; border: 1px solid; }
.alert.err { background: var(--err-bg); border-color: var(--err-border); color: var(--err-text); }
.alert.warn { background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn-text); max-width: none; margin: 0 0 20px; }
.alert ul { margin: 6px 0 0; padding-left: 18px; }

/* ---------- tags / stats ---------- */
#result { padding: 12px 0 80px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.tag { font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.tag.accent { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 25%, transparent); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-top: 20px; }
.stat { background: var(--surface-2); border-radius: 14px; padding: 14px 16px; border: 1px solid var(--border); }
.stat b { display: block; font-size: 22px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat span { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }

/* ---------- toolbar ---------- */
.toolbar {
  position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 12px 0; margin-bottom: 12px;
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(12px);
}
.field {
  display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 0 12px; height: 40px;
}
.field input, .field select { border: 0; outline: 0; background: transparent; font-size: 14px; height: 100%; }
.field.grow { flex: 1; min-width: 200px; }
.field.grow input { flex: 1; min-width: 0; }
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 3px; }
.seg button { border: 0; background: transparent; padding: 6px 10px; border-radius: 9px; cursor: pointer; color: var(--muted); display: grid; place-items: center; }
.seg button.on { background: var(--surface-2); color: var(--text); }
.count { font-size: 13px; color: var(--muted); margin-left: auto; white-space: nowrap; }

/* ---------- items ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 18px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
  display: flex; flex-direction: column; transition: transform .2s ease, box-shadow .2s ease; animation: rise .35s ease both;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.media { position: relative; aspect-ratio: 16 / 10; background: var(--surface-2); overflow: hidden; }
.media img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .4s ease; }
.card:hover .media img { transform: scale(1.04); }
.media .noimg { position: absolute; inset: 0; display: grid; place-items: center; color: var(--faint); font-size: 13px; }
.credit {
  position: absolute; right: 8px; bottom: 8px; font-size: 11px; color: #fff; background: rgba(0,0,0,.5); padding: 2px 8px; border-radius: 999px;
  max-width: 70%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; backdrop-filter: blur(6px);
}
.body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 12px; flex: 1; }
.title { font-weight: 700; font-size: 17px; line-height: 1.3; letter-spacing: -.01em; margin: 0; }
.title a { text-decoration: none; }
.title a:hover { color: var(--accent); }
.card-foot { margin-top: auto; display: flex; justify-content: space-between; align-items: center; }

.empty { text-align: center; color: var(--muted); padding: 60px 0; }

/* skeleton */
.skel .media, .skel .line { background: linear-gradient(90deg, var(--surface-2), var(--border), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
.skel .line { height: 12px; border-radius: 6px; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

@media (max-width: 640px) {
  .search { flex-wrap: wrap; border-radius: 18px; }
  .search .seg { flex: 1 1 100%; justify-content: center; }
  .search select, .search .btn { flex: 1; justify-content: center; }
  .count { width: 100%; margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* =====================================================================
   navigation, drawer
   ===================================================================== */

.nav { display: flex; gap: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 4px; }
.nav a {
  text-decoration: none; padding: 7px 14px; border-radius: 10px; font-size: 14px; font-weight: 500; color: var(--muted);
  display: inline-flex; align-items: center; gap: 6px; transition: color .15s, background .15s;
}
.nav a:hover { color: var(--text); }
.nav a.on { background: var(--surface-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--border); }
.topbar-right { display: flex; gap: 10px; align-items: center; }

/* stat tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 18px 20px; box-shadow: var(--shadow); }
.tile b { display: block; font-size: 28px; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.tile span { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }

/* drawer */
.scrim { position: fixed; inset: 0; background: rgba(5, 7, 15, .45); backdrop-filter: blur(2px); opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 40; }
.scrim.on { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; height: 100%; width: min(560px, 100%); background: var(--bg); border-left: 1px solid var(--border);
  transform: translateX(100%); transition: transform .25s ease, visibility .25s; z-index: 50; overflow-y: auto; visibility: hidden;
}
.drawer.on { transform: none; visibility: visible; box-shadow: -20px 0 60px rgba(0,0,0,.2); }
.drawer-hero { position: relative; aspect-ratio: 16 / 9; background: var(--surface-2); }
.drawer-hero img { width: 100%; height: 100%; object-fit: cover; display: block; }
.drawer-close { position: absolute; top: 12px; right: 12px; z-index: 2; background: rgba(10,12,24,.6); color: #fff; border: 1px solid rgba(255,255,255,.2); }
.drawer-body { padding: 20px 22px 40px; display: flex; flex-direction: column; gap: 18px; }
.drawer h2 { margin: 0; font-size: 24px; letter-spacing: -.02em; line-height: 1.2; }
.drawer h4 { margin: 0 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--border); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.muted { color: var(--muted); font-size: 14px; }

@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; gap: 10px; }
  .nav { order: 3; width: 100%; overflow-x: auto; }
  .nav a { padding: 7px 10px; white-space: nowrap; }
}

/* =====================================================================
   Goal news viewer
   ===================================================================== */

/* query bar: date · edition · go */
.search .seg { flex: none; }
.search .seg button { padding: 9px 14px; font-size: 14px; font-weight: 500; }
.search input[type="date"] {
  flex: none; border: 1px solid var(--border); background: var(--surface-2); border-radius: 12px; padding: 9px 10px; font-size: 14px; color-scheme: inherit;
}
.search .spacer { flex: 1; }
.kinds { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 16px; }
.kind-chip {
  border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 6px 12px; font-size: 13px; color: var(--muted);
  cursor: pointer; display: inline-flex; align-items: center; gap: 6px; transition: color .15s, border-color .15s, background .15s;
}
.kind-chip:hover { color: var(--text); }
.kind-chip[aria-pressed="true"] {
  color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); background: color-mix(in srgb, var(--accent) 10%, var(--surface));
}
.kind-chip small { color: var(--faint); font-weight: 400; }
.hint { font-size: 12px; color: var(--faint); margin-top: 10px; }

/* summary */
.summary { display: flex; flex-direction: column; gap: 14px; margin-bottom: 18px; }
.summary .tiles { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.tile small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.actions .muted { font-size: 13px; }

/* kind badge colours (identity only; the label always carries the meaning) */
.badge {
  font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 3px 8px; border-radius: 6px;
  color: #fff; background: rgba(10, 12, 24, .68); backdrop-filter: blur(6px);
}
.media .badge { position: absolute; top: 10px; left: 10px; }
.badge.k-news { background: #2563eb; }
.badge.k-lists { background: #7c3aed; }
.badge.k-originals { background: #0f766e; }
.badge.k-betting { background: #b45309; }
.badge.k-where-to-watch { background: #be185d; }
.badge.k-tickets-travel { background: #475569; }

.card { cursor: pointer; text-align: left; }
.card:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.card .meta { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; }
.card .teaser { font-size: 14px; color: var(--muted); margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .tags { margin: 0; }
.card .tag { font-size: 11px; padding: 2px 8px; }
.got { font-size: 12px; font-weight: 600; color: var(--up); white-space: nowrap; }
.got.fail { color: var(--down); }

/* reader (drawer) */
.drawer { width: min(720px, 100%); }
.reader-tabs { display: inline-flex; }
.byline-row { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--muted); }
.byline-row a { color: var(--accent); text-decoration: none; }
.lead { font-size: 17px; color: var(--muted); margin: 0; line-height: 1.55; }
.article { font-size: 16.5px; line-height: 1.75; }
.article p { margin: 0 0 1em; }
.article h2, .article h3, .article h4 { line-height: 1.3; letter-spacing: -.01em; margin: 1.4em 0 .5em; }
.article h2 { font-size: 21px; }
.article h3 { font-size: 18px; }
.article a { color: var(--accent); }
.article img { max-width: 100%; height: auto; border-radius: 12px; display: block; margin: 8px 0; }
.article blockquote { margin: 1em 0; padding: 4px 0 4px 16px; border-left: 3px solid var(--accent); color: var(--muted); }
.article ul, .article ol { padding-left: 22px; }
.article table { border-collapse: collapse; width: 100%; font-size: 14px; }
.article td, .article th { border: 1px solid var(--border); padding: 6px 8px; text-align: left; }
.slide-head { display: flex; gap: 10px; align-items: baseline; }
.slide-head b { color: var(--accent); font-variant-numeric: tabular-nums; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 13px; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
pre.json {
  margin: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 14px; font-size: 12px; line-height: 1.5;
  overflow: auto; max-height: 70vh; white-space: pre-wrap; overflow-wrap: anywhere; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

@media (max-width: 640px) {
  .search input[type="date"], .search select, .search .btn { flex: 1 1 auto; }
  .search .spacer { display: none; }
  .drawer-body { padding: 18px 16px 40px; }
}
