* {
  box-sizing: border-box;
}

:root {
  --bg: #f3f6f9;
  --panel: #ffffff;
  --line: #d9e1e8;
  --text: #163042;
  --muted: #5e7282;
  --accent: #0b66c3;
  --accent-dark: #084e95;
  --shadow: 0 8px 24px rgba(16, 43, 64, 0.08);
  --radius: 16px;
  --radius-sm: 12px;
}

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  min-height: 100vh;
}

button, input, select {
  font: inherit;
}

button {
  appearance: none;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  padding: 12px 14px;
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  box-shadow: 0 2px 10px rgba(16, 43, 64, 0.04);
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(16, 43, 64, 0.08);
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

button.primary:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

input[type="range"] {
  width: 100%;
  margin-top: 8px;
}

select {
  width: 100%;
  margin-top: 8px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

label {
  display: block;
  margin-bottom: 16px;
  color: var(--text);
  font-weight: 600;
}

progress {
  width: 100%;
  height: 10px;
  margin: 12px 0;
}

h1, h2 {
  margin: 0 0 10px;
  line-height: 1.2;
}

h1 {
  font-size: 1.55rem;
}

h2 {
  font-size: 1.02rem;
}

p {
  margin: 0;
}

ul {
  margin: 0;
  padding-left: 18px;
}

.app-shell {
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 18px;
  padding: 18px;
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}

.intro {
  color: var(--muted);
  margin-bottom: 16px;
}

.workflow {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
}

.step {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 12px;
  align-items: start;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fbfcfe;
}

.step.active {
  border-color: #7bb2e9;
  background: #eef6ff;
}

.step.complete {
  border-color: #9fd1b0;
  background: #f3fbf5;
}

.step-number {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: #e8f2ff;
  color: var(--accent);
  font-weight: 800;
}

.step.complete .step-number {
  background: #dff4e5;
  color: #1d7a3f;
}

.step p,
.small,
.muted,
.canvas-header p,
.notes {
  color: var(--muted);
}

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

.stat-grid {
  display: grid;
  gap: 12px;
}

.stat-grid.two-col {
  grid-template-columns: 1fr 1fr;
}

.stat-grid div {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: #fbfcfe;
}

.stat-grid span {
  display: block;
  color: var(--muted);
  font-size: 0.84rem;
  margin-bottom: 4px;
}

.stat-grid strong {
  font-size: 0.96rem;
}

.range-readout {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-weight: 500;
  margin-top: 4px;
}

.checkbox-row {
  margin-top: -6px;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 500;
}

.status {
  min-height: 22px;
  color: var(--muted);
}

.download-link {
  display: inline-block;
  margin-top: 8px;
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.download-link.hidden {
  display: none;
}

.main {
  display: grid;
  grid-template-rows: minmax(440px, 60vh) minmax(280px, 1fr);
  gap: 18px;
}

.map-wrap,
.canvas-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  position: relative;
}

#map {
  width: 100%;
  height: 100%;
  min-height: 440px;
}

.map-overlay {
  position: absolute;
  left: 14px;
  top: 14px;
  z-index: 500;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  pointer-events: none;
}

.pill {
  background: rgba(10, 20, 30, 0.78);
  color: #fff;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.85rem;
  backdrop-filter: blur(8px);
}

.canvas-panel {
  padding: 0 0 14px;
  display: flex;
  flex-direction: column;
}

.canvas-header {
  padding: 16px 18px 10px;
  border-bottom: 1px solid var(--line);
}

#renderCanvas {
  width: calc(100% - 28px);
  max-height: calc(100% - 56px);
  margin: 14px;
  background: linear-gradient(180deg, #dbe8f3, #b8ccdd);
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  object-fit: contain;
}

.notes li + li {
  margin-top: 8px;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .main {
    grid-template-rows: minmax(420px, 52vh) minmax(260px, auto);
  }
}

@media (max-width: 760px) {
  .app-shell {
    padding: 12px;
    gap: 12px;
  }

  .panel {
    padding: 14px;
  }

  .button-row {
    flex-direction: column;
  }

  .stat-grid.two-col {
    grid-template-columns: 1fr;
  }

  #renderCanvas {
    width: calc(100% - 20px);
    margin: 10px;
  }
}
