/* ==========================================================================
   iFloat / EngTalk legal pages — shared design system
   --------------------------------------------------------------------------
   Design tokens follow the app's DesignTokens.swift:
     light: page #F2F2F7, card #FFFFFF, accent #0B5FD0, ink #000, ink2 #666668
     dark:  page #000000, card #1C1C1E, accent text #4EA1FF, ink #FFF, ink2 #97979C
   No external fonts, images, or analytics. Print-friendly. WCAG AA targeted.
   ========================================================================== */

:root {
  color-scheme: light dark;
  --page: #f2f2f7;
  --card: #ffffff;
  --sunken: #f2f2f7;
  --ink: #000000;
  --ink-2: #666668;
  --ink-3: #8a8a8e;
  --hairline: rgba(60, 60, 67, 0.29);
  --brand: #0b5fd0;
  --brand-text: #0b5fd0;
  --brand-soft: #e8f0fe;
  --success: #1b7a33;
  --success-soft: #e8f5ec;
  --warning: #c93400;
  --warning-soft: #fff1e8;
  --danger: #d70015;
  --danger-soft: #fdecea;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.04);
  --max: 1120px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC",
    sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --page: #000000;
    --card: #1c1c1e;
    --sunken: #000000;
    --ink: #ffffff;
    --ink-2: #97979c;
    --ink-3: #7c7c80;
    --hairline: rgba(84, 84, 88, 0.65);
    --brand: #0a63d6;
    --brand-text: #4ea1ff;
    --brand-soft: #0e2440;
    --success: #30d158;
    --success-soft: #0c2a16;
    --warning: #ff9f0a;
    --warning-soft: #2e1c05;
    --danger: #ff453a;
    --danger-soft: #2e0b09;
    --shadow: none;
  }
}

/* EngTalk uses a calmer teal so the two products stay visually distinct. */
[data-brand="engtalk"] {
  --brand: #0f766e;
  --brand-text: #0f766e;
  --brand-soft: #e6f4f1;
}

@media (prefers-color-scheme: dark) {
  [data-brand="engtalk"] {
    --brand: #14b8a6;
    --brand-text: #5eead4;
    --brand-soft: #0b2b27;
  }
}

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

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

body {
  margin: 0;
  font-family: var(--font);
  background: var(--page);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.75;
  letter-spacing: 0.01em;
  text-rendering: optimizeLegibility;
}

html[lang="en"] body {
  letter-spacing: 0;
}

a {
  color: var(--brand-text);
  text-underline-offset: 0.18em;
}

a:hover {
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: 3px solid var(--brand-text);
  outline-offset: 3px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -80px;
  z-index: 100;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--hairline);
  box-shadow: var(--shadow);
  text-decoration: none;
}

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

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--page);
  border-bottom: 1px solid var(--hairline);
}

@supports (backdrop-filter: blur(1px)) {
  .site-header {
    background: color-mix(in srgb, var(--page) 86%, transparent);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
  }
}

.header-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  min-width: 0;
}

.brand-mark {
  width: 36px;
  height: 36px;
  flex: none;
  display: block;
  border-radius: 22.5%;
  background: var(--brand);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06);
  -webkit-user-drag: none;
}

.brand-text {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.2;
  white-space: nowrap;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lang-switch {
  display: flex;
  gap: 2px;
  padding: 3px;
  background: var(--sunken);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  flex: none;
}

.lang-switch a {
  padding: 6px 11px;
  border-radius: 999px;
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
}

.lang-switch a[aria-current="page"] {
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--shadow);
}

/* ---------- Hero ---------- */

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

.eyebrow {
  margin: 0 0 10px;
  color: var(--brand-text);
  font-size: 13px;
  font-weight: 700;
  /* 这行放的是**应用全名**（iFloat Live Translation / iFloat实时语音翻译），
     不能被 text-transform 改成全大写 —— 品牌里的 camelCase 会丢。
     去掉全大写后，原来的 0.1em 字距对混合大小写太散，收到 0.02em。 */
  letter-spacing: 0.02em;
}

