:root {
  --bg: #f6f4ef;
  --surface: #ffffff;
  --surface-muted: #faf9f6;
  --border: #e5e0d5;
  --border-strong: #cfc8b8;
  --text: #1f1d1a;
  --text-muted: #666055;
  --accent: #1d4ed8;
  --accent-hover: #1e40af;
  --accent-soft: #eff6ff;
  --success: #15803d;
  --success-soft: #ecfdf5;
  --ko: #0f766e;
  --ko-soft: #f0fdfa;
  --danger: #b91c1c;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(31, 29, 26, 0.05), 0 8px 24px rgba(31, 29, 26, 0.04);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei UI", sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
  background: #f1eee7;
  padding: 0.12em 0.4em;
  border-radius: 5px;
}

.page-shell {
  max-width: 920px;
  margin: 0 auto;
  padding: 28px 18px 48px;
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: #1f1d1a;
  color: #f6f4ef;
  display: grid;
  place-items: center;
  font-family: Georgia, "Songti SC", serif;
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.03em;
  flex-shrink: 0;
}

.brand h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.25;
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge-sub {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  background: #ece8df;
  padding: 2px 8px;
  border-radius: 999px;
}

.subtitle {
  margin: 2px 0 0;
  font-size: 13.5px;
  color: var(--text-muted);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.privacy-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--success);
  background: var(--success-soft);
  border: 1px solid #bbf7d0;
  padding: 5px 11px;
  border-radius: 999px;
  font-weight: 500;
}

.privacy-pill .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
}

.gh-link {
  font-size: 13px;
  color: var(--text);
  text-decoration: none;
  padding: 5px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface);
  transition: background 0.15s, border-color 0.15s;
}

.gh-link:hover {
  background: var(--surface-muted);
  border-color: var(--text);
}

.main-grid {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow);
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.card-head h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.drop-zone {
  border: 2px dashed var(--border-strong);
  border-radius: 12px;
  background: var(--surface-muted);
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.18s, background 0.18s, transform 0.12s;
}

.drop-zone:hover,
.drop-zone:focus-visible,
.drop-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-soft);
  outline: none;
}

.drop-icon {
  color: var(--text-muted);
  margin-bottom: 8px;
}

.drop-zone.drag-over .drop-icon {
  color: var(--accent);
}

.drop-title {
  margin: 0;
  font-size: 15px;
  font-weight: 500;
}

.link-like {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.drop-hint {
  margin: 6px 0 0;
  font-size: 12.5px;
  color: var(--text-muted);
}

.file-list,
.result-list {
  list-style: none;
  padding: 0;
  margin: 14px 0 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.result-list {
  margin-top: 0;
}

.file-item,
.result-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.file-meta,
.result-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.file-name,
.result-name {
  font-size: 14px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-size,
.result-sub {
  font-size: 12px;
  color: var(--text-muted);
}

.target-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

@media (max-width: 680px) {
  .target-grid {
    grid-template-columns: 1fr;
  }
}

.target-card {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-muted);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.target-card:has(input:checked) {
  border-color: var(--accent);
  background: #f8fbff;
}

.target-card input[type="checkbox"] {
  margin-top: 3px;
  width: 17px;
  height: 17px;
  accent-color: var(--accent);
  flex-shrink: 0;
}

.target-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  font-weight: 600;
  font-size: 14.5px;
  margin-bottom: 4px;
}

.target-body p {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-muted);
}

.tag {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.tag-kindle {
  color: var(--accent);
  background: var(--accent-soft);
}

.tag-ko {
  color: var(--ko);
  background: var(--ko-soft);
}

.action-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.btn-primary,
.btn-secondary,
.btn-ghost,
.btn-download {
  font: inherit;
  border-radius: 9px;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s, border-color 0.15s;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 10px 22px;
  font-weight: 600;
  font-size: 14.5px;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-secondary {
  background: #fff;
  color: var(--danger);
  border: 1px solid #fecaca;
  padding: 9px 16px;
  font-weight: 500;
  font-size: 14px;
}

.btn-secondary:hover {
  background: #fef2f2;
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 4px 10px;
  font-size: 12.5px;
}

.btn-ghost:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.btn-remove {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  line-height: 1;
  padding: 4px 8px;
  cursor: pointer;
  border-radius: 6px;
}

.btn-remove:hover {
  color: var(--danger);
  background: #fef2f2;
}

.btn-download {
  background: #1f1d1a;
  color: #fff;
  border: none;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}

.btn-download:hover {
  background: #36332e;
}

.progress-wrap {
  flex: 1;
  min-width: 180px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.progress-track {
  flex: 1;
  height: 8px;
  background: #ebe7de;
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.25s ease;
}

.progress-text {
  font-size: 12.5px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.log-box {
  margin: 0;
  background: #18181b;
  color: #e4e4e7;
  padding: 14px 16px;
  border-radius: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.55;
  max-height: 280px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.fonts-details summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 14.5px;
  user-select: none;
}

.fonts-note {
  margin: 12px 0;
  font-size: 13px;
  color: var(--text-muted);
}

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

.font-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.font-table th,
.font-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}

.font-table th {
  color: var(--text-muted);
  font-weight: 600;
  background: var(--surface-muted);
}

.font-table a {
  color: var(--accent);
  text-decoration: none;
}

.font-table a:hover {
  text-decoration: underline;
}

.footer {
  margin-top: 28px;
  text-align: center;
  font-size: 12.5px;
  color: var(--text-muted);
}
