:root {
  --paper: #f6f2e9;
  --surface: #fffcf7;
  --ink: #1d2a33;
  --muted: #6b7780;
  --line: #ded8cb;
  --accent: #2b4257;
  --warm: #a14f3d;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  max-width: 100%;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 8%, rgba(184, 207, 193, 0.22), transparent 28rem),
    radial-gradient(circle at 95% 90%, rgba(225, 206, 175, 0.16), transparent 26rem),
    var(--paper);
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
  line-height: 1.85;
}

body { min-height: 100vh; }

.legal-top {
  width: min(760px, calc(100% - 40px));
  margin: 0 auto;
  padding: 30px 0 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.legal-brand {
  color: var(--ink);
  font-size: 15px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-decoration: none;
}

.legal-brand .legal-mark { width: 28px; height: 28px; margin-right: 8px; border-radius: 7px; object-fit: cover; vertical-align: -8px; }

.legal-brand span {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin-right: 8px;
  border-radius: 50% 50% 50% 10%;
  color: #fff;
  background: var(--accent);
  font-family: serif;
  font-size: 13px;
}

.legal-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: flex-end;
  font-size: 12px;
}

.legal-nav a {
  color: var(--muted);
  text-decoration: none;
}

.legal-nav a:hover { color: var(--accent); }

main {
  width: min(760px, calc(100% - 40px));
  margin: 0 auto;
  padding: 20px 0 56px;
}

.legal-card {
  padding: clamp(24px, 5vw, 44px);
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: 0 18px 50px rgba(35, 54, 47, 0.06);
}

.legal-kicker {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.18em;
}

h1 {
  margin: 0 0 10px;
  font-family: "Songti SC", "Noto Serif SC", "STSong", serif;
  font-size: clamp(28px, 4.6vw, 38px);
  font-weight: 600;
  line-height: 1.3;
}

.legal-meta {
  margin: 0 0 24px;
  color: var(--muted);
  font-size: 12px;
}

.legal-summary {
  margin: 0 0 28px;
  padding: 14px 16px;
  border-left: 3px solid var(--accent);
  background: #f0f6f2;
  color: #3f524c;
  font-size: 14px;
}

h2 {
  margin: 32px 0 10px;
  font-family: "Songti SC", "Noto Serif SC", "STSong", serif;
  font-size: 19px;
  font-weight: 600;
  line-height: 1.5;
}

h3 {
  margin: 22px 0 6px;
  font-size: 15px;
  font-weight: 650;
}

p { margin: 0 0 12px; font-size: 14px; }

ul, ol { margin: 6px 0 14px; padding-left: 22px; }
li { margin: 0 0 7px; font-size: 14px; }

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }

.legal-note {
  margin: 18px 0;
  padding: 14px 16px;
  border: 1px solid #ead9c3;
  border-radius: 14px;
  background: #fff8ed;
  color: #6b5135;
  font-size: 13px;
}

.legal-danger {
  border-color: #e7c7c1;
  background: #fff3f0;
  color: #7a3b31;
}

.legal-table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0 18px;
  table-layout: fixed;
  font-size: 13px;
}

.legal-table th,
.legal-table td {
  padding: 10px 12px;
  border: 1px solid var(--line);
  vertical-align: top;
  text-align: left;
  overflow-wrap: break-word;
}

.legal-table th { width: 26%; background: #f4f7f4; font-weight: 600; }

.legal-footer {
  width: min(760px, calc(100% - 40px));
  margin: 0 auto;
  padding: 0 0 34px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  line-height: 1.9;
}

.legal-footer a { color: var(--muted); }

.legal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 26px;
}

.legal-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 18px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  color: #fff;
  background: var(--accent);
  font: inherit;
  font-size: 13px;
  text-decoration: none;
  cursor: pointer;
}

.legal-button.secondary {
  color: var(--accent);
  background: transparent;
}

.legal-button:disabled { opacity: .6; cursor: not-allowed; }

.legal-input,
.legal-select,
.legal-textarea {
  width: 100%;
  margin: 6px 0 14px;
  padding: 12px 14px;
  border: 1px solid #c9d5cd;
  border-radius: 12px;
  color: var(--ink);
  background: #fff;
  font: inherit;
  font-size: 14px;
}

.legal-textarea { min-height: 100px; resize: vertical; }

.legal-label { display: block; margin-top: 10px; font-size: 13px; font-weight: 600; }

.legal-status { margin-top: 12px; font-size: 13px; color: var(--accent); }
.legal-status.error { color: var(--warm); }

.client-id-row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin: 8px 0 16px;
}

.client-id-row code {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8faf8;
  font-size: 12px;
  overflow-wrap: anywhere;
}

@media (max-width: 560px) {
  .legal-top { align-items: flex-start; flex-direction: column; }
  .legal-nav { justify-content: flex-start; }
  .legal-card { border-radius: 18px; }
  .legal-table th { width: 34%; }
}
