/* ============================================================
   AI Sport - autorski design system "Stadion Nocą"
   Dark mode glowny + dopracowany light mode. Zero bibliotek.
   ============================================================ */

:root {
  --bg: #070c15;
  --bg-grad: radial-gradient(1200px 600px at 80% -10%, rgba(47, 230, 168, 0.07), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(109, 139, 255, 0.08), transparent 55%);
  --surface: #0d1524;
  --surface-2: #121d31;
  --surface-3: #182541;
  --line: rgba(148, 170, 200, 0.14);
  --text: #eef4fb;
  --muted: #93a5bc;
  --accent: #2fe6a8;
  --accent-ink: #062d20;
  --accent-soft: rgba(47, 230, 168, 0.12);
  --accent-2: #6d8bff;
  --accent-2-soft: rgba(109, 139, 255, 0.14);
  --warn: #f2b64c;
  --warn-soft: rgba(242, 182, 76, 0.14);
  --danger: #ff6b6e;
  --danger-soft: rgba(255, 107, 110, 0.14);
  --gold: #e8c76e;
  --shadow: 0 18px 48px rgba(2, 8, 20, 0.55);
  --radius: 16px;
  --radius-sm: 10px;
  --nav-h: 62px;
  color-scheme: dark;
}

[data-theme="light"] {
  --bg: #f2f5fa;
  --bg-grad: radial-gradient(1200px 600px at 80% -10%, rgba(21, 178, 124, 0.08), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(84, 108, 224, 0.08), transparent 55%);
  --surface: #ffffff;
  --surface-2: #f4f7fb;
  --surface-3: #e9eef6;
  --line: rgba(30, 50, 80, 0.12);
  --text: #101a2c;
  --muted: #5a6b84;
  --accent: #0eaf7d;
  --accent-ink: #ffffff;
  --accent-soft: rgba(14, 175, 125, 0.12);
  --accent-2: #4c66d9;
  --accent-2-soft: rgba(76, 102, 217, 0.12);
  --warn: #b97d17;
  --warn-soft: rgba(185, 125, 23, 0.12);
  --danger: #d5484c;
  --danger-soft: rgba(213, 72, 76, 0.1);
  --gold: #a8842a;
  --shadow: 0 14px 36px rgba(20, 35, 60, 0.14);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  background-image: var(--bg-grad);
  background-attachment: fixed;
  color: var(--text);
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  min-height: 100vh;
}
button { font: inherit; cursor: pointer; }
input, select { font: inherit; }
a { color: var(--accent); text-decoration: none; }
::selection { background: var(--accent); color: var(--accent-ink); }

button, [role="button"], summary { min-width: 44px; min-height: 44px; }
.field input, select { min-height: 44px; }
.searchbox { min-height: 44px; padding-block: 0; }
.searchbox input { min-height: 44px; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible, [role="button"]:focus-visible, summary:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.icon { display: inline-flex; align-items: center; }
.icon svg { display: block; }

/* ---------- Layout ---------- */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 8px;
  padding: 22px 14px;
  border-right: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  backdrop-filter: blur(14px);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; }
.brand-badge {
  width: 38px; height: 38px; border-radius: 12px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #06121f; font-weight: 800; font-size: 15px;
  box-shadow: 0 6px 18px rgba(47, 230, 168, 0.35);
}
.brand-name { font-weight: 750; font-size: 17px; letter-spacing: 0.2px; }
.brand-sub { font-size: 11px; color: var(--muted); margin-top: -2px; }

.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: 12px;
  color: var(--muted); background: none; border: none; width: 100%;
  text-align: left; font-weight: 550; transition: background 0.18s, color 0.18s, transform 0.12s;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); }
.nav-item:active { transform: scale(0.98); }
.sidebar-footer { margin-top: auto; font-size: 11.5px; color: var(--muted); padding: 0 10px; }

.main { min-width: 0; padding: 26px clamp(16px, 4vw, 44px) 96px; }
.topbar { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; flex-wrap: wrap; }
.topbar-title { font-size: clamp(20px, 3vw, 27px); font-weight: 760; letter-spacing: -0.3px; margin-right: auto; }
.top-chip {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12.5px; color: var(--muted);
  background: var(--surface-2); border: 1px solid var(--line);
  padding: 6px 12px; border-radius: 999px;
}

.bottomnav { display: none; }

