/* Plum and peach */
:root {
  --text: #261b2e;
  --muted: #7a6b85;
  --accent: #7b3fa0;
  --on-accent: #ffffff;
  --accent-soft: #efe3f6;
  --border: #e2d8e8;
  --surface: #ffffff;
  --background: #f8f5f9;
  --success: #e3f1e6;
  --error: #f9e0e0;
  --veto: #b3261e;
  --approve: #3a7d44;
  --star: #ff8a3d;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --text: #efe7f3;
    --muted: #a596b0;
    --accent: #c08ae0;
    --on-accent: #1b1020;
    --accent-soft: #33243f;
    --border: #3a2e44;
    --surface: #211a27;
    --background: #17121b;
    --success: #1f3326;
    --error: #3f2225;
    --veto: #ff7b6b;
    --approve: #7fcf8a;
    --star: #ff9a57;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  font: 17px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--background);
}

header { display: flex; justify-content: space-between; align-items: center; padding: 0.75rem 1rem; border-bottom: 1px solid var(--border); background: var(--surface); }
.account { display: flex; gap: 0.25rem; align-items: center; }
.brand { display: flex; align-items: center; gap: 0.45rem; color: var(--text); font-weight: 600; text-decoration: none; }
main { max-width: 36rem; margin: 0 auto; padding: 1rem; }
h1 { font-size: 1.5rem; line-height: 1.25; }
h2 { font-size: 1.1rem; margin-top: 2rem; }
a { color: var(--accent); }

.muted { color: var(--muted); }
.small { font-size: 0.85rem; }

.stack { display: flex; flex-direction: column; gap: 1rem; }
.row { display: flex; gap: 0.5rem; align-items: center; }
.row > input { flex: 1; min-width: 0; }
.row > span { flex: 1; }

label { display: block; }
input:not([type=radio]):not([type=checkbox]), textarea, select {
  display: block;
  width: 100%;
  margin-top: 0.25rem;
  padding: 0.6rem 0.7rem;
  font: inherit;
  color: inherit;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.row input { margin-top: 0; }

fieldset { border: 1px solid var(--border); border-radius: 10px; padding: 0.5rem 1rem 1rem; background: var(--surface); }
legend { font-weight: 600; padding: 0 0.25rem; }

.choice { display: flex; gap: 0.6rem; align-items: flex-start; padding: 0.5rem 0; cursor: pointer; }
.choice input { margin-top: 0.3rem; width: 1.2rem; height: 1.2rem; flex: none; }
label.inline input { width: 6rem; display: inline-block; }

button, .button {
  display: inline-block;
  padding: 0.65rem 1.1rem;
  font: inherit;
  font-weight: 600;
  color: var(--on-accent);
  background: var(--accent);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
}
button.secondary { color: var(--accent); background: var(--accent-soft); }
button.link { padding: 0.25rem; color: var(--muted); background: none; font-weight: normal; text-decoration: underline; }

.notice { padding: 0.7rem 0.9rem; border-radius: 8px; background: var(--accent-soft); }
.notice.success { background: var(--success); }
.notice.error { background: var(--error); }

.wizard { margin: 0.25rem 0 0.5rem; padding: 0.6rem 0.8rem; border-radius: 8px; background: var(--accent-soft); }
.wizard summary { cursor: pointer; font-weight: 600; color: var(--accent); }
.wizard button { margin: 0.25rem 0; }

ul.ballot, ul.plain { list-style: none; padding: 0; margin: 0; }
ul.ballot li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem 0.75rem;
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}
ul.ballot li .choice, ul.ballot li .ranked { flex: 1; }
ul.ballot li > .small { flex-basis: 100%; }
.option-label { flex: 1; min-width: 8rem; }

.ranked { display: flex; align-items: center; gap: 0.75rem; }
.ranked select { width: 4.5rem; margin: 0; flex: none; }

/* Stars are rendered highest first and reversed visually, so a checked star
   can colour itself and every lower star with the sibling selector. */
.stars { display: inline-flex; flex-direction: row-reverse; }
.stars input, .tristate input { position: absolute; opacity: 0; pointer-events: none; }
.stars label { font-size: 1.6rem; padding: 0 0.1rem; color: var(--border); cursor: pointer; }
.stars label.zero { font-size: 1.1rem; margin-right: 0.3rem; align-self: center; }
.stars input:checked ~ label.star, .stars label.star:hover, .stars label.star:hover ~ label.star { color: var(--star); }
.stars input:checked + label.zero { color: var(--text); }

.tristate { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.tristate label { padding: 0.35rem 0.7rem; cursor: pointer; color: var(--muted); }
.tristate label + input + label { border-left: 1px solid var(--border); }
.tristate input:checked + label { color: #fff; background: var(--muted); }
.tristate input:checked + label.veto { background: var(--veto); }
.tristate input:checked + label.approve { background: var(--approve); }

.winner { font-size: 1.25rem; }
ol.standings { list-style: none; padding: 0; }
ol.standings li { display: flex; gap: 0.75rem; align-items: flex-start; padding: 0.5rem 0; border-bottom: 1px solid var(--border); }
.place { font-weight: 700; min-width: 1.5rem; text-align: right; }
.own-vote { margin-left: auto; padding: 0.15rem 0.5rem; font-size: 0.85rem; white-space: nowrap; color: var(--accent); background: var(--accent-soft); border-radius: 999px; }

.heading { justify-content: space-between; }
.heading h1 { margin: 0.5rem 0; }
ul.elections { list-style: none; padding: 0; }
ul.elections li { display: flex; gap: 0.6rem; align-items: baseline; padding: 0.5rem 0; border-bottom: 1px solid var(--border); }
ul.elections .status { flex: none; }
.manage { margin-top: 2.5rem; padding-top: 0.5rem; border-top: 1px solid var(--border); }
.manage h2 { margin: 0; }
.invite { margin-bottom: 1.5rem; padding: 1rem; border-radius: 10px; background: var(--accent-soft); }
.invite p { margin-top: 0; }
.invite .login { gap: 0.75rem; }
.invite form + form p { margin: 0.75rem 0 0; }
fieldset.bare { border: none; padding: 0; margin: 0; background: none; min-width: 0; }
fieldset.bare[disabled] { opacity: 0.6; }