.hero h1 {
  margin: 0;
  font-size: clamp(32px, 5vw, 52px);
  line-height: 1.12;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.lead {
  max-width: 62ch;
  margin: 18px 0 0;
  font-size: clamp(17px, 2vw, 20px);
  line-height: 1.65;
  color: var(--ink-2);
  text-wrap: pretty;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--hairline);
  color: var(--ink-2);
  font-size: 12px;
  line-height: 1.3;
}

.badges {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 0;
  margin: 24px 0 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 14px;
  background: var(--card);
  border: 1px solid var(--hairline);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--ink);
  box-shadow: var(--shadow);
}

.badge svg {
  width: 18px;
  height: 18px;
  flex: none;
  color: var(--success);
}

.badge.is-brand svg {
  color: var(--brand-text);
}

/* ---------- Layout + TOC ---------- */

.layout {
  max-width: var(--max);
  margin: 0 auto;
  padding: 8px 24px 64px;
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  gap: 40px;
  align-items: start;
}

.toc {
  position: sticky;
  top: 84px;
  max-height: calc(100vh - 104px);
  overflow: auto;
  padding-right: 4px;
}

.toc-title {
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-2);
}

.toc ol {
  list-style: none;
  margin: 0;
  padding: 0;
  border-left: 2px solid var(--hairline);
}

.toc li {
  margin: 0;
}

.toc a {
  display: block;
  padding: 7px 0 7px 14px;
  margin-left: -2px;
  border-left: 2px solid transparent;
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.45;
  text-decoration: none;
}

.toc a:hover {
  color: var(--ink);
  border-left-color: var(--brand);
}

.toc-foot {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--hairline);
  font-size: 12px;
  line-height: 1.5;
  color: var(--ink-2);
}

.toc-mobile {
  display: none;
}

/* ---------- Sections ---------- */

.content {
  min-width: 0;
}

.section {
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 28px 30px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
  scroll-margin-top: 92px;
}

.section:target {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

.section-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}

.section-num {
  flex: none;
  width: 28px;
  height: 28px;
  margin-top: 2px;
  border-radius: 9px;
  background: var(--brand-soft);
  color: var(--brand-text);
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
}

.section h2 {
  margin: 0;
  font-size: clamp(20px, 2.4vw, 24px);
  line-height: 1.3;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.section h3 {
  margin: 24px 0 8px;
  font-size: 17px;
  line-height: 1.4;
  letter-spacing: -0.005em;
}

.section h3:first-of-type {
  margin-top: 8px;
}

.section p {
  margin: 0 0 12px;
  text-wrap: pretty;
}

.section p:last-child,
.section ul:last-child,
.section ol:last-child,
.section .table-wrap:last-child,
.section .callout:last-child {
  margin-bottom: 0;
}

.section ul,
.section ol {
  margin: 0 0 12px;
  padding-left: 1.35em;
}

.section li {
  margin: 6px 0;
}

.section li::marker {
  color: var(--brand-text);
}

.lead-strong {
  font-size: 18px;
  font-weight: 650;
  line-height: 1.6;
}

.muted {
  color: var(--ink-2);
}

.small {
  font-size: 13px;
  line-height: 1.6;
}

.nowrap {
  white-space: nowrap;
}

/* ---------- Callouts ---------- */

.callout {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--hairline);
  background: var(--sunken);
  margin: 16px 0;
}

.callout svg {
  width: 20px;
  height: 20px;
  flex: none;
  margin-top: 2px;
}

.callout p {
  margin: 0;
}

.callout-info {
  background: var(--brand-soft);
  border-color: transparent;
}

.callout-info svg {
  color: var(--brand-text);
}

.callout-success {
  background: var(--success-soft);
  border-color: transparent;
}

.callout-success svg {
  color: var(--success);
}

