:root {
  --navy: #06224b;
  --navy-2: #103a73;
  --navy-3: #021735;
  --green: #287a23;
  --green-2: #4aa03f;
  --green-soft: #e9f4e8;
  --yellow: #f4c400;
  --yellow-soft: #fff6ce;
  --red: #d92128;
  --red-soft: #fde8e9;
  --paper: #f6f8f5;
  --white: #ffffff;
  --ink: #111827;
  --muted: #5c6675;
  --line: #d9e2dd;
  --neutral: #94a3b8;
  --shadow: 0 22px 58px rgba(6, 34, 75, 0.14);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(40, 122, 35, 0.14) 0, rgba(40, 122, 35, 0.03) 310px, transparent 650px),
    var(--paper);
  font-family: Aptos, "Segoe UI", Arial, sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
}

.app-shell {
  width: min(1160px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 42px;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 106px;
  margin-bottom: 18px;
}

.brand {
  display: block;
  width: 360px;
  max-width: min(56vw, 360px);
}

.brand img {
  display: block;
  width: 100%;
  height: auto;
}

.header-meta {
  display: grid;
  gap: 3px;
  text-align: right;
}

.header-meta span {
  color: var(--green);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.header-meta strong {
  color: var(--navy);
  font-family: "Arial Black", Arial, sans-serif;
  font-size: 24px;
  letter-spacing: 0;
}

.app-card {
  min-height: 720px;
  padding: 30px;
  background: var(--white);
  border: 1px solid rgba(6, 34, 75, 0.14);
  border-top: 8px solid var(--navy);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.progress-wrap {
  margin-bottom: 28px;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
  text-transform: uppercase;
}

.progress-track {
  height: 10px;
  overflow: hidden;
  background: #edf2ed;
  border-radius: 999px;
}

.progress-bar {
  width: 12.5%;
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--green-2), var(--navy));
  border-radius: inherit;
  transition: width 180ms ease;
}

.screen {
  display: none;
}

.screen.is-active {
  display: block;
}

.intro-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.16fr) minmax(290px, 0.84fr);
  gap: 36px;
  align-items: center;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--green);
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
p {
  overflow-wrap: anywhere;
}

h1 {
  max-width: 900px;
  margin: 0 0 16px;
  color: var(--navy);
  font-family: "Arial Black", Arial, sans-serif;
  font-size: 52px;
  line-height: 1.05;
}

h2 {
  margin: 0 0 12px;
  color: var(--navy);
  font-size: 25px;
}

.lead {
  max-width: 850px;
  margin: 0 0 26px;
  color: var(--muted);
  font-size: 22px;
  line-height: 1.45;
}

.signal-panel {
  display: grid;
  justify-items: center;
  gap: 16px;
  padding: 34px;
  color: var(--white);
  background: var(--navy);
  border: 1px solid rgba(6, 34, 75, 0.28);
  border-radius: 8px;
  box-shadow: inset 0 -7px 0 rgba(0, 0, 0, 0.12);
}

.panel-logo {
  width: min(260px, 100%);
  height: auto;
  margin-bottom: 4px;
}

.signal {
  width: 74px;
  height: 74px;
  border-radius: 50%;
  box-shadow: inset 0 -8px 0 rgba(0, 0, 0, 0.11);
}

.signal.green {
  background: var(--green);
}

.signal.yellow {
  background: var(--yellow);
}

.signal.red {
  background: var(--red);
}

.signal-panel strong {
  color: var(--white);
  font-size: 28px;
}

.signal-panel small {
  color: rgba(255, 255, 255, 0.78);
  font-size: 18px;
  text-align: center;
}

.notice,
.counter-pill,
.form-error {
  width: max-content;
  max-width: 100%;
  margin: 0 0 18px;
  padding: 10px 14px;
  color: var(--navy);
  background: var(--yellow-soft);
  border: 1px solid rgba(244, 196, 0, 0.44);
  border-radius: 8px;
  font-weight: 800;
}

