/* =========================================================
   班级竞选评分系统 —— 视觉：纸质选票 / 墨蓝 + 朱砂
   ========================================================= */
:root {
  --ink: #132033;
  --ink-2: #2b3a52;
  --muted: #6d7889;
  --paper: #f5efe3;
  --card: #fffdf7;
  --line: #e4d9c6;
  --line-soft: #efe7d8;
  --gold: #b58a3c;
  --gold-soft: #f2e6c9;
  --red: #ad2b33;
  --green: #2f6b58;
  --green-soft: #e3efe8;
  --shadow-sm: 0 1px 2px rgba(19, 32, 51, .06);
  --shadow-md: 0 20px 44px -30px rgba(19, 32, 51, .55);
  --shadow-lg: 0 40px 80px -40px rgba(19, 32, 51, .45);
  --r-lg: 20px;
  --r-md: 14px;
  --r-sm: 10px;
  --serif: "Source Han Serif SC", "Noto Serif SC", "Songti SC", "STSong", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background:
    radial-gradient(1200px 640px at 8% -12%, #fffaf0 0%, rgba(255, 250, 240, 0) 62%),
    radial-gradient(900px 520px at 108% 4%, #ece0c9 0%, rgba(236, 224, 201, 0) 58%),
    var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.paper-grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: .55;
  background-image: radial-gradient(rgba(19, 32, 51, .055) 1px, transparent 1px);
  background-size: 21px 21px;
  -webkit-mask-image: linear-gradient(#000 0%, rgba(0, 0, 0, .25) 70%, transparent 100%);
  mask-image: linear-gradient(#000 0%, rgba(0, 0, 0, .25) 70%, transparent 100%);
}

.app { position: relative; z-index: 1; min-height: 100%; }

/* ---------------- 通用 ---------------- */
h1, h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: .01em; margin: 0; }

p { margin: 0; }

.eyebrow {
  font-size: 11px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

.hidden { display: none !important; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-decoration: none;
  white-space: nowrap;
  appearance: none;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 11px 20px;
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: transform .15s ease, background .2s ease, box-shadow .2s ease, border-color .2s ease;
  background: transparent;
  color: var(--ink);
}
.btn:active { transform: translateY(1px) scale(.995); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--ink); color: #fff; box-shadow: 0 6px 14px -10px rgba(19, 32, 51, .8); }
.btn.primary:hover:not(:disabled) { background: #1d2f4a; }
.btn.ghost { border-color: var(--line); color: var(--ink-2); background: rgba(255, 253, 247, .6); }
.btn.ghost:hover:not(:disabled) { border-color: #cdbfa6; background: #fffdf7; }
.btn.danger { border-color: #e6c4c2; color: var(--red); background: #fff6f4; }
.btn.danger:hover:not(:disabled) { background: #fdeceb; }
.btn.sm { padding: 7px 14px; font-size: 13px; }
.btn.block { width: 100%; }
.btn[disabled] { pointer-events: none; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}

.seal {
  width: 46px; height: 46px;
  flex: 0 0 auto;
  display: grid; place-items: center;
  background: linear-gradient(160deg, #c0393f, var(--red) 55%, #8e2229);
  color: #fff;
  border-radius: 12px;
  font-family: var(--serif);
  font-size: 23px;
  line-height: 1;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .22), 0 8px 18px -12px rgba(173, 43, 51, .9);
  padding-bottom: 2px;
}
.seal.sm { width: 34px; height: 34px; font-size: 17px; border-radius: 9px; }

/* ---------------- 顶栏 ---------------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 14px max(20px, env(safe-area-inset-left)) 14px max(20px, env(safe-area-inset-right));
  background: rgba(245, 239, 227, .82);
  backdrop-filter: saturate(140%) blur(14px);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid rgba(228, 217, 198, .8);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand .txt { display: flex; flex-direction: column; min-width: 0; }
.brand strong { font-family: var(--serif); font-size: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand small { font-size: 11.5px; color: var(--muted); letter-spacing: .04em; }
.topbar .actions { display: flex; align-items: center; gap: 8px; }

/* ---------------- 登录 ---------------- */
.login-wrap {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 22px;
  padding: 40px 20px calc(40px + env(safe-area-inset-bottom));
}
.ballot {
  width: 100%; max-width: 440px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 34px 30px 28px;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
  animation: rise .5s cubic-bezier(.2, .8, .25, 1) both;
}
.ballot::before {
  content: "";
  position: absolute; inset: 9px;
  border: 1px dashed rgba(181, 138, 60, .32);
  border-radius: 17px;
  pointer-events: none;
}
.ballot > * { position: relative; }
.ballot h1 { font-size: 30px; margin: 18px 0 10px; line-height: 1.25; }
.ballot .lede { color: var(--ink-2); font-size: 14px; line-height: 1.75; }
.ballot form { margin-top: 26px; }
.field-label {
  display: block; font-size: 12px; font-weight: 600; color: var(--muted);
  letter-spacing: .08em; margin-bottom: 8px;
}
.input-wrap { position: relative; }
input[type="text"], input[type="password"], input[type="number"], textarea {
  width: 100%;
  font: inherit;
  font-size: 16px;
  color: var(--ink);
  background: #fffef9;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 14px 16px;
  outline: none;
  transition: border-color .18s ease, box-shadow .18s ease;
}
input::placeholder, textarea::placeholder { color: #a9a294; }
input:focus, textarea:focus {
  border-color: #c3a35f;
  box-shadow: 0 0 0 4px rgba(181, 138, 60, .13);
}
.ballot .btn.primary { margin-top: 14px; padding: 14px 20px; font-size: 15px; }

.suggest {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px);
  background: #fffef9;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  z-index: 40;
  max-height: 268px; overflow-y: auto;
  padding: 6px 0 14px;
}
.suggest button {
  display: flex; align-items: center; gap: 10px;
  width: 100%; text-align: left;
  padding: 11px 14px;
  background: none; border: 0; border-bottom: 1px solid var(--line-soft);
  font: inherit; font-size: 14.5px; color: var(--ink); cursor: pointer;
}
.suggest button:last-child { border-bottom: 0; }
.suggest button:hover, .suggest button.active { background: #f7f0e0; }
.suggest .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--gold); flex: 0 0 auto; }

.admin-link {
  display: inline-block; margin-top: 22px;
  font-size: 12.5px; color: var(--muted); text-decoration: none;
  border-bottom: 1px solid transparent; padding-bottom: 2px;
}
.admin-link:hover { color: var(--ink); border-color: var(--line); }
.footnote { font-size: 12px; color: var(--muted); text-align: center; max-width: 420px; line-height: 1.7; }

/* ---------------- 学生端 ---------------- */
.page { max-width: 1040px; margin: 0 auto; padding: 28px 20px 80px; }
.hero { padding: 10px 2px 26px; }
.hero .eyebrow { margin-bottom: 10px; }
.hero h1 { font-size: clamp(26px, 5vw, 36px); line-height: 1.25; }
.hero h1 em { font-style: normal; color: var(--red); }
.progress-line { display: flex; align-items: center; gap: 14px; margin-top: 20px; flex-wrap: wrap; }
.bar {
  flex: 1 1 180px; height: 6px; border-radius: 999px;
  background: #e8ddc9; overflow: hidden; max-width: 320px;
}
.bar i {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--gold), #d8b26a);
  border-radius: 999px;
  transition: width .45s cubic-bezier(.2, .8, .25, 1);
}
.progress-line span { font-size: 13px; color: var(--muted); }
.progress-line b { color: var(--ink); font-size: 15px; }

.banner {
  margin-top: 18px; padding: 12px 16px;
  border-radius: var(--r-md);
  background: #fdf1e0; border: 1px solid #ecd6b2;
  color: #7a5316; font-size: 13.5px; line-height: 1.6;
}

.cand-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(196px, 1fr));
  gap: 14px;
}
.cand {
  position: relative;
  display: flex; align-items: center; gap: 13px;
  padding: 16px 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
  box-shadow: var(--shadow-sm);
  transition: transform .18s ease, box-shadow .22s ease, border-color .2s ease;
  overflow: hidden;
}
.cand:hover { transform: translateY(-2px); box-shadow: 0 18px 30px -24px rgba(19, 32, 51, .65); border-color: #d3c2a4; }
.cand:active { transform: translateY(0); }
.cand .idx {
  position: absolute; top: 10px; right: 12px;
  font-size: 11px; color: #bdb2a0; font-variant-numeric: tabular-nums;
  letter-spacing: .08em;
}
.avatar {
  width: 44px; height: 44px; flex: 0 0 auto;
  border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(150deg, #f3e7cf, #e9d9b7);
  color: #6b5327;
  font-family: var(--serif);
  font-size: 19px;
  border: 1px solid #e2d2b1;
}
.avatar.lg { width: 56px; height: 56px; font-size: 24px; }
.cand .meta { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cname { font-family: var(--serif); font-size: 16.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status { font-size: 11.5px; color: var(--muted); display: flex; align-items: center; gap: 5px; }
.status::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: #cbbfa8; }
.cand.scored { border-color: #bcd7c8; background: linear-gradient(180deg, #fbfdf9, #f6fbf7); }
.cand.scored .status { color: var(--green); }
.cand.scored .status::before { background: var(--green); }
.cand.scored .avatar { background: linear-gradient(150deg, #dceee2, #cde6d8); color: #295c4c; border-color: #bcd7c8; }
.cand .check {
  position: absolute; top: 9px; right: 9px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  display: grid; place-items: center;
  font-size: 10px;
  line-height: 1;
  box-shadow: 0 3px 8px -4px rgba(47, 107, 88, .9);
}
.cand.scored .idx { display: none; }

/* ---------------- 打分面板 ---------------- */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(19, 32, 51, .38);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: fade .22s ease both;
}
.sheet {
  position: fixed; z-index: 61;
  left: 50%; bottom: 0;
  width: min(520px, 100%);
  transform: translateX(-50%);
  background: var(--card);
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 24px 24px 0 0;
  padding: 22px 24px calc(24px + env(safe-area-inset-bottom));
  box-shadow: 0 -30px 60px -40px rgba(19, 32, 51, .6);
  animation: sheetUp .32s cubic-bezier(.2, .85, .3, 1) both;
}
.sheet::before {
  content: ""; position: absolute; top: 8px; left: 50%; transform: translateX(-50%);
  width: 40px; height: 4px; border-radius: 999px; background: #dcd2bf;
}
.sheet-head { display: flex; align-items: center; gap: 14px; margin: 10px 0 18px; }
.sheet-head h2 { font-size: 21px; }
.sheet-head p { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.sheet-close {
  position: absolute; top: 14px; right: 14px;
  width: 32px; height: 32px; border-radius: 50%;
  border: 1px solid var(--line); background: #fffef9;
  color: var(--muted); font-size: 17px; line-height: 1; cursor: pointer;
}
.sheet-close:hover { color: var(--ink); }

.score-box {
  display: flex; align-items: baseline; justify-content: center; gap: 8px;
  padding: 4px 0 10px;
}
.score-box input {
  width: 168px; padding: 0;
  border: 0; background: transparent;
  font-family: var(--serif);
  font-size: 64px; font-weight: 600;
  text-align: center;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  line-height: 1.05;
}
.score-box input:focus { box-shadow: none; }
.score-box input::-webkit-outer-spin-button,
.score-box input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.score-box input[type=number] { -moz-appearance: textfield; }
.score-box span { font-family: var(--serif); font-size: 17px; color: var(--muted); }

input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 30px; background: transparent; margin: 4px 0 8px;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 6px; border-radius: 999px;
  background: linear-gradient(90deg, #e9dcc3, #dcc9a4);
}
input[type="range"]::-moz-range-track { height: 6px; border-radius: 999px; background: #e6d9c0; }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 24px; height: 24px; margin-top: -9px;
  border-radius: 50%;
  background: #fffdf7; border: 6px solid var(--ink);
  box-shadow: 0 4px 12px -6px rgba(19, 32, 51, .8);
  cursor: grab;
}
input[type="range"]::-moz-range-thumb {
  width: 14px; height: 14px; border-radius: 50%;
  background: #fffdf7; border: 6px solid var(--ink);
  box-shadow: 0 4px 12px -6px rgba(19, 32, 51, .8);
  cursor: grab;
}

.quick-row { display: flex; gap: 8px; justify-content: center; margin: 10px 0 6px; }
.quick-row button, .step-row button {
  border: 1px solid var(--line); background: #fffef9;
  color: var(--ink-2); font: inherit; font-size: 14px;
  border-radius: 999px; padding: 8px 0; cursor: pointer;
  min-width: 52px; transition: all .16s ease;
}
.quick-row button { flex: 1; }
.quick-row button:hover, .step-row button:hover { border-color: #c9b692; background: #fdf8ec; }
.quick-row button.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.step-row { display: flex; gap: 8px; margin: 8px 0 18px; }
.step-row button { flex: 1; padding: 9px 0; }
.sheet .btn.primary { padding: 15px; font-size: 15.5px; }

/* ---------------- 教师端 ---------------- */
.admin-shell { min-height: 100vh; }
.tabs {
  display: flex; gap: 4px;
  max-width: 1080px; margin: 0 auto; padding: 18px 20px 0;
  overflow-x: auto;
}
.tab {
  border: 0; background: transparent; font: inherit; font-size: 14px; font-weight: 600;
  color: var(--muted); padding: 10px 16px; border-radius: 999px; cursor: pointer;
  white-space: nowrap;
}
.tab:hover { color: var(--ink); }
.tab.on { background: var(--ink); color: #fff; }

.stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px; margin: 22px 0 20px;
}
.stat {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 16px 18px;
}
.stat .k { font-size: 11.5px; color: var(--muted); letter-spacing: .06em; }
.stat .v { font-family: var(--serif); font-size: 28px; font-weight: 600; margin-top: 6px; font-variant-numeric: tabular-nums; }
.stat .v small { font-size: 13px; color: var(--muted); font-family: var(--sans); font-weight: 500; }
.stat.hl .v { color: var(--red); }

.panel {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-sm);
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 18px 20px; border-bottom: 1px solid var(--line-soft); flex-wrap: wrap;
}
.panel-head h2 { font-size: 17px; }
.panel-head .hint { font-size: 12px; color: var(--muted); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 720px; }
thead th {
  text-align: left; font-size: 11.5px; font-weight: 600; color: var(--muted);
  letter-spacing: .07em; padding: 12px 16px; border-bottom: 1px solid var(--line);
  background: #fbf7ee; white-space: nowrap;
}
tbody td { padding: 14px 16px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
thead th:nth-child(2), tbody td:nth-child(2) { min-width: 148px; }
.who b { white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fdfaf2; }
.rank-badge {
  display: inline-grid; place-items: center;
  width: 26px; height: 26px; border-radius: 50%;
  font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums;
  background: #f1ecdf; color: #7e7361;
}
tr.top1 .rank-badge { background: linear-gradient(150deg, #e8c781, #c9a24f); color: #4a3510; }
tr.top2 .rank-badge { background: linear-gradient(150deg, #dcdcdc, #b9bec6); color: #3c4149; }
tr.top3 .rank-badge { background: linear-gradient(150deg, #e3c2a1, #c99a70); color: #4c3220; }
tr.top1 { background: linear-gradient(90deg, rgba(242, 230, 201, .55), rgba(255, 253, 247, 0)); }
.who { display: flex; align-items: center; gap: 11px; }
.who .avatar { width: 36px; height: 36px; font-size: 15px; }
.who b { font-family: var(--serif); font-size: 15.5px; font-weight: 600; }
.avg-cell { font-family: var(--serif); font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.avg-cell.none { color: #b6ad9c; font-size: 16px; }
.muted-cell { color: var(--muted); font-variant-numeric: tabular-nums; }
.tiny-bar { display: inline-flex; align-items: center; gap: 8px; }
.tiny-bar u { display: block; width: 54px; height: 4px; border-radius: 99px; background: #ece2cf; text-decoration: none; overflow: hidden; }
.tiny-bar u i { display: block; height: 100%; background: var(--gold); }

.drawer-backdrop { position: fixed; inset: 0; z-index: 70; background: rgba(19, 32, 51, .3); animation: fade .2s ease both; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 71;
  width: min(420px, 100%);
  background: var(--card); border-left: 1px solid var(--line);
  box-shadow: -30px 0 60px -40px rgba(19, 32, 51, .5);
  display: flex; flex-direction: column;
  animation: drawerIn .28s cubic-bezier(.2, .85, .3, 1) both;
}
.drawer-head { padding: 22px 22px 18px; border-bottom: 1px solid var(--line-soft); }
.drawer-head h2 { font-size: 20px; margin-top: 10px; }
.drawer-head .sub { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 8px 22px 22px; }
.drow {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--line-soft); font-size: 14px;
}
.drow:last-child { border-bottom: 0; }
.drow .n { color: var(--ink-2); }
.drow .s { font-family: var(--serif); font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; }
.drow.missing .n, .drow.missing .s { color: #b3aa98; }
.drow .s.pending { font-family: var(--sans); font-size: 12px; font-weight: 500; }

/* 名单 */
.roster-list {
  max-height: 62vh;
  overflow-y: auto;
  display: grid;
  grid-template-columns: 1fr;
}
@media (min-width: 900px) {
  .roster-list { grid-template-columns: 1fr 1fr; }
  .roster-item:nth-child(odd) { border-right: 1px solid var(--line-soft); }
}
.roster-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 20px; border-bottom: 1px solid var(--line-soft);
  cursor: pointer; user-select: none;
}
.roster-item:hover { background: #fdfaf2; }
.roster-item input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--ink); }
.roster-item .nm { flex: 1; font-size: 14.5px; }
.roster-item .tag { font-size: 11.5px; color: var(--muted); }
.roster-item .tag.given { color: var(--green); }

.form-grid { display: grid; gap: 16px; padding: 20px; }
.share-box {
  display: flex; align-items: center; gap: 12px;
  background: #fbf7ee;
  border: 1px dashed #d9c9a8;
  border-radius: var(--r-md);
  padding: 13px 16px;
}
.share-box code {
  flex: 1;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 15px;
  color: var(--ink);
  white-space: nowrap; overflow-x: auto;
}
.help code {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  background: #f4ecdc; padding: 1px 5px; border-radius: 4px; font-size: 11.5px;
}
.linkbtn {
  border: 0; background: none; padding: 0 2px;
  font: inherit; font-size: 12px; color: var(--ink-2);
  text-decoration: underline; text-underline-offset: 2px;
  cursor: pointer;
}
.linkbtn:hover { color: var(--red); }.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
label.switch { display: flex; align-items: center; gap: 10px; font-size: 14px; cursor: pointer; }
label.switch input { width: 18px; height: 18px; accent-color: var(--ink); }
.hr { height: 1px; background: var(--line-soft); margin: 4px 0; }
textarea { resize: vertical; min-height: 120px; line-height: 1.7; font-size: 14px; }
.help { font-size: 12px; color: var(--muted); line-height: 1.7; }

@media (max-width: 760px) {
  thead th:first-child, tbody td:first-child {
    position: sticky; left: 0; z-index: 1;
    background: var(--card);
  }
  thead th:first-child { background: #fbf7ee; }
  tbody tr.top1 td:first-child { background: linear-gradient(90deg, #faf3e2, #fdfbf4); }
}

/* 提示 */
.toast-root {
  position: fixed; left: 50%; bottom: calc(28px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 90;
  display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none;
}
.toast {
  background: var(--ink); color: #fff;
  padding: 11px 20px; border-radius: 999px;
  font-size: 13.5px; box-shadow: 0 16px 30px -18px rgba(19, 32, 51, .9);
  animation: toastIn .26s cubic-bezier(.2, .85, .3, 1) both;
  max-width: 86vw; text-align: center;
}
.toast.err { background: var(--red); }

.empty { padding: 46px 20px; text-align: center; color: var(--muted); font-size: 13.5px; line-height: 1.8; }

/* 密码门 */
.gate { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.gate .card { width: 100%; max-width: 380px; padding: 30px 28px; }
.gate h1 { font-size: 22px; margin: 16px 0 8px; }
.gate p { font-size: 13px; color: var(--muted); line-height: 1.7; }
.gate form { margin-top: 22px; display: grid; gap: 12px; }

@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes sheetUp { from { opacity: 0; transform: translate(-50%, 26px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes drawerIn { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px) scale(.97); } to { opacity: 1; transform: none; } }

/* ---------------- 响应式 ---------------- */
@media (max-width: 640px) {
  .page { padding: 20px 16px 70px; }
  .cand-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .cand { padding: 13px 12px; gap: 10px; }
  .cand .avatar { width: 38px; height: 38px; font-size: 16px; }
  .cname { font-size: 15px; }
  .cand .idx { display: none; }
  .ballot { padding: 28px 22px 24px; }
  .ballot h1 { font-size: 26px; }
  .score-box input { font-size: 56px; width: 150px; }
  .row-2 { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat .v { font-size: 23px; }
  .topbar { padding-left: 16px; padding-right: 16px; }
  .brand small { display: none; }
}

@media (min-width: 720px) {
  .sheet {
    bottom: auto; top: 50%;
    transform: translate(-50%, -50%);
    border-radius: 24px;
    border-bottom: 1px solid var(--line);
    animation: popIn .3s cubic-bezier(.2, .85, .3, 1) both;
  }
  .sheet::before { display: none; }
}
@keyframes popIn {
  from { opacity: 0; transform: translate(-50%, -46%) scale(.97); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

@media print {
  .topbar, .tabs, .btn, .drawer, .drawer-backdrop { display: none !important; }
  body { background: #fff; }
  .panel { border: 0; box-shadow: none; }
}
