:root {
  --bg: #0b0912;
  --surface: #15111f;
  --accent: #8b5cf6;
  --accent-soft: #a78bfa;
  --text: #ece8f6;
  --muted: #8d84a3;
  --font: "Segoe UI", "Inter", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-tap-highlight-color: transparent;
}

/* ---------- сцена ---------- */

.scene {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(60% 70% at 72% 45%, rgba(139, 92, 246, 0.16), transparent 70%),
    radial-gradient(40% 50% at 15% 85%, rgba(139, 92, 246, 0.07), transparent 70%),
    var(--bg);
}

.layer {
  position: absolute;
  inset: -40px;
  will-change: transform;
  transition: transform 0.25s ease-out;
}

.window {
  position: absolute;
  right: 12%;
  top: 14%;
  width: min(34vw, 460px);
  height: min(46vh, 420px);
  border-radius: 18px;
  border: 1px solid rgba(167, 139, 250, 0.18);
  background:
    radial-gradient(1px 1px at 20% 30%, #fff8, transparent),
    radial-gradient(1px 1px at 70% 20%, #fff6, transparent),
    radial-gradient(1.5px 1.5px at 45% 60%, #fff5, transparent),
    radial-gradient(1px 1px at 85% 70%, #fff7, transparent),
    radial-gradient(1px 1px at 30% 80%, #fff4, transparent),
    radial-gradient(1px 1px at 60% 45%, #fff6, transparent),
    linear-gradient(180deg, #120b24 0%, #1e1240 70%, #2a1650 100%);
  box-shadow: inset 0 0 60px rgba(0, 0, 0, 0.6), 0 0 80px rgba(139, 92, 246, 0.08);
  overflow: hidden;
}

/* переплёт окна */
.window::before, .window::after {
  content: "";
  position: absolute;
  background: rgba(11, 9, 18, 0.85);
}
.window::before { left: 50%; top: 0; bottom: 0; width: 6px; transform: translateX(-50%); }
.window::after { top: 50%; left: 0; right: 0; height: 6px; transform: translateY(-50%); }

.moon {
  position: absolute;
  right: 18%;
  top: 14%;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: #e9e1ff;
  box-shadow: 0 0 30px 6px rgba(200, 180, 255, 0.35);
  opacity: 0.85;
}

.neon {
  position: absolute;
  left: 6%;
  right: 6%;
  top: 7%;
  height: 3px;
  border-radius: 3px;
  background: var(--accent-soft);
  box-shadow: 0 0 12px 2px var(--accent), 0 0 60px 10px rgba(139, 92, 246, 0.35);
  animation: neon 7s infinite;
}

@keyframes neon {
  0%, 92%, 100% { opacity: 0.9; }
  93% { opacity: 0.35; }
  94% { opacity: 0.9; }
  95% { opacity: 0.5; }
}

.floor {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 28%;
  background: linear-gradient(180deg, transparent, rgba(21, 17, 31, 0.9));
  border-top: 1px solid rgba(167, 139, 250, 0.08);
}

#fx, #stage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

#stage { touch-action: none; }

/* ---------- облачко реплики ---------- */

.bubble {
  position: fixed;
  z-index: 5;
  max-width: 260px;
  padding: 10px 14px;
  border-radius: 16px;
  background: rgba(21, 17, 31, 0.92);
  border: 1px solid rgba(167, 139, 250, 0.35);
  box-shadow: 0 0 24px rgba(139, 92, 246, 0.25);
  font-size: 15px;
  line-height: 1.35;
  pointer-events: none;
  transform: translate(-50%, -100%);
  animation: pop 0.22s ease-out;
}

.bubble.angry {
  border-color: rgba(255, 80, 120, 0.6);
  box-shadow: 0 0 28px rgba(255, 60, 100, 0.35);
}

@keyframes pop {
  from { opacity: 0; transform: translate(-50%, -90%) scale(0.92); }
  to { opacity: 1; transform: translate(-50%, -100%) scale(1); }
}

/* ---------- меню ---------- */

.menu-wrap {
  position: fixed;
  z-index: 4;
  left: clamp(24px, 7vw, 120px);
  top: 50%;
  transform: translateY(-50%);
  transition: opacity 0.5s, transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.menu-wrap.away {
  opacity: 0;
  transform: translate(-40px, -50%);
  pointer-events: none;
}

.hint {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.menu {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  margin-top: 18px;
}

.menu button {
  appearance: none;
  border: 0;
  background: none;
  color: var(--text);
  opacity: 0.55;
  font: 600 clamp(22px, 2.4vw, 32px) / 1.2 var(--font);
  padding: 6px 0 14px;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.25s, color 0.2s, text-shadow 0.2s;
  text-align: left;
}

.menu button.active {
  opacity: 1;
  color: #fff;
  transform: translateX(10px);
  text-shadow: 0 0 18px rgba(167, 139, 250, 0.6);
}

/* «Продолжить»: компактная плашка, длинное название трека обрезается */
.menu button.resume {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  max-width: min(340px, 80vw);
  margin-bottom: 10px;
  padding: 8px 16px 8px 10px;
  border-radius: 999px;
  border: 1px solid rgba(167, 139, 250, 0.3);
  background: rgba(21, 17, 31, 0.95);
  font: 500 14px/1.2 var(--font);
  opacity: 0.9;
}

.menu button.resume.active {
  transform: none;
  text-shadow: none;
  opacity: 1;
  background: rgba(42, 26, 74, 0.9);
  box-shadow: 0 0 18px rgba(139, 92, 246, 0.35);
}

.resume-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent);
}

.resume-icon svg {
  display: block;
  width: 12px;
  height: 12px;
}

.resume-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.resume-title {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.menu button:focus-visible { outline: none; }

.underline {
  position: absolute;
  left: 0;
  top: 0;
  height: 24px;
  pointer-events: none;
  transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1), width 0.28s;
}

/* ---------- раздел-заглушка ---------- */

.section {
  position: fixed;
  z-index: 4;
  left: clamp(24px, 7vw, 120px);
  top: 50%;
  transform: translateY(-50%);
  max-width: 520px;
  animation: rise 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.section h1 {
  margin: 18px 0 10px;
  font-size: clamp(34px, 4vw, 56px);
}

.section p { color: var(--muted); }

.back {
  /* Закреплена сверху раздела: при прокрутке длинного раздела не уезжает. */
  position: sticky;
  top: 0;
  z-index: 2;
  appearance: none;
  border: 1px solid rgba(167, 139, 250, 0.3);
  background: rgba(21, 17, 31, 0.7);
  color: var(--text);
  border-radius: 999px;
  padding: 10px 18px;
  font: 500 15px var(--font);
  cursor: pointer;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(-40%); }
  to { opacity: 1; transform: translateY(-50%); }
}

/* ---------- полный плеер ---------- */

/* Отступ снизу, чтобы мини-плеер не закрывал конец раздела при прокрутке. */
.section.wide { max-height: calc(100vh - 40px); overflow-y: auto; scrollbar-width: none; padding-bottom: 110px; }
.section.wide h1 { margin-top: 14px; }

.player {
  width: min(460px, calc(100vw - 48px));
  padding: 20px 22px 14px;
  border-radius: 22px;
  background: rgba(21, 17, 31, 0.93);
  border: 1px solid rgba(167, 139, 250, 0.18);
}

.pl-name { font-size: 22px; font-weight: 700; }
.pl-artist { margin-top: 2px; color: var(--muted); font-size: 14px; }
.pl-wave { display: block; width: 100%; height: 28px; margin-top: 18px; cursor: pointer; touch-action: none; }

.pl-times {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.pl-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 12px 4px 4px;
}

.pl-btn {
  appearance: none;
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.pl-btn:hover { background: rgba(139, 92, 246, 0.14); }
.pl-btn svg { display: block; width: 22px; height: 22px; }
.pl-btn.big { width: 62px; height: 62px; background: var(--accent); box-shadow: 0 0 24px rgba(139, 92, 246, 0.5); }
.pl-btn.big svg { width: 28px; height: 28px; }
.pl-btn.small { width: 34px; height: 34px; }
.pl-btn.small svg { width: 18px; height: 18px; }
.pl-btn.off { color: var(--muted); }
.pl-btn.on { color: var(--accent-soft); }

.pl-volume { display: flex; align-items: center; gap: 8px; margin-top: 6px; }

.pl-volume input {
  flex: 1;
  accent-color: var(--accent);
  height: 4px;
}

.pl-list {
  list-style: none;
  margin: 12px 0 0;
  padding: 10px 0 0;
  border-top: 1px solid rgba(167, 139, 250, 0.12);
  max-height: 180px;
  overflow-y: auto;
}

.pl-list li {
  display: flex;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pl-list li:hover { background: rgba(139, 92, 246, 0.1); }
.pl-list li.current { color: var(--accent-soft); background: rgba(139, 92, 246, 0.14); }
.pl-list li span { color: var(--muted); }

/* ---------- главная, посты, проекты ---------- */

.view { width: min(480px, calc(100vw - 48px)); }

.card-arrow svg { display: block; width: 18px; height: 18px; }

.projects { display: grid; gap: 10px; }

.card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(21, 17, 31, 0.93);
  border: 1px solid rgba(167, 139, 250, 0.16);
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.2s, background 0.2s, transform 0.2s;
}
a.card:hover { border-color: rgba(167, 139, 250, 0.45); background: rgba(42, 26, 74, 0.8); transform: translateX(4px); }
.card-text { flex: 1; min-width: 0; }
.card-title { font-weight: 600; font-size: 16px; }
.card-sub { margin-top: 2px; color: var(--muted); font-size: 13px; }
.card-arrow { color: var(--accent-soft); }

.tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.tab {
  appearance: none;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(167, 139, 250, 0.2);
  background: rgba(21, 17, 31, 0.7);
  color: var(--muted);
  font: 500 13px var(--font);
  cursor: pointer;
}
.tab.on { color: #fff; background: rgba(139, 92, 246, 0.3); border-color: rgba(167, 139, 250, 0.5); }

/* На время загрузки бледнеет содержимое, а не сама карточка. */
.post {
  padding: 12px;
  border-radius: 20px;
  background: rgba(21, 17, 31, 0.94);
  border: 1px solid rgba(167, 139, 250, 0.16);
}
.post > * { transition: opacity 0.2s; }
.post.loading > * { opacity: 0.4; }
.post-media { position: relative; border-radius: 14px; overflow: hidden; background: #0003; }
.post-media img { display: block; width: 100%; max-height: 52vh; object-fit: contain; }
.post-media.album { cursor: pointer; }
.dots { position: absolute; left: 0; right: 0; bottom: 8px; display: flex; justify-content: center; gap: 6px; }
.dots span { width: 7px; height: 7px; border-radius: 50%; background: #fff6; }
.dots span.on { background: #fff; }
.post-caption { margin: 12px 4px 0; font-size: 15px; line-height: 1.45; overflow-wrap: anywhere; }
.post-caption:empty { display: none; }
.post-caption a { color: var(--accent-soft); }
.post-caption blockquote { margin: 6px 0; padding-left: 10px; border-left: 3px solid var(--accent); color: var(--muted); }
.post-caption code, .post-caption pre { font-family: Consolas, monospace; background: #ffffff12; border-radius: 4px; padding: 0 4px; }
.spoiler { background: var(--muted); color: transparent; border-radius: 4px; cursor: pointer; transition: all 0.25s; }
.spoiler.open { background: transparent; color: inherit; }
.post-meta { margin: 6px 4px 0; color: var(--muted); font-size: 12px; }
.post-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.btn {
  appearance: none;
  padding: 9px 14px;
  border-radius: 12px;
  border: 1px solid rgba(167, 139, 250, 0.25);
  background: transparent;
  color: var(--text);
  font: 500 14px var(--font);
  text-decoration: none;
  cursor: pointer;
}
.btn.primary { background: var(--accent); border-color: var(--accent); }
.empty { margin: 8px; color: var(--muted); }

/* ---------- мини-плеер ---------- */

.mini {
  position: fixed;
  z-index: 6;
  left: 50%;
  bottom: max(16px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(560px, calc(100vw - 32px));
  padding: 10px 16px 12px;
  border-radius: 18px;
  background: rgba(21, 17, 31, 0.96);
  border: 1px solid rgba(167, 139, 250, 0.2);
  animation: slideup 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes slideup {
  from { opacity: 0; transform: translate(-50%, 30px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.mini-wave {
  display: block;
  width: 100%;
  height: 24px;
  cursor: pointer;
}

.mini-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mini-title {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mini-btn {
  appearance: none;
  border: 0;
  flex: none;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  background: rgba(139, 92, 246, 0.18);
  color: var(--text);
  cursor: pointer;
}

.mini-btn svg {
  display: block;
  width: 18px;
  height: 18px;
}

.mini-close {
  background: transparent;
  color: var(--muted);
}

.mini.closing {
  animation: slidedown 0.35s ease-in forwards;
}

@keyframes slidedown {
  to { opacity: 0; transform: translate(-50%, 30px); }
}

/* ---------- служебное ---------- */

/* Только по id: класс .loading есть и у карточки поста. */
#loading {
  position: fixed;
  z-index: 3;
  right: 22%;
  top: 50%;
  color: var(--muted);
  font-size: 14px;
  letter-spacing: 0.1em;
  animation: blink 1.6s infinite;
}

#loading.done { display: none; }

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

.credits {
  position: fixed;
  z-index: 2;
  right: 14px;
  bottom: 10px;
  max-width: 60vw;
  text-align: right;
  font-size: 11px;
  color: rgba(141, 132, 163, 0.7);
}

.credits a { color: inherit; }

body.entered .credits { display: none; }

/* ---------- телефон: Мику сверху, меню снизу ---------- */

@media (max-width: 760px), (orientation: portrait) {
  .window { right: 8%; top: 8%; width: 70vw; height: 32vh; }
  .menu-wrap {
    left: 24px;
    right: 24px;
    top: auto;
    bottom: max(56px, calc(env(safe-area-inset-bottom) + 40px));
    transform: none;
  }
  .menu-wrap.away { transform: translateY(30px); }
  .menu { margin-top: 10px; gap: 0; }
  .menu button { font-size: 21px; padding: 4px 0 10px; }
  #loading { right: auto; left: 50%; top: 28%; transform: translateX(-50%); }
  .credits { left: 14px; right: 14px; max-width: none; text-align: center; font-size: 10px; }
  .section { left: 24px; right: 24px; top: auto; bottom: 120px; transform: none; animation: none; }
  .section.wide { top: 30vh; bottom: 16px; max-height: none; }
  .player, .view { width: 100%; }
}

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