﻿:root {
  --bg: #f5efe6;
  --bg-accent: #efe2cf;
  --card: rgba(255, 252, 246, 0.92);
  --ink: #30251b;
  --muted: #6d5a4a;
  --line: #dcc7af;
  --brand: #b25832;
  --brand-deep: #7c381f;
  --ok: #22654c;
  --warn: #9e5e13;
  --bad: #8a2d26;
  --shadow: 0 24px 60px rgba(82, 47, 18, 0.12);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", "Noto Sans TC", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(178, 88, 50, 0.18), transparent 28%),
    radial-gradient(circle at bottom right, rgba(146, 94, 42, 0.12), transparent 20%),
    linear-gradient(180deg, var(--bg) 0%, #fbf7f1 100%);
  color: var(--ink);
}

a {
  color: var(--brand-deep);
}

.shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 48px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 18px 22px;
  margin: 24px auto;
  background: rgba(255, 250, 242, 0.84);
  border: 1px solid rgba(220, 199, 175, 0.7);
  border-radius: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.brand {
  font-size: 1.35rem;
  font-weight: 800;
  text-decoration: none;
}

.brand small {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 600;
}

.nav {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.nav a,
.nav button {
  text-decoration: none;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  padding: 10px 14px;
  border-radius: 999px;
}

.nav a:hover,
.nav button:hover {
  background: rgba(178, 88, 50, 0.1);
}

.grid {
  display: grid;
  gap: 20px;
}

.grid.two {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.card {
  background: var(--card);
  border: 1px solid rgba(220, 199, 175, 0.95);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

.hero {
  display: grid;
  gap: 20px;
  align-items: start;
}

.hero h1,
.page-title {
  margin: 0 0 12px;
  font-size: clamp(1.8rem, 4vw, 2.9rem);
  line-height: 1.05;
}

.lead {
  margin: 0;
  color: var(--muted);
  font-size: 1.02rem;
  max-width: 60ch;
}

.label {
  display: block;
  font-size: 0.92rem;
  color: var(--muted);
  margin-bottom: 8px;
}

input,
select,
textarea {
  width: 100%;
  padding: 13px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  font: inherit;
  color: var(--ink);
}

textarea {
  min-height: 132px;
  resize: vertical;
}

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  border-radius: 999px;
  border: 0;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-deep) 100%);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

button:disabled,
.button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.button.secondary,
button.secondary {
  background: rgba(124, 56, 31, 0.1);
  color: var(--brand-deep);
}

.ghost {
  background: rgba(124, 56, 31, 0.08);
  color: var(--brand-deep);
}

.button.warn,
button.warn {
  background: linear-gradient(135deg, #c97130 0%, #9e5e13 100%);
}

.button.bad,
button.bad {
  background: linear-gradient(135deg, #a53a30 0%, #7b231d 100%);
}

.stack {
  display: grid;
  gap: 14px;
}

.song-filter-form {
  min-width: min(100%, 540px);
}

.filter-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.stats-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.stat-card {
  padding: 18px 20px;
  border-radius: 18px;
  border: 1px solid rgba(220, 199, 175, 0.95);
  background: rgba(255, 250, 242, 0.9);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.stat-card strong {
  display: block;
  margin-top: 10px;
  font-size: 2rem;
  line-height: 1;
}

.stat-card span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
}

.stat-card-primary {
  background: linear-gradient(135deg, rgba(178, 88, 50, 0.14) 0%, rgba(124, 56, 31, 0.09) 100%);
}

.soft-card {
  padding: 20px;
  border-radius: 18px;
  border: 1px solid rgba(220, 199, 175, 0.8);
  background: rgba(255, 248, 239, 0.82);
}

.batch-panel {
  gap: 16px;
}

.section-title {
  margin: 0 0 8px;
  font-size: 1.2rem;
}

.log-summary {
  min-width: min(100%, 360px);
}

.log-summary code {
  display: block;
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(124, 56, 31, 0.08);
  color: var(--brand-deep);
  overflow-wrap: anywhere;
}

.selection-toolbar {
  align-items: center;
}

.grouped-song-section {
  padding-top: 20px;
}

.grouped-song-header {
  margin-bottom: 10px;
}

.playlist-entry {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: start;
  padding: 12px 14px;
  border: 1px solid rgba(220, 199, 175, 0.8);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
}

.playlist-entry input {
  width: auto;
  margin-top: 4px;
}

.playlist-entry strong {
  display: block;
  margin-bottom: 6px;
}

.inline-form {
  display: inline;
}

.flash {
  margin-bottom: 18px;
  padding: 14px 16px;
  border-radius: 14px;
  font-weight: 600;
}

.flash.success {
  background: rgba(34, 101, 76, 0.12);
  color: var(--ok);
}

.flash.error {
  background: rgba(138, 45, 38, 0.12);
  color: var(--bad);
}

.flash.info {
  background: rgba(178, 88, 50, 0.1);
  color: var(--brand-deep);
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid rgba(220, 199, 175, 0.6);
}

.checkbox-cell {
  width: 64px;
  text-align: center;
}

.checkbox-cell input[type="checkbox"] {
  width: 18px;
  height: 18px;
}

th {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 700;
}

.badge.queued,
.badge.downloading,
.badge.muxing {
  background: rgba(178, 88, 50, 0.12);
  color: var(--brand-deep);
}

.badge.completed {
  background: rgba(34, 101, 76, 0.13);
  color: var(--ok);
}

.badge.failed,
.badge.disabled {
  background: rgba(138, 45, 38, 0.13);
  color: var(--bad);
}

.badge.expired {
  background: rgba(109, 90, 74, 0.12);
  color: var(--muted);
}

.meta {
  color: var(--muted);
  font-size: 0.94rem;
}

.thumb {
  width: 100%;
  max-width: 320px;
  border-radius: 16px;
  border: 1px solid rgba(220, 199, 175, 0.7);
  display: block;
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.actions-between {
  justify-content: space-between;
  align-items: flex-start;
  margin-top: 0;
}

.row-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.status-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.status-grid .card {
  padding: 16px 18px;
}

.muted {
  color: var(--muted);
}

.hidden {
  display: none !important;
}

.footer-note {
  color: var(--muted);
  margin-top: 22px;
  font-size: 0.92rem;
}

.log-output {
  margin: 0;
  padding: 18px;
  border-radius: 18px;
  border: 1px solid rgba(220, 199, 175, 0.8);
  background: #241c16;
  color: #f6efe8;
  font-family: "Consolas", "Courier New", monospace;
  font-size: 0.92rem;
  line-height: 1.6;
  max-height: 720px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

@media (max-width: 720px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .shell {
    width: min(100% - 20px, 1120px);
  }

  .card {
    padding: 20px;
  }
}

code {
  font-family: "Consolas", "Courier New", monospace;
}

.log-meta-grid {
  min-width: min(100%, 520px);
}

.compact-form {
  gap: 8px;
}

.log-clue-list {
  display: grid;
  gap: 10px;
}

.log-clue-item {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(220, 199, 175, 0.8);
  background: rgba(255, 248, 239, 0.82);
}

.log-clue-item code {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

