:root {
  --bg: #0a0d12;
  --surface: rgba(17, 21, 29, 0.92);
  --surface-strong: #161c25;
  --ink: #edf3fb;
  --muted: #97a5b8;
  --line: rgba(237, 243, 251, 0.1);
  --accent: #7e8b99;
  --accent-strong: #bcc6cf;
  --accent-soft: rgba(126, 139, 153, 0.16);
  --warm: #f4b860;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.34);
  --radius-lg: 22px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --max-width: 1200px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  color-scheme: dark;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Public Sans", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(126, 139, 153, 0.12), transparent 26%),
    radial-gradient(circle at top right, rgba(244, 184, 96, 0.1), transparent 18%),
    linear-gradient(180deg, #0f131a 0%, #0a0d12 42%, #06080b 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(237, 243, 251, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(237, 243, 251, 0.025) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.25), transparent 80%);
}

.lock-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.lock-card {
  width: min(100%, 360px);
  display: grid;
  gap: 12px;
  padding: 24px;
  border-radius: 24px;
  backdrop-filter: blur(16px);
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: var(--shadow);
}

.lock-label {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-strong);
}

.lock-title {
  margin: 0 0 4px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.4rem;
  line-height: 1.15;
}

.lock-message {
  min-height: 1.2em;
  margin: 0;
  color: var(--warm);
  font-size: 0.92rem;
}

.page-shell {
  width: min(calc(100vw - 24px), var(--max-width));
  margin: 0 auto;
  padding: 12px 0 18px;
}

@media (max-width: 719px) {
  .page-shell {
    width: min(calc(100vw - 4px), var(--max-width));
  }

  .toolbar {
    padding: 8px 4px;
  }

  .tab-bar {
    padding: 0 4px 8px;
  }

  .locations-list {
    padding: 10px 4px;
  }

  .empty-state,
  .map-status {
    padding: 10px 4px 0;
  }

  .map-toolbar {
    top: 8px;
    right: 4px;
  }
}

.app-frame {
  backdrop-filter: blur(16px);
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: var(--shadow);
}

h2,
.tab-button,
.block-filter-button,
.location-card h3 {
  font-family: "Space Grotesk", sans-serif;
}

input,
button,
a {
  font: inherit;
}

input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 11px 14px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
}

input::placeholder {
  color: #748296;
}

input:focus {
  outline: 3px solid rgba(126, 139, 153, 0.18);
  border-color: rgba(126, 139, 153, 0.5);
}

button {
  cursor: pointer;
  border: 0;
  border-radius: 999px;
  padding: 11px 14px;
  transition:
    transform 150ms ease,
    background-color 150ms ease,
    opacity 150ms ease;
}

button:hover,
button:focus-visible,
.location-card:focus-visible,
.map-popup-link:focus-visible {
  transform: translateY(-1px);
}

.primary-button {
  background: var(--accent);
  color: #f5f7fa;
  font-weight: 700;
}

.primary-button:hover,
.primary-button:focus-visible {
  background: var(--accent-strong);
}

.secondary-button {
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  border: 1px solid var(--line);
}

.text-link {
  color: var(--accent-strong);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.18em;
}

.sheet-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.status-message {
  margin: 0;
  font-size: 0.92rem;
  color: var(--muted);
}

.app-frame {
  border-radius: 24px;
  overflow: hidden;
}

.toolbar {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.toolbar-copy {
  display: grid;
  gap: 4px;
}

.toolbar h2 {
  margin: 0;
  font-size: clamp(1.16rem, 2.1vw, 1.4rem);
}

.toolbar-actions {
  display: grid;
  gap: 8px;
}

.search-field {
  display: block;
}

.tab-bar {
  display: flex;
  gap: 8px;
  padding: 0 12px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.tab-button,
.block-filter-button {
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  min-height: 30px;
  padding: 5px 11px;
  font-size: 0.92rem;
}

.block-filter-button {
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.035);
}

.tab-button.is-active {
  background: rgba(126, 139, 153, 0.14);
  color: var(--accent-strong);
}

.block-filter-button.is-active {
  background: rgba(126, 139, 153, 0.2);
  color: var(--ink);
  border-color: rgba(126, 139, 153, 0.4);
}

.block-filter-button.is-unavailable:not(.is-active) {
  opacity: 0.38;
}

.panel {
  display: none;
  min-height: 60vh;
}

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

.locations-list {
  display: grid;
  gap: 10px;
  padding: 16px;
}

.locations-list-compact {
  padding-top: 0;
  padding-bottom: 8px;
}

.location-card {
  display: grid;
  gap: 8px;
  width: 100%;
  text-align: left;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.02)),
    var(--surface-strong);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
  align-self: start;
}

