:root {
  --bg: #070b12;
  --panel: rgba(12, 18, 28, 0.88);
  --panel-solid: rgba(12, 18, 28, 0.94);
  --text: #e8edf5;
  --muted: #8b9cb3;
  --accent: #f0b429;
  --accent2: #2dd4bf;
  --border: rgba(240, 180, 41, 0.15);
  --danger: #f87171;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ---- HUD header, same as map ---- */

.header {
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
}

.lang-switch {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  flex-shrink: 0;
}

.lang-btn {
  border: none;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  padding: 0.4rem 0.7rem;
  font-family: Syne, sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.lang-btn + .lang-btn {
  border-left: 1px solid var(--border);
}

.lang-btn:hover {
  color: var(--text);
}

.lang-btn.is-active {
  background: rgba(240, 180, 41, 0.18);
  color: var(--accent);
}

.header h1 {
  font-family: Syne, sans-serif;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--accent);
}

.subtitle {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.15rem;
}

.page {
  width: min(44rem, 100%);
  margin: 0 auto;
  padding: 1.5rem 1rem 2rem;
  flex: 1;
}

/* ---- Panels, same treatment as map legend/popup ---- */

.panel {
  background: var(--panel-solid);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.1rem 1.25rem;
  margin-bottom: 1.15rem;
  backdrop-filter: blur(12px);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(240, 180, 41, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.intro-title,
.form-title,
.result-title {
  font-family: Syne, sans-serif;
  font-size: 0.84rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

/* ---- Intro (What is this?) ---- */

.intro {
  padding: 0;
}

.intro-summary {
  list-style: none;
  cursor: pointer;
  padding: 0.9rem 1.25rem;
  font-family: Syne, sans-serif;
  font-size: 0.84rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  user-select: none;
}

.intro-summary::-webkit-details-marker {
  display: none;
}

.intro-summary::after {
  content: "▾";
  float: right;
  color: var(--muted);
  transition: transform 0.15s ease;
}

.intro[open] .intro-summary::after {
  transform: rotate(180deg);
}

.intro-body {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
}

.intro-lead {
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
  line-height: 1.55;
}

.intro-lead strong,
.intro-list strong {
  color: var(--accent);
  font-weight: 600;
}

.intro-list {
  margin-bottom: 0.85rem;
  padding-left: 1.15rem;
  font-size: 0.86rem;
  line-height: 1.5;
}

.intro-list li + li {
  margin-top: 0.45rem;
}

.intro-note {
  padding: 0.65rem 0.8rem;
  border-radius: 6px;
  background: rgba(240, 180, 41, 0.08);
  border: 1px solid var(--border);
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--muted);
}

/* ---- Form ---- */

.form-title {
  margin-bottom: 1.1rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.95rem;
}

.field-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 500;
}

input,
textarea {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  padding: 0.55rem 0.65rem;
  font: inherit;
  font-size: 0.9rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input::placeholder,
textarea::placeholder {
  color: rgba(139, 156, 179, 0.55);
}

input:focus-visible,
textarea:focus-visible {
  outline: none;
  border-color: rgba(240, 180, 41, 0.5);
  box-shadow: 0 0 0 2px rgba(240, 180, 41, 0.18);
}

textarea {
  resize: vertical;
  min-height: 5.5rem;
  line-height: 1.5;
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}

/* ---- Info popovers ----
   The popover is anchored to the whole field (not the tiny icon) so it
   spans the field width and never overflows the viewport. */

.field,
.actions,
.hint {
  position: relative;
}

.info-wrap {
  display: inline-flex;
  align-items: center;
}

.info-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(139, 156, 179, 0.45);
  background: transparent;
  color: var(--muted);
  font-size: 0.6rem;
  font-weight: 700;
  font-style: italic;
  font-family: Georgia, "Times New Roman", serif;
  cursor: help;
  line-height: 1;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.info-btn:hover,
.info-btn:focus-visible,
.info-wrap.is-open .info-btn {
  border-color: rgba(240, 180, 41, 0.6);
  background: rgba(240, 180, 41, 0.12);
  color: var(--accent);
  outline: none;
}

.info-popover {
  display: none;
  position: absolute;
  top: calc(100% + 0.45rem);
  left: 0;
  right: 0;
  padding: 0.75rem 0.9rem;
  border-radius: 7px;
  border: 1px solid rgba(232, 237, 245, 0.25);
  background: #121a28;
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 400;
  line-height: 1.55;
  text-transform: none;
  letter-spacing: normal;
  box-shadow:
    0 12px 32px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(240, 180, 41, 0.25);
  z-index: 20;
  animation: popover-in 0.12s ease;
}

@keyframes popover-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.info-popover code {
  font-size: 0.92em;
  color: var(--accent2);
}

.info-popover strong {
  color: var(--accent);
}

.info-wrap.is-open .info-popover,
.info-wrap:focus-within .info-popover {
  display: block;
}

@media (hover: hover) and (pointer: fine) {
  .info-wrap:hover .info-popover {
    display: block;
  }
}

.actions-info {
  align-self: center;
  margin-left: auto;
}

.confirm-info {
  margin-left: 0.25rem;
  vertical-align: middle;
}

/* ---- Actions, same as map scope-btn / filters-toggle ---- */

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 0.5rem;
}

.btn {
  border-radius: 4px;
  border: 1px solid var(--border);
  padding: 0.5rem 0.85rem;
  font-family: Syne, sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn.primary {
  background: rgba(240, 180, 41, 0.12);
  color: var(--accent);
}

.btn.primary:hover:not(:disabled) {
  background: rgba(240, 180, 41, 0.22);
}

.btn.secondary {
  background: rgba(45, 212, 191, 0.1);
  border-color: rgba(45, 212, 191, 0.25);
  color: var(--accent2);
}

.btn.secondary:hover:not(:disabled) {
  background: rgba(45, 212, 191, 0.2);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.hint {
  margin-top: 0.75rem;
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--muted);
}

.confirm {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-left: 0.35rem;
  color: var(--text);
  cursor: pointer;
}

.confirm input {
  accent-color: var(--accent);
}

/* ---- Results ---- */

.stats {
  display: grid;
  gap: 0.42rem;
  font-size: 0.86rem;
}

.stats strong {
  font-family: Syne, sans-serif;
  color: var(--accent);
  font-weight: 600;
}

.result-title + .result-title,
.stats + .result-title,
.objections + .result-title,
.hint + .result-title {
  margin-top: 1rem;
}

.verbatim {
  margin-top: 0.5rem;
  padding: 0.7rem 0.8rem;
  background: rgba(255, 255, 255, 0.04);
  border-left: 2px solid rgba(240, 180, 41, 0.45);
  border-radius: 0 6px 6px 0;
  font-size: 0.85rem;
  line-height: 1.5;
}

.objections {
  margin-top: 0.5rem;
  padding-left: 1.1rem;
  font-size: 0.85rem;
  line-height: 1.5;
}

.objections li + li {
  margin-top: 0.3rem;
}

.error {
  color: var(--danger);
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

.hidden {
  display: none !important;
}

/* ---- Footer, same as map ---- */

.footer {
  z-index: 2;
  flex-shrink: 0;
  text-align: center;
  padding: 0.5rem 1rem;
  padding-bottom: calc(0.5rem + env(safe-area-inset-bottom, 0px));
  font-size: 0.7rem;
  color: var(--muted);
  background: var(--panel);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(12px);
}

.footer a {
  color: var(--accent);
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}

@media (max-width: 520px) {
  .header {
    padding: 0.75rem 0.85rem;
  }

  .header h1 {
    font-size: 1.05rem;
  }

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

  .actions .btn {
    flex: 1 1 auto;
    min-height: 2.75rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}
