/* ============================================================
   众声 VoxPop · v4 风格样式表
   令牌与 BeeCount v4.0 设计规范对齐（docs/design/card-refresh）：
   扁平 tonal 表面 + 细分割线、卡片 r22、控件 r13、按钮 r15、
   最小可点 44×44、accent 原色直用（on-accent 深墨/白）。
   明暗两套结构对称，仅表面明度与文字对比翻转。
   ============================================================ */
:root {
  /* 表面（light） */
  --bc-bg: #f5f6f7;
  --bc-paper: #ffffff;
  --bc-soft: #f3f4f5;
  /* 文本 */
  --bc-ink: #25282c;
  --bc-muted: #777c82;
  --bc-line: #eceeef;
  /* 品牌（可被问卷主题色注入覆盖） */
  --bc-accent: #f8c91c;
  --bc-accent-ink: #4c3b05;
  /* 语义 */
  --bc-danger: #b54242;
  /* 阴影（仅浮起元素） */
  --bc-shadow: 0 8px 24px rgba(36, 40, 44, .07);
  /* 圆角阶梯 */
  --r-card: 22px;
  --r-sheet: 25px;
  --r-btn: 15px;
  --r-ctrl: 13px;
  --r-sm: 9px;
  /* 派生：主色淡染（跟随 accent 注入自动派生） */
  --bc-tint: color-mix(in srgb, var(--bc-accent) 14%, var(--bc-paper));
  color-scheme: light;
}
[data-theme="dark"] {
  --bc-bg: #111214;
  --bc-paper: #18191b;
  --bc-soft: #242629;
  --bc-ink: #f0f1ed;
  --bc-muted: #a4a6a9;
  --bc-line: #303236;
  --bc-danger: #ffb3b3;
  --bc-shadow: 0 8px 24px rgba(0, 0, 0, .31);
  --bc-tint: color-mix(in srgb, var(--bc-accent) 24%, var(--bc-paper));
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Segoe UI", "Microsoft YaHei", "Noto Sans", sans-serif;
  background: var(--bc-bg);
  color: var(--bc-ink);
  font-size: 14px;
  line-height: 1.6;
  transition: background-color .2s ease, color .2s ease;
}
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; }
code {
  background: var(--bc-soft); color: var(--bc-ink);
  padding: 1px 6px; border-radius: var(--r-sm); font-size: .9em;
}
:focus-visible { outline: 2px solid var(--bc-accent); outline-offset: 3px; border-radius: 4px; }
::selection { background: var(--bc-tint); }

/* ---------- 顶栏（吸顶毛玻璃，单行、与内容同宽对齐） ---------- */
.vp-header {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--bc-paper) 80%, transparent);
  -webkit-backdrop-filter: blur(14px) saturate(1.5);
  backdrop-filter: blur(14px) saturate(1.5);
  border-bottom: 1px solid color-mix(in srgb, var(--bc-line) 75%, transparent);
  padding: 10px 17px;
}
.vp-header-in {
  max-width: 780px; margin: 0 auto;
  display: flex; align-items: center; gap: 10px;
}
.vp-logo { font-size: 20px; font-weight: 650; letter-spacing: -.3px; display: inline-flex; align-items: center; gap: 6px; }
.vp-logo-zh { margin-right: 2px; }
.vp-logo-chip {
  background: var(--bc-accent); color: var(--bc-accent-ink);
  padding: 3px 11px; border-radius: 10px; font-weight: 650;
}
.vp-logo-chip.sm { font-size: 13px; padding: 1px 8px; border-radius: 8px; }
.vp-tagline { color: var(--bc-muted); font-size: 12px; }
.vp-header-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.vp-nav { display: flex; gap: 2px; }
.vp-nav a {
  font-size: 13px; font-weight: 500; padding: 8px 11px;
  border-radius: var(--r-ctrl); min-height: 36px; display: inline-flex; align-items: center;
}
.vp-nav a:hover { background: var(--bc-soft); text-decoration: none; }
/* 语言 + 主题：软底分段胶囊，段内 hover 浮起 */
.vp-tools {
  display: flex; align-items: center; gap: 2px;
  background: var(--bc-soft); border-radius: var(--r-ctrl); padding: 2px;
}
.vp-lang, .vp-icon-btn {
  width: 34px; height: 32px; min-height: 32px;
  border: none; border-radius: calc(var(--r-ctrl) - 3px);
  background: transparent; color: var(--bc-ink);
  font-size: 12px; font-weight: 600; letter-spacing: .02em;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  text-decoration: none; padding: 0;
}
.vp-lang:hover, .vp-icon-btn:hover { background: var(--bc-paper); text-decoration: none; }
.vp-icon-btn svg { display: block; }
@media (max-width: 640px) {
  .vp-tagline { display: none; }
  .vp-header-in { gap: 6px; }
  .vp-nav a { padding: 8px 9px; }
}

