:root {
  color-scheme: light;
  --ink: #0b0f1a;
  --muted: #5a6475;
  --accent: #d25f3d;
  --accent-2: #3c6f9e;
  --panel: #f5f1e8;
  --panel-border: #d7cbb8;
  --map-shadow: rgba(11, 15, 26, 0.2);
  --bg: #f1ede4;
  --font-display: "Fraunces", "Iowan Old Style", "Palatino Linotype", serif;
  --font-body: "Work Sans", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: radial-gradient(circle at top left, #ffffff 0%, var(--bg) 55%);
  color: var(--ink);
  font-family: var(--font-body);
}

.app {
  display: grid;
  grid-template-columns: minmax(260px, 320px) 1fr;
  min-height: 100vh;
  height: 100vh;
}

.panel {
  padding: 28px 24px;
  background: var(--panel);
  border-right: 1px solid var(--panel-border);
  box-shadow: 8px 0 24px var(--map-shadow);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: conic-gradient(from 120deg, var(--accent), var(--accent-2), #9a7b4f);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.5);
}

.brand-text h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.5rem;
}

.brand-text p {
  margin: 4px 0 0;
  color: var(--muted);
}

.controls {
  display: grid;
  gap: 12px;
}

.btn {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--panel-border);
  background: #fffaf2;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
}

.btn.primary {
  background: var(--accent);
  color: #ffffff;
  border-color: transparent;
}

.btn.ghost {
  background: transparent;
}

.section {
  display: grid;
  gap: 10px;
}

.section-title {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.7rem;
  color: var(--muted);
}

label {
  font-weight: 600;
}

.input-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  cursor: pointer;
}

.checkbox-row input {
  accent-color: var(--accent);
}

input[type="number"] {
  width: 120px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--panel-border);
  background: #fff;
  font-weight: 600;
}

.unit {
  color: var(--muted);
}

.stat {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#area-stat {
  display: none;
}

.value {
  font-weight: 700;
  font-size: 1.1rem;
}

.hint {
  color: var(--muted);
  margin: 0;
  font-size: 0.9rem;
}

.tip {
  margin: 0;
  padding: 12px;
  border-left: 4px solid var(--accent-2);
  background: rgba(60, 111, 158, 0.1);
  font-size: 0.9rem;
}

.point-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
  max-height: 220px;
  overflow-y: auto;
}

.point-item {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--panel-border);
  background: #fffaf2;
  display: grid;
  gap: 6px;
  font-size: 0.85rem;
}

.point-meta {
  display: flex;
  justify-content: space-between;
  font-weight: 700;
}

.point-coords {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.point-distance {
  display: flex;
  justify-content: space-between;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.point-actions {
  display: flex;
  justify-content: flex-end;
}

.delete-point {
  border: 1px solid var(--panel-border);
  background: #fff;
  color: var(--muted);
  font-size: 0.75rem;
  padding: 4px 8px;
  border-radius: 999px;
  cursor: pointer;
}

.delete-point:hover {
  color: var(--ink);
  border-color: var(--accent);
}

.point-empty {
  color: var(--muted);
  font-size: 0.85rem;
}

#map {
  width: 100%;
  height: 100%;
}

.leaflet-container {
  background: #cfe2ec;
}

.measure-node {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #f5f1e8;
  border: 2px solid #0b0f1a;
  box-shadow: 0 0 0 2px rgba(210, 95, 61, 0.2);
}

.segment-tooltip {
  background: rgba(11, 15, 26, 0.9);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 4px 8px;
  font-weight: 600;
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}

@media (max-width: 900px) {
  .app {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  .panel {
    border-right: none;
    border-bottom: 1px solid var(--panel-border);
  }

}
