:root {
  --blue: #00338d;
  --blue-2: #005eb8;
  --ink: #0f1b33;
  --muted: #6b7690;
  --line: #e3e8f2;
  --soft: #f4f7fc;
  --ok: #0a8f5b;
  --bad: #c0392b;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: #fff; color: var(--ink); }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; line-height: 1.4; }
[hidden] { display: none !important; }

.wrap { max-width: 640px; margin: 0 auto; padding: 24px 20px 48px; }
h1 { font-size: 1.5rem; margin: 0 0 4px; color: var(--blue); }
.muted { color: var(--muted); }
.bar-top { height: 6px; background: linear-gradient(90deg, #00338d, #005eb8, #0091da, #483698); }

button, input, textarea { font: inherit; }
button {
  border: 0; border-radius: 12px; padding: 12px 18px; cursor: pointer;
  background: var(--blue); color: #fff; font-weight: 600; transition: transform .08s, opacity .2s;
}
button:hover { opacity: .92; }
button:active { transform: scale(.98); }
button.ghost { background: #fff; color: var(--blue); border: 1.5px solid var(--line); }
button.danger { background: #fff; color: var(--bad); border: 1.5px solid var(--line); }
button:disabled { opacity: .4; cursor: default; }

input[type=text], input[type=email], input[type=password], textarea {
  width: 100%; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink);
}
input:focus, textarea:focus { outline: 2px solid var(--blue-2); outline-offset: 1px; border-color: transparent; }
textarea { resize: vertical; min-height: 96px; }
label { display: block; font-weight: 600; font-size: .9rem; margin: 14px 0 6px; }

/* ---------- voter ---------- */
.center { min-height: 60vh; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; gap: 10px; }
.pulse { width: 14px; height: 14px; border-radius: 50%; background: var(--blue-2); animation: pulse 1.4s infinite; }
@keyframes pulse { 0%,100% { transform: scale(.7); opacity: .5; } 50% { transform: scale(1.2); opacity: 1; } }
.q-text { font-size: 1.6rem; font-weight: 700; margin: 8px 0 22px; }
.opt {
  display: block; width: 100%; text-align: left; margin-bottom: 12px; padding: 18px 18px;
  background: #fff; color: var(--ink); border: 2px solid var(--line); border-radius: 14px; font-size: 1.1rem; font-weight: 500;
}
.opt:hover { border-color: var(--blue-2); opacity: 1; }
.opt.picked { background: var(--blue); color: #fff; border-color: var(--blue); }
.check { font-size: 3rem; color: var(--ok); }

/* ---------- admin ---------- */
.admin { max-width: 880px; margin: 0 auto; padding: 24px 20px 120px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row.between { justify-content: space-between; }
.card { border: 1.5px solid var(--line); border-radius: 16px; padding: 16px 18px; margin: 12px 0; background: #fff; }
.card h3 { margin: 0 0 2px; }
.spacer { flex: 1; }

/* ---------- live screen ---------- */
.live { min-height: 100vh; padding: 40px 6vw 140px; }
.live .title { color: var(--muted); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; font-size: .9rem; }
.live .q { font-size: clamp(1.8rem, 4vw, 3.2rem); font-weight: 800; color: var(--blue); margin: 10px 0 34px; line-height: 1.15; }
.res { margin-bottom: 18px; }
.res .label { display: flex; justify-content: space-between; font-size: clamp(1.1rem, 2vw, 1.6rem); font-weight: 600; margin-bottom: 6px; gap: 16px; }
.res .track { height: clamp(26px, 4vh, 44px); background: var(--soft); border-radius: 10px; overflow: hidden; }
.res .fill { height: 100%; width: 0; border-radius: 10px; transition: width .6s cubic-bezier(.2,.8,.2,1); }
.badge { display: inline-block; padding: 4px 12px; border-radius: 999px; font-size: .85rem; font-weight: 700; }
.badge.open { background: #e5f6ee; color: var(--ok); }
.badge.closed { background: #fdeceb; color: var(--bad); }
.qr-screen { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; min-height: 70vh; gap: 18px; }
.qr-screen h2 { font-size: clamp(1.8rem, 4vw, 3rem); margin: 0; color: var(--blue); }
.qr-screen svg, .qr-screen img { width: min(60vh, 80vw); height: auto; }
.qr-url { font-size: 1.2rem; color: var(--muted); word-break: break-all; }
.controls {
  position: fixed; left: 0; right: 0; bottom: 0; padding: 14px 20px; background: rgba(255,255,255,.96);
  border-top: 1.5px solid var(--line); display: flex; gap: 10px; flex-wrap: wrap; align-items: center; justify-content: center;
  opacity: .25; transition: opacity .2s;
}
.controls:hover, .controls:focus-within { opacity: 1; }
.err { color: var(--bad); margin-top: 10px; min-height: 1.2em; }
