/* NCM 转 MP3 — 本地解密界面 */
:root {
  --bg: #08080c;
  --text: #f4f4f7;
  --muted: #9c9ca8;
  --dim: #6f6f7c;
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.16);
  --panel: rgba(255, 255, 255, 0.038);
  --panel-hover: rgba(255, 255, 255, 0.06);
  --accent: #ff4d5e;
  --accent-soft: #ff707e;
  --accent-glow: rgba(255, 77, 94, 0.35);
  --ok: #38d996;
  --warn: #ffb648;
  --err: #ff6b6b;
  --radius: 18px;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "tnum" 1;
}

[hidden] { display: none !important; }

/* ---------- ambient background ---------- */
.ambient {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.55;
}

.glow-a {
  width: 620px;
  height: 620px;
  top: -300px;
  left: -180px;
  background: radial-gradient(circle, rgba(255, 77, 94, 0.28), transparent 68%);
}

.glow-b {
  width: 720px;
  height: 720px;
  right: -300px;
  top: -180px;
  background: radial-gradient(circle, rgba(108, 92, 255, 0.2), transparent 68%);
}

.grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.022) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse at 50% 0%, rgba(0, 0, 0, 0.85), transparent 72%);
  -webkit-mask-image: radial-gradient(ellipse at 50% 0%, rgba(0, 0, 0, 0.85), transparent 72%);
}

/* ---------- shell ---------- */
.shell {
  position: relative;
  z-index: 1;
  width: min(860px, 100%);
  margin: 0 auto;
  padding: 40px 26px 54px;
}

/* ---------- top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 30px;
}

.brand { display: flex; align-items: center; gap: 13px; }

.logo {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 13px;
  color: #fff;
  background: linear-gradient(145deg, #ff6572, #ff375f 55%, #f02d6c);
  box-shadow: 0 8px 26px rgba(255, 61, 95, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.logo svg { width: 22px; height: 22px; }

.brand-text h1 {
  margin: 0;
  font-size: 19px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.brand-text p {
  margin: 3px 0 0;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.privacy-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.privacy-pill svg { width: 13px; height: 13px; color: var(--ok); }

.pills {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.license-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  border: 1px solid rgba(56, 217, 150, 0.26);
  border-radius: 999px;
  background: rgba(56, 217, 150, 0.08);
  color: #82e7bd;
  font-size: 12px;
  white-space: nowrap;
}

.license-pill svg { width: 13px; height: 13px; }


/* ---------- dropzone ---------- */
.dropzone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 46px 24px 36px;
  border: 1.5px dashed rgba(255, 255, 255, 0.14);
  border-radius: 24px;
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(255, 255, 255, 0.06), transparent 60%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.015));
  cursor: pointer;
  user-select: none;
  transition: border-color 0.25s ease, background 0.25s ease, transform 0.25s ease;
}

.dropzone:hover,
.dropzone.is-dragover {
  border-color: rgba(255, 96, 110, 0.55);
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(255, 96, 110, 0.1), transparent 62%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
}

.dropzone:focus-visible {
  outline: 2px solid var(--accent-soft);
  outline-offset: 3px;
}

.drop-visual { margin-bottom: 18px; }

.drop-icon {
  display: grid;
  place-items: center;
  width: 66px;
  height: 66px;
  border-radius: 50%;
  color: #ffd9dd;
  background:
    radial-gradient(circle at 50% 120%, rgba(255, 77, 94, 0.5), rgba(255, 77, 94, 0.08) 60%),
    rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 120, 132, 0.3);
  box-shadow: 0 0 0 8px rgba(255, 77, 94, 0.045), 0 12px 32px rgba(0, 0, 0, 0.35);
}

.drop-icon svg { width: 28px; height: 28px; }

.dropzone h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 620;
  letter-spacing: -0.015em;
}

.drop-sub {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.text-link {
  color: var(--accent-soft);
  font-weight: 550;
  border-bottom: 1px solid rgba(255, 112, 126, 0.35);
  padding-bottom: 1px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 24px;
}

.chip {
  padding: 5px 10px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.028);
  color: #8d8d9a;
  font-size: 11.5px;
  letter-spacing: 0.01em;
}

