/* ─────────────────────────────────────────────────────────────────────────
   Party Queue — ночная «космическая» тема: чёрный фон со звёздами,
   неоновый градиент маджента → фиолет, крупная дисплейная типографика.
   ───────────────────────────────────────────────────────────────────────── */

:root {
  /* фон и поверхности */
  --bg: #08070b;
  --bg-soft: #0e0c15;
  --surface: rgba(255, 255, 255, 0.035);
  --surface-2: rgba(255, 255, 255, 0.07);
  --line: rgba(255, 255, 255, 0.09);
  --line-2: rgba(255, 255, 255, 0.18);

  /* текст */
  --text: #f4f2ee;
  --muted: rgba(244, 242, 238, 0.55);
  --dim: rgba(244, 242, 238, 0.35);

  /* акценты */
  --accent: #ff3d9a;
  --violet: #7b3ff2;
  --ok: #9fe870;
  --warn: #ffd84d;
  --cyan: #6bc9ff;
  --accent-soft: rgba(255, 61, 154, 0.12);
  --grad: linear-gradient(95deg, #ff4d9d 0%, #c13ff0 52%, #6b3ff2 100%);
  --grad-rainbow: linear-gradient(90deg, #ff4d9d, #c13ff0, #6b3ff2, #6bc9ff, #9fe870, #ffd84d);
  --glow: 0 12px 44px rgba(255, 61, 154, 0.28);

  /* геометрия */
  --radius: 22px;
  --radius-sm: 14px;

  /* шрифты */
  --font-display: 'Unbounded', 'Manrope', system-ui, sans-serif;
  --font: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-serif: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --font-hand: 'Caveat', 'Segoe Script', cursive;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ── фон: туманности + звёзды ───────────────────────────────────────────── */

body::before,
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

/* цветные пятна-туманности */
body::before {
  background:
    radial-gradient(60vw 46vh at 12% -6%, rgba(255, 61, 154, 0.20), transparent 70%),
    radial-gradient(52vw 40vh at 92% 6%, rgba(123, 63, 242, 0.20), transparent 70%),
    radial-gradient(70vw 50vh at 50% 108%, rgba(107, 201, 255, 0.10), transparent 70%),
    radial-gradient(40vw 34vh at 78% 72%, rgba(159, 232, 112, 0.07), transparent 70%);
}

/* звёздная пыль в три слоя */
body::after {
  background-image:
    radial-gradient(1.6px 1.6px at 24px 38px, rgba(255, 255, 255, 0.85), transparent),
    radial-gradient(1.2px 1.2px at 168px 96px, rgba(255, 199, 232, 0.75), transparent),
    radial-gradient(1.1px 1.1px at 96px 212px, rgba(255, 255, 255, 0.55), transparent),
    radial-gradient(1.4px 1.4px at 268px 152px, rgba(159, 232, 112, 0.55), transparent),
    radial-gradient(1px 1px at 330px 300px, rgba(107, 201, 255, 0.65), transparent),
    radial-gradient(1.3px 1.3px at 60px 330px, rgba(255, 255, 255, 0.5), transparent);
  background-size: 360px 360px, 420px 420px, 300px 300px, 520px 520px, 460px 460px, 380px 380px;
  opacity: 0.55;
  animation: twinkle 7s ease-in-out infinite alternate;
}

@keyframes twinkle {
  from { opacity: 0.35; }
  to   { opacity: 0.7; }
}

/* ── каркас ─────────────────────────────────────────────────────────────── */

.wrap {
  position: relative;
  z-index: 1;
  max-width: 760px;
  margin: 0 auto;
  padding: 28px 18px 120px;
}

/* верхний блок с героем не должен тянуть нижний отступ каркаса */
.wrap.head { padding-bottom: 0; }
.wrap.body { padding-top: 0; }

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

h1 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(30px, 7vw, 46px);
  line-height: 0.98;
  letter-spacing: -0.03em;
  margin: 0;
}

h2 {
  font-family: var(--font);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--muted);
  margin: 34px 0 12px;
}

a { color: var(--accent); text-decoration-color: rgba(255, 61, 154, 0.4); }

/* ── герой публичной страницы ───────────────────────────────────────────── */

.hero {
  display: block;
  text-align: center;
  padding: 26px 0 6px;
  margin-bottom: 18px;
}

.hero h1 {
  font-size: clamp(42px, 13vw, 84px);
  margin: 14px 0 10px;
}

/* «Очередь» — с градиентной заливкой букв */
.hero h1 .grad {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-sub {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: clamp(17px, 4.4vw, 23px);
  color: rgba(255, 216, 77, 0.9);
  margin: 0 auto 16px;
  max-width: 30ch;
}

.hero .status { margin-top: 4px; }

/* значок-пилюля над заголовком */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--text);
  background: rgba(255, 61, 154, 0.10);
  border: 1px solid rgba(255, 61, 154, 0.35);
  border-radius: 999px;
  padding: 7px 16px;
}
.badge::before { content: '✦'; color: var(--accent); letter-spacing: 0; }

