:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --ink: #101828;
  --ink-2: #344054;
  --muted: #667085;
  --faint: #98a2b3;
  --line: #e6e9f2;
  --line-strong: #d5dae8;
  --accent: #3a5cff;
  --accent-deep: #2b3fd6;
  --accent-soft: #eef1ff;
  --violet: #8b5cf6;
  --green: #12b76a;
  --amber: #f79009;
  --red: #f04438;
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 11px;
  --shadow-card: 0 18px 50px -28px rgba(16, 24, 40, .28), 0 2px 6px rgba(16, 24, 40, .04);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { margin: 0; }

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

button, input { font-family: inherit; }

/* ---------- 背景光晕 ---------- */
.bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

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

.blob-a {
  width: 560px;
  height: 560px;
  top: -240px;
  left: -140px;
  background: radial-gradient(circle at 40% 40%, #cdd8ff, #e9edff 60%, transparent 72%);
}

.blob-b {
  width: 520px;
  height: 520px;
  top: 80px;
  right: -220px;
  background: radial-gradient(circle at 50% 50%, #d8f5ee, #edf9f6 55%, transparent 72%);
}

/* ---------- 布局 ---------- */
.page {
  position: relative;
  z-index: 1;
  width: min(1060px, calc(100% - 40px));
  margin: 0 auto;
  padding: 44px 0 36px;
}

.hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 26px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.logo {
  flex: none;
  width: 54px;
  height: 54px;
  border-radius: 17px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(140deg, #4b6bff 0%, #3a5cff 45%, #8b5cf6 100%);
  box-shadow: 0 14px 28px -12px rgba(58, 92, 255, .65), inset 0 1px 0 rgba(255, 255, 255, .35);
}

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

.titles h1 {
  margin: 0;
  font-size: 27px;
  line-height: 1.25;
  letter-spacing: -.02em;
  font-weight: 700;
}

.titles p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13.5px;
}

.privacy-pill {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .8);
  border: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 500;
  box-shadow: 0 4px 14px -8px rgba(16, 24, 40, .2);
  backdrop-filter: blur(8px);
}

.privacy-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(18, 183, 106, .14);
}

/* ---------- 拖拽区 ---------- */
.dropzone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 50px 24px 44px;
  border-radius: var(--radius-lg);
  border: 1.5px dashed var(--line-strong);
  background: rgba(255, 255, 255, .66);
  backdrop-filter: blur(6px);
  cursor: pointer;
  transition: border-color .2s, background .2s, transform .2s, box-shadow .2s;
  outline: none;
}

.dropzone:hover,
.dropzone:focus-visible {
  border-color: #b8c3ff;
  background: rgba(255, 255, 255, .85);
}

.dropzone.is-drag {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-2px) scale(1.005);
  box-shadow: 0 24px 50px -30px rgba(58, 92, 255, .6);
}

.dropzone.is-drag .dz-icon {
  transform: translateY(-4px);
  color: var(--accent);
}

.dz-icon {
  width: 62px;
  height: 62px;
  border-radius: 19px;
  display: grid;
  place-items: center;
  color: var(--accent);
  background: linear-gradient(160deg, #eef1ff, #e4e9ff);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .7), 0 10px 22px -14px rgba(58, 92, 255, .7);
  transition: transform .2s, color .2s;
}

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

.dropzone h2 {
  margin: 18px 0 4px;
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -.01em;
}

.dz-sub {
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
}

.dz-link {
  color: var(--accent);
  font-weight: 600;
  border-bottom: 1px solid rgba(58, 92, 255, .35);
}

.formats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-top: 20px;
}

.formats span {
  padding: 3px 9px;
  border-radius: 6px;
  background: rgba(255, 255, 255, .9);
  border: 1px solid var(--line);
  color: var(--faint);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .04em;
}