/* ---------- gate (card key) ---------- */
.gate {
  position: relative;
  padding: 42px 24px 28px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(255, 77, 94, 0.1), transparent 58%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.018));
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.35);
  text-align: center;
  animation: rise 0.35s ease both;
}

.gate-icon {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  margin: 0 auto 18px;
  border-radius: 50%;
  color: #ffd0d5;
  background:
    radial-gradient(circle at 50% 120%, rgba(255, 77, 94, 0.55), rgba(255, 77, 94, 0.06) 65%),
    rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 120, 132, 0.28);
  box-shadow: 0 0 0 8px rgba(255, 77, 94, 0.04), 0 10px 28px rgba(0, 0, 0, 0.35);
}

.gate-icon svg { width: 26px; height: 26px; }

.gate h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 620;
  letter-spacing: -0.02em;
}

.gate-sub {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.gate-form {
  display: flex;
  gap: 8px;
  max-width: 480px;
  margin: 24px auto 0;
}

.gate-form.shake { animation: shake 0.35s ease; }

.gate-input {
  flex: 1;
  min-width: 0;
  height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.35);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  font-size: 13.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.gate-input::placeholder { color: #565661; letter-spacing: 0.05em; }

.gate-input:focus {
  outline: none;
  border-color: rgba(255, 96, 110, 0.6);
  background: rgba(0, 0, 0, 0.45);
  box-shadow: 0 0 0 3px rgba(255, 77, 94, 0.14);
}

.gate-form .gate-btn {
  height: 46px;
  padding: 0 24px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 560;
}

.gate-msg {
  min-height: 18px;
  margin: 12px 0 0;
  font-size: 12.5px;
  color: #ff9a9a;
}

.gate-msg.is-ok { color: var(--ok); }

.gate-note {
  margin: 6px 0 0;
  font-size: 11.5px;
  color: var(--dim);
}

/* ---------- workspace ---------- */
.workspace { animation: rise 0.35s ease both; }

.list-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin: 26px 0 12px;
}

.head-text h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.head-text p {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--dim);
}

.head-actions { display: flex; gap: 8px; align-items: center; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 520;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease,
    transform 0.12s ease, opacity 0.18s ease;
  white-space: nowrap;
}

.btn:active { transform: scale(0.975); }

.btn:focus-visible {
  outline: 2px solid var(--accent-soft);
  outline-offset: 2px;
}

.btn-primary {
  background: linear-gradient(180deg, #ff5a6a, #f73a55);
  border-color: rgba(255, 255, 255, 0.12);
  color: #fff;
  box-shadow: 0 6px 18px rgba(247, 58, 85, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(180deg, #ff6e7c, #fb4660);
  box-shadow: 0 8px 24px rgba(247, 58, 85, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.btn-ghost {
  border-color: var(--line);
  background: var(--panel);
  color: #cfcfd8;
}

.btn-ghost:hover:not(:disabled) {
  border-color: var(--line-strong);
  background: var(--panel-hover);
  color: #fff;
}

.btn-ghost.danger:hover:not(:disabled) {
  border-color: rgba(255, 107, 107, 0.35);
  color: #ff9a9a;
}

.btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.link-btn {
  padding: 0;
  border: none;
  background: none;
  color: var(--dim);
  font: inherit;
  font-size: 11px;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.link-btn:hover { color: #b9b9c4; }

.btn-sm {
  height: 30px;
  padding: 0 12px;
  font-size: 12.5px;
  border-radius: 9px;
}

/* ---------- list ---------- */
.list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.022));
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.22);
  animation: rise 0.35s ease both;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.item:hover { border-color: var(--line-strong); }

.item.is-error { border-color: rgba(255, 107, 107, 0.28); }

.item.no-anim { animation: none; }

.thumb {
  flex: none;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 12px;
  overflow: hidden;
  color: rgba(255, 255, 255, 0.72);
  background:
    radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.16), transparent 55%),
    linear-gradient(145deg, #3a2b4a, #241d2e);
  border: 1px solid rgba(255, 255, 255, 0.09);
}

.thumb svg { width: 20px; height: 20px; opacity: 0.85; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }

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

.title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

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

.status {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--dim);
  font-size: 11px;
  font-weight: 500;
}

.status::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.9;
}

.status-ready { color: var(--ok); background: rgba(56, 217, 150, 0.1); }
.status-decoding { color: var(--warn); background: rgba(255, 182, 72, 0.1); }
.status-decoding::before { animation: pulse 1.1s ease-in-out infinite; }
.status-error { color: var(--err); background: rgba(255, 107, 107, 0.1); }

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

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

.badge {
  padding: 2px 7px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.032);
  color: #92929f;
  font-size: 11px;
  line-height: 1.45;
}

