/* ==========================================================================
   consent.css — Cookie 授权横幅 + 偏好中心（2026-11-18，仅英文语言引入）
   依赖 common.css 的 --brand / --navy / --line 等变量。
   ★ z-index 需高于 sp-pop(1200) 与 tabbar(80)，统一 3000+。
   ★ 所有元素用 [hidden] 控制显隐，必须 !important 压过 display:flex/grid。
   ========================================================================== */

.ck { font-family: inherit; }
.ck [hidden] { display: none !important; }
body.ck-lock { overflow: hidden; }

/* ---------- 按钮 ---------- */
.ck-btn {
    display: inline-flex; align-items: center; justify-content: center;
    min-height: 42px; padding: 10px 20px;
    border: 1px solid transparent; border-radius: 8px;
    font: inherit; font-size: 14px; font-weight: 600; line-height: 1.3;
    cursor: pointer; white-space: nowrap;
    transition: background-color .18s, border-color .18s, color .18s, transform .18s;
}
.ck-btn:focus-visible { outline: 3px solid var(--brand-light); outline-offset: 2px; }
.ck-btn:active { transform: translateY(1px); }
.ck-btn--primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.ck-btn--primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.ck-btn--outline { background: #fff; color: var(--brand-dark); border-color: var(--brand-line); }
.ck-btn--outline:hover { background: var(--brand-soft); border-color: var(--brand); }
.ck-btn--ghost { background: #fff; color: var(--navy); border-color: var(--line, #d9e2ec); }
.ck-btn--ghost:hover { background: #f4f7fb; }
.ck-btn--text {
    background: transparent; color: var(--brand-dark); border-color: transparent;
    text-decoration: underline; text-underline-offset: 3px; padding-inline: 8px;
}
.ck-btn--text:hover { color: var(--brand); }

/* ---------- 页脚合规入口（页脚是深蓝底，颜色继承 + 半透明） ---------- */
.footer__legal-links { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 8px 18px; }
.footer__legal-links a,
.footer__ck {
    color: inherit; opacity: .78; text-decoration: none; font-size: inherit;
    transition: opacity .15s;
}
.footer__legal-links a:hover, .footer__ck:hover { opacity: 1; text-decoration: underline; text-underline-offset: 3px; }
.footer__ck { background: none; border: 0; padding: 0; cursor: pointer; font: inherit; }
.footer__ck:focus-visible { outline: 2px solid var(--brand-on-dark); outline-offset: 3px; }

/* ---------- 初次横幅 ---------- */
.ck-banner {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 3000;
    padding: 16px 20px calc(16px + env(safe-area-inset-bottom, 0px));
    pointer-events: none;                 /* 空白区不挡点击 */
    animation: ckIn .3s ease-out both;
}
.ck-banner__inner {
    pointer-events: auto;
    box-sizing: border-box;
    width: 100%; max-width: min(1180px, 100%); margin: 0 auto;
    display: flex; align-items: center; gap: 26px;
    padding: 20px 24px;
    background: #fff; border: 1px solid var(--line, #dde5ee);
    border-radius: 14px;
    box-shadow: 0 14px 44px rgba(7, 26, 51, .18), 0 2px 8px rgba(7, 26, 51, .08);
}
.ck-banner__text { display: flex; gap: 14px; align-items: flex-start; flex: 1 1 auto; min-width: 0; }
.ck-banner__icon {
    flex: 0 0 40px; width: 40px; height: 40px; border-radius: 10px;
    display: grid; place-items: center;
    background: var(--brand-soft); color: var(--brand-dark);
}
.ck-banner__copy { min-width: 0; }
.ck-banner__title { margin: 0 0 5px; font-size: 17px; line-height: 1.35; color: var(--navy); font-weight: 700; }
.ck-banner__desc { margin: 0; font-size: 13.5px; line-height: 1.65; color: #4a5b6e; }
.ck-banner__links { margin: 8px 0 0; font-size: 12.5px; color: #7b8b9e; }
.ck-banner__links a,
.ck-linkbtn {
    color: var(--brand-dark); font-size: inherit; text-decoration: underline; text-underline-offset: 2px;
}
.ck-linkbtn {
    background: none; border: 0; padding: 0; cursor: pointer; font: inherit; font-weight: 500;
}
.ck-banner__links a:hover, .ck-linkbtn:hover { color: var(--brand); }
.ck-banner__links span { margin: 0 6px; color: #b6c2d0; }
.ck-banner__actions {
    flex: 0 0 auto; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end;
}

/* ---------- 遮罩 + 偏好中心 ---------- */
.ck-overlay {
    position: fixed; inset: 0; z-index: 3100;
    background: rgba(7, 26, 51, .48);
    -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
    animation: ckFade .2s ease-out both;
}
.ck-modal {
    position: fixed; z-index: 3200;
    left: 50%; top: 50%; transform: translate(-50%, -50%);
    width: min(600px, calc(100vw - 32px)); max-height: min(86vh, 760px);
    display: flex; flex-direction: column;
    background: #fff; border-radius: 14px;
    box-shadow: 0 24px 70px rgba(7, 26, 51, .3);
    animation: ckPop .24s ease-out both;
}
.ck-modal__head {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 20px 24px 16px; border-bottom: 1px solid var(--line, #e4eaf1);
}
.ck-modal__head h2 { margin: 0; font-size: 19px; color: var(--navy); font-weight: 700; }
.ck-modal__x {
    width: 34px; height: 34px; display: grid; place-items: center;
    background: #f2f5f9; border: 0; border-radius: 8px; color: #5a6b7e; cursor: pointer;
}
.ck-modal__x:hover { background: #e7edf5; color: var(--navy); }
.ck-modal__x:focus-visible { outline: 3px solid var(--brand-light); outline-offset: 2px; }
.ck-modal__body { padding: 18px 24px 8px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.ck-modal__intro { margin: 0 0 18px; font-size: 13.5px; line-height: 1.7; color: #4a5b6e; }
.ck-modal__note {
    margin: 16px 0 10px; font-size: 12px; line-height: 1.6; color: #8393a6;
    padding: 10px 12px; background: #f7f9fc; border-radius: 8px;
}

.ck-cat {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 18px;
    padding: 16px 0; border-top: 1px solid var(--line, #e9eef4);
}
.ck-cat:first-of-type { border-top: 0; }
.ck-cat__info { min-width: 0; }
.ck-cat__info h3 {
    margin: 0 0 5px; font-size: 15px; color: var(--navy); font-weight: 700;
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.ck-cat__info p { margin: 0; font-size: 13px; line-height: 1.65; color: #5a6b7e; }
.ck-cat__tag {
    font-size: 11px; font-weight: 600; letter-spacing: .02em;
    color: #8a6a1f; background: #fdf5e3; border: 1px solid #f0dfb4;
    padding: 2px 8px; border-radius: 20px;
}
.ck-cat__always {
    flex: 0 0 auto; font-size: 12px; font-weight: 600; color: #2c7a4b;
    background: #eaf7ef; border: 1px solid #c9ead6; padding: 5px 10px; border-radius: 20px;
}

/* 开关：原生 checkbox 保留（键盘/读屏可用），视觉层用 span */
.ck-switch { position: relative; flex: 0 0 auto; display: inline-block; width: 44px; height: 26px; cursor: pointer; }
.ck-switch input {
    position: absolute; inset: 0; width: 100%; height: 100%; margin: 0;
    opacity: 0; cursor: pointer; z-index: 1;
}
.ck-switch__track {
    display: block; width: 44px; height: 26px; border-radius: 26px;
    background: #cbd5e1; transition: background-color .2s;
}
.ck-switch__knob {
    display: block; width: 20px; height: 20px; margin: 3px;
    border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2);
    transition: transform .2s;
}
.ck-switch input:checked + .ck-switch__track { background: var(--brand); }
.ck-switch input:checked + .ck-switch__track .ck-switch__knob { transform: translateX(18px); }
.ck-switch input:focus-visible + .ck-switch__track { outline: 3px solid var(--brand-light); outline-offset: 2px; }

.ck-modal__foot {
    display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap;
    padding: 16px 24px 20px; border-top: 1px solid var(--line, #e4eaf1);
}

/* ---------- 保存提示 ---------- */
.ck-toast {
    position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 3300;
    background: var(--navy); color: #fff; font-size: 13px;
    padding: 11px 20px; border-radius: 8px; box-shadow: 0 8px 24px rgba(7,26,51,.25);
    animation: ckFade .2s ease-out both;
}

@keyframes ckIn  { from { opacity: 0; transform: translateY(22px); } to { opacity: 1; transform: none; } }
@keyframes ckFade{ from { opacity: 0; } to { opacity: 1; } }
@keyframes ckPop { from { opacity: 0; transform: translate(-50%, -46%) scale(.98); } to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }

/* ---------- 平板：横幅内按钮换行 ---------- */
@media (max-width: 980px) {
    .ck-banner__inner { flex-direction: column; align-items: stretch; gap: 16px; }
    .ck-banner__actions { justify-content: flex-start; }
}

/* ---------- 手机：让开底部 Tab（58px + 安全区），横幅不被压住 ---------- */
@media (max-width: 720px) {
    .ck-banner { padding: 0 10px calc(58px + env(safe-area-inset-bottom, 0px) + 10px); }
    .ck-banner__inner { padding: 16px; gap: 14px; border-radius: 12px; }
    .ck-banner__icon { flex-basis: 34px; width: 34px; height: 34px; }
    .ck-banner__title { font-size: 16px; }
    .ck-banner__desc { font-size: 13px; }
    /* ★ 列宽必须用 minmax(0, 1fr)：按钮默认 white-space:nowrap，
       「Reject non-essential」的 min-content 会把 1fr 列撑破、整卡溢出视口（11-18 踩过）。 */
    .ck-banner__actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .ck-banner__actions .ck-btn {
        width: 100%; min-height: 40px; padding: 9px 8px;
        font-size: 12.5px; white-space: normal; line-height: 1.3;
    }
    .ck-banner__actions .ck-btn--text { grid-column: 1 / -1; min-height: 32px; font-size: 13px; }
    .ck-modal { width: calc(100vw - 20px); max-height: 88vh; }
    .ck-modal__head, .ck-modal__body, .ck-modal__foot { padding-left: 16px; padding-right: 16px; }
    .ck-modal__intro { font-size: 13px; margin-bottom: 14px; }
    .ck-cat { padding: 13px 0; }
    .ck-modal__foot { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .ck-modal__foot .ck-btn { padding-inline: 8px; font-size: 12.5px; white-space: normal; line-height: 1.3; }
    .ck-modal__foot .ck-btn--primary { grid-column: 1 / -1; }
    .ck-toast { bottom: calc(58px + env(safe-area-inset-bottom, 0px) + 16px); width: max-content; max-width: 90vw; }
}

@media (prefers-reduced-motion: reduce) {
    .ck-banner, .ck-overlay, .ck-modal, .ck-toast { animation: none; }
    .ck-switch__track, .ck-switch__knob, .ck-btn { transition: none; }
}
