:root {
  --ink: #17211d;
  --muted: #68736e;
  --paper: #f7f3e8;
  --card: #fffdf7;
  --line: #dcd7c9;
  --green: #173f35;
  --green-2: #266b56;
  --lime: #d9f36a;
  --lime-soft: #f0fac3;
  --orange: #ef8354;
  --orange-soft: #fff0e9;
  --used: #e6e5df;
  --danger: #a83e2b;
  --shadow: 0 18px 60px rgba(31, 48, 41, 0.1);
  --radius: 24px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 0%, rgba(217, 243, 106, 0.32), transparent 28rem),
    radial-gradient(circle at 95% 18%, rgba(239, 131, 84, 0.13), transparent 25rem),
    var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

button, input, select, textarea { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
}

.hero {
  position: relative;
  overflow: hidden;
  padding: 54px 0 76px;
  color: white;
  background: var(--green);
}

.hero::before,
.hero::after {
  position: absolute;
  content: "";
  border-radius: 999px;
  pointer-events: none;
}

.hero::before {
  width: 340px;
  height: 340px;
  right: -90px;
  top: -190px;
  border: 62px solid rgba(217, 243, 106, 0.15);
}

.hero::after {
  width: 180px;
  height: 180px;
  left: -100px;
  bottom: -120px;
  background: rgba(239, 131, 84, 0.18);
}

.hero-inner {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 48px;
}

.kicker,
.section-kicker {
  margin: 0 0 10px;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.kicker { color: var(--lime); }
.section-kicker { color: var(--green-2); }

h1 {
  max-width: 720px;
  margin: 0;
  font-size: clamp(2.6rem, 7vw, 5.4rem);
  line-height: 0.95;
  letter-spacing: -0.055em;
}

h2 {
  margin: 0;
  font-size: clamp(1.65rem, 4vw, 2.45rem);
  line-height: 1.05;
  letter-spacing: -0.035em;
}

h3 { margin: 0; }

.hero-copy {
  max-width: 690px;
  margin: 22px 0 0;
  color: rgba(255, 255, 255, 0.76);
  font-size: 1.04rem;
}

.live-card {
  min-width: 250px;
  padding: 20px 22px;
  color: var(--ink);
  background: var(--lime);
  border-radius: 20px;
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.18);
}

.live-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  color: #42521c;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green-2);
  box-shadow: 0 0 0 5px rgba(38, 107, 86, 0.14);
}

#progress-text {
  display: block;
  font-size: 1.25rem;
  line-height: 1.2;
}

#sync-status {
  display: block;
  margin-top: 7px;
  color: #5d692d;
  font-size: 0.8rem;
}

main {
  position: relative;
  z-index: 2;
  margin-top: -36px;
  padding-bottom: 80px;
}

.panel {
  margin-bottom: 22px;
  padding: clamp(22px, 4vw, 38px);
  background: var(--card);
  border: 1px solid rgba(220, 215, 201, 0.85);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.loading-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 13px;
  min-height: 150px;
  color: var(--muted);
}

.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--line);
  border-top-color: var(--green-2);
  border-radius: 50%;
  animation: spin 750ms linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.phase-banner {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  color: white;
  background: var(--green);
  border-color: var(--green);
}

.phase-banner .section-kicker { color: var(--lime); }
.phase-banner p:last-child { max-width: 760px; margin: 13px 0 0; color: rgba(255,255,255,.74); }

.approved-banner {
  color: var(--ink);
  background: var(--lime);
  border-color: #c6df58;
}

.approved-banner .section-kicker { color: var(--green-2); }
.approved-banner p:last-child { color: #566033; }

.phase-number {
  flex: 0 0 auto;
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  color: var(--green);
  background: var(--lime);
  border-radius: 14px;
  font-size: 1.2rem;
  font-weight: 900;
}

.approved-banner .phase-number { color: white; background: var(--green); }

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.section-note {
  max-width: 450px;
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  text-align: right;
}

.squad-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.squad-button {
  position: relative;
  min-height: 92px;
  padding: 16px;
  color: var(--ink);
  text-align: left;
  background: white;
  border: 1px solid var(--line);
  border-radius: 16px;
  cursor: pointer;
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease, box-shadow 150ms ease;
}

.squad-button:not(:disabled):hover {
  z-index: 1;
  transform: translateY(-2px);
  border-color: var(--green-2);
  box-shadow: 0 9px 22px rgba(23, 63, 53, 0.1);
}

.squad-button:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(38, 107, 86, 0.28);
  outline-offset: 2px;
}

