:root {
  color-scheme: light;
  --ink: #1d1d1b;
  --muted: #77736c;
  --line: #dedbd2;
  --paper: #f8f7f2;
  --card: #fffefb;
  --accent: #e94f37;
  --accent-dark: #bd3523;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background: radial-gradient(circle at 80% 0%, #f3e4d7 0, transparent 32%), var(--paper);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
}

.page-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.card {
  width: min(100%, 660px);
  padding: clamp(28px, 7vw, 64px);
  border: 1px solid rgba(29, 29, 27, .08);
  border-radius: 24px;
  background: rgba(255, 254, 251, .92);
  box-shadow: 0 24px 80px rgba(67, 52, 37, .12);
}

.eyebrow { color: var(--accent); font-size: 12px; font-weight: 800; letter-spacing: .18em; }
h1 { margin: 14px 0 10px; font-size: clamp(34px, 7vw, 58px); line-height: .98; letter-spacing: -.06em; }
.intro { margin: 0 0 34px; color: var(--muted); font-size: 16px; }
label { display: block; margin-bottom: 9px; font-size: 14px; font-weight: 700; }
.input-row { display: flex; gap: 10px; }
input { flex: 1; min-width: 0; height: 52px; padding: 0 15px; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); background: #fff; font: inherit; outline: none; }
input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(233, 79, 55, .12); }
.quality-title { margin-top: 18px; margin-bottom: 9px; font-size: 14px; font-weight: 700; }
.source-quality-area { margin-top: 2px; }
.quality-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(88px, 1fr)); gap: 8px; }
button { min-width: 112px; border: 0; border-radius: 12px; color: #fff; background: var(--accent); font: inherit; font-weight: 800; cursor: pointer; }
.quality-button { min-width: 0; padding: 9px 5px; border: 1px solid var(--line); color: var(--ink); background: #fff; font-size: 13px; line-height: 1.2; }
.quality-button small { color: var(--muted); font-size: 11px; font-weight: 500; }
.quality-button.is-selected { border-color: var(--accent); color: var(--accent-dark); background: #fff3ef; box-shadow: 0 0 0 2px rgba(233, 79, 55, .12); }
.quality-button.is-selected small { color: var(--accent-dark); }
.download-actions { display: flex; gap: 10px; margin-top: 16px; }
#paste-button, #download-button, #stop-button { flex: 1; min-width: 0; height: 52px; }
#paste-button { background: #2e9b62; }
#paste-button:hover { background: #217647; }
#stop-button { background: #615e58; }
#stop-button:hover { background: #403e3a; }
button:hover { background: var(--accent-dark); }
button.quality-button:hover { color: var(--accent-dark); background: #fff3ef; }
button:disabled { color: #f4f3f0; background: #aaa7a1; cursor: not-allowed; opacity: 1; }
.status { min-height: 24px; margin-top: 14px; color: var(--accent-dark); font-size: 14px; }
.progress-area { margin-top: 14px; }
.progress-meta { display: flex; justify-content: space-between; margin-bottom: 7px; color: var(--muted); font-size: 13px; }
.progress-meta span:last-child { color: var(--accent-dark); font-weight: 800; }
.progress-track { height: 9px; overflow: hidden; border-radius: 99px; background: #eee9df; }
.progress-bar { width: 0; height: 100%; border-radius: inherit; background: var(--accent); transition: width .3s ease; }
.notes { margin-top: 30px; padding-top: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; line-height: 1.7; }
.notes p { margin: 5px 0; }
.notes span { color: var(--ink); font-weight: 700; }

.result-area { margin-top: 18px; }
.meta-card { display: flex; gap: 14px; align-items: flex-start; }
.cover-preview { width: 84px; height: 112px; flex: none; object-fit: cover; border-radius: 12px; background: #eee9df; }
.meta-copy { min-width: 0; flex: 1; }
.work-title { font-size: 16px; font-weight: 800; line-height: 1.35; }
.work-caption { margin-top: 6px; color: var(--muted); font-size: 14px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; max-height: 8.2em; overflow: auto; }
.caption-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.text-button, .secondary-button {
  min-width: 0; height: 36px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 10px;
  color: var(--ink); background: #fff; font-size: 13px; font-weight: 700;
}
.text-button:hover, .secondary-button:hover { color: var(--accent-dark); background: #fff3ef; }
.extra-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.album-preview { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px; margin-top: 14px; }
.album-preview img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; background: #eee9df; }

@media (max-width: 520px) {
  .page-shell { padding: 14px; }
  .card { border-radius: 20px; }
  .input-row { display: grid; grid-template-columns: 1fr; }
  .quality-row { gap: 5px; }
  .quality-button { font-size: 12px; }
  .meta-card { gap: 10px; }
  .cover-preview { width: 72px; height: 96px; }
  .download-actions { flex-wrap: wrap; }
}