.counter-pill {
  background: var(--red-soft);
  border-color: rgba(217, 33, 40, 0.22);
}

.green-pill {
  background: var(--green-soft);
  border-color: rgba(40, 122, 35, 0.22);
}

.form-error {
  color: #8b1014;
  background: var(--red-soft);
  border-color: rgba(217, 33, 40, 0.28);
}

.traffic-grid {
  display: grid;
  gap: 12px;
}

.traffic-row {
  display: grid;
  grid-template-columns: minmax(210px, 1fr) repeat(4, minmax(108px, 148px));
  gap: 10px;
  align-items: stretch;
  padding: 12px;
  background: #fbfdfb;
  border: 1px solid rgba(6, 34, 75, 0.1);
  border-radius: 8px;
}

.topic-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  color: var(--navy);
  font-size: 18px;
  font-weight: 900;
}

.topic-title span {
  min-width: 0;
}

.info-button {
  min-height: 34px;
  padding: 0 10px;
  color: var(--green);
  background: var(--green-soft);
  border: 1px solid rgba(40, 122, 35, 0.24);
  border-radius: 999px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}

.info-button:hover {
  border-color: var(--green);
}

.traffic-button,
.choice-button,
.location-button {
  min-height: 52px;
  padding: 12px 14px;
  color: var(--navy);
  background: var(--white);
  border: 2px solid #d7e1d8;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 800;
  text-align: left;
  transition:
    transform 120ms ease,
    border-color 120ms ease,
    background 120ms ease;
}

.traffic-button:hover,
.choice-button:hover,
.location-button:hover {
  transform: translateY(-1px);
  border-color: #b8c8bf;
}

.traffic-button.is-selected,
.choice-button.is-selected,
.location-button.is-selected {
  border-color: var(--navy);
  background: #f4f8f5;
  box-shadow: inset 0 -4px 0 rgba(6, 34, 75, 0.08);
}

.traffic-button {
  display: flex;
  align-items: center;
  gap: 9px;
}

.dot {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  border-radius: 50%;
}

.dot.green {
  background: var(--green);
}

.dot.yellow {
  background: var(--yellow);
}

.dot.red {
  background: var(--red);
}

.dot.none {
  background: var(--neutral);
}

.topic-note {
  grid-column: 1 / -1;
  min-height: 78px;
  padding: 12px 14px;
  font-size: 15px;
}

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

.choice-grid.compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.choice-card {
  position: relative;
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 10px;
  background: #fbfdfb;
  border: 1px solid rgba(6, 34, 75, 0.09);
  border-radius: 8px;
}

.choice-card .info-button {
  justify-self: start;
}

.choice-button {
  width: 100%;
  min-height: 72px;
}

.choice-card.red-choice.is-selected .choice-button {
  color: #8b1014;
  background: var(--red-soft);
  border-color: var(--red);
}

.choice-card.green-choice.is-selected .choice-button {
  color: #174d14;
  background: var(--green-soft);
  border-color: var(--green);
}

.choice-button.is-limited {
  animation: nudge 180ms ease;
}

@keyframes nudge {
  0% { transform: translateX(0); }
  35% { transform: translateX(-4px); }
  70% { transform: translateX(4px); }
  100% { transform: translateX(0); }
}

.location-layout {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(300px, 0.78fr);
  gap: 24px;
  align-items: start;
}

.location-fields {
  min-width: 0;
}

.map-option {
  min-width: 0;
  padding: 22px;
  background: #f7faf7;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.map-option h2 {
  font-size: 25px;
}

.map-option p {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.45;
}

.location-help {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.45;
}

.map-toggle {
  width: 100%;
  margin-bottom: 16px;
}

.map-panel[hidden] {
  display: none;
}

.real-map {
  height: 360px;
  min-height: 300px;
  overflow: hidden;
  background: #eaf1ea;
  border: 2px solid var(--line);
  border-radius: 8px;
}