/* ── бегущая строка ─────────────────────────────────────────────────────── */

.ticker {
  position: relative;
  z-index: 1;
  overflow: hidden;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, rgba(255, 61, 154, 0.10), rgba(123, 63, 242, 0.10));
  padding: 10px 0;
  margin: 8px 0 26px;
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}

.ticker-track {
  display: flex;
  width: max-content;
  animation: marquee 26s linear infinite;
}

.ticker span {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: rgba(244, 242, 238, 0.72);
  padding: 0 22px;
  white-space: nowrap;
}
.ticker span::after { content: '✦'; color: var(--accent); margin-left: 22px; }

@keyframes marquee {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* ── карточки-панели ────────────────────────────────────────────────────── */

.card {
  position: relative;
  /* Выше того, что идёт следом: из карточки выпадает список результатов,
     и очередь не должна его перекрывать. */
  z-index: 5;
  background:
    linear-gradient(165deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.015)),
    rgba(14, 12, 21, 0.72);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 18px;
  backdrop-filter: blur(14px);
}

/* Радужная полоска по верхней кромке — как на карточке RSVP.
   Фоновым слоем, а не ::before: скруглённые углы обрезают её сами, и карточке
   не нужен overflow: hidden, который срезал бы выпадающий список. */
.card.striped {
  background:
    var(--grad-rainbow) top left / 100% 3px no-repeat,
    linear-gradient(165deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.015)),
    rgba(14, 12, 21, 0.72);
}

.section-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 36px 0 14px;
}
.section-head h2 { margin: 0; white-space: nowrap; }
.section-head::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--line), transparent);
}

.count-chip {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 12px;
  color: var(--text);
  background: var(--accent-soft);
  border: 1px solid rgba(255, 61, 154, 0.35);
  border-radius: 999px;
  padding: 3px 11px;
  flex: none;
}

/* ── статус ─────────────────────────────────────────────────────────────── */

.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 14px;
  backdrop-filter: blur(10px);
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--dim);
  flex: none;
}
.dot.on {
  background: var(--ok);
  box-shadow: 0 0 0 0 rgba(159, 232, 112, 0.6);
  animation: pulse 1.8s ease-out infinite;
}
.dot.off { background: var(--accent); box-shadow: 0 0 10px rgba(255, 61, 154, 0.8); }

@keyframes pulse {
  70%  { box-shadow: 0 0 0 8px rgba(159, 232, 112, 0); }
  100% { box-shadow: 0 0 0 0 rgba(159, 232, 112, 0); }
}

/* ── поиск и поля ───────────────────────────────────────────────────────── */

.search-box { position: relative; }

/* ── выпадающий список результатов ──────────────────────────────────────── */

/* Пока в поле ищут, странице нужен запас снизу: иначе короткую страницу
   не прокрутить так, чтобы поле поднялось над клавиатурой. */
body.searching { padding-bottom: 70vh; }

