/* MKOSZ Live Analytics — design system */
:root {
  --bg:        #0b0d12;
  --bg-elev:   #131722;
  --bg-card:   #1a1f2c;
  --bg-hover:  #232938;
  --line:      #2a3142;
  --line-soft: #1f2533;
  --txt:       #e8ecf2;
  --txt-mut:   #8a93a5;
  --txt-dim:   #5e6677;
  --accent:    #b15cd8;
  --accent-dk: #7a00a6;
  --accent-bg: #2a0d3a;
  --home:      #b15cd8;
  --away:      #4ea8ff;
  --good:      #2dc56e;
  --bad:       #ef5350;
  --warn:      #f0b323;
  --shadow:    0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.25);
  --radius:    12px;
  --radius-sm: 8px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--txt);
  font-family: 'Inter', -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'cv11', 'ss01', 'tnum';
}

/* ---------- Fejléc ---------- */
.topbar {
  background: linear-gradient(180deg, rgba(122,0,166,.18) 0%, transparent 100%), var(--bg-elev);
  border-bottom: 1px solid var(--line);
  padding: 14px 24px;
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(8px);
}
.brand {
  font-weight: 800; font-size: 16px; letter-spacing: .3px;
  display: flex; align-items: center; gap: 10px; color: var(--txt);
  text-decoration: none;
}
.brand .dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-dk));
  box-shadow: 0 0 12px var(--accent);
}
.topbar nav { display: flex; gap: 4px; }
.topbar nav a {
  color: var(--txt-mut); text-decoration: none; padding: 6px 12px;
  border-radius: var(--radius-sm); font-size: 13px; font-weight: 500;
}
.topbar nav a:hover { background: var(--bg-hover); color: var(--txt); }
.topbar nav a.active { background: var(--accent-bg); color: var(--accent); }
.topbar .spacer { flex: 1; }
.topbar .controls { display: flex; gap: 10px; align-items: center; font-size: 13px; }
.topbar input.code {
  background: var(--bg-card); color: var(--txt);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 7px 12px; font-size: 13px; min-width: 220px;
  font-family: 'JetBrains Mono', ui-monospace, Menlo, monospace;
}
.topbar input.code:focus { outline: none; border-color: var(--accent); }
.btn {
  background: var(--bg-card); color: var(--txt);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 7px 14px; font-size: 13px; cursor: pointer; font-weight: 500;
  transition: all .15s;
}
.btn:hover { background: var(--bg-hover); border-color: var(--accent); }
.btn.primary { background: var(--accent-dk); border-color: var(--accent); color: white; }
.btn.primary:hover { background: var(--accent); }
.status-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 20px; font-size: 11px;
  font-weight: 700; letter-spacing: .5px; text-transform: uppercase;
}
.status-badge.live { background: rgba(239,83,80,.15); color: var(--bad); }
.status-badge.live::before {
  content: ''; width: 7px; height: 7px; border-radius: 50%;
  background: var(--bad); animation: pulse 1.2s infinite;
}
.status-badge.done { background: rgba(45,197,110,.12); color: var(--good); }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.35} }
.freshness {
  font-size: 11px; color: var(--txt-mut); padding: 3px 8px;
  border-radius: 10px; background: var(--bg-card); border: 1px solid var(--line);
  font-variant-numeric: tabular-nums; transition: all .3s;
}
.freshness.warn { color: var(--warn); border-color: var(--warn); background: rgba(240,179,35,.08); }
.freshness.stale { color: var(--bad); border-color: var(--bad); background: rgba(239,83,80,.08); }

/* ---------- Layout ---------- */
.container { max-width: 1320px; margin: 0 auto; padding: 24px; }
.grid { display: grid; gap: 18px; }
.cols-2 { grid-template-columns: 1fr 1fr; }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 980px) {
  .cols-2, .cols-3 { grid-template-columns: 1fr; }
  .container { padding: 16px; }
}

