:root {
  --bg: #fbf6ee;
  --card: #fffdf7;
  --ink: #2b2b33;
  --muted: #7a7568;
  --line: #e7dfd0;
  --accent: #0fa968;
  --accent-dark: #0c8a55;
  --accent-soft: #e6f6ee;
  --danger: #d64545;
  --radius: 16px;
  --shadow: 0 1px 3px rgba(43, 43, 51, 0.07), 0 8px 24px rgba(43, 43, 51, 0.05);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  width: 100%;
  max-width: 880px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- header ---------- */

.site-header {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  font-weight: 700;
  font-size: 19px;
  letter-spacing: 0.2px;
}

.logo em {
  font-style: normal;
  color: var(--accent);
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 22px;
}

.header-nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 15px;
}

.header-nav a:hover { color: var(--ink); }

.lang-toggle {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 4px 14px;
  font-size: 13px;
  cursor: pointer;
}

.lang-toggle:hover { color: var(--ink); border-color: var(--muted); }

/* ---------- hero ---------- */

.hero {
  text-align: center;
  padding: 48px 0 8px;
}

.hero h1 {
  font-size: clamp(30px, 5vw, 42px);
  margin: 0 0 8px;
  letter-spacing: 0.5px;
}

.hero .sub {
  color: var(--muted);
  font-size: 17px;
  margin: 0 0 14px;
}

.privacy-pill {
  display: inline-block;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 14px;
  font-weight: 600;
  border-radius: 999px;
  padding: 6px 18px;
  margin: 0 0 24px;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 16px;
  font-size: 15px;
  color: var(--muted);
}

.toolbar select {
  font: inherit;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 6px 12px;
  cursor: pointer;
}

.dropzone {
  background: var(--card);
  border: 2px dashed #cfc4ab;
  border-radius: 22px;
  padding: 56px 24px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.1s ease;
  color: var(--ink);
  outline: none;
}

.dropzone:hover,
.dropzone:focus-visible {
  border-color: var(--accent);
}

.dropzone.dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: scale(1.01);
}

.dz-icon { color: var(--accent); }

.dz-main {
  font-size: 18px;
  font-weight: 600;
  margin: 14px 0 4px;
}

.dz-hint {
  color: var(--muted);
  font-size: 14px;
  margin: 0;
}

.paste-hint {
  color: var(--muted);
  font-size: 13px;
  margin: 12px 0 0;
}

/* ---------- results ---------- */

.results { margin-top: 32px; }
.results.hidden { display: none; }

.file-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.file-row {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px 18px;
  display: grid;
  grid-template-columns: 1fr auto auto;
  grid-template-areas:
    "name  stats action"
    "bar   bar   bar";
  align-items: center;
  gap: 4px 16px;
}

.file-name {
  grid-area: name;
  font-weight: 600;
  font-size: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.file-stats {
  grid-area: stats;
  font-size: 14px;
  color: var(--muted);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 10px;
}

.badge {
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-weight: 700;
  font-size: 13px;
  border-radius: 999px;
  padding: 2px 10px;
}

.badge.error {
  background: #fdecec;
  color: var(--danger);
}

.link-btn {
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--accent-dark);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
}

.link-btn:hover { color: var(--accent); }

.file-action { grid-area: action; }

.file-action a {
  color: var(--accent-dark);
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 5px 16px;
  white-space: nowrap;
}

.file-action a:hover {
  background: var(--accent);
  color: #fff;
}

.progress {
  grid-area: bar;
  height: 4px;
  border-radius: 2px;
  background: var(--line);
  overflow: hidden;
  margin-top: 8px;
}

.progress .bar {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.2s ease;
}

.progress.indet .bar {
  width: 40%;
  animation: indet-slide 1.1s ease-in-out infinite;
}

@keyframes indet-slide {
  0% { margin-left: -40%; }
  100% { margin-left: 100%; }
}

