/* ==========================================================================
   隐私政策 / 用户协议（privacy.php · terms.php）— 类名使用 legal- 前缀
   ========================================================================== */

/* base.css 显现后的 clip-path 会裁掉卡片阴影，本页取消 */
.js .page-privacy [data-reveal].is-revealed,
.js .page-terms [data-reveal].is-revealed { clip-path: none; }
.page-privacy #main, .page-terms #main { overflow-x: clip; }

/* ---------- 标题横幅 ---------- */
.legal-hero {
  position: relative;
  padding: calc(var(--header-h) + clamp(36px, 5.5vw, 72px)) 0 clamp(34px, 4.5vw, 56px);
  overflow: hidden;
  isolation: isolate;
  border-bottom: 1px solid var(--c-line);
  background:
    radial-gradient(ellipse 55% 120% at 88% 0%, rgba(232, 135, 159, 0.15), transparent 62%),
    radial-gradient(ellipse 40% 90% at 0% 100%, rgba(99, 179, 163, 0.07), transparent 60%),
    linear-gradient(180deg, #171012 0%, var(--c-bg) 100%);
}
.legal-hero::before {
  content: "";
  position: absolute; inset: 0;
  z-index: -1;
  opacity: 0.06;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.legal-hero::after {
  content: "";
  position: absolute; left: 50%; bottom: -1px;
  width: min(520px, 70%); height: 1px;
  transform: translateX(-50%);
  background: linear-gradient(90deg, transparent, var(--c-gold), transparent);
}
.legal-hero__glyph {
  position: absolute;
  right: clamp(-20px, 6vw, 120px);
  top: 50%;
  z-index: -1;
  font-family: var(--f-brush);
  font-size: clamp(9rem, 22vw, 19rem);
  line-height: 1;
  color: rgba(232, 135, 159, 0.04);
  -webkit-text-stroke: 1px rgba(241, 221, 174, 0.16);
  transform: translateY(-46%) rotate(-4deg);
  pointer-events: none;
  user-select: none;
  animation: legal-glyph-in 1.6s var(--ease-out) both;
}
.legal-hero__inner { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.legal-hero__title { font-size: clamp(2.5rem, 5.6vw, 4.2rem); line-height: 1.1; text-shadow: 0 6px 40px rgba(0, 0, 0, 0.6); }
html[lang="en"] .legal-hero__title { font-size: clamp(2rem, 4.4vw, 3.2rem); }
.legal-hero__lead { max-width: 640px; font-size: clamp(1rem, 1.4vw, 1.1rem); color: var(--c-text-2); }
.legal-hero__bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 28px; width: 100%; margin-top: 12px; padding-top: 20px; border-top: 1px solid var(--c-line); }
.legal-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 26px; font-size: 0.9rem; color: var(--c-muted); }
.legal-meta > span { display: inline-flex; align-items: center; gap: 8px; }
.legal-meta .icon { color: var(--c-gold); }
.legal-meta time, .legal-meta b { color: var(--c-text); font-weight: 600; }
.legal-hero__tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.legal-switch { position: relative; display: inline-flex; padding: 4px; border: 1px solid var(--c-line-strong); border-radius: 999px; background: rgba(13, 10, 11, 0.5); }
.legal-switch a {
  display: inline-flex; align-items: center;
  min-height: 42px;
  padding: 0 18px;
  border-radius: 999px;
  font-family: var(--f-serif);
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--c-muted);
  transition: color 0.3s, background-color 0.3s, box-shadow 0.3s;
}
html[lang="en"] .legal-switch a { letter-spacing: 0.02em; }
.legal-switch a:hover { color: var(--c-text); }
.legal-switch a[aria-current="page"] { color: #fff; background: rgba(232, 135, 159, 0.2); box-shadow: inset 0 0 0 1px rgba(232, 135, 159, 0.45); }

/* ---------- 布局 ---------- */
.legal-body { padding-block: clamp(36px, 5vw, 72px) clamp(72px, 9vw, 120px); }
.legal-layout { display: grid; grid-template-columns: 268px minmax(0, 1fr); gap: clamp(40px, 5vw, 84px); align-items: start; }

/* ---------- 目录 ---------- */
.legal-toc { position: sticky; top: calc(var(--header-h) + 28px); transition: top 0.45s var(--ease-out); }
.site-header.is-hidden ~ main .legal-toc { top: 28px; }
.legal-toc__toggle { display: none; }
.legal-toc__title { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 14px; font-family: var(--f-en); font-size: 0.74rem; font-weight: 600; letter-spacing: 0.3em; text-transform: uppercase; color: var(--c-gold); }
html[lang="zh-CN"] .legal-toc__title { font-family: var(--f-serif); font-size: 0.9rem; letter-spacing: 0.2em; }
.legal-toc__pct { font-family: var(--f-en); font-size: 0.72rem; letter-spacing: 0.1em; color: var(--c-muted); font-variant-numeric: tabular-nums; }
.legal-toc__track { position: relative; max-height: calc(100vh - var(--header-h) - 150px); overflow-y: auto; overscroll-behavior: contain; border-left: 1px solid var(--c-line-strong); scrollbar-width: thin; }
.legal-toc__ind { position: absolute; left: -1px; top: 0; width: 2px; height: 0; background: var(--grad-peach); box-shadow: var(--glow-peach); transition: transform 0.45s var(--ease-out), height 0.45s var(--ease-out); pointer-events: none; }
.legal-toc__list a {
  display: grid;
  grid-template-columns: 2.1em minmax(0, 1fr);
  gap: 4px;
  padding: 7px 10px 7px 16px;
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--c-muted);
  transition: color 0.3s, background-color 0.3s, padding-left 0.35s var(--ease-out);
}
.legal-toc__list a:hover { color: var(--c-text); background: rgba(255, 255, 255, 0.03); }
.legal-toc__list a[aria-current="location"] { color: var(--c-peach-2); padding-left: 20px; background: linear-gradient(90deg, rgba(232, 135, 159, 0.1), transparent); }
.legal-toc__num { padding-top: 0.12em; font-family: var(--f-en); font-size: 0.76rem; letter-spacing: 0.06em; color: var(--c-gold); opacity: 0.7; }
.legal-toc__list a[aria-current="location"] .legal-toc__num { opacity: 1; }
.legal-toc__meter { position: relative; height: 2px; margin-top: 18px; overflow: hidden; border-radius: 2px; background: var(--c-line); }
.legal-toc__meter span { position: absolute; inset: 0; background: var(--grad-peach); transform: scaleX(var(--p, 0)); transform-origin: left; }

