:root {
  color-scheme: light;
  font: 14px/1.55 -apple-system, BlinkMacSystemFont, 'Microsoft YaHei UI', 'PingFang SC', sans-serif;
  --bg: #f6f5fa; --card: #fff; --input: #fbfaff; --tint: #f0eaff; --ink: #201832;
  --sub: #645a75; --border: #e8e3f0; --accent: #6441d3; --accent-ink: #5732c0;
  --green: #16774c; --red: #a23248; --red-bg: #fff0f3; --shadow: 0 3px 12px #260e4f07;
}
:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #171420; --card: #221d2e; --input: #2b253a; --tint: #372953; --ink: #f4effe;
  --sub: #c3b8d4; --border: #3d334e; --accent: #7854e8; --accent-ink: #cbb2ff;
  --green: #8ddfb4; --red: #ffadb8; --red-bg: #3a2433;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink); }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(27px, 4.6vw, 43px); line-height: 1.23; letter-spacing: -.045em; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .53; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid #9a76fa; outline-offset: 2px; }
.topbar { min-height: 62px; background: var(--card); border-bottom: 1px solid var(--border); padding: 0 max(20px, calc((100% - 960px) / 2)); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: inline-flex; gap: 8px; align-items: center; font-size: 18px; font-weight: 800; white-space: nowrap; }
.brand span { display: grid; place-items: center; border-radius: 8px; width: 29px; height: 29px; background: var(--accent); color: #fff; font-size: 16px; }
.top-actions { display: flex; gap: 14px; align-items: center; }
.icon-button { width: 33px; height: 33px; background: var(--input); border: 1px solid var(--border); border-radius: 8px; font-size: 20px; line-height: 1; color: var(--sub); flex: none; }
.icon-button:hover { background: var(--tint); }
main { width: min(calc(100% - 36px), 960px); margin: 0 auto; padding-bottom: 36px; }
.page-title { padding: 34px 0 24px; }
.page-title p { color: var(--sub); font-size: 14px; margin-top: 9px; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 13px; margin-bottom: 12px; padding: 16px 18px; box-shadow: var(--shadow); scroll-margin: 10px; }
.section-top { min-height: 28px; display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 11px; }
.muted { color: var(--sub); font-size: 12px; overflow-wrap: anywhere; }
.button { display: inline-flex; justify-content: center; align-items: center; border: 1px solid transparent; border-radius: 8px; padding: 8px 13px; min-height: 36px; font-weight: 700; font-size: 13px; text-align: center; }
.button.primary { background: var(--accent); color: white; }
.button.primary:hover:not(:disabled) { filter: brightness(.94); }
.button.secondary { background: var(--card); color: var(--sub); border-color: var(--border); }
.button.secondary:hover:not(:disabled) { background: var(--tint); color: var(--accent-ink); }
.button.compact { min-height: 28px; font-size: 12px; padding: 4px 8px; }
.text-button { border: 0; background: transparent; padding: 3px 0; color: var(--accent-ink); font-size: 12px; font-weight: 700; white-space: nowrap; text-align: left; }
.text-button:hover:not(:disabled) { text-decoration: underline; }
.drive-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.provider { text-align: left; display: flex; align-items: center; gap: 10px; border: 1px solid var(--border); border-radius: 9px; background: var(--input); min-width: 0; padding: 9px 10px; }
.provider:hover { border-color: #a98cf2; }
.provider-icon { width: 34px; height: 34px; border-radius: 8px; flex: none; display: grid; place-items: center; font-weight: 800; }
.provider strong { display: block; font-size: 13px; }
.provider small { display: block; color: var(--sub); font-size: 11px; }
.provider small.connected { color: var(--green); }
.provider-arrow { margin-left: auto; color: var(--sub); font-size: 12px; white-space: nowrap; }
.baidu { color: #2b55aa; background: #edf3ff; }
.quark { color: #6542bd; background: #eee7ff; }
.import-row { display: flex; align-items: stretch; gap: 7px; }
.import-row input { flex: 1; min-width: 0; }
.import-row button { flex: none; }
input:not([type='file'], [type='checkbox']), textarea, .editable { background: var(--input); border: 1px solid var(--border); padding: 9px 11px; border-radius: 8px; width: 100%; }
input::placeholder, textarea::placeholder, .editable:empty::before { color: var(--sub); opacity: .85; }
.editable { min-height: 100px; white-space: pre-wrap; overflow-wrap: anywhere; }
.editable:empty::before { content: attr(data-placeholder); pointer-events: none; }
textarea { resize: vertical; }
.import-options { display: flex; gap: 14px; align-items: center; margin-top: 5px; }
#batch-fields, #paste-fields { margin-top: 9px; }
#batch-fields .button { margin-top: 5px; }
#paste-fields label { display: block; color: var(--sub); font-size: 12px; font-weight: 700; margin: 6px 0; }
.file-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 3px 0; }
#paste-fields .file-label { position: relative; color: var(--accent-ink); cursor: pointer; }
.file-label:focus-within { outline: 2px solid #9a76fa; }
.file-label input, .clipboard-buffer { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.form-message { overflow-wrap: anywhere; white-space: pre-line; font-size: 12px; color: var(--sub); margin-top: 8px; }
.error { color: var(--red) !important; }
.selection-bar, .link-pages { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; }
.selection-bar label { display: flex; gap: 6px; align-items: center; font-size: 12px; }
.selection-bar input, .link-row input { accent-color: var(--accent); margin: 0; width: 15px; height: 15px; flex: none; }
.link-pages { justify-content: flex-end; border-top: 1px solid var(--border); padding-top: 9px; }
.link-row { display: flex; gap: 12px; align-items: center; padding: 9px 0; border-top: 1px solid var(--border); }
.link-row:first-child { margin-top: 9px; }
.link-info { flex: 1; min-width: 0; }
.link-info .source { display: block; overflow-wrap: anywhere; color: var(--sub); font-size: 12px; }
.link-info .replacement, .pill.done { color: var(--green); }
.link-actions, .form-actions, .article-tabs { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.link-actions { justify-content: flex-end; }
.pill { display: inline-flex; font-size: 11px; border-radius: 5px; padding: 1px 6px; margin: 0 5px 4px 0; }
.pill:not(.baidu):not(.quark) { background: var(--input); }
.pill.problem { background: var(--red-bg) !important; color: var(--red); }
.row-detail { position: relative; flex: none; }
.row-detail summary { display: block; list-style: none; cursor: pointer; }
.row-detail summary::-webkit-details-marker { display: none; }
.row-detail .link-actions { padding-top: 5px; }
.align-right { margin-left: auto; }
.article-tabs button[aria-pressed='true'] { background: var(--tint); color: var(--accent-ink); }
.article-bar { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin: 9px 0; overflow-wrap: anywhere; }
.compare { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.compare > section { border: 1px solid var(--border); border-radius: 9px; min-width: 0; }
.compare-head { display: flex; gap: 6px; justify-content: space-between; align-items: center; flex-wrap: wrap; border-bottom: 1px solid var(--border); background: var(--input); padding: 7px 9px; border-radius: 9px 9px 0 0; }
.article-preview { min-height: 120px; max-height: 52vh; overflow: auto; overflow-wrap: anywhere; padding: 11px; }
.article-preview p { margin-bottom: 8px; }
.article-preview a { color: var(--accent-ink); text-decoration: underline; }
.article-preview img { max-width: 100%; height: auto; }
.article-preview .swapped { background: var(--tint); }
.empty { text-align: center; color: var(--sub); padding: 21px 8px; }
.empty p { font-size: 12px; margin-top: 4px; }
.history-row { border-top: 1px solid var(--border); display: flex; gap: 12px; align-items: center; padding: 9px 0; }
.history-row p { color: var(--sub); font-size: 12px; }
.history-row strong { overflow-wrap: anywhere; }
dialog { width: min(530px, calc(100% - 20px)); max-height: calc(100% - 26px); padding: 0; border: 1px solid var(--border); border-radius: 13px; background: var(--card); color: var(--ink); box-shadow: 0 18px 65px #26144045; }
dialog.wide { width: min(780px, calc(100% - 20px)); }
dialog::backdrop { background: #25163d66; }
.dialog-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 11px 14px; border-bottom: 1px solid var(--border); }
.dialog-body { padding: 13px 14px 16px; }
.dialog-body ol { padding-left: 20px; }
.dialog-body .form-actions { margin-top: 10px; }
.bind-form { margin-top: 13px; }
.bind-form label { display: block; font-weight: 700; font-size: 12px; margin-bottom: 5px; }
.bind-hint { border-radius: 8px; background: var(--input); border: 1px solid var(--border); padding: 9px 11px; margin-top: 9px; color: var(--sub); font-size: 12px; }
.bind-hint ol { margin: 5px 0; padding-left: 19px; }
.bind-hint p + p { margin-top: 4px; }
.official-bind { margin-top: 12px; color: var(--sub); font-size: 12px; }
.official-bind summary { cursor: pointer; }
.folder-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 228px), 1fr)); gap: 9px; margin-top: 10px; }
.folder-panel { border: 1px solid var(--border); border-radius: 9px; padding: 9px; min-width: 0; }
.folder-panel h3 { margin-bottom: 6px; }
.breadcrumbs { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; margin-bottom: 5px; color: var(--sub); }
.folder-list, .progress-list { max-height: 245px; overflow: auto; }
.folder-panel .folder-search { margin-bottom: 5px; }
.folder-list button { width: 100%; text-align: left; border: 0; background: var(--input); border-radius: 6px; display: flex; justify-content: space-between; gap: 5px; padding: 5px 8px; margin-bottom: 3px; overflow-wrap: anywhere; }
.folder-list button:hover { background: var(--tint); }
.folder-panel .folder-selected { color: var(--accent-ink); font-size: 12px; margin: 5px 0; overflow-wrap: anywhere; }
.progress-row { display: flex; gap: 8px; align-items: center; padding: 7px 0; overflow-wrap: anywhere; border-bottom: 1px solid var(--border); }
.progress-row div { flex: 1; min-width: 0; }
.progress-row .muted { display: block; }
progress { width: 100%; height: 10px; margin: 7px 0; accent-color: var(--accent); }
.toast { position: fixed; z-index: 2; bottom: 17px; right: 17px; background: var(--ink); color: var(--card); padding: 8px 12px; border-radius: 8px; max-width: calc(100% - 34px); }
.toast.error { background: var(--red-bg); }
#dialog-feedback { margin-left: auto; color: var(--green); }
@media (max-width: 580px) {
  main { width: calc(100% - 22px); }
  .topbar { min-height: 52px; padding: 0 11px; }
  .page-title { padding: 21px 0 16px; }
  .page-title p { font-size: 12px; }
  .card { padding: 12px; }
  .provider { padding: 6px; gap: 6px; }
  .provider-icon { width: 26px; height: 26px; }
  .provider-arrow { display: none; }
  .import-row { flex-wrap: wrap; }
  .import-row input { flex: 1 0 100%; }
  .compare { grid-template-columns: 1fr; }
  .article-preview { max-height: 34vh; }
  .link-row { flex-wrap: wrap; gap: 3px 8px; }
  .link-info { flex-basis: calc(100% - 24px); }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
