:root {
  --bg: #06111d;
  --bg-soft: #0c1928;
  --panel: rgba(7, 17, 29, 0.84);
  --panel-strong: rgba(9, 19, 31, 0.96);
  --panel-border: rgba(135, 179, 211, 0.16);
  --text-main: #eef7ff;
  --text-soft: #9ab0c4;
  --accent: #ff9f68;
  --accent-2: #67d3ff;
  --success: #8ff0c0;
  --danger: #ff8f80;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.32);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(54, 116, 201, 0.2), transparent 32%),
    radial-gradient(circle at bottom right, rgba(255, 159, 104, 0.14), transparent 28%),
    linear-gradient(155deg, #04101b, #081524 48%, #04111b 100%);
  color: var(--text-main);
  font-family: "Space Grotesk", sans-serif;
}

body {
  position: relative;
  overflow: hidden;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 26px 26px;
  mask-image: radial-gradient(circle at center, black 55%, transparent 100%);
  opacity: 0.42;
}

.app-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(21rem, 28rem) minmax(0, 1fr);
  gap: 1.1rem;
  min-height: 100vh;
  padding: 1rem;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
  min-height: 0;
}

.sidebar__hero,
.panel,
.map-shell {
  border: 1px solid var(--panel-border);
  border-radius: 1.35rem;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.sidebar__hero,
.panel {
  padding: 1rem 1.05rem;
}

.sidebar__hero h1,
.map-shell h2,
.panel h2 {
  margin: 0;
  line-height: 1.03;
}

.sidebar__hero h1 {
  font-size: clamp(2rem, 4vw, 3rem);
}

.eyebrow,
.section-heading__eyebrow,
.map-shell__eyebrow {
  margin: 0 0 0.35rem;
  color: var(--accent-2);
  font-size: 0.75rem;
  font-family: "IBM Plex Mono", monospace;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.intro,
.section-heading p,
.toggle small,
.status,
.point-meta,
.metric-pill__label,
.selection-chip {
  color: var(--text-soft);
}

.intro,
.section-heading p {
  margin: 0.45rem 0 0;
  line-height: 1.5;
}

.metrics-panel {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.metric-pill {
  padding: 0.85rem 0.9rem;
  border-radius: 1rem;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.metric-pill strong {
  display: block;
  margin-top: 0.25rem;
  font-size: 1rem;
}

.metric-pill__label {
  display: block;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.73rem;
  letter-spacing: 0.06em;
}

.section-heading {
  display: grid;
  gap: 0.2rem;
}

.toggle {
  display: flex;
  justify-content: space-between;
  gap: 0.9rem;
  align-items: center;
  margin-top: 1rem;
  padding: 0.9rem 1rem;
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.toggle span {
  display: grid;
  gap: 0.2rem;
}

.toggle input {
  width: 1.25rem;
  height: 1.25rem;
  accent-color: var(--accent-2);
}

.button-grid,
.form-actions,
.field-row {
  display: grid;
  gap: 0.7rem;
}

.button-grid {
  margin-top: 1rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.point-form {
  display: grid;
  gap: 0.85rem;
  margin-top: 1rem;
}

label {
  display: grid;
  gap: 0.38rem;
  font-size: 0.85rem;
  color: var(--text-soft);
}

input[type="text"],
input[type="number"],
input[type="color"] {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 0.9rem;
  background: rgba(1, 8, 16, 0.8);
  color: var(--text-main);
  padding: 0.72rem 0.82rem;
}

input[type="number"],
input[type="text"] {
  font-family: "IBM Plex Mono", monospace;
}

input[type="color"] {
  padding: 0.3rem;
  min-height: 3rem;
}

input:focus {
  outline: 2px solid rgba(103, 211, 255, 0.6);
  outline-offset: 1px;
}

button {
  border: 0;
  border-radius: 0.95rem;
  padding: 0.78rem 0.95rem;
  background: linear-gradient(135deg, var(--accent), #ffd09c);
  color: #09131c;
  font-weight: 700;
  transition: transform 120ms ease, filter 120ms ease;
}

button:hover {
  filter: brightness(1.04);
}

button:active {
  transform: translateY(1px);
}

.button-muted,
.point-card__focus {
  background: linear-gradient(135deg, #bceaff, #6ec6ff);
}

.point-card__remove,
.status[data-tone="error"] {
  background: linear-gradient(135deg, #ffc0a9, #ff8b7a);
}

.panel--stretch {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.status {
  margin: 1rem 0 0;
  padding: 0.8rem 0.9rem;
  border-radius: 0.95rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  min-height: 3.4rem;
  line-height: 1.4;
}

.status[data-tone="success"] {
  color: var(--success);
}

.status[data-tone="error"] {
  color: #081119;
}

.points-list {
  list-style: none;
  padding: 0;
  margin: 0.85rem 0 0;
  display: grid;
  gap: 0.75rem;
  overflow: auto;
}

.point-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  padding: 0.85rem 0.9rem;
  border-radius: 1rem;
  background: rgba(1, 8, 16, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.point-card__main {
  display: grid;
  gap: 0.2rem;
}

.point-card__title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0;
  font-size: 1rem;
}

.point-card__swatch {
  width: 0.8rem;
  height: 0.8rem;
  border-radius: 999px;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08);
}

.point-meta {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.77rem;
  line-height: 1.45;
}

.point-card__actions {
  display: grid;
  align-content: start;
  gap: 0.5rem;
}

.point-card__actions button {
  padding-inline: 0.8rem;
}

.empty-state {
  padding: 1rem;
  border-radius: 1rem;
  border: 1px dashed rgba(255, 255, 255, 0.14);
  color: var(--text-soft);
  text-align: center;
}

.map-shell {
  position: relative;
  overflow: hidden;
  padding: 0.85rem;
  background:
    radial-gradient(circle at top, rgba(103, 211, 255, 0.14), transparent 30%),
    rgba(5, 14, 24, 0.88);
}

.map-shell__header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: start;
  padding: 0.3rem 0.2rem 0.85rem;
}

.map-shell__header h2 {
  font-size: 1.35rem;
}

.selection-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.7rem 0.85rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.76rem;
}

.map-canvas {
  width: 100%;
  height: calc(100vh - 3.4rem);
  border-radius: 1rem;
  overflow: hidden;
  background: #020812;
}

.maplibregl-map {
  font-family: "Space Grotesk", sans-serif;
}

.maplibregl-ctrl-group {
  border-radius: 0.9rem;
  overflow: hidden;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.24);
}

.maplibregl-ctrl button {
  border-radius: 0;
}

.maplibregl-popup-content {
  border-radius: 0.95rem;
  padding: 0.75rem 0.9rem;
  font-family: "Space Grotesk", sans-serif;
}

@media (max-width: 1100px) {
  body {
    overflow: auto;
  }

  .app-shell {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .map-canvas {
    height: 70vh;
  }
}

@media (max-width: 640px) {
  .app-shell {
    padding: 0.7rem;
  }

  .metrics-panel,
  .button-grid,
  .field-row {
    grid-template-columns: 1fr;
  }

  .map-shell__header {
    flex-direction: column;
  }

  .selection-chip {
    width: 100%;
    justify-content: center;
  }

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

  .point-card__actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