.location-card.is-expandable {
  cursor: pointer;
}

.location-card.is-expanded {
  border-color: rgba(126, 139, 153, 0.18);
  grid-column: 1 / -1;
}

.location-card h3 {
  margin: 0;
  font-size: 1.02rem;
}

.location-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.4;
  font-size: 0.94rem;
}

.location-card .location-name {
  color: #d4dce3;
  font-weight: 600;
}

.main-location-trigger {
  display: grid;
  gap: 8px;
  padding: 2px 0;
  border-radius: 12px;
}

.main-location-trigger.is-selected {
  padding: 8px 10px;
  background: rgba(126, 139, 153, 0.08);
  border: 1px solid rgba(126, 139, 153, 0.24);
}

.card-expand-hint {
  color: var(--accent-strong);
  font-size: 0.8rem;
}

.location-card .meta-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.location-card .chip {
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 700;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 4px;
}

.card-action-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 6px 12px;
  text-decoration: none;
  border-radius: 999px;
  line-height: 1;
}

.card-actions .primary-button {
  padding-inline: 16px;
}

.location-card-details {
  display: grid;
  gap: 12px;
  padding-top: 8px;
  margin-top: 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.detail-section {
  display: grid;
  gap: 8px;
}

.detail-section-label {
  margin: 0;
  color: var(--accent-strong);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

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

.detail-location-item {
  display: grid;
  gap: 6px;
  padding: 9px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  cursor: pointer;
}

.detail-location-item.is-selected {
  border-color: rgba(126, 139, 153, 0.24);
  background: rgba(126, 139, 153, 0.08);
}

.detail-location-name,
.detail-location-address {
  margin: 0;
}

.detail-location-type {
  margin: 0;
  color: var(--accent-strong);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.detail-location-name {
  color: var(--ink);
  font-weight: 600;
}

.detail-location-address {
  color: var(--muted);
  font-size: 0.9rem;
}

.detail-location-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 2px;
}

.detail-map-status {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.detail-mini-map {
  width: 100%;
  height: 320px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: #13181f;
}

.detail-mini-map .leaflet-container {
  width: 100%;
  height: 100%;
  border-radius: 14px;
}

.location-card .hint {
  color: var(--warm);
  font-size: 0.76rem;
  font-weight: 700;
}

.empty-state,
.map-status {
  padding: 10px 12px 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.map-stage {
  position: relative;
  margin-top: 8px;
}

.map-toolbar {
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 500;
  display: flex;
  justify-content: flex-end;
}

.map-style-switcher {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px;
  border-radius: 999px;
  background: rgba(7, 18, 37, 0.7);
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.24);
}

.map-style-button {
  min-height: 28px;
  padding: 4px 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font-weight: 700;
  font-size: 0.85rem;
}

.map-style-button.is-active {
  background: rgba(126, 139, 153, 0.14);
  color: var(--accent-strong);
  border-color: rgba(126, 139, 153, 0.24);
}

.map-results {
  padding-top: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.map-canvas {
  width: 100%;
  height: 60vh;
  min-height: 360px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.leaflet-container {
  font-family: "Public Sans", sans-serif;
  background: #13181f;
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  background: #252c35;
  color: var(--ink);
}

.leaflet-popup-content-wrapper {
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.35);
}

.leaflet-popup-content {
  margin: 14px 16px;
}

.leaflet-popup-close-button {
  color: #c1c9d2 !important;
}

.leaflet-popup-close-button:hover {
  color: #ffffff !important;
}

.map-popup {
  display: grid;
  gap: 10px;
}

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

.map-popup-item {
  display: grid;
  gap: 6px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.map-popup-item:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.map-popup-title {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent-strong);
}

.map-popup-detail {
  margin: 0;
  color: var(--ink);
  line-height: 1.35;
}

@media (min-width: 720px) {
  .toolbar {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
  }
}

@media (min-width: 880px) {
  .locations-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (prefers-reduced-motion: no-preference) {
  .app-frame,
  .location-card {
    animation: rise 380ms ease-out both;
  }

  .location-card:nth-child(2n) {
    animation-delay: 60ms;
  }

  .location-card:nth-child(3n) {
    animation-delay: 120ms;
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}