.map-tools {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.compact-label {
  margin: 0;
}

.compact-textarea {
  min-height: 92px;
  padding: 12px 14px;
  font-size: 15px;
}

.map-status {
  margin: 0;
  color: var(--navy);
  font-weight: 800;
}

.pin-list {
  display: grid;
  gap: 8px;
}

.pin-item {
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.pin-item strong {
  color: var(--navy);
}

.pin-item span,
.pin-item small {
  color: var(--muted);
  line-height: 1.35;
}

.map-clear {
  justify-self: start;
  min-height: 44px;
}

.is-hidden {
  display: none !important;
}

.info-popover {
  position: fixed;
  z-index: 20;
  left: 50%;
  top: 50%;
  width: min(520px, calc(100% - 28px));
  padding: 24px;
  color: var(--ink);
  background: var(--white);
  border: 1px solid rgba(6, 34, 75, 0.18);
  border-top: 6px solid var(--green);
  border-radius: 8px;
  box-shadow: 0 24px 90px rgba(2, 23, 53, 0.28);
  transform: translate(-50%, -50%);
}

.info-popover[hidden] {
  display: none;
}

.info-popover h2 {
  margin-right: 32px;
}

.info-popover p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.5;
}

.info-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  color: var(--navy);
  background: #eaf1ea;
  border-radius: 999px;
  cursor: pointer;
  font-size: 26px;
  font-weight: 900;
  line-height: 1;
}

.leaflet-container {
  font-family: Aptos, "Segoe UI", Arial, sans-serif;
}

.leaflet-control-attribution {
  font-size: 11px;
}

.map-sketch {
  position: relative;
  min-height: 350px;
  padding: 28px;
  overflow: hidden;
  color: var(--navy);
  background:
    linear-gradient(135deg, transparent 42%, rgba(40, 122, 35, 0.16) 42%, rgba(40, 122, 35, 0.16) 45%, transparent 45%),
    linear-gradient(30deg, transparent 50%, rgba(6, 34, 75, 0.12) 50%, rgba(6, 34, 75, 0.12) 53%, transparent 53%),
    #f7faf7;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.map-sketch strong,
.map-sketch small {
  position: relative;
  z-index: 1;
  display: block;
}

.map-sketch strong {
  margin-top: 220px;
  font-size: 28px;
}

.map-sketch small {
  margin-top: 6px;
  color: var(--muted);
  font-size: 17px;
}

.map-pin {
  position: absolute;
  width: 24px;
  height: 24px;
  background: var(--red);
  border: 4px solid var(--white);
  border-radius: 50% 50% 50% 0;
  box-shadow: 0 8px 18px rgba(6, 34, 75, 0.18);
  transform: rotate(-45deg);
}

.pin-a {
  left: 90px;
  top: 92px;
}

.pin-b {
  right: 78px;
  top: 145px;
  background: var(--green);
}

.pin-c {
  left: 160px;
  top: 198px;
  background: var(--yellow);
}

.field-label,
.form-grid span {
  display: block;
  margin: 18px 0 8px;
  color: var(--navy);
  font-size: 16px;
  font-weight: 900;
}

input,
textarea {
  width: 100%;
  color: var(--ink);
  background: var(--white);
  border: 2px solid var(--line);
  border-radius: 8px;
  outline: none;
}

input {
  min-height: 54px;
  padding: 0 15px;
}

textarea {
  resize: vertical;
  min-height: 190px;
  padding: 15px;
  line-height: 1.45;
}

input:focus,
textarea:focus {
  border-color: var(--navy);
}

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

.checkbox-line {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 22px 0 16px;
  color: var(--muted);
  line-height: 1.45;
}

.checkbox-line input {
  width: 22px;
  min-width: 22px;
  height: 22px;
  min-height: 22px;
  margin-top: 2px;
  accent-color: var(--green);
}

.screen-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 28px;
}