/* ---------- 工作区 ---------- */
.workspace {
  margin-top: 20px;
  padding: 20px 22px 24px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid rgba(230, 233, 242, .9);
  box-shadow: var(--shadow-card);
  animation: rise .35s ease both;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.summary {
  font-size: 13.5px;
  color: var(--muted);
}

.summary strong {
  color: var(--ink);
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.summary .sep {
  display: inline-block;
  width: 1px;
  height: 11px;
  margin: 0 9px;
  background: var(--line-strong);
  vertical-align: -1px;
}

.done-text strong { color: inherit; }
.done-text.has-done strong { color: var(--green); }

.quality {
  display: flex;
  align-items: center;
  gap: 10px;
}

.quality label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
}

.quality output {
  min-width: 38px;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-size: 12px;
  font-weight: 650;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 150px;
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(to right, var(--accent) 0%, var(--accent) var(--fill, 80%), #e4e7f0 var(--fill, 80%), #e4e7f0 100%);
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--accent);
  box-shadow: 0 2px 6px rgba(16, 24, 40, .18);
  transition: transform .15s;
}

input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.12); }

input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--accent);
}

input[type="range"]::-moz-range-track {
  height: 4px;
  border-radius: 999px;
  background: #e4e7f0;
}

/* ---------- 操作栏 ---------- */
.actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 38px;
  padding: 0 17px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .18s, border-color .18s, transform .12s, box-shadow .18s, opacity .18s;
  white-space: nowrap;
}

.btn svg { width: 16px; height: 16px; }

.btn:hover:not(:disabled) {
  border-color: #c3cbe0;
  background: #fbfcff;
}

.btn:active:not(:disabled) { transform: translateY(1px); }

.btn:disabled {
  opacity: .42;
  cursor: not-allowed;
}

.btn.primary {
  border-color: transparent;
  color: #fff;
  background: linear-gradient(135deg, #4361ff, #3a5cff 55%, #6d5cf6);
  box-shadow: 0 10px 22px -12px rgba(58, 92, 255, .85);
}

.btn.primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #3450f0, #2f4ce0 55%, #5f4ee6);
  border-color: transparent;
}

