:root {
  color-scheme: dark;

  --bg: #0b1020;
  --bg-2: #121933;
  --bg-3: #182246;

  --panel: #141b34;
  --panel-soft: rgba(20, 27, 52, 0.95);
  --panel-glass: rgba(15, 18, 24, 0.92);
  --panel-glass-soft: rgba(18, 24, 44, 0.78);

  --text: #eef2ff;
  --muted: #aeb8d6;
  --muted-2: rgba(255, 255, 255, 0.55);

  --border: #283252;
  --border-soft: rgba(255, 255, 255, 0.08);
  --border-faint: rgba(255, 255, 255, 0.06);

  --accent: #7aa2ff;
  --accent-strong: #93b4ff;

  --shadow-sm: 0 10px 24px rgba(0, 0, 0, 0.18);
  --shadow-lg: 0 18px 40px rgba(0, 0, 0, 0.24);
  --shadow-xl: 0 28px 70px rgba(0, 0, 0, 0.35);

  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --radius-xl: 28px;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top center, rgba(122, 162, 255, 0.12), transparent 28%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 55%, var(--bg-3) 100%);
}

a {
  color: var(--accent);
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

/* ---------- Shared layout ---------- */

.wrap {
  max-width: 1040px;
  margin: 0 auto;
  padding: 56px 24px 72px;
}

.locations-page {
  max-width: 1120px;
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.topbar a {
  text-decoration: none;
  color: var(--muted);
  font-weight: 600;
}

.topbar a:hover,
.topbar a:focus-visible {
  color: var(--text);
}

h1 {
  margin: 0 0 12px;
  font-size: clamp(2.3rem, 4.8vw, 4.2rem);
  line-height: 0.98;
  letter-spacing: -0.045em;
  text-wrap: balance;
}

.subtitle {
  max-width: 62ch;
  margin: 0 0 28px;
  color: var(--muted);
  font-size: clamp(1rem, 1.5vw, 1.125rem);
  line-height: 1.6;
  text-wrap: balance;
}

.examples p,
.footer,
.panel p {
  color: var(--muted);
}

.footer {
  margin-top: 48px;
  font-size: 13px;
  line-height: 1.6;
}

/* ---------- Shared form controls ---------- */

.form,
.settings-form {
  display: grid;
  gap: 16px;
  margin-bottom: 28px;
}

.form {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
}

.field {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.field span {
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

input,
select {
  min-width: 0;
  width: 100%;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font-size: 16px;
  outline: none;
}

input::placeholder {
  color: var(--muted);
}

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(122, 162, 255, 0.18);
}

.checkbox-row {
  display: flex;
  gap: 10px;
  align-items: center;
  color: var(--text);
}

.checkbox-row input {
  width: 18px;
  height: 18px;
  padding: 0;
}

.button-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

button,
.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  border: 0;
  background: var(--accent);
  color: #08101f;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition:
    transform 140ms ease,
    background 140ms ease,
    border-color 140ms ease,
    color 140ms ease,
    opacity 140ms ease,
    box-shadow 140ms ease;
}

button:hover,
.button-link:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(122, 162, 255, 0.18);
}

button.secondary,
.secondary-link {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: none;
}

/* ---------- Shared cards/panels ---------- */

.grid {
  display: grid;
  gap: 14px;
}

.card,
.panel {
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--panel-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
}

.card:hover {
  border-color: var(--border);
}

.title {
  display: block;
  font-weight: 700;
  margin-bottom: 6px;
}

.url {
  display: block;
  color: var(--muted);
  word-break: break-all;
  font-size: 14px;
}

/* ---------- Homepage / main page ---------- */

.wrap:not(.locations-page) {
  display: grid;
  gap: 28px;
}

.wrap:not(.locations-page) > .topbar,
.wrap:not(.locations-page) > h1,
.wrap:not(.locations-page) > .subtitle,
.wrap:not(.locations-page) > .form,
.wrap:not(.locations-page) > .map-preview,
.wrap:not(.locations-page) > .examples,
.wrap:not(.locations-page) > .footer {
  min-width: 0;
}

.wrap:not(.locations-page) > h1,
.wrap:not(.locations-page) > .subtitle,
.wrap:not(.locations-page) > .examples,
.wrap:not(.locations-page) > .footer {
  max-width: 760px;
}

.wrap:not(.locations-page) > .form {
  position: relative;
  margin: 0;
  padding: 18px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-xl);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.02)),
    var(--panel-glass-soft);
  box-shadow:
    var(--shadow-lg),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(10px);
  grid-template-columns: minmax(0, 1fr) auto;
}

