:root {
  --bg: #0a0b14;
  --text: #eef1ff;
  --muted: #9aa0c5;
  --accent: #5eead4;
  --accent-2: #818cf8;
  --danger: #fb7185;
  --red: #ff4d5e;
  --red-2: #ff8a3d;
  --ok: #34d399;
  --glass: rgba(255, 255, 255, 0.04);
  --glass-brd: rgba(255, 255, 255, 0.08);
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  --palette-0: #38bdf8;
  --palette-1: #fbbf24;
  --palette-2: #a78bfa;
  --palette-3: #34d399;
  --palette-4: #f472b6;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; }

body {
  font-family: "Inter", system-ui, sans-serif;
  color: var(--text);
  background: radial-gradient(1200px 700px at 50% -10%, #1c1f44 0%, var(--bg) 55%);
  display: flex;
  justify-content: center;
  padding: clamp(18px, 4vw, 48px) 18px;
  position: relative;
  overflow-x: hidden;
}

.bg-glow {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(420px 420px at 18% 12%, rgba(255, 77, 94, 0.10), transparent 70%),
    radial-gradient(460px 460px at 84% 22%, rgba(129, 140, 248, 0.12), transparent 70%);
}

.wrap {
  position: relative; z-index: 1; width: 100%; max-width: 720px;
  display: flex; flex-direction: column; gap: 22px;
}

/* Topbar --------------------------------------------------------------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.brand { display: flex; flex-direction: column; }
.brand .kicker {
  font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--red); font-weight: 600;
}
.brand h1 { font-family: "Space Grotesk", sans-serif; font-size: 20px; font-weight: 600; color: var(--muted); }
.topbar-actions { display: flex; gap: 10px; }

/* Buttons -------------------------------------------------------------- */
.btn {
  font: inherit; font-weight: 600; font-size: 14px; cursor: pointer;
  border-radius: 12px; padding: 10px 16px; border: 1px solid var(--glass-brd);
  background: var(--glass); color: var(--text);
  transition: transform 0.12s ease, background 0.2s ease, opacity 0.2s ease;
}
.btn:hover { background: rgba(255, 255, 255, 0.09); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  color: #0a0b14; border: none;
}
.btn-danger { color: var(--red); border-color: rgba(255, 77, 94, 0.4); }
.btn-ghost { background: transparent; }
.btn-sm { padding: 7px 12px; font-size: 13px; }

/* Glass cards ---------------------------------------------------------- */
.glass {
  background: var(--glass); border: 1px solid var(--glass-brd);
  border-radius: 22px; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}

/* Counter -------------------------------------------------------------- */
.counter-card { padding: clamp(26px, 5vw, 44px); text-align: center; }
.counter-label {
  font-size: 13px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 14px;
}
.counter {
  font-family: "Space Grotesk", sans-serif; font-variant-numeric: tabular-nums;
  font-weight: 700; font-size: clamp(40px, 11vw, 80px); line-height: 1.02; letter-spacing: -0.02em;
  background: linear-gradient(120deg, #ffd0d5 0%, var(--red) 45%, var(--red-2) 100%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  text-shadow: 0 0 50px rgba(255, 77, 94, 0.22);
}
.counter.settled {
  background: linear-gradient(120deg, #d1ffe9 0%, var(--ok) 60%, var(--accent) 100%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}

/* Progress ------------------------------------------------------------- */
.progress { margin-top: 26px; }
.progress-track { height: 12px; border-radius: 999px; background: rgba(255, 255, 255, 0.07); overflow: hidden; }
.progress-fill {
  height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 18px rgba(94, 234, 212, 0.5);
  transition: width 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}
.progress-meta { display: flex; justify-content: space-between; margin-top: 10px; font-size: 13px; color: var(--muted); }
.pct { color: var(--accent); font-weight: 600; }
.totals { margin-top: 18px; font-size: 13px; color: var(--muted); }
.totals strong { color: var(--text); }
.settled-msg { margin-top: 18px; font-size: 18px; font-weight: 600; color: var(--ok); }

/* Games ---------------------------------------------------------------- */
.games { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.game-card { padding: 20px; }
.game-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.game-head h2 { font-size: 15px; font-weight: 600; color: var(--muted); }
.game-dot { width: 11px; height: 11px; border-radius: 50%; background: var(--c, var(--accent)); box-shadow: 0 0 12px var(--c, var(--accent)); }
.game-profit { font-family: "Space Grotesk", sans-serif; font-variant-numeric: tabular-nums; font-size: clamp(20px, 4.5vw, 26px); font-weight: 600; }
.game-sub { margin-top: 8px; font-size: 13px; color: var(--muted); }
.today.pos { color: var(--accent); }
.today.neg { color: var(--danger); }
.badge-off { font-size: 11px; color: var(--danger); border: 1px solid rgba(251, 113, 133, 0.4); border-radius: 999px; padding: 1px 7px; margin-left: auto; }

/* Footer / status ------------------------------------------------------ */
.foot { text-align: center; }
.status { font-size: 12.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 7px; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); }
.status.stale::before, .status.error::before { background: var(--danger); box-shadow: 0 0 10px var(--danger); }

/* Login ---------------------------------------------------------------- */
.login-wrap { min-height: 80vh; display: flex; align-items: center; justify-content: center; }
.login-card { padding: 36px 32px; width: 100%; max-width: 380px; text-align: center; }
.login-card h1 { font-family: "Space Grotesk", sans-serif; font-size: 24px; margin-bottom: 6px; }
.login-card p { color: var(--muted); font-size: 13px; margin-bottom: 22px; }
.field { text-align: left; margin-bottom: 16px; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.08em; }
.input, textarea.input {
  width: 100%; font: inherit; color: var(--text); background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--glass-brd); border-radius: 12px; padding: 12px 14px; outline: none;
  transition: border 0.2s ease;
}
.input:focus, textarea.input:focus { border-color: var(--accent-2); }
textarea.input { resize: vertical; min-height: 90px; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12.5px; }
.form-error { color: var(--red); font-size: 13px; margin-top: 4px; min-height: 18px; }
.form-ok { color: var(--ok); font-size: 13px; margin-top: 4px; min-height: 18px; }

/* Config page ---------------------------------------------------------- */
.section { padding: 24px; }
.section h2 { font-family: "Space Grotesk", sans-serif; font-size: 17px; margin-bottom: 6px; }
.section .hint { color: var(--muted); font-size: 13px; margin-bottom: 18px; }
.row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.row .field { flex: 1; min-width: 160px; margin-bottom: 0; }
.provider-list { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.provider-item {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px;
  border: 1px solid var(--glass-brd); border-radius: 14px; background: rgba(255, 255, 255, 0.02);
}
.provider-item .meta { flex: 1; min-width: 0; }
.provider-item .meta b { font-size: 15px; }
.provider-item .meta small { display: block; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.provider-actions { display: flex; flex-direction: column; gap: 6px; flex-shrink: 0; }
.empty { color: var(--muted); font-size: 13px; padding: 10px 0; }

.hidden { display: none !important; }

@media (max-width: 560px) { .games { grid-template-columns: 1fr 1fr; } }
@media (max-width: 420px) { .games { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { .progress-fill { transition: none; } }