/* ---------- Kártyák ---------- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
}
.card h2 {
  font-size: 11px; margin: 0 0 14px;
  color: var(--txt-mut); text-transform: uppercase;
  letter-spacing: 1.2px; font-weight: 700;
}
.card h2 .sub { color: var(--txt-dim); font-weight: 400; text-transform: none; letter-spacing: 0; margin-left: 8px; }

/* ---------- Eredménykijelző ---------- */
.scoreboard {
  display: grid; grid-template-columns: 1fr auto 1fr;
  align-items: center; gap: 24px;
  padding: 30px 24px;
  background: linear-gradient(180deg, var(--bg-elev) 0%, var(--bg-card) 100%);
  border: 1px solid var(--line); border-radius: var(--radius);
  margin-bottom: 18px;
}
.scoreboard .tname {
  font-size: 19px; font-weight: 600; line-height: 1.2;
}
.scoreboard .tname.home { text-align: right; }
.scoreboard .tname.home::before {
  content: ''; display: inline-block; width: 4px; height: 18px;
  background: var(--home); margin-right: 10px; vertical-align: -3px; border-radius: 2px;
}
.scoreboard .tname.away::after {
  content: ''; display: inline-block; width: 4px; height: 18px;
  background: var(--away); margin-left: 10px; vertical-align: -3px; border-radius: 2px;
}
.scoreboard .scores {
  display: flex; gap: 14px; align-items: baseline;
  font-family: 'Inter', sans-serif; font-weight: 800;
  font-variant-numeric: tabular-nums; font-size: 56px;
  line-height: 1;
}
.scoreboard .scores .sep { color: var(--txt-dim); font-size: 36px; font-weight: 300; }
.scoreboard .scores .h { color: var(--home); }
.scoreboard .scores .a { color: var(--away); }
.meta-row {
  text-align: center; color: var(--txt-mut); font-size: 12px;
  margin-top: 12px; display: flex; gap: 14px; justify-content: center; flex-wrap: wrap;
}
.meta-row span { display: inline-flex; align-items: center; gap: 5px; }
.meta-row .sep-dot { color: var(--txt-dim); }

/* ---------- Csapat-összehasonlítás (bar chart) ---------- */
.cmp { display: grid; grid-template-columns: 1fr 90px 1fr; gap: 8px 14px; align-items: center; }
.cmp .lbl {
  text-align: center; color: var(--txt-mut);
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px;
}
.bar { height: 28px; background: var(--bg-elev); border-radius: 6px; position: relative; overflow: hidden; }
.bar > span {
  position: absolute; top: 0; bottom: 0; display: flex; align-items: center;
  padding: 0 10px; font-size: 13px; font-weight: 700;
  font-variant-numeric: tabular-nums;
  transition: width .5s ease;
}
.bar.l > span { right: 0; background: linear-gradient(90deg, transparent 0%, var(--home) 100%); justify-content: flex-end; color: white; }
.bar.r > span { left: 0; background: linear-gradient(270deg, transparent 0%, var(--away) 100%); color: white; }
.bar.l.winner > span { box-shadow: inset 0 0 0 2px rgba(255,255,255,.3); }
.bar.r.winner > span { box-shadow: inset 0 0 0 2px rgba(255,255,255,.3); }

/* ---------- Trend chart ---------- */
.trend-wrap { position: relative; }
canvas.trend { width: 100%; height: 240px; display: block; }
.trend-note {
  font-size: 12px; color: var(--txt-mut); margin-top: 8px; text-align: center;
}

/* ---------- Tabok / Tab gombok ---------- */
.tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.tab {
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 7px 14px; font-size: 13px; cursor: pointer; font-weight: 500; color: var(--txt-mut);
  transition: all .15s;
}
.tab:hover { color: var(--txt); border-color: var(--accent); }
.tab.on { background: var(--accent-bg); color: var(--accent); border-color: var(--accent); }

