/* =========================================================
   安在记 - 协议页面通用样式
   适用：协议中心 / 隐私政策 / 用户服务协议 / 会员协议
   设计：极简 H5 风格（移动端优先，桌面端自适应）
   ========================================================= */

/* ==================== CSS 变量 ==================== */
:root {
    /* 主色 */
    --primary-color: #F77B56;
    --primary-light: #FFA589;
    --primary-dark:  #E55A3A;

    /* 背景 */
    --background-warm:  #FFF8F5;
    --background-light: #FFF5F2;
    --background-card:  #FFFFFF;

    /* 文字 */
    --text-dark:   #3D2A24;
    --text-medium: #6B5045;
    --text-light:  #9C857D;

    /* 分隔线/边 */
    --border-light: rgba(247, 123, 86, 0.14);

    /* 阴影 */
    --shadow-sm: 0 2px 12px rgba(247, 123, 86, 0.08);
    --shadow-md: 0 8px 24px rgba(247, 123, 86, 0.10);

    /* 过渡 */
    --transition-fast: 0.25s ease;
}

/* ==================== 基础重置 ==================== */
* { margin: 0; padding: 0; box-sizing: border-box; }

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    scroll-padding-top: 56px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC",
                 "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI",
                 Roboto, sans-serif;
    font-size: 15px;
    line-height: 1.7;
    color: var(--text-dark);
    background-color: var(--background-warm);
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
    /* iOS safe-area */
    padding-left:  env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition-fast);
}
a:active { color: var(--primary-dark); }

img { max-width: 100%; height: auto; display: block; }

/* ==================== H5 顶部导航 ==================== */
/* 仿客户端的页面顶栏：返回箭头 + 居中标题 */
.agr-header {
    position: sticky;
    top: 0;
    z-index: 100;
    height: 56px;
    background: var(--background-warm);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    padding: 0 12px;
    /* 顶栏背景毛玻璃效果，更接近 App */
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.agr-back-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: var(--text-dark);
    transition: var(--transition-fast);
    flex-shrink: 0;
}
.agr-back-btn:active { background: rgba(247, 123, 86, 0.08); }
.agr-back-btn svg { width: 22px; height: 22px; }

.agr-header-title {
    flex: 1;
    text-align: center;
    font-size: 17px;
    font-weight: 600;
    color: var(--text-dark);
    /* 给左右按钮让位 */
    padding: 0 36px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.agr-header-right {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
}

/* ==================== 主体容器 ==================== */
.agr-main {
    max-width: 720px;          /* H5 桌面下最大宽度不超过 720，居中阅读舒适 */
    margin: 0 auto;
    padding: 16px 16px 64px;   /* 移动端优先紧贴左右 */
}

/* ==================== 协议卡片（中心列表） ==================== */
.agr-list { display: flex; flex-direction: column; gap: 12px; }

.agr-list-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    background: var(--background-card);
    border-radius: 14px;
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    color: var(--text-dark);
    transition: var(--transition-fast);
}
.agr-list-item:active {
    transform: scale(0.98);
    background: var(--background-light);
    color: var(--text-dark);
}

.agr-list-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(145deg, var(--primary-color), var(--primary-light));
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(247, 123, 86, 0.22);
}
.agr-list-icon img {
    width: 24px;
    height: 24px;
    filter: brightness(0) invert(1);
}

.agr-list-body { flex: 1; min-width: 0; }
.agr-list-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 4px;
}
.agr-list-desc {
    font-size: 13px;
    color: var(--text-medium);
    line-height: 1.5;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.agr-list-arrow {
    width: 16px;
    height: 16px;
    color: var(--text-light);
    flex-shrink: 0;
}

/* ==================== 协议详情页（H5 单列） ==================== */
.agr-doc {
    background: var(--background-card);
    border-radius: 16px;
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    padding: 24px 20px;
}

.agr-doc-head {
    text-align: center;
    padding: 12px 0 20px;
    margin-bottom: 20px;
    border-bottom: 1px dashed var(--border-light);
}
.agr-doc-badge {
    display: inline-block;
    padding: 4px 12px;
    background: rgba(247, 123, 86, 0.12);
    color: var(--primary-color);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 10px;
}
.agr-doc-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-dark);
    line-height: 1.4;
    margin-bottom: 8px;
}
.agr-doc-update {
    font-size: 12px;
    color: var(--text-light);
}

/* 章节 */
.agr-section {
    margin-bottom: 28px;
    scroll-margin-top: 72px;
}
.agr-section:last-child { margin-bottom: 0; }

.agr-section h2 {
    font-size: 17px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 14px;
    padding-left: 12px;
    border-left: 4px solid var(--primary-color);
    line-height: 1.4;
    scroll-margin-top: 72px;
}
.agr-section h3 {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-dark);
    margin: 18px 0 10px;
    scroll-margin-top: 72px;
}
.agr-section h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dark);
    margin: 14px 0 8px;
}

.agr-section p {
    font-size: 14px;
    color: var(--text-medium);
    margin-bottom: 10px;
    line-height: 1.85;
}

