:root {
  /* ธีม "นกอยู่ข้างพี่ตา" — น้ำเงินกรมท่า + ทอง + ชมพู (ตามโลโก้) */
  --accent: #ffc61a;          /* ทอง — สีเน้นหลัก */
  --accent-ink: #0a1044;      /* ตัวอักษรบนพื้นสีทอง */
  --pink: #f06db4;            /* ชมพู — สีเน้นรอง */
  --bg: #0a1044;              /* กรมท่าเข้ม */
  --bg-soft: #141c66;
  --card: #1d2678;
  --line: #3a4499;
  --text: #f4f2ff;
  --text-dim: #a9b0e0;
  --blue: #3f8ee6;
  --red: #ff4d63;
  --ok: #34d17a;
  --warn: #ffb020;
  --danger: #ff5a6a;
  --radius: 18px;
  --font: "Noto Sans Thai", "IBM Plex Sans Thai", -apple-system, BlinkMacSystemFont,
    "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

button {
  font-family: inherit;
  cursor: pointer;
}

.conn-banner {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 9999;
  background: var(--warn);
  color: #1a1200;
  font-weight: 700;
  text-align: center;
  padding: 10px 16px;
  letter-spacing: 0.02em;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}
.conn-banner[hidden] { display: none; }

/* แถบผลโหวต (ใช้ทั้ง display และ control) */
.bars { display: flex; flex-direction: column; gap: 14px; width: 100%; }
.bar-row { display: flex; flex-direction: column; gap: 6px; }
.bar-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-weight: 700;
}
.bar-track {
  position: relative;
  height: var(--bar-h, 46px);
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  overflow: hidden;
}
.bar-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  border-radius: 999px;
  transition: width 420ms cubic-bezier(0.22, 1, 0.36, 1);
}
.bar-pct { font-variant-numeric: tabular-nums; }
.bar-count { color: var(--text-dim); font-size: 0.8em; font-weight: 600; }
.bar-row.is-leader .bar-fill { box-shadow: 0 0 24px 2px currentColor; filter: brightness(1.08); }
.bar-row.is-leader .bar-pct { font-weight: 900; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--line);
  font-weight: 600;
  font-size: 0.9rem;
}
.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--text-dim);
}
.dot.on { background: var(--ok); box-shadow: 0 0 10px var(--ok); }
.dot.off { background: var(--danger); }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap;
}