/* ---------- Táblázatok ---------- */
table {
  width: 100%; border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}
thead { background: var(--bg-elev); }
th, td {
  padding: 9px 8px; text-align: right; border-bottom: 1px solid var(--line-soft);
  white-space: nowrap;
}
th:first-child, td:first-child { text-align: left; padding-left: 14px; }
th:last-child, td:last-child { padding-right: 14px; }
th {
  color: var(--txt-mut); font-weight: 600; font-size: 11px;
  text-transform: uppercase; letter-spacing: .5px; cursor: pointer; user-select: none;
  position: sticky; top: 0; background: var(--bg-elev); z-index: 1;
}
th:hover { color: var(--txt); }
th.sorted { color: var(--accent); }
th.sorted::after {
  content: '▾'; margin-left: 4px; display: inline-block; font-size: 9px;
}
th.sorted.asc::after { content: '▴'; }
tbody tr { transition: background .12s; cursor: pointer; }
tbody tr:hover { background: var(--bg-hover); }
tbody tr.selected { background: var(--accent-bg); }
.pname { font-weight: 600; }
.pnum { color: var(--txt-mut); font-size: 11px; margin-right: 6px; }
.scroll { max-height: 540px; overflow: auto; border-radius: var(--radius-sm); border: 1px solid var(--line-soft); }
.scroll::-webkit-scrollbar { width: 10px; height: 10px; }
.scroll::-webkit-scrollbar-thumb { background: var(--line); border-radius: 5px; }
.scroll::-webkit-scrollbar-thumb:hover { background: var(--txt-dim); }

.pos { color: var(--good); font-weight: 600; }
.neg { color: var(--bad); font-weight: 600; }
.zero { color: var(--txt-dim); }
.heat { font-weight: 600; }
.tag { font-size: 11px; color: var(--txt-mut); font-weight: normal; text-transform: none; letter-spacing: 0; }
.foot { text-align: center; color: var(--txt-dim); font-size: 12px; margin-top: 24px; padding: 12px; }

/* ---------- Modal (játékos drilldown) ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.65); z-index: 100;
  display: none; align-items: center; justify-content: center;
  backdrop-filter: blur(4px); padding: 20px;
}
.modal-backdrop.show { display: flex; }
.modal {
  background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--radius);
  width: 100%; max-width: 720px; max-height: 90vh; overflow: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.6);
  animation: slideUp .25s ease;
}
@keyframes slideUp { from{opacity:0;transform:translateY(20px)} to{opacity:1;transform:translateY(0)} }
.modal header {
  padding: 18px 24px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 14px;
  background: linear-gradient(180deg, var(--accent-bg) 0%, transparent 100%);
}
.modal header .num {
  background: var(--accent-dk); color: white; width: 42px; height: 42px;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 18px;
}
.modal header .pn { flex: 1; }
.modal header .pn .nm { font-size: 18px; font-weight: 700; }
.modal header .pn .tm { font-size: 12px; color: var(--txt-mut); }
.modal header .close {
  background: none; border: none; color: var(--txt-mut); font-size: 22px;
  cursor: pointer; padding: 4px 10px; border-radius: 6px;
}
.modal header .close:hover { background: var(--bg-hover); color: var(--txt); }
.modal .body { padding: 18px 24px; }
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; margin-bottom: 18px; }
.kpi {
  background: var(--bg-elev); border-radius: var(--radius-sm); padding: 10px 12px;
  border: 1px solid var(--line-soft);
}
.kpi .lbl { font-size: 10px; color: var(--txt-mut); text-transform: uppercase; letter-spacing: .5px; }
.kpi .val { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 2px; }
.kpi .sub { font-size: 11px; color: var(--txt-dim); margin-top: 2px; }
.kpi.good .val { color: var(--good); }
.kpi.bad  .val { color: var(--bad); }
.section-head {
  font-size: 11px; color: var(--txt-mut); text-transform: uppercase;
  letter-spacing: 1px; font-weight: 700; margin: 14px 0 8px;
}
.shotchart { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.shotbar {
  background: var(--bg-elev); border-radius: var(--radius-sm); padding: 10px;
  border: 1px solid var(--line-soft);
}
.shotbar .nm { font-size: 11px; color: var(--txt-mut); }
.shotbar .stat { font-size: 16px; font-weight: 700; margin: 4px 0; }
.shotbar .bar2 { height: 6px; background: var(--bg-card); border-radius: 3px; overflow: hidden; }
.shotbar .bar2 > span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-dk)); }

/* ---------- Combo eszköz ---------- */
.combo-wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 800px) { .combo-wrap { grid-template-columns: 1fr; } }
.combo-list {
  background: var(--bg-elev); border-radius: var(--radius-sm); padding: 4px;
  max-height: 360px; overflow: auto; border: 1px solid var(--line-soft);
}
.combo-list label {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px;
  border-radius: 5px; cursor: pointer; font-size: 13px;
}
.combo-list label:hover { background: var(--bg-hover); }
.combo-list label.checked { background: var(--accent-bg); }
.combo-list label input { accent-color: var(--accent); }
.combo-list label .nm { flex: 1; }
.combo-list label .minS { font-size: 11px; color: var(--txt-mut); font-variant-numeric: tabular-nums; }
.combo-result {
  background: var(--bg-elev); border-radius: var(--radius-sm); padding: 16px;
  border: 1px solid var(--line-soft);
}
.combo-result .empty { color: var(--txt-mut); text-align: center; padding: 40px 0; font-size: 13px; }
.combo-result h3 { margin: 0 0 12px; font-size: 13px; color: var(--accent); }

