/*
 * 《用户协议》《隐私政策》《付费服务协议》共用样式。
 *
 * 这三页是独立的静态 HTML（登录页、收银台和官网页脚经 src/constants/app.ts 的 legalUrls 链过来，
 * 不经过前端路由和登录守卫），所以令牌照抄官网首页 views/landing/index.vue 的 --lp-*，
 * 首页令牌改了要同步这里（手抄，无自动同步）。
 *
 * 版式参照 peec.ai 的法律页：左侧目录、右侧一栏正文、每节开头一句「简而言之」。
 * - 强调色只有主题蓝 #646cff（链接、目录当前项、待填标记），正文链接用更深一档的 #4a4cd9 才够对比度。
 * - 圆角：待填标记 6px，按钮 8px，提示块和表格 14px。
  * - 限制责任、积分过期、管辖这类条款按民法典第 496 条的提示义务加粗加下划线（<strong>），<strong> 只用于这个目的；
 *   只是想加粗的小标题用 .term。
 */

@font-face {
  font-family: 'Geist Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('./geist-latin-wght-normal.woff2') format('woff2-variations');
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F,
    U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #f7f7f7;
  --surface: #fdfdfd;
  --sunken: #f0f0f1;
  --ink: #171717;
  --ink-body: #333333;
  --ink-2: #525252;
  --ink-3: #6f6f6f;
  --line: #e8e8e8;
  --line-strong: #dadada;
  --accent: #646cff;
  --accent-ink: #4a4cd9;
  --accent-soft: rgb(100 108 255 / 0.08);
  --accent-line: rgb(100 108 255 / 0.3);
  --font: 'Geist Variable', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Noto Sans CJK SC', system-ui,
    sans-serif;
  --nav-h: 64px;

  color-scheme: light;
}

/* 跟随工作台的主题开关（head 里的脚本读 localStorage 的 JANUS_darkMode 给 html 加 .dark / .light），没设过就跟系统。 */
:root.dark {
  --bg: #0a0a0b;
  --surface: #121213;
  --sunken: #0e0e0f;
  --ink: #ededed;
  --ink-body: #cfcfcf;
  --ink-2: #a3a3a3;
  --ink-3: #8b8b8b;
  --line: #1f1f21;
  --line-strong: #2d2d30;
  --accent-ink: #b5beff;
  --accent-soft: rgb(100 108 255 / 0.14);
  --accent-line: rgb(140 150 255 / 0.35);

  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not(.light) {
    --bg: #0a0a0b;
    --surface: #121213;
    --sunken: #0e0e0f;
    --ink: #ededed;
    --ink-body: #cfcfcf;
    --ink-2: #a3a3a3;
    --ink-3: #8b8b8b;
    --line: #1f1f21;
    --line-strong: #2d2d30;
    --accent-ink: #b5beff;
    --accent-soft: rgb(100 108 255 / 0.14);
    --accent-line: rgb(140 150 255 / 0.35);

    color-scheme: dark;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

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

a {
  color: var(--accent-ink);
  text-decoration: underline;
  text-decoration-color: var(--accent-line);
  text-underline-offset: 3px;
  transition: text-decoration-color 0.2s ease;
}

a:hover {
  text-decoration-color: currentColor;
}

a:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -48px;
  z-index: 40;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--line-strong);
  color: var(--ink);
  text-decoration: none;
}

.skip-link:focus {
  top: 12px;
}

.container {
  width: 100%;
  max-width: 1200px;
  margin-inline: auto;
  padding-inline: 16px;
}

@media (min-width: 768px) {
  .container {
    padding-inline: 32px;
  }
}

/* ---------- 顶栏 ---------- */

.nav-sentinel {
  position: absolute;
  top: 0;
  left: 0;
  width: 1px;
  height: 12px;
  pointer-events: none;
}

.nav {
  position: sticky;
  top: 0;
  z-index: 30;
  border-bottom: 1px solid transparent;
  background: var(--bg);
  transition:
    background-color 0.3s ease,
    border-color 0.3s ease;
}

.nav[data-scrolled='true'] {
  border-bottom-color: var(--line);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(170%) blur(16px);
  -webkit-backdrop-filter: saturate(170%) blur(16px);
}