.primary-action,
.secondary-action,
.ghost-action {
  min-height: 52px;
  padding: 0 20px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 900;
}

.primary-action {
  color: var(--white);
  background: var(--navy);
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.18);
}

.intro-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: stretch;
}

.intro-actions .primary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 76px;
  padding: 0 28px;
  font-size: 18px;
}

.intro-web-link {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  min-width: min(100%, 310px);
  min-height: 76px;
  padding: 14px 18px;
  color: var(--navy);
  background: var(--green-soft);
  border: 2px solid rgba(40, 122, 35, 0.28);
  border-radius: 8px;
  text-decoration: none;
  box-shadow: inset 0 -4px 0 rgba(40, 122, 35, 0.08);
}

.intro-web-link span {
  color: var(--green);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.intro-web-link strong {
  color: var(--navy);
  font-size: 22px;
  line-height: 1.15;
}

.intro-web-link:hover {
  border-color: var(--green);
}

.secondary-action {
  color: var(--navy);
  background: #eaf1ea;
}

.ghost-action {
  color: var(--navy);
  background: transparent;
  border: 2px solid var(--line);
}

.primary-action:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.summary-box {
  padding: 22px;
  background: #f7faf7;
  border: 1px solid rgba(6, 34, 75, 0.14);
  border-radius: 8px;
}

.citizen-type {
  margin: 0 0 18px;
  padding: 20px;
  background: var(--green-soft);
  border: 1px solid rgba(40, 122, 35, 0.18);
  border-radius: 8px;
}

.citizen-type h2 {
  margin-bottom: 8px;
}

.citizen-type p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.45;
}

.summary-list {
  display: grid;
  gap: 10px;
  margin: 0;
}

.summary-list div {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 14px;
}

.summary-list dt {
  color: var(--navy);
  font-weight: 900;
}

.summary-list dd {
  margin: 0;
  color: var(--muted);
}

.json-box {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.json-box summary {
  padding: 16px;
  color: var(--navy);
  cursor: pointer;
  font-weight: 900;
}

.json-box pre {
  max-height: 340px;
  margin: 0;
  padding: 16px;
  overflow: auto;
  color: #e5edf7;
  background: #071a33;
  border-radius: 0 0 8px 8px;
  font-size: 14px;
  line-height: 1.45;
}

.admin-main {
  display: grid;
  gap: 24px;
  align-content: start;
}

.admin-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.admin-hero .lead {
  margin-bottom: 0;
}

.admin-link {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  text-decoration: none;
}

.admin-login {
  display: grid;
  grid-template-columns: minmax(240px, 420px) auto;
  gap: 12px;
  align-items: end;
  padding: 20px;
  background: #f7faf7;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.admin-login span {
  display: block;
  margin: 0 0 8px;
  color: var(--navy);
  font-size: 16px;
  font-weight: 900;
}

.form-message {
  min-height: 24px;
  margin: -6px 0 0;
  color: var(--muted);
  font-weight: 800;
}

.form-message.is-error {
  color: #8b1014;
}

.results-panel {
  display: grid;
  gap: 22px;
}

.results-panel[hidden] {
  display: none;
}

.results-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: flex-end;
}

.danger-button {
  min-height: 52px;
  padding: 0 20px;
  color: #8b1014;
  background: var(--red-soft);
  border: 2px solid rgba(217, 33, 40, 0.28);
  border-radius: 8px;
  cursor: pointer;
  font-weight: 900;
}

.danger-button:disabled,
.results-actions button:disabled,
.admin-login button:disabled {
  cursor: wait;
  opacity: 0.55;
}

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

.stat-card {
  min-height: 118px;
  padding: 18px;
  background: #f7faf7;
  border: 1px solid rgba(6, 34, 75, 0.12);
  border-radius: 8px;
}

.stat-card span {
  display: block;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 900;
  text-transform: uppercase;
}

