/* ============================================================
   Cookie 同意层（横幅 + 设置面板）
   由 /consent.js 注入 DOM，样式与 site.css 共用同一套变量。
   ============================================================ */

/* 横幅和面板都用 flex/grid，必须显式兜住 hidden —— 否则「关掉」根本关不掉 */
.ck-banner[hidden],
.ck-overlay[hidden] {
  display: none !important;
}

/* ---------- 底部横幅 ---------- */

.ck-banner {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 200;
  background: rgba(6, 15, 29, 0.94);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  backdrop-filter: blur(18px) saturate(160%);
  border-top: 1px solid var(--line-strong);
  box-shadow: 0 -18px 44px rgba(0, 0, 0, 0.42);
  animation: ck-rise 0.28s ease both;
}

@keyframes ck-rise {
  from { transform: translateY(100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .ck-banner { animation: none; }
}

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

.ck-copy { min-width: 0; }

.ck-copy strong {
  display: block;
  font-size: 13.5px;
  color: var(--text);
  margin-bottom: 3px;
}

.ck-copy p {
  margin: 0;
  font-size: 12.8px;
  line-height: 1.7;
  color: var(--text-3);
  max-width: 640px;
}

.ck-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* 「全部接受」和「仅必要」必须同款：同边框、同底色、同字号。
   做成一个实心一个灰字，就是监管明确点名的暗黑模式。 */
.ck-btn {
  appearance: none;
  -webkit-appearance: none;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  padding: 9px 17px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.ck-btn:hover {
  background: var(--accent-soft);
  border-color: var(--accent-line);
  color: #fff;
}

.ck-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.ck-link {
  appearance: none;
  background: none;
  border: 0;
  padding: 4px 2px;
  font-family: inherit;
  font-size: 12.8px;
  color: var(--text-3);
  text-decoration: underline;
  text-decoration-color: rgba(255, 255, 255, 0.22);
  text-underline-offset: 3px;
  cursor: pointer;
}

.ck-link:hover { color: var(--accent); }

/* 横幅占位：出现时把页脚顶上来，不至于压住版权行 */
body.ck-visible { padding-bottom: 128px; }

/* ---------- 设置面板 ---------- */

.ck-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  /* 不用 backdrop-filter：无 GPU 的环境（含部分无头浏览器）会把整层渲染成半透明，
     卡片跟着一起虚掉。纯色遮罩在深色站上观感差别不大。 */
  background: rgba(4, 9, 17, 0.82);
  animation: ck-fade 0.18s ease;
}

@keyframes ck-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.ck-card {
  width: 100%;
  max-width: 620px;
  max-height: 86vh;
  overflow: auto;
  background: var(--ink-850);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
  padding: 26px 26px 22px;
}

/* 容器接焦点是为了让读屏器读到对话框，不需要画出焦点环 */
.ck-card:focus { outline: none; }

.ck-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.ck-head h2 {
  font-size: 19px;
  letter-spacing: -0.01em;
}

.ck-close {
  appearance: none;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  color: var(--text-2);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  flex: none;
  transition: background 0.16s ease, color 0.16s ease;
}

.ck-close:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }

.ck-desc {
  margin: 10px 0 6px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-3);
}

.ck-row {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  padding: 15px 0;
  border-top: 1px solid var(--line);
}

.ck-row-text { min-width: 0; flex: 1; }

.ck-row-text b {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.ck-row-text span {
  display: block;
  font-size: 12.6px;
  line-height: 1.7;
  color: var(--text-3);
}

.ck-always {
  flex: none;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  border-radius: 999px;
  padding: 4px 11px;
  margin-top: 1px;
  white-space: nowrap;
}

/* 开关：深色底上原生的白色方块太扎眼，自绘一个 */
.ck-row input[type='checkbox'] {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  width: 42px;
  height: 24px;
  margin: 0;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.1);
  position: relative;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease;
}

.ck-row input[type='checkbox']::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #cfdcee;
  transition: transform 0.18s ease, background 0.18s ease;
}

.ck-row input[type='checkbox']:checked {
  background: var(--accent);
  border-color: var(--accent);
}

.ck-row input[type='checkbox']:checked::after {
  transform: translateX(18px);
  background: #04211d;
}

.ck-row input[type='checkbox']:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.ck-ts {
  margin: 14px 0 0;
  font-size: 12px;
  color: var(--text-3);
  min-height: 1px;
}

/* 还没选过的时候这一行是空的，别留一段空白 */
.ck-ts:empty { display: none; }

.ck-panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

/* ---------- 窄屏 ---------- */

@media (max-width: 860px) {
  .ck-inner {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    padding: 16px 18px;
  }

  /* 窄屏用两列网格：按钮各占一半，下面一行放「自定义 / 详情」，
     否则两个链接会被挤到按钮右边贴着，点起来容易误触。 */
  .ck-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .ck-actions .ck-btn { width: 100%; }
  .ck-actions .ck-link { justify-self: start; }
  .ck-actions .ck-link:last-child { justify-self: end; }

  body.ck-visible { padding-bottom: 260px; }
}

@media (max-width: 520px) {
  .ck-overlay { padding: 0; align-items: flex-end; }
  .ck-card {
    max-width: none;
    max-height: 92vh;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    border-bottom: 0;
    padding: 22px 18px 18px;
  }
  .ck-panel-actions .ck-btn { flex: 1 1 0; }
  .ck-row { gap: 14px; }
}