/* ---------- Karty i sekcje ---------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
}
.legal-contact-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  max-width: 100%;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--accent-soft);
  overflow-wrap: anywhere;
  text-align: center;
  touch-action: manipulation;
  vertical-align: middle;
}
.legal-contact-link:hover { background: color-mix(in srgb, var(--accent) 18%, transparent); }
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: 1.1px; color: var(--muted); margin: 26px 0 12px; font-weight: 700; }

.chip-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.chip {
  border: 1px solid var(--line); background: var(--surface);
  color: var(--muted); border-radius: 999px; padding: 8px 14px;
  font-size: 13px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 7px;
  transition: all 0.16s;
}
.chip:hover { color: var(--text); border-color: var(--accent); }
.chip.active { background: var(--accent); color: var(--accent-ink); border-color: transparent; box-shadow: 0 6px 16px rgba(47, 230, 168, 0.3); }
.chip.locked { opacity: 0.55; }

.searchbox {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; padding: 0 15px; min-height: 44px; margin: 14px 0 6px;
  transition: border-color 0.16s, box-shadow 0.16s;
}
.searchbox:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.searchbox input { flex: 1; background: none; border: none; outline: none; color: var(--text); font-size: 14.5px; }
.searchbox input::placeholder { color: var(--muted); }

/* ---------- Karta wydarzenia ---------- */
.league-group { margin-bottom: 20px; }
.league-head { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; font-weight: 700; margin: 0 4px 9px; text-transform: uppercase; letter-spacing: 0.7px; }
.league-head .tag { color: var(--gold); border: 1px solid color-mix(in srgb, var(--gold) 40%, transparent); border-radius: 6px; padding: 1px 7px; font-size: 10.5px; }

.event-card {
  display: grid; grid-template-columns: 1fr auto; gap: 6px 14px; align-items: center;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 15px 18px; margin-bottom: 10px;
  cursor: pointer; transition: transform 0.16s, border-color 0.16s, box-shadow 0.2s;
  animation: card-in 0.35s ease both;
}
.event-card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); box-shadow: var(--shadow); }
.event-teams { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.team-line { display: flex; align-items: center; gap: 9px; font-weight: 640; font-size: 15.5px; }
.team-line .score { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 750; }
.event-meta { grid-column: 1 / -1; display: flex; gap: 10px; align-items: center; color: var(--muted); font-size: 12.5px; flex-wrap: wrap; }
.event-side { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }

.badge { display: inline-flex; align-items: center; gap: 6px; border-radius: 8px; padding: 3px 9px; font-size: 11.5px; font-weight: 700; }
.badge.live { background: var(--danger-soft); color: var(--danger); }
.badge.today { background: var(--accent-2-soft); color: var(--accent-2); }
.badge.done { background: var(--surface-3); color: var(--muted); }
.badge.gold { background: color-mix(in srgb, var(--gold) 16%, transparent); color: var(--gold); }
.badge.quality { background: var(--surface-3); color: var(--muted); }

.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--danger); animation: pulse 1.6s ease-out infinite; }

/* ---------- Przyciski ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  border-radius: 13px; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--text);
  padding: 11px 18px; font-weight: 650; font-size: 14.5px;
  transition: all 0.16s;
}
.btn:hover { border-color: var(--accent); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn.primary {
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 70%, var(--accent-2)));
  color: var(--accent-ink); border: none;
  box-shadow: 0 10px 26px rgba(47, 230, 168, 0.35);
}
.btn.primary:hover { filter: brightness(1.06); transform: translateY(-1px); }
.btn.big { width: 100%; padding: 15px 20px; font-size: 16px; border-radius: 15px; }
.btn.ghost { background: none; }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); }

/* ---------- Pasek prawdopodobienstw ---------- */
.prob-block { display: flex; flex-direction: column; gap: 10px; }
.prob-row { display: grid; grid-template-columns: minmax(90px, 160px) 1fr 52px; gap: 12px; align-items: center; }
.prob-label { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prob-track { height: 10px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.prob-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent-2), var(--accent)); width: 0; transition: width 0.9s cubic-bezier(0.22, 1, 0.36, 1); }
.prob-fill.top { background: linear-gradient(90deg, var(--accent), #7ef7c9); }
.prob-value { font-variant-numeric: tabular-nums; font-weight: 750; text-align: right; }

.meter { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: 999px; background: var(--accent); transition: width 0.7s ease; }
.meter.warn > span { background: var(--warn); }
.meter.danger > span { background: var(--danger); }

/* ---------- Raport ---------- */
.report-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.stat-tile { background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.stat-tile h4 { margin: 0 0 6px; font-size: 12px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px; }
.stat-tile .value { font-size: 19px; font-weight: 760; }
.verdict-hero {
  display: flex; flex-wrap: wrap; align-items: center; gap: 16px;
  padding: 20px 22px; border-radius: var(--radius);
  background: linear-gradient(135deg, var(--accent-soft), var(--accent-2-soft));
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line));
}
.verdict-hero.abstain { background: var(--surface-2); border-color: var(--line); }
.verdict-label { font-size: 22px; font-weight: 800; letter-spacing: -0.3px; }
.factor-list { margin: 0; padding: 0 0 0 2px; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.factor-list li { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; }
.factor-list .icon { margin-top: 2px; flex: none; }
.factor-list.pos .icon { color: var(--accent); }
.factor-list.neg .icon { color: var(--warn); }
.factor-list.threat .icon { color: var(--danger); }

details.howto { border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; background: var(--surface-2); }
details.howto summary { cursor: pointer; font-weight: 650; color: var(--muted); }
details.howto[open] summary { color: var(--text); margin-bottom: 8px; }

.disclaimer { font-size: 12.5px; color: var(--muted); border-left: 3px solid var(--warn); padding: 8px 12px; background: var(--warn-soft); border-radius: 8px; }

/* ---------- Pipeline / progres analizy ---------- */
.pipeline { display: flex; flex-direction: column; gap: 12px; padding: 8px 2px; }
.pipe-step { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 14px; opacity: 0.5; transition: opacity 0.3s; }
.pipe-step.active { opacity: 1; color: var(--text); }
.pipe-step.done { opacity: 1; color: var(--accent); }
.pipe-dot {
  width: 26px; height: 26px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  border: 2px solid var(--line); background: var(--surface-2);
}
.pipe-step.active .pipe-dot { border-color: var(--accent); animation: spin-ring 1s linear infinite; border-top-color: transparent; }
.pipe-step.done .pipe-dot { border-color: var(--accent); background: var(--accent-soft); }

/* ---------- Skeleton ---------- */
.skeleton { position: relative; overflow: hidden; background: var(--surface-2); border-radius: 12px; min-height: 16px; }
.skeleton::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--text) 7%, transparent), transparent);
  animation: shimmer 1.4s infinite;
}
.skeleton-card { height: 84px; margin-bottom: 10px; }

