:root {
  --violet: #a855f7;
  --violet2: #7c3aed;
  --cyan: #22d3ee;
  --cyan2: #5eead4;
  --ink: #f5f3ff;
  --muted: #c4b5fd;
  --danger: #ff2d6a;
  --gold: #fbbf24;
  --panel: rgba(12, 6, 28, 0.72);
  --border: rgba(168, 85, 247, 0.55);
}

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

html, body {
  background: transparent !important;
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: "Space Grotesk", system-ui, sans-serif;
  color: var(--ink);
}

.app {
  position: relative;
  width: 100%;
  height: 100%;
  padding: 24px;
  pointer-events: none;
}

.widget {
  position: relative;
  width: min(520px, 92vw);
  padding: 16px 18px 14px;
  background: var(--panel);
  border: 2px solid var(--border);
  border-radius: 16px;
  box-shadow:
    0 0 0 1px rgba(34, 211, 238, 0.15),
    0 12px 40px rgba(0, 0, 0, 0.45),
    0 0 48px rgba(168, 85, 247, 0.25);
  transform: rotate(-0.6deg);
  backdrop-filter: blur(8px);
  overflow: hidden;
  animation: widgetIn 0.7s cubic-bezier(.2, .9, .2, 1) both;
}

.glow {
  position: absolute;
  inset: -40%;
  background:
    radial-gradient(circle at 20% 30%, rgba(168, 85, 247, 0.35), transparent 45%),
    radial-gradient(circle at 85% 70%, rgba(34, 211, 238, 0.28), transparent 40%);
  animation: chaosPulse 3.2s ease-in-out infinite alternate;
  pointer-events: none;
  z-index: 0;
}

.widget > *:not(.glow) { position: relative; z-index: 1; }

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.badge {
  font-family: Bangers, cursive;
  letter-spacing: 0.08em;
  font-size: 1.05rem;
  color: #0b0614;
  background: linear-gradient(90deg, var(--cyan), var(--violet));
  padding: 0.28rem 0.7rem;
  border-radius: 6px;
  transform: rotate(-1.5deg);
  box-shadow: 0 0 18px rgba(34, 211, 238, 0.45);
  animation: badgeWiggle 2.4s ease-in-out infinite;
}

.pct {
  font-family: Bangers, cursive;
  font-size: 1.55rem;
  color: var(--gold);
  text-shadow: 0 0 16px rgba(251, 191, 36, 0.55);
  letter-spacing: 0.04em;
}

.counter {
  font-weight: 800;
  font-size: clamp(1.7rem, 4.2vw, 2.35rem);
  letter-spacing: -0.03em;
  line-height: 1.05;
  margin-bottom: 10px;
  text-shadow: 2px 2px 0 #000, 0 0 22px rgba(168, 85, 247, 0.45);
}

.raised { color: var(--cyan2); }
.sep { color: rgba(255, 255, 255, 0.35); font-weight: 600; }
.goal { color: var(--muted); font-size: 0.62em; font-weight: 700; }

.bar-wrap { margin-bottom: 8px; }

.bar {
  position: relative;
  height: 22px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  border: 2px solid rgba(255, 255, 255, 0.1);
  overflow: hidden;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.5);
}

.bar > i {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--violet2), var(--violet) 40%, var(--cyan) 85%, var(--cyan2));
  box-shadow: 0 0 22px rgba(34, 211, 238, 0.55);
  transition: width 1.15s cubic-bezier(.2, .85, .2, 1);
  position: relative;
}

.bar .shine {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35), transparent);
  transform: translateX(-100%);
  animation: shine 2.2s linear infinite;
  pointer-events: none;
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
}

.footer #missingText { color: var(--gold); }
.deadline {
  color: var(--danger);
  animation: blink 1.1s steps(2) infinite;
}

/* ——— Alerts ——— */
.alert-host {
  position: absolute;
  left: 24px;
  bottom: 24px;
  width: min(420px, 90vw);
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 20;
}

.alert {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: linear-gradient(135deg, rgba(88, 28, 135, 0.88), rgba(8, 47, 73, 0.88));
  border: 2px solid rgba(34, 211, 238, 0.65);
  border-radius: 14px;
  box-shadow:
    0 0 32px rgba(168, 85, 247, 0.45),
    0 10px 28px rgba(0, 0, 0, 0.4);
  transform: rotate(0.8deg);
  opacity: 0;
  animation: alertIn 0.55s cubic-bezier(.2, .9, .2, 1) forwards;
}

.alert.out {
  animation: alertOut 0.55s ease forwards;
}

.alert .icon {
  font-size: 1.7rem;
  filter: drop-shadow(0 0 8px rgba(34, 211, 238, 0.8));
  animation: pop 0.6s ease;
}

.alert .body { flex: 1; min-width: 0; }
.alert .label {
  font-family: Bangers, cursive;
  letter-spacing: 0.06em;
  font-size: 0.95rem;
  color: var(--cyan);
}
.alert .who {
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--ink);
  text-shadow: 0 0 12px rgba(168, 85, 247, 0.6);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.alert .amt {
  font-family: Bangers, cursive;
  font-size: 1.55rem;
  color: var(--gold);
  text-shadow: 0 0 16px rgba(251, 191, 36, 0.6);
  white-space: nowrap;
}

@keyframes widgetIn {
  from { opacity: 0; transform: translateY(-18px) rotate(-2deg) scale(0.96); }
  to { opacity: 1; transform: translateY(0) rotate(-0.6deg) scale(1); }
}
@keyframes chaosPulse {
  from { opacity: 0.55; transform: scale(1) rotate(0deg); }
  to { opacity: 1; transform: scale(1.08) rotate(3deg); }
}
@keyframes badgeWiggle {
  0%, 100% { transform: rotate(-1.5deg) scale(1); }
  50% { transform: rotate(1.5deg) scale(1.04); }
}
@keyframes shine {
  from { transform: translateX(-100%); }
  to { transform: translateX(120%); }
}
@keyframes blink {
  to { opacity: 0.35; }
}
@keyframes alertIn {
  from { opacity: 0; transform: translateY(28px) scale(0.9) rotate(-2deg); }
  to { opacity: 1; transform: translateY(0) scale(1) rotate(0.8deg); }
}
@keyframes alertOut {
  from { opacity: 1; transform: translateY(0) scale(1) rotate(0.8deg); }
  to { opacity: 0; transform: translateY(-16px) scale(0.92) rotate(2deg); }
}
@keyframes pop {
  0% { transform: scale(0.4); }
  60% { transform: scale(1.25); }
  100% { transform: scale(1); }
}