/* Висит прямо под полем и перекрывает страницу: на телефоне список нужен
   рядом с полем, над клавиатурой. Высоту досчитывает JS по visualViewport. */
.dropdown {
  position: absolute;
  z-index: 40;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  max-height: 46vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 8px;
  /* Непрозрачный: сквозь полупрозрачный просвечивала очередь под ним. */
  background:
    linear-gradient(165deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.015)),
    #100d17;
  border: 1px solid var(--line-2);
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.7);
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

/* Внутри выпадашки карточки-в-карточке ни к чему: строки плоские. */
.dropdown li.track {
  background: none;
  border-color: transparent;
  border-radius: 14px;
}
.dropdown li.track:hover {
  background: rgba(255, 255, 255, 0.05);
  transform: none;
}

.dropdown .empty {
  border: none;
  padding: 20px 12px;
  font-size: 15px;
}

.field-label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--dim);
  margin: 0 0 8px 2px;
}

input[type='text'],
input[type='password'],
input[type='search'] {
  width: 100%;
  padding: 15px 17px;
  font: 500 16px/1.3 var(--font);
  color: var(--text);
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.16s, box-shadow 0.16s, background 0.16s;
  -webkit-appearance: none;
}
input:focus {
  border-color: rgba(255, 61, 154, 0.75);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 0 0 4px rgba(255, 61, 154, 0.14);
}
input::placeholder { color: var(--dim); font-weight: 400; }
input[type='search']::-webkit-search-cancel-button { filter: invert(1) opacity(0.5); }

.name-field { margin-top: 12px; }

.spinner {
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.16);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: translateY(-50%) rotate(360deg); } }

/* ── списки треков ──────────────────────────────────────────────────────── */

ul.list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

li.track {
  position: relative;
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 11px 14px;
  background:
    linear-gradient(165deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.012)),
    rgba(14, 12, 21, 0.6);
  border: 1px solid var(--line);
  border-radius: 18px;
  transition: transform 0.16s, border-color 0.16s, background 0.16s;
}
li.track:hover {
  border-color: var(--line-2);
  transform: translateY(-1px);
}

li.track.playing {
  border-color: rgba(255, 61, 154, 0.55);
  background:
    linear-gradient(100deg, rgba(255, 61, 154, 0.16), rgba(123, 63, 242, 0.12) 60%, transparent),
    rgba(14, 12, 21, 0.7);
  box-shadow: 0 10px 34px rgba(255, 61, 154, 0.16);
}
li.track.playing::before {
  content: '';
  position: absolute;
  left: 0;
  top: 14px;
  bottom: 14px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--grad);
}

li.track img {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  flex: none;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
}

.meta { min-width: 0; flex: 1; }

.title {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.by {
  font-family: var(--font-hand);
  font-size: 17px;
  line-height: 1;
  color: var(--warn);
}

.pos {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--dim);
  width: 26px;
  text-align: center;
  flex: none;
}
li.track.playing .pos { color: var(--accent); }

.now-badge {
  display: inline-block;
  margin-top: 3px;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ── кнопки ─────────────────────────────────────────────────────────────── */

button {
  font: 600 14px/1 var(--font);
  cursor: pointer;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: var(--surface-2);
  color: var(--text);
  padding: 11px 18px;
  transition: transform 0.14s, filter 0.14s, opacity 0.14s, box-shadow 0.14s;
}
button:hover { filter: brightness(1.35); transform: translateY(-1px); }
button:active { transform: translateY(0); }
button:disabled { opacity: 0.4; cursor: default; filter: none; transform: none; }

button.add {
  width: 44px;
  height: 44px;
  padding: 0;
  flex: none;
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  background: var(--grad);
  border: none;
  box-shadow: var(--glow);
}
button.add.done {
  background: rgba(159, 232, 112, 0.16);
  color: var(--ok);
  border: 1px solid rgba(159, 232, 112, 0.5);
  box-shadow: none;
}

button.icon {
  background: transparent;
  border: none;
  color: var(--dim);
  font-size: 18px;
  padding: 6px 8px;
  line-height: 1;
  box-shadow: none;
}
button.icon:hover { color: var(--accent); filter: none; }

button.transport {
  background: var(--surface-2);
  border-color: rgba(255, 61, 154, 0.45);
  font-weight: 700;
}

button.armed {
  background: var(--grad);
  border: none;
  color: #fff;
  box-shadow: var(--glow);
}

/* широкая кнопка-CTA с градиентом (логин, привязка плеера) */
.login button,
#gate .toolbar button.add,
#main .toolbar button.add {
  width: auto;
  height: auto;
  padding: 15px 26px;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  border-radius: 999px;
}