/* ---------- Modal / paywall ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(3, 8, 18, 0.66); backdrop-filter: blur(6px);
  display: grid; place-items: center; padding: 18px;
  animation: fade-in 0.2s ease;
}
.modal {
  width: min(660px, 100%); max-height: 88vh; overflow: auto;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 20px; padding: 26px; box-shadow: var(--shadow);
  animation: card-in 0.28s ease;
}
.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-top: 16px; }
.plan-card { border: 1px solid var(--line); border-radius: 16px; padding: 18px; background: var(--surface-2); display: flex; flex-direction: column; gap: 8px; position: relative; }
.plan-card.highlight { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.plan-card .price { font-size: 21px; font-weight: 800; }
.plan-card ul { margin: 4px 0 10px; padding-left: 18px; color: var(--muted); font-size: 13px; display: flex; flex-direction: column; gap: 4px; }
.plan-badge { position: absolute; top: -9px; right: 12px; background: var(--gold); color: #241a02; font-size: 10.5px; font-weight: 800; border-radius: 6px; padding: 2px 8px; }

/* ---------- Formularze ---------- */
.form { display: flex; flex-direction: column; gap: 12px; max-width: 420px; }
.field label { display: block; font-size: 12.5px; color: var(--muted); font-weight: 650; margin-bottom: 5px; }
.field input {
  width: 100%; background: var(--surface-2); color: var(--text);
  border: 1px solid var(--line); border-radius: 12px; padding: 11px 14px;
  outline: none; transition: border-color 0.15s, box-shadow 0.15s;
}
.field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.form-hint { font-size: 12.5px; color: var(--muted); }
.form-error { font-size: 13px; color: var(--danger); background: var(--danger-soft); border-radius: 8px; padding: 8px 12px; }
.form-success { font-size: 13px; color: var(--accent); background: var(--accent-soft); border-radius: 8px; padding: 10px 12px; }

/* ---------- Tabele ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.6px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.table td { padding: 9px 10px; border-bottom: 1px solid color-mix(in srgb, var(--line) 55%, transparent); }
.table tr:last-child td { border-bottom: none; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: calc(var(--nav-h) + 18px); left: 50%; transform: translateX(-50%);
  z-index: 90; background: var(--surface); color: var(--text);
  border: 1px solid var(--line); border-radius: 13px; padding: 12px 18px;
  box-shadow: var(--shadow); font-size: 14px; max-width: min(480px, 92vw);
  animation: toast-in 0.25s ease;
}
.toast.error { border-color: color-mix(in srgb, var(--danger) 50%, var(--line)); }
.toast.success { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }

/* ---------- Age gate ---------- */
.age-gate { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: var(--bg); background-image: var(--bg-grad); padding: 20px; }
.age-card { max-width: 460px; text-align: center; }
.age-card .brand-badge { margin: 0 auto 14px; width: 52px; height: 52px; font-size: 20px; }

/* ---------- Empty state ---------- */
.empty { text-align: center; color: var(--muted); padding: 42px 16px; border: 1px dashed var(--line); border-radius: var(--radius); }
.empty .icon { color: var(--muted); margin-bottom: 8px; }

/* ---------- Animacje ---------- */
@keyframes card-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--danger) 55%, transparent); } 100% { box-shadow: 0 0 0 9px transparent; } }
@keyframes spin-ring { to { transform: rotate(360deg); } }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

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

/* ---------- Responsywnosc ---------- */
@media (max-width: 940px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .main { padding: 18px 14px calc(var(--nav-h) + 26px); }
  .bottomnav {
    display: grid; grid-template-columns: repeat(5, 1fr);
    position: fixed; left: 0; right: 0; bottom: 0; height: var(--nav-h); z-index: 50;
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    backdrop-filter: blur(16px); border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .bottomnav button {
    background: none; border: none; color: var(--muted);
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    font-size: 10.5px; font-weight: 650;
  }
  .bottomnav button.active { color: var(--accent); }
  .event-card { padding: 13px 14px; }
}
@media (min-width: 941px) {
  .main { max-width: 1180px; }
}
