:root {
  --overlay-darkness: 0.1;
  --overlay-blur: 2px;
  --overlay-blur-locked: 42px;
  --overlay-fog: 0.28;
  --card-blur: 18px;
  --accent: #5865f2;
  --spotify: #1db954;
  --online: #23a55a;
  --idle: #f0b232;
  --dnd: #f23f43;
  --offline: #80848e;
  --text: #f2f3f5;
  --muted: #b5bac1;
}

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

html, body {
  height: 100%;
  width: 100%;
  overflow: hidden;
  font-family: "gg sans", "Noto Sans", "Segoe UI", system-ui, sans-serif;
  background: #050505;
  color: var(--text);
}

.bg-video,
.bg-image {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
  pointer-events: none;
}

.bg-image {
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
}

.bg-overlay {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(ellipse at center, rgba(0, 0, 0, var(--overlay-fog)) 0%, rgba(0, 0, 0, calc(var(--overlay-darkness) + 0.18)) 100%),
    rgba(0, 0, 0, var(--overlay-darkness));
  backdrop-filter: blur(var(--overlay-blur-locked));
  -webkit-backdrop-filter: blur(var(--overlay-blur-locked));
  transition: backdrop-filter 1.1s ease, -webkit-backdrop-filter 1.1s ease, background 1.1s ease;
}

body.entered .bg-overlay {
  backdrop-filter: blur(var(--overlay-blur));
  -webkit-backdrop-filter: blur(var(--overlay-blur));
}

.stage {
  position: relative;
  z-index: 2;
  min-height: 100%;
  width: 100%;
  display: grid;
  place-items: center;
  padding: 24px;
}

.widget {
  width: min(520px, 100%);
  background: rgba(15, 16, 20, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  padding: 22px;
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(var(--card-blur));
  -webkit-backdrop-filter: blur(var(--card-blur));
  opacity: 1;
  transform: translateY(18px) scale(0.96);
  filter: blur(10px);
  pointer-events: none;
  transition: opacity 0.9s ease, transform 0.9s cubic-bezier(0.22, 1, 0.36, 1), filter 0.9s ease;
}

body.entered .widget {
  opacity: 1;
  transform: translateY(0) scale(1);
  filter: blur(0);
  pointer-events: auto;
}

.widget-top {
  display: flex;
  gap: 16px;
  align-items: center;
}

.avatar-wrap {
  position: relative;
  width: 84px;
  height: 84px;
  flex-shrink: 0;
}

.avatar {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  object-fit: cover;
  background: #2b2d31;
  display: block;
}

.status-dot {
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 4px solid #111218;
  background: var(--offline);
}

.status-dot.online { background: var(--online); }
.status-dot.idle { background: var(--idle); }
.status-dot.dnd { background: var(--dnd); }
.status-dot.offline { background: var(--offline); }

.identity {
  min-width: 0;
  flex: 1;
}

.display-name {
  font-size: 22px;
  font-weight: 720;
  line-height: 1.15;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.username {
  margin-top: 3px;
  color: var(--muted);
  font-size: 14px;
}

.status-label {
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.activity {
  margin-top: 18px;
  padding: 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.05);
  display: none;
}

.activity.visible {
  display: block;
}

.activity-head {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}

.activity-body {
  display: flex;
  gap: 12px;
  align-items: center;
}

.activity-art {
  width: 56px;
  height: 56px;
  border-radius: 10px;
  object-fit: cover;
  background: #2b2d31;
  flex-shrink: 0;
}

.activity-text {
  min-width: 0;
  flex: 1;
}

.activity-title,
.activity-sub,
.activity-extra {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.activity-title {
  font-size: 14px;
  font-weight: 650;
}

.activity-sub,
.activity-extra {
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
}

.progress-wrap {
  margin-top: 10px;
  display: none;
}

.progress-wrap.visible {
  display: block;
}

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

.progress-times {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 11px;
  color: var(--muted);
}

.progress-bar {
  height: 100%;
  width: 0;
  background: #1db954;
  border-radius: inherit;
}

.spotify-btn {
  margin: 0 0 0 auto;
  display: none;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  padding: 6px;
  border-radius: 50%;
  background: rgba(29, 185, 84, 0.14);
  border: 1px solid rgba(29, 185, 84, 0.3);
  text-decoration: none;
}

.spotify-btn.visible {
  display: inline-flex;
}

.spotify-btn:hover {
  background: rgba(29, 185, 84, 0.26);
}

.spotify-logo {
  width: 18px;
  height: 18px;
  object-fit: contain;
  display: block;
}

.hint {
  margin-top: 14px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}

.hint.error {
  color: #ff8d8d;
}

.enter-gate {
  position: fixed;
  inset: 0;
  z-index: 20;
  border: 0;
  background: rgba(0, 0, 0, 0.28);
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
  opacity: 1;
  transition: opacity 0.9s ease, visibility 0.9s ease;
}

.enter-text {
  font-size: clamp(18px, 3.2vw, 28px);
  font-weight: 400;
  letter-spacing: 0.28em;
  text-transform: lowercase;
  color: rgba(255, 255, 255, 0.92);
  text-shadow: 0 0 18px rgba(255, 255, 255, 0.18);
  animation: enterFade 2.2s ease-in-out infinite;
}

@keyframes enterFade {
  0%, 100% { opacity: 0.18; }
  50% { opacity: 1; }
}

body.entered .enter-gate {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

body:not(.entered) .music-btn {
  opacity: 0;
  pointer-events: none;
}

.music-btn {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 5;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  background: rgba(15, 16, 20, 0.7);
  color: var(--text);
  font-size: 16px;
  cursor: pointer;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: opacity 0.6s ease, background 0.2s ease;
}

.music-btn:hover {
  background: rgba(30, 32, 40, 0.85);
}

@media (max-width: 480px) {
  .widget {
    padding: 18px;
    border-radius: 16px;
  }

  .avatar,
  .avatar-wrap {
    width: 72px;
    height: 72px;
  }

  .display-name {
    font-size: 19px;
  }
}