/* ---------- 主区 ---------- */
.vp-main { max-width: 780px; margin: 0 auto; padding: 18px 17px 56px; }
.vp-main.vp-embed { padding: 10px 4px 16px; max-width: 640px; }

/* ---------- 页脚（纸面圆角底板；品牌 + GitHub，桌面双栏 / 移动居中堆叠） ---------- */
.vp-footer {
  background: var(--bc-paper);
  border-radius: 28px 28px 0 0;
  margin-top: 44px;
  padding: 22px 17px calc(30px + env(safe-area-inset-bottom));
}
.vp-footer-in { max-width: 780px; margin: 0 auto; display: grid; gap: 10px; justify-items: center; }
.vp-footer-brand { font-size: 15px; font-weight: 650; display: flex; align-items: center; justify-content: center; gap: 8px; }
.vp-footer-gh {
  color: var(--bc-muted); display: inline-flex; align-items: center;
  width: 30px; height: 30px; border-radius: var(--r-sm);
  align-items: center; justify-content: center;
}
.vp-footer-gh:hover { color: var(--bc-ink); background: var(--bc-soft); }
.vp-footer-privacy { color: var(--bc-muted); font-size: 12px; margin: 0; }
@media (min-width: 720px) {
  .vp-footer-in {
    grid-template-columns: 1fr auto;
    align-items: center; justify-items: start; gap: 14px;
  }
  .vp-footer-brand { justify-self: start; }
  .vp-footer-privacy { justify-self: end; }
}
.vp-footer {
  text-align: center; color: var(--bc-muted); font-size: 12px;
  padding: 24px 17px 40px;
}

/* ---------- 标题 ---------- */
.vp-title, .vp-home-title { font-size: 24px; font-weight: 650; letter-spacing: -.4px; line-height: 1.3; margin: 8px 0; }
.vp-desc { color: var(--bc-muted); font-size: 13px; margin: 4px 0 20px; }
.vp-section { font-size: 16px; font-weight: 600; margin: 26px 0 12px; }
.vp-section-h { font-size: 16px; font-weight: 600; margin: 26px 0 12px; }