.wrap:not(.locations-page) > .form input,
.wrap:not(.locations-page) > .form button {
  align-self: stretch;
}

.map-preview {
  margin: 0;
  padding: 18px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-soft);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.018)),
    var(--panel-glass-soft);
  box-shadow:
    var(--shadow-xl),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  overflow: clip;
}

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

.map-preview-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
  margin-bottom: 16px;
}

.map-title,
.map-coords,
.map-note {
  margin: 0;
}

.map-coords[title] {
  cursor: help;
}

.map-title {
  margin: 0;
  font-size: clamp(1.15rem, 2vw, 1.45rem);
  font-weight: 750;
  line-height: 1.2;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.map-coords {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: clamp(0.95rem, 1.3vw, 1rem);
  font-weight: 600;
  color: rgba(255, 255, 255, 0.8);
  word-break: break-word;
}

.map-meta {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.map-frame {
  display: block;
  width: 100%;
  min-height: clamp(300px, 48vw, 520px);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius-xl) - 6px);
  background:
    radial-gradient(circle at top left, rgba(122, 162, 255, 0.18), transparent 35%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.map-note {
  margin-top: 12px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.examples {
  color: var(--muted);
}

.examples p {
  margin: 0 0 10px;
  font-weight: 700;
  color: var(--text);
}

.examples ul {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 8px;
}

.examples li {
  line-height: 1.5;
}

/* ---------- Locations page ---------- */

.locations-hero {
  margin-bottom: 20px;
}

.locations-search-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  margin-bottom: 18px;
}

.locations-summary {
  margin-bottom: 22px;
}

.locations-summary p {
  margin: 0;
  color: var(--muted);
}

.locations-sections {
  display: grid;
  gap: 28px;
}

.locations-region {
  display: grid;
  gap: 14px;
}

.locations-region-header {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
}

.locations-region-title {
  margin: 0;
  font-size: 24px;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.locations-region-subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.locations-region-count {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  white-space: nowrap;
}

.locations-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
}

.location-card {
  padding: 18px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-soft);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02)),
    var(--panel-glass);
  box-shadow:
    var(--shadow-lg),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(10px);
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    border-color 160ms ease;
}

.location-card:hover,
.location-card:focus-within {
  transform: translateY(-2px);
  box-shadow: 0 24px 50px rgba(0, 0, 0, 0.3);
  border-color: rgba(122, 162, 255, 0.18);
}

.location-empty-card {
  min-height: 140px;
  align-content: center;
}

.location-card-top {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 18px;
  align-items: start;
  margin-bottom: 16px;
}

.location-card-bottom {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: end;
}

.location-card-copy,
.location-card-map,
.location-meta-block {
  min-width: 0;
}

.location-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.location-title {
  margin: 0;
  font-size: 1.2rem;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.location-title a {
  color: inherit;
  text-decoration: none;
}

.location-title a:hover {
  text-decoration: underline;
}

.location-region-badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  line-height: 1;
  color: rgba(255, 255, 255, 0.92);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-soft);
  white-space: nowrap;
}

.location-coords {
  margin: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.92rem;
  color: rgba(255, 255, 255, 0.72);
  word-break: break-word;
}

.location-preview-shell {
  position: relative;
  min-height: 220px;
  border-radius: 18px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-faint);
}

.location-preview-frame {
  display: block;
  width: 100%;
  height: 220px;
  border: 0;
  opacity: 0;
  transition: opacity 180ms ease;
}

.location-preview-shell.is-map-ready .location-preview-frame {
  opacity: 1;
}

.location-preview-skeleton {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 25% 30%, rgba(255, 255, 255, 0.07), transparent 30%),
    radial-gradient(circle at 70% 70%, rgba(255, 255, 255, 0.05), transparent 28%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.015));
  opacity: 1;
}

.location-preview-skeleton-shimmer {
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent);
  animation: location-skeleton-shimmer 1.6s infinite;
}

.location-preview-skeleton-pin {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  transform: translate(-50%, -50%);
  background: rgba(255, 255, 255, 0.22);
  box-shadow: 0 0 0 8px rgba(255, 255, 255, 0.06);
}