.btn.ghost {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.btn.ghost:hover:not(:disabled) { background: #f5f6fa; color: var(--ink-2); }

.btn.working svg { animation: spin 1s linear infinite; }

@keyframes spin { to { transform: rotate(360deg); } }

.hint {
  margin-left: auto;
  font-size: 11.5px;
  color: var(--faint);
}

/* ---------- 进度 ---------- */
.progress {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
}

.progress-track {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: #eef0f6;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #3a5cff, #8b5cf6);
  transition: width .25s ease;
}

#progressText {
  flex: none;
  max-width: 46%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* ---------- 缩略图网格 ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(172px, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #fff;
  overflow: hidden;
  transition: box-shadow .2s, transform .2s, border-color .2s;
  animation: pop .25s ease both;
}

@keyframes pop {
  from { opacity: 0; transform: scale(.97); }
  to { opacity: 1; transform: scale(1); }
}

.card:hover {
  transform: translateY(-2px);
  border-color: #d8ddef;
  box-shadow: 0 16px 30px -22px rgba(16, 24, 40, .35);
}

.thumb {
  position: relative;
  aspect-ratio: 4 / 3;
  background:
    linear-gradient(45deg, #f4f6fb 25%, transparent 25%, transparent 75%, #f4f6fb 75%),
    linear-gradient(45deg, #f4f6fb 25%, #fbfcff 25%, #fbfcff 75%, #f4f6fb 75%);
  background-size: 18px 18px;
  background-position: 0 0, 9px 9px;
  overflow: hidden;
}

.thumb-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: #a7b0c6;
}

.thumb-fallback svg { width: 30px; height: 30px; opacity: .6; }

.thumb-ext {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .1em;
  color: #8b95ad;
}

.thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity .3s ease;
}

.card.has-img .thumb img { opacity: 1; }

.badge {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
  padding: 3px 7px;
  border-radius: 5px;
  background: rgba(16, 24, 40, .62);
  color: #fff;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .09em;
  backdrop-filter: blur(6px);
}

.card.has-img .badge { background: rgba(16, 24, 40, .48); }

.remove {
  position: absolute;
  top: 7px;
  right: 7px;
  z-index: 3;
  width: 24px;
  height: 24px;
  padding: 0;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 50%;
  background: rgba(16, 24, 40, .55);
  color: #fff;
  cursor: pointer;
  opacity: 0;
  transform: scale(.9);
  transition: opacity .18s, transform .18s, background .18s;
  backdrop-filter: blur(4px);
}

.remove svg { width: 12px; height: 12px; }

.card:hover .remove,
.card:focus-within .remove { opacity: 1; transform: scale(1); }

.remove:hover { background: rgba(240, 68, 56, .92); }
.remove:disabled { display: none; }

.thumb-loading {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: none;
  place-items: center;
  background: rgba(255, 255, 255, .55);
  backdrop-filter: blur(1.5px);
}

.card.is-working .thumb-loading { display: grid; }

.spinner {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid rgba(58, 92, 255, .2);
  border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}

.card-meta {
  padding: 9px 11px 11px;
}

.card-name {
  margin: 0;
  font-size: 12.5px;
  font-weight: 550;
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-size {
  margin: 3px 0 0;
  font-size: 11px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-size .out-size { color: var(--green); font-weight: 600; }

.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
  min-height: 24px;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--muted);
  min-width: 0;
}

.status::before {
  content: "";
  flex: none;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #c6ccd9;
}

.status span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status.is-working { color: var(--accent-deep); }
.status.is-working::before { background: var(--accent); box-shadow: 0 0 0 3px rgba(58, 92, 255, .12); }

.status.is-done { color: var(--green); }
.status.is-done::before { background: var(--green); }

.status.is-error { color: var(--red); }
.status.is-error::before { background: var(--red); }

.dl {
  flex: none;
  width: 26px;
  height: 26px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: #fff;
  color: #c2c9d8;
  cursor: default;
  transition: color .18s, border-color .18s, background .18s;
}

.dl svg { width: 13px; height: 13px; }

.card.is-done .dl {
  color: var(--accent);
  border-color: #ccd6ff;
  background: var(--accent-soft);
  cursor: pointer;
}

.card.is-done .dl:hover { background: #e0e6ff; border-color: #b9c6ff; }

/* ---------- 其他 ---------- */
.foot {
  margin-top: 24px;
  text-align: center;
  font-size: 11.5px;
  color: var(--faint);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 30px;
  z-index: 20;
  transform: translate(-50%, 14px);
  max-width: min(88vw, 460px);
  padding: 10px 18px;
  border-radius: 10px;
  background: rgba(16, 24, 40, .92);
  color: #fff;
  font-size: 12.5px;
  box-shadow: 0 16px 32px -16px rgba(16, 24, 40, .6);
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s, transform .22s;
  text-align: center;
}

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

/* ---------- 响应式 ---------- */
@media (max-width: 720px) {
  .page { width: calc(100% - 28px); padding-top: 28px; }
  .hero { flex-direction: column; gap: 12px; }
  .titles h1 { font-size: 23px; }
  .titles p { font-size: 12.5px; }
  .privacy-pill { margin-top: 0; align-self: flex-start; }
  .dropzone { padding: 38px 18px 32px; }
  .workspace { padding: 16px 15px 18px; border-radius: 20px; }
  .bar { align-items: flex-start; }
  .quality { width: 100%; justify-content: space-between; }
  input[type="range"] { flex: 1; width: auto; }
  .hint { margin-left: 0; width: 100%; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(142px, 1fr)); gap: 10px; }
  .remove { opacity: 1; transform: scale(1); }
  .formats span:nth-child(n+7) { display: none; }
}

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