/* icourse163-dl-web — 深色极简主题 */
:root {
  --bg: #0A0A0A;
  --card: #141414;
  --card-hover: #1A1A1A;
  --line: #2A2A2A;
  --text: #E8DCC4;
  --text-dim: #8B8478;
  --text-mute: #5C584F;
  --accent: #E8DCC4;
  --accent-dim: #B8AC93;
  --error: #D97757;
  --success: #97B498;
  --info: #6B8FA8;
  --radius: 4px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

body::before {
  /* 极淡的网格底纹 */
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(232,220,196,0.018) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(232,220,196,0.018) 1px, transparent 1px);
  background-size: 32px 32px;
  pointer-events: none;
  z-index: 0;
}

.page {
  position: relative;
  max-width: 720px;
  margin: 0 auto;
  padding: 80px 24px 60px;
  z-index: 1;
}

/* ─── Header ─── */
.hero { margin-bottom: 48px; }
.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 36px;
  font-size: 14px;
}
.logo-mark {
  color: var(--accent);
  font-size: 16px;
}
.logo-text {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  color: var(--text-dim);
  letter-spacing: 0.02em;
}
.logo-text .serif { font-family: 'Fraunces', serif; font-weight: 400; }
.logo-text .italic { font-style: italic; }
.logo-text .dot { color: var(--text-mute); }

.title {
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: 44px;
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--text);
  margin-bottom: 12px;
}
.sub {
  color: var(--text-dim);
  font-size: 15px;
}

/* ─── Card ─── */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
  transition: border-color .15s ease;
}
.card:focus-within { border-color: var(--text-mute); }

/* ─── URL Row ─── */
.url-row {
  display: flex;
  gap: 12px;
  align-items: stretch;
}
.url-row input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  color: var(--text);
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  outline: none;
  transition: border-color .15s ease;
}
.url-row input::placeholder { color: var(--text-mute); }
.url-row input:focus { border-color: var(--accent-dim); }

.primary {
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: var(--radius);
  padding: 0 28px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: opacity .15s ease, transform .15s ease;
  font-family: 'Inter', sans-serif;
  letter-spacing: 0.02em;
}
.primary:hover { opacity: 0.88; }
.primary:active { transform: scale(0.98); }
.primary:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* ─── Advanced ─── */
.advanced {
  margin-top: 16px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}
.advanced summary {
  color: var(--text-dim);
  font-size: 13px;
  cursor: pointer;
  user-select: none;
  list-style: none;
}
.advanced summary::-webkit-details-marker { display: none; }
.advanced summary::before {
  content: '▸ ';
  color: var(--text-mute);
  transition: transform .15s ease;
  display: inline-block;
}
.advanced[open] summary::before { transform: rotate(90deg); }

.adv-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 16px;
}
.adv-grid label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--text-dim);
}
.adv-grid label.check {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text);
}
.adv-grid label.check input { width: 14px; height: 14px; accent-color: var(--accent); }
.adv-grid textarea, .adv-grid select, .adv-grid input[type="number"] {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 10px;
  color: var(--text);
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  outline: none;
  resize: vertical;
}
.adv-grid textarea:focus, .adv-grid select:focus, .adv-grid input:focus {
  border-color: var(--accent-dim);
}

/* ─── Progress ─── */
.prog-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--text-dim);
}
.prog-head > div { display: flex; align-items: center; gap: 8px; }
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-mute);
  display: inline-block;
  animation: pulse 1.6s ease-in-out infinite;
}
.status-dot.running { background: var(--info); }
.status-dot.done { background: var(--success); animation: none; }
.status-dot.fail { background: var(--error); animation: none; }
.status-text { font-weight: 500; }
.meta { color: var(--text-mute); font-family: 'JetBrains Mono', monospace; font-size: 11px; }

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

.log {
  list-style: none;
  max-height: 320px;
  overflow-y: auto;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 0;
}
.log li {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  padding: 3px 14px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  animation: slide-in .15s ease-out;
}
.log li.ok  { color: var(--text); }
.log li.skip { color: var(--text-mute); }
.log li.fail { color: var(--error); }
.log li.info { color: var(--text-dim); }
.log li.done { color: var(--success); font-weight: 500; }

@keyframes slide-in {
  from { opacity: 0; transform: translateX(-4px); }
  to   { opacity: 1; transform: none; }
}

.prog-foot {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
}

/* 完成态：放大版下载按钮 */
.done-actions {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: stretch;
}
.done-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}
.download-zip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 18px 28px;
  font-size: 15px;
  letter-spacing: 0.04em;
  text-transform: none;
  background: var(--accent);
  color: var(--bg);
  text-decoration: none;
  border-radius: var(--radius);
  font-weight: 600;
  transition: opacity .15s ease, transform .15s ease;
}
.download-zip:hover { opacity: 0.88; }
.download-zip:active { transform: scale(0.99); }
.download-zip .download-icon {
  display: inline-block;
  font-size: 18px;
  transform: translateY(1px);
}
.ghost {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 13px;
  cursor: pointer;
  border: 1px solid var(--line);
  padding: 6px 12px;
  border-radius: var(--radius);
  transition: color .15s, border-color .15s;
}
.ghost:hover { color: var(--accent); border-color: var(--accent-dim); }

/* ─── Files ─── */
.title2 {
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: 18px;
  color: var(--text);
}
.files {
  list-style: none;
  display: grid;
  gap: 4px;
  margin-top: 12px;
}
.files li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
}
.files li a {
  color: var(--text);
  text-decoration: none;
}
.files li a:hover { color: var(--accent); }
.files li .size { color: var(--text-mute); }

.footer {
  margin-top: 64px;
  text-align: center;
  color: var(--text-mute);
  font-size: 11px;
}

.hidden { display: none; }

/* ─── Scrollbar ─── */
.log::-webkit-scrollbar { width: 6px; }
.log::-webkit-scrollbar-track { background: transparent; }
.log::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }