/*! vote：应用自身样式（布局/表格/画布尺寸等），来自原版 taez/tools/vote/index.html 的 <style>。
 * metro.css 负责外层外观（面板、按钮、页头），本文件只补应用结构与几何，勿随意删减。 */
:root{
  --bg1:#1a1a2e; --bg2:#16213e; --card:#223; --card-bg:#ffffff;
  --txt:#111; --sub:#666; --accent:#ff6b6b; --shadow:rgba(0,0,0,.25);
}
*{box-sizing:border-box; margin:0; padding:0;}
html,body{height:100%;}
body{
  font-family:"Microsoft YaHei","PingFang SC",system-ui,-apple-system,sans-serif;
  background:linear-gradient(135deg,var(--bg1),var(--bg2));
  color:#fff; min-height:100vh; display:flex; flex-direction:column;
  -webkit-user-select:none; user-select:none;
}

/* ============ 顶部标题栏 ============ */
header{
  display:flex; align-items:center; gap:16px; flex-wrap:wrap;
  padding:14px 28px; background:rgba(0,0,0,.18); backdrop-filter:blur(6px);
  box-shadow:0 2px 14px rgba(0,0,0,.3);
}
header h1{font-size:34px; font-weight:800; letter-spacing:2px; flex:1; min-width:240px;}
.head-actions{display:flex; gap:10px; align-items:center; flex-wrap:wrap;}
#tally{font-size:22px; font-weight:700; background:var(--accent); color:#fff;
  padding:8px 18px; box-shadow:0 4px 12px rgba(0,0,0,.25);}
/* 缩放控制组 */
.zoom-group{display:flex; align-items:stretch; gap:0; overflow:hidden; border:1px solid #ffffff55;}
.zoom-group .btn{border:none; border-radius:0;}
.zoom-group .btn.zoom-btn{padding:8px 14px; font-size:18px; line-height:1; background:#ffffff22;}
.zoom-group .btn.zoom-btn:hover{background:#ffffff40;}
#zoomPct{display:flex; align-items:center; justify-content:center; min-width:60px;
  font-size:14px; font-weight:700; color:#fff; background:#ffffff22; padding:0 6px;}
/* 页面缩放容器（transform-origin 保持从顶部中心缩放） */
#app{width:100%; transform-origin:top center;}

/* ============ 按钮 ============ */
button{cursor:pointer; border:none; font-family:inherit; transition:.18s; outline:none;}
button:active{transform:scale(.95);}
.btn{
  font-size:16px; font-weight:700; padding:9px 18px; border-radius:0;
  background:#ffffff22; color:#fff; border:1px solid #ffffff55;
}
.btn:hover{background:#ffffff40;}
.btn.primary{background:var(--accent); border:none; box-shadow:0 4px 12px rgba(0,0,0,.3);}
.btn.primary:hover{filter:brightness(1.08);}
.btn.ghost{background:transparent; border:1px solid #ffffff55; color:#fff;}
.btn.danger{background:#e03131; border:none;}
.btn.small{padding:5px 12px; font-size:14px; border-radius:0;}

/* ============ 设置抽屉 ============ */
#backdrop{position:fixed; inset:0; background:rgba(0,0,0,.5); opacity:0; pointer-events:none; transition:.3s; z-index:50;}
#backdrop.show{opacity:1; pointer-events:auto;}
#panel{
  position:fixed; top:0; right:0; bottom:0; width:min(560px,94vw);
  background:#fff; color:var(--txt); transform:translateX(105%); transition:.35s;
  overflow-y:auto; z-index:60; box-shadow:-8px 0 30px rgba(0,0,0,.4); padding:24px;
}
#panel.open{transform:none;}
#panel h2{font-size:24px; margin-bottom:18px; display:flex; justify-content:space-between; align-items:center;}
#panel h3{font-size:16px; margin:20px 0 8px; color:var(--sub); text-transform:uppercase; letter-spacing:1px;}
.fld{margin-bottom:14px;}
.fld label{display:block; font-weight:700; margin-bottom:6px; font-size:14px;}
.fld input[type=text],.fld input[type=number],.fld textarea{
  width:100%; padding:10px 12px; font-size:15px; border:1px solid #ccc; border-radius:0; font-family:inherit;
}
.fld input:focus,.fld textarea:focus{border-color:var(--accent); outline:none;}
.fld textarea{min-height:130px; resize:vertical;}
.hint{font-size:12px; color:#999; margin-top:5px;}
.chips{display:flex; gap:8px; flex-wrap:wrap;}
.chip{padding:8px 14px; border-radius:0; background:#eee; cursor:pointer; font-weight:700; border:2px solid transparent;}
.chip.on{background:var(--accent); color:#fff; border-color:var(--accent);}

/* 配色预设 */
.swatches{display:flex; gap:10px; flex-wrap:wrap; align-items:center;}
.sw{width:38px; height:38px; cursor:pointer; border:3px solid transparent;
   display:flex; align-items:center; justify-content:center; color:#fff; box-shadow:0 2px 6px rgba(0,0,0,.2);}
.sw.on{border-color:#333; transform:scale(1.12);}
.color-row{display:flex; gap:14px; align-items:flex-end; flex-wrap:wrap;}
.color-fld{flex:1; min-width:120px;}
.color-fld label{display:block; font-size:12px; color:#888; margin-bottom:4px;}
.color-fld input[type=color]{width:100%; height:38px; border:1px solid #ccc; border-radius:0; background:none; cursor:pointer; padding:2px;}
.btn-row{display:flex; gap:10px; margin-top:22px; flex-wrap:wrap;}
.btn-row .btn{flex:1;}
.panel-btns{position:sticky; bottom:0; background:#fff; padding-top:10px;}

/* ============ 主投票区 ============ */
main{flex:1; padding:30px 28px 40px;}
.grid{
  display:grid; gap:22px; grid-template-columns:repeat(auto-fill,minmax(210px,1fr));
}
.target{
  position:relative; background:var(--card-bg); color:var(--txt); border-radius:0;
  padding:22px 16px 12px; cursor:pointer; text-align:center;
  box-shadow:0 6px 20px var(--shadow); overflow:hidden;
  animation:pop .35s ease;
  display:flex; flex-direction:column;
}
.target:hover{transform:translateY(-4px); box-shadow:0 12px 28px var(--shadow);}
.target:active{transform:scale(.96);}
.target .idx{
  position:absolute; top:10px; left:12px; font-size:14px; color:#bbb; font-weight:700;
}
.target .name{
  font-size:22px; font-weight:800; word-break:break-word; line-height:1.3; margin-bottom:6px;
}
.target .count{
  font-size:60px; font-weight:900; line-height:1;
  background:linear-gradient(135deg,var(--accent),color-mix(in srgb,var(--accent) 60%,#000));
  -webkit-background-clip:text; background-clip:text; color:transparent;
  text-shadow:none;
}
.target .unit{font-size:16px; color:var(--sub);}
.target .num{flex:1;}
/* 卡片上的减票 / 改票 小按钮 */
.card-act{display:flex; justify-content:center; gap:6px; margin-top:12px; opacity:.15; transition:.18s;}
.target:hover .card-act{opacity:1;}
.card-act .act{
  cursor:pointer; border:1px solid #ccc; background:transparent; color:var(--sub);
  font-family:inherit; font-size:13px; font-weight:700; padding:5px 12px; border-radius:0; line-height:1;
}
.target:hover .card-act .act{color:var(--txt); border-color:#bbb;}
.card-act .act:hover{background:#eee;}
.card-act .act:active{transform:scale(.92);}
.card-act .act.sub{min-width:34px;}
@keyframes pop{0%{transform:scale(.9);opacity:0;}100%{transform:scale(1);opacity:1;}}

/* 票数飞升动画 */
.fly{
  position:fixed; z-index:90; pointer-events:none; font-weight:900; font-size:30px;
  animation:flyup 1s ease forwards; color:var(--accent);
}
@keyframes flyup{0%{opacity:1; transform:translateY(0) scale(1);}100%{opacity:0; transform:translateY(-130px) scale(1.5);}}

.empty{
  text-align:center; padding:90px 20px; color:#ffffffaa; font-size:22px; border:2px dashed #ffffff55;
  border-radius:0;
}

footer{padding:10px; text-align:center; color:#ffffff66; font-size:13px;}

@media (max-width:640px){
  header h1{font-size:24px;}
  .target .count{font-size:44px;}
}