.location-preview-shell.is-map-ready .location-preview-skeleton {
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.location-meta-label {
  margin: 0 0 8px;
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.5);
}

.location-empty-meta {
  margin: 0;
  color: var(--muted-2);
  font-size: 0.92rem;
}

.location-aliases {
  display: grid;
  gap: 10px;
}

.location-alias-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.location-alias-chip {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  text-decoration: none;
  color: rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(255, 255, 255, 0.07);
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  transition:
    transform 140ms ease,
    background 140ms ease,
    border-color 140ms ease;
}

.location-alias-chip:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.14);
}

.location-alias-details {
  display: grid;
  gap: 10px;
}

.location-alias-details[open] .location-alias-summary {
  color: var(--text);
}

.location-alias-summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

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

.location-alias-summary::before {
  content: '▸';
  font-size: 11px;
  line-height: 1;
  transition: transform 140ms ease;
}

.location-alias-details[open] .location-alias-summary::before {
  transform: rotate(90deg);
}

.location-alias-summary:hover {
  color: var(--text);
}

.location-alias-list-expanded {
  padding-top: 2px;
}

.location-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  align-items: center;
}

.copy-coords-button.is-copied {
  border-color: rgba(122, 162, 255, 0.45);
  color: var(--accent);
}

.location-card mark {
  padding: 0 0.18em;
  border-radius: 0.35em;
  background: rgba(255, 214, 10, 0.22);
  color: inherit;
}

@keyframes location-skeleton-shimmer {
  100% {
    transform: translateX(100%);
  }
}

/* ---------- FAQ ---------- */

.faq-panel {
  display: grid;
  gap: 14px;
  padding: 18px;
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.015)),
    var(--panel-soft);
}

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

.faq-item {
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
  overflow: hidden;
}

.faq-item summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 16px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

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

.faq-item summary::after {
  content: '+';
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  flex: 0 0 auto;
}

.faq-item[open] summary::after {
  content: '–';
  color: var(--text);
}

.faq-answer {
  padding: 0 16px 16px;
  color: var(--muted);
  line-height: 1.65;
}

.faq-answer p:first-child {
  margin-top: 0;
}

.faq-answer p:last-child,
.faq-answer ul:last-child {
  margin-bottom: 0;
}

.faq-answer ul {
  padding-left: 18px;
}

/* ---------- Responsive ---------- */

@media (max-width: 840px) {
  .wrap {
    padding: 40px 18px 60px;
  }

  .wrap:not(.locations-page) > .form {
    grid-template-columns: 1fr;
    padding: 16px;
  }

  .locations-search-form {
    grid-template-columns: 1fr;
  }

  .locations-region-header {
    display: grid;
    gap: 6px;
  }
}

@media (max-width: 820px) {
  .location-card-top {
    grid-template-columns: 1fr;
  }

  .location-card-bottom {
    grid-template-columns: 1fr;
  }

  .location-actions {
    justify-content: flex-start;
  }

  .location-preview-frame {
    height: 200px;
  }

  .location-preview-shell {
    min-height: 200px;
  }
}

@media (max-width: 640px) {
  body {
    background:
      radial-gradient(circle at top center, rgba(122, 162, 255, 0.11), transparent 22%),
      linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 55%, var(--bg-3) 100%);
  }

  .wrap {
    padding: 32px 14px 52px;
  }

  .topbar {
    gap: 12px;
    margin-bottom: 18px;
  }

  .subtitle {
    margin-bottom: 22px;
  }

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

  .button-row {
    width: 100%;
  }

  button,
  .button-link {
    width: 100%;
  }

  .map-frame {
    min-height: 260px;
    border-radius: 16px;
  }

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

  .faq-panel {
    padding: 16px;
    border-radius: 18px;
  }

  .faq-item summary {
    padding: 13px 14px;
  }

  .faq-answer {
    padding: 0 14px 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  button,
  .button-link,
  .location-card,
  .location-alias-chip,
  .location-alias-summary,
  .location-preview-frame,
  .location-preview-skeleton {
    transition: none;
    animation: none;
  }

  button:hover,
  .button-link:hover,
  .location-card:hover,
  .location-card:focus-within,
  .location-alias-chip:hover {
    transform: none;
  }
}
