/* 协议页：App WebView 内嵌，强制适配屏宽、禁止横向溢出 */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  height: 100%;
  overflow-x: hidden;
}

body.policy-page {
  margin: 0;
  padding: 0;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
  background: #fff;
  color: #111;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
}

body.policy-page--embedded {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  height: 100vh;
  overflow: hidden;
}

.policy-app-bar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  min-height: 44px;
  width: 100%;
  max-width: 100vw;
  padding: 0 8px;
  padding-top: env(safe-area-inset-top);
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  z-index: 10;
}

.policy-app-bar__back {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  color: #111;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.policy-app-bar__back:active {
  opacity: 0.55;
}

.policy-app-bar__back-icon {
  display: block;
  width: 10px;
  height: 10px;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  margin-left: 4px;
}

.policy-app-bar__title {
  flex: 1;
  min-width: 0;
  margin: 0;
  padding: 0 8px 0 0;
  font-size: 17px;
  font-weight: 600;
  line-height: 44px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.policy-page--no-bar .policy-app-bar {
  display: none;
}

/* 滚动区 + 内容区：宽度锁死在视口内 */
.policy-page__body,
#content {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: hidden;
}

body.policy-page--embedded .policy-page__body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 12px 14px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom));
}

body.policy-page--no-bar.policy-page--embedded .policy-page__body {
  padding-top: calc(12px + env(safe-area-inset-top));
}

body.policy-page:not(.policy-page--embedded) {
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  background: #f5f5f5;
}

body.policy-page:not(.policy-page--embedded) .policy-page__body {
  padding: 12px 14px;
  background: #fff;
  min-height: 100dvh;
  min-height: 100vh;
}

.policy-page__loading {
  color: #6b7280;
  font-size: 15px;
  line-height: 1.6;
}

.policy-page__error {
  color: #b91c1c;
  font-weight: 600;
  font-size: 15px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
}

/* Word 正文：覆盖内联样式，强制换行 */
.policy-document {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  overflow-x: hidden;
  font-size: 15px;
  line-height: 1.75;
  color: #1a1a1a;
  word-break: break-word;
  overflow-wrap: anywhere;
  line-break: anywhere;
}

.policy-document * {
  max-width: 100% !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
}

.policy-document p,
.policy-document div,
.policy-document span,
.policy-document li,
.policy-document td,
.policy-document th,
.policy-document h1,
.policy-document h2,
.policy-document h3,
.policy-document h4,
.policy-document h5,
.policy-document h6,
.policy-document a {
  width: auto !important;
  white-space: normal !important;
  word-break: break-word !important;
  overflow-wrap: anywhere !important;
}

.policy-document h1,
.policy-document h2,
.policy-document h3,
.policy-document h4,
.policy-document h5,
.policy-document h6 {
  font-weight: 600;
  line-height: 1.35;
  margin: 1em 0 0.5em;
}

.policy-document h1 { font-size: 1.35rem; }
.policy-document h2 { font-size: 1.2rem; }
.policy-document h3 { font-size: 1.1rem; }
.policy-document h4 { font-size: 1.05rem; }

.policy-document p {
  margin: 0.55em 0;
  text-align: left;
}

.policy-document ul,
.policy-document ol {
  margin: 0.55em 0;
  padding-left: 1.25em;
}

.policy-document li {
  margin: 0.35em 0;
}

.policy-document .policy-table-wrap {
  display: block;
  width: 100% !important;
  max-width: 100% !important;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0.8em 0;
}

.policy-document table {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  table-layout: fixed !important;
  border-collapse: collapse;
  font-size: 13px;
}

.policy-document th,
.policy-document td {
  border: 1px solid #d1d5db;
  padding: 6px 8px;
  vertical-align: top;
  word-break: break-word !important;
  overflow-wrap: anywhere !important;
}

.policy-document th {
  background: #f3f4f6;
  font-weight: 600;
}

.policy-document img {
  display: block;
  max-width: 100% !important;
  height: auto !important;
}

.policy-document a {
  color: #2563eb;
  text-decoration: underline;
  word-break: break-all !important;
}

.policy-document pre {
  white-space: pre-wrap !important;
  word-break: break-word !important;
  overflow-x: auto;
  max-width: 100% !important;
}

@media (min-width: 600px) {
  body.policy-page:not(.policy-page--embedded) {
    background: #f0f0f0;
  }

  body.policy-page:not(.policy-page--embedded) .policy-page__body {
    max-width: 720px;
    margin: 16px auto;
    padding: 20px 24px;
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  }

  .policy-document p {
    text-align: justify;
  }
}

@media (min-width: 960px) {
  body.policy-page:not(.policy-page--embedded) .policy-page__body {
    max-width: 860px;
    margin: 24px auto;
  }
}
