/* =========================================================
   Sona — заставка / светомузыка
   Полноэкранный оверлей поверх канваса со «хромом» интерфейса.
   Все правила изолированы префиксом .vis / #sona-visualizer.
   ========================================================= */

.vis {
  --vis-accent: var(--accent, #b8f45c);
  --vis-accent-strong: var(--accent-strong, #c9ff78);
  --vis-ink: var(--accent-ink, #0a0c07);
  --vis-text: var(--text, #f5f5f2);
  --vis-text-2: var(--text-2, #b7b7bf);
  --vis-muted: var(--muted, #8a8a94);
  --vis-border: var(--border, rgba(255, 255, 255, 0.085));
  --vis-ease: var(--ease, cubic-bezier(0.22, 1, 0.36, 1));
  --vis-font: var(--font, "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif);

  position: fixed;
  inset: 0;
  z-index: 600;
  display: block;
  overflow: hidden;
  background: #000;
  color: var(--vis-text);
  font-family: var(--vis-font);
  cursor: default;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  animation: vis-fade-in 0.45s var(--vis-ease) both;
}

/* глубокая виньетка — придаёт картинке объём */
.vis::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(125% 95% at 50% 46%, transparent 52%, rgba(0, 0, 0, 0.55) 100%);
}

.vis.is-idle { cursor: none; }

@keyframes vis-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

body.vis-open { overflow: hidden; }

/* ---------------- canvas ---------------- */

.vis__canvas {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: block;
  width: 100%;
  height: 100%;
  background: #000;
}

/* ---------------- «хром» ---------------- */

.vis__chrome {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 1;
  transform: none;
  transition:
    opacity 0.55s var(--vis-ease),
    transform 0.55s var(--vis-ease);
}

.vis.is-idle .vis__chrome {
  opacity: 0;
  transform: translateY(6px);
}

.vis__chrome button { pointer-events: auto; }

.vis button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

.vis button:focus-visible {
  outline: 2px solid var(--vis-accent);
  outline-offset: 3px;
}

/* ---------------- верхняя панель ---------------- */

.vis__top {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: clamp(16px, 3vw, 34px) clamp(16px, 3vw, 38px) 56px;
  pointer-events: none;
  background: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0.78),
    rgba(0, 0, 0, 0.42) 52%,
    rgba(0, 0, 0, 0) 100%
  );
}

.vis__top > * { pointer-events: auto; }

.vis__track {
  display: flex;
  align-items: center;
  gap: clamp(10px, 1.4vw, 16px);
  min-width: 0;
}

.vis__cover {
  position: relative;
  flex: none;
  width: clamp(46px, 5vw, 64px);
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 14px;
  border: 1px solid var(--vis-border);
  background:
    linear-gradient(145deg, rgba(184, 244, 92, 0.22), rgba(177, 140, 255, 0.16)),
    rgba(255, 255, 255, 0.04);
  box-shadow:
    0 14px 34px rgba(0, 0, 0, 0.55),
    inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.vis__cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.vis__cover-letter {
  font-size: clamp(20px, 2.4vw, 26px);
  font-weight: 700;
  color: var(--vis-accent);
  text-shadow: 0 0 20px rgba(184, 244, 92, 0.55);
}

.vis__meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.vis__title {
  margin: 0;
  max-width: min(54vw, 620px);
  font-size: clamp(15px, 1.6vw, 20px);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--vis-text);
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.7);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vis__artist {
  margin: 0;
  max-width: min(54vw, 620px);
  font-size: clamp(12px, 1.1vw, 14px);
  color: var(--vis-muted);
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.65);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vis__top-right {
  display: flex;
  align-items: center;
  gap: clamp(10px, 1.4vw, 16px);
  flex: none;
}

.vis__mode-name {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(245, 245, 242, 0.6);
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.7);
  white-space: nowrap;
}

.vis__close {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 22px;
  line-height: 1;
  color: #e9e9ee;
  background: rgba(10, 10, 14, 0.58);
  border: 1px solid rgba(255, 255, 255, 0.16);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  transition:
    transform 0.3s var(--vis-ease),
    background 0.3s var(--vis-ease),
    color 0.3s var(--vis-ease),
    border-color 0.3s var(--vis-ease);
}

.vis__close:hover {
  background: rgba(255, 107, 139, 0.18);
  border-color: rgba(255, 107, 139, 0.45);
  color: #fff;
  transform: rotate(90deg);
}

/* ---------------- нижний док ---------------- */

.vis__dock {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(10px, 1.6vw, 16px);
  padding: clamp(18px, 3vw, 34px) clamp(14px, 3vw, 32px) clamp(14px, 2.4vw, 26px);
  pointer-events: none;
  background: linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.88),
    rgba(0, 0, 0, 0.52) 55%,
    rgba(0, 0, 0, 0) 100%
  );
}

.vis__dock > * { pointer-events: auto; }

.vis__modes {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  max-width: min(940px, 92vw);
  max-height: 40vh;
  overflow: auto;
  padding: 2px;
  scrollbar-width: none;
}

.vis__modes::-webkit-scrollbar { display: none; }

.vis__pill {
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  color: var(--vis-text-2);
  background: rgba(10, 10, 14, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.14);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  white-space: nowrap;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.6);
  transition:
    color 0.25s var(--vis-ease),
    background 0.25s var(--vis-ease),
    border-color 0.25s var(--vis-ease),
    transform 0.25s var(--vis-ease),
    box-shadow 0.25s var(--vis-ease);
}

