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

:root {
  --bg:       #0a0a0a;
  --surface:  #141414;
  --border:   rgba(255,255,255,0.08);
  --text:     #ffffff;
  --muted:    rgba(255,255,255,0.4);
  --accent:   #f97316;
  --accent-h: #fb923c;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  min-height: 100vh;
  max-width: 1200px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 6rem;
}

/* ── Header ── */
.eyebrow {
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 1.25rem;
}

h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
  margin-bottom: 1rem;
}

.tagline {
  font-size: 1rem;
  color: var(--muted);
  line-height: 1.55;
  max-width: 480px;
  margin-bottom: 2.5rem;
}

/* ── Section prompt labels ── */
.prompt {
  display: block;
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  padding: 0.875rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

/* ── Input container ── */
.input-container {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
}

.section-upload,
.section-parameters {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
}

.section-upload { flex: 1; }
.section-parameters { flex: 1.8; }

/* ── File input ── */
.field {
  padding: 1rem 1.25rem;
}

input[type="file"] {
  width: 100%;
  font-size: 0.875rem;
  color: var(--muted);
  font-family: inherit;
  cursor: pointer;
  background: transparent;
  border: none;
  outline: none;
}

input[type="file"]::file-selector-button {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.35rem 0.875rem;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  margin-right: 0.75rem;
  transition: background 0.15s;
}

input[type="file"]::file-selector-button:hover {
  background: var(--accent-h);
}

/* ── Parameters ── */
.parameters-grid {
  padding: 1rem 1.25rem;
}

.parameters-grid > label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 0.875rem;
}

input[type="number"] {
  width: 60px;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: 0.9375rem;
  font-family: ui-monospace, 'SF Mono', monospace;
  text-align: right;
  padding: 0.125rem 0;
  outline: none;
}

input[type="number"]:focus {
  border-bottom-color: var(--accent);
}

input[type="range"] {
  width: 150px;
  appearance: none;
  -webkit-appearance: none;
  height: 4px;
  background: rgba(255,255,255,0.12);
  border-radius: 2px;
  outline: none;
  border: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: none;
}

#consistencyValue {
  font-family: ui-monospace, 'SF Mono', monospace;
  color: var(--text);
  font-size: 0.875rem;
}

.parameters-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 0.875rem;
  border-top: 1px solid var(--border);
  margin-top: 0.25rem;
}

.help-text {
  font-size: 0.75rem;
  color: var(--muted);
  max-width: 340px;
}

.controls {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  margin-left: 1rem;
}

button {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 0.55rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  letter-spacing: -0.01em;
  transition: background 0.15s, opacity 0.15s;
}

button:hover:not(:disabled) { background: var(--accent-h); }
button:disabled { opacity: 0.45; cursor: not-allowed; }

/* ── Results container ── */
.results-container {
  display: flex;
  gap: 1rem;
  height: 520px;
}

#results {
  flex: 1;
  min-width: 300px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#map-container {
  flex: 1;
  min-width: 300px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ── Terminal output ── */
.terminal-output {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.25rem;
  font-family: ui-monospace, 'SF Mono', monospace;
  font-size: 0.8125rem;
  line-height: 1.6;
  color: var(--text);
  white-space: pre-wrap;
}

/* ── Map ── */
#map {
  flex: 1;
  min-height: 200px;
}

/* ── Leaflet overrides ── */
.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  background: rgba(20, 20, 20, 0.95);
  color: var(--text);
  border-radius: 10px;
  border: 1px solid var(--border);
  box-shadow: 0 4px 24px rgba(0,0,0,0.5);
}

.leaflet-popup-content {
  margin: 10px 14px;
  font-family: ui-monospace, 'SF Mono', monospace;
  font-size: 0.75rem;
  line-height: 1.5;
}

.leaflet-popup-content strong { color: var(--accent); }

.leaflet-control-zoom a {
  background: rgba(20,20,20,0.9) !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
  border-radius: 8px !important;
}

.leaflet-control-zoom a:hover { background: #1c1c1c !important; }

.leaflet-control-attribution {
  background: rgba(20,20,20,0.7) !important;
  color: var(--muted) !important;
  font-size: 0.625rem !important;
}

.leaflet-control-attribution a { color: var(--muted) !important; }

.leaflet-interactive:hover {
  stroke-width: 3px !important;
  stroke: var(--accent) !important;
}

/* ── Terminal output buttons ── */
.terminal-output button {
  background: transparent;
  color: var(--accent);
  border: 1px solid rgba(249,115,22,0.3);
  border-radius: 6px;
  padding: 0.25rem 0.625rem;
  font-size: 0.75rem;
  font-family: ui-monospace, 'SF Mono', monospace;
  margin-top: 0.5rem;
  letter-spacing: 0;
  transition: background 0.15s, border-color 0.15s;
}

.terminal-output button:hover {
  background: rgba(249,115,22,0.1);
  border-color: rgba(249,115,22,0.6);
}

/* ── Tables ── */
table {
  border-collapse: collapse;
  width: 100%;
  margin: 0.75rem 0;
  font-family: ui-monospace, 'SF Mono', monospace;
  font-size: 0.75rem;
}

th, td {
  text-align: left;
  padding: 0.375rem 0.5rem;
  border-bottom: 1px solid var(--border);
}

th {
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ── Status indicators ── */
.status-indicator {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 4px;
}

.status-normal   { background: #22c55e; }
.status-warning  { background: var(--accent); }
.status-critical { background: #ef4444; }

/* ── Footer ── */
.site-footer {
  margin-top: 2.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.8125rem;
  color: var(--muted);
}

.site-footer a {
  color: rgba(255,255,255,0.55);
  text-decoration: none;
  transition: color 0.15s;
}

.site-footer a:hover { color: var(--accent); }
