body {
  margin: 0;
  padding: 0;
  font-family: "Google Sans Code", "Poppins", sans-serif;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
#map {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 100%;
}
#main-panel {
  position: absolute;
  top: 16px;
  left: 16px;
  background: rgba(255, 255, 255, 0.95);
  padding: 18px 22px 16px 22px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  z-index: 10;
  max-width: 340px;
}
/* Small top banner inside the main panel for project credit */
.panel-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #e8f0ff; /* light blue */
  color: #145a96;
  font-size: 0.75em;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 6px 10px;
  border-top-left-radius: 6px;
  border-top-right-radius: 6px;
  margin: -18px -22px 10px -22px; /* pull edge-to-edge inside panel */
}
.panel-banner a {
  color: #145a96;
  text-decoration: none;
  font-weight: 700;
  margin-left: 6px;
}

@media (max-width: 600px) {
  /* On mobile the #main-panel padding is reduced; match .panel-banner margins so it aligns */
  .panel-banner {
    margin: -16px -16px 10px -16px; /* match mobile padding / spacing */
    padding: 6px 8px;
    font-size: 0.72em;
  }
  /* Move draw helper up on mobile so it doesn't collide with the bottom instruction */
  #draw-helper {
    bottom: 90px; /* sit above the main instruction which is at bottom:40px */
    left: 20px;
    right: 20px;
    justify-content: center;
  }
}
h1 {
  margin-top: 0;
  margin-bottom: 10px;
  font-size: 1.4em;
  font-weight: 600;
  color: #4264fb;
  letter-spacing: 0.35px;
  line-height: 1.18;
}
p {
  font-size: 1em;
  line-height: 1.4;
}
p > a {
  color: rgba(66, 100, 251, 1);
  text-decoration: none;
  border-bottom: 2px solid rgba(66, 100, 251, 1);
}
p > a:hover {
  color: rgb(41, 70, 204);
  text-decoration: none;
  border-bottom: 2px solid rgba(41, 70, 204, 0.3);
}
#main-panel .instructions {
  margin-bottom: 18px;
  transition: opacity 240ms ease, transform 240ms ease, margin-bottom 240ms ease;
  transform-origin: left center;
  opacity: 1;
}

/* When main panel is compact (e.g. while drawing), fade/slide the instructions */
#main-panel.compact .instructions {
  opacity: 0;
  transform: translateY(-6px) scale(0.98);
  margin-bottom: 0;
  pointer-events: none;
}
#side-rotator {
  transition: opacity 0.4s;
  font-weight: bold;
  color: #4264fb;
}
.fade {
  opacity: 0.2;
}
.btn {
  padding: 10px;
  margin-bottom: 0;
  border: none;
  border-radius: 4px;
  font-size: 1em;
  font-weight: 600;
  cursor: pointer;
  transition:
    background 0.18s,
    color 0.18s,
    box-shadow 0.18s;
  flex: 1;
}
.main-panel-buttons,
.form-buttons {
  display: flex;
  gap: 10px;
  margin-top: 8px;
  margin-bottom: 12px;
}
.btn-primary {
  background: #4264fb;
  color: white;
}
.btn-primary:hover:not(:disabled) {
  background: #2c4bd1;
  color: #fff;
}
.btn-primary:active:not(:disabled) {
  background: #bccbd7;
  color: #fff;
}
.btn-primary:disabled {
  background: #ccc;
  color: #888;
  cursor: not-allowed;
}
.btn-primary.loading {
  background: linear-gradient(270deg, #4264fb, #4129a4, #6f40a1, #4264fb);
  background-size: 400% 400%;
  animation: gradient-rotate 1.2s linear infinite;
  color: #fff !important;
  pointer-events: none;
  position: relative;
}
@keyframes gradient-rotate {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}
.btn-secondary {
  background: #eee;
  color: #4264fb;
  font-weight: 500;
}
.btn-secondary:hover:not(:disabled) {
  background: #e0eaff;
  color: #145a96;
}
.btn-secondary:active:not(:disabled) {
  background: #c2d8f7;
  color: #bccbd7;
}
.btn-secondary:disabled {
  background: #ccc;
  color: #888;
  cursor: not-allowed;
}
/* Modal Styles */
#modal-form,
#confirmation-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.25);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-content {
  background: #fff;
  padding: 22px 24px;
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.18);
  max-width: 340px;
  width: 95vw;
}
.modal-content h1 {
  margin-top: 0;
  color: #4264fb;
}
.modal-content form label {
  display: block;
  font-size: 0.9em;
  margin-top: 8px;
  margin-bottom: 4px;
  font-weight: 500;
  color: #222;
}
.modal-content form input,
.modal-content form select {
  width: 100%;
  padding: 8px 10px;
  margin-bottom: 8px;
  border: 1px solid #bbb;
  border-radius: 4px;
  font-size: 1em;
  box-sizing: border-box;
  font-weight: 400;
}
.modal-content form textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #bbb;
  border-radius: 4px;
  font-size: 1em;
  box-sizing: border-box;
  resize: vertical;
}
@media (max-width: 600px) {
  #main-panel,
  .modal-content {
    max-width: 98vw;
    padding: 16px;
    font-size: 1em;
    margin-right: 16px;
  }
  .modal-content {
    margin-left: 16px;
  }
}
.subtext {
  font-size: 0.92em;
  color: #888;
  margin-top: 8px;
  margin-bottom: 0;
  text-align: left;
}
/* Header (static, no compact/transition behavior) */
.panel-header {
  display: flex;
  align-items: center;
  gap: 16px;
}
.panel-logo {
  width: 60px;
  height: 60px;
  object-fit: contain;
  border-radius: 8px;
}
.panel-title {
  margin: 0;
}
/* Map Instructions */
#map-instructions {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  pointer-events: none;
  background: rgba(255, 255, 255, 0.65);
  font-size: 1.25em;
  color: #4264fb;
  font-weight: 600;
  text-align: center;
  transition: opacity 0.3s;
  opacity: 0.85;
  padding: 0 32px;
}
@media (max-width: 600px) {
  #map-instructions {
    padding: 0 18vw;
    font-size: 1.1em;
    align-items: flex-end;
    justify-content: center;
    top: auto;
    bottom: 40px; /* position 40px above bottom of viewport on mobile */
    height: auto;
  }
}
#draw-helper {
  display: none;
  position: absolute;
  left: 20px;
  right: 20px;
  bottom: 40px;
  z-index: 6;
  pointer-events: none;
  justify-content: center;
  align-items: flex-end;
}
#draw-helper span {
  background: rgba(255, 255, 255, 0.85);
  color: #ee9d19;
  font-size: 1em;
  padding: 10px 22px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