.toolbar {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
  margin: 16px 0;
}

/* ── drag & drop ────────────────────────────────────────────────────────── */

.handle {
  cursor: grab;
  color: var(--dim);
  font-size: 17px;
  padding: 0 2px;
  flex: none;
  user-select: none;
}
.handle:active { cursor: grabbing; }

li.track.dragging { opacity: 0.4; }
li.track.drop-above { box-shadow: 0 -2px 0 0 var(--accent); }
li.track.drop-below { box-shadow: 0 2px 0 0 var(--accent); }

/* ── прочее ─────────────────────────────────────────────────────────────── */

.empty {
  color: var(--muted);
  text-align: center;
  padding: 34px 18px;
  border: 1px dashed var(--line-2);
  border-radius: var(--radius);
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 17px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%) translateY(160%);
  background: rgba(20, 17, 28, 0.92);
  border: 1px solid var(--line-2);
  border-radius: 999px;
  padding: 13px 22px;
  font-size: 14px;
  font-weight: 600;
  transition: transform 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.3);
  z-index: 50;
  max-width: 90vw;
  text-align: center;
  backdrop-filter: blur(16px);
  box-shadow: 0 14px 44px rgba(0, 0, 0, 0.6);
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.err { border-color: rgba(255, 61, 154, 0.7); color: #ffd9e8; }

/* «Уже отыграло» — справочный блок, он не должен спорить с очередью. */
ul.list.history li.track { opacity: 0.55; }
ul.list.history li.track:hover { opacity: 1; }

.drift-log {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px;
  max-height: 220px;
  overflow: auto;
  white-space: pre-wrap;
}

.login {
  max-width: 380px;
  margin: 12vh auto;
  text-align: center;
}
.login h1 { margin-bottom: 8px; }
.login input { margin-top: 14px; text-align: center; }
.login button { width: 100%; margin-top: 12px; }

.hint {
  color: var(--muted);
  font-size: 14px;
}

/* рукописная ремарка */
.hand {
  font-family: var(--font-hand);
  font-size: 21px;
  line-height: 1.25;
  color: rgba(244, 242, 238, 0.72);
}

/* ── заряженный следующий трек ──────────────────────────────────────────── */

li.track.locked {
  border-color: rgba(255, 216, 77, 0.4);
  background:
    linear-gradient(100deg, rgba(255, 216, 77, 0.10), transparent 60%),
    rgba(14, 12, 21, 0.6);
}

.lock-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--warn);
  margin-top: 3px;
}

li.track.locked .handle {
  opacity: 0.25;
  cursor: not-allowed;
}

.warning {
  background: rgba(255, 216, 77, 0.10);
  border: 1px solid rgba(255, 216, 77, 0.45);
  border-radius: var(--radius-sm);
  padding: 13px 16px;
  margin-bottom: 16px;
  font-size: 14px;
}
.warning a { color: var(--warn); font-weight: 700; }

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

@media (max-width: 480px) {
  .wrap { padding: 20px 14px 110px; }
  .hero { padding-top: 14px; }
  li.track { padding: 10px 12px; gap: 11px; }
  li.track img { width: 46px; height: 46px; }
  .toolbar button { flex: 1 1 auto; }
}

@media (prefers-reduced-motion: reduce) {
  body::after { animation: none; }
  .ticker-track { animation: none; }
  .dot.on { animation: none; }
  * { transition-duration: 0.01ms !important; }
}
