:root {
  --accent: #c43cff;
  --accent-soft: color-mix(in srgb, var(--accent) 35%, transparent);
  --accent-glow: color-mix(in srgb, var(--accent) 70%, transparent);
  --text: #f1eaf7;
  --muted: color-mix(in srgb, var(--text) 55%, transparent);
  --card: rgba(18, 16, 22, 0.55);
  --card-border: rgba(255, 255, 255, 0.07);
  --radius: 22px;
}

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

html, body { height: 100%; }
html { scrollbar-width: none; }
html::-webkit-scrollbar, body::-webkit-scrollbar { display: none; }

body {
  font-family: 'Outfit', system-ui, sans-serif;
  color: var(--text);
  background: #070709;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

/* ---------- Background ---------- */
#bg { position: fixed; inset: 0; z-index: 0; overflow: hidden; }
#bg video, #bg img, #bg canvas {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; display: none;
}
#bg .show { display: block; }
.bg-overlay { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.45); }

/* ---------- Enter screen ---------- */
.enter {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: center;
  background: rgba(5, 5, 8, 0.82);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  cursor: pointer; transition: opacity .8s ease, visibility .8s;
  outline: none;
}
.enter.gone { opacity: 0; visibility: hidden; }
.enter-text {
  font-size: clamp(1.1rem, 3vw, 1.5rem); letter-spacing: .08em;
  color: var(--text); text-shadow: 0 0 18px var(--accent-glow);
  animation: pulse 2.2s ease-in-out infinite;
}
.enter-text::after { content: '|'; margin-left: 2px; animation: blink 1s steps(1) infinite; color: var(--accent); }
@keyframes pulse { 50% { opacity: .55; } }
@keyframes blink { 50% { opacity: 0; } }

/* ---------- Volume ---------- */
.volume {
  position: fixed; top: 20px; left: 20px; z-index: 40;
  display: flex; align-items: center; gap: 10px;
  padding: 8px; border-radius: 16px;
  background: var(--card); border: 1px solid var(--card-border);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  opacity: 0; transform: translateY(-10px); transition: opacity .6s, transform .6s;
}
body.entered .volume { opacity: 1; transform: none; }
.icon-btn {
  width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center;
  font-size: 1.25rem; color: var(--accent);
  filter: drop-shadow(0 0 6px var(--accent-glow)); transition: transform .2s;
}
.icon-btn:hover { transform: scale(1.08); }
#vol-slider { width: 0; opacity: 0; transition: width .35s ease, opacity .35s ease, margin .35s; margin-right: 0; }
.volume:hover #vol-slider, .volume:focus-within #vol-slider { width: 110px; opacity: 1; margin-right: 8px; }

input[type=range] { -webkit-appearance: none; appearance: none; height: 4px; border-radius: 4px; cursor: pointer;
  background: linear-gradient(to right, var(--accent) var(--val, 50%), rgba(255,255,255,.15) var(--val, 50%)); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 12px; border-radius: 50%; background: #fff; box-shadow: 0 0 8px var(--accent); }
input[type=range]::-moz-range-thumb { width: 12px; height: 12px; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 0 8px var(--accent); }

/* ---------- Layout ---------- */
.app {
  position: relative; z-index: 10; min-height: 100vh; min-height: 100dvh;
  display: grid; place-items: center; padding: 24px 16px;
  perspective: 1200px;
}
.stack {
  width: 100%; max-width: 780px; display: flex; flex-direction: column; gap: 18px;
  transform-style: preserve-3d; transition: transform .25s ease-out;
  opacity: 0; translate: 0 30px;
}
body.entered .stack { opacity: 1; translate: 0 0; transition: transform .25s ease-out, opacity 1s ease, translate 1s cubic-bezier(.2,.8,.2,1); }

.card {
  background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius);
  backdrop-filter: blur(16px) saturate(130%); -webkit-backdrop-filter: blur(16px) saturate(130%);
  box-shadow: 0 20px 60px rgba(0,0,0,.45);
}

/* ---------- Profile card ---------- */
.profile-card { overflow: hidden; }
.banner {
  position: relative; height: 130px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 45%, #111), #0d0b12 70%) center/cover no-repeat;
}
.banner::after { content: ''; position: absolute; inset: 0; background: linear-gradient(to bottom, transparent 30%, rgba(14,12,18,.85)); }
.banner.none { height: 70px; background: none; }
.banner.none::after { display: none; }