.callout-warn {
  background: var(--warning-soft);
  border-color: transparent;
}

.callout-warn svg {
  color: var(--warning);
}

/* ---------- Tables ---------- */

.table-wrap {
  overflow-x: auto;
  margin: 16px 0;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
  font-size: 14px;
  line-height: 1.55;
}

.table-hint {
  display: none;
  margin: 8px 0 0;
  color: var(--ink-2);
  font-size: 12px;
  line-height: 1.5;
}

th,
td {
  padding: 12px 14px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--hairline);
}

th {
  background: var(--sunken);
  color: var(--ink-2);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

tr:last-child td {
  border-bottom: none;
}

td strong {
  font-weight: 650;
}

code {
  overflow-wrap: anywhere;
}

/* ---------- Permission cards ---------- */

.permissions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.permission {
  padding: 16px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  background: var(--sunken);
}

.permission h3 {
  margin: 0 0 6px;
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.permission h3 svg {
  width: 18px;
  height: 18px;
  flex: none;
  color: var(--brand-text);
}

.permission p {
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink-2);
}

.permission .tag {
  display: inline-block;
  margin-top: 8px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-text);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.4;
}

/* ---------- FAQ ---------- */

.faq details {
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  padding: 0 16px;
  margin: 10px 0;
  background: var(--sunken);
}

.faq summary {
  cursor: pointer;
  padding: 14px 0;
  font-weight: 650;
  list-style: none;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

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

.faq summary::after {
  content: "+";
  color: var(--brand-text);
  font-weight: 800;
}

.faq details[open] summary::after {
  content: "−";
}

.faq details p {
  margin: 0 0 14px;
  color: var(--ink-2);
}

/* ---------- Contact ---------- */

.contact-card {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  padding: 18px;
  border-radius: var(--radius-sm);
  background: var(--brand-soft);
}

.contact-card p {
  margin: 0;
}

.contact-card a {
  font-weight: 700;
}

/* ---------- Support page ---------- */

.portal .contact-card {
  margin: 24px 0;
}

.support-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: 999px;
  background: var(--brand);
  color: #ffffff;
  font-weight: 700;
  font-size: 15px;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}

.support-cta:hover,
.support-cta:focus-visible {
  filter: brightness(0.92);
}

.portal .steps {
  display: grid;
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.steps > li {
  position: relative;
  padding-left: 40px;
  counter-increment: step;
}

.steps > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 1px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--brand-soft);
  color: var(--brand-text);
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
}

.steps > li > strong {
  display: block;
  margin-bottom: 3px;
}

.steps > li > p {
  margin: 0;
  color: var(--ink-2);
}

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--hairline);
  background: var(--card);
}

.footer-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 28px 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--ink-2);
}

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

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

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

.back-top {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 11px;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 650;
  text-decoration: none;
  background: var(--card);
}

/* ---------- Index / portal ---------- */

.portal {
  max-width: 880px;
  margin: 0 auto;
  padding: 64px 24px 80px;
}

.portal h1 {
  margin: 0;
  font-size: clamp(34px, 6vw, 56px);
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.portal .lead {
  margin-top: 16px;
}

.doc-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 28px;
}

.doc-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 22px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--ink);
  text-decoration: none;
  box-shadow: var(--shadow);
}

.doc-card:hover {
  border-color: var(--brand);
}

.doc-card strong {
  font-size: 18px;
}

.doc-card span {
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.55;
}

.doc-card .arrow {
  margin-top: 8px;
  color: var(--brand-text);
  font-size: 13px;
  font-weight: 700;
}

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
    gap: 20px;
    padding-top: 0;
  }

  .toc {
    display: none;
  }

  .toc-mobile {
    display: block;
    margin-bottom: 18px;
    padding: 0 18px;
    border: 1px solid var(--hairline);
    border-radius: var(--radius);
    background: var(--card);
    box-shadow: var(--shadow);
  }

  .toc-mobile summary {
    padding: 16px 0;
    font-weight: 700;
    cursor: pointer;
    list-style: none;
  }

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

  .toc-mobile summary::after {
    content: "▾";
    float: right;
    color: var(--brand-text);
  }

  .toc-mobile[open] summary::after {
    content: "▴";
  }

  .toc-mobile ol {
    margin: 0 0 16px;
    padding-left: 1.2em;
  }

  .toc-mobile a {
    color: var(--ink-2);
    text-decoration: none;
    font-size: 14px;
  }
}

