@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@600;700&display=swap');

:root {
  color-scheme: dark;
  font-family: Inter, "Segoe UI", system-ui, sans-serif;
  color: #e9f0f5;
  background: #09131c;
  --accent: #9bffb0;
  --line: #ffffff20;
  --panel: #0b1723ed;
}

* { box-sizing: border-box; }
body { margin: 0; overflow: hidden; }
[hidden] { display: none !important; }

button, input { font: inherit; }
button, input[type="text"], input:not([type]) {
  min-height: 38px;
}
button {
  color: #e7f1f6;
  border: 1px solid var(--line);
  background: #203244;
  padding: 9px 12px;
  border-radius: 7px;
  cursor: pointer;
}
button:hover { background: #304a5d; border-color: #9bffb080; }
button:disabled { opacity: .4; cursor: not-allowed; }
button.active, .primary {
  color: #07180d;
  background: var(--accent);
  font-weight: 750;
}
button.primary:hover { background: #c1ffcd; }
.danger { background: #63362c; border-color: #ff9b6840; }
input {
  color: #eaf4ff;
  background: #07121c;
  border: 1px solid #ffffff24;
  border-radius: 6px;
  padding: 9px;
  min-width: 0;
  width: 100%;
}
input[type="range"] { padding: 4px 0; accent-color: var(--accent); }
input[type="checkbox"] { width: auto; }
input[type="file"] { font-size: 11px; }
label { display: block; font-size: 12px; flex: 1; margin-top: 10px; }
label input { display: block; margin-top: 6px; }
.check { display: flex; gap: 7px; align-items: center; }
.check input { margin: 0; }
output { float: right; color: var(--accent); }
h1 {
  font: 700 38px/.93 "Barlow Condensed", Impact, sans-serif;
  letter-spacing: .8px;
  margin: 14px 0;
}
h1 span { color: var(--accent); }
h2 { font-size: 21px; }
p { line-height: 1.6; }
pre {
  font-family: ui-monospace, monospace;
  font-size: 11px;
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }
summary { cursor: pointer; font-size: 12px; padding: 8px 0; }
details { margin: 10px 0; }
.row { display: flex; gap: 7px; align-items: center; }
.row > input { flex: 1; }
.row > button { flex-shrink: 0; }
.wide { width: 100%; margin-top: 10px; }
.muted { color: #93aab9; }
.small { font-size: 11px; }
.eyebrow {
  font: 600 10px/1.4 ui-monospace, monospace;
  letter-spacing: 2px;
  color: #9bffb0;
}
.panel {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: 0 16px 50px #0007;
  backdrop-filter: blur(16px);
  padding: 20px;
}

#mapScreen, #worldScreen, #map, #viewport {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
#map { background: #172b36; }
.map-panel {
  position: absolute;
  top: 16px;
  left: 16px;
  width: min(370px, calc(100vw - 32px));
  max-height: calc(100dvh - 64px);
  overflow-y: auto;
  z-index: 500;
}
#searchResults { display: grid; gap: 4px; margin: 7px 0; }
#searchResults button { text-align: left; font-size: 11px; }
#areaInfo { border-left: 2px solid var(--accent); padding-left: 10px; }

.leaflet-control-zoom { margin-right: 20px !important; margin-top: 20px !important; }
.leaflet-control-attribution { max-width: 60vw; }
.area-handle {
  border: 2px solid white;
  background: #2b9851;
  border-radius: 3px;
  box-shadow: 0 2px 6px #0009;
}
.area-center {
  border: 2px solid #082b14;
  background: #afffc2;
  border-radius: 50%;
  color: #082b14;
  text-align: center;
  line-height: 20px;
  font-weight: bold;
}

.world-header {
  position: absolute;
  top: 16px;
  left: 16px;
  right: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
}
.tool-panel {
  position: absolute;
  left: 16px;
  top: 106px;
  bottom: 48px;
  width: 280px;
  overflow-y: auto;
}
.tool-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 12px; }
.tool-grid button { font-size: 11px; text-align: left; }
.stats-panel {
  position: absolute;
  right: 16px;
  top: 106px;
  width: 240px;
  max-height: calc(100dvh - 165px);
  overflow-y: auto;
}
#viewport { display: block; outline: 0; touch-action: none; }
#crosshair {
  position: absolute;
  left: 50%;
  top: 50%;
  color: #ffffff70;
  font-size: 22px;
  pointer-events: none;
}
#showUI { position: absolute; right: 16px; top: 16px; }
body.ui-hidden .hud { display: none; }

#attribution {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 700;
  background: #06101ce8;
  color: #c4d4df;
  padding: 6px 12px;
  font-size: 10px;
  line-height: 1.4;
}
#toast {
  position: fixed;
  bottom: 50px;
  left: 50%;
  transform: translateX(-50%);
  max-width: min(700px, 90vw);
  padding: 14px 20px;
  border: 1px solid #aaffbd80;
  background: #102535f5;
  border-radius: 8px;
  z-index: 2000;
  font-size: 13px;
  white-space: pre-wrap;
}
#loading {
  position: fixed;
  inset: 0;
  background: #03101bc9;
  display: grid;
  place-items: center;
  z-index: 1500;
}
.loading-panel { width: min(560px, 92vw); }
progress { width: 100%; accent-color: var(--accent); height: 12px; }
#loadLog { max-height: 45vh; overflow-y: auto; }
@media (max-width: 950px) {
  .stats-panel { width: 185px; font-size: 10px; }
  .tool-panel { width: 240px; }
  .world-header { flex-wrap: wrap; }
  .world-header button { font-size: 11px; padding: 7px; }
}
@media (max-height: 650px) {
  .panel { padding: 12px; }
  .tool-panel, .stats-panel { top: 94px; }
  h1 { font-size: 30px; }
}
