:root {
  --text: #ffffff;
  --text-dim: rgba(255, 255, 255, 0.62);
  --text-faint: rgba(255, 255, 255, 0.42);
  --glass: rgba(255, 255, 255, 0.075);
  --glass-hi: rgba(255, 255, 255, 0.12);
  --line: rgba(255, 255, 255, 0.16);
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
  --font: "Satoshi", "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  color-scheme: dark;
}

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

html, body {
  margin: 0;
  height: 100%;
  background: #0a0a0b;
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

body { min-height: 100svh; }

img { display: block; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ---------- фон ---------- */

.bg { position: fixed; inset: 0; z-index: 0; overflow: hidden; background: #0d0d0e; }

.bg-media {
  position: absolute;
  inset: -2%;
  width: 104%;
  height: 104%;
  object-fit: cover;
  filter: grayscale(1) brightness(0.55) contrast(1.1) blur(0.4px);
  transform: scale(1.02);
}

.bg-shade {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 38% 34% at 50% 34%, rgba(255, 255, 255, 0.10), transparent 70%),
    radial-gradient(ellipse at 50% 50%, transparent 35%, rgba(0, 0, 0, 0.72) 100%),
    linear-gradient(rgba(0, 0, 0, 0.18), rgba(0, 0, 0, 0.38));
}

.bg-grain {
  position: absolute;
  inset: -50%;
  opacity: 0.07;
  pointer-events: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 .9 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  animation: grain 1.2s steps(6) infinite;
}

@keyframes grain {
  0% { transform: translate(0, 0); }
  20% { transform: translate(-4%, 3%); }
  40% { transform: translate(3%, -5%); }
  60% { transform: translate(-6%, -2%); }
  80% { transform: translate(5%, 4%); }
  100% { transform: translate(0, 0); }
}

.fx { position: fixed; inset: 0; z-index: 1; pointer-events: none; width: 100%; height: 100%; }

/* ---------- заставка ---------- */

.enter {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  cursor: pointer;
  background: rgba(0, 0, 0, 0.62);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  transition: opacity 0.9s var(--ease), visibility 0.9s;
  outline: none;
}

.enter-text {
  font-size: 21px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.92);
  text-shadow: 0 0 14px rgba(255, 255, 255, 0.45);
  animation: breathe 2.4s ease-in-out infinite;
  user-select: none;
}

@keyframes breathe { 0%, 100% { opacity: 0.55; } 50% { opacity: 1; } }

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

/* ---------- громкость ---------- */

.volume {
  position: fixed;
  top: 18px;
  left: 18px;
  z-index: 20;
  display: flex;
  align-items: center;
  height: 58px;
  border-radius: 14px;
  background: rgba(20, 20, 22, 0.55);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  overflow: hidden;
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.8s var(--ease) 0.3s, transform 0.8s var(--ease) 0.3s;
}

.entered .volume { opacity: 1; transform: none; }

.vol-btn {
  width: 58px;
  height: 58px;
  flex: none;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  cursor: pointer;
  color: #fff;
}

.vol-btn svg { filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.35)); }

.vol-slider {
  width: 0;
  overflow: hidden;
  transition: width 0.35s var(--ease), padding 0.35s var(--ease);
  display: flex;
  align-items: center;
}

.volume:hover .vol-slider,
.volume:focus-within .vol-slider { width: 128px; padding-right: 16px; }

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 112px;
  height: 4px;
  border-radius: 4px;
  background: linear-gradient(to right, #fff var(--p, 35%), rgba(255, 255, 255, 0.22) var(--p, 35%));
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.6);
}

input[type="range"]::-moz-range-thumb {
  width: 13px;
  height: 13px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.6);
}

/* ---------- профиль ---------- */

.stage {
  position: relative;
  z-index: 5;
  min-height: 100svh;
  display: grid;
  place-items: center;
  place-items: safe center;
  padding: 72px 16px 40px;
  perspective: 1200px;
  overflow-y: auto;
  height: 100svh;
}