.meta {
  position: absolute; top: 16px; right: 18px; z-index: 2;
  display: flex; align-items: center; gap: 12px;
  padding: 6px 12px; border-radius: 999px; background: rgba(0,0,0,.35);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); font-size: .95rem;
}
.meta-item { display: inline-flex; align-items: center; gap: 7px; }
.meta-item i { color: var(--accent); filter: drop-shadow(0 0 5px var(--accent-glow)); }
.meta-item b { font-weight: 500; }
.meta-sep { width: 1px; height: 16px; background: rgba(255,255,255,.25); }
.hidden { display: none !important; }

.profile { position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; padding: 0 28px 28px; }
.avatar-wrap {
  position: relative; margin-top: -58px; z-index: 2; width: 116px; height: 116px; border-radius: 50%; padding: 4px;
  box-shadow: 0 0 30px var(--accent-soft);
}
.avatar-wrap::before {
  content: ''; position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(from 0deg, var(--accent), transparent 40%, var(--accent) 70%, transparent);
  animation: spin 6s linear infinite;
}
.avatar { position: relative; width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; background: #15121b; border: 3px solid #120f17; }
@keyframes spin { to { transform: rotate(360deg); } }

.name {
  margin-top: 10px; font-size: clamp(2rem, 6vw, 2.8rem); font-weight: 400; line-height: 1.35;
  background: linear-gradient(100deg, var(--accent) 20%, #fff 40%, var(--accent) 60%) 0 0/250% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 10px var(--accent-glow));
  animation: shimmer 4s linear infinite;
}
@keyframes shimmer { to { background-position: -250% 0; } }

.bio { max-width: 520px; margin-top: 6px; font-size: 1.12rem; line-height: 1.5; color: color-mix(in srgb, var(--accent) 55%, #fff); text-shadow: 0 0 12px var(--accent-soft); white-space: pre-line; }

/* Badges */
.badges {
  margin-top: 18px; display: flex; flex-wrap: wrap; justify-content: center; gap: 4px;
  padding: 8px 12px; border-radius: 999px; background: rgba(255,255,255,.04); border: 1px solid var(--card-border);
}
.badges:empty { display: none; }
.badge { position: relative; width: 30px; height: 30px; display: grid; place-items: center; font-size: 1rem; color: var(--accent); filter: drop-shadow(0 0 5px var(--accent-glow)); transition: transform .2s; cursor: default; }
.badge:hover { transform: translateY(-3px) scale(1.15); }
.badge img { width: 22px; height: 22px; object-fit: contain; }
[data-tip]::before {
  content: attr(data-tip); position: absolute; bottom: calc(100% + 8px); left: 50%;
  translate: -50% 4px; white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity .2s, translate .2s;
  font: 500 .78rem 'Outfit', sans-serif; color: #fff; background: rgba(10,10,14,.92); padding: 5px 9px; border-radius: 8px;
  border: 1px solid var(--card-border); filter: none; z-index: 5;
}
[data-tip]:hover::before { opacity: 1; translate: -50% 0; }

/* Discord presence */
.presence {
  margin-top: 20px; width: 100%; max-width: 560px; display: flex; align-items: center; gap: 14px;
  padding: 14px 16px; border-radius: 18px; text-align: left;
  background: color-mix(in srgb, var(--accent) 7%, rgba(255,255,255,.03)); border: 1px solid var(--card-border);
}
.p-avatar { position: relative; flex: none; width: 74px; height: 74px; }
.p-avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; background: #15121b; }
.status { position: absolute; right: 1px; bottom: 1px; width: 20px; height: 20px; border-radius: 50%; border: 4px solid #17141c; background: #80848e; }
.status.online { background: #23a55a; } .status.idle { background: #f0b232; }
.status.dnd { background: #f23f43; } .status.offline { background: #80848e; }
.p-info { flex: 1; min-width: 0; }
.p-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.p-name { font-size: 1.3rem; font-weight: 500; color: var(--text); }
.p-tag { display: inline-flex; align-items: center; gap: 5px; font-size: .8rem; color: var(--muted); padding: 2px 8px; border-radius: 8px; background: rgba(255,255,255,.06); }
.p-tag i { color: #ff8fd8; }
.p-tag:empty { display: none; }
.p-activity, .p-sub { font-size: .92rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-activity b { color: var(--text); font-weight: 600; }
.p-sub:empty, .p-activity:empty { display: none; }
.p-progress { margin-top: 7px; height: 3px; border-radius: 3px; background: rgba(255,255,255,.12); overflow: hidden; display: none; }
.p-progress.show { display: block; }
#p-progress-fill { height: 100%; width: 0; background: var(--accent); }
.p-art { flex: none; width: 74px; height: 74px; border-radius: 12px; object-fit: cover; display: none; box-shadow: 0 6px 20px rgba(0,0,0,.4); }
.p-art.show { display: block; }

/* Socials */
.socials { margin-top: 22px; display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; }
.social {
  position: relative; width: 48px; height: 48px; display: grid; place-items: center; font-size: 2.1rem;
  color: var(--accent); filter: drop-shadow(0 0 8px var(--accent-glow)); transition: transform .2s, filter .2s;
  text-decoration: none;
}
.social:hover { transform: translateY(-4px) scale(1.1); filter: drop-shadow(0 0 14px var(--accent)); }
.social svg { width: 34px; height: 34px; fill: currentColor; }

/* ---------- Player ---------- */
.player { display: flex; align-items: center; gap: 18px; padding: 16px 20px; }
.cover { flex: none; width: 80px; height: 80px; border-radius: 12px; object-fit: cover; background: #15121b; box-shadow: 0 6px 20px rgba(0,0,0,.4); }
.player.playing .cover { animation: breathe 3s ease-in-out infinite; }
@keyframes breathe { 50% { box-shadow: 0 0 22px var(--accent-soft); } }
.player-main { flex: 1; min-width: 0; }
.track-title { font-size: 1.2rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: color-mix(in srgb, var(--accent) 45%, #fff); }
.track-title.error { color: #ff6b81; }
.track-artist { font-size: .85rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track-artist:empty { display: none; }
.progress-row { margin-top: 6px; display: flex; align-items: center; gap: 12px; }
.time { font-size: 1.05rem; font-variant-numeric: tabular-nums; color: var(--muted); min-width: 38px; }
.bar { position: relative; flex: 1; height: 16px; cursor: pointer; display: flex; align-items: center; touch-action: none; }
.bar::before { content: ''; position: absolute; left: 0; right: 0; height: 3px; border-radius: 3px; background: rgba(255,255,255,.15); }
.bar-fill { position: relative; height: 3px; width: 0; border-radius: 3px; background: var(--accent); box-shadow: 0 0 8px var(--accent-glow); }
.knob { position: absolute; right: -6px; top: 50%; width: 12px; height: 12px; border-radius: 50%; background: #fff; translate: 0 -50%; scale: 0; transition: scale .15s; box-shadow: 0 0 8px var(--accent); }
.bar:hover .knob, .bar.dragging .knob { scale: 1; }
.controls { display: flex; align-items: center; gap: 6px; }
.ctrl { width: 40px; height: 40px; display: grid; place-items: center; font-size: 1.2rem; color: var(--accent); border-radius: 12px; transition: transform .15s, background .2s; filter: drop-shadow(0 0 5px var(--accent-glow)); }
.ctrl:hover { background: rgba(255,255,255,.06); transform: scale(1.08); }
.ctrl:active { transform: scale(.94); }
.ctrl.play { font-size: 1.55rem; width: 46px; height: 46px; }

/* ---------- Cursor trail ---------- */
.spark { position: fixed; z-index: 100; pointer-events: none; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); animation: spark .8s ease-out forwards; }
@keyframes spark { to { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(.2); } }

/* ---------- Mobile ---------- */
@media (max-width: 600px) {
  .app { padding: 70px 12px 16px; }
  .banner { height: 110px; }
  .avatar-wrap { width: 96px; height: 96px; margin-top: -48px; }
  .profile { padding: 0 16px 22px; }
  .meta { top: 10px; right: 10px; font-size: .85rem; }
  .p-avatar, .p-art { width: 56px; height: 56px; }
  .player { flex-wrap: wrap; gap: 12px; padding: 14px; }
  .cover { width: 64px; height: 64px; }
  .player-main { flex: 1 1 calc(100% - 80px); }
  .controls { width: 100%; justify-content: center; }
  .time { font-size: .9rem; min-width: 32px; }
  .social { font-size: 1.8rem; width: 42px; height: 42px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
