:root {
  --bg: #07080f;
  --glass: rgba(18, 22, 36, 0.72);
  --glass-border: rgba(255, 255, 255, 0.08);
  --text: #f4f6fb;
  --muted: #8b93ab;
  --accent: #6d8bff;
  --accent2: #b06cff;
  --music: #ff6bb5;
  --music2: #ff9a5c;
  --yt: #ff4d4d;
  --tt: #25f4ee;
  --vk: #4d7cff;
  --ok: #3dd68c;
  --err: #ff6b7a;
  --radius: 18px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "Inter", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

.bg-mesh {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 80% 50% at 20% -10%, rgba(109, 139, 255, 0.28), transparent 55%),
    radial-gradient(ellipse 60% 40% at 90% 10%, rgba(176, 108, 255, 0.22), transparent 50%),
    radial-gradient(ellipse 50% 30% at 50% 100%, rgba(37, 244, 238, 0.08), transparent 55%);
}
.bg-grid {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: .35;
  background-image: linear-gradient(rgba(255,255,255,.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.03) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at center, black 20%, transparent 75%);
}

.page {
  position: relative; z-index: 1;
  max-width: 680px; margin: 0 auto; padding: 20px 16px 56px;
}

.glass {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-radius: 999px; margin-bottom: 36px;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--text); font-weight: 700; font-size: 1.05rem;
}
.brand-icon {
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: grid; place-items: center; font-size: .95rem;
}
.brand-dim { color: var(--muted); font-weight: 500; }
.auth-box { display: flex; align-items: center; gap: 8px; }
.user-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px; border-radius: 999px;
  background: rgba(255,255,255,.05); border: 1px solid var(--glass-border);
}
.user-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--ok); box-shadow: 0 0 10px var(--ok);
}
.auth-user { font-size: .88rem; font-weight: 500; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.hero { text-align: center; margin-bottom: 28px; }
.hero h1 {
  margin: 16px 0 12px; font-size: clamp(1.9rem, 5vw, 2.6rem);
  font-weight: 700; letter-spacing: -0.03em; line-height: 1.15;
}
.gradient-text {
  background: linear-gradient(135deg, #a8c0ff, #c8a8ff, #7ee8fa);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-sub { color: var(--muted); margin: 0; font-size: 1rem; max-width: 420px; margin-inline: auto; }
.platforms { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
.pill {
  font-size: .75rem; font-weight: 600; letter-spacing: .02em;
  padding: 5px 12px; border-radius: 999px; border: 1px solid transparent;
}
.pill.yt { background: rgba(255,77,77,.12); color: #ff8a8a; border-color: rgba(255,77,77,.25); }
.pill.tt { background: rgba(37,244,238,.1); color: #7af8f4; border-color: rgba(37,244,238,.22); }
.pill.vk { background: rgba(77,124,255,.12); color: #8eb0ff; border-color: rgba(77,124,255,.25); }
.pill.mp3 { background: rgba(255,107,181,.12); color: #ffb8dc; border-color: rgba(255,107,181,.25); }

.card { border-radius: var(--radius); padding: 24px; }
.auth-card { text-align: center; margin-bottom: 20px; }
.auth-card h2 { margin: 12px 0 8px; font-size: 1.35rem; }
.auth-card p { color: var(--muted); margin: 0 0 20px; }
.auth-icon { font-size: 2rem; }
.main-card.locked { opacity: .4; pointer-events: none; filter: grayscale(.3); }

.label { font-size: .82rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.field { display: grid; gap: 10px; margin-bottom: 20px; }
.input-wrap {
  display: flex; align-items: center; gap: 10px;
  background: rgba(0,0,0,.28); border: 1px solid var(--glass-border);
  border-radius: 14px; padding: 4px 14px; transition: border-color .2s, box-shadow .2s;
}
.input-wrap:focus-within {
  border-color: rgba(109, 139, 255, .5);
  box-shadow: 0 0 0 3px rgba(109, 139, 255, .12);
}
.input-icon { opacity: .5; font-size: 1rem; flex-shrink: 0; }
input[type="url"], input[type="text"] {
  flex: 1; border: 0; background: transparent; color: var(--text);
  font: inherit; font-size: 1rem; padding: 12px 0; outline: none; min-width: 0;
}
input::placeholder { color: #5c6478; }

.vk-panel {
  margin-bottom: 20px; padding: 16px; border-radius: 14px;
  background: rgba(77, 124, 255, .06); border: 1px solid rgba(77, 124, 255, .15);
}
.vk-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 10px; }
.vk-desc { margin: 4px 0 0; font-size: .85rem; color: var(--muted); line-height: 1.45; }
.vk-badge {
  font-size: .75rem; font-weight: 600; padding: 4px 10px; border-radius: 999px;
  background: rgba(61, 214, 140, .15); color: var(--ok); border: 1px solid rgba(61, 214, 140, .3);
  white-space: nowrap;
}
.vk-badge.hidden { display: none; }
.vk-hint { margin: 0 0 10px; font-size: .82rem; color: var(--muted); }
.vk-app-list { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.vk-app-btn {
  display: inline-flex; align-items: center; padding: 7px 12px; border-radius: 999px;
  font-size: .82rem; font-weight: 600; text-decoration: none; color: var(--text);
  background: rgba(255,255,255,.05); border: 1px solid rgba(77, 124, 255, .2);
  transition: background .15s, border-color .15s;
}
.vk-app-btn:hover { background: rgba(77, 124, 255, .12); border-color: rgba(77, 124, 255, .45); }
.vk-app-btn.recommended {
  border-color: rgba(61, 214, 140, .45);
  background: rgba(61, 214, 140, .08);
}
.vk-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; align-items: center; }
.vk-oauth-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.vk-advanced.open > summary { color: var(--accent, #a78bfa); }
.vk-bookmarklet { cursor: grab; }
.vk-oauth-btn {
  display: flex; width: 100%; justify-content: center; margin-bottom: 12px;
  background: linear-gradient(135deg, #4d7cff, #6d8bff);
}
.vk-advanced { margin-top: 8px; font-size: .85rem; color: var(--muted); }
.vk-advanced summary { cursor: pointer; padding: 8px 0; user-select: none; }
.vk-advanced[open] summary { margin-bottom: 8px; }
.vk-notice {
  margin: 0 0 12px; padding: 10px 12px; border-radius: 10px; font-size: .88rem; line-height: 1.45;
}
.vk-connect-row { margin-top: 12px; }
.vk-notice a { color: var(--accent, #a78bfa); text-decoration: underline; }
.vk-notice.hidden { display: none; }
.vk-remixsid.open { margin-top: 14px; padding-top: 14px; border-top: 1px solid rgba(77,124,255,.12); }
.vk-remixsid .label { display: block; margin-bottom: 8px; }
.vk-desc code { font-size: .8em; color: #a8b8ff; }
.danger-text { color: var(--err) !important; }

.btn {
  border: 0; border-radius: 12px; padding: 11px 18px; font-weight: 600;
  cursor: pointer; font-size: .92rem; font-family: inherit;
  text-decoration: none; display: inline-flex; align-items: center; justify-content: center;
  transition: transform .15s, opacity .15s, background .15s;
}
.btn:active { transform: scale(.98); }
.btn.sm { padding: 8px 14px; font-size: .85rem; border-radius: 10px; }
.btn.lg { width: 100%; padding: 15px 20px; font-size: 1rem; border-radius: 14px; }
.btn.primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent2) 100%);
  color: #fff; box-shadow: 0 8px 28px rgba(109, 139, 255, .35);
}
.btn.primary:hover { box-shadow: 0 10px 32px rgba(109, 139, 255, .45); }
.btn.primary:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn.ghost {
  background: rgba(255,255,255,.05); color: var(--text);
  border: 1px solid var(--glass-border);
}
.btn.ghost:hover { background: rgba(255,255,255,.09); }

.btn-spinner {
  width: 20px; height: 20px; border: 2px solid rgba(255,255,255,.3);
  border-top-color: #fff; border-radius: 50%;
  animation: spin .7s linear infinite;
}
.btn-spinner.hidden, .btn-text.hidden { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

.status { min-height: 1.3em; margin: 14px 0 0; font-size: .92rem; text-align: center; }
.status.err { color: var(--err); }
.status.ok { color: var(--ok); }

.results { margin-top: 24px; display: grid; gap: 16px; }
.results.hidden { display: none; }
.video-card {
  display: grid; grid-template-columns: 140px 1fr; gap: 16px;
  padding: 16px; border-radius: var(--radius);
}
.thumb {
  width: 140px; aspect-ratio: 16/9; object-fit: cover; border-radius: 12px;
  background: rgba(0,0,0,.3); border: 1px solid var(--glass-border);
}
.meta h3 { margin: 0 0 6px; font-size: 1rem; line-height: 1.35; font-weight: 600; }
.meta p { margin: 0; color: var(--muted); font-size: .85rem; }
.formats { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 8px; }
.fmt-btn {
  text-decoration: none; color: var(--text);
  background: rgba(255,255,255,.06); border: 1px solid var(--glass-border);
  border-radius: 10px; padding: 8px 12px; font-size: .82rem; font-weight: 500;
  transition: border-color .15s, background .15s;
  font-family: inherit; cursor: pointer;
}
.fmt-btn:disabled { opacity: .55; cursor: wait; }
.fmt-btn:hover { border-color: var(--accent); background: rgba(109, 139, 255, .12); }

.footer { text-align: center; margin-top: 40px; }
.footer a { color: var(--muted); text-decoration: none; font-size: .88rem; }
.footer a:hover { color: var(--text); }

.hidden { display: none !important; }

.section-tabs {
  display: flex; gap: 8px; justify-content: center; margin-bottom: 20px;
  padding: 6px; border-radius: 999px;
  background: rgba(0,0,0,.22); border: 1px solid var(--glass-border);
  width: fit-content; margin-inline: auto;
}
.section-tab {
  border: 0; background: transparent; color: var(--muted);
  font: inherit; font-weight: 600; font-size: .9rem;
  padding: 10px 18px; border-radius: 999px; cursor: pointer;
  transition: background .2s, color .2s, box-shadow .2s;
}
.section-tab:hover { color: var(--text); }
.section-tab.active {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  box-shadow: 0 6px 20px rgba(109, 139, 255, .28);
}
.section-tab[data-panel="music"].active {
  background: linear-gradient(135deg, var(--music), var(--music2));
  box-shadow: 0 6px 20px rgba(255, 107, 181, .28);
}
.panel { display: none; }
.panel.active { display: block; }

.music-card {
  background:
    linear-gradient(145deg, rgba(255, 107, 181, .08), rgba(255, 154, 92, .04)),
    var(--glass);
  border-color: rgba(255, 107, 181, .18);
}
.music-card.locked { opacity: .4; pointer-events: none; filter: grayscale(.3); }
.music-head { display: flex; gap: 16px; align-items: center; margin-bottom: 20px; }
.music-icon-wrap {
  width: 52px; height: 52px; border-radius: 16px; flex-shrink: 0;
  display: grid; place-items: center; font-size: 1.5rem;
  background: linear-gradient(135deg, rgba(255, 107, 181, .25), rgba(255, 154, 92, .2));
  border: 1px solid rgba(255, 107, 181, .3);
  box-shadow: 0 8px 24px rgba(255, 107, 181, .15);
}
.music-title { margin: 0 0 4px; font-size: 1.25rem; font-weight: 700; }
.music-sub { margin: 0; color: var(--muted); font-size: .9rem; }
.music-input:focus-within {
  border-color: rgba(255, 107, 181, .45);
  box-shadow: 0 0 0 3px rgba(255, 107, 181, .12);
}
.btn.music {
  background: linear-gradient(135deg, var(--music) 0%, var(--music2) 100%);
  color: #fff; box-shadow: 0 8px 28px rgba(255, 107, 181, .32);
}
.btn.music:hover { box-shadow: 0 10px 32px rgba(255, 107, 181, .42); }
.music-auth { border-color: rgba(255, 107, 181, .15); }

.music-results { margin-top: 20px; display: grid; gap: 12px; }
.music-results.hidden { display: none; }
.music-results-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 0 4px 4px;
}
.music-results-head h3 { margin: 0; font-size: 1rem; font-weight: 600; }
.music-results-head span { color: var(--muted); font-size: .85rem; }
.track-card {
  display: grid; grid-template-columns: 72px 1fr auto; gap: 14px; align-items: center;
  padding: 14px; border-radius: 16px;
  background: rgba(0,0,0,.2); border: 1px solid rgba(255, 107, 181, .12);
  transition: border-color .2s, transform .15s;
}
.track-card:hover { border-color: rgba(255, 107, 181, .28); }
.track-cover {
  width: 72px; height: 72px; border-radius: 12px; object-fit: cover;
  background: rgba(255,255,255,.05); border: 1px solid var(--glass-border);
}
.track-meta { min-width: 0; }
.track-title {
  margin: 0 0 4px; font-size: .95rem; font-weight: 600; line-height: 1.35;
  overflow: hidden; text-overflow: ellipsis; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.track-artist { margin: 0; color: var(--muted); font-size: .84rem; }
.track-duration {
  display: inline-flex; margin-top: 6px; font-size: .75rem; font-weight: 600;
  padding: 3px 8px; border-radius: 999px;
  background: rgba(255,255,255,.06); color: #d4a8c4;
}
.track-dl {
  flex-shrink: 0; white-space: nowrap;
  background: rgba(255, 107, 181, .14); border: 1px solid rgba(255, 107, 181, .28);
  color: #ffd4ec; border-radius: 12px; padding: 10px 14px;
  font-size: .82rem; font-weight: 600; cursor: pointer; font-family: inherit;
  transition: background .15s, border-color .15s;
}
.track-dl:hover { background: rgba(255, 107, 181, .22); border-color: rgba(255, 107, 181, .45); }
.track-dl:disabled { opacity: .55; cursor: wait; }

@media (max-width: 560px) {
  .topbar { border-radius: var(--radius); }
  .video-card { grid-template-columns: 1fr; }
  .thumb { width: 100%; }
  .user-chip { display: none; }
  .track-card { grid-template-columns: 56px 1fr; }
  .track-cover { width: 56px; height: 56px; }
  .track-dl { grid-column: 1 / -1; width: 100%; text-align: center; }
}
