/* Colors follow the Telegram theme (its --tg-theme-* variables), with a dark fallback. */
:root {
  --bg: var(--tg-theme-bg-color, #0d0d12);
  --bg2: var(--tg-theme-secondary-bg-color, #16161e);
  --text: var(--tg-theme-text-color, #f3f3f7);
  --hint: var(--tg-theme-hint-color, #8d8d9a);
  --accent: #8b5cf6;
  --accent-2: #ec4899;
  --ok: #22c55e;
  --bad: #ef4444;
  --card: rgba(255, 255, 255, .05);
  --line: rgba(255, 255, 255, .08);
  --card: color-mix(in srgb, var(--text) 6%, transparent);
  --line: color-mix(in srgb, var(--text) 9%, transparent);
  --grad: linear-gradient(135deg, var(--accent), var(--accent-2));
  --radius: 14px;
  --tabbar: 64px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 15px/1.35 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  overscroll-behavior-y: none;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
[hidden] { display: none !important; }

#app { padding-bottom: calc(var(--tabbar) + var(--safe-bottom) + 16px); }
body.with-player #app { padding-bottom: calc(var(--tabbar) + var(--safe-bottom) + 88px); }
.content { padding: 0 12px; }
.page-title { font-size: 28px; font-weight: 800; letter-spacing: -.5px; margin: 0; padding: 20px 16px 12px; }

/* search header */
.top {
  position: sticky; top: 0; z-index: 5;
  padding: 12px 12px 10px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
}
.search {
  display: flex; align-items: center; gap: 10px;
  height: 46px; padding: 0 12px 0 14px;
  background: var(--bg2); border: 1px solid var(--line); border-radius: 23px;
  transition: border-color .2s, box-shadow .2s;
}
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 20%, transparent); }
.search > svg { color: var(--hint); width: 20px; height: 20px; }
.search input {
  flex: 1; min-width: 0; height: 100%;
  background: none; border: 0; outline: 0; color: var(--text); font: inherit; font-size: 16px;
}
.search input::placeholder { color: var(--hint); }
.search input::-webkit-search-cancel-button { display: none; }
.clear { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--card); color: var(--hint); }
.clear svg { width: 14px; height: 14px; stroke-width: 2.5; }

.sources { display: flex; gap: 8px; margin-top: 10px; overflow-x: auto; scrollbar-width: none; }
.sources::-webkit-scrollbar { display: none; }
.pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 14px; border-radius: 99px;
  background: var(--card); color: var(--hint); font-weight: 600; font-size: 14px; white-space: nowrap;
  transition: background .2s, color .2s, transform .1s;
}
.pill:active { transform: scale(.96); }
.pill .dot { width: 8px; height: 8px; border-radius: 50%; }
.pill.active { background: var(--text); color: var(--bg); }
.dot.yt { background: #ff3b30; } .dot.sp { background: #1ed760; } .dot.vk { background: #2787f5; }

/* sections */
.section-title { display: flex; align-items: baseline; justify-content: space-between; margin: 18px 4px 8px; font-weight: 700; font-size: 17px; }
.section-title small { color: var(--hint); font-weight: 500; font-size: 13px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 4px; }
.chip { padding: 7px 12px; border-radius: 10px; background: var(--card); font-size: 14px; }

/* track rows */
.list { display: flex; flex-direction: column; }
.track {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 6px; border-radius: var(--radius);
  animation: rise .35s both; animation-delay: calc(var(--i, 0) * 25ms);
}
.track:active { background: var(--card); }
.track.playing .t { color: var(--accent); }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }

.cover {
  position: relative; width: 52px; height: 52px; border-radius: 10px; overflow: hidden; flex: none;
  background: var(--grad);
  display: grid; place-items: center; color: #fff;
}
.cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cover-play {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: rgba(0, 0, 0, .35); opacity: 0; transition: opacity .2s;
}
.cover-play svg { fill: #fff; stroke: none; width: 20px; height: 20px; }
.track:hover .cover-play, .track.playing .cover-play { opacity: 1; }
.eq { display: none; gap: 3px; align-items: flex-end; height: 16px; }
.eq i { width: 3px; background: #fff; border-radius: 2px; animation: eq .9s infinite ease-in-out alternate; }
.eq i:nth-child(2) { animation-delay: -.3s; } .eq i:nth-child(3) { animation-delay: -.6s; }
@keyframes eq { from { height: 4px; } to { height: 16px; } }
.track.playing .cover-play svg { display: none; }
.track.playing .eq { display: flex; }
.track.playing.paused .eq i { animation-play-state: paused; }

.meta { flex: 1; min-width: 0; cursor: pointer; }
.t, .s { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t { font-weight: 600; }
.s { color: var(--hint); font-size: 13px; margin-top: 2px; display: flex; align-items: center; gap: 6px; }
.s .dot { width: 6px; height: 6px; border-radius: 50%; flex: none; }

.fav, .dl { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; flex: none; color: var(--hint); }
.fav:active, .dl:active { transform: scale(.9); }
.fav.on { color: var(--accent-2); }
.fav.on svg { fill: currentColor; }

/* download button: idle -> queued -> running (ring) -> done | error */
.dl { position: relative; background: var(--card); color: var(--text); }
.dl svg { width: 20px; height: 20px; }
.dl .ring {
  position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(var(--accent) calc(var(--p, 0) * 1turn), transparent 0);
  -webkit-mask: radial-gradient(circle, transparent 15px, #000 16px);
  mask: radial-gradient(circle, transparent 15px, #000 16px);
  opacity: 0; transition: opacity .2s;
}
.dl[data-state="running"] .ring { opacity: 1; }
.dl[data-state="queued"] .ring, .dl[data-state="running"].indeterminate .ring {
  opacity: 1; --p: .25; animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(1turn); } }
.dl[data-state="queued"] svg, .dl[data-state="running"] svg { opacity: .35; }
.dl[data-state="done"] { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.dl[data-state="error"] { background: color-mix(in srgb, var(--bad) 18%, transparent); color: var(--bad); }

/* collection header (album / playlist from a link) */
.collection {
  position: relative; overflow: hidden; border-radius: 20px; margin: 4px 0 10px;
  padding: 18px; display: flex; gap: 16px; align-items: center; background: var(--bg2);
}
.collection .bg { position: absolute; inset: -20px; background-size: cover; background-position: center; filter: blur(30px) saturate(1.4); opacity: .45; }
.collection > *:not(.bg) { position: relative; }
.collection .art { width: 96px; height: 96px; border-radius: 12px; object-fit: cover; box-shadow: 0 10px 30px rgba(0, 0, 0, .35); background: var(--grad); flex: none; }
.collection h2 { margin: 0 0 4px; font-size: 19px; line-height: 1.2; }
.collection p { margin: 0 0 12px; color: var(--hint); font-size: 13px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 18px; border-radius: 20px;
  background: var(--grad); color: #fff; font-weight: 700;
  box-shadow: 0 6px 20px color-mix(in srgb, var(--accent) 40%, transparent);
}
.btn svg { width: 18px; height: 18px; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; }

/* states */
.empty { text-align: center; padding: 56px 24px; color: var(--hint); }
.empty .icon {
  width: 72px; height: 72px; margin: 0 auto 16px; border-radius: 22px;
  display: grid; place-items: center; background: var(--grad); color: #fff;
  box-shadow: 0 12px 30px color-mix(in srgb, var(--accent) 35%, transparent);
}
.empty .icon svg { width: 34px; height: 34px; }
.empty h3 { color: var(--text); margin: 0 0 6px; font-size: 18px; }
.empty p { margin: 0; }

.skeleton { display: flex; align-items: center; gap: 12px; padding: 8px 6px; }
.skeleton .a { width: 52px; height: 52px; border-radius: 10px; }
.skeleton .b { flex: 1; }
.skeleton .b i { display: block; height: 12px; border-radius: 6px; margin: 6px 0; }
.skeleton .b i:last-child { width: 45%; }
.skeleton .a, .skeleton .b i {
  background: linear-gradient(90deg, var(--card) 25%, var(--line) 50%, var(--card) 75%);
  background-size: 200% 100%; animation: shimmer 1.2s infinite linear;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* settings */
.card { background: var(--bg2); border-radius: 18px; padding: 16px; margin-bottom: 12px; }
.card h3 { margin: 0 0 12px; font-size: 15px; }
.card p { margin: 10px 0 0; color: var(--hint); font-size: 13px; }
.segmented { display: flex; gap: 4px; padding: 4px; background: var(--card); border-radius: 12px; }
.segmented button { flex: 1; padding: 9px 6px; border-radius: 9px; font-weight: 600; font-size: 14px; color: var(--hint); display: flex; align-items: center; justify-content: center; gap: 6px; }
.segmented button.active { background: var(--bg); color: var(--text); box-shadow: 0 2px 8px rgba(0, 0, 0, .15); }
.stat { display: flex; align-items: center; gap: 14px; }
.stat b { font-size: 30px; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* mini player */
.player {
  position: fixed; left: 8px; right: 8px; z-index: 9;
  bottom: calc(var(--tabbar) + var(--safe-bottom) + 8px);
  display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 8px;
  background: color-mix(in srgb, var(--bg2) 88%, transparent);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--line); border-radius: 16px; overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
  animation: rise .25s both;
}
.player img { width: 44px; height: 44px; border-radius: 9px; object-fit: cover; background: var(--grad); }
.player-meta { flex: 1; min-width: 0; }
.player-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--line); }
#player-bar { height: 100%; width: 0; background: var(--grad); transition: width .25s linear; }
.round { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--text); color: var(--bg); flex: none; }
.round svg { fill: currentColor; stroke: none; width: 18px; height: 18px; }
.round.ghost { background: none; color: var(--hint); }
.round.ghost svg { fill: none; stroke: currentColor; }
.round.loading svg { animation: spin 1s linear infinite; fill: none; stroke: currentColor; }

/* tab bar */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; height: calc(var(--tabbar) + var(--safe-bottom)); padding-bottom: var(--safe-bottom);
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--line);
}
.tabbar button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--hint); font-size: 11px; font-weight: 600; transition: color .2s; }
.tabbar button.active { color: var(--accent); }
.tabbar button.active svg { transform: translateY(-1px); }

