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

:root {
  --bg: none;
  --dim: .5;
  --bg-blur: 0px;
  --card-bg: rgba(10, 10, 10, .38);
  --card-border: rgba(255, 255, 255, .14);
  --card-radius: 22px;
  --avatar: 96px;
  --card-blur: 10px;
  --font: "Inter", system-ui, sans-serif;
  --icon: 32px;
  --icon-color: #fff;
}

html, body { height: 100%; }

body {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 16px;
  overflow: hidden;
  background: #000;
  color: #fff;
  font-family: var(--font);
  perspective: 900px;
}

#bg {
  position: fixed;
  inset: calc(var(--bg-blur) * -2);   /* hide blurred edges */
  background: var(--bg) center / cover no-repeat;
  filter: blur(var(--bg-blur));
}
/* dim the wallpaper so the card stands out */
#bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, rgba(0,0,0,calc(var(--dim) * .7)) 0%, rgba(0,0,0,min(1, calc(var(--dim) * 1.3))) 100%);
}

.loading #bg, .loading .card { display: none; }

#fx { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; }

#bg video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

/* ---------- screen filters (body[data-screen]) ---------- */
#screen, #crt { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; display: none; }
#crt i { position: absolute; left: 0; right: 0; height: 18%; display: none; }

[data-screen="grain"] #screen,
[data-screen="oldtv"] #screen,
[data-screen="vhs"] #screen { display: block; mix-blend-mode: overlay; opacity: calc(var(--strength, .6) * .5); }

[data-screen="oldtv"] #crt, [data-screen="vhs"] #crt { display: block; }
[data-screen="oldtv"] #crt {
  background:
    repeating-linear-gradient(to bottom, rgba(0,0,0,calc(var(--strength) * .45)) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,calc(.4 + var(--strength) * .5)) 100%);
  animation: flicker .12s steps(2) infinite;
}
[data-screen="oldtv"] #crt i { display: block; background: linear-gradient(transparent, rgba(255,255,255,calc(var(--strength) * .06)), transparent); animation: roll 7s linear infinite; }
[data-screen="oldtv"] #bg { filter: blur(var(--bg-blur)) contrast(1.15) sepia(calc(var(--strength) * .35)); }

[data-screen="vhs"] #crt { background: repeating-linear-gradient(to bottom, rgba(0,0,0,calc(var(--strength) * .25)) 0 1px, transparent 1px 4px); }
[data-screen="vhs"] #crt i { display: block; height: 6%; background: linear-gradient(transparent, rgba(255,255,255,calc(var(--strength) * .12)), rgba(120,200,255,calc(var(--strength) * .08)), transparent); animation: roll 4.5s linear infinite; }
[data-screen="vhs"] #bg { filter: blur(var(--bg-blur)) saturate(1.5) contrast(1.1) hue-rotate(-6deg); animation: jitter 3s steps(1) infinite; }

[data-screen="glass"] #screen { display: block; }
[data-screen="glass"] #bg { filter: blur(calc(var(--bg-blur) + var(--strength) * 6px)) brightness(.95); }
[data-screen="glass"] #bg::before { content: ""; position: absolute; inset: 0; background: rgba(170,185,200,calc(var(--strength) * .08)); z-index: 1; }

@keyframes flicker { 50% { opacity: .9; } }
@keyframes roll { from { top: -20%; } to { top: 110%; } }
@keyframes jitter { 0%, 100% { transform: none; } 92% { transform: translateX(3px) skewX(.6deg); } 94% { transform: translateX(-4px); } 96% { transform: translateX(2px); } }

.card {
  position: relative;
  max-width: min(560px, 100%);
  padding: 28px 34px;
  border-radius: var(--card-radius);
  text-align: center;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .6);
  backdrop-filter: blur(var(--card-blur));
  -webkit-backdrop-filter: blur(var(--card-blur));
  transform-style: preserve-3d;
  transition: transform .25s ease-out;
  animation: in .9s cubic-bezier(.2, .8, .2, 1) both;
}
@keyframes in { from { opacity: 0; transform: translateY(14px) scale(.96); } }

#avatar { display: block; width: var(--avatar); height: var(--avatar); object-fit: cover; margin: 0 auto 14px; }
#avatar[hidden] { display: none; }
#avatar.shape-circle { border-radius: 50%; }
#avatar.shape-rounded { border-radius: 22%; }
#avatar.glow { box-shadow: 0 0 0 2px rgba(255,255,255,.15), 0 0 24px rgba(255,255,255,.35); }

#location { display: flex; align-items: center; justify-content: center; gap: 4px; margin-top: 8px; font-size: 13px; opacity: .75; }
#location[hidden] { display: none; }
#location svg { width: 14px; height: 14px; fill: currentColor; }

#text.typing::after { content: "|"; margin-left: 1px; animation: caret 1s steps(1) infinite; }
@keyframes caret { 50% { opacity: 0; } }

