:root {
  --bg: #0f1117;
  --panel: #181b24;
  --panel2: #20242f;
  --border: #2a2f3c;
  --text: #e6e8ee;
  --muted: #8b93a7;
  --accent: #5b8cff;
  --accent2: #7c5bff;
  --ok: #34c77b;
  --warn: #f0b429;
  --err: #ff5d6c;
  --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; }
a { color: var(--accent); }
code { background: var(--panel2); padding: 1px 6px; border-radius: 6px; font-size: .9em; word-break: break-all; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .85em; }

.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 12px 24px; background: rgba(15,17,23,.9); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 18px; }
.brand span { background: linear-gradient(90deg, var(--accent), var(--accent2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tabs a { color: var(--muted); text-decoration: none; padding: 6px 14px; border-radius: 8px; transition: .15s; }
.tabs a:hover { color: var(--text); background: var(--panel2); }
.tabs a.active { color: #fff; background: var(--accent); }
.badge { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--warn); color: #000; font-size: 11px; text-align: center; }

main { max-width: 960px; margin: 24px auto; padding: 0 16px; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 22px; margin-bottom: 18px; }
.card h2 { margin: 0 0 8px; font-size: 20px; }
.row { display: flex; gap: 10px; align-items: center; }
.row.between { justify-content: space-between; flex-wrap: wrap; }
input, select, button { font: inherit; color: var(--text); background: var(--panel2); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; }
input { flex: 1; min-width: 0; }
input:focus, select:focus { outline: none; border-color: var(--accent); }
select { width: 100%; }
button { cursor: pointer; white-space: nowrap; transition: .15s; }
button:hover { border-color: var(--accent); }
button:disabled { opacity: .5; cursor: not-allowed; }
button.primary { background: linear-gradient(90deg, var(--accent), var(--accent2)); border: none; color: #fff; font-weight: 600; }
button.danger { color: var(--err); }
button.wide { width: 100%; margin-top: 12px; padding: 12px; }

.meta { display: flex; gap: 18px; margin-bottom: 16px; }
.meta img { width: 240px; max-width: 40%; aspect-ratio: 16/9; object-fit: cover; border-radius: 10px; background: var(--panel2); }
.meta-info h3 { margin: 0 0 8px; font-size: 18px; line-height: 1.4; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { background: var(--panel2); border: 1px solid var(--border); padding: 2px 10px; border-radius: 20px; font-size: 13px; color: var(--muted); }
.chip:empty { display: none; }
.grid2 { display: grid; grid-template-columns: 2fr 1fr; gap: 14px; }
.grid2 label { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 14px; }

.task-list { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.task { background: var(--panel2); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }
.task-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.task-title { font-weight: 600; word-break: break-all; }
.task-sub { color: var(--muted); font-size: 13px; margin-top: 2px; word-break: break-all; }
.status { font-size: 12px; padding: 2px 10px; border-radius: 20px; white-space: nowrap; background: var(--border); }
.status.done { background: rgba(52,199,123,.15); color: var(--ok); }
.status.failed { background: rgba(255,93,108,.15); color: var(--err); }
.status.downloading, .status.uploading, .status.parsing { background: rgba(91,140,255,.15); color: var(--accent); }
.status.pending { background: rgba(240,180,41,.15); color: var(--warn); }
.bar { height: 6px; background: var(--border); border-radius: 3px; margin-top: 10px; overflow: hidden; }
.bar > div { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent2)); transition: width .4s; }
.task-error { color: var(--err); font-size: 13px; margin-top: 8px; word-break: break-all; }
.empty { text-align: center; color: var(--muted); padding: 30px 0; }

.drive-list { display: flex; flex-direction: column; gap: 14px; margin-top: 14px; }
.drive { background: var(--panel2); border: 1px solid var(--border); border-radius: 10px; padding: 16px; }
.drive-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.drive-name { font-size: 17px; font-weight: 600; }
.pill { font-size: 12px; padding: 2px 10px; border-radius: 20px; margin-left: 6px; }
.pill.real { background: rgba(52,199,123,.15); color: var(--ok); }
.pill.demo { background: rgba(240,180,41,.15); color: var(--warn); }
.pill.local { background: rgba(91,140,255,.15); color: var(--accent); }
.drive ol { margin: 10px 0 0; padding-left: 20px; color: var(--muted); font-size: 14px; }
.drive .btn-link { display: inline-block; text-decoration: none; }

.prose h3 { margin: 22px 0 6px; font-size: 16px; }
.prose li { margin: 4px 0; }

.toast { position: fixed; top: 70px; left: 50%; transform: translateX(-50%); z-index: 20; padding: 10px 18px; border-radius: 10px;
  background: var(--panel2); border: 1px solid var(--border); box-shadow: 0 8px 30px rgba(0,0,0,.4); max-width: 90vw; }
.toast.error { border-color: var(--err); color: var(--err); }
.toast.ok { border-color: var(--ok); color: var(--ok); }

.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff;
  border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -2px; margin-right: 6px; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 640px) {
  .topbar { padding: 10px 14px; }
  .meta { flex-direction: column; }
  .meta img { width: 100%; max-width: 100%; }
  .grid2 { grid-template-columns: 1fr; }
  .row:not(.between) { flex-wrap: wrap; }
  #parseForm input { flex-basis: 100%; }
  #parseForm button { width: 100%; }
}
