:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #07182d;
}

* { box-sizing: border-box; }

html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }

button { font: inherit; }

.loading,
.welcome {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 50% 30%, rgba(25, 191, 214, .2), transparent 35%),
    linear-gradient(145deg, #04101e, #0a2942);
}

.welcome[hidden], .loading[hidden], .screen-controls[hidden] { display: none !important; }

.welcome-card {
  width: min(92vw, 520px);
  padding: clamp(28px, 5vw, 50px);
  border: 1px solid rgba(112, 231, 255, .38);
  border-radius: 28px;
  text-align: center;
  background: rgba(4, 18, 32, .78);
  box-shadow: 0 30px 90px rgba(0, 0, 0, .42);
  backdrop-filter: blur(18px);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 70px;
  height: 70px;
  margin: 0 auto 18px;
  border: 2px solid #76ecff;
  border-radius: 22px 7px 22px 7px;
  color: #76ecff;
  font-weight: 900;
  font-size: 26px;
  letter-spacing: -.08em;
  transform: rotate(-3deg);
}

.loading p, .welcome p { color: #b9d6e5; }
.eyebrow { margin: 0 0 8px; color: #76ecff !important; font-weight: 800; letter-spacing: .18em; }
.welcome h1 { margin: 0; font-size: clamp(42px, 10vw, 72px); line-height: .95; letter-spacing: -.06em; }

#startButton {
  width: 100%;
  margin: 25px 0 14px;
  padding: 16px 22px;
  border: 0;
  border-radius: 15px;
  color: #02101c;
  background: linear-gradient(135deg, #7af0ff, #35c5d7);
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 12px 36px rgba(55, 206, 226, .25);
}

.editor-entry {
  width: 100%;
  margin: 0 0 14px;
  padding: 13px 20px;
  border: 1px solid rgba(122, 240, 255, .45);
  border-radius: 15px;
  color: #bff7ff;
  background: rgba(21, 89, 119, .35);
  font-weight: 800;
  cursor: pointer;
}

.welcome small { display: block; color: #7997a8; line-height: 1.4; }

.screen-controls {
  position: fixed;
  z-index: 10;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  display: flex;
  gap: 8px;
  transform: translateX(-50%);
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 18px;
  background: rgba(3, 15, 27, .8);
  backdrop-filter: blur(12px);
}

.screen-controls button {
  min-width: 48px;
  min-height: 46px;
  padding: 0 14px;
  border: 0;
  border-radius: 12px;
  color: #fff;
  background: #155977;
  font-weight: 800;
  cursor: pointer;
}

.screen-controls button:nth-child(2) { background: #0c8992; }

.notice {
  position: fixed;
  z-index: 30;
  top: 18px;
  left: 50%;
  padding: 10px 16px;
  border-radius: 999px;
  color: #fff;
  background: rgba(3, 17, 29, .88);
  opacity: 0;
  transform: translate(-50%, -12px);
  transition: .25s ease;
  pointer-events: none;
}

.notice.show { opacity: 1; transform: translate(-50%, 0); }

.editor-panel {
  position: fixed;
  z-index: 40;
  top: 0;
  right: 0;
  width: min(430px, 100vw);
  height: 100dvh;
  padding: 20px;
  overflow: auto;
  color: #eafaff;
  background: rgba(3, 16, 28, .96);
  border-left: 1px solid rgba(105, 229, 250, .28);
  box-shadow: -18px 0 60px rgba(0, 0, 0, .38);
  backdrop-filter: blur(18px);
}

.editor-panel[hidden], .editor-crosshair[hidden] { display: none !important; }

.editor-header,
.editor-section-title,
.editor-form-actions,
.editor-footer-row,
.editor-coordinates {
  display: flex;
  align-items: center;
  gap: 10px;
}

.editor-header { justify-content: space-between; margin-bottom: 18px; }
.editor-header p { margin: 0 0 3px; color: #6ee8fb; font-size: 12px; font-weight: 900; letter-spacing: .16em; }
.editor-header h2, .editor-list-section h3, .marker-form h3 { margin: 0; }
.editor-header h2 { font-size: 22px; }
.editor-icon-button { width: 42px; height: 42px; border: 0; border-radius: 12px; color: #fff; background: #263b4e; font-size: 27px; cursor: pointer; }

.editor-field { display: grid; gap: 7px; margin: 0 0 14px; }
.editor-field > span { color: #a9c8d6; font-size: 13px; font-weight: 800; }
.editor-field small { color: #7998a9; line-height: 1.35; }
.editor-field input,
.editor-field select,
.editor-field textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid #284b61;
  border-radius: 10px;
  padding: 10px 12px;
  color: #f4fdff;
  background: #0b2639;
  outline: none;
  resize: vertical;
}
.editor-field input:focus,
.editor-field select:focus,
.editor-field textarea:focus { border-color: #56d9ea; box-shadow: 0 0 0 3px rgba(86, 217, 234, .12); }

.editor-help {
  margin: 8px 0 12px;
  padding: 11px 12px;
  border-radius: 10px;
  color: #b9d6e3;
  background: rgba(33, 112, 140, .22);
  font-size: 13px;
  line-height: 1.45;
}

.editor-primary,
.editor-secondary,
.editor-small {
  border: 0;
  border-radius: 10px;
  padding: 11px 13px;
  color: #fff;
  font-weight: 850;
  cursor: pointer;
}
.editor-primary { width: 100%; color: #04141d; background: #67e4f4; }
.editor-primary:disabled,
.editor-secondary:disabled,
.editor-small:disabled { opacity: .5; cursor: wait; }
.editor-secondary { flex: 1; background: #1b455d; }
.editor-small { align-self: end; margin-bottom: 14px; padding: 10px; background: #1b5268; font-size: 12px; }

.editor-place-navigation {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  margin: -4px 0 14px;
}
.editor-place-navigation .editor-secondary { padding: 9px 7px; font-size: 12px; }
.editor-place-navigation span {
  min-width: 48px;
  color: #8be7f3;
  text-align: center;
  font-size: 12px;
  font-weight: 900;
}

.editor-list-section { margin: 20px 0; }
.editor-section-title { justify-content: space-between; margin-bottom: 9px; }
.editor-section-title h3, .marker-form h3 { font-size: 16px; }
.editor-section-title span { display: grid; place-items: center; min-width: 28px; height: 24px; border-radius: 999px; color: #05202b; background: #67e4f4; font-weight: 900; }
.marker-list { display: grid; gap: 8px; }
.marker-empty { padding: 14px; border: 1px dashed #31556a; border-radius: 10px; color: #7899aa; text-align: center; font-size: 13px; }
.marker-item { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; padding: 10px; border: 1px solid #25485e; border-radius: 11px; background: #0a2233; }
.marker-item strong { display: block; margin-bottom: 3px; font-size: 14px; }
.marker-item small { color: #7ea1b2; }
.marker-item-actions { display: flex; gap: 5px; }
.marker-item button { min-width: 36px; height: 34px; border: 0; border-radius: 8px; color: #fff; background: #1a536c; cursor: pointer; }
.marker-item button[data-marker-action="delete"] { background: #75353d; }

.marker-form { margin: 18px 0; padding: 15px; border: 1px solid #2d6077; border-radius: 14px; background: rgba(9, 37, 54, .88); }
.marker-form > h3 { margin-bottom: 15px; }
.editor-link-fields { margin: 0 0 14px; padding: 12px; border: 1px solid #766027; border-radius: 11px; background: rgba(129, 91, 20, .16); }
.editor-link-fields[hidden] { display: none; }
.editor-link-fields .editor-field:last-of-type { margin-bottom: 8px; }
.editor-link-fields > small { color: #d8c48a; line-height: 1.4; }
.editor-coordinates { align-items: stretch; }
.editor-coordinates .editor-field { flex: 1; }
.editor-form-actions { margin-top: 6px; }
.editor-form-actions .editor-primary { flex: 1.4; }
.editor-form-actions .editor-secondary { flex: .8; }

.editor-image-preview { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin: -4px 0 14px; }
.editor-image-preview img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 8px; border: 1px solid #315a70; }

.editor-footer { display: grid; gap: 9px; margin-top: 18px; padding-top: 16px; border-top: 1px solid #24475b; }
.editor-status { min-height: 20px; margin: 0; color: #89ddeb; font-size: 13px; line-height: 1.4; }

.editor-crosshair {
  position: fixed;
  z-index: 35;
  left: 50%;
  top: 50%;
  width: 44px;
  height: 44px;
  transform: translate(-50%, -50%);
  border: 2px solid rgba(255, 255, 255, .95);
  border-radius: 50%;
  pointer-events: none;
  box-shadow: 0 0 0 5px rgba(3, 25, 40, .42), 0 0 22px rgba(80, 224, 245, .65);
}
.editor-crosshair::before,
.editor-crosshair::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  background: #fff;
  transform: translate(-50%, -50%);
}
.editor-crosshair::before { width: 20px; height: 2px; }
.editor-crosshair::after { width: 2px; height: 20px; }

@media (max-width: 520px) {
  .screen-controls { width: calc(100% - 24px); justify-content: center; }
  .screen-controls button { flex: 1; padding-inline: 8px; }
  .editor-panel { width: 100%; }
  .editor-crosshair { display: none; }
}