@media (prefers-reduced-transparency: reduce) {
  .nav[data-scrolled='true'] {
    background: var(--bg);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}

.nav-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: var(--nav-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 17px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.brand img {
  width: 26px;
  height: 26px;
}

/* 三份文件之间的切换：当前这份是实底，其余是文字。 */
.doc-switch {
  display: inline-flex;
  gap: 4px;
  padding: 3px;
  border-radius: 10px;
  background: var(--sunken);
  box-shadow: inset 0 0 0 1px var(--line);
}

.doc-switch a {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding-inline: 12px;
  border-radius: 8px;
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  transition:
    color 0.2s ease,
    background-color 0.2s ease;
}

.doc-switch a:hover {
  color: var(--ink);
}

.doc-switch a[aria-current='page'] {
  background: var(--surface);
  box-shadow:
    0 0 0 1px var(--line-strong),
    0 1px 2px rgb(0 0 0 / 0.04);
  color: var(--ink);
  font-weight: 600;
}

.doc-switch a:active {
  transform: scale(0.98);
}

/* 语言切换：顶栏最右一枚胶囊，链到另一种语言的同一份文件。 */
.lang-link {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  height: 32px;
  padding-inline: 12px;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px var(--line-strong);
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.2s ease;
}

.lang-link:hover {
  color: var(--ink);
}

/*
 * 三份文件名在一行放不下时（手机和窄平板）：品牌和语言链接留在第一行，切换另起一行铺满，三项等宽。
 * 顶栏因此变高，--nav-h 跟着改，锚点跳转（scroll-margin-top）才不会被顶栏挡住。
 */
@media (max-width: 767px) {
  :root {
    --nav-h: 104px;
  }

  .nav-row {
    flex-wrap: wrap;
    align-content: center;
    row-gap: 8px;
    height: auto;
    min-height: var(--nav-h);
    padding-block: 12px;
  }

  .doc-switch {
    order: 3;
    flex-basis: 100%;
  }

  .doc-switch a {
    flex: 1 1 0;
    justify-content: center;
    min-width: 0;
    padding-inline: 6px;
    font-size: 13px;
  }

  .lang-link {
    padding-inline: 10px;
    font-size: 13px;
  }
}

/* 英文文件名的短写法（Terms / Privacy / Paid Services），三项并排放不下全名时换上；读屏始终读全名。 */
.label-short {
  display: none;
}

@media (max-width: 639px) {
  .label-long {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .label-short {
    display: inline;
  }
}

/* 英文译本开头的说明：以中文版为准。 */
.doc-note {
  margin: 20px 0 0;
  padding: 12px 16px;
  border-radius: 10px;
  background: var(--sunken);
  box-shadow: inset 0 0 0 1px var(--line);
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.6;
}

/* ---------- 页面骨架：左目录、右正文 ---------- */

.shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  padding-block: 40px 96px;
}

@media (min-width: 1024px) {
  .shell {
    grid-template-columns: 232px minmax(0, 720px);
    column-gap: 72px;
    padding-block: 64px 128px;
  }

  .doc-head,
  .doc {
    grid-column: 2;
  }
}

.toc {
  display: none;
}

@media (min-width: 1024px) {
  .toc {
    display: block;
    grid-row: 1 / span 2;
    position: sticky;
    top: calc(var(--nav-h) + 32px);
    align-self: start;
    max-height: calc(100dvh - var(--nav-h) - 64px);
    overflow-y: auto;
    padding-right: 8px;
    scrollbar-width: thin;
  }
}

.toc-title {
  margin: 0 0 12px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
}

.toc ol,
.toc-mobile ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

.toc a,
.toc-mobile a {
  display: block;
  padding: 6px 0 6px 14px;
  border-left: 2px solid var(--line);
  color: var(--ink-3);
  font-size: 14px;
  line-height: 1.5;
  text-decoration: none;
  transition:
    color 0.2s ease,
    border-color 0.2s ease;
}

.toc a:hover,
.toc-mobile a:hover {
  color: var(--ink);
}

.toc a[aria-current='true'] {
  border-left-color: var(--accent);
  color: var(--ink);
  font-weight: 600;
}

/* 手机和平板上目录收进正文开头的折叠块。 */
.toc-mobile {
  margin: 32px 0 8px;
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--line);
}

.toc-mobile summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  padding: 0 18px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}

.toc-mobile summary::-webkit-details-marker {
  display: none;
}

.toc-mobile summary::after {
  content: '';
  width: 8px;
  height: 8px;
  border-right: 1.5px solid var(--ink-3);
  border-bottom: 1.5px solid var(--ink-3);
  transform: translateY(-2px) rotate(45deg);
  transition: transform 0.2s ease;
}

.toc-mobile[open] summary::after {
  transform: translateY(2px) rotate(-135deg);
}

.toc-mobile ol {
  padding: 0 18px 16px;
}

@media (min-width: 1024px) {
  .toc-mobile {
    display: none;
  }
}

/* ---------- 文件头 ---------- */

.doc-head {
  min-width: 0;
}

.doc-head h1 {
  margin: 0;
  color: var(--ink);
  font-size: 32px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

@media (min-width: 768px) {
  .doc-head h1 {
    font-size: 40px;
  }
}

.doc-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 24px;
  margin: 16px 0 0;
  color: var(--ink-3);
  font-size: 14px;
  line-height: 1.6;
}

.doc-lead {
  margin: 28px 0 0;
  color: var(--ink-2);
  font-size: 17px;
  line-height: 1.85;
}

/* ---------- 正文 ---------- */

.doc {
  min-width: 0;
}

.doc section {
  scroll-margin-top: calc(var(--nav-h) + 24px);
}