.stat-card strong {
  display: block;
  color: var(--navy);
  font-family: "Arial Black", Arial, sans-serif;
  font-size: clamp(24px, 3vw, 36px);
  line-height: 1.05;
}

.admin-section {
  padding: 20px;
  background: #fbfdfb;
  border: 1px solid rgba(6, 34, 75, 0.11);
  border-radius: 8px;
}

.admin-section h2 {
  margin-bottom: 16px;
}

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

.semafor-summary {
  display: grid;
  gap: 14px;
}

.semafor-row {
  display: grid;
  grid-template-columns: minmax(180px, 0.85fr) minmax(210px, 1fr) minmax(220px, 0.9fr);
  gap: 14px;
  align-items: center;
}

.semafor-row strong {
  color: var(--navy);
}

.semafor-row small {
  color: var(--muted);
  font-weight: 800;
  line-height: 1.4;
}

.bar-stack {
  display: flex;
  min-width: 0;
  height: 28px;
  overflow: hidden;
  background: #eef4ef;
  border-radius: 999px;
}

.bar-segment {
  display: grid;
  place-items: center;
  min-width: 34px;
  color: var(--white);
  font-size: 13px;
  font-weight: 900;
}

.bar-segment.green {
  background: var(--green);
}

.bar-segment.yellow {
  color: var(--navy);
  background: var(--yellow);
}

.bar-segment.red {
  background: var(--red);
}

.bar-segment.none {
  background: var(--neutral);
}

.count-list {
  display: grid;
  gap: 10px;
}

.count-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 12px 14px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.count-row span {
  color: var(--navy);
  font-weight: 900;
}

.count-row strong {
  display: grid;
  place-items: center;
  min-width: 38px;
  height: 34px;
  color: var(--white);
  background: var(--navy);
  border-radius: 999px;
}

.text-answers {
  display: grid;
  gap: 12px;
}

.text-answer {
  display: grid;
  gap: 10px;
  padding: 16px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.text-answer div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  justify-content: space-between;
}

.text-answer strong {
  color: var(--navy);
}

.text-answer span,
.text-answer p,
.admin-empty {
  color: var(--muted);
}

.text-answer p,
.admin-empty {
  margin: 0;
  line-height: 1.5;
}

@media (max-width: 900px) {
  .site-header {
    align-items: flex-start;
  }

  .header-meta {
    display: none;
  }

  .app-card {
    min-height: auto;
    padding: 20px;
  }

  .intro-grid,
  .location-layout,
  .form-grid {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 38px;
  }

  .lead {
    font-size: 19px;
  }

  .traffic-row {
    grid-template-columns: 1fr;
  }

  .choice-grid,
  .choice-grid.compact {
    grid-template-columns: 1fr;
  }

  .map-sketch {
    min-height: 250px;
  }

  .map-sketch strong {
    margin-top: 140px;
  }

  .real-map {
    height: 320px;
  }

  .summary-list div {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .admin-hero,
  .results-actions {
    justify-content: stretch;
  }

  .admin-hero,
  .admin-login,
  .admin-two-columns {
    grid-template-columns: 1fr;
  }

  .admin-hero {
    display: grid;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .semafor-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .app-shell {
    width: min(100% - 20px, 1180px);
    padding-top: 16px;
  }

  .brand {
    width: min(330px, 78vw);
    max-width: none;
  }

  .app-card {
    padding: 16px;
  }

  h1 {
    font-size: 32px;
  }

  .screen-actions {
    justify-content: stretch;
  }

  .primary-action,
  .secondary-action,
  .ghost-action {
    width: 100%;
  }

  .intro-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .intro-web-link {
    width: 100%;
  }

  .map-option {
    padding: 16px;
  }

  .real-map {
    height: 280px;
    min-height: 260px;
  }

  .admin-login,
  .admin-section {
    padding: 16px;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }
}