.vis__pill:hover {
  color: #fff;
  background: rgba(18, 18, 24, 0.78);
  transform: translateY(-1px);
}

.vis__pill.is-active {
  color: var(--vis-ink);
  background: linear-gradient(135deg, var(--vis-accent-strong), var(--vis-accent));
  border-color: transparent;
  text-shadow: none;
  box-shadow:
    0 0 0 1px rgba(184, 244, 92, 0.35),
    0 10px 28px rgba(184, 244, 92, 0.22);
}

.vis__controls {
  display: flex;
  align-items: center;
  gap: clamp(10px, 1.4vw, 16px);
}

.vis__btn {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--vis-text);
  background: rgba(10, 10, 14, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.16);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  transition:
    transform 0.25s var(--vis-ease),
    background 0.25s var(--vis-ease),
    color 0.25s var(--vis-ease),
    border-color 0.25s var(--vis-ease),
    box-shadow 0.25s var(--vis-ease);
}

.vis__btn svg {
  display: block;
  width: 20px;
  height: 20px;
}

.vis__btn:hover {
  color: #fff;
  background: rgba(184, 244, 92, 0.16);
  border-color: rgba(184, 244, 92, 0.4);
  transform: translateY(-2px);
}

.vis__btn--play {
  width: 58px;
  height: 58px;
  color: var(--vis-ink);
  background: linear-gradient(140deg, var(--vis-accent), rgba(184, 244, 92, 0.72));
  border-color: transparent;
  box-shadow: 0 12px 30px rgba(184, 244, 92, 0.28);
}

.vis__btn--play svg {
  width: 24px;
  height: 24px;
}

.vis__btn--play:hover {
  color: var(--vis-ink);
  background: linear-gradient(140deg, var(--vis-accent-strong), var(--vis-accent));
  transform: translateY(-2px) scale(1.04);
}

.vis__hint {
  margin: 0;
  font-size: 11.5px;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.46);
  text-align: center;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.8);
}

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

@media (max-width: 720px) {
  .vis__top {
    padding: 14px 14px 40px;
  }

  .vis__mode-name { display: none; }

  .vis__title,
  .vis__artist { max-width: 62vw; }

  .vis__modes {
    flex-wrap: nowrap;
    justify-content: flex-start;
    max-width: 94vw;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 14px, #000 calc(100% - 14px), transparent);
    mask-image: linear-gradient(90deg, transparent, #000 14px, #000 calc(100% - 14px), transparent);
  }

  .vis__pill { flex: none; }
}

@media (max-width: 520px) {
  .vis__dock {
    gap: 12px;
    padding: 16px 12px calc(12px + env(safe-area-inset-bottom, 0px));
  }

  .vis__hint { display: none; }
  .vis__btn { width: 42px; height: 42px; }
  .vis__btn--play { width: 54px; height: 54px; }
}

@media (max-height: 520px) {
  .vis__hint { display: none; }
  .vis__cover { width: 42px; }
  .vis__meta { gap: 1px; }
}

/* ---------------- уважение к reduced motion ---------------- */

@media (prefers-reduced-motion: reduce) {
  .vis {
    animation: none;
  }

  .vis__chrome,
  .vis__pill,
  .vis__btn,
  .vis__close {
    transition-duration: 0.01ms;
  }
}