/* username effects */
#header { position: relative; }
.fx-glow { text-shadow: 0 0 8px currentColor, 0 0 22px currentColor !important; }
.fx-rainbow { background: linear-gradient(90deg, #ff5f6d, #ffc371, #5ef08f, #47c9ff, #b06bff, #ff5f6d) 0 0 / 200% 100%; -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; animation: slide 4s linear infinite; text-shadow: none !important; }
.fx-shiny { background: linear-gradient(110deg, currentColor 35%, #fff 50%, currentColor 65%) 0 0 / 250% 100%; -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; animation: slide 3s linear infinite; text-shadow: none !important; }
@keyframes slide { to { background-position: -200% 0; } }
.fx-glitch::before, .fx-glitch::after { content: attr(data-text); position: absolute; inset: 0; pointer-events: none; }
.fx-glitch::before { color: #ff2d55; transform: translate(-2px); clip-path: inset(0 0 60% 0); animation: glitch 2.4s steps(1) infinite; mix-blend-mode: screen; }
.fx-glitch::after { color: #2de2ff; transform: translate(2px); clip-path: inset(55% 0 0 0); animation: glitch 2.4s steps(1) infinite reverse; mix-blend-mode: screen; }
@keyframes glitch { 0%, 86%, 100% { clip-path: inset(0 0 100% 0); } 88% { clip-path: inset(10% 0 55% 0); } 92% { clip-path: inset(60% 0 8% 0); } 96% { clip-path: inset(35% 0 40% 0); } }

/* lightning flash */
#flash { position: fixed; inset: 0; background: rgb(200, 215, 255); opacity: 0; mix-blend-mode: soft-light; pointer-events: none; }

/* cursor trail */
.trail { position: fixed; pointer-events: none; z-index: 50; translate: -50% -50%; font-style: normal; }
.trail-dots { width: 6px; height: 6px; border-radius: 50%; background: #fff; animation: fade .6s ease-out forwards; }
.trail-ghost { width: 14px; height: 14px; border-radius: 50%; background: rgba(255,255,255,.25); filter: blur(3px); animation: fade .8s ease-out forwards; }
.trail-sparkle { color: #fff; font-size: 12px; text-shadow: 0 0 6px #fff; animation: sparkle .8s ease-out forwards; }
@keyframes fade { to { opacity: 0; transform: scale(.3); } }
@keyframes sparkle { to { opacity: 0; transform: translate(var(--dx), 18px) rotate(90deg) scale(.4); } }

#header { font-weight: 700; line-height: 1.1; text-shadow: 0 2px 18px rgba(0,0,0,.6); overflow-wrap: anywhere; }
#text { margin-top: 10px; line-height: 1.5; white-space: pre-line; overflow-wrap: anywhere; }
#header:not([hidden]) ~ .socials, #text:not([hidden]) ~ .socials { margin-top: 22px; }

.socials { display: flex; flex-wrap: wrap; justify-content: center; gap: 26px; list-style: none; }

.socials a, .socials button {
  display: grid;
  place-items: center;
  width: calc(var(--icon) + 12px);
  height: calc(var(--icon) + 12px);
  background: none;
  border: 0;
  cursor: pointer;
  opacity: .82;
  transition: transform .2s ease, opacity .2s ease, filter .2s ease;
}
.socials svg { width: var(--icon); height: var(--icon); fill: currentColor; }

.socials a:hover, .socials button:hover,
.socials a:focus-visible, .socials button:focus-visible {
  opacity: 1;
  transform: translateY(-4px) scale(1.18);
  filter: drop-shadow(0 0 8px currentColor);
  outline: none;
}
.no-glow .socials a:hover, .no-glow .socials button:hover { filter: none; }
.socials a:active, .socials button:active { transform: scale(.92); }
.socials .copied { animation: pop .5s ease; filter: drop-shadow(0 0 14px currentColor); }
@keyframes pop { 50% { transform: scale(1.35); } }

/* mini player */
.player {
  position: fixed;
  left: 50%;
  bottom: 20px;
  translate: -50% 0;
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: calc(100% - 32px);
  padding: 6px 14px 6px 8px;
  border-radius: 999px;
  background: rgba(10, 10, 10, .5);
  border: 1px solid rgba(255, 255, 255, .14);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-size: 13px;
}
.player[hidden] { display: none; }
.player button { display: grid; place-items: center; width: 30px; height: 30px; border: 0; border-radius: 50%; background: none; color: #fff; cursor: pointer; opacity: .8; }
.player button:hover { opacity: 1; background: rgba(255,255,255,.1); }
.player svg { width: 16px; height: 16px; fill: currentColor; }
.player .i-pause, .player.playing .i-play { display: none; }
.player.playing .i-pause { display: block; }
#song { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: .85; margin-left: 4px; }

/* click to enter */
.enter {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  border: 0;
  background: rgba(0, 0, 0, .55);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: #fff;
  font: 500 18px var(--font);
  letter-spacing: .08em;
  cursor: pointer;
  transition: opacity .6s ease, visibility .6s;
}
.enter span { animation: breathe 2.4s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: .45; } }
.enter.gone { opacity: 0; visibility: hidden; pointer-events: none; }

@media (prefers-reduced-motion: reduce) {
  .card, .socials *, .enter span, #crt, #crt i, #bg, #header, #header::before, #header::after { animation: none !important; transition: none; }
}