/* toast */
.toast {
  position: fixed; left: 50%; z-index: 20; max-width: calc(100% - 32px);
  bottom: calc(var(--tabbar) + var(--safe-bottom) + 90px);
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  padding: 11px 16px; border-radius: 14px; background: var(--text); color: var(--bg);
  font-weight: 600; font-size: 14px; text-align: center;
  transition: opacity .25s, transform .25s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { background: var(--bad); color: #fff; }

/* ---------- v2: new sources, library, overlays, full player ---------- */
.dot.dz { background: #a238ff; } .dot.sc { background: #ff5500; } .dot.bc { background: #1da0c3; }

.icon-btn { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; color: var(--text); flex: none; position: relative; }
.icon-btn:active { transform: scale(.9); }
.icon-btn.big svg { width: 30px; height: 30px; }
svg.solid, .solid path { fill: currentColor; stroke: none; }
.more { width: 30px; color: var(--hint); }
.more svg { width: 20px; height: 20px; }

.btn.ghost { background: var(--card); color: var(--text); box-shadow: none; }
.btn.small { height: 34px; padding: 0 14px; font-size: 14px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* library */
#library-tabs { margin: 4px 4px 14px; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; padding: 0 4px; }
.pl-card { text-align: left; animation: rise .35s both; animation-delay: calc(var(--i, 0) * 30ms); }
.pl-card .collage, .pl-card .add-tile { aspect-ratio: 1; border-radius: 16px; margin-bottom: 8px; }
.pl-card .t { font-weight: 700; }
.pl-card .s { margin-top: 1px; }
.add-tile { display: grid; place-items: center; background: var(--card); color: var(--hint); border: 1.5px dashed var(--line); }
.add-tile svg { width: 34px; height: 34px; }
.collage { display: grid; grid-template-columns: 1fr 1fr; overflow: hidden; background: var(--grad); position: relative; }
.collage img { width: 100%; height: 100%; object-fit: cover; display: block; }
.collage.one { grid-template-columns: 1fr; }
.collage .note { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; }
.collage .note svg { width: 40%; height: 40%; }

/* overlay page (playlist / album) */
.overlay {
  position: fixed; inset: 0; z-index: 8; overflow-y: auto; background: var(--bg);
  padding-bottom: calc(var(--tabbar) + var(--safe-bottom) + 96px);
  animation: slide-in .25s ease both;
}
@keyframes slide-in { from { transform: translateX(30px); opacity: 0; } }
.pl-head { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 20px 8px 6px; }
.pl-head .collage { width: 200px; height: 200px; border-radius: 20px; box-shadow: 0 20px 50px rgba(0, 0, 0, .35); }
.pl-head h2 { margin: 16px 0 4px; font-size: 22px; line-height: 1.2; }
.pl-head p { margin: 0 0 14px; color: var(--hint); font-size: 14px; }
.pl-head .btn-row { justify-content: center; }
.back-row { display: flex; align-items: center; gap: 4px; padding: 10px 4px 0; color: var(--accent); font-weight: 600; }

/* wave */
.wave-hero {
  position: relative; overflow: hidden; border-radius: 28px; margin: 14px 0 6px; padding: 34px 20px 26px;
  text-align: center; background: #0b0b12; color: #fff; isolation: isolate;
}
.wave-hero .blob { position: absolute; width: 260px; height: 260px; border-radius: 50%; filter: blur(50px); opacity: .75; z-index: -1; animation: drift 9s ease-in-out infinite alternate; }
.wave-hero .b1 { background: var(--accent); left: -60px; top: -80px; }
.wave-hero .b2 { background: var(--accent-2); right: -70px; bottom: -110px; animation-delay: -4s; }
.wave-hero .b3 { background: #22d3ee; left: 30%; top: 30%; width: 160px; height: 160px; animation-delay: -2s; opacity: .45; }
@keyframes drift { to { transform: translate(40px, 30px) scale(1.15); } }
.wave-hero h2 { margin: 0 0 6px; font-size: 30px; letter-spacing: -.5px; }
.wave-hero p { margin: 0 0 22px; opacity: .75; }
.wave-play { width: 76px; height: 76px; border-radius: 50%; background: #fff; color: #111; display: inline-grid; place-items: center; box-shadow: 0 10px 40px rgba(255, 255, 255, .25); }
.wave-play svg { width: 30px; height: 30px; fill: currentColor; stroke: none; }
.wave-play:active { transform: scale(.94); }
.wave-hero.on .wave-play { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 14px rgba(255, 255, 255, .08), 0 10px 40px rgba(255, 255, 255, .25); } }

/* settings extras */
.field { display: flex; gap: 8px; }
.field input {
  flex: 1; min-width: 0; height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg); color: var(--text); font: inherit; outline: none;
}
.field input:focus { border-color: var(--accent); }
.themes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.theme { border-radius: 12px; overflow: hidden; border: 2px solid transparent; background: var(--card); position: relative; }
.theme img { width: 100%; aspect-ratio: 2; object-fit: cover; display: block; background: var(--card); }
.theme span { display: block; padding: 6px 8px; font-size: 13px; font-weight: 600; text-align: left; }
.theme.active { border-color: var(--accent); }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; }
.switch-row small { display: block; color: var(--hint); font-size: 12px; margin-top: 2px; }
.switch { width: 50px; height: 30px; border-radius: 15px; background: var(--line); position: relative; flex: none; transition: background .2s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 2px 6px rgba(0, 0, 0, .2); }
.switch.on { background: var(--accent); }
.switch.on::after { transform: translateX(20px); }
.note-box { padding: 10px 12px; border-radius: 10px; background: color-mix(in srgb, var(--accent) 12%, transparent); font-size: 13px; margin-top: 12px; }
.note-box code { font-size: 12px; }

/* bottom sheet */
.sheet-backdrop { position: fixed; inset: 0; z-index: 30; background: rgba(0, 0, 0, .45); animation: fade .2s both; }
@keyframes fade { from { opacity: 0; } }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 31; max-height: 80vh; overflow-y: auto;
  background: var(--bg2); border-radius: 22px 22px 0 0; padding: 8px 12px calc(14px + var(--safe-bottom));
  animation: sheet-up .25s cubic-bezier(.2, .9, .3, 1) both;
}
@keyframes sheet-up { from { transform: translateY(100%); } }
.sheet::before { content: ""; display: block; width: 38px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 10px; }
.sheet-head { display: flex; gap: 12px; align-items: center; padding: 4px 6px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.sheet-head img, .sheet-head .ph { width: 48px; height: 48px; border-radius: 9px; object-fit: cover; background: var(--grad); flex: none; }
.sheet-head .meta { cursor: default; }
.sheet h3 { margin: 6px 6px 12px; font-size: 17px; }
.sheet-item { display: flex; align-items: center; gap: 14px; width: 100%; padding: 12px 8px; border-radius: 12px; font-size: 16px; text-align: left; }
.sheet-item:active { background: var(--card); }
.sheet-item svg { color: var(--hint); }
.sheet-item.danger, .sheet-item.danger svg { color: var(--bad); }
.sheet-item img, .sheet-item .collage { width: 44px; height: 44px; border-radius: 9px; object-fit: cover; flex: none; }
.sheet .field { padding: 4px 6px 10px; }
.sheet .btn { width: 100%; margin-top: 4px; }

/* full player */
.fullplayer {
  position: fixed; inset: 0; z-index: 20; display: flex; flex-direction: column; color: #fff; overflow: hidden;
  padding: 8px 20px calc(18px + var(--safe-bottom)); background: #0b0b10;
  animation: sheet-up .3s cubic-bezier(.2, .9, .3, 1) both;
}
.fp-bg { position: absolute; inset: -60px; background-size: cover; background-position: center; filter: blur(60px) saturate(1.5) brightness(.55); z-index: -1; transition: background-image .4s; }
.fullplayer { isolation: isolate; }
.fullplayer .icon-btn { color: #fff; }
.fp-top { display: flex; align-items: center; justify-content: space-between; }
.fp-context { font-size: 13px; font-weight: 600; opacity: .75; text-align: center; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fp-stage { flex: 1; display: grid; place-items: center; min-height: 0; padding: 14px 0; }
.fp-art { width: min(100%, 46vh); aspect-ratio: 1; border-radius: 20px; background: var(--grad) center / cover; box-shadow: 0 30px 70px rgba(0, 0, 0, .5); transition: transform .3s; }
.fullplayer.paused .fp-art { transform: scale(.9); }
.fp-lyrics { width: 100%; height: 100%; overflow-y: auto; -webkit-mask-image: linear-gradient(transparent, #000 15%, #000 85%, transparent); mask-image: linear-gradient(transparent, #000 15%, #000 85%, transparent); padding: 30% 0; scrollbar-width: none; }
.fp-lyrics::-webkit-scrollbar { display: none; }
.fp-lyrics p { margin: 0 0 14px; font-size: 24px; font-weight: 800; line-height: 1.25; opacity: .35; transition: opacity .25s, transform .25s; transform-origin: left; cursor: pointer; }
.fp-lyrics p.on { opacity: 1; transform: scale(1.03); }
.fp-lyrics.plain p { font-size: 18px; font-weight: 600; opacity: .85; cursor: default; }
.fp-lyrics .empty { opacity: .7; text-align: center; }
.fp-meta { display: flex; align-items: center; gap: 10px; }
.fp-titles { flex: 1; min-width: 0; }
.fp-title { font-size: 22px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fp-artist { font-size: 16px; opacity: .75; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; display: block; }
.fullplayer .fav.on { color: var(--accent-2); }
.fullplayer .fav.on svg { fill: currentColor; }
.fp-seek { margin-top: 14px; }
.fp-seek input { width: 100%; height: 4px; -webkit-appearance: none; appearance: none; border-radius: 2px; outline: none;
  background: linear-gradient(#fff, #fff) 0 / var(--p, 0%) 100% no-repeat, rgba(255, 255, 255, .25); }
.fp-seek input::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%; background: #fff; }
.fp-seek input::-moz-range-thumb { width: 14px; height: 14px; border: 0; border-radius: 50%; background: #fff; }
.fp-times { display: flex; justify-content: space-between; font-size: 12px; opacity: .6; margin-top: 6px; font-variant-numeric: tabular-nums; }
.fp-controls { display: flex; align-items: center; justify-content: space-between; margin: 10px 0 14px; }
.fp-controls .icon-btn { opacity: .6; }
.fp-controls .icon-btn.big, .fp-controls .icon-btn.on { opacity: 1; }
.fp-controls .icon-btn.on { color: var(--accent-2); }
.badge { position: absolute; top: 4px; right: 2px; font-size: 9px; font-weight: 800; background: var(--accent-2); color: #fff; border-radius: 6px; padding: 0 4px; }
.play-btn { width: 70px; height: 70px; border-radius: 50%; background: #fff; color: #111; display: grid; place-items: center; }
.play-btn svg { width: 28px; height: 28px; fill: currentColor; stroke: none; }
.play-btn.loading svg { animation: spin 1s linear infinite; fill: none; stroke: currentColor; }
.play-btn:active { transform: scale(.94); }
.fp-actions { display: flex; justify-content: space-around; }
.fp-actions button { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 11px; opacity: .75; }
.fp-actions button.on { opacity: 1; color: var(--accent-2); }
.queue-item.current .t { color: var(--accent); }

/* ---------- v3: recognition, cutter, friends, party, recap ---------- */
.mic { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; color: var(--accent); flex: none; }
.mic svg { width: 20px; height: 20px; }
.tabbar button span { white-space: nowrap; }
.tabbar button { font-size: 10px; }

.listening { text-align: center; padding: 10px 0 6px; }
.listening .orb {
  width: 120px; height: 120px; margin: 10px auto 18px; border-radius: 50%; background: var(--grad);
  display: grid; place-items: center; color: #fff; animation: orb 1.4s ease-in-out infinite;
}
.listening .orb svg { width: 46px; height: 46px; }
@keyframes orb { 50% { transform: scale(1.08); box-shadow: 0 0 0 22px color-mix(in srgb, var(--accent) 18%, transparent); } }
.listening h3 { margin: 0 0 4px; }
.listening p { margin: 0 0 16px; color: var(--hint); }

.recognized {
  display: flex; gap: 14px; align-items: center; padding: 14px; border-radius: 18px; margin: 4px 0 10px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 22%, var(--bg2)), var(--bg2));
}
.recognized img, .recognized .ph { width: 76px; height: 76px; border-radius: 12px; object-fit: cover; background: var(--grad); flex: none; }
.recognized small { color: var(--hint); font-size: 12px; font-weight: 700; letter-spacing: .5px; }
.recognized h2 { margin: 2px 0; font-size: 19px; line-height: 1.2; }
.recognized p { margin: 0; color: var(--hint); }

.cut-times { text-align: center; font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; margin: 2px 0 12px; }
.cut-times b { color: var(--accent); font-size: 15px; display: block; margin-top: 2px; }
.cut-range { display: block; margin: 0 6px 12px; font-size: 13px; color: var(--hint); }
.cut-range input { width: 100%; accent-color: var(--accent); margin-top: 6px; }
.sheet .segmented { margin: 4px 6px 8px; }
.sheet .segmented button { font-size: 13px; padding: 9px 4px; }
.hint { color: var(--hint); font-size: 13px; margin: 0 8px 10px; }

.invite { display: flex; align-items: center; gap: 14px; }
.invite .icon { width: 52px; height: 52px; border-radius: 16px; background: var(--grad); color: #fff; display: grid; place-items: center; flex: none; }
.invite div { flex: 1; font-size: 14px; color: var(--hint); }
.invite b { display: block; color: var(--text); font-size: 15px; }
.avatar { width: 46px; height: 46px; border-radius: 50%; object-fit: cover; flex: none; background: var(--grad); color: #fff; display: grid; place-items: center; font-weight: 800; position: relative; }
.avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; position: absolute; inset: 0; }
.avatar.live::after { content: ""; position: absolute; right: 0; bottom: 0; width: 12px; height: 12px; border-radius: 50%; background: var(--ok); border: 2px solid var(--bg); }
.friend { display: flex; align-items: center; gap: 12px; padding: 8px 6px; border-radius: var(--radius); }
.friend .meta .s { white-space: nowrap; }
.friend .now { color: var(--ok); }
.feed-who { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--hint); margin: 10px 6px -2px; }
.feed-who .avatar { width: 22px; height: 22px; font-size: 11px; }
.feed-who .avatar.live::after { display: none; }
.feed-who b { color: var(--text); }

.party-head { text-align: center; padding: 14px 6px 4px; }
.party-head small { color: var(--accent); font-weight: 800; letter-spacing: .6px; font-size: 12px; }
.party-head h2 { margin: 4px 0 2px; font-size: 22px; }
.party-head p { margin: 0 0 14px; color: var(--hint); font-size: 13px; }
.party-now { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.party-now .art { width: 210px; height: 210px; border-radius: 20px; background: var(--grad) center / cover; box-shadow: 0 20px 50px rgba(0, 0, 0, .35); }
.party-now .t { font-size: 18px; font-weight: 800; text-align: center; white-space: normal; }
.party-now .s { justify-content: center; }
/* ---------- v4: app themes, card editor ---------- */
html[data-theme="dark"] { --bg: #0d0d12; --bg2: #17171f; --text: #f3f3f7; --hint: #8d8d9a; --accent: #8b5cf6; --accent-2: #ec4899; }
html[data-theme="amoled"] { --bg: #000000; --bg2: #0e0e11; --text: #f5f5f7; --hint: #7d7d88; --accent: #a855f7; --accent-2: #22d3ee; }
html[data-theme="light"] { --bg: #f5f5f8; --bg2: #ffffff; --text: #141418; --hint: #6c6c78; --accent: #7c3aed; --accent-2: #db2777; }
html[data-theme="ocean"] { --bg: #06121d; --bg2: #0c1e2e; --text: #e8f4fb; --hint: #7f9bb0; --accent: #06b6d4; --accent-2: #3b82f6; }
html[data-theme="sunset"] { --bg: #170b10; --bg2: #24121a; --text: #fdf0ec; --hint: #b08a86; --accent: #f97316; --accent-2: #e11d48; }
html[data-theme="forest"] { --bg: #08130d; --bg2: #102017; --text: #ecf8ef; --hint: #84a58d; --accent: #22c55e; --accent-2: #a3e635; }
html[data-theme="light"] .pill.active { background: var(--text); color: #fff; }

.app-themes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.app-theme { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--hint); }
.app-theme .swatch { width: 100%; aspect-ratio: 1; border-radius: 14px; border: 2px solid var(--line); position: relative; overflow: hidden; }
.app-theme .swatch::after { content: ""; position: absolute; left: 18%; right: 18%; bottom: 18%; height: 22%; border-radius: 99px; background: var(--sw-accent); }
.app-theme.active { color: var(--text); }
.app-theme.active .swatch { border-color: var(--accent); }

.ed-preview-wrap { position: sticky; top: 0; z-index: 2; background: var(--bg); padding: 12px 4px 10px; }
.ed-preview { width: 100%; border-radius: 14px; display: block; background: var(--card); min-height: 120px; object-fit: contain; transition: opacity .2s; }
.ed-preview.loading { opacity: .6; }
.editor .card h3 { margin-bottom: 10px; }
.editor .row { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.editor .row > span { flex: 1; font-size: 14px; }
.editor input[type="range"] { width: 100%; accent-color: var(--accent); }
.range-label { display: flex; justify-content: space-between; font-size: 13px; color: var(--hint); margin-top: 12px; }
.editor input[type="color"] { width: 44px; height: 36px; border: none; border-radius: 10px; padding: 0; background: none; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.swatches button { width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--line); }
.editor .field { margin-top: 10px; }
.editor-actions { display: flex; gap: 8px; margin: 14px 0 24px; }
.file-btn { width: 100%; margin-top: 4px; position: relative; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.editor-actions .btn { flex: 1; }

/* ---------- v5: profile, taste match, eq ---------- */
.profile-head { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 26px 8px 8px; }
.profile-head .avatar { width: 96px; height: 96px; font-size: 38px; box-shadow: 0 14px 40px color-mix(in srgb, var(--accent) 35%, transparent); }
.profile-head h2 { margin: 12px 0 2px; font-size: 24px; }
.profile-head p { margin: 0 0 12px; color: var(--hint); }
.profile-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 4px 4px; }
.profile-tiles div { background: var(--bg2); border-radius: 16px; padding: 12px 6px; text-align: center; }
.profile-tiles b { display: block; font-size: 24px; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.profile-tiles span { font-size: 11px; color: var(--hint); }
.match-head { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 24px 8px 6px; }
.match-faces { display: flex; }
.match-faces .avatar { width: 64px; height: 64px; font-size: 26px; border: 3px solid var(--bg); }
.match-faces .avatar + .avatar { margin-left: -14px; }
.match-ring {
  width: 150px; height: 150px; border-radius: 50%; margin: 18px 0 6px; display: grid; place-items: center;
  /* the inner disc is painted in the page colour, so the number inside stays visible */
  background: radial-gradient(circle, var(--bg) 58px, transparent 59px),
    conic-gradient(var(--accent-2) calc(var(--p) * 1%), var(--card) 0);
  position: relative;
}
.match-ring b { position: absolute; font-size: 34px; }
.match-head h2 { margin: 6px 0 2px; }
.match-head p { margin: 0 0 14px; color: var(--hint); }
.active-chip { background: var(--accent) !important; color: #fff; }

.card .segmented { flex-wrap: wrap; }
.card .segmented button { flex: 1 1 28%; min-width: 0; white-space: nowrap; }
.recap-img { width: 100%; border-radius: 14px; display: block; margin-bottom: 12px; background: var(--card); aspect-ratio: 1080 / 1350; object-fit: cover; }
