:root {
  --ink: #17221c;
  --muted: #647067;
  --line: #d8ded7;
  --panel: #fbfcfa;
  --paper: #ffffff;
  --pitch: #0f6b4b;
  --pitch-dark: #084634;
  --gold: #d8a31f;
  --red: #ce3f35;
  --blue: #2567a8;
  --shadow: 0 18px 48px rgba(20, 35, 28, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: #eaf0eb;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(320px, 390px) minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  height: 100vh;
  min-height: 100vh;
  overflow: hidden;
}

.control-panel {
  display: flex;
  flex-direction: column;
  gap: 22px;
  grid-column: 1;
  grid-row: 1;
  padding: 28px;
  background: var(--panel);
  border-right: 1px solid var(--line);
  z-index: 2;
}

.summary-panel {
  display: flex;
  flex-direction: column;
  gap: 22px;
  grid-column: 1;
  grid-row: 2;
  overflow-y: auto;
  padding: 0 28px 28px;
  background: var(--panel);
  border-right: 1px solid var(--line);
  box-shadow: var(--shadow);
  z-index: 2;
}

.title-block {
  display: grid;
  gap: 6px;
}

.eyebrow {
  margin: 0;
  color: var(--pitch);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(2.1rem, 5vw, 3.5rem);
  line-height: 0.98;
}

.intro {
  color: var(--muted);
  line-height: 1.45;
}

.fan-form {
  display: grid;
  gap: 9px;
  padding: 18px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
}

label {
  color: #334139;
  font-size: 0.82rem;
  font-weight: 750;
}

input,
select {
  appearance: none;
  width: 100%;
  min-height: 46px;
  padding: 0 13px;
  color: var(--ink);
  background: #f7faf7;
  border: 1px solid #cbd5cd;
  border-radius: 7px;
  outline: none;
}

select {
  padding-right: 42px;
  background-image:
    linear-gradient(45deg, transparent 50%, #66746b 50%),
    linear-gradient(135deg, #66746b 50%, transparent 50%);
  background-position:
    calc(100% - 21px) 20px,
    calc(100% - 15px) 20px;
  background-repeat: no-repeat;
  background-size: 6px 6px, 6px 6px;
}

input:focus,
select:focus {
  border-color: var(--pitch);
  box-shadow: 0 0 0 3px rgba(15, 107, 75, 0.14);
}

.suggestion-field {
  position: relative;
}

.suggestion-list {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  left: 0;
  overflow: hidden;
  background: var(--paper);
  border: 1px solid #cbd5cd;
  border-radius: 8px;
  box-shadow: 0 14px 30px rgba(24, 35, 29, 0.16);
  z-index: 900;
}

.suggestion-item {
  display: block;
  width: 100%;
  min-height: 40px;
  margin: 0;
  padding: 10px 12px;
  color: var(--ink);
  background: var(--paper);
  border: 0;
  border-radius: 0;
  text-align: left;
  cursor: pointer;
  font-size: 0.92rem;
  font-weight: 700;
}

.suggestion-item:hover,
.suggestion-item:focus,
.suggestion-item.active {
  color: var(--ink);
  background: #edf4ee;
}

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  margin-top: 6px;
  color: #ffffff;
  background: var(--pitch);
  border: 0;
  border-radius: 7px;
  cursor: pointer;
  font-weight: 800;
}

button:hover {
  background: var(--pitch-dark);
}

button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.form-message {
  min-height: 20px;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.35;
}

.form-message.error {
  color: #a92e28;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.stat {
  min-width: 0;
  padding: 14px 10px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.stat span {
  display: block;
  font-size: 1.5rem;
  font-weight: 850;
}

.stat p {
  color: var(--muted);
  font-size: 0.8rem;
}

.map-mode-control {
  display: grid;
  gap: 8px;
}

.map-mode-control p {
  color: #334139;
  font-size: 0.82rem;
  font-weight: 750;
}

.segmented-control {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px;
  padding: 4px;
  background: #e4ebe5;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.mode-button {
  min-height: 38px;
  margin: 0;
  color: var(--muted);
  background: transparent;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 800;
}

.mode-button:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.58);
}

.mode-button.active {
  color: #ffffff;
  background: var(--pitch);
  box-shadow: 0 4px 12px rgba(15, 107, 75, 0.22);
}

.summary-section {
  display: grid;
  gap: 10px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

h2 {
  font-size: 0.98rem;
}

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

.empty-state,
.row {
  min-width: 0;
  padding: 12px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.empty-state {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.4;
}

.row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.row strong {
  display: block;
  overflow: hidden;
  font-size: 0.94rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row small {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.count-badge {
  min-width: 32px;
  padding: 5px 8px;
  color: #ffffff;
  background: var(--pitch);
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 800;
  text-align: center;
}

.map-panel {
  position: relative;
  grid-column: 2;
  grid-row: 1 / span 2;
  min-height: 0;
}

#map {
  width: 100%;
  height: 100vh;
  min-height: 100vh;
  background: #dfe8e2;
}

.map-key {
  position: absolute;
  right: 18px;
  bottom: 18px;
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: min(360px, calc(100% - 36px));
  padding: 11px 13px;
  color: #28342d;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(216, 222, 215, 0.85);
  border-radius: 8px;
  box-shadow: 0 8px 26px rgba(25, 43, 34, 0.16);
  font-size: 0.84rem;
  line-height: 1.3;
  z-index: 500;
}

.key-dot {
  width: 13px;
  height: 13px;
  flex: 0 0 auto;
  background: radial-gradient(circle, #ff2f1f 0 28%, #ffc928 54%, rgba(28, 128, 66, 0.18) 74%);
  border: 2px solid #ffffff;
  border-radius: 999px;
  box-shadow: 0 0 0 1px rgba(24, 35, 29, 0.22);
}

.key-dot.markers {
  background: var(--gold);
}

.supporter-marker {
  border: 0;
  background: transparent;
}

.map-pin {
  display: grid;
  place-items: center;
  color: #ffffff;
  background: var(--marker-color);
  border: 3px solid #ffffff;
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(26, 36, 30, 0.32);
  font-size: 0.9rem;
  font-weight: 900;
}

.popup-title {
  margin-bottom: 8px;
  color: var(--ink);
  font-weight: 850;
}

.popup-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-width: 170px;
  padding: 4px 0;
  color: #334139;
}

.popup-team {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.popup-dot {
  width: 10px;
  height: 10px;
  background: var(--team-color);
  border-radius: 999px;
}

@media (max-width: 880px) {
  .app-shell {
    display: flex;
    flex-direction: column;
    grid-template-columns: 1fr;
    height: auto;
    overflow: visible;
  }

  .control-panel {
    order: 1;
    max-height: none;
    padding: 22px 18px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    box-shadow: none;
  }

  .map-panel {
    order: 2;
  }

  .summary-panel {
    order: 3;
    gap: 18px;
    overflow: visible;
    padding: 22px 18px;
    border-right: 0;
    box-shadow: none;
  }

  h1 {
    font-size: 2.25rem;
  }

  .map-panel,
  #map {
    height: 62vh;
    min-height: 390px;
  }

  .map-key {
    right: 12px;
    bottom: 12px;
    max-width: calc(100% - 24px);
  }
}

@media (max-width: 460px) {
  .control-panel {
    gap: 14px;
    padding: 16px 14px;
  }

  .summary-panel {
    padding: 16px 14px;
  }

  h1 {
    font-size: 2rem;
  }

  .intro {
    font-size: 0.95rem;
  }

  .fan-form {
    padding: 14px;
  }

  .map-panel,
  #map {
    height: 58vh;
    min-height: 360px;
  }

  .stat-grid {
    gap: 8px;
  }

  .stat {
    padding: 12px 8px;
  }

  .stat span {
    font-size: 1.3rem;
  }

  .stat p {
    font-size: 0.74rem;
  }
}