.badge-format {
  color: #ffa8b0;
  border-color: rgba(255, 96, 110, 0.24);
  background: rgba(255, 77, 94, 0.08);
  font-weight: 600;
  letter-spacing: 0.04em;
}

.progress {
  position: relative;
  height: 3px;
  margin-top: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  overflow: hidden;
}

.progress i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #ff375f, #ff8a72);
  transition: width 0.18s ease;
}

.out {
  margin-top: 9px;
  font-size: 11.5px;
  color: var(--dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.out strong { color: #b9b9c4; font-weight: 500; }

.error-msg {
  margin-top: 8px;
  font-size: 12px;
  color: #ff9a9a;
}

.item-actions {
  flex: none;
  display: flex;
  align-items: center;
  gap: 7px;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--dim);
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.icon-btn svg { width: 15px; height: 15px; }

.icon-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--line);
  color: #fff;
}

.icon-btn:disabled { opacity: 0.35; cursor: default; }

.icon-btn:focus-visible {
  outline: 2px solid var(--accent-soft);
  outline-offset: 2px;
}

.icon-btn.is-playing { color: #fff; background: rgba(255, 77, 94, 0.16); border-color: rgba(255, 96, 110, 0.3); }

/* ---------- footer ---------- */
.footer {
  margin-top: 42px;
  text-align: center;
  color: var(--dim);
  font-size: 12px;
  line-height: 1.8;
}

.footer .fine {
  font-size: 11px;
  color: #5c5c68;
}

/* ---------- overlay & toast ---------- */
.drag-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  background: rgba(6, 6, 10, 0.72);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  animation: fade 0.18s ease both;
}

.drag-overlay-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: calc(100% - 36px);
  height: calc(100% - 36px);
  border: 2px dashed rgba(255, 96, 110, 0.5);
  border-radius: 28px;
}

.overlay-icon {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  margin-bottom: 18px;
  border-radius: 50%;
  color: #ffd9dd;
  background: rgba(255, 77, 94, 0.14);
  border: 1px solid rgba(255, 120, 132, 0.35);
}

.overlay-icon svg { width: 30px; height: 30px; }

.drag-overlay-inner h2 { margin: 0; font-size: 22px; font-weight: 620; }
.drag-overlay-inner p { margin: 8px 0 0; font-size: 13px; color: var(--muted); }

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 50;
  transform: translate(-50%, 14px);
  max-width: min(520px, calc(100vw - 40px));
  padding: 10px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: rgba(24, 24, 31, 0.94);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.5);
  color: #e8e8ee;
  font-size: 12.5px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- responsive ---------- */
@media (max-width: 680px) {
  .shell { padding: 28px 18px 42px; }
  .dropzone { padding: 38px 18px 30px; }
  .dropzone h2 { font-size: 18px; }
  .chips { display: none; }
  .privacy-pill { display: none; }
  .gate { padding: 34px 18px 24px; }
  .gate h2 { font-size: 19px; }
  .gate-form { flex-direction: column; }
  .gate-input { flex: 0 0 auto; width: 100%; height: 46px; }
  .gate-form .gate-btn { width: 100%; }
  .gate-form { gap: 10px; }
  .item { flex-wrap: wrap; }
  .item-actions { width: 100%; justify-content: flex-end; }
  .list-head { align-items: flex-start; }
}

/* ---------- motion ---------- */
@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes pulse {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 1; }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-7px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(3px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
