:root {
  --bg: #000;
  --line: #222;
  --text: #8a8a8a;
  --accent: #d4d4d4;
  --font: "Space Grotesk", system-ui, sans-serif;
}

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

body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  overflow: hidden;
}

button { font-family: inherit; }

/* ---------- background layers ---------- */
#bg-video {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  filter: grayscale(1);
  z-index: -3;
}
#bg-dim    { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.78); z-index: -2; }
#bg-canvas { position: fixed; inset: 0; z-index: -1; pointer-events: none; }

/* ---------- entry ---------- */
#entry {
  position: fixed; inset: 0; z-index: 20;
  display: grid; place-items: center;
  background: #000;
  cursor: pointer;
  transition: opacity 0.7s ease, visibility 0.7s ease;
}
#entry.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
#entry-text {
  color: var(--accent);
  font-size: 15px;
  letter-spacing: 3px;
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 0.35; } 50% { opacity: 1; } }

/* ---------- volume ---------- */
#volume {
  position: fixed; top: 16px; left: 16px; z-index: 10;
  display: flex; align-items: center; gap: 10px;
  padding: 6px 12px 6px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.6);
}
#volume-btn {
  background: none; border: none; cursor: pointer;
  font-size: 16px; line-height: 1;
}
#volume-slider {
  -webkit-appearance: none; appearance: none;
  width: 90px; height: 3px;
  background: #333; border-radius: 2px; outline: none;
}
#volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--accent); cursor: pointer;
}
#volume-slider::-moz-range-thumb {
  width: 11px; height: 11px; border: none; border-radius: 50%;
  background: var(--accent); cursor: pointer;
}

/* ---------- card ---------- */
#card {
  width: min(100%, 480px);
  display: flex; flex-direction: column; gap: 22px;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}
#card.shown {
  opacity: 1;
  transform: none;
  animation: float 6s ease-in-out 0.8s infinite;
}
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }

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

#avatar {
  width: 76px; height: 76px; flex-shrink: 0;
  border-radius: 50%; object-fit: cover;
  border: 1px solid var(--line);
  filter: grayscale(1);
}

#name-row { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }

#name {
  color: var(--accent);
  font-size: 28px; font-weight: 700; letter-spacing: 0.5px;
  animation: glitch 5s infinite;
}
@keyframes glitch {
  0%, 92%, 100% { transform: none; text-shadow: none; }
  93% { transform: translateX(-2px); text-shadow:  2px 0 #fff, -2px 0 #555; }
  95% { transform: translateX(2px);  text-shadow: -2px 0 #fff,  2px 0 #555; }
  97% { transform: translateX(-1px); text-shadow:  1px 0 #fff, -1px 0 #555; }
}

/* badges */
#badges {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
}
.badge { position: relative; display: flex; align-items: center; }
.badge img { width: 20px; height: 20px; object-fit: contain; display: block; transition: transform 0.15s; }
.badge:hover img { transform: scale(1.2); }
.badge-fallback {
  display: grid; place-items: center;
  width: 20px; height: 20px;
  border: 1px solid #444; border-radius: 50%;
  font-size: 10px; color: var(--accent);
}
.badge-tip {
  position: absolute; bottom: calc(100% + 8px); left: 50%;
  transform: translateX(-50%) translateY(3px);
  padding: 3px 8px;
  background: #000; border: 1px solid var(--line); border-radius: 5px;
  font-size: 11px; white-space: nowrap; color: var(--accent);
  opacity: 0; pointer-events: none;
  transition: opacity 0.15s, transform 0.15s;
}
.badge:hover .badge-tip { opacity: 1; transform: translateX(-50%); }

#bio { margin-top: 6px; min-height: 1.4em; font-size: 14px; line-height: 1.5; }
#bio::after {
  content: "_";
  margin-left: 1px;
  color: var(--accent);
  animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* ---------- discord ---------- */
#discord {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
#discord-avatar {
  width: 46px; height: 46px; flex-shrink: 0;
  border-radius: 50%; object-fit: cover;
  filter: grayscale(1);
}
#discord-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
#discord-username { color: var(--accent); font-size: 16px; font-weight: 700; }
#discord-invite {
  width: fit-content;
  color: var(--text); font-size: 13px; text-decoration: none;
  transition: color 0.15s;
}
#discord-invite:hover, #discord-invite:focus-visible { color: var(--accent); outline: none; }

#copy-id {
  flex-shrink: 0;
  padding: 6px 10px;
  background: none;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
#copy-id:hover, #copy-id:focus-visible { color: var(--accent); border-color: #555; outline: none; }


/* ---------- song player ---------- */
#player {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
#player[hidden] { display: none; }

#play-btn {
  width: 38px; height: 38px; flex-shrink: 0;
  display: grid; place-items: center;
  background: none;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--accent);
  font-size: 12px;
  cursor: pointer;
  transition: border-color 0.15s;
}
#play-btn:hover, #play-btn:focus-visible { border-color: #555; outline: none; }

#song-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
#song-title  { color: var(--accent); font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#song-artist { font-size: 12px; }

#progress {
  height: 3px; margin-top: 8px;
  background: #222; border-radius: 2px;
  cursor: pointer;
}
#progress-bar { width: 0; height: 100%; background: var(--accent); border-radius: 2px; }

/* ---------- views ---------- */
#views {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  font-size: 12px;
}
#views[hidden] { display: none; }

/* ---------- links ---------- */
#links { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px 22px; }
#links a { color: var(--text); font-size: 14px; text-decoration: none; transition: color 0.15s; }
#links a::before { content: "["; margin-right: 4px; }
#links a::after  { content: "]"; margin-left: 4px; }
#links a:hover, #links a:focus-visible { color: var(--accent); outline: none; }

@media (max-width: 480px) {
  #discord { flex-wrap: wrap; }
  #copy-id { margin-left: 60px; }
}

@media (prefers-reduced-motion: reduce) {
  #card.shown, #name, #entry-text { animation: none; }
}
