:root {
  --bg: #fafaf9;
  --surface: #ffffff;
  --surface-muted: #f5f5f4;
  --text-primary: #1c1917;
  --text-secondary: #57534e;
  --text-muted: #a8a29e;
  --border: #e7e5e4;
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --accent-soft: #eef2ff;
  --max-width: 760px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-mono: "SF Mono", Menlo, Monaco, Consolas, "Courier New", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c0a09;
    --surface: #1c1917;
    --surface-muted: #292524;
    --text-primary: #fafaf9;
    --text-secondary: #d6d3d1;
    --text-muted: #78716c;
    --border: #292524;
    --accent: #818cf8;
    --accent-hover: #a5b4fc;
    --accent-soft: #1e1b4b;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  }
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.7;
  color: var(--text-primary);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* ===== Hero ===== */
.hero {
  background: linear-gradient(135deg, var(--accent) 0%, #8b5cf6 100%);
  color: white;
  padding: 48px 0 56px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.hero .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

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

.hero-logo {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 700;
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.hero h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.hero-subtitle {
  margin: 4px 0 0;
  font-size: 14px;
  opacity: 0.9;
}

.lang-switch {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.15);
  padding: 6px 12px;
  border-radius: 999px;
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  font-size: 14px;
}

.lang-link {
  color: white;
  text-decoration: none;
  padding: 2px 6px;
  border-radius: 6px;
  transition: background 0.15s;
}

.lang-link:hover {
  background: rgba(255, 255, 255, 0.15);
}

.lang-link.active {
  background: rgba(255, 255, 255, 0.25);
  font-weight: 600;
}

.lang-divider {
  opacity: 0.6;
}

/* ===== Main ===== */
main.container {
  padding-top: 48px;
  padding-bottom: 64px;
}

.intro {
  margin-bottom: 48px;
}

.intro h2 {
  font-size: 24px;
  font-weight: 700;
  margin: 0 0 12px;
  letter-spacing: -0.01em;
}

.intro p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 16px;
}

/* ===== Doc cards (homepage only) ===== */
.docs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 48px;
}

.doc-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  text-decoration: none;
  color: inherit;
  transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.doc-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--accent);
}

.doc-card-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}

.doc-card h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.doc-card p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 14px;
  flex: 1;
}

.doc-card-link {
  color: var(--accent);
  font-size: 14px;
  font-weight: 500;
}

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

/* ===== Contact ===== */
.contact {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
}

.contact h2 {
  margin: 0 0 12px;
  font-size: 20px;
  font-weight: 600;
}

.contact p {
  margin: 0 0 16px;
  color: var(--text-secondary);
}

.contact-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.contact-list li {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 15px;
}

.contact-list li:last-child {
  border-bottom: none;
}

.contact-list a {
  color: var(--accent);
  text-decoration: none;
}

.contact-list a:hover {
  text-decoration: underline;
}

/* ===== Footer ===== */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 24px 0;
  color: var(--text-muted);
  font-size: 13px;
}

.site-footer p {
  margin: 0;
  text-align: center;
}

.site-footer .footer-meta {
  margin-top: 4px;
  font-size: 12px;
}

/* ===== Doc page (privacy_policy / user_agreement) ===== */
.doc-header {
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.doc-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--accent);
  text-decoration: none;
  font-size: 14px;
  margin-bottom: 16px;
  font-weight: 500;
}

.doc-back:hover {
  text-decoration: underline;
}

.doc-header h1 {
  margin: 0 0 8px;
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.doc-meta {
  color: var(--text-muted);
  font-size: 14px;
  margin: 0;
}

.doc-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px;
}

.doc-content h2 {
  font-size: 20px;
  font-weight: 600;
  margin: 36px 0 12px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  letter-spacing: -0.01em;
}

.doc-content h2:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.doc-content h3 {
  font-size: 17px;
  font-weight: 600;
  margin: 24px 0 8px;
  color: var(--text-primary);
}

.doc-content h4 {
  font-size: 15px;
  font-weight: 600;
  margin: 16px 0 6px;
}

.doc-content p {
  margin: 0 0 14px;
  color: var(--text-secondary);
}

.doc-content strong {
  color: var(--text-primary);
  font-weight: 600;
}

.doc-content ul,
.doc-content ol {
  margin: 0 0 16px;
  padding-left: 24px;
  color: var(--text-secondary);
}

.doc-content li {
  margin-bottom: 6px;
}

.doc-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0 24px;
  font-size: 14px;
  overflow: hidden;
  border-radius: var(--radius-sm);
}

.doc-content th,
.doc-content td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

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

.doc-content tbody tr:hover {
  background: var(--surface-muted);
}

.doc-content blockquote {
  margin: 16px 0;
  padding: 12px 16px;
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 15px;
}

.doc-content blockquote p:last-child {
  margin-bottom: 0;
}

.doc-content code {
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 2px 6px;
  background: var(--surface-muted);
  border-radius: 4px;
  color: var(--accent);
}

.doc-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 32px 0;
}

.doc-signature {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 14px;
}

.doc-signature p {
  margin: 4px 0;
}

/* ===== Responsive ===== */
@media (max-width: 640px) {
  .hero {
    padding: 32px 0 40px;
  }

  .hero .container {
    flex-direction: column;
    align-items: flex-start;
  }

  .hero h1 {
    font-size: 24px;
  }

  .doc-content {
    padding: 24px 20px;
  }

  .doc-header h1 {
    font-size: 26px;
  }

  .doc-content table {
    font-size: 13px;
  }

  .doc-content th,
  .doc-content td {
    padding: 8px 10px;
  }
}