/* 功能表首列是功能名（对话翻译 / OCR 表格识别…），列宽不够时会被挤成
   「对话翻 / 译」这种两行。给它一个下限并不换行；下方的移动端卡片布局里
   会重置回正常换行（那张表在手机上不是表格，是卡片）。 */
table.responsive th:first-child,
table.responsive td:first-child {
  width: 1%;
  white-space: nowrap;
}

@media (max-width: 640px) {
  .header-inner {
    padding: 10px 16px;
    gap: 10px;
  }

  .brand {
    gap: 8px;
  }

  .brand-mark {
    width: 32px;
    height: 32px;
  }

  .brand-text {
    font-size: 13.5px;
  }

  .hero {
    padding: 36px 16px 20px;
  }

  .layout {
    padding: 0 16px 48px;
  }

  .section {
    padding: 22px 18px;
    border-radius: 16px;
  }

  .permissions {
    grid-template-columns: 1fr;
  }

  .table-hint {
    display: block;
  }

  .table-wrap:has(table.responsive) {
    border: 0;
    overflow: visible;
  }

  table.responsive {
    min-width: 0;
  }

  table.responsive thead {
    display: none;
  }

  table.responsive tbody {
    display: block;
  }

  table.responsive tr {
    display: block;
    padding: 8px 12px;
    margin-bottom: 10px;
    border: 1px solid var(--hairline);
    border-radius: var(--radius-sm);
    background: var(--card);
  }

  table.responsive tr:last-child {
    margin-bottom: 0;
  }

  table.responsive td {
    display: grid;
    grid-template-columns: 88px minmax(0, 1fr);
    gap: 10px;
    padding: 6px 0;
    border: 0;
  }

  table.responsive td::before {
    content: attr(data-label);
    color: var(--ink-2);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.5;
  }

  table.responsive td:first-child {
    padding-top: 4px;
    /* 桌面端首列被挤成「对话翻 / 译」两行，这里恢复自动换行 */
    width: auto;
    white-space: normal;
  }

  table.responsive td:last-child {
    padding-bottom: 4px;
  }

  .badge {
    width: 100%;
  }

  .footer-inner {
    padding: 24px 16px;
  }

  .doc-grid {
    grid-template-columns: 1fr;
  }

  .portal {
    padding: 40px 16px 56px;
  }
}

/* ---------- Print ---------- */

@media print {
  :root {
    color-scheme: light;
    --page: #ffffff;
    --card: #ffffff;
    --sunken: #ffffff;
    --ink: #000000;
    --ink-2: #333333;
    --hairline: #bbbbbb;
    --brand-soft: #ffffff;
    --success-soft: #ffffff;
    --warning-soft: #ffffff;
    --shadow: none;
  }

  body {
    background: #ffffff;
    font-size: 11pt;
    line-height: 1.5;
  }

  .site-header,
  .toc,
  .toc-mobile,
  .site-footer,
  .back-top,
  .print-hide {
    display: none !important;
  }

  .hero {
    max-width: none;
    padding: 0 0 16px;
  }

  .layout {
    display: block;
    max-width: none;
    padding: 0;
  }

  .section {
    border: 1px solid #dddddd;
    box-shadow: none;
    break-inside: avoid;
    page-break-inside: avoid;
    margin-bottom: 12px;
  }

  a {
    color: #000000;
    text-decoration: none;
  }

  .table-wrap {
    overflow: visible;
  }

  table {
    min-width: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}