/* ---------- 首页卡片 ---------- */
.vp-home-title { margin-bottom: 16px; }
.vp-home { display: grid; gap: 12px; grid-template-columns: 1fr; }
.vp-card {
  display: block; background: var(--bc-paper);
  border-radius: var(--r-card); padding: 16px 19px;
  transition: transform .15s ease;
}
.vp-card:hover { text-decoration: none; transform: translateY(-1px); }
.vp-card-title { margin: 0 0 4px; font-size: 16px; font-weight: 600; }
.vp-card-desc { margin: 0 0 6px; color: var(--bc-muted); font-size: 13px; }
.vp-card-meta { margin: 0; color: var(--bc-muted); font-size: 12px; }
@media (min-width: 720px) {
  .vp-home { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
}

/* ---------- 投票页 ---------- */
.vp-q {
  background: var(--bc-paper); border-radius: var(--r-card);
  padding: 16px 19px; margin-bottom: 12px;
}
.vp-q h3 { margin: 0 0 12px; font-size: 15px; font-weight: 600; }
.vp-choice {
  display: flex; align-items: center; gap: 10px;
  background: var(--bc-soft); border: 1.5px solid transparent;
  border-radius: var(--r-ctrl); padding: 10px 12px;
  min-height: 44px; margin-bottom: 8px; cursor: pointer;
  font-size: 13px;
}
.vp-choice:hover { border-color: var(--bc-line); }
.vp-choice:has(input:checked) { background: var(--bc-tint); border-color: var(--bc-accent); }
.vp-choice input { accent-color: var(--bc-accent); margin: 0; flex: none; }
select.vp-input, textarea.vp-input, input.vp-input {
  width: 100%; padding: 12px; border: 1.5px solid transparent;
  border-radius: var(--r-ctrl); font: inherit; font-size: 13px;
  background: var(--bc-soft); color: var(--bc-ink); margin-bottom: 10px; min-height: 44px;
}
textarea.vp-input { min-height: 96px; resize: vertical; }
select.vp-input:focus, textarea.vp-input:focus, input.vp-input:focus {
  outline: none; border-color: var(--bc-accent);
}

/* ---------- 按钮 ---------- */
.vp-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--bc-accent); color: var(--bc-accent-ink); border: none;
  padding: 10px 16px; min-height: 44px; border-radius: var(--r-btn);
  font: inherit; font-size: 13px; font-weight: 500; cursor: pointer;
}
.vp-btn:hover { filter: brightness(.97); text-decoration: none; }
.vp-btn:disabled { background: var(--bc-soft); color: var(--bc-muted); cursor: default; filter: none; }
.vp-btn.ghost { background: var(--bc-soft); color: var(--bc-ink); }
.vp-btn.ghost:hover { background: var(--bc-line); }
.vp-btn.danger { background: color-mix(in srgb, var(--bc-danger) 14%, var(--bc-paper)); color: var(--bc-danger); }
.vp-btn.small { min-height: 36px; padding: 6px 12px; font-size: 12px; }
.vp-link { background: none; border: none; color: var(--bc-ink); text-decoration: underline; cursor: pointer; font: inherit; font-size: 13px; padding: 0; }

/* ---------- 提交区 / 提示 ---------- */
.vp-actions { margin-top: 16px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.vp-msg { color: var(--bc-danger); font-size: 13px; }
.vp-thanks { font-size: 17px; font-weight: 600; }
.vp-muted { color: var(--bc-muted); font-size: 13px; }
.vp-empty { color: var(--bc-muted); text-align: center; padding: 56px 0; }
.vp-banner {
  background: var(--bc-tint);
  color: color-mix(in srgb, var(--bc-accent) 45%, var(--bc-ink));
  border: 1px solid color-mix(in srgb, var(--bc-accent) 35%, transparent);
  padding: 10px 14px; border-radius: var(--r-ctrl);
  font-size: 13px; font-weight: 500; margin: 0 0 10px;
}
.vp-turnstile { margin: 14px 0; }
.vp-error { color: var(--bc-danger); font-size: 13px; }

.vp-locked .vp-q { opacity: .6; }
.vp-locked .vp-choice { cursor: default; }
.vp-locked .vp-actions { opacity: .75; }

/* ---------- 结果 ---------- */
.vp-results-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.vp-total { color: var(--bc-muted); font-size: 13px; margin: 0; }
.vp-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; font-size: 13px; }
.vp-row-label { flex: 0 0 auto; max-width: 42%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 550; }
.vp-bar { flex: 1 1 auto; background: var(--bc-soft); border-radius: 4px; height: 8px; overflow: hidden; }
.vp-bar-fill { display: block; height: 100%; background: var(--bc-accent); border-radius: 4px; min-width: 2px; transition: width .4s ease; }
.vp-row-num { flex: 0 0 auto; color: var(--bc-muted); font-variant-numeric: tabular-nums; font-size: 12px; }
.vp-bd {
  background: var(--bc-paper); border-radius: var(--r-card);
  padding: 12px 16px; margin-bottom: 12px;
}
.vp-bd h4 { margin: 2px 0 8px; font-size: 13px; color: var(--bc-muted); font-weight: 500; }
.vp-chip {
  display: inline-block; background: var(--bc-soft); border-radius: var(--r-ctrl);
  padding: 6px 12px; font-size: 12px; margin: 0 6px 6px 0; color: var(--bc-ink);
}
h3 small.vp-chip { margin-left: 6px; font-weight: 400; }

