:root {
  --primary: #3370ff;
  --primary-soft: #e1eaff;
  --danger: #f54a45;
  --text: #1f2329;
  --muted: #8f959e;
  --border: #dee0e3;
  --bg: #f5f6f7;
  --card: #ffffff;
  --bar: #eff0f1;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --primary: #4c88ff;
    --primary-soft: #1f2b47;
    --danger: #f76964;
    --text: #ebebeb;
    --muted: #8a8f99;
    --border: #373c43;
    --bg: #1a1a1a;
    --card: #232324;
    --bar: #2e3033;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
}
a { color: inherit; text-decoration: none; }

.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}
.brand { font-weight: 600; font-size: 17px; }
.me { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }

.container { max-width: 720px; margin: 0 auto; padding: 16px; }
.center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 12px;
}
a.card { display: block; }
a.card:hover { border-color: var(--primary); }

.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.spread { justify-content: space-between; }
h1 { font-size: 20px; margin: 0 0 4px; }
h2 { font-size: 16px; margin: 0 0 4px; }
.desc { white-space: pre-wrap; margin: 8px 0 0; }

.chip { font-size: 12px; padding: 1px 8px; border-radius: 10px; background: var(--primary-soft); color: var(--primary); }
.chip.done { background: var(--bar); color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 7px 16px; border-radius: 6px; font-size: 14px;
  border: 1px solid var(--border); background: var(--card); color: var(--text); cursor: pointer;
  white-space: nowrap; flex: none;
}
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.danger { color: var(--danger); }
.btn.block { width: 100%; }

/* 投票选项：背景条表示比例 */
.option {
  position: relative; overflow: hidden;
  width: 100%; text-align: left;
  padding: 12px 14px; margin-bottom: 10px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--card); color: var(--text); font-size: 15px;
  cursor: pointer;
}
.option:disabled { cursor: default; }
.option.mine { border-color: var(--primary); }
.option .fill { position: absolute; inset: 0 auto 0 0; background: var(--primary-soft); transition: width .3s; }
.option .content { position: relative; display: flex; justify-content: space-between; gap: 8px; }
.option .voters { position: relative; margin-top: 6px; display: flex; flex-wrap: wrap; gap: 4px 10px; }
.voter { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); }

.avatar {
  width: 22px; height: 22px; border-radius: 50%; object-fit: cover; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--primary); color: #fff; font-size: 11px;
}
.voter .avatar { width: 18px; height: 18px; font-size: 10px; }

label { display: block; font-weight: 500; margin: 14px 0 6px; }
input, textarea {
  width: 100%; padding: 8px 10px; font: inherit; color: var(--text);
  background: var(--card); border: 1px solid var(--border); border-radius: 6px;
}
input:focus, textarea:focus { outline: none; border-color: var(--primary); }
.option-input { display: flex; gap: 6px; margin-bottom: 6px; }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }

.toast {
  position: fixed; left: 50%; bottom: 32px; transform: translateX(-50%);
  max-width: calc(100% - 32px);
  padding: 8px 16px; border-radius: 6px;
  background: rgba(0, 0, 0, .78); color: #fff; font-size: 14px;
}
