:root {
  --app-font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --app-background: #f3f3f3;

  --hud-top: 1rem;
  --hud-right: 1rem;
  --hud-min-width: 320px;
  --hud-max-height: calc(100vh - 2rem);
  --hud-padding: 12px 14px;
  --hud-background: rgba(255, 255, 255, 0.94);
  --hud-border: 1px solid rgba(0, 0, 0, 0.08);
  --hud-border-radius: 10px;
  --hud-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  --hud-backdrop-blur: 6px;
  --hud-section-border: 1px solid rgba(0, 0, 0, 0.08);

  --button-height: 34px;
  --button-background: #ffffff;
  --button-background-hover: #f5f5f5;
  --button-background-active: #ebebeb;
  --button-border: 1px solid rgba(0, 0, 0, 0.12);
  --button-radius: 8px;

  --input-height: 28px;
  --input-padding: 4px 8px;
  --input-border: 1px solid rgba(0, 0, 0, 0.12);
  --input-radius: 6px;
  --input-background: #ffffff;
  --input-font-size: 12px;
  --input-invalid-border: #c7422f;
  --input-invalid-background: #fff2f0;

  --status-busy: #a23a00;
  --status-ready: #0b6b34;

  --overlay-background: rgba(255, 255, 255, 0.82);
  --overlay-backdrop-blur: 3px;
  --loading-card-width: min(460px, calc(100vw - 48px));
  --loading-card-background: #ffffff;
  --loading-card-radius: 12px;
  --loading-card-border: 1px solid rgba(0, 0, 0, 0.08);
  --loading-card-shadow: 0 10px 30px rgba(0, 0, 0, 0.14);
  --loading-card-padding: 18px 18px 16px 18px;

  --progress-track: #ececec;
  --progress-fill: linear-gradient(90deg, #7a7a7a, #444);
  --map-base-filter: grayscale(100%) brightness(1.2) contrast(0.9);
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--app-font-family);
  background: var(--app-background);
}

#map {
  width: 100%;
  height: 100%;
  background: var(--app-background);
}

.ol-zoom {
  top: 1rem;
  left: 1rem;
}

.map-base canvas {
  filter: var(--map-base-filter);
}

.hud {
  position: absolute;
  top: var(--hud-top);
  right: var(--hud-right);
  min-width: var(--hud-min-width);
  max-height: var(--hud-max-height);
  z-index: 1000;
  overflow: auto;
  background: var(--hud-background);
  border: var(--hud-border);
  border-radius: var(--hud-border-radius);
  padding: var(--hud-padding);
  box-shadow: var(--hud-shadow);
  backdrop-filter: blur(var(--hud-backdrop-blur));
  max-width: min(420px, calc(100vw - 2rem));
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.hud h1 {
  margin: 0 0 8px 0;
  font-size: 15px;
  font-weight: 650;
}

.hud h2 {
  margin: 0 0 8px 0;
  font-size: 13px;
  font-weight: 650;
}

.hud-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 6px 0;
  font-size: 13px;
  color: #2b2b2b;
  flex-wrap: wrap;
}

.hud-row .label,
.hud-input-row .label {
  color: #666;
}

.hud-section {
  margin-top: 12px;
  padding-top: 10px;
  border-top: var(--hud-section-border);
}

.hud-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 78px 54px;
  align-items: center;
  gap: 10px;
  margin: 8px 0;
  font-size: 12px;
  color: #2b2b2b;
}

.hud-radio-row {
  grid-template-columns: minmax(0, 1fr) auto 0;
}

.hud-radio-group {
  display: inline-flex;
  align-items: center;
  justify-self: end;
  gap: 12px;
  white-space: nowrap;
}

.hud-radio-option {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #2b2b2b;
}

.hud-radio-option input {
  margin: 0;
}

.hud-unit {
  color: #777;
  font-size: 12px;
  justify-self: start;
}

.hud-input {
  width: 100%;
  height: var(--input-height);
  box-sizing: border-box;
  padding: var(--input-padding);
  border: var(--input-border);
  border-radius: var(--input-radius);
  background: var(--input-background);
  font-size: var(--input-font-size);
  text-align: right;
}

.hud-button-row {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.hud-button-row .hud-button {
  width: auto;
  margin-top: 0;
  flex: 1 1 0;
}

.hud-input.is-invalid {
  border-color: var(--input-invalid-border);
  background: var(--input-invalid-background);
}

.hud-button {
  margin-top: 10px;
  width: 100%;
  height: var(--button-height);
  border: var(--button-border);
  border-radius: var(--button-radius);
  background: var(--button-background);
  color: #2b2b2b;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.hud-button:hover {
  background: var(--button-background-hover);
}

.hud-button:active {
  background: var(--button-background-active);
}

.status-busy {
  color: var(--status-busy);
  font-weight: 600;
}

.status-ready {
  color: var(--status-ready);
  font-weight: 600;
}

.loading-overlay {
  position: absolute;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--overlay-background);
  backdrop-filter: blur(var(--overlay-backdrop-blur));
}

.loading-card {
  width: var(--loading-card-width);
  background: var(--loading-card-background);
  border-radius: var(--loading-card-radius);
  border: var(--loading-card-border);
  box-shadow: var(--loading-card-shadow);
  padding: var(--loading-card-padding);
}

.loading-title {
  margin: 0 0 10px 0;
  font-size: 16px;
  font-weight: 650;
}

.loading-subtitle {
  margin: 0 0 12px 0;
  font-size: 13px;
  color: #666;
}
/* Startup confirmation inside the loading card */
.startup-confirm {
  margin: 12px 0 10px 0;
  padding: 10px 12px;
  border: 1px solid rgba(0, 0, 0, 0.10);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.02);
}

.startup-confirm-text {
  font-size: 13px;
  color: #333;
  line-height: 1.35;
  margin-bottom: 10px;
}

.startup-confirm-buttons {
  display: flex;
  gap: 10px;
}

.startup-confirm-buttons .hud-button {
  margin-top: 0;
  width: auto;
  flex: 1 1 0;
}

/* Optional: visually de-emphasize cancel a bit */
.hud-button-secondary {
  font-weight: 600;
  opacity: 0.9;
}

.progress-bar {
  width: 100%;
  height: 10px;
  background: var(--progress-track);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--progress-fill);
  transition: width 90ms linear;
}

.progress-text {
  margin-top: 10px;
  font-size: 13px;
  color: #333;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.hidden {
  display: none !important;
}


.hud-checkbox {
  justify-self: end;
  width: 18px;
  height: 18px;
}

/* Allow HUD contents to shrink and wrap instead of forcing the HUD wider */
.hud * {
  min-width: 0;
}

/* Optional: use this class for any long explanatory text in the HUD */
.hud .hud-longtext {
  display: block;
  white-space: normal;
  overflow-wrap: anywhere;
}
