:root {
  --bg: #efe5d4;
  --bg-deep: #ddc9ab;
  --paper: rgba(255, 250, 242, 0.88);
  --paper-strong: rgba(255, 252, 247, 0.96);
  --paper-soft: rgba(246, 238, 225, 0.78);
  --ink: #192630;
  --muted: #697683;
  --line: rgba(25, 38, 48, 0.14);
  --line-strong: rgba(25, 38, 48, 0.22);
  --primary: #165f58;
  --primary-strong: #0f4742;
  --primary-soft: rgba(22, 95, 88, 0.12);
  --accent: #b86a3e;
  --accent-soft: rgba(184, 106, 62, 0.14);
  --shadow: 0 26px 70px rgba(56, 41, 24, 0.14);
  --shadow-soft: 0 18px 40px rgba(56, 41, 24, 0.08);
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 14px;
  --tile-size: 58px;
  --font-display: "Palatino Linotype", "Book Antiqua", Georgia, serif;
  --font-body: "Aptos", "Segoe UI", "Trebuchet MS", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--font-body);
  background:
    radial-gradient(circle at top left, rgba(184, 106, 62, 0.22), transparent 26%),
    radial-gradient(circle at 84% 12%, rgba(22, 95, 88, 0.2), transparent 28%),
    radial-gradient(circle at 50% 120%, rgba(221, 201, 171, 0.6), transparent 42%),
    linear-gradient(180deg, #f2e8d9 0%, var(--bg) 38%, #ece0cd 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.22;
  background-image:
    linear-gradient(rgba(25, 38, 48, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(25, 38, 48, 0.03) 1px, transparent 1px);
  background-size: 36px 36px;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% -10%, rgba(255, 255, 255, 0.6), transparent 34%),
    linear-gradient(180deg, transparent 0%, rgba(25, 38, 48, 0.05) 100%);
}

.page-shell {
  width: min(1260px, calc(100% - 32px));
  margin: 18px auto 28px;
  position: relative;
  z-index: 1;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.9fr) minmax(240px, 300px);
  gap: 18px;
  align-items: stretch;
  margin-bottom: 18px;
}

.hero-copy,
.hero-card,
.panel {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: var(--radius-xl);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.56), rgba(255, 255, 255, 0.08)),
    var(--paper);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.hero-copy {
  padding: 24px 26px;
}

.hero-copy::after,
.hero-card::after,
.panel::after {
  content: "";
  position: absolute;
  inset: auto -16% -48% auto;
  width: 250px;
  height: 250px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(22, 95, 88, 0.12), transparent 68%);
}

.hero-copy::before,
.hero-card::before,
.panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.22), transparent 32%);
  pointer-events: none;
}

.eyebrow,
.panel-eyebrow,
.hero-card-label,
.stat-label,
.control-label {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-size: 0.82rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

h1,
h2 {
  margin: 0;
  font-family: var(--font-display);
  line-height: 0.94;
  letter-spacing: -0.03em;
}

h1 {
  max-width: none;
  font-size: clamp(2rem, 3vw, 3rem);
}

h2 {
  font-size: clamp(1.7rem, 2vw, 2.25rem);
}

.hero-text,
.helper-text,
.panel-caption {
  color: var(--muted);
}

.hero-text {
  max-width: 56ch;
  margin: 10px 0 0;
  font-size: 0.98rem;
  line-height: 1.5;
}

.hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.hero-badge {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(25, 38, 48, 0.1);
  background: rgba(255, 250, 242, 0.78);
  color: var(--ink);
  font-size: 0.82rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.hero-card {
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 20px 22px;
  background:
    radial-gradient(circle at top right, rgba(255, 255, 255, 0.18), transparent 24%),
    linear-gradient(180deg, rgba(22, 95, 88, 0.96), rgba(15, 71, 66, 0.98)),
    var(--paper);
  color: #f8f2ea;
}

.hero-card::after {
  background: radial-gradient(circle, rgba(255, 255, 255, 0.12), transparent 64%);
}

.hero-card-label,
.hero-card-note {
  color: rgba(248, 242, 234, 0.75);
}

.hero-card-value {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 3vw, 3.2rem);
}

.progress-bar {
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.16);
}

.progress-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #f1d8a7 0%, #f7edcb 100%);
  transition: width 180ms ease;
}

.hero-card-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-top: auto;
  padding-top: 2px;
  color: rgba(248, 242, 234, 0.74);
  font-size: 0.82rem;
}

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