/* ---------- 后台 ---------- */
.vp-login {
  max-width: 380px; margin: 48px auto; background: var(--bc-paper);
  border-radius: var(--r-sheet); padding: 24px;
}
.vp-login h1 { margin-top: 0; font-size: 20px; }
.vp-field { margin-bottom: 14px; }
.vp-field label { display: block; font-size: 12px; color: var(--bc-muted); margin-bottom: 5px; }
.vp-field input, .vp-field select, .vp-field textarea {
  width: 100%; padding: 12px; border: 1.5px solid transparent;
  border-radius: var(--r-ctrl); font: inherit; font-size: 13px;
  background: var(--bc-soft); color: var(--bc-ink); min-height: 44px;
}
.vp-field input[type="color"] { padding: 4px; min-height: 44px; cursor: pointer; }
.vp-field input:focus, .vp-field select:focus, .vp-field textarea:focus {
  outline: none; border-color: var(--bc-accent);
}
.vp-field-row { display: flex; gap: 12px; flex-wrap: wrap; }
.vp-field-row > .vp-field { flex: 1 1 160px; }
.vp-admin-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin: 8px 0 12px;
}
.vp-admin-head > div { display: flex; gap: 8px; align-items: center; }
.vp-admin-actions {
  display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; align-items: center;
}
.vp-accent-form { display: flex; gap: 8px; align-items: center; }
.vp-badge { font-size: 12px; border-radius: 12px; padding: 2px 10px; font-weight: 500; }
.vp-badge.on { background: var(--bc-tint); color: var(--bc-accent-ink); }
.vp-badge.off { background: var(--bc-soft); color: var(--bc-muted); }
.vp-table-wrap {
  background: var(--bc-paper); border-radius: var(--r-card); overflow-x: auto;
}
.vp-table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 640px; }
.vp-table th, .vp-table td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--bc-line); white-space: nowrap; }
.vp-table th { color: var(--bc-muted); font-weight: 500; font-size: 12px; }
.vp-table tr:last-child td { border-bottom: none; }
.vp-actions { display: flex; gap: 6px; }
form.inline { display: inline-block; margin: 0; }
.vp-admin-q {
  background: var(--bc-paper); border-radius: var(--r-card);
  padding: 14px 19px; margin-bottom: 12px;
}
.vp-admin-q h3 { margin: 0 0 10px; font-size: 15px; font-weight: 600; }
.vp-texts { margin: 8px 0 0; padding-left: 18px; font-size: 13px; }
.vp-texts li { margin-bottom: 6px; }
.vp-texts small { color: var(--bc-muted); }
.vp-actions-bar { margin-top: 16px; }

/* ---------- 后台图表 ---------- */
.vp-chart-wide {
  background: var(--bc-paper); border-radius: var(--r-card);
  padding: 16px 19px; margin-bottom: 12px;
}
.vp-charts {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px; margin-bottom: 16px;
}
.vp-chart-box { background: var(--bc-paper); border-radius: var(--r-card); padding: 14px 16px; }
.vp-chart-box h4 { margin: 0 0 6px; font-size: 13px; color: var(--bc-muted); font-weight: 500; }

/* ---------- 页脚 ---------- */
.vp-footer {
  border-top: 1px solid var(--bc-line); margin-top: 36px;
  padding: 26px 17px 46px;
}
.vp-footer-in { max-width: 780px; margin: 0 auto; text-align: center; }
.vp-footer-brand { font-size: 15px; font-weight: 650; display: flex; align-items: center; justify-content: center; gap: 6px; }
.vp-footer-privacy { color: var(--bc-muted); font-size: 12px; margin: 8px 0 12px; }
.vp-footer-links { display: flex; justify-content: center; gap: 16px; font-size: 12px; color: var(--bc-muted); }
.vp-footer-links a:hover { color: var(--bc-ink); }

/* ---------- select 美化（自绘箭头；系统弹层字号随控件字号） ---------- */
select.vp-input {
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23777c82' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 38px;
  font-size: 14px;
}