.profile {
  width: min(620px, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: transform 0.25s ease-out;
  will-change: transform;
}

.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 1s var(--ease), transform 1s var(--ease);
}

.entered .reveal { opacity: 1; transform: none; }
.entered .reveal:nth-child(2) { transition-delay: 0.08s; }
.entered .reveal:nth-child(3) { transition-delay: 0.16s; }
.entered .reveal:nth-child(4) { transition-delay: 0.24s; }
.entered .reveal:nth-child(5) { transition-delay: 0.32s; }
.entered .reveal:nth-child(6) { transition-delay: 0.40s; }

.avatar-wrap {
  width: 118px;
  height: 118px;
  border-radius: 50%;
  position: relative;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08), 0 0 50px rgba(255, 255, 255, 0.10), 0 12px 40px rgba(0, 0, 0, 0.6);
  background: radial-gradient(circle at 50% 35%, #2a2a2d, #111 70%);
}

.avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  filter: grayscale(0.15);
  opacity: 0;
  transition: opacity 0.6s ease;
}

.avatar.loaded { opacity: 1; }

.username {
  margin: 18px 0 0;
  font-size: clamp(32px, 6vw, 40px);
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.6), 0 0 28px rgba(255, 255, 255, 0.28);
  position: relative;
}

.bio {
  margin: 12px 0 0;
  min-height: 1.4em;
  font-size: 18px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.92);
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
  text-align: center;
}

.caret {
  display: inline-block;
  width: 2px;
  height: 1.05em;
  margin-left: 2px;
  vertical-align: -0.15em;
  background: rgba(255, 255, 255, 0.85);
  animation: blink 1s steps(1) infinite;
}

@keyframes blink { 50% { opacity: 0; } }

/* ---------- Discord-карточка ---------- */

.dcard {
  margin-top: 22px;
  width: min(406px, 100%);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px 12px 12px;
  border-radius: 18px;
  background: var(--glass);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: inherit;
  text-decoration: none;
  transition: background 0.25s ease, border-color 0.25s ease, transform 0.25s var(--ease);
}

.dcard:hover { background: var(--glass-hi); border-color: rgba(255, 255, 255, 0.24); }

.dc-ava { position: relative; width: 70px; height: 70px; flex: none; }

#dc-avatar {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  object-fit: cover;
  background: #1c1c1f;
}

.dc-deco {
  position: absolute;
  inset: -8px;
  width: 86px;
  height: 86px;
  pointer-events: none;
}

.dc-status {
  position: absolute;
  right: 1px;
  bottom: 1px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  border: 3.5px solid #1b1b1e;
  background: #80848e;
}

.dc-status.online { background: #23a55a; }
.dc-status.idle { background: #f0b232; }
.dc-status.dnd { background: #f23f43; }
.dc-status.offline { background: #80848e; }

.dc-info { min-width: 0; flex: 1; text-align: left; }

.dc-top { display: flex; align-items: center; gap: 8px; min-width: 0; }

.dc-name {
  font-size: 18px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.25);
}

.dc-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: none;
  height: 22px;
  padding: 0 7px 0 5px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.10);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.dc-tag img { width: 14px; height: 14px; }

.dc-sub {
  margin-top: 4px;
  font-size: 13.5px;
  font-style: italic;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dc-sub.activity { font-style: normal; }
.dc-sub b { font-weight: 700; color: rgba(255, 255, 255, 0.85); }

/* ---------- соцсети ---------- */

.socials {
  margin-top: 26px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 18px;
  min-height: 40px;
}

.socials a {
  position: relative;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  color: #fff;
  filter: drop-shadow(0 0 7px rgba(255, 255, 255, 0.55));
  transition: transform 0.25s var(--ease), filter 0.25s ease;
}

.socials a:hover { transform: translateY(-3px) scale(1.06); filter: drop-shadow(0 0 12px rgba(255, 255, 255, 0.85)); }

.socials a::after {
  content: attr(data-label);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translate(-50%, 4px);
  padding: 5px 9px;
  border-radius: 8px;
  background: rgba(10, 10, 12, 0.85);
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  filter: none;
}

.socials a:hover::after { opacity: 1; transform: translate(-50%, 0); }

.socials svg { width: 36px; height: 36px; }

/* ---------- плеер ---------- */

.player-zone { width: 100%; margin-top: 18px; }

.views {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 14px 2px;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.4);
  font-variant-numeric: tabular-nums;
}

.views svg { filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.45)); }

