:root {
  --bg: #0b0d12;
  --panel: #111523;
  --muted: #9aa4b2;
  --text: #e7eaf0;
  --border: #1e2a44;
  --primary: #6aa7ff;
  --danger: #ff4d4d;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; background: var(--bg); color: var(--text); font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Noto Sans", "Liberation Sans"; }

.layout { display: grid; grid-template-columns: 380px 1fr; height: 100vh; }
.sidebar { overflow: auto; border-right: 1px solid var(--border); background: linear-gradient(180deg, #0c1020, var(--bg)); padding: 14px; }
.mapwrap { position: relative; }
#map { position: absolute; inset: 0; }

.mobileOnly { display: none; }
.mapControls { position: absolute; top: 12px; left: 12px; display: none; gap: 10px; z-index: 5; }
.fab { width: 44px; height: 44px; border-radius: 14px; padding: 0; display: grid; place-items: center; font-size: 18px; background: rgba(17, 21, 35, 0.85); border: 1px solid var(--border); }
.fab--primary { background: rgba(106, 167, 255, 0.22); border-color: rgba(106, 167, 255, 0.55); }
.fab--active { background: rgba(43, 255, 185, 0.16); border-color: rgba(43, 255, 185, 0.55); }
.toast { position: absolute; left: 12px; right: 12px; bottom: 12px; z-index: 6; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border); background: rgba(17,21,35,0.92); color: var(--text); font-size: 13px; }
.toast a { color: #2bffb9; text-decoration: underline; }
.toast a:visited { color: #2bffb9; }
.toast__row { display: flex; gap: 10px; align-items: center; justify-content: space-between; }
.toast__close { width: 34px; height: 34px; border-radius: 12px; padding: 0; display: grid; place-items: center; }

.placePin {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 28px;
  height: 28px;
  margin-left: -14px;
  margin-top: -28px; /* tip sits on center */
  border: 2px solid rgba(0, 0, 0, 0.45);
  border-radius: 16px 16px 16px 0;
  background: rgba(106, 167, 255, 0.95);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.45);
  transform: rotate(-45deg);
  z-index: 7;
  cursor: pointer;
  pointer-events: auto;
}
.placePin::after {
  content: "";
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: rgba(17, 21, 35, 0.95);
  border: 1px solid rgba(0, 0, 0, 0.35);
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) rotate(45deg);
}

.authOverlay { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,0.65); z-index: 50; }
.authCard { width: min(520px, calc(100vw - 24px)); border: 1px solid var(--border); background: rgba(17, 21, 35, 0.95); border-radius: 14px; padding: 14px; }
.authCard h2 { margin: 0 0 8px; font-size: 18px; }

h1 { font-size: 18px; margin: 0 0 10px; }
.sidebar__header { margin-bottom: 10px; }
.sheetHandle { display: none; }
.muted { color: var(--muted); font-size: 12px; line-height: 1.3; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New"; }
.label { font-size: 12px; color: var(--muted); margin-bottom: 6px; }

.card { border: 1px solid var(--border); background: rgba(17, 21, 35, 0.75); border-radius: 12px; padding: 12px; margin: 12px 0; }
.row { display: flex; gap: 10px; align-items: center; }
.row--space { justify-content: space-between; }
.field { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; flex: 1; }
label { font-size: 12px; color: var(--muted); }
input, textarea, select, button {
  background: #0e1322;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 10px;
  outline: none;
}
input[type="range"] { padding: 0; height: 28px; }
textarea { resize: vertical; }
button { cursor: pointer; }
button.primary { background: rgba(106, 167, 255, 0.18); border-color: rgba(106, 167, 255, 0.45); }
button.danger { background: rgba(255, 77, 77, 0.16); border-color: rgba(255, 77, 77, 0.45); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
.btnLink {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(14, 19, 34, 0.75);
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
}
.btnLink:hover { background: rgba(14, 19, 34, 0.9); }
.check { display: flex; gap: 8px; align-items: center; user-select: none; }
pre { margin: 10px 0 0; padding: 10px; background: #0c1120; border: 1px solid var(--border); border-radius: 10px; overflow: auto; }

.supportBtn {
  display: inline-flex;
  width: 100%;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(43, 255, 185, 0.55);
  background: rgba(43, 255, 185, 0.12);
  color: #2bffb9;
  text-decoration: none;
  font-size: 13px;
}
.supportBtn:hover { background: rgba(43, 255, 185, 0.16); }

.comments { display: flex; flex-direction: column; gap: 10px; }
.comment { border: 1px solid var(--border); background: rgba(14, 19, 34, 0.65); border-radius: 12px; padding: 10px; }
.comment__head { color: var(--muted); font-size: 12px; margin-bottom: 6px; }
.comment__body { white-space: pre-wrap; font-size: 13px; color: var(--text); }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .mapControls { display: flex; }
  .mobileOnly { display: inline-flex; }
  .sidebar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    height: 70vh;
    border-right: 0;
    border-top: 1px solid var(--border);
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
    transform: translateY(calc(100% - 62px));
    transition: transform 180ms ease;
    z-index: 10;
    padding-bottom: 20px;
    overscroll-behavior: contain;
    touch-action: pan-y;
  }
  .sidebar.sidebar--dragging { transition: none; }
  .sidebar__header {
    position: sticky;
    top: 0;
    z-index: 2;
    background: rgba(12, 16, 32, 0.98);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(30, 42, 68, 0.7);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
    padding-bottom: 10px;
  }
  .sheetHandle {
    width: 100%;
    height: 22px;
    display: grid;
    place-items: center;
    touch-action: none;
  }
  .sheetHandle::before {
    content: "";
    width: 54px;
    height: 5px;
    border-radius: 999px;
    background: rgba(154, 164, 178, 0.55);
    border: 1px solid rgba(30, 42, 68, 0.7);
  }
}