/* ---------- 自绘 radio / checkbox（v4 风格：accent 填充 + accent-ink 图形） ---------- */
input[type="radio"], input[type="checkbox"] {
  appearance: none; -webkit-appearance: none;
  width: 20px; height: 20px; min-height: 20px; flex: none; margin: 0;
  border: 2px solid color-mix(in srgb, var(--bc-ink) 30%, transparent);
  background: var(--bc-paper);
  display: inline-grid; place-items: center;
  cursor: pointer; padding: 0; vertical-align: middle;
  transition: background .15s ease, border-color .15s ease;
}
input[type="radio"] { border-radius: 50%; }
input[type="checkbox"] { border-radius: 6px; }
input[type="radio"]::before {
  content: ""; width: 9px; height: 9px; border-radius: 50%;
  background: var(--bc-accent-ink);
  transform: scale(0); transition: transform .15s ease;
}
input[type="checkbox"]::before {
  content: ""; width: 11px; height: 6px; margin-top: -2px;
  border-left: 2.5px solid var(--bc-accent-ink); border-bottom: 2.5px solid var(--bc-accent-ink);
  transform: rotate(-45deg) scale(0); transition: transform .15s ease;
}
input[type="radio"]:checked, input[type="checkbox"]:checked {
  background: var(--bc-accent); border-color: var(--bc-accent);
}
input[type="radio"]:checked::before { transform: scale(1); }
input[type="checkbox"]:checked::before { transform: rotate(-45deg) scale(1); }
input[type="radio"]:disabled, input[type="checkbox"]:disabled { opacity: .4; cursor: default; }

/* ---------- 标签勾选组 / 注册表 ---------- */
.vp-checks { display: flex; flex-wrap: wrap; gap: 8px; }
.vp-check {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--bc-soft); border: 1.5px solid transparent;
  border-radius: var(--r-ctrl); padding: 8px 12px; min-height: 44px;
  cursor: pointer; font-size: 13px;
}
.vp-check:hover { border-color: var(--bc-line); }
.vp-check:has(input:checked) { background: var(--bc-tint); border-color: var(--bc-accent); }
.vp-check input { margin: 0; }
.vp-slug { font-size: 11px; color: var(--bc-muted); }
.vp-reg-list { list-style: none; margin: 0 0 10px; padding: 0; }
.vp-reg-list li {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 0; border-bottom: 1px solid var(--bc-line); font-size: 13px;
}
.vp-reg-list li:last-child { border-bottom: none; }
.vp-reg-list li span { flex: 1; }

/* ---------- 级联自绘下拉（桌面） ---------- */
.dd { position: relative; margin-bottom: 10px; }
.dd-btn {
  width: 100%; min-height: 44px;
  background: var(--bc-soft); color: var(--bc-ink);
  border: 1.5px solid transparent; border-radius: var(--r-ctrl);
  padding: 10px 36px 10px 12px; font: inherit; font-size: 13px;
  display: flex; align-items: center; justify-content: space-between;
  cursor: pointer; text-align: left;
}
.dd-btn::after {
  content: ""; flex: none; width: 14px; height: 14px; margin-left: 8px;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23777c82' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: center;
}
.dd.open .dd-btn { border-color: var(--bc-accent); }
.dd-panel {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 30;
  background: var(--bc-paper); border-radius: var(--r-ctrl);
  box-shadow: var(--bc-shadow);
  padding: 6px; margin: 0; list-style: none;
  max-height: 268px; overflow: auto;
}
.dd-item { padding: 9px 12px; border-radius: var(--r-sm); cursor: pointer; font-size: 13px; }
.dd-item:hover { background: var(--bc-soft); }

/* ---------- 结果自动刷新条 / 英文编辑 ---------- */
.vp-refresh-bar { display: flex; justify-content: flex-end; margin: 0 0 8px; }
details.q-en summary { cursor: pointer; font-size: 12px; color: var(--bc-muted); margin-bottom: 8px; }
details.q-en[open] summary { margin-bottom: 10px; }

/* ---------- 窄屏：提交按钮通栏 ---------- */
@media (max-width: 520px) {
  .vp-title, .vp-home-title { font-size: 21px; }
  .vp-row-label { max-width: 38%; }
  .vp-main { padding: 14px 14px 48px; }
  .vp-actions { flex-direction: column; align-items: stretch; }
  .vp-actions .vp-btn { width: 100%; }
  .vp-msg { text-align: center; }
  .vp-footer { padding-bottom: 40px; }
}