.squad-button.selected {
  background: var(--lime-soft);
  border-color: var(--green-2);
  box-shadow: inset 0 0 0 1px var(--green-2);
}

.squad-button.used {
  color: #7c827e;
  background: var(--used);
  border-color: #d7d6d0;
  cursor: not-allowed;
}

.squad-button.approved:not(.selected) {
  background: #f4f8df;
  border-color: #cad99a;
}

.squad-name {
  display: block;
  padding-right: 18px;
  font-size: 0.98rem;
  font-weight: 800;
  line-height: 1.2;
}

.squad-state {
  display: block;
  margin-top: 10px;
  color: var(--green-2);
  font-size: 0.76rem;
  font-weight: 700;
}

.used .squad-state { color: #8a8e8b; }

.squad-check {
  position: absolute;
  top: 14px;
  right: 14px;
  display: grid;
  width: 21px;
  height: 21px;
  place-items: center;
  color: white;
  background: var(--green-2);
  border-radius: 50%;
  font-size: 0.72rem;
  font-weight: 900;
}

.used .squad-check { background: #9ca19e; }

.selection-line {
  min-height: 25px;
  margin: 16px 2px 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.selection-line strong { color: var(--green); }

.draft-grid,
.questions-grid,
.results-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.draft-card,
.question-card,
.result-card {
  min-width: 0;
  padding: 20px;
  background: #faf8f1;
  border: 1px solid var(--line);
  border-radius: 18px;
}

.draft-title,
.question-title {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 0 0 16px;
  font-size: 1rem;
  font-weight: 850;
  line-height: 1.3;
}

.number-badge {
  flex: 0 0 auto;
  display: grid;
  width: 31px;
  height: 31px;
  place-items: center;
  color: var(--green);
  background: var(--lime);
  border-radius: 9px;
  font-size: 0.72rem;
  font-weight: 900;
}

.draft-options {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.draft-options li {
  padding: 7px 10px;
  color: #43504a;
  background: white;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.79rem;
  font-weight: 650;
}

.proposal-forms {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.proposal-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px;
  background: #faf8f1;
  border: 1px solid var(--line);
  border-radius: 18px;
}

.proposal-type {
  color: var(--green-2);
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.field { display: grid; gap: 7px; }
.field > span { color: #4d5853; font-size: .8rem; font-weight: 750; }

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 11px 12px;
  color: var(--ink);
  background: white;
  border: 1px solid var(--line);
  border-radius: 11px;
}

.field textarea { resize: vertical; }
.field input:disabled, .field select:disabled, .field textarea:disabled { background: #efeee9; cursor: not-allowed; }

.action-button,
.primary-button,
.withdraw-button {
  border: 0;
  border-radius: 12px;
  font-weight: 850;
  cursor: pointer;
}

.action-button {
  align-self: flex-start;
  margin-top: auto;
  padding: 11px 15px;
  color: white;
  background: var(--green-2);
}

.primary-button {
  flex: 0 0 auto;
  min-width: 205px;
  padding: 14px 22px;
  color: white;
  background: var(--green);
  box-shadow: 0 10px 24px rgba(23, 63, 53, 0.2);
}

.action-button:disabled,
.primary-button:disabled,
.withdraw-button:disabled {
  opacity: .42;
  cursor: not-allowed;
  box-shadow: none;
}

.subsection-head {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 28px 0 13px;
  padding-top: 23px;
  border-top: 1px solid var(--line);
}

.subsection-head h3 { font-size: 1rem; }
.count-pill {
  display: inline-grid;
  min-width: 25px;
  height: 25px;
  padding: 0 7px;
  place-items: center;
  color: white;
  background: var(--green-2);
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 850;
}

.proposal-list { display: grid; gap: 9px; }
.proposal-empty { padding: 18px; color: var(--muted); background: #faf8f1; border: 1px dashed var(--line); border-radius: 13px; }

.proposal-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 14px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 13px;
}

.proposal-copy { min-width: 0; }
.proposal-copy strong { display: block; font-size: .9rem; }
.proposal-copy span { display: block; margin-top: 3px; color: var(--muted); font-size: .78rem; }
.proposal-copy em { color: var(--danger); font-style: normal; }

.withdraw-button {
  flex: 0 0 auto;
  padding: 8px 10px;
  color: var(--danger);
  background: var(--orange-soft);
  font-size: .76rem;
}

.approval-panel { border-top: 6px solid var(--lime); }

.approval-squads,
.results-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.status-chip {
  padding: 7px 10px;
  color: #737a76;
  background: #eeece5;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 750;
}

.status-chip.approved,
.status-chip.voted {
  color: var(--green);
  background: var(--lime-soft);
}

.approval-footer,
.vote-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 24px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.approval-footer p,
.vote-help { margin: 0; color: var(--muted); font-size: .85rem; }

.question-card {
  min-width: 0;
  margin: 0;
  transition: opacity 150ms ease;
}

.question-card:disabled { opacity: .58; }

.question-title {
  width: 100%;
  padding: 0;
}

.options { display: grid; gap: 9px; }

.option {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: center;
  gap: 11px;
  min-height: 48px;
  padding: 11px 13px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
}

.option:hover { border-color: #a9b0aa; }
.option:has(input:checked) { background: var(--lime-soft); border-color: var(--green-2); }

.option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.radio-mark {
  display: block;
  width: 19px;
  height: 19px;
  background: white;
  border: 2px solid #a9afab;
  border-radius: 50%;
  box-shadow: inset 0 0 0 4px white;
}

.option input:checked + .radio-mark { background: var(--green-2); border-color: var(--green-2); }
.option-text { font-size: .9rem; font-weight: 650; line-height: 1.25; }

.results-meta { margin-bottom: 20px; }
.empty-results { padding: 28px; color: var(--muted); text-align: center; background: #faf8f1; border: 1px dashed var(--line); border-radius: 16px; }

.result-title { margin: 0 0 17px; font-size: .98rem; line-height: 1.3; }
.result-options { display: grid; gap: 14px; }
.result-label { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 6px; font-size: .82rem; }
.result-label span:first-child { font-weight: 650; }
.result-value { flex: 0 0 auto; color: var(--muted); font-variant-numeric: tabular-nums; font-weight: 750; }
.result-track { height: 8px; overflow: hidden; background: #e3e1d9; border-radius: 999px; }
.result-fill { width: 0; height: 100%; background: var(--green-2); border-radius: inherit; transition: width 300ms ease; }

.toast {
  position: fixed;
  z-index: 20;
  right: 20px;
  bottom: 20px;
  max-width: min(420px, calc(100% - 40px));
  padding: 13px 16px;
  color: white;
  background: var(--ink);
  border-radius: 12px;
  box-shadow: 0 15px 45px rgba(0, 0, 0, 0.24);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.show { opacity: 1; transform: translateY(0); }
.noscript { margin: 20px; padding: 16px; color: #7d2519; background: #ffe2db; border-radius: 12px; text-align: center; }

@media (max-width: 820px) {
  .hero { padding-top: 42px; }
  .hero-inner { grid-template-columns: 1fr; gap: 28px; }
  .live-card { width: min(100%, 360px); }
  .squad-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .draft-grid, .questions-grid, .results-grid, .proposal-forms { grid-template-columns: 1fr; }
  .section-head { align-items: flex-start; flex-direction: column; gap: 10px; }
  .section-note { text-align: left; }
}

@media (max-width: 540px) {
  .shell { width: min(100% - 20px, 1120px); }
  .hero { padding-bottom: 64px; }
  main { margin-top: -28px; }
  .panel { border-radius: 19px; }
  .phase-banner { flex-direction: column; }
  .squad-grid { grid-template-columns: 1fr; }
  .squad-button { min-height: 76px; }
  .approval-footer, .vote-footer { align-items: stretch; flex-direction: column; }
  .primary-button { width: 100%; }
  .proposal-row { align-items: flex-start; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