.agr-section ul,
.agr-section ol {
    margin: 8px 0 12px 22px;
    padding-left: 4px;
}
.agr-section ul li,
.agr-section ol li {
    font-size: 14px;
    color: var(--text-medium);
    margin-bottom: 6px;
    line-height: 1.75;
    padding-left: 4px;
}
.agr-section ul li::marker { color: var(--primary-color); }
.agr-section ol li::marker { color: var(--primary-color); font-weight: 700; }

.agr-section strong { color: var(--text-dark); font-weight: 700; }

/* 高亮块 */
.agr-tip {
    background: linear-gradient(135deg,
                  rgba(247, 123, 86, 0.06) 0%,
                  rgba(255, 166, 137, 0.06) 100%);
    border-left: 3px solid var(--primary-color);
    border-radius: 8px;
    padding: 12px 14px;
    margin: 14px 0;
    font-size: 13.5px;
    color: var(--text-medium);
    line-height: 1.75;
}
.agr-tip strong { color: var(--primary-dark); }

.agr-warn {
    background: linear-gradient(135deg,
                  rgba(229, 90, 58, 0.06) 0%,
                  rgba(247, 123, 86, 0.06) 100%);
    border: 1px solid rgba(229, 90, 58, 0.18);
    border-radius: 8px;
    padding: 12px 14px;
    margin: 14px 0;
    font-size: 13.5px;
    color: var(--text-medium);
    line-height: 1.75;
}
.agr-warn strong { color: var(--primary-dark); }

/* 表格 */
.agr-table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 14px 0;
    border-radius: 10px;
    box-shadow: var(--shadow-sm);
}
.agr-table-wrap .agr-table {
    margin: 0;
    box-shadow: none;
    min-width: 480px;
}

.agr-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    background: var(--background-card);
    border-radius: 10px;
    overflow: hidden;
}
.agr-table thead {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: #fff;
}
.agr-table th,
.agr-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
    vertical-align: top;
    line-height: 1.5;
}
.agr-table th { font-weight: 600; }
.agr-table tbody tr:nth-child(even) { background: rgba(247, 123, 86, 0.03); }
.agr-table tbody tr:last-child td { border-bottom: none; }

/* 强调标签 */
.agr-tag {
    display: inline-block;
    padding: 2px 8px;
    background: rgba(247, 123, 86, 0.12);
    color: var(--primary-dark);
    border-radius: 5px;
    font-size: 12px;
    font-weight: 600;
    margin: 0 2px;
}

/* 协议详情页底部 */
.agr-doc-foot {
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px dashed var(--border-light);
    text-align: center;
    color: var(--text-light);
    font-size: 12px;
    line-height: 1.8;
}

/* ==================== 页脚 ==================== */
.agr-footer {
    text-align: center;
    padding: 28px 16px;
    color: var(--text-light);
    font-size: 12px;
    line-height: 1.8;
    background: var(--background-warm);
}
.agr-footer a { color: var(--text-medium); margin: 0 6px; }
.agr-footer a:active { color: var(--primary-color); }

/* ==================== 回到顶部 ==================== */
.agr-totop {
    position: fixed;
    bottom: calc(24px + env(safe-area-inset-bottom, 0px));
    right: calc(16px + env(safe-area-inset-right, 0px));
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(247, 123, 86, 0.35);
    opacity: 0;
    visibility: hidden;
    transform: translateY(16px);
    transition: var(--transition-fast);
    z-index: 99;
    border: none;
}
.agr-totop.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.agr-totop:active { transform: scale(0.92); }

/* =========================================================
   响应式适配
   桌面/平板/手机共用一套断点
   ========================================================= */

/* 平板及以下稍微加大字号 */
@media (min-width: 768px) {
    body { font-size: 16px; }
    .agr-main { padding: 24px 24px 64px; }
    .agr-doc { padding: 32px 32px; border-radius: 18px; }
    .agr-doc-title { font-size: 26px; }
    .agr-section h2 { font-size: 19px; }
    .agr-section h3 { font-size: 16.5px; }
    .agr-section p,
    .agr-section li { font-size: 15px; }
    .agr-tip, .agr-warn { font-size: 14.5px; }
    .agr-list-item { padding: 18px; }
    .agr-list-icon { width: 48px; height: 48px; }
    .agr-list-icon img { width: 26px; height: 26px; }
    .agr-list-title { font-size: 17px; }
    .agr-list-desc { font-size: 14px; }
}

/* 桌面端进一步居中、加大留白 */
@media (min-width: 1100px) {
    .agr-main { padding: 32px 24px 64px; }
    .agr-doc { padding: 40px 48px; border-radius: 20px; }
    .agr-doc-title { font-size: 28px; margin-bottom: 12px; }
    .agr-doc-update { font-size: 13px; }
    .agr-section { margin-bottom: 36px; }
    .agr-section h2 { font-size: 20px; margin-bottom: 18px; }
    .agr-section h3 { font-size: 17px; }
    .agr-section p,
    .agr-section li { font-size: 15.5px; line-height: 1.9; }
    .agr-tip, .agr-warn { padding: 16px 20px; font-size: 15px; border-radius: 10px; }
    .agr-tip { padding-left: 18px; }
    .agr-table th, .agr-table td { padding: 14px 16px; }
}
