:root {
  --bg: #eef2f7;
  --card: #ffffff;
  --fg: #16233a;
  --fg-2: #4a5b74;
  --muted: #8194ab;
  --line: #dfe6ef;
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --yes: #1f8a54;
  --no: #b4432f;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(23, 43, 77, 0.10);
}

* { box-sizing: border-box; }

/**
 * hidden 属性必须真的隐藏。
 * 不加这条时，元素自身若写了 display（如 .actions 的 display:flex），会覆盖 hidden 的
 * UA 样式 display:none——表现就是"投完票了投票按钮还挂在屏幕上"（只是变灰）。
 */
[hidden] { display: none !important; }

body {
  margin: 0;
  padding: 24px 16px 48px;
  background:
    radial-gradient(1100px 420px at 50% -140px, #dfe9fb 0%, rgba(223, 233, 251, 0) 70%),
    var(--bg);
  color: var(--fg);
  font: 16px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  min-height: 100dvh;
  -webkit-text-size-adjust: 100%;
}

.wrap { max-width: 720px; margin: 0 auto; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 26px 22px;
}

h1 {
  margin: 0 0 6px;
  font-size: 24px;
  letter-spacing: 0.5px;
}

.subtitle {
  margin: 0 0 18px;
  color: var(--fg-2);
  font-size: 15px;
}

.lines {
  margin: 0 0 20px;
  padding: 16px 18px;
  background: #f5f8fd;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--fg-2);
  list-style: none;
}

.lines li { padding: 3px 0; }

.lines li::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 10px;
  border-radius: 50%;
  background: var(--brand);
  vertical-align: 2px;
}

.question {
  margin: 0 0 18px;
  font-size: 20px;
  font-weight: 600;
  line-height: 1.5;
}

.actions { display: flex; flex-direction: column; gap: 12px; }

button.choice {
  appearance: none;
  border: 2px solid var(--line);
  background: #fff;
  color: var(--fg);
  font: inherit;
  font-size: 19px;
  font-weight: 600;
  padding: 16px 18px;
  border-radius: 14px;
  cursor: pointer;
  transition: transform 0.06s ease, border-color 0.15s ease, background 0.15s ease;
}

button.choice:active { transform: scale(0.99); }
button.choice:hover { border-color: var(--brand); background: #f7faff; }
button.choice:disabled { cursor: not-allowed; opacity: 0.55; }
button.choice.yes:hover { border-color: var(--yes); background: #f3fbf6; }
button.choice.no:hover { border-color: var(--no); background: #fdf5f3; }

.code-row { margin: 0 0 16px; }
.code-row label { display: block; font-size: 14px; color: var(--fg-2); margin-bottom: 6px; }
.code-row input {
  width: 100%;
  padding: 12px 14px;
  font: inherit;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}
.code-row input:focus { outline: 2px solid #c7dbff; border-color: var(--brand); }

.hint { color: var(--muted); font-size: 13px; margin: 14px 0 0; }

.msg { margin: 16px 0 0; padding: 12px 14px; border-radius: 10px; font-size: 15px; }
.msg.error { background: #fdf0ee; color: #8f3222; border: 1px solid #f5d5cf; }
.msg.ok { background: #f1faf4; color: #1c6b45; border: 1px solid #cfe9db; }

.result { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.result h2 { margin: 0 0 14px; font-size: 16px; color: var(--fg-2); font-weight: 600; }
.bar-row { margin-bottom: 14px; }
.bar-head { display: flex; justify-content: space-between; font-size: 15px; margin-bottom: 6px; }
.bar-head b { font-weight: 600; }
.bar-track { height: 12px; border-radius: 999px; background: #edf1f7; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; transition: width 0.4s ease; }
.bar-fill.yes { background: linear-gradient(90deg, #34a06a, var(--yes)); }
.bar-fill.no { background: linear-gradient(90deg, #d0654b, var(--no)); }
.bar-fill.plain { background: var(--brand); }
.result .total { color: var(--muted); font-size: 13px; }

/* 已投票的设备：随时刷新看最新统计 */
.refresh-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
  flex-wrap: wrap;
}

.refresh-row .btn { padding: 10px 16px; }

.refresh-at { color: var(--muted); font-size: 13px; }

.admin h1 { font-size: 20px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--fg-2); margin-bottom: 5px; }
.field input[type="text"], .field textarea, .field select {
  width: 100%;
  padding: 10px 12px;
  font: inherit;
  font-size: 15px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}
.field textarea { min-height: 84px; resize: vertical; }
.row2 { display: flex; gap: 12px; }
.row2 > .field { flex: 1; }
button.btn {
  appearance: none;
  border: 0;
  background: var(--brand);
  color: #fff;
  font: inherit;
  font-weight: 600;
  padding: 11px 18px;
  border-radius: 10px;
  cursor: pointer;
}
button.btn:hover { background: var(--brand-dark); }
button.btn.ghost { background: #eef2f8; color: var(--fg); }
button.btn.danger { background: #b4432f; }
table.votes { width: 100%; border-collapse: collapse; font-size: 13px; }
table.votes th, table.votes td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); }
table.votes th { color: var(--muted); font-weight: 600; }

@media (max-width: 480px) {
  body { padding: 16px 12px 40px; }
  .card { padding: 20px 16px; }
  h1 { font-size: 21px; }
  .question { font-size: 18px; }
  button.choice { font-size: 17px; padding: 14px; }
  .row2 { flex-direction: column; gap: 0; }
}

/* ============================ 网站备案信息（投票页底部） ============================ *
 * 法定展示要求：ICP 备案号（链接工信部）+ 公安联网备案号（连同图标）。
 * 值来自 config.json，留空时 footer 带 hidden（不留空条）。 */
.site-beian {
  margin: 14px auto 0; padding-top: 12px; border-top: 1px solid rgba(15, 23, 42, .1);
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center;
  font-size: 12px; color: #64748b; max-width: 100%; text-align: center;
}
.site-beian a { color: #64748b; text-decoration: none; }
.site-beian a:hover { color: #2563eb; text-decoration: underline; }
.site-beian img { vertical-align: -2px; margin-right: 4px; }
.site-beian .beian-sep { color: rgba(100, 116, 139, .55); margin: 0 2px; }
@media (max-width: 420px) {
  .site-beian { font-size: 11.5px; }
}