/* ---------- Magyarázó oldal ---------- */
.docs { max-width: 900px; margin: 0 auto; padding: 20px 0; }
.docs h1 { font-size: 28px; margin: 0 0 8px; font-weight: 800; }
.docs .lead { color: var(--txt-mut); font-size: 15px; margin-bottom: 30px; }
.docs h2 {
  font-size: 18px; margin: 32px 0 10px; padding-bottom: 8px;
  border-bottom: 1px solid var(--line); color: var(--accent);
}
.docs h3 { font-size: 14px; margin: 18px 0 6px; color: var(--txt); font-weight: 700; }
.docs p { color: var(--txt); margin: 8px 0; }
.docs .formula {
  background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 12px 16px; font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 13px; color: var(--accent); margin: 10px 0; overflow-x: auto;
}
.docs .note {
  background: rgba(240,179,35,.08); border-left: 3px solid var(--warn);
  padding: 10px 14px; border-radius: 4px; margin: 10px 0; font-size: 13px;
}
.docs .note strong { color: var(--warn); }
.docs ul { padding-left: 22px; }
.docs li { margin: 4px 0; }
.docs table.glossary { margin: 12px 0; }
.docs table.glossary td:first-child { color: var(--accent); font-family: monospace; font-weight: 600; }

/* ---------- Üres állapot ---------- */
.empty-state {
  text-align: center; padding: 80px 20px; color: var(--txt-mut);
}
.empty-state h2 { color: var(--txt); font-size: 20px; margin-bottom: 8px; }
.empty-state p { font-size: 14px; max-width: 480px; margin: 0 auto 16px; }
.empty-state .examples { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.empty-state code {
  background: var(--bg-card); border: 1px solid var(--line); border-radius: 5px;
  padding: 4px 10px; font-size: 12px; cursor: pointer; color: var(--accent);
}
.empty-state code:hover { background: var(--accent-bg); }
.error-banner {
  background: rgba(239,83,80,.1); border: 1px solid var(--bad); border-radius: var(--radius-sm);
  padding: 12px 16px; color: var(--bad); margin: 16px 0; font-size: 13px;
}