.player {
  display: flex;
  align-items: center;
  gap: 15px;
  width: 100%;
}

.pl-cover {
  width: 66px;
  height: 66px;
  flex: none;
  border-radius: 10px;
  overflow: hidden;
  background: #151517 radial-gradient(circle at 50% 40%, #2b2b2f, #111 75%);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.55);
}

.pl-cover img { width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 0.5s ease; }
.pl-cover img.loaded { opacity: 1; }

.pl-body { flex: 1; min-width: 0; }

.pl-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  margin-bottom: 4px;
}

.pl-title {
  font-size: 17px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
}

.pl-artist {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pl-line { display: flex; align-items: center; gap: 10px; }

.pl-time {
  font-size: 16px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.8);
  font-variant-numeric: tabular-nums;
  min-width: 38px;
}

#pl-dur { text-align: right; }

.pl-bar {
  flex: 1;
  height: 18px;
  display: flex;
  align-items: center;
  cursor: pointer;
  touch-action: none;
  outline: none;
}

.pl-track {
  position: relative;
  width: 100%;
  height: 3px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.22);
  transition: height 0.15s ease;
}

.pl-bar:hover .pl-track, .pl-bar.dragging .pl-track { height: 5px; }

.pl-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  border-radius: inherit;
  background: #fff;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.55);
}

.pl-fill::after {
  content: "";
  position: absolute;
  right: -6px;
  top: 50%;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  transform: translateY(-50%) scale(0);
  transition: transform 0.15s ease;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.7);
}

.pl-bar:hover .pl-fill::after, .pl-bar.dragging .pl-fill::after { transform: translateY(-50%) scale(1); }

.pl-ctrls { display: flex; align-items: center; gap: 6px; margin-left: 4px; }

.pl-ctrls button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: rgba(255, 255, 255, 0.82);
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease, transform 0.15s ease;
}

.pl-ctrls button:hover { color: #fff; background: rgba(255, 255, 255, 0.08); }
.pl-ctrls button:active { transform: scale(0.92); }
.pl-ctrls .pl-play { color: #fff; filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.5)); }

.player.unavailable .pl-ctrls, .player.unavailable .pl-bar { opacity: 0.35; pointer-events: none; }

.sc-frame {
  position: fixed;
  width: 1px;
  height: 1px;
  left: -10px;
  bottom: -10px;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

.noscript { position: fixed; inset: auto 0 20px; text-align: center; z-index: 60; color: var(--text-dim); }

/* ---------- адаптив ---------- */

@media (max-width: 560px) {
  .stage { padding: 84px 14px 28px; }
  .avatar-wrap { width: 104px; height: 104px; }
  .bio { font-size: 16px; }
  .dcard { padding: 10px 12px 10px 10px; gap: 12px; }
  .dc-ava, #dc-avatar { width: 58px; height: 58px; }
  .dc-deco { width: 72px; height: 72px; inset: -7px; }
  .dc-name { font-size: 16px; }
  .player { gap: 12px; }
  .pl-cover { width: 56px; height: 56px; }
  .pl-time { font-size: 13px; min-width: 30px; }
  .pl-line { gap: 7px; }
  .pl-ctrls { gap: 0; margin-left: 0; }
  .pl-ctrls button { width: 30px; height: 30px; }
  .volume { top: 12px; left: 12px; height: 50px; }
  .vol-btn { width: 50px; height: 50px; }
}

@media (max-height: 700px) and (min-width: 561px) {
  .stage { place-items: start center; }
}

@media (prefers-reduced-motion: reduce) {
  .bg-grain, .enter-text, .caret { animation: none; }
  .reveal, .profile { transition: none; }
}