/* ---------- 正文 ---------- */
.legal-doc { min-width: 0; max-width: 820px; }
.legal-intro { padding-bottom: 28px; border-bottom: 1px solid var(--c-line); font-size: clamp(1.02rem, 1.4vw, 1.12rem); line-height: 1.95; color: var(--c-text); }
.legal-intro a { color: var(--c-peach-2); }

.legal-summary { margin-top: 32px; }
.legal-summary__title { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; font-family: var(--f-serif); font-size: 1.05rem; letter-spacing: 0.12em; color: var(--c-gold); }
html[lang="en"] .legal-summary__title { font-family: var(--f-en); letter-spacing: 0.14em; text-transform: uppercase; font-size: 0.92rem; }
.legal-summary__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
/* 卡片数为奇数时，最后一张横跨两列（隐私政策的「免费游玩，不开放充值」） */
.legal-summary__grid > :last-child:nth-child(odd) { grid-column: 1 / -1; }
.legal-card {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-content: start;
  column-gap: 14px;
  row-gap: 4px;
  padding: 18px 18px 18px 16px;
  border: 1px solid var(--c-line);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, var(--c-surface-2), var(--c-surface));
  overflow: hidden;
  transition: border-color 0.4s, box-shadow 0.45s var(--ease-out), transform 0.45s var(--ease-out);
}
.legal-card::after { content: ""; position: absolute; right: -40px; top: -40px; width: 110px; height: 110px; border-radius: 50%; background: radial-gradient(circle, rgba(232, 135, 159, 0.16), transparent 70%); opacity: 0; transition: opacity 0.5s; pointer-events: none; }
.legal-card:hover { border-color: rgba(232, 135, 159, 0.4); box-shadow: var(--shadow-1); }
.js .legal-card.is-revealed:hover { transform: translateY(-3px); }
.legal-card:hover::after { opacity: 1; }
.legal-card__ico { grid-row: span 2; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; border: 1px solid rgba(241, 221, 174, 0.35); color: var(--c-gold-2); background: rgba(217, 191, 134, 0.06); transition: background-color 0.4s, color 0.4s, border-color 0.4s; }
.legal-card:hover .legal-card__ico { background: var(--grad-peach); border-color: transparent; color: #fff; }
.legal-card__ico .icon { width: 19px; height: 19px; }
.legal-card__title { font-family: var(--f-serif); font-size: 1rem; color: var(--c-text); line-height: 1.45; }
.legal-card__text { font-size: 0.88rem; line-height: 1.65; color: var(--c-text-2); }

.legal-sec { position: relative; padding-top: clamp(40px, 5vw, 56px); scroll-margin-top: 16px; }
.legal-sec__head { position: relative; display: flex; align-items: center; gap: 10px; padding-bottom: 14px; border-bottom: 1px solid var(--c-line); }
.legal-sec__title { display: flex; align-items: baseline; gap: 14px; font-size: clamp(1.3rem, 2.2vw, 1.6rem); line-height: 1.35; color: var(--c-text); }
.legal-sec__num { flex: none; font-family: var(--f-en); font-size: 0.95rem; font-weight: 700; letter-spacing: 0.08em; color: var(--c-gold); transition: color 0.4s; }
.legal-sec.is-current .legal-sec__num { color: var(--c-peach-2); }
.legal-sec__head::after { content: ""; position: absolute; left: 0; bottom: -1px; width: 64px; height: 1px; background: var(--grad-peach); transform: scaleX(0); transform-origin: left; transition: transform 0.6s var(--ease-out); }
.legal-sec.is-current .legal-sec__head::after { transform: none; }
.legal-sec__link { display: grid; place-items: center; flex: none; width: 40px; height: 40px; margin-left: auto; border: 1px solid transparent; border-radius: 50%; color: var(--c-muted); opacity: 0.35; transition: opacity 0.3s, color 0.3s, border-color 0.3s, transform 0.35s var(--ease-out); }
.legal-sec__link .icon { width: 17px; height: 17px; }
.legal-sec:hover .legal-sec__link, .legal-sec__link:focus-visible { opacity: 1; }
.legal-sec__link:hover { color: var(--c-peach-2); border-color: rgba(232, 135, 159, 0.4); transform: rotate(-12deg); }
.legal-sec__link.is-done { color: var(--c-jade); border-color: rgba(99, 179, 163, 0.5); opacity: 1; }
.legal-sec__body { max-width: none; margin-top: 18px; font-size: 1rem; }
.legal-sec__body a { word-break: break-word; }
.legal-sec.is-flash .legal-sec__head { animation: legal-flash 1.6s var(--ease-out); }

.legal-note { display: flex; align-items: flex-start; gap: 12px; padding: 14px 18px; border: 1px solid rgba(232, 135, 159, 0.35); border-radius: var(--radius); background: rgba(232, 135, 159, 0.07); color: var(--c-text); font-size: 0.95rem; line-height: 1.8; }
.legal-note .icon { flex: none; margin-top: 0.3em; color: var(--c-peach-2); }
.legal-table { margin-block: 1.2em; }
.legal-table table { min-width: 560px; font-size: 0.9rem; }
.legal-table th, .legal-table td { padding: 12px 14px; border: 0; border-bottom: 1px solid var(--c-line); line-height: 1.6; vertical-align: top; }
.legal-table tbody th { background: none; color: var(--c-text); font-weight: 400; white-space: nowrap; }
/* 'plain' => true 的表格（隐私政策的保存期限表）：第一列是较长的普通文字，允许换行 */
.legal-table--plain tbody th { min-width: 11em; white-space: normal; }
.legal-table code { padding: 2px 8px; border-radius: 3px; background: rgba(217, 191, 134, 0.1); border: 1px solid rgba(217, 191, 134, 0.25); font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 0.86rem; color: var(--c-gold-2); }

/* ---------- 响应式 ---------- */
@media (max-width: 1023px) {
  .legal-layout { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .legal-doc { max-width: none; }
  .legal-toc {
    top: var(--header-h);
    z-index: 30;
    margin-inline: calc(var(--gutter) * -1);
    padding-inline: var(--gutter);
    background: rgba(13, 10, 11, 0.92);
    backdrop-filter: blur(14px) saturate(1.2);
    -webkit-backdrop-filter: blur(14px) saturate(1.2);
    border-block: 1px solid var(--c-line);
  }
  .site-header.is-hidden ~ main .legal-toc { top: 0; }
  .site-header.is-hidden ~ main .legal-toc__track { max-height: min(60vh, 460px, calc(100vh - 80px)); }
  .legal-toc__title, .legal-toc__ind { display: none; }
  .legal-toc__toggle { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 54px; text-align: left; }
  .legal-toc__label { flex: none; padding: 3px 10px; border: 1px solid rgba(241, 221, 174, 0.4); border-radius: 999px; font-size: 0.78rem; letter-spacing: 0.1em; color: var(--c-gold); }
  .legal-toc__current { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--f-serif); font-weight: 600; color: var(--c-text); }
  .legal-toc__chev { flex: none; color: var(--c-muted); transition: transform 0.4s var(--ease-out); }
  .legal-toc.is-open .legal-toc__chev { transform: rotate(180deg); }
  /* 下拉目录浮在栏下方（不占文档流），展开 / 收起不改变页面高度，避免滚动锚定把页面推走 */
  .legal-toc__track {
    display: none;
    position: absolute;
    top: calc(100% + 1px);
    left: 0;
    right: 0;
    max-height: min(60vh, 460px, calc(100vh - var(--header-h) - 80px));
    padding: 8px var(--gutter) 12px;
    border-left: 0;
    border-bottom: 1px solid var(--c-line-strong);
    background: var(--c-bg); /* 必须不透明：父级有 backdrop-filter，半透明背景会透出下方正文 */
    box-shadow: 0 24px 48px -12px rgba(0, 0, 0, 0.7);
  }
  .legal-toc.is-open .legal-toc__track { display: block; animation: legal-drop 0.4s var(--ease-out); }
  .legal-toc__list a { min-height: 44px; align-items: center; padding-left: 6px; }
  .legal-toc__list a[aria-current="location"] { padding-left: 12px; }
  .legal-toc__meter { position: absolute; left: 0; right: 0; bottom: -1px; margin: 0; height: 2px; border-radius: 0; background: transparent; }
  .legal-sec { scroll-margin-top: 72px; }
}
@media (max-width: 640px) {
  .legal-hero__bar { flex-direction: column; align-items: flex-start; }
  .legal-hero__tools { width: 100%; }
  .legal-switch { flex: 1 1 100%; }
  .legal-switch a { flex: 1; justify-content: center; padding: 0 10px; white-space: nowrap; font-size: 0.88rem; }
  .legal-summary__grid { grid-template-columns: minmax(0, 1fr); }
  /* 表格改为卡片：每行一张卡，列名放在每格前面，不再需要横向滚动 */
  .legal-table { overflow: visible; border: 0; }
  .legal-table table { min-width: 0; }
  .legal-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .legal-table table, .legal-table tbody, .legal-table tr, .legal-table th, .legal-table td { display: block; width: 100%; }
  .legal-table tbody { display: grid; gap: 12px; }
  .legal-table tr { padding: 14px 16px 6px; border: 1px solid var(--c-line); border-radius: var(--radius-lg); background: linear-gradient(180deg, var(--c-surface-2), var(--c-surface)); }
  .legal-table tbody tr:hover { background: linear-gradient(180deg, var(--c-surface-2), var(--c-surface)); border-color: rgba(232, 135, 159, 0.35); }
  .legal-table tbody th { padding: 0 0 10px; border-bottom: 1px dashed var(--c-line-strong); white-space: normal; }
  .legal-table td { display: grid; grid-template-columns: 5.6em minmax(0, 1fr); gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--c-line); }
  .legal-table td:last-child { border-bottom: 0; }
  .legal-table td::before { content: attr(data-label); font-size: 0.8rem; font-weight: 600; letter-spacing: 0.04em; color: var(--c-gold); }
  .legal-sec__title { gap: 10px; }
  .legal-sec__link { opacity: 0.6; }
}
@media (hover: none) {
  .legal-sec__link { opacity: 0.6; }
}

