:root {
  --bg: #f7f7fb;
  --card: #ffffff;
  --ink: #1c1c28;
  --muted: #6b6b7b;
  --accent: #5b5bd6;
  --accent-soft: #ecebfd;
  --border: #e6e6ef;
  --radius: 16px;
  --shadow: 0 1px 3px rgba(28,28,40,.06), 0 8px 24px rgba(28,28,40,.07);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { overflow-x: hidden; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
}

header {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 55%, #db2777 100%);
  color: #fff;
  padding: 16px 20px 56px;
  text-align: center;
  position: relative;
}
.header-logo {
  width: 100px; max-width: 30vw; display: block;
  filter: brightness(0) invert(1); /* wordmark ships dark; render white on the gradient */
}
.header-badge {
  position: absolute; top: 10px; right: 10px;
  background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.35);
  border-radius: 999px; padding: 2px 9px; font-size: .6rem; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase;
}
.header-title {
  display: flex; align-items: center; justify-content: center; gap: 12px;
}
.header-title h1 { font-size: 1.05rem; font-weight: 700; letter-spacing: -0.01em; }
header p { max-width: 560px; margin: 10px auto 0; font-size: .92rem; opacity: .92; }
/* keep the title row clear of the corner pill on narrow screens */
@media (max-width: 560px) { header { padding-top: 36px; } }

main { max-width: 860px; margin: -40px auto 0; padding: 0 24px 70px; position: relative; z-index: 2; }
.panel {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  margin-bottom: 18px;
}
.panel h2 { font-size: 1.05rem; font-weight: 700; letter-spacing: -0.01em; margin-bottom: 4px; }
label { display: block; font-size: .8rem; font-weight: 700; color: var(--muted); margin: 12px 0 4px; }
input[type=text], textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: .95rem;
  font-family: inherit;
  line-height: 1.5;
  background: #fff;
  outline: none;
  transition: border-color .15s;
  resize: vertical;
}
input[type=text]:focus, textarea:focus { border-color: var(--accent); }
button {
  font: inherit;
  border: none;
  border-radius: 10px;
  padding: 10px 18px;
  cursor: pointer;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  margin-top: 14px;
  transition: all .13s;
}
button:hover { filter: brightness(1.08); }
button:disabled { opacity: .6; cursor: default; filter: none; }
.banner {
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 18px;
  font-size: .9rem;
  display: none;
}
.banner.info { display: block; background: var(--accent-soft); color: var(--accent); }
.banner.error { display: block; background: #fdecec; color: #b3261e; }
.list-head { display: flex; align-items: baseline; justify-content: space-between; margin: 26px 0 12px; }
.list-head h2 { font-size: 1.15rem; font-weight: 700; letter-spacing: -0.01em; }
.list-head button {
  margin: 0; padding: 6px 14px; font-size: .85rem; font-weight: 600;
  background: #fff; color: var(--ink); border: 1.5px solid var(--border);
}
.list-head button:hover { border-color: var(--accent); color: var(--accent); filter: none; }
.question {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 20px;
  margin-bottom: 12px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
}
.votebox { text-align: center; min-width: 76px; }
.votebox .count { font-size: 1.6rem; font-weight: 700; color: var(--accent); line-height: 1.1; }
.votebox .unit { font-size: .7rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.votebox button { margin-top: 8px; padding: 7px 14px; font-size: .85rem; width: 100%; }
.votebox button.voted { background: #e0f4ea; color: #047857; }
.votebox button.voted:not(:disabled):hover { background: #fdecec; color: #b3261e; filter: none; }
.question h3 { font-size: 1.05rem; font-weight: 700; letter-spacing: -0.01em; margin-bottom: 4px; line-height: 1.4; overflow-wrap: anywhere; }
.order {
  display: inline-block; min-width: 1.6em; margin-right: 8px;
  background: var(--accent-soft); color: var(--accent);
  border-radius: 8px; padding: 1px 6px; text-align: center;
  font-size: .85rem; font-weight: 700;
}
.editbtn {
  margin: 0 0 0 8px; padding: 2px 8px; font-size: .72rem; font-weight: 700;
  background: var(--accent-soft); color: var(--accent); border-radius: 6px; vertical-align: middle;
}
.editform button { margin-right: 8px; }
.editform .cancel { background: #fff; color: var(--muted); border: 1.5px solid var(--border); }
.editform .cancel:hover { border-color: var(--accent); color: var(--accent); filter: none; }
.meta { font-size: .82rem; color: var(--muted); }
.note { margin: 8px 0 0; font-size: .9rem; color: #3c3c4c; overflow-wrap: anywhere; }
.voters { margin-top: 8px; font-size: .8rem; color: var(--muted); }
.voters span {
  background: var(--accent-soft); color: var(--accent); font-weight: 600;
  border-radius: 999px; padding: 2px 10px; margin: 0 4px 4px 0; display: inline-block;
}
.empty { text-align: center; color: var(--muted); padding: 60px 0; font-size: 1.05rem; }
footer { text-align: center; color: var(--muted); font-size: .85rem; padding: 0 24px 40px; }
@media (max-width: 560px) {
  .question { flex-direction: column-reverse; }
  .votebox { display: flex; align-items: center; gap: 12px; min-width: 0; }
  .votebox button { margin-top: 0; width: auto; }
}