.sidebar,
.content {
  display: grid;
  gap: 16px;
  align-content: start;
}

.panel {
  padding: 20px;
}

.stat-panel {
  display: grid;
  gap: 10px;
}

.stat-card {
  padding: 14px 14px 16px;
  border-radius: var(--radius-lg);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.58), rgba(255, 255, 255, 0.16)),
    rgba(255, 250, 240, 0.84);
  border: 1px solid rgba(25, 38, 48, 0.1);
  box-shadow: var(--shadow-soft);
}

.stat-value {
  display: block;
  font-family: var(--font-display);
  font-size: 1.75rem;
}

.stat-value-small {
  font-size: 1.1rem;
  line-height: 1.2;
}

.controls-panel {
  display: grid;
  gap: 14px;
}

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

.text-input,
.select-input {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid rgba(25, 38, 48, 0.12);
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.56), rgba(255, 255, 255, 0.08)),
    rgba(255, 250, 240, 0.92);
  color: var(--ink);
  font: inherit;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.text-input:focus,
.select-input:focus,
.view-button:focus,
.state-toggle:focus,
.map-tile:focus,
.secondary-button:focus,
.primary-button:focus {
  outline: 3px solid rgba(20, 99, 86, 0.18);
  outline-offset: 2px;
}

.content-toolbar {
  display: flex;
  justify-content: flex-start;
}

.view-toggle {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 6px;
  width: min(100%, 700px);
  border-radius: 18px;
  background: rgba(25, 38, 48, 0.05);
  border: 1px solid rgba(25, 38, 48, 0.08);
}

.view-button,
.secondary-button,
.primary-button,
.map-tile,
.state-toggle {
  border: 0;
  cursor: pointer;
}

.view-button {
  padding: 10px 12px;
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 0.9rem;
  transition:
    transform 120ms ease,
    background-color 120ms ease,
    color 120ms ease,
    box-shadow 120ms ease;
}

.view-button.is-active {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.18), transparent),
    var(--primary);
  color: #fff9ee;
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(22, 95, 88, 0.22);
}

.action-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.secondary-button,
.primary-button {
  padding: 11px 14px;
  border-radius: 14px;
  font-family: var(--font-display);
  font-size: 0.92rem;
  box-shadow: var(--shadow-soft);
}

.secondary-button {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.5), transparent),
    rgba(29, 42, 52, 0.08);
  color: var(--ink);
}

.primary-button {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.18), transparent),
    linear-gradient(135deg, #c6784d, var(--accent));
  color: #fff5ed;
}

.helper-text {
  min-height: 1.4em;
  margin: 0;
  font-size: 0.88rem;
  padding: 2px 2px 0;
}

.panel-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(25, 38, 48, 0.08);
}

.state-list {
  display: grid;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.state-row {
  display: grid;
}

.state-toggle {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.5), transparent),
    rgba(255, 250, 240, 0.76);
  text-align: left;
  transition:
    transform 120ms ease,
    background-color 120ms ease,
    border-color 120ms ease,
    box-shadow 120ms ease;
  border: 1px solid rgba(25, 38, 48, 0.1);
  box-shadow: var(--shadow-soft);
}

.state-toggle:hover,
.map-tile:hover {
  transform: translateY(-2px);
}

.state-toggle.is-visited {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.24), transparent),
    rgba(22, 95, 88, 0.12);
  border-color: rgba(20, 99, 86, 0.3);
}

.state-check {
  width: 18px;
  height: 18px;
  border-radius: 6px;
  border: 1px solid rgba(29, 42, 52, 0.18);
  background: #fffdf8;
  position: relative;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.state-toggle.is-visited .state-check {
  background: var(--primary);
  border-color: var(--primary);
}

.state-toggle.is-visited .state-check::after {
  content: "";
  position: absolute;
  inset: 4px 3px 4px 6px;
  border-right: 2px solid #fff9ee;
  border-bottom: 2px solid #fff9ee;
  transform: rotate(37deg);
}

.state-name {
  display: block;
  font-family: var(--font-display);
  font-size: 1rem;
}

.state-meta,
.state-status {
  color: var(--muted);
  font-size: 0.84rem;
}

.state-status {
  font-family: var(--font-display);
}

.map-wrap {
  overflow-x: auto;
  padding: 6px 4px 8px;
  border-radius: 18px;
  background: rgba(255, 250, 240, 0.44);
}

.tile-map {
  display: grid;
  grid-template-columns: repeat(12, var(--tile-size));
  grid-template-rows: repeat(8, var(--tile-size));
  gap: 10px;
  min-width: max-content;
  align-items: center;
}

.map-tile {
  display: grid;
  place-items: center;
  width: var(--tile-size);
  height: var(--tile-size);
  padding: 6px;
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.5), transparent),
    rgba(255, 250, 240, 0.84);
  border: 1px solid rgba(25, 38, 48, 0.1);
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 0.98rem;
  grid-column: var(--col);
  grid-row: var(--row);
  transition:
    transform 120ms ease,
    background-color 120ms ease,
    border-color 120ms ease,
    color 120ms ease,
    box-shadow 120ms ease;
  box-shadow: var(--shadow-soft);
}

