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

:root {
  --bg: rgba(8, 8, 18, 0.96);
  --card: rgba(255,255,255,0.05);
  --card-border: rgba(255,255,255,0.08);
  --purple: #a78bfa;
  --purple-dim: rgba(167,139,250,0.15);
  --green: #34d399;
  --yellow: #fbbf24;
  --orange: #f97316;
  --red: #f87171;
  --text-dim: rgba(255,255,255,0.25);
  --text-mid: rgba(255,255,255,0.5);
  --text: rgba(255,255,255,0.9);
}

html, body {
  width: 100%; height: 100%;
  background: transparent;
  font-family: "Outfit", sans-serif;
  color: var(--text);
  overflow: hidden;
  user-select: none;
}

.widget {
  width: 100%; height: 100%;
  background: var(--bg);
  border: 1px solid rgba(167,139,250,0.2);
  border-radius: 18px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.04) inset,
    0 20px 60px rgba(0,0,0,0.8),
    0 0 40px rgba(124,58,237,0.06);
  -webkit-app-region: drag;
  position: relative;
  overflow: hidden;
}

.widget::before {
  content: "";
  position: absolute;
  top: 0; left: 20%; right: 20%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(167,139,250,0.5), transparent);
  pointer-events: none;
}

.widget::after {
  content: "";
  position: absolute;
  top: -60px; left: 50%;
  transform: translateX(-50%);
  width: 200px; height: 120px;
  background: radial-gradient(ellipse, rgba(124,58,237,0.08), transparent 70%);
  pointer-events: none;
}

/* ── Header ── */
.header {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-shrink: 0;
}

.logo {
  width: 26px; height: 26px;
  background: linear-gradient(135deg, #7c3aed, #a78bfa);
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  box-shadow: 0 2px 12px rgba(124,58,237,0.4);
  flex-shrink: 0;
}

.title {
  font-size: 13px; font-weight: 700;
  letter-spacing: 0.2px;
  background: linear-gradient(90deg, #e0d0ff, #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
  animation: blink 2.5s ease infinite;
  flex-shrink: 0;
}

@keyframes blink {
  0%,100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.controls {
  margin-left: auto;
  display: flex; gap: 5px;
  -webkit-app-region: no-drag;
}

.btn {
  width: 22px; height: 22px; border: none;
  border-radius: 6px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700;
  transition: all 0.15s ease;
  border: 1px solid transparent;
}

.btn-refresh {
  background: var(--purple-dim);
  color: var(--purple);
  border-color: rgba(167,139,250,0.15);
}
.btn-refresh:hover { background: rgba(167,139,250,0.25); transform: rotate(180deg); }

.btn-minimize {
  background: rgba(251,191,36,0.1);
  color: var(--yellow);
  border-color: rgba(251,191,36,0.15);
  font-size: 14px;
  padding-bottom: 4px;
}
.btn-minimize:hover { background: rgba(251,191,36,0.22); }

.btn-close {
  background: rgba(248,113,113,0.1);
  color: var(--red);
  border-color: rgba(248,113,113,0.15);
}
.btn-close:hover { background: rgba(248,113,113,0.25); }

/* ── Timestamp ── */
.timestamp {
  font-family: "JetBrains Mono", monospace;
  font-size: 9px;
  color: var(--text-dim);
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

/* ── Cards ── */
.cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  flex: 1;
  min-height: 0;
}

.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 11px;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.3s;
}

.card:hover { border-color: rgba(255,255,255,0.12); }

.card::before {
  content: "";
  position: absolute;
  top: 0; left: 10%; right: 10%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.7;
}

.card::after {
  content: "";
  position: absolute;
  top: -20px; right: -20px;
  width: 70px; height: 70px;
  background: radial-gradient(circle, var(--accent), transparent 70%);
  opacity: 0.07;
  pointer-events: none;
}

.card-label {
  font-size: 8px; font-weight: 600;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.gauge-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
}

.gauge {
  position: relative;
  flex-shrink: 0;
  width: 54px; height: 54px;
}

.gauge svg {
  transform: rotate(-90deg);
  width: 100%; height: 100%;
  overflow: visible;
}

.gauge-bg { fill: none; stroke: rgba(255,255,255,0.05); stroke-width: 5.5; }

.gauge-fill {
  fill: none; stroke-width: 5.5; stroke-linecap: round;
  stroke-dasharray: 148;
  stroke: var(--accent);
  filter: drop-shadow(0 0 5px var(--accent));
  transition: stroke-dashoffset 1s cubic-bezier(.4,0,.2,1);
}

.gauge-text {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px; font-weight: 700;
  color: var(--accent);
}

.gauge-info { flex: 1; min-width: 0; }

.gauge-percent {
  font-size: 22px; font-weight: 800;
  color: var(--accent); line-height: 1;
  margin-bottom: 4px;
  text-shadow: 0 0 18px var(--accent);
}

.gauge-sublabel {
  font-size: 8px;
  color: var(--text-dim);
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

.gauge-reset {
  font-family: "JetBrains Mono", monospace;
  font-size: 8px;
  color: var(--text-mid);
  line-height: 1.4;
}

/* ── Credits ── */
.credits-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 11px 13px;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
  transition: border-color 0.3s;
}

.credits-card:hover { border-color: rgba(255,255,255,0.12); }

.credits-card::before {
  content: "";
  position: absolute;
  top: 0; left: 10%; right: 10%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.7;
}

.credits-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 9px;
}

.credits-label {
  font-size: 8px; font-weight: 600;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 3px;
}

.credits-amount {
  font-family: "JetBrains Mono", monospace;
  font-size: 14px; font-weight: 700;
  color: var(--accent);
  text-shadow: 0 0 16px var(--accent);
}

.credits-badge {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 9px; font-weight: 600;
  color: var(--accent);
  font-family: "JetBrains Mono", monospace;
}

.bar-track {
  height: 4px;
  background: rgba(255,255,255,0.05);
  border-radius: 99px;
  overflow: hidden;
}

.bar-fill {
  height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 60%, white));
  box-shadow: 0 0 10px var(--accent);
  transition: width 1s cubic-bezier(.4,0,.2,1);
}

/* ── States ── */
.error-state {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 8px; color: var(--red); font-size: 11px;
  text-align: center; padding: 0 20px;
}

.loading-state {
  flex: 1; display: flex; align-items: center; justify-content: center;
  color: var(--text-dim); font-size: 10px;
  font-family: "JetBrains Mono", monospace;
  animation: pulse 1.5s ease infinite;
}

@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.2} }