:root {
  --panel-bg: rgba(20, 24, 22, 0.82);
  --panel-fg: #f2f0ea;
  --accent: #c8a468;
  --radius: 10px;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #1a1d1b;
  color: var(--panel-fg);
}

#app, #app canvas { position: fixed; inset: 0; }

.hidden { display: none !important; }

#topbar {
  position: fixed;
  top: 12px;
  left: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  gap: 16px;
  z-index: 10;
  pointer-events: none;
}

#topbar h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.04em;
  background: var(--panel-bg);
  padding: 8px 14px;
  border-radius: var(--radius);
  backdrop-filter: blur(6px);
}

#topbar nav {
  display: flex;
  gap: 8px;
  pointer-events: auto;
}

button {
  background: var(--panel-bg);
  color: var(--panel-fg);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius);
  padding: 8px 14px;
  font-size: 14px;
  cursor: pointer;
  backdrop-filter: blur(6px);
}

button:hover { border-color: var(--accent); }

button.active {
  background: var(--accent);
  color: #1a1d1b;
  border-color: var(--accent);
  font-weight: 600;
}

#crosshair {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 22px;
  color: rgba(255, 255, 255, 0.85);
  text-shadow: 0 0 4px rgba(0, 0, 0, 0.8);
  z-index: 5;
  pointer-events: none;
}

#measure-panel, #help-panel {
  position: fixed;
  left: 12px;
  bottom: 12px;
  max-width: 340px;
  background: var(--panel-bg);
  border-radius: var(--radius);
  padding: 12px 16px;
  z-index: 10;
  backdrop-filter: blur(6px);
  font-size: 14px;
  line-height: 1.5;
}

#help-panel { left: auto; right: 12px; }

#help-panel table { border-collapse: collapse; margin: 8px 0; }
#help-panel td { padding: 2px 8px 2px 0; vertical-align: top; }

kbd {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 4px;
  padding: 0 5px;
  font-size: 12px;
}

.note { opacity: 0.7; font-size: 12px; }

#measure-readout { margin: 8px 0; white-space: pre-line; }
.measure-actions { display: flex; gap: 8px; }
.measure-actions button { padding: 5px 10px; font-size: 13px; }

#measure-total { color: var(--accent); font-weight: 600; }

.measure-label {
  background: rgba(20, 24, 22, 0.85);
  color: var(--accent);
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
}

#poi-panel {
  position: fixed;
  top: 64px;
  left: 12px;
  width: 240px;
  background: var(--panel-bg);
  border-radius: var(--radius);
  padding: 12px 14px;
  z-index: 10;
  backdrop-filter: blur(6px);
  font-size: 14px;
}

#poi-list {
  list-style: none;
  margin: 8px 0;
  padding: 0;
  max-height: 40vh;
  overflow-y: auto;
}

#poi-list li {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

#poi-list .poi-go {
  flex: 1;
  text-align: left;
  padding: 6px 10px;
}

#poi-list .poi-del {
  padding: 6px 9px;
  font-size: 12px;
  opacity: 0.7;
}

#poi-list .poi-del:hover { opacity: 1; border-color: #d66; }

#btn-poi-save { width: 100%; }

#poi-panel .empty { opacity: 0.6; font-size: 13px; margin: 6px 0; }

#cut-panel {
  position: fixed;
  top: 64px;
  right: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--panel-bg);
  border-radius: var(--radius);
  padding: 10px 14px;
  z-index: 10;
  backdrop-filter: blur(6px);
  font-size: 13px;
}

#cut-panel input[type="range"] {
  width: 150px;
  accent-color: var(--accent);
}

#cut-value { min-width: 62px; color: var(--accent); font-weight: 600; }

#settings-panel {
  position: fixed;
  top: 120px;
  right: 12px;
  width: 270px;
  background: var(--panel-bg);
  border-radius: var(--radius);
  padding: 12px 14px;
  z-index: 10;
  backdrop-filter: blur(6px);
  font-size: 13px;
}

#sun-panel {
  position: fixed;
  top: 120px;
  right: 12px;
  width: 270px;
  background: var(--panel-bg);
  border-radius: var(--radius);
  padding: 12px 14px;
  z-index: 10;
  backdrop-filter: blur(6px);
  font-size: 13px;
}

.sun-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0;
}

.sun-row input[type="range"] {
  flex: 1;
  accent-color: var(--accent);
}

.sun-val { min-width: 86px; color: var(--accent); font-weight: 600; font-size: 12px; }

#sun-panel code {
  background: rgba(255, 255, 255, 0.1);
  padding: 0 4px;
  border-radius: 4px;
}

.north-label {
  color: #c8531f;
  font-weight: 700;
  font-size: 16px;
  text-shadow: 0 0 4px rgba(255, 255, 255, 0.8);
  pointer-events: none;
}

#minimap-frame {
  position: fixed;
  right: 14px;
  bottom: 14px;
  width: 190px;
  height: 190px;
  border: 2px solid var(--panel-bg);
  border-radius: 4px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
  z-index: 6;
  pointer-events: none;
}

#loading, #missing {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 17, 16, 0.92);
  z-index: 20;
}

#loading .box, #missing .box {
  background: var(--panel-bg);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius);
  padding: 28px 36px;
  max-width: 440px;
  text-align: center;
}

#missing code {
  background: rgba(255, 255, 255, 0.1);
  padding: 1px 6px;
  border-radius: 4px;
}

progress {
  width: 240px;
  accent-color: var(--accent);
}

label { display: flex; gap: 8px; align-items: center; margin-top: 6px; }
