html, body {
  height: 100%;
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  color: #111827;
}

.topbar{
  display:flex;
  gap:16px;
  align-items:flex-start;
  justify-content:space-between;
  padding: 12px 16px;
  border-bottom: 1px solid #e5e7eb;
  background: #ffffff;
}

.brand .title{ font-weight: 700; font-size: 16px; }
.brand .subtitle{ font-size: 12px; color:#6b7280; }

.controls{
  display:flex;
  gap: 12px;
  align-items:flex-end;
  flex-wrap:wrap;
}

.controls label{
  display:flex;
  flex-direction:column;
  gap:6px;
  font-size: 12px;
  color:#374151;
}

.controls select{
  min-width: 200px;
  padding: 8px 10px;
  border:1px solid #d1d5db;
  border-radius:10px;
  background:#fff;
}

.yearCtl{
  min-width: 320px;
}
.yearRow{
  display:flex;
  align-items:center;
  gap:10px;
}
#yearSlider{
  width: 220px;
}
.yearLabel{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
  padding: 6px 8px;
  border:1px solid #e5e7eb;
  border-radius: 10px;
  background:#f9fafb;
  min-width: 42px;
  text-align:center;
}
.playBtn{
  padding: 8px 10px;
  border-radius: 10px;
  border:1px solid #d1d5db;
  background:#111827;
  color:#fff;
  cursor:pointer;
}

.controls .toggle{
  flex-direction:row;
  align-items:center;
  gap:8px;
  padding: 6px 10px;
  border:1px solid #e5e7eb;
  border-radius: 10px;
  background:#f9fafb;
}

.controls button#resetBtn{
  padding: 10px 12px;
  border-radius: 10px;
  border:1px solid #d1d5db;
  background:#111827;
  color:#fff;
  cursor:pointer;
}

.layout{
  display:grid;
  grid-template-columns: 1fr 360px;
  height: calc(100% - 70px);
}

#map{
  height: 100%;
  width: 100%;
}

.sidebar{
  border-left: 1px solid #e5e7eb;
  background:#f9fafb;
  padding: 12px;
  overflow:auto;
}

.card{
  background:#fff;
  border:1px solid #e5e7eb;
  border-radius: 16px;
  padding: 12px;
  margin-bottom: 12px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.04);
}

.cardTitle{
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 8px;
}

.mono{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
  white-space: pre-wrap;
}

.legendNote{ font-size: 12px; color:#6b7280; line-height:1.4; }

#histCanvas{
  width: 100%;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #ffffff;
}


.navlinks{
  display:flex;
  gap:10px;
  align-items:center;
  padding-top: 4px;
}
.navlinks a{
  font-size: 12px;
  color:#111827;
  text-decoration:none;
  padding: 6px 10px;
  border:1px solid #e5e7eb;
  border-radius: 999px;
  background:#f9fafb;
}
.navlinks a:hover{
  background:#ffffff;
}

.page{
  max-width: 980px;
  margin: 0 auto;
  padding: 18px 16px 40px;
}
.page h1{
  font-size: 20px;
  margin: 10px 0 6px;
}
.page p{
  color:#374151;
  line-height:1.5;
  margin-top: 0;
}
.formGrid{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 900px){
  .formGrid{ grid-template-columns: 1fr; }
}
.field{
  display:flex;
  flex-direction:column;
  gap:6px;
  font-size: 12px;
  color:#374151;
}
.field input, .field select, .field textarea{
  padding: 10px 12px;
  border:1px solid #d1d5db;
  border-radius: 12px;
  font-size: 14px;
  background:#fff;
}
.field textarea{ min-height: 120px; resize: vertical; }
.actionsRow{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  margin-top: 12px;
}
.btn{
  padding: 10px 12px;
  border-radius: 12px;
  border:1px solid #d1d5db;
  background:#111827;
  color:#fff;
  cursor:pointer;
}
.btn.secondary{
  background:#ffffff;
  color:#111827;
}
.notice{
  margin-top: 10px;
  font-size: 12px;
  color:#6b7280;
}
.success{
  margin-top: 10px;
  font-size: 12px;
  color:#065f46;
}
.danger{
  margin-top: 10px;
  font-size: 12px;
  color:#b91c1c;
}


/* --- v10 UI polish --- */
.req{
  color:#dc2626;
  font-size:0.75em;
  vertical-align: super;
  margin-left: 2px;
}

.dev-only{ display:none !important; }

/* Make form labels + inputs align cleanly */
.field{
  box-sizing:border-box;
}
.field input, .field select, .field textarea{
  box-sizing:border-box;
  width:100%;
}

/* Better mobile form layout */
.actionsRow{
  display:flex;
  flex-wrap: wrap;
  gap: 10px;
}
.actionsRow.center{
  justify-content:center;
}
@media (max-width: 640px){
  .actionsRow .btn{
    flex: 1 1 100%;
  }
  .topbar{
    flex-direction: column;
    align-items: stretch;
  }
  .navlinks{
    flex-wrap: wrap;
    gap: 10px;
  }
}

/* Modal */
.modal{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display:flex;
  align-items:center;
  justify-content:center;
  z-index: 999;
}
.modal.hidden{ display:none; }
.modal-content{
  background:#fff;
  padding: 22px;
  border-radius: 12px;
  max-width: 520px;
  width: calc(100% - 32px);
  box-shadow: 0 20px 50px rgba(0,0,0,0.25);
  text-align:center;
}
.modal-content .muted{
  color:#6b7280;
  font-size: 12px;
}

/* Stack selected fields across full row */
.field.full{ grid-column: 1 / -1; }

/* Forms: single-column on mobile */
@media (max-width: 900px){
  form.formGrid{
    grid-template-columns: 1fr !important;
  }
  form.formGrid .field{
    grid-column: 1 / -1;
  }
  .modal{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display:flex;
  align-items:center;
  justify-content:center;
  z-index: 999;
}
.modal.hidden{ display:none; }
.modal-content{
  background:#fff;
  padding: 22px;
  border-radius: 12px;
  max-width: 520px;
  width: calc(100% - 32px);
  box-shadow: 0 20px 50px rgba(0,0,0,0.25);
  text-align:center;
}
.modal-content .muted{
  color:#6b7280;
  font-size: 12px;
}

}
