:root {
  --bg: #000;
  --fg: #e6e6e6;
  --muted: #8a8a99;
  --dim: #555;
  --accent: #640fd3;
  --ghost: #7a7a9a;
  --mono: "Courier New", ui-monospace, Consolas, monospace;
  --goth: "UnifrakturMaguntia", serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html, body { min-height: 100%; }
body { background: var(--bg); color: var(--fg); font-family: var(--mono); -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

/* --- background layers --- */
.ambient { position: fixed; inset: -20%; filter: blur(60px); z-index: 0; }
.ambient i { position: absolute; border-radius: 50%; }
.ambient i:nth-child(1) { width: 55%; height: 60%; left: 5%; top: 10%; background: #2a2433; animation: drift1 14s ease-in-out infinite alternate; }
.ambient i:nth-child(2) { width: 50%; height: 50%; right: 0; bottom: 5%; background: #141018; animation: drift2 17s ease-in-out infinite alternate; }
@keyframes drift1 { to { transform: translate(35%, 20%); } }
@keyframes drift2 { to { transform: translate(-30%, -25%); } }

.bg { position: fixed; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 1; }
.fx { position: fixed; inset: 0; pointer-events: none; z-index: 2; }
.dim { background: rgba(0, 0, 0, .45); }
.scan { background: repeating-linear-gradient(0deg, transparent 0 2px, rgba(0, 0, 0, .48) 2px 4px); }
.grain {
  inset: -10%; opacity: .13;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='.8' numOctaves='2'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain .25s steps(3) infinite;
}
@keyframes grain { 33% { transform: translate(-5%, 3%); } 66% { transform: translate(4%, -4%); } }
.vign { background: radial-gradient(ellipse at center, transparent 35%, #000 95%); }

.rec { position: fixed; top: 16px; right: 20px; z-index: 3; font-size: 14px; letter-spacing: 1px; color: #ddd; }
.rec b { color: #c00; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* --- content --- */
.content {
  position: relative; z-index: 4;
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 48px 16px;
}
.content > * { opacity: 0; transform: translateY(8px); transition: opacity 1.6s ease, transform 1.6s ease; }
.on .content > * { opacity: 1; transform: none; }
.on .content > :nth-child(2) { transition-delay: .4s; }
.on .content > :nth-child(3) { transition-delay: .8s; }
.on .content > :nth-child(4) { transition-delay: 1.2s; }
.on .content > :nth-child(5) { transition-delay: 1.6s; }
.on .content > :nth-child(6) { transition-delay: 2s; }
.on .content > :nth-child(7) { transition-delay: 2.4s; }

.avatar {
  width: 96px; height: 96px; border-radius: 50%; object-fit: cover; margin-bottom: 10px; box-shadow: 0 0 24px rgba(88, 8, 216, 0.35);
}

.nick {
  position: relative; font-family: var(--goth); font-weight: 400;
  font-size: clamp(48px, 14vw, 76px); line-height: 1.1;
  color: var(--fg); text-shadow: 0 0 18px rgba(255, 255, 255, .19);
}
.nick::before, .nick::after { content: attr(data-t); position: absolute; left: 0; top: 0; width: 100%; }
.nick::before { color: var(--accent); animation: glitch1 3s infinite steps(1); }
.nick::after { color: var(--ghost); animation: glitch2 3s infinite steps(1); }
@keyframes glitch1 {
  0%, 88% { clip-path: inset(0 0 100% 0); transform: none; }
  90% { clip-path: inset(10% 0 60% 0); transform: translate(-5px, -1px); }
  93% { clip-path: inset(55% 0 20% 0); transform: translate(5px, 1px); }
}
@keyframes glitch2 {
  0%, 88% { clip-path: inset(0 0 100% 0); transform: none; }
  91% { clip-path: inset(60% 0 10% 0); transform: translate(5px, 1px); }
  94% { clip-path: inset(15% 0 70% 0); transform: translate(-5px, 0); }
}

.status { color: var(--muted); font-size: 14px; margin-top: 6px; min-height: 1.4em; }
.caret { animation: blink 1.1s steps(1) infinite; margin-left: 1px; }

.presence { display: inline-flex; align-items: center; gap: 8px; margin-top: 14px; font-size: 12px; color: var(--muted); max-width: min(90vw, 340px); }
#presence-text { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dim); flex: none; }
.dot.online { background: #3ba55d; }
.dot.idle { background: #faa61a; }
.dot.dnd { background: #ed4245; }

.links { display: flex; gap: 22px; margin-top: 22px; }
.link {
  display: block; width: 26px; height: 26px; background: #aaa;
  -webkit-mask: var(--icon) center / contain no-repeat; mask: var(--icon) center / contain no-repeat;
  transition: background .3s, transform .3s;
}
.link:hover, .link:focus-visible { background: #fff; transform: translateY(-2px); }
.link:focus-visible { outline: 1px solid var(--accent); outline-offset: 6px; }
.link.copied { background: var(--accent); }

.player {
  display: flex; align-items: center; gap: 12px; width: min(280px, 86vw);
  margin-top: 24px; padding: 10px 4px; text-align: left;
  border-top: 1px solid rgba(255, 255, 255, .1); border-bottom: 1px solid rgba(255, 255, 255, .1);
}
.meta { flex: 1; min-width: 0; font-size: 12px; color: var(--muted); line-height: 1.4; }
.meta b, #track-artist { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meta b { color: #ccc; font-weight: 400; font-size: 13px; }
.bar { height: 1px; background: rgba(255, 255, 255, .15); margin-top: 7px; }
.bar i { display: block; height: 100%; width: 0; background: var(--accent); }
.mute { width: 28px; height: 28px; flex: none; color: #aaa; display: flex; align-items: center; justify-content: center; }
.mute:hover, .mute:focus-visible { color: #fff; }
.mute svg { width: 20px; height: 20px; }
.player .x { display: none; }
.player.muted .w { display: none; }
.player.muted .x { display: inline; }

.views { margin-top: 16px; font-size: 11px; color: var(--dim); }

/* --- enter overlay --- */
.enter {
  position: fixed; inset: 0; z-index: 10; display: flex; align-items: center; justify-content: center;
  background: #000; cursor: pointer; user-select: none; transition: opacity 1.4s ease;
  font-size: 15px; letter-spacing: 4px; color: #888;
}
.enter span { animation: breathe 3s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: .2; } }
.enter:focus-visible { outline: none; }
.enter:focus-visible span { color: #ccc; }
.enter.gone { opacity: 0; pointer-events: none; }

@media (max-width: 480px) {
  .rec { top: 12px; right: 14px; font-size: 12px; }
  .links { gap: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  .ambient i, .grain, .rec b, .caret, .enter span { animation: none; }
  .nick::before, .nick::after { display: none; }
  .content > *, .enter { transition: none; }
}