.map-tile.is-visited {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), transparent),
    var(--primary);
  border-color: transparent;
  color: #fff9ee;
}

.map-tile.is-filtered-out {
  opacity: 0.32;
}

.map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
  color: var(--muted);
}

.map-legend span {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 250, 240, 0.66);
  border: 1px solid rgba(25, 38, 48, 0.08);
  font-size: 0.86rem;
}

.leaflet-map {
  height: 500px;
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid rgba(25, 38, 48, 0.12);
  box-shadow: var(--shadow-soft);
  background:
    radial-gradient(circle at 20% 80%, rgba(22, 95, 88, 0.14), transparent 26%),
    radial-gradient(circle at 80% 18%, rgba(184, 106, 62, 0.1), transparent 22%),
    linear-gradient(180deg, #e6efec 0%, #edf2eb 100%);
}

.leaflet-container {
  font-family: var(--font-display);
}

.leaflet-control-attribution {
  background: rgba(255, 250, 240, 0.82);
  color: var(--muted);
}

.leaflet-control-zoom a {
  background: rgba(255, 252, 247, 0.94);
  color: var(--ink);
  border-bottom-color: rgba(25, 38, 48, 0.08);
}

.leaflet-control-zoom a:hover {
  background: #fffdf8;
}

.leaflet-tooltip.state-tooltip {
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(29, 42, 52, 0.1);
  background: rgba(255, 250, 240, 0.94);
  color: var(--ink);
  box-shadow: 0 12px 28px rgba(35, 31, 24, 0.1);
}

.leaflet-tooltip.state-tooltip::before {
  display: none;
}

.legend-swatch {
  display: inline-block;
  width: 16px;
  height: 16px;
  margin-right: 8px;
  border-radius: 6px;
  vertical-align: -3px;
  border: 1px solid var(--line);
}

.legend-swatch-visited {
  background: var(--primary);
  border-color: transparent;
}

.legend-swatch-open {
  background: rgba(255, 250, 240, 0.84);
}

.empty-state {
  margin: 0;
  padding: 36px 18px;
  border: 1px dashed rgba(29, 42, 52, 0.2);
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.46), transparent),
    rgba(255, 250, 240, 0.62);
  text-align: center;
  color: var(--muted);
}

.is-hidden {
  display: none;
}

.hero-copy,
.hero-card,
.panel {
  animation: rise-in 480ms ease both;
}

.hero-card {
  animation-delay: 70ms;
}

.sidebar .panel:nth-child(2) {
  animation-delay: 100ms;
}

.content .panel {
  animation-delay: 140ms;
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(14px);
  }

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

@media (prefers-reduced-motion: reduce) {
  .hero-copy,
  .hero-card,
  .panel,
  .view-button,
  .state-toggle,
  .map-tile,
  .progress-fill {
    animation: none;
    transition: none;
  }
}

@media (max-width: 980px) {
  .hero,
  .app-grid {
    grid-template-columns: 1fr;
  }

  .page-shell {
    width: min(100% - 20px, 1200px);
    margin-top: 12px;
  }

  .hero-copy,
  .hero-card,
  .panel {
    border-radius: 24px;
  }
}

@media (max-width: 720px) {
  :root {
    --tile-size: 48px;
  }

  .hero-copy,
  .hero-card,
  .panel {
    padding: 18px;
  }

  .hero-badges {
    gap: 8px;
  }

  .panel-heading {
    flex-direction: column;
    align-items: start;
  }

  .action-row,
  .view-toggle {
    grid-template-columns: 1fr;
  }

  .leaflet-map {
    height: 400px;
  }

  .state-toggle {
    grid-template-columns: auto 1fr;
  }

  .state-status {
    grid-column: 2;
  }
}
