/* ============================================================
   Editlyst – dark, phone-first styles
   ============================================================ */
:root {
  --bg: #0b0b0c;
  --surface: #161618;
  --surface-2: #1f1f22;
  --surface-3: #2b2b30;
  --line: rgba(255, 255, 255, .08);
  --text: #ffffff;
  --text-2: #b4b4ba;
  --text-3: #7c7c84;
  --accent: #00d9ff;
  --accent-purple: #b026ff;
  --accent-grad: linear-gradient(135deg, #00d9ff, #b026ff);
  --accent-2: #00b8e6;
  --accent-ink: #ffffff;
  --danger: #ff5a68;
  --radius: 14px;
  --radius-lg: 22px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --tabbar-h: 62px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
body { overflow: hidden; overscroll-behavior: none; -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; touch-action: manipulation; }
input { font: inherit; color: inherit; }
svg { width: 24px; height: 24px; flex: none; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- stage / phone frame ---------- */
.stage { height: 100%; width: 100%; }
.device { height: 100%; width: 100%; }
.screen {
  position: relative; height: 100%; width: 100%;
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--bg);
  isolation: isolate;
}

/* Bigger screens: keep the phone layout inside a phone-shaped frame */
@media (min-width: 600px) and (min-height: 620px) {
  body {
    background:
      radial-gradient(1200px 700px at 15% 10%, rgba(0, 217, 255, .10), transparent 60%),
      radial-gradient(900px 700px at 90% 90%, rgba(176, 38, 255, .12), transparent 60%),
      #050506;
  }
  .stage { display: grid; place-items: center; padding: 24px; }
  .device {
    width: 414px; height: min(880px, calc(100dvh - 48px));
    padding: 12px; border-radius: 58px;
    background: linear-gradient(145deg, #2d2d33, #121214 40%, #1b1b1f);
    box-shadow: 0 0 0 1.5px #3a3a40, 0 0 0 7px #0d0d0f, 0 40px 90px rgba(0, 0, 0, .7), inset 0 0 2px rgba(255,255,255,.2);
    position: relative;
  }
  .device::before { /* speaker / camera pill */
    content: ""; position: absolute; top: 22px; left: 50%; transform: translateX(-50%);
    width: 96px; height: 26px; border-radius: 20px; background: #000; z-index: 50;
  }
  .screen { border-radius: 46px; --safe-top: 34px; --safe-bottom: 14px; --safe-left: 0px; --safe-right: 0px; }
}

/* Phone turned sideways: keep content readable */
@media (max-height: 619px) and (min-width: 600px) {
  .screen { max-width: 560px; margin: 0 auto; border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
}

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(var(--safe-top) + 10px) calc(var(--safe-right) + 12px) 8px calc(var(--safe-left) + 20px);
  flex: none;
}
.topbar-title { flex: 1; min-width: 0; margin: 0; font-size: 26px; font-weight: 800; letter-spacing: -.02em; }

.icon-btn {
  width: 44px; height: 44px; border-radius: 50%;
  display: inline-grid; place-items: center; color: var(--text-2); position: relative;
  transition: transform .15s var(--ease), color .15s, background .15s;
}
.icon-btn:active { transform: scale(.9); }
.icon-btn:hover { color: var(--text); }
.icon-btn.lg svg { width: 34px; height: 34px; }
.icon-btn.lg { width: 56px; height: 56px; color: var(--text); }
.icon-btn.small { width: 36px; height: 36px; }
.icon-btn.small svg { width: 18px; height: 18px; }
.icon-btn.toggle.is-on { color: var(--accent); }
.icon-btn.toggle.is-on::after {
  content: ""; position: absolute; bottom: 4px; left: 50%; width: 4px; height: 4px; margin-left: -2px;
  border-radius: 50%; background: var(--accent);
}

.offline-banner {
  display: flex; align-items: center; gap: 8px; margin: 0 16px 6px; padding: 8px 12px;
  background: #2a2412; color: #ffd66b; border-radius: 10px; font-size: 13px; flex: none;
}
.offline-banner svg { width: 18px; height: 18px; }

/* ---------- views ---------- */
.views { flex: 1; min-height: 0; position: relative; }
.view {
  position: absolute; inset: 0; overflow-y: auto; overflow-x: hidden;
  -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  padding: 4px calc(var(--safe-right) + 8px) 24px calc(var(--safe-left) + 8px);
  animation: view-in .28s var(--ease);
  scrollbar-width: thin; scrollbar-color: #333 transparent;
}
@keyframes view-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- library header ---------- */
.lib-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 8px 12px 12px; }
.lib-meta { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.lib-count { color: var(--text-2); font-size: 13px; }
.lib-actions { display: flex; align-items: center; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px 0 10px;
  border-radius: 999px; background: var(--surface-2); font-size: 13px; font-weight: 600; min-height: 34px;
}
.chip svg { width: 16px; height: 16px; }
.chip:active { transform: scale(.96); }
.big-play {
  width: 56px; height: 56px; border-radius: 50%; background: var(--accent-grad); color: var(--accent-ink);
  display: grid; place-items: center; box-shadow: 0 8px 24px rgba(140, 80, 255, .35);
  transition: transform .15s var(--ease), background .15s;
}
.big-play svg { width: 26px; height: 26px; }
.big-play:hover { background: #2ae86e; transform: scale(1.04); }
.big-play:active { transform: scale(.94); }

/* ---------- track list ---------- */
.track-list { list-style: none; margin: 0; padding: 0; }
.track { position: relative; border-radius: 12px; overflow: hidden; transition: height .25s var(--ease), opacity .25s; }
.track-bg {
  position: absolute; inset: 0; background: var(--danger); color: #fff;
  display: flex; align-items: center; justify-content: flex-end; padding-right: 8px;
  opacity: 0; transition: opacity .1s;
}
.track.swiping .track-bg, .track.open .track-bg { opacity: 1; }
.track-del-btn { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; font-weight: 700; width: 80px; height: 100%; justify-content: center; }
.track-main {
  position: relative; display: flex; align-items: center; gap: 12px;
  padding: 8px 4px 8px 10px; background: var(--bg); border-radius: 12px;
  touch-action: pan-y; user-select: none; -webkit-user-select: none; cursor: pointer;
  transition: transform .28s var(--ease), background .15s;
}
.track.swiping .track-main { transition: none; }
.track-main:hover { background: #141416; }
.track-main:active { background: var(--surface); }
.track-text { flex: 1; min-width: 0; }
.track-title { font-size: 15.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.3; }
.track-sub { display: flex; align-items: center; gap: 6px; color: var(--text-2); font-size: 13px; margin-top: 3px; white-space: nowrap; overflow: hidden; }
.track-sub svg { width: 14px; height: 14px; }
.track-sub .saved { color: var(--accent); }
.track-sub .sub-text { overflow: hidden; text-overflow: ellipsis; }
.track.is-current .track-title { color: var(--accent); }
.track.unavailable { opacity: .38; }
.track-list .more { color: var(--text-3); }

/* covers */
.cover {
  position: relative; flex: none; width: 52px; height: 52px; border-radius: 8px; overflow: hidden;
  background: var(--surface-2); display: grid; place-items: center;
}
.cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover .ph { width: 100%; height: 100%; display: grid; place-items: center; }
.cover .ph svg { width: 42%; height: auto; aspect-ratio: 1; opacity: .95; }
.cover .eq {
  position: absolute; inset: 0; background: rgba(0, 0, 0, .55); display: none;
  align-items: flex-end; justify-content: center; gap: 3px; padding-bottom: 15px;
}
.track.is-current .cover .eq { display: flex; }
.eq i { width: 3.5px; height: 18px; border-radius: 2px; background: var(--accent); transform-origin: bottom; transform: scaleY(.3); }
.is-playing .track.is-current .eq i { animation: eq 0.9s ease-in-out infinite; }
.eq i:nth-child(2) { animation-delay: -.3s !important; }
.eq i:nth-child(3) { animation-delay: -.6s !important; }
.eq i:nth-child(4) { animation-delay: -.15s !important; }
@keyframes eq { 0%, 100% { transform: scaleY(.25); } 50% { transform: scaleY(1); } }

/* ---------- empty states ---------- */
.empty { text-align: center; padding: 48px 28px; color: var(--text-2); }
.empty h2 { color: var(--text); font-size: 20px; margin: 18px 0 8px; }
.empty p { margin: 0 0 22px; line-height: 1.5; font-size: 15px; }
.empty.small { padding: 40px 20px; }
.empty-art {
  width: 84px; height: 84px; margin: 0 auto; border-radius: 24px; display: grid; place-items: center;
  background: linear-gradient(135deg, #00d9ff33, #b026ff33); color: var(--accent);
}
.empty-art svg { width: 40px; height: 40px; }

/* ---------- buttons ---------- */
.btn-primary, .btn-secondary {
  min-height: 50px; padding: 0 24px; border-radius: 999px; font-weight: 700; font-size: 16px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform .15s var(--ease), background .15s, opacity .15s;
}
.btn-primary { background: var(--accent-grad); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.1); }
.btn-primary:disabled { opacity: .5; }
.btn-secondary { background: var(--surface-3); color: var(--text); }
.btn-secondary svg { width: 20px; height: 20px; }
.btn-primary:active, .btn-secondary:active { transform: scale(.96); }
.btn-danger { background: var(--danger); color: #fff; }
.grow { flex: 1; }

/* ---------- add view ---------- */
.add-card { margin: 8px 8px 0; padding: 20px 18px; border-radius: var(--radius-lg); background: linear-gradient(160deg, #141a33 0%, var(--surface) 55%); border: 1px solid var(--line); }
.add-label { display: block; font-weight: 700; font-size: 17px; margin-bottom: 12px; }
.add-field {
  display: flex; align-items: center; gap: 8px; background: #0d0d0f; border-radius: 14px;
  padding: 0 6px 0 14px; border: 1.5px solid transparent; transition: border-color .15s;
}
.add-field:focus-within { border-color: var(--accent); }
.add-field-icon { width: 20px; height: 20px; color: var(--text-3); }
.add-field input { flex: 1; min-width: 0; height: 54px; background: none; border: 0; outline: none; font-size: 16px; }
.add-field input::placeholder { color: var(--text-3); }
.add-buttons { display: flex; gap: 10px; margin-top: 12px; }
.add-error { color: var(--danger); font-size: 14px; margin: 10px 2px 0; min-height: 0; line-height: 1.4; }
.add-error:empty { display: none; }
.platforms { display: flex; gap: 16px; margin-top: 16px; color: var(--text-2); font-size: 13px; flex-wrap: wrap; }
.platforms span { display: inline-flex; align-items: center; gap: 6px; }
.platforms svg { width: 18px; height: 18px; }
.add-tip { color: var(--text-3); font-size: 13px; line-height: 1.5; margin: 14px 16px 0; }
.section-title { font-size: 18px; margin: 26px 16px 8px; }

.jobs { list-style: none; margin: 0; padding: 0 8px; display: flex; flex-direction: column; gap: 8px; }
.job {
  display: flex; gap: 12px; align-items: flex-start; padding: 12px; border-radius: var(--radius);
  background: var(--surface); animation: view-in .3s var(--ease);
}
.job .cover { width: 48px; height: 48px; }
.job-body { flex: 1; min-width: 0; }
.job-title { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.job-status { color: var(--text-2); font-size: 13px; margin-top: 3px; line-height: 1.4; }
.job.error .job-status { color: var(--danger); }
.job.done .job-status, .job.duplicate .job-status { color: var(--accent); }
.job-bar { height: 4px; border-radius: 4px; background: var(--surface-3); margin-top: 9px; overflow: hidden; }
.job-bar i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 4px; transition: width .4s var(--ease); }
.job-bar.indeterminate i { width: 35% !important; animation: indet 1.2s ease-in-out infinite; }
@keyframes indet { from { transform: translateX(-100%); } to { transform: translateX(300%); } }
.job-details { margin-top: 6px; font-size: 12px; color: var(--text-3); }
.job-details summary { cursor: pointer; padding: 4px 0; }
.job-details code { display: block; white-space: pre-wrap; word-break: break-word; font-size: 11px; margin-top: 4px; }
.job-actions { display: flex; flex-direction: column; }
.job-actions .icon-btn { width: 40px; height: 40px; }
.job-actions .icon-btn svg { width: 20px; height: 20px; }
.spinner { width: 20px; height: 20px; border-radius: 50%; border: 2.5px solid var(--surface-3); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- search ---------- */
.search-field {
  display: flex; align-items: center; gap: 10px; margin: 6px 8px 14px; padding: 0 14px;
  background: #fff; color: #121212; border-radius: 12px;
}
.search-field svg { width: 22px; height: 22px; color: #121212; }
.search-field input { flex: 1; min-width: 0; height: 50px; border: 0; outline: none; background: none; color: #121212; font-size: 16px; font-weight: 500; }
.search-field input::placeholder { color: #6a6a6a; }

/* ---------- mini player ---------- */
.mini {
  position: relative; flex: none; display: flex; align-items: center; gap: 2px;
  margin: 0 8px 6px; padding: 6px 4px 6px 6px; border-radius: 12px;
  background: var(--mini-bg, #2a2a2e); box-shadow: 0 6px 20px rgba(0, 0, 0, .45);
  animation: mini-in .35s var(--ease); transition: background .5s;
  margin-left: calc(var(--safe-left) + 8px); margin-right: calc(var(--safe-right) + 8px);
}
@keyframes mini-in { from { transform: translateY(20px); opacity: 0; } to { transform: none; opacity: 1; } }
.mini-open { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; text-align: left; min-height: 44px; }
.mini-cover { width: 44px; height: 44px; border-radius: 6px; }
.mini-text { min-width: 0; flex: 1; }
.mini-title { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-sub { font-size: 12.5px; color: rgba(255, 255, 255, .7); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.mini .icon-btn { color: var(--text); }
.mini .icon-btn svg { width: 26px; height: 26px; }
.mini-progress { position: absolute; left: 10px; right: 10px; bottom: 0; height: 2.5px; background: rgba(255, 255, 255, .2); border-radius: 2px; overflow: hidden; }
.mini-progress-fill { height: 100%; width: 0; background: #fff; }

/* ---------- tab bar ---------- */
.tabbar {
  flex: none; display: flex; justify-content: space-around;
  padding: 4px calc(var(--safe-right) + 8px) calc(var(--safe-bottom) + 6px) calc(var(--safe-left) + 8px);
  background: linear-gradient(to top, #000 55%, rgba(0, 0, 0, .85));
  border-top: 1px solid rgba(255, 255, 255, .04);
}
.tab {
  flex: 1; max-width: 140px; min-height: 54px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; color: var(--text-3); font-size: 11.5px; font-weight: 600; position: relative;
  transition: color .15s, transform .15s var(--ease);
}
.tab svg { width: 26px; height: 26px; }
.tab .on { display: none; }
.tab.is-active { color: var(--text); }
.tab.is-active .on { display: block; }
.tab.is-active .off { display: none; }
.tab:active { transform: scale(.92); }
.tab-badge {
  position: absolute; top: 6px; left: 50%; margin-left: 8px; width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 2px #000; animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse { 50% { transform: scale(.7); opacity: .6; } }

/* ---------- now playing ---------- */
.np {
  position: absolute; inset: 0; z-index: 30; background: #121212; overflow: hidden;
  transform: translateY(100%); transition: transform .38s var(--ease); visibility: hidden;
  touch-action: none;
}
.np.open { transform: none; visibility: visible; }
.np.dragging { transition: none; }
.np-bg { position: absolute; inset: 0; background: linear-gradient(180deg, var(--np-color, #3a3a40) 0%, #121212 78%); transition: background .6s; }
.np-inner {
  position: relative; height: 100%; display: flex; flex-direction: column;
  padding: calc(var(--safe-top) + 6px) calc(var(--safe-right) + 22px) calc(var(--safe-bottom) + 18px) calc(var(--safe-left) + 22px);
}
.np-top { display: flex; align-items: center; justify-content: space-between; margin: 0 -10px; }
.np-top .icon-btn { color: var(--text); }
.np-top .icon-btn svg { width: 28px; height: 28px; }
.np-context { text-align: center; display: flex; flex-direction: column; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: rgba(255,255,255,.7); }
.np-context b { color: #fff; font-size: 13px; text-transform: none; letter-spacing: 0; margin-top: 2px; }
.np-art-wrap { flex: 1; min-height: 0; display: grid; place-items: center; padding: 18px 0; }
.np-art {
  width: min(100%, 46vh, 380px); height: auto; aspect-ratio: 1; border-radius: 12px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .55); transition: transform .4s var(--ease);
}
.np:not(.is-playing) .np-art { transform: scale(.92); }
.np-meta { display: flex; align-items: center; gap: 10px; }
.np-text { flex: 1; min-width: 0; }
.np-title { margin: 0; font-size: 22px; font-weight: 800; letter-spacing: -.01em; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.np-sub { display: flex; align-items: center; gap: 6px; margin-top: 6px; color: rgba(255, 255, 255, .72); font-size: 15px; min-width: 0; }
.np-sub svg { width: 16px; height: 16px; }
.np-sub span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#np-offline { color: var(--text-2); }
#np-offline.is-saved { color: var(--accent); }

.seek { margin-top: 18px; touch-action: none; }
.seek input[type=range] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 28px; background: transparent; margin: 0; cursor: pointer; display: block;
  --p: 0%;
}
.seek input[type=range]::-webkit-slider-runnable-track {
  height: 4px; border-radius: 4px;
  background: linear-gradient(to right, #fff var(--p), rgba(255, 255, 255, .25) var(--p));
}
.seek input[type=range]::-moz-range-track { height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .25); }
.seek input[type=range]::-moz-range-progress { height: 4px; border-radius: 4px; background: #fff; }
.seek input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%; background: #fff; margin-top: -5px; border: 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .4); transition: transform .15s;
}
.seek input[type=range]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 0; }
.seek input[type=range]:active::-webkit-slider-thumb { transform: scale(1.35); }
.seek input[type=range]:hover::-webkit-slider-runnable-track, .seek input[type=range]:active::-webkit-slider-runnable-track {
  background: linear-gradient(to right, var(--accent) var(--p), rgba(255, 255, 255, .25) var(--p));
}
.seek-times { display: flex; justify-content: space-between; font-size: 12px; color: rgba(255, 255, 255, .7); font-variant-numeric: tabular-nums; margin-top: -2px; }

.controls { display: flex; align-items: center; justify-content: space-between; margin: 14px -8px 0; }
.controls .toggle svg { width: 24px; height: 24px; }
.controls .icon-btn.toggle { color: rgba(255,255,255,.75); }
.controls .icon-btn.toggle.is-on { color: var(--accent); }
.repeat-one {
  display: none; position: absolute; top: 9px; right: 7px; font-style: normal; font-size: 9px; font-weight: 800;
  background: var(--accent); color: var(--accent-ink); width: 13px; height: 13px; border-radius: 50%; line-height: 13px; text-align: center;
}
#btn-repeat[data-mode="count"] .repeat-one { display: block; }
.repeat-one { min-width: 13px; width: auto; padding: 0 2px; }
.play-btn {
  width: 72px; height: 72px; border-radius: 50%; background: #fff; color: #000;
  display: grid; place-items: center; transition: transform .15s var(--ease);
  box-shadow: 0 10px 30px rgba(0,0,0,.35);
}
.play-btn svg { width: 32px; height: 32px; }
.play-btn:hover { transform: scale(1.05); }
.play-btn:active { transform: scale(.92); }

/* ---------- overlay: sheets & dialogs ---------- */
.overlay {
  position: absolute; inset: 0; z-index: 60; background: rgba(0, 0, 0, .6);
  display: flex; flex-direction: column; justify-content: flex-end;
  animation: fade-in .2s ease;
}
.overlay.center { justify-content: center; padding: 24px; }
@keyframes fade-in { from { opacity: 0; } }
.sheet {
  background: #232327; border-radius: 22px 22px 0 0; padding: 8px 8px calc(var(--safe-bottom) + 12px);
  animation: sheet-in .32s var(--ease); max-height: 85%; overflow-y: auto;
}
@keyframes sheet-in { from { transform: translateY(100%); } }
.sheet-grip { width: 38px; height: 5px; border-radius: 3px; background: #4a4a50; margin: 4px auto 10px; }
.sheet-head { display: flex; align-items: center; gap: 12px; padding: 4px 12px 14px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.sheet-head .cover { width: 48px; height: 48px; }
.sheet-head-text { min-width: 0; }
.sheet-head-title { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sheet-head-sub { color: var(--text-2); font-size: 13px; margin-top: 2px; }
.sheet h3 { margin: 6px 14px 12px; font-size: 18px; }
.sheet-item {
  width: 100%; display: flex; align-items: center; gap: 16px; min-height: 52px; padding: 0 14px;
  border-radius: 12px; text-align: left; font-size: 16px; font-weight: 500;
}
.sheet-item:hover, .sheet-item:active { background: rgba(255, 255, 255, .06); }
.sheet-item svg { color: var(--text-2); }
.sheet-item.danger, .sheet-item.danger svg { color: var(--danger); }
.sheet-item.on svg { color: var(--accent); }
.sheet-item .right { margin-left: auto; color: var(--text-3); font-size: 13px; }
.sheet-note { color: var(--text-3); font-size: 13px; line-height: 1.5; padding: 8px 14px 4px; margin: 0; }
.sheet-note.warn { color: #ffcf66; }

.dialog {
  background: #26262a; border-radius: 20px; padding: 22px 20px 16px; width: 100%; max-width: 340px; margin: 0 auto;
  animation: pop-in .22s var(--ease); box-shadow: 0 30px 80px rgba(0,0,0,.6);
}
@keyframes pop-in { from { transform: scale(.92); opacity: 0; } }
.dialog h3 { margin: 0 0 8px; font-size: 19px; }
.dialog p { margin: 0 0 16px; color: var(--text-2); line-height: 1.5; font-size: 15px; }
.dialog input {
  width: 100%; height: 50px; border-radius: 12px; border: 1.5px solid var(--surface-3); background: #141416;
  padding: 0 14px; font-size: 16px; outline: none; margin-bottom: 16px;
}
.dialog input:focus { border-color: var(--accent); }
.dialog-buttons { display: flex; gap: 10px; }
.dialog-buttons button { flex: 1; min-height: 48px; }

/* ---------- toast ---------- */
.toast {
  position: absolute; left: 16px; right: 16px; bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 76px); z-index: 80;
  background: #f2f2f2; color: #111; border-radius: 12px; padding: 12px 14px; font-size: 14.5px; font-weight: 600;
  display: flex; align-items: center; gap: 10px; box-shadow: 0 12px 30px rgba(0, 0, 0, .5);
  transform: translateY(20px); opacity: 0; pointer-events: none; transition: transform .3s var(--ease), opacity .3s;
}
.toast.show { transform: none; opacity: 1; pointer-events: auto; }
.toast span { flex: 1; line-height: 1.35; }
.toast button { color: #7b2cff; font-weight: 800; min-height: 32px; padding: 0 4px; text-transform: uppercase; font-size: 13px; letter-spacing: .04em; }
.toast.error { background: #3a1a1e; color: #ffd5d9; }

/* ---------- lock screen ---------- */
.lock {
  position: absolute; inset: 0; z-index: 100; background: radial-gradient(120% 70% at 50% 0%, #1c1240 0%, var(--bg) 60%);
  display: flex; align-items: center; justify-content: center; overflow-y: auto;
  padding: calc(var(--safe-top) + 16px) 24px calc(var(--safe-bottom) + 16px);
}
.lock-inner { width: 100%; max-width: 320px; text-align: center; }
.lock-logo { border-radius: 18px; box-shadow: 0 12px 40px rgba(176,38,255,.35); }
.lock-title { margin: 18px 0 6px; font-size: 24px; font-weight: 800; }
.lock-sub { margin: 0; color: var(--text-2); font-size: 15px; }
.pin-dots { display: flex; justify-content: center; gap: 14px; height: 18px; margin: 28px 0 8px; }
.pin-dots i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--text-3); transition: background .15s, border-color .15s, transform .15s; }
.pin-dots i.filled { background: var(--accent); border-color: var(--accent); transform: scale(1.1); }
.pin-dots.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-10px); } 40%, 80% { transform: translateX(10px); } }
.pin-text { width: 100%; height: 52px; border-radius: 12px; border: 1.5px solid var(--surface-3); background: #141416; padding: 0 14px; font-size: 17px; margin: 24px 0 4px; outline: none; text-align: center; }
.pin-text:focus { border-color: var(--accent); }
.lock-error { color: var(--danger); min-height: 22px; margin: 8px 0 10px; font-size: 14px; }
.keypad { display: grid; grid-template-columns: repeat(3, 76px); justify-content: center; gap: 14px 22px; }
.keypad button {
  width: 76px; height: 76px; border-radius: 50%; background: rgba(255, 255, 255, .07);
  font-size: 30px; font-weight: 500; display: grid; place-items: center; transition: background .1s, transform .1s;
}
.keypad button:active { background: rgba(255, 255, 255, .2); transform: scale(.94); }
.keypad .key-fn { background: none; }
.keypad .key-ok { background: var(--accent-grad); color: var(--accent-ink); }
.keypad .key-ok svg { width: 30px; height: 30px; }
@media (max-height: 640px) {
  .keypad { grid-template-columns: repeat(3, 64px); gap: 10px 20px; }
  .keypad button { width: 64px; height: 64px; font-size: 26px; }
  .lock-logo { width: 52px; height: 52px; }
  .pin-dots { margin-top: 16px; }
}

/* ---------- sign in (Google / email) ---------- */
.signin { z-index: 101; }
.signin .lock-inner { max-width: 340px; }
.signin .lock-sub { margin-bottom: 26px; }
.si-google {
  width: 100%; height: 52px; border-radius: 14px; background: #fff; color: #1f1f1f; font-size: 16px; font-weight: 600;
  display: flex; align-items: center; justify-content: center; gap: 10px; transition: transform .1s, opacity .1s;
}
.si-google svg { width: 20px; height: 20px; }
.si-google:active, .si-submit:active { transform: scale(.98); }
.si-google:disabled, .si-submit:disabled { opacity: .55; }
.si-note { margin: 10px 0 0; font-size: 13px; color: var(--text-2); line-height: 1.4; }
.si-or { display: flex; align-items: center; gap: 12px; margin: 20px 0; color: var(--text-3); font-size: 13px; }
.si-or::before, .si-or::after { content: ""; flex: 1; height: 1px; background: var(--surface-3); }
.si-input {
  width: 100%; height: 50px; border-radius: 12px; border: 1.5px solid var(--surface-3); background: #141416; color: var(--text);
  padding: 0 14px; font-size: 16px; margin-bottom: 10px; outline: none;
}
.si-input:focus { border-color: var(--accent); }
.si-error { margin: 0 0 8px; min-height: 0; }
.si-error:empty { display: none; }
.si-error.ok { color: var(--accent); }
.si-submit { width: 100%; height: 52px; border-radius: 14px; font-size: 16px; font-weight: 700; }
.si-link { color: var(--accent); font-size: 14px; font-weight: 600; padding: 6px 4px; background: none; }
#si-forgot { margin-top: 10px; }
.si-switch { margin: 4px 0 0; font-size: 14px; color: var(--text-2); }

/* ---------- Editlyst Premium (paywall) ---------- */
.paywall { z-index: 102; }
.paywall .lock-inner { max-width: 360px; }
.pw-list { list-style: none; margin: 22px 0 18px; padding: 0; text-align: left; display: flex; flex-direction: column; gap: 12px; }
.pw-list li { display: flex; gap: 12px; align-items: flex-start; font-size: 15px; line-height: 1.35; }
.pw-list svg { width: 20px; height: 20px; flex: none; margin-top: 1px; padding: 3px; border-radius: 50%; background: var(--accent-grad); color: #000; }
.pw-price {
  border-radius: 16px; padding: 14px; margin-bottom: 14px; display: flex; flex-direction: column; gap: 2px;
  background: linear-gradient(#141416, #141416) padding-box, var(--accent-grad) border-box; border: 1.5px solid transparent;
}
.pw-price b { font-size: 22px; font-weight: 800; }
.pw-price span { color: var(--text-2); font-size: 14px; }
#pw-code-btn { margin-top: 10px; }
.pw-code { display: flex; gap: 8px; margin-top: 8px; }
.pw-code .si-input { margin: 0; text-transform: uppercase; }
.pw-redeem { flex: none; height: 50px; padding: 0 18px; border-radius: 12px; font-weight: 700; }
#pw-test { margin-top: 12px; }

/* ---------- payment form inside the app ---------- */
.paysheet { position: absolute; inset: 0; z-index: 103; background: #fff; color: #1a1a1a; display: flex; flex-direction: column; animation: sheet-in .3s var(--ease); }
.paysheet-bar { display: flex; align-items: center; justify-content: space-between; padding: calc(var(--safe-top) + 8px) 8px 8px 18px; border-bottom: 1px solid #ececf0; }
.paysheet-bar b { font-size: 17px; }
.paysheet-bar .icon-btn { color: #1a1a1a; }
.paysheet-body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding-bottom: var(--safe-bottom); position: relative; }
.paysheet-wait { position: absolute; inset: 0; display: grid; place-items: center; }
#paysheet-mount { min-height: 100%; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- phone-library extras ---------- */
.add-status { display: flex; align-items: center; gap: 10px; margin: 12px 2px 0; color: var(--text-2); font-size: 14px; line-height: 1.4; }
.add-status .spinner { flex: none; }
.storage-meter { margin: 2px 14px 10px; height: 6px; border-radius: 6px; background: var(--surface-3); overflow: hidden; }
.storage-meter i { display: block; height: 100%; background: var(--accent); border-radius: 6px; }
.job.storing .job-status, .job.saved .job-status { color: var(--accent); }

/* ---------- playlists ---------- */
.back-btn { margin-left: -12px; color: var(--text); }
.back-btn svg { width: 26px; height: 26px; }
.section-title.first { margin-top: 6px; }
.pl-rows { list-style: none; margin: 0 0 4px; padding: 0; }
.pl-row { width: 100%; display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 12px; text-align: left; color: var(--text); }
.pl-row:hover { background: #141416; }
.pl-row:active { background: var(--surface); }
.ph.pl-ph { background: linear-gradient(135deg, #0b3a52, #3d0f6b); color: #fff; }
.pl-new .ph.pl-ph { background: var(--surface-2); color: var(--accent); }
.pl-new .track-title { color: var(--text-2); }

.pl-hero { display: flex; gap: 16px; align-items: flex-end; padding: 8px 10px 12px; }
.pl-cover {
  position: relative; flex: none; width: 136px; height: 136px; padding: 0; border-radius: 10px; overflow: hidden;
  background: var(--surface-2); box-shadow: 0 12px 32px rgba(0, 0, 0, .55); color: var(--text);
}
.pl-cover-img, .pl-cover-img img, .pl-cover-img .ph { width: 100%; height: 100%; display: block; }
.pl-cover-img img { object-fit: cover; }
.pl-cover-img .ph { display: grid; place-items: center; }
.pl-cover-img .ph svg { width: 42%; height: 42%; }
.pl-cover-hint {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  background: rgba(0, 0, 0, .62); font-size: 14px; font-weight: 700; opacity: 0; transition: opacity .15s;
}
.pl-cover-hint svg { width: 30px; height: 30px; }
.pl-cover:hover .pl-cover-hint, .pl-cover:focus-visible .pl-cover-hint, .pl-cover:active .pl-cover-hint { opacity: 1; }
.pl-cover-badge {
  position: absolute; right: 6px; bottom: 6px; width: 30px; height: 30px; border-radius: 50%;
  display: none; place-items: center; background: rgba(0, 0, 0, .65);
}
.pl-cover-badge svg { width: 16px; height: 16px; }
@media (hover: none) {
  .pl-cover:not(.has-img) .pl-cover-hint { opacity: 1; background: rgba(0, 0, 0, .35); }
  .pl-cover.has-img .pl-cover-badge { display: grid; }
}
.pl-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; padding-bottom: 2px; }
.pl-kicker { font-size: 12px; font-weight: 700; color: var(--text-2); }
.pl-name {
  width: 100%; min-width: 0; padding: 2px 0; border: 0; border-bottom: 2px solid transparent; border-radius: 0;
  background: none; outline: none; color: var(--text); font: inherit; font-size: 28px; font-weight: 800;
  letter-spacing: -.02em; text-overflow: ellipsis;
}
.pl-name:hover { border-bottom-color: var(--surface-3); }
.pl-name:focus { border-bottom-color: var(--accent); }
.pl-meta { color: var(--text-2); font-size: 13px; }
.pl-actions { display: flex; align-items: center; justify-content: space-between; min-height: 56px; padding: 0 8px 4px 2px; }
.pl-add { margin-top: 0; }
.pl-jobs { margin-top: 10px; }
.pl-list { margin-top: 14px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; pointer-events: none; left: -9999px; }

/* ---------- share sheet (opened from TikTok / Instagram / YouTube) ---------- */
.share-sheet { padding-inline: 12px; }
.share-head { display: flex; align-items: center; gap: 12px; padding: 2px 6px 14px; }
.share-head svg { width: 30px; height: 30px; flex: none; }
.share-head div { min-width: 0; display: flex; flex-direction: column; }
.share-head b { font-size: 17px; }
.share-head span { font-size: 13px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.share-main { width: 100%; }
.share-sub { margin: 18px 6px 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-2); }
.share-lists { display: flex; flex-direction: column; }
.share-pl .cover { width: 40px; height: 40px; border-radius: 6px; }
.share-pl-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.share-cancel { width: 100%; margin-top: 10px; }
.share-done { text-align: center; padding-block: 8px 18px; }
.share-check { display: grid; place-items: center; margin: 6px auto 4px; color: var(--accent); }
.share-check svg { width: 52px; height: 52px; }
.share-done h3 { margin: 6px 0 2px; }
.share-done .sheet-note { padding-bottom: 14px; }

/* ---------- iPhone Share button setup ---------- */
.iphone-setup { padding-inline: 12px; }
.iphone-setup h3 { margin: 6px 6px 6px; }
.copy-row { margin: 10px 6px; }
.copy-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-2); margin-bottom: 6px; }
.copy-box { display: flex; gap: 8px; }
.copy-box input { flex: 1; min-width: 0; height: 44px; border-radius: 10px; border: 1px solid var(--surface-3); background: #141416;
  color: var(--text); padding: 0 10px; font: 13px ui-monospace, Menlo, monospace; }
.copy-btn { min-height: 44px; padding: 0 16px; font-size: 14px; }
.setup-steps { margin: 12px 0 4px; padding: 0 12px 0 30px; display: flex; flex-direction: column; gap: 10px; font-size: 15px; line-height: 1.45; color: var(--text); }
.setup-steps b, .iphone-setup .sheet-note b { color: var(--text); }

/* ---------- "Add to Home Screen" guide ---------- */
.ig {
  position: absolute; inset: 0; z-index: 300; display: flex; align-items: flex-end; justify-content: center;
  background: rgba(0, 0, 0, .55); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, system-ui, sans-serif;
  animation: ig-fade .25s ease;
}
@keyframes ig-fade { from { opacity: 0; } }
.ig-card {
  width: 100%; max-width: 460px; max-height: 100%; overflow-y: auto; color: #1c1c1e; background: #f2f2f7;
  border-radius: 28px 28px 0 0; padding: 10px 18px calc(var(--safe-bottom) + 18px);
  box-shadow: 0 -10px 40px rgba(0, 0, 0, .35);
}
.ig.opening .ig-card { animation: sheet-in .35s var(--ease); }
.ig-grip { width: 38px; height: 5px; border-radius: 3px; background: #c7c7cc; margin: 2px auto 12px; }
.ig-head { display: flex; align-items: center; gap: 12px; }
.ig-head img { width: 54px; height: 54px; border-radius: 13px; flex: none; box-shadow: 0 2px 8px rgba(0, 0, 0, .18); }
.ig-head h2 { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -.01em; }
.ig-head p { margin: 2px 0 0; font-size: 14px; color: #6c6c70; line-height: 1.35; }

/* the drawn phone */
.ig-stage { display: flex; justify-content: center; margin: 16px 0 6px; }
.ig-phone {
  position: relative; width: 196px; height: 300px; border-radius: 32px; padding: 7px; background: #1c1c1e;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .22);
}
.ig-scr { position: relative; width: 100%; height: 100%; border-radius: 26px; overflow: hidden; background: #fff; color: #1c1c1e; font-size: 9px; }
.ig-scr::before { content: ""; position: absolute; top: 6px; left: 50%; width: 52px; height: 15px; border-radius: 10px; background: #1c1c1e; transform: translateX(-50%); z-index: 3; }
.ig-page { position: absolute; inset: 0; padding: 30px 12px 0; background: linear-gradient(#0b0b0c, #160f2a); color: #fff; }
.ig-page .pg-logo { width: 38px; height: 38px; border-radius: 9px; display: block; margin: 18px auto 8px; }
.ig-page .pg-l { height: 6px; border-radius: 3px; background: rgba(255, 255, 255, .22); margin: 6px auto; }
.ig-page .pg-cta { height: 18px; width: 70%; border-radius: 9px; margin: 12px auto 0; background: linear-gradient(120deg, #00d9ff, #b026ff); }
.ig-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 42px; background: rgba(248, 248, 250, .97); border-top: 1px solid #e0e0e4;
  display: flex; align-items: center; justify-content: space-around; padding: 0 6px 6px; color: #007aff; }
.ig-bar.top { top: 0; bottom: auto; height: 50px; padding: 22px 8px 0; border-top: 0; border-bottom: 1px solid #e0e0e4; justify-content: space-between; }
.ig-bar svg { width: 16px; height: 16px; }
.ig-pill { flex: 1; height: 22px; margin: 0 6px; border-radius: 11px; background: #e9e9ee; color: #3c3c43; display: grid; place-items: center; font-size: 8.5px; }
.ig-ico { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; position: relative; }
.ig-dim { color: #c7c7cc; }

.ig-sheet { position: absolute; left: 0; right: 0; bottom: 0; top: 70px; background: #f2f2f7; border-radius: 14px 14px 0 0; padding: 10px 8px; box-shadow: 0 -4px 14px rgba(0, 0, 0, .15); }
.ig-apps { display: flex; gap: 8px; justify-content: center; margin: 4px 0 10px; }
.ig-apps i { width: 26px; height: 26px; border-radius: 7px; background: #d1d1d6; }
.ig-list { background: #fff; border-radius: 9px; overflow: hidden; }
.ig-row { display: flex; align-items: center; justify-content: space-between; height: 24px; padding: 0 9px; border-bottom: 1px solid #ececf0; font-size: 9px; position: relative; }
.ig-row:last-child { border-bottom: 0; }
.ig-row svg { width: 12px; height: 12px; color: #1c1c1e; }
.ig-menu { position: absolute; right: 8px; bottom: 50px; width: 120px; background: rgba(250, 250, 252, .98); border-radius: 11px; box-shadow: 0 6px 22px rgba(0, 0, 0, .22); overflow: hidden; }
.ig-menu.top { top: 52px; bottom: auto; }

.ig-dialog { position: absolute; inset: 0; background: #f2f2f7; padding: 26px 10px 0; }
.ig-dbar { display: flex; justify-content: space-between; align-items: center; font-size: 9.5px; margin-bottom: 14px; }
.ig-dbar b { font-weight: 600; color: #1c1c1e; }
.ig-dbar span { color: #007aff; padding: 3px 4px; border-radius: 6px; position: relative; }
.ig-dbar .ig-strong { font-weight: 700; }
.ig-dcard { display: flex; gap: 8px; align-items: center; background: #fff; border-radius: 9px; padding: 8px; }
.ig-dcard img { width: 34px; height: 34px; border-radius: 8px; }
.ig-dcard div { flex: 1; }
.ig-dcard b { display: block; font-size: 10px; border-bottom: 1px solid #ececf0; padding-bottom: 4px; margin-bottom: 4px; }
.ig-dcard small { color: #8e8e93; font-size: 8px; }
.ig-toggle { margin-top: 10px; background: #fff; border-radius: 9px; padding: 7px 9px; display: flex; justify-content: space-between; align-items: center; font-size: 9px; }
.ig-toggle i { width: 24px; height: 14px; border-radius: 7px; background: #34c759; position: relative; }
.ig-toggle i::after { content: ""; position: absolute; right: 1.5px; top: 1.5px; width: 11px; height: 11px; border-radius: 50%; background: #fff; }

.ig-home { position: absolute; inset: 0; background: linear-gradient(160deg, #3a2a6e, #0f3b54); padding: 34px 14px 0;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px 8px; align-content: start; }
.ig-home i { aspect-ratio: 1; border-radius: 9px; background: rgba(255, 255, 255, .28); }
.ig-home figure { margin: 0; position: relative; text-align: center; }
.ig-home figure img { width: 100%; aspect-ratio: 1; border-radius: 9px; display: block; }
.ig-home figcaption { color: #fff; font-size: 7.5px; margin-top: 2px; }

.ig-andialog { position: absolute; left: 12px; right: 12px; top: 92px; background: #fff; border-radius: 16px; padding: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, .3); text-align: left; }
.ig-andialog b { font-size: 11px; display: block; margin-bottom: 8px; }
.ig-andialog .ig-dcard { padding: 0; background: none; }
.ig-anbtns { display: flex; justify-content: flex-end; gap: 12px; margin-top: 10px; color: #1a73e8; font-weight: 600; font-size: 9.5px; }
.ig-anbtns span { padding: 3px 5px; border-radius: 6px; position: relative; }

/* the thing to tap: a pulsing ring */
.hl { position: relative; z-index: 2; }
.hl::after {
  content: ""; position: absolute; inset: -5px; border-radius: 10px; border: 2.5px solid #ff2d55;
  box-shadow: 0 0 0 4px rgba(255, 45, 85, .18); animation: ig-pulse 1.3s ease-in-out infinite; pointer-events: none;
}
.ig-ico.hl::after { border-radius: 50%; }
@keyframes ig-pulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.12); opacity: .65; } }
@media (prefers-reduced-motion: reduce) { .hl::after { animation: none; } }

.ig-step { text-align: center; margin-top: 12px; min-height: 92px; }
.ig-count { font-size: 12px; font-weight: 600; color: #8e8e93; text-transform: uppercase; letter-spacing: .06em; }
.ig-step h3 { margin: 4px 0 4px; font-size: 19px; font-weight: 700; letter-spacing: -.01em; }
.ig-step p { margin: 0 auto; max-width: 30em; font-size: 15px; line-height: 1.4; color: #3c3c43; }
.ig-step p b { color: #1c1c1e; }
.ig-step .inl { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; background: #e5e5ea; color: #007aff; vertical-align: -6px; margin: 0 2px; }
.ig-step .inl svg { width: 14px; height: 14px; }
.ig-dots { display: flex; justify-content: center; gap: 6px; margin: 12px 0 14px; }
.ig-dots i { width: 7px; height: 7px; border-radius: 50%; background: #d1d1d6; transition: background .2s, width .2s; }
.ig-dots i.on { width: 18px; border-radius: 4px; background: #007aff; }
.ig-btns { display: flex; flex-direction: column; gap: 8px; }
.ig-btn { height: 50px; border-radius: 14px; font-size: 17px; font-weight: 600; background: #007aff; color: #fff; }
.ig-btn.brand { background: linear-gradient(120deg, #00b8e6, #9b2cf0); }
.ig-btn.light { background: #e5e5ea; color: #007aff; }
.ig-btn:active { opacity: .8; }
.ig-later { height: 40px; font-size: 15px; color: #007aff; background: none; }
.ig-nav { display: flex; gap: 8px; }
.ig-nav .ig-btn { flex: 1; }
