*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:      #0d1117;
  --sf:      #161b22;
  --sf2:     #21262d;
  --bd:      #30363d;
  --accent:  #7c3aed;
  --green:   #059669;
  --blue:    #2563eb;
  --red:     #dc2626;
  --yellow:  #d97706;
  --cyan:    #0891b2;
  --text:    #e6edf3;
  --muted:   #8b949e;
  --r:       8px;
}

body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; font-size: 14px; line-height: 1.5; }

/* ── Header ── */
.app-header {
  background: var(--sf); border-bottom: 1px solid var(--bd);
  padding: 10px 20px; display: flex; align-items: center; gap: 14px;
  flex-wrap: wrap; position: sticky; top: 0; z-index: 100;
}
.logo { font-size: 17px; font-weight: 700; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.logo-icon { width: 28px; height: 28px; background: var(--accent); border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 15px; }
.cfg { display: flex; align-items: center; gap: 8px; flex: 1; flex-wrap: wrap; }
#urlInput { width: 340px; }

/* ── Inputs ── */
input[type="text"], select {
  background: var(--sf2); border: 1px solid var(--bd); color: var(--text);
  border-radius: var(--r); padding: 6px 11px; font-size: 13px; outline: none;
  transition: border-color .15s;
}
input[type="text"]:focus, select:focus { border-color: var(--accent); }

/* ── Buttons ── */
.btn { padding: 6px 14px; border-radius: var(--r); border: none; cursor: pointer; font-size: 13px; font-weight: 500; transition: opacity .15s; display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn:hover:not(:disabled) { opacity: .84; }
.btn-primary   { background: var(--accent); color: #fff; }
.btn-secondary { background: var(--sf2); color: var(--text); border: 1px solid var(--bd); }
.btn-green     { background: var(--green); color: #fff; }
.btn-sm        { padding: 4px 10px; font-size: 12px; }

/* ── Nav ── */
.nav { background: var(--sf); border-bottom: 1px solid var(--bd); padding: 0 20px; display: flex; gap: 2px; overflow-x: auto; }
.nav-tab { padding: 11px 16px; font-size: 13px; font-weight: 500; color: var(--muted); border: none; background: none; cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; transition: color .15s, border-color .15s; }
.nav-tab:hover { color: var(--text); }
.nav-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ── Layout ── */
.content { padding: 20px; max-width: 1440px; margin: 0 auto; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Cards ── */
.card { background: var(--sf); border: 1px solid var(--bd); border-radius: var(--r); padding: 18px; }
.kpi-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 6px; }
.kpi-value { font-size: 26px; font-weight: 700; line-height: 1.2; }
.kpi-sub   { font-size: 11px; color: var(--muted); margin-top: 3px; }
.top-green  { border-top: 3px solid var(--green); }
.top-blue   { border-top: 3px solid var(--blue); }
.top-accent { border-top: 3px solid var(--accent); }
.top-yellow { border-top: 3px solid var(--yellow); }
.top-red    { border-top: 3px solid var(--red); }
.top-cyan   { border-top: 3px solid var(--cyan); }

/* ── Grids ── */
.g4 { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.g2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.g3 { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
@media (max-width: 800px) { .g2 { grid-template-columns: 1fr; } .g4 { grid-template-columns: 1fr 1fr; } }

/* ── Section ── */
.sec-title { font-size: 15px; font-weight: 600; margin-bottom: 14px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sec-gap   { margin-top: 26px; }

/* ── Tables ── */
.tbl-wrap { overflow-x: auto; border-radius: var(--r); border: 1px solid var(--bd); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th { background: var(--sf2); padding: 9px 13px; text-align: left; font-weight: 600; color: var(--muted); white-space: nowrap; border-bottom: 1px solid var(--bd); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
tbody td { padding: 9px 13px; border-bottom: 1px solid var(--bd); }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--sf2); cursor: default; }

/* ── Badges ── */
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.bg    { background: rgba(5,150,105,.2);   color: #34d399; }
.bb    { background: rgba(37,99,235,.2);   color: #60a5fa; }
.br    { background: rgba(220,38,38,.2);   color: #f87171; }
.by    { background: rgba(217,119,6,.2);   color: #fbbf24; }
.bgr   { background: rgba(107,114,128,.2); color: #9ca3af; }
.bc    { background: rgba(8,145,178,.2);   color: #22d3ee; }

/* ── Chart box ── */
.chart-box { background: var(--sf); border: 1px solid var(--bd); border-radius: var(--r); padding: 18px; }
.chart-box canvas { max-height: 270px; }
.chart-title { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 12px; }

/* ── States ── */
.state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 48px 24px; color: var(--muted); gap: 8px; font-size: 13px; }
.state-icon { font-size: 30px; }
.spinner { width: 18px; height: 18px; border: 2px solid var(--bd); border-top-color: var(--accent); border-radius: 50%; animation: spin .6s linear infinite; display: inline-block; flex-shrink: 0; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Alert ── */
.alert { padding: 11px 15px; border-radius: var(--r); margin-bottom: 14px; font-size: 13px; display: flex; align-items: flex-start; gap: 8px; }
.alert-err  { background: rgba(220,38,38,.12);  border: 1px solid rgba(220,38,38,.35);  color: #f87171; }
.alert-info { background: rgba(37,99,235,.12);  border: 1px solid rgba(37,99,235,.35);  color: #60a5fa; }

/* ── UUID fetch row ── */
.fetch-row { display: flex; gap: 8px; align-items: center; margin-bottom: 18px; flex-wrap: wrap; }
.fetch-row label { font-size: 12px; color: var(--muted); white-space: nowrap; }
.fetch-row input { flex: 1; min-width: 260px; }

/* ── Pagination ── */
.pager { display: none; align-items: center; gap: 8px; margin-top: 12px; justify-content: flex-end; }
.pager-info { font-size: 12px; color: var(--muted); }

/* ── Game card ── */
.game-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; font-size: 12px; margin-top: 12px; }
.gd-label { color: var(--muted); font-size: 11px; }
.game-header { display: flex; justify-content: space-between; align-items: flex-start; }

/* ── Toast ── */
#toast {
  position: fixed; bottom: 22px; right: 22px;
  background: var(--sf2); border: 1px solid var(--bd); border-radius: var(--r);
  padding: 11px 18px; font-size: 13px; z-index: 9999;
  transform: translateY(80px); opacity: 0; transition: all .28s;
  max-width: 300px; border-left: 4px solid var(--accent);
}
#toast.show { transform: translateY(0); opacity: 1; }

/* ── Modal ── */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.75);
  display: flex; align-items: center; justify-content: center;
  z-index: 10000;
}
.modal {
  background: var(--sf); border: 1px solid var(--bd); border-radius: 12px;
  padding: 36px 32px; width: 100%; max-width: 360px;
  display: flex; flex-direction: column; gap: 12px;
}
.modal-icon  { font-size: 36px; text-align: center; }
.modal-title { font-size: 18px; font-weight: 700; text-align: center; }
.modal-sub   { font-size: 13px; color: var(--muted); text-align: center; }
.modal-input {
  width: 100%; background: var(--sf2); border: 1px solid var(--bd);
  color: var(--text); border-radius: var(--r); padding: 9px 13px;
  font-size: 14px; outline: none; display: block;
}
.modal-input:focus { border-color: var(--accent); }
.modal-err { font-size: 12px; color: #f87171; min-height: 18px; }

/* ── Utility ── */
.mono { font-family: 'SF Mono', ui-monospace, monospace; font-size: 11px; }
.dim  { color: var(--muted); }
.mt14 { margin-top: 14px; }
.mb16 { margin-bottom: 16px; }