/* ---------- 动画 ---------- */
@keyframes legal-glyph-in { from { opacity: 0; transform: translateY(-40%) rotate(-10deg) scale(0.9); filter: blur(10px); } to { opacity: 1; transform: translateY(-46%) rotate(-4deg); filter: none; } }
@keyframes legal-drop { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@keyframes legal-flash { 0%, 100% { background: transparent; } 30% { background: rgba(232, 135, 159, 0.1); } }

/* ---------- 打印 ---------- */
@media print {
  .site-header, .site-footer, .mobile-nav, .to-top, .toast, .preloader, .page-veil, .skip-link,
  .legal-toc, .legal-hero__tools, .legal-hero__glyph, .legal-sec__link { display: none !important; }
  body, .legal-hero, .legal-body { background: #fff !important; color: #111 !important; }
  .legal-hero { padding: 0 0 16px; border: 0; }
  .legal-hero::before, .legal-hero::after { display: none; }
  .legal-layout { display: block; }
  .legal-doc { max-width: none; }
  .legal-hero__title, .legal-sec__title, .legal-intro, .legal-card__title { color: #111 !important; text-shadow: none !important; }
  .legal-hero__lead, .legal-meta, .legal-meta time, .legal-meta b, .prose, .legal-card__text, .legal-note { color: #333 !important; }
  .legal-card, .legal-note, .table-scroll { background: none !important; border-color: #ccc !important; box-shadow: none !important; }
  .js [data-reveal] { opacity: 1 !important; transform: none !important; }
  .prose a, .legal-intro a { color: #111 !important; }
  .legal-sec { break-inside: avoid-page; }
}