.file-row.done .progress,
.file-row.error .progress { display: none; }

.status-text {
  font-size: 13px;
  color: var(--muted);
}

/* ---------- summary ---------- */

.summary {
  margin-top: 18px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.total-saved {
  font-weight: 700;
  font-size: 16px;
  color: var(--accent-dark);
}

.summary-actions {
  display: flex;
  gap: 10px;
}

.btn {
  font: inherit;
  font-weight: 600;
  border-radius: 999px;
  padding: 9px 22px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s ease;
}

.btn.primary {
  background: var(--accent);
  color: #fff;
}

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

.btn.primary:disabled {
  background: #b9d9c9;
  cursor: not-allowed;
}

.btn.ghost {
  background: transparent;
  color: var(--muted);
  border-color: var(--line);
}

.btn.ghost:hover { color: var(--ink); border-color: var(--muted); }

/* ---------- info cards ---------- */

.info-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px 28px;
  margin-top: 36px;
}

.info-card h2 {
  margin: 0 0 10px;
  font-size: 21px;
}

.info-card pre {
  background: #2b2b33;
  color: #e8e6df;
  border-radius: 12px;
  padding: 16px 18px;
  overflow-x: auto;
  font-size: 13.5px;
  line-height: 1.55;
}

.info-card details {
  border-top: 1px solid var(--line);
  padding: 10px 0;
}

.info-card details:first-of-type { border-top: none; }

.info-card summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 15.5px;
}

.info-card details p {
  color: var(--muted);
  font-size: 14.5px;
  margin: 8px 0 0;
}

/* ---------- footer ---------- */

.site-footer {
  margin-top: 56px;
  padding: 28px 20px 36px;
  text-align: center;
  color: var(--muted);
  font-size: 13.5px;
  border-top: 1px solid var(--line);
}

.site-footer p { margin: 4px 0; }

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 22px;
  margin-bottom: 14px;
  font-size: 14px;
}

.footer-nav a {
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
}

.footer-nav a:hover { color: var(--accent-dark); text-decoration: underline; }

.info-card ul {
  margin: 10px 0;
  padding-left: 22px;
}

.info-card li { margin: 8px 0; color: var(--muted); font-size: 15px; }

/* ---------- legal pages (generated from legal/*.md) ---------- */

.legal-content { line-height: 1.7; }

.legal-content h1 {
  font-size: 30px;
  margin: 6px 0 14px;
}

.legal-content h2 {
  font-size: 21px;
  margin: 34px 0 10px;
}

.legal-content h3 {
  font-size: 17px;
  margin: 24px 0 8px;
}

.legal-content p,
.legal-content li {
  color: #4a463c;
  font-size: 15px;
}

.legal-content li { margin: 6px 0; }

.legal-content hr {
  border: none;
  border-top: 1px solid var(--line);
  margin: 28px 0;
}

.legal-content blockquote {
  margin: 14px 0;
  padding: 10px 18px;
  border-left: 4px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 10px 10px 0;
}

.legal-content blockquote p { margin: 4px 0; }

.legal-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  margin: 14px 0;
  display: block;
  overflow-x: auto;
}

.legal-content th,
.legal-content td {
  border: 1px solid var(--line);
  padding: 8px 12px;
  text-align: left;
  vertical-align: top;
}

.legal-content th { background: var(--bg); }

.legal-content code {
  background: var(--bg);
  border-radius: 6px;
  padding: 1px 6px;
  font-size: 13.5px;
}

.legal-content a { color: var(--accent-dark); }

/* ---------- responsive ---------- */

@media (max-width: 560px) {
  .file-row {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "name  action"
      "stats stats"
      "bar   bar";
  }

  .hero { padding-top: 32px; }
  .dropzone { padding: 40px 16px; }
  .summary { flex-direction: column; align-items: stretch; text-align: center; }
  .summary-actions { justify-content: center; }
}
