:root {
  --bg: #ffffff;
  --surface: #f6f8f6;
  --surface-hover: #eef2ef;
  --border: #e1e7e2;
  --fg: #172019;
  --fg-muted: #667168;
  --primary: #10b765;
  --primary-hover: #0a9b55;
  --primary-strong: #087443;
  --primary-soft: #eaf8f0;
  --ink: #101713;
  --shadow-sm: 0 8px 24px rgba(23, 32, 25, 0.06);
  --shadow-lg: 0 24px 64px rgba(23, 32, 25, 0.1);
  --radius: 8px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --font-sans:
    "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  text-decoration: none;
  color: inherit;
}

/* Layout */
.container {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Button (no-slop-ui: 8px solid / subtle border, no pill, no translateY) */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  border-radius: 8px;
  min-height: 40px;
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease;
  cursor: pointer;
  border: 1px solid transparent;
  user-select: none;
}

.btn-primary {
  background-color: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  border-color: var(--primary-hover);
}

.btn-outline {
  background-color: #ffffff;
  border: 1px solid var(--border);
  color: var(--fg);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.btn-outline:hover {
  background-color: var(--surface);
  border-color: #cbd5e1;
}

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

.btn-ghost:hover {
  color: var(--fg);
  background-color: var(--surface);
}

/* Nav */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

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

.nav-left {
  display: flex;
  align-items: center;
  gap: 32px;
}

.brand {
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-logo {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  object-fit: contain;
}

.nav-links {
  display: flex;
  gap: 24px;
}

.nav-links a {
  font-size: 14px;
  color: var(--fg-muted);
  font-weight: 500;
  transition: color 0.2s;
}

.nav-links a:hover {
  color: var(--fg);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Product memory preview */
.archive-graph-preview {
  position: relative;
  z-index: 2;
  display: flex;
  flex: 1 1 600px;
  flex-direction: column;
  min-width: 0;
  max-width: 660px;
  height: 480px;
  background-color: #ffffff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(23, 32, 25, 0.05);
  overflow: hidden;
}

.archive-graph-toolbar,
.archive-graph-footer {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 14px;
  background: #ffffff;
}

.archive-graph-toolbar {
  border-bottom: 1px solid var(--border);
}

.archive-graph-title {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
}

.archive-graph-icon {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: var(--primary-soft);
  color: var(--primary-strong);
  font-size: 12px;
  font-weight: 700;
}

.archive-graph-title-text {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.archive-graph-title-text strong {
  color: var(--fg);
  font-size: 13px;
  font-weight: 600;
}

.archive-graph-title-text small {
  color: var(--fg-muted);
  font-size: 11px;
}

.archive-graph-legend {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--fg-muted);
  font-size: 11px;
}

.archive-graph-legend span,
.archive-graph-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.archive-graph-legend i,
.archive-graph-status::before {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  content: "";
}

.archive-graph-legend .person-dot {
  background: #4f8ff7;
}
.archive-graph-legend .place-dot {
  background: #6ee7b7;
}
.archive-graph-legend .org-dot {
  background: #a3b5bd;
}

.archive-graph-canvas {
  position: relative;
  flex: 1;
  min-height: 0;
  background: #ffffff;
  overflow: hidden;
}

.archive-graph-fallback,
.archive-graph-svg {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.archive-graph-fallback {
  object-fit: contain;
  transition: opacity 0.2s;
}

.archive-graph-svg {
  z-index: 2;
  opacity: 0;
  cursor: grab;
  touch-action: none;
  transition: opacity 0.2s;
  user-select: none;
}

.archive-graph-svg:active {
  cursor: grabbing;
}

.archive-graph-canvas.graph-ready .archive-graph-svg {
  opacity: 1;
}

.archive-graph-canvas.graph-ready .archive-graph-fallback {
  opacity: 0;
  pointer-events: none;
}

.archive-graph-svg .graph-link {
  stroke: #7a9099;
  stroke-width: 2.2;
  transition:
    opacity 0.16s,
    stroke 0.16s;
}

.archive-graph-svg .graph-link-label {
  fill: #34443a;
  font-size: 12px;
  font-weight: 600;
  paint-order: stroke;
  pointer-events: none;
  stroke: #ffffff;
  stroke-linejoin: round;
  stroke-width: 4px;
  text-anchor: middle;
  transition: opacity 0.16s;
}

.archive-graph-svg .graph-node {
  cursor: grab;
}

.archive-graph-svg .graph-node:active {
  cursor: grabbing;
}

.archive-graph-svg .graph-node circle {
  stroke-width: 1.5;
  transition:
    opacity 0.16s,
    stroke-width 0.16s;
}

.archive-graph-svg .graph-node text {
  fill: #101713;
  font-size: 13px;
  font-weight: 600;
  paint-order: stroke;
  pointer-events: none;
  stroke: #ffffff;
  stroke-linejoin: round;
  stroke-width: 4px;
  text-anchor: middle;
  transition: opacity 0.16s;
}

.archive-graph-controls {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 3;
  display: none;
  flex-direction: column;
  gap: 6px;
}

.archive-graph-canvas.graph-ready .archive-graph-controls {
  display: flex;
}

.archive-graph-control {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid #d5ded7;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 1px 4px rgba(23, 32, 25, 0.06);
  color: #334239;
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1;
}

.archive-graph-control:hover {
  border-color: #afc0b3;
  background: #ffffff;
  color: var(--primary-strong);
}

.archive-graph-footer {
  min-height: 38px;
  border-top: 1px solid var(--border);
  color: var(--fg-muted);
  font-size: 11px;
}

.archive-graph-status {
  color: var(--primary-strong);
  font-weight: 600;
}

.archive-graph-status::before {
  background: var(--primary);
}

/* Section Component */
.section {
  padding: 72px 0;
  border-top: 1px solid var(--border);
}

.section-header {
  margin-bottom: 36px;
}

.section-title {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--fg);
  margin-bottom: 10px;
}

.section-desc {
  font-size: 15px;
  color: var(--fg-muted);
  line-height: 1.65;
  max-width: 720px;
}

/* FAQ */
.faq-list {
  display: grid;
  gap: 12px;
  max-width: 920px;
}

.faq-item {
  padding: 18px 22px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

.faq-item summary {
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  list-style-position: inside;
  color: var(--fg);
}

.faq-item p {
  max-width: 800px;
  margin-top: 10px;
  color: var(--fg-muted);
  font-size: 14px;
  line-height: 1.7;
}

/* Downloads Grid */
.dl-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.dl-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: flex-start;
}

.dl-card h4 {
  font-size: 16px;
  font-weight: 600;
}

.dl-card .btn {
  width: 100%;
}

.dl-card .note {
  font-size: 12px;
  color: var(--fg-muted);
}

/* Footer */
.footer {
  padding: 64px 0;
  border-top: 1px solid var(--border);
  color: var(--fg-muted);
  font-size: 14px;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.footer-links {
  display: flex;
  gap: 24px;
}

.footer-links a {
  cursor: pointer;
}

/* Legal Modal (用户协议 / 服务条款 / 隐私政策) */
.legal-modal {
  position: fixed;
  inset: 0;
  background: rgba(23, 32, 25, 0.46);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.18s ease,
    visibility 0.18s ease;
  padding: 24px;
}

.legal-modal.show {
  opacity: 1;
  visibility: visible;
}

.legal-modal-content {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 100%;
  max-width: 880px;
  height: 90vh;
  max-height: 920px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(23, 32, 25, 0.22);
}

.legal-modal-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.legal-modal-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--fg);
  letter-spacing: 0;
}

.legal-modal-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.legal-modal-icon-btn {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--fg-muted);
  border-radius: 8px;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  transition:
    background 0.15s,
    color 0.15s;
}

.legal-modal-icon-btn:hover {
  background: var(--surface-hover);
  color: var(--fg);
}

.legal-modal-iframe {
  flex: 1;
  width: 100%;
  border: 0;
  background: var(--bg);
}

@media (max-width: 640px) {
  .legal-modal {
    padding: 0;
  }
  .legal-modal-content {
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
    border: 0;
  }
}

/* Modals & Auth overrides */
.auth-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(23, 32, 25, 0.48);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s;
}
.auth-modal.show {
  opacity: 1;
  visibility: visible;
}
.auth-modal-content {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 100%;
  max-width: 400px;
  padding: 32px;
  position: relative;
}
.auth-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: transparent;
  border: none;
  color: var(--fg-muted);
  font-size: 24px;
  cursor: pointer;
}
.auth-form input {
  width: 100%;
  background: #ffffff;
  border: 1px solid var(--border);
  padding: 12px;
  border-radius: var(--radius);
  color: var(--fg);
  outline: none;
  margin-bottom: 16px;
  font-family: var(--font-sans);
}
.auth-form input:focus {
  border-color: var(--primary);
}

.user-avatar {
  position: relative;
  overflow: hidden;
  width: 32px;
  height: 32px;
  background: var(--primary);
  color: #ffffff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  cursor: pointer;
  font-size: 14px;
}
.user-avatar img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
  min-width: 180px;
  display: none;
  box-shadow: var(--shadow-sm);
}
.user-dropdown.show {
  display: block;
}

#langSwitcher {
  color: var(--fg-muted) !important;
}

#user-email {
  color: var(--fg) !important;
}

.footer .brand-name {
  color: var(--fg);
  font-weight: 600;
}

:focus-visible {
  outline: 3px solid rgba(16, 183, 101, 0.22);
  outline-offset: 3px;
}