.doc h2 {
  margin: 64px 0 20px;
  color: var(--ink);
  font-size: 22px;
  font-weight: 600;
  line-height: 1.4;
  scroll-margin-top: calc(var(--nav-h) + 24px);
}

.doc h3 {
  margin: 36px 0 12px;
  color: var(--ink);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.5;
  scroll-margin-top: calc(var(--nav-h) + 24px);
}

.doc p,
.doc li {
  text-wrap: pretty;
}

.doc p {
  margin: 0 0 14px;
}

.doc strong {
  color: var(--ink);
  font-weight: 600;
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

.doc .term {
  color: var(--ink);
  font-weight: 600;
}

.doc ul,
.doc ol {
  margin: 0 0 14px;
  padding-left: 1.4em;
}

.doc li {
  margin: 4px 0;
}

.doc li::marker {
  color: var(--ink-3);
}

/* 条款：编号悬挂在左边，正文对齐成一列。 */
.clause {
  display: grid;
  grid-template-columns: 2.6em minmax(0, 1fr);
  column-gap: 4px;
  margin: 0 0 14px;
}

.clause > .no {
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.clause > div > p:last-child,
.clause > div > ul:last-child,
.clause > div > ol:last-child {
  margin-bottom: 0;
}

/* 开头的「重要提示」和每节开头的「简而言之」。 */
.notice,
.brief {
  margin: 28px 0 0;
  padding: 20px 22px;
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--line);
}

.brief {
  margin: 0 0 20px;
  padding: 16px 20px;
  background: var(--sunken);
  box-shadow: none;
}

.notice-title,
.brief-title {
  display: block;
  margin: 0 0 6px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
}

.brief-title {
  font-size: 14px;
}

.notice p:last-child,
.brief p:last-child,
.notice ul:last-child {
  margin-bottom: 0;
}

.notice ul {
  padding-left: 1.2em;
}

.brief p {
  color: var(--ink-2);
  font-size: 15px;
  line-height: 1.8;
}

/* 表格：只用行间一条细线；手机上每行拆成一张小卡，靠 data-label 标出列名。 */
.table-wrap {
  margin: 8px 0 20px;
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--line);
  overflow: hidden;
}

.doc table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
  line-height: 1.7;
}

.doc th {
  padding: 12px 16px;
  background: var(--sunken);
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  vertical-align: bottom;
}

.doc td {
  padding: 12px 16px;
  vertical-align: top;
}

.doc tbody tr + tr td {
  border-top: 1px solid var(--line);
}

.doc td:first-child {
  color: var(--ink);
  font-weight: 600;
}

@media (max-width: 639px) {
  .doc thead {
    display: none;
  }

  .doc table,
  .doc tbody,
  .doc tr,
  .doc td {
    display: block;
    width: 100%;
  }

  .doc tbody tr {
    padding: 14px 16px;
  }

  .doc tbody tr + tr {
    border-top: 1px solid var(--line);
  }

  .doc tbody tr + tr td {
    border-top: 0;
  }

  .doc td {
    padding: 2px 0;
  }

  .doc td[data-label]:not(:first-child)::before {
    content: attr(data-label) '：';
    color: var(--ink-3);
  }

  html[lang='en'] .doc td[data-label]:not(:first-child)::before {
    content: attr(data-label) ': ';
  }
}

/* 上线前要法务或运营补上的内容。刻意做得显眼，别带着它发布。 */
.fill {
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent-line);
  color: var(--accent-ink);
  font-weight: 600;
  white-space: nowrap;
}

.fill::before {
  content: '【';
}

.fill::after {
  content: '】';
}

/* ---------- 页脚 ---------- */

.footer {
  border-top: 1px solid var(--line);
}

.footer-row {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-block: 32px 40px;
  color: var(--ink-3);
  font-size: 13px;
  line-height: 1.7;
}

@media (min-width: 768px) {
  .footer-row {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.footer-row p {
  margin: 0;
}

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

.footer-links a {
  color: var(--ink-2);
  text-decoration: none;
}

.footer-links a:hover {
  color: var(--ink);
}

/* ---------- 打印 / 存 PDF ---------- */

@media print {
  :root,
  :root.dark,
  :root:not(.light) {
    --bg: #fff;
    --surface: #fff;
    --sunken: #f4f4f4;
    --ink: #000;
    --ink-body: #1a1a1a;
    --ink-2: #333;
    --ink-3: #555;
    --line: #ccc;
    --accent-ink: #000;

    color-scheme: light;
  }

  .nav,
  .toc,
  .toc-mobile,
  .skip-link,
  .footer-links {
    display: none !important;
  }

  body {
    font-size: 11pt;
    line-height: 1.7;
  }

  .shell {
    display: block;
    padding-block: 0;
  }

  .doc h2 {
    margin-top: 28pt;
    break-after: avoid;
  }

  .doc h3 {
    break-after: avoid;
  }

  .table-wrap,
  .notice,
  .brief {
    box-shadow: 0 0 0 1px #ccc;
    break-inside: avoid;
  }

  a {
    text-decoration: none;
  }
}
