:root {
  color-scheme: dark;
  --bg: #242424;
  --panel: #1e1f23;
  --panel-border: #2d2f36;
  --text: #e6e6e6;
  --muted: #9da3b4;
  --accent: #4f8cff;
}

* {
  box-sizing: border-box;
}

strong {
  font-weight: 600;
}

html,
body {
  margin: 0;
  height: 100%;
  font-family: "Roboto", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
}

#app {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
}

.streetview {
  position: absolute;
  inset: 0;
  background: #2a2a2a;
  opacity: 0;
  transition: opacity 200ms ease;
  z-index: 1;
}

.streetview.is-active {
  opacity: 1;
}

.placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  color: rgba(230, 230, 230, 0.6);
  font-size: 1.05rem;
  letter-spacing: 0.2px;
  pointer-events: none;
  z-index: 2;
}

.compass {
  position: absolute;
  top: 18px;
  left: 18px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  /* background: radial-gradient(
    circle at 30% 30%,
    #c8d5ea 0%,
    #dfe8f6 45%,
    #f4f7ff 100%
  ); */
  background: rgba(225, 225, 255, 0.4);
  /* border: 2px solid #6fa1ff; */
  /* box-shadow: 0 10px 20px rgba(0, 0, 0, 0.35); */
  border: 10px solid rgba(255, 255, 255, 0.2);
  z-index: 6;
  display: grid;
  place-items: center;
  backdrop-filter: blur(5px);
}

.compass.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.compass-needle {
  position: absolute;
  width: 0;
  height: 0;
  transform: rotate(0deg);
  transform-origin: center center;
  filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.25));
}

.compass-needle::before,
.compass-needle::after {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
}

.compass-needle::before {
  top: -22px;
  border-bottom: 22px solid #e84b4b;
}

.compass-needle::after {
  top: 0;
  border-top: 22px solid #f5f6fa;
}

.compass-center {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f5f6fa;
  border: 2px solid #1f2a3a;
  z-index: 1;
}

.compass-north {
  position: absolute;
  top: 4px;
  font-size: 0.55rem;
  font-weight: 600;
  color: #e84b4b;
  letter-spacing: 0.5px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

.settings-button {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 0px solid rgba(255, 255, 255, 0.08);
  background: rgba(24, 25, 30, 0.6);
  color: rgba(255, 255, 255, 0.85);
  cursor: pointer;
  /* box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35); */
  z-index: 7;
  padding: 6px 10px;
  font-size: 1.2rem;
}

.settings-button:hover {
  color: #ffffff;
}

.settings-menu {
  position: absolute;
  top: 64px;
  right: 18px;
  min-width: 220px;
  background: rgba(30, 31, 35, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.35);
  padding: 6px;
  z-index: 7;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.settings-menu.is-hidden {
  display: none;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-size: 0.85rem;
  text-align: left;
}

.menu-item:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.menu-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 6;
}

.modal-backdrop.is-hidden {
  display: none;
}

.modal {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  max-width: 520px;
  background: rgba(30, 31, 35, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
  padding: 14px 16px 16px;
  z-index: 8;
}

.modal.is-hidden {
  display: none;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.modal-title {
  font-size: 1rem;
  font-weight: 500;
}

.modal-close {
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  font-size: 1rem;
}

.modal-body {
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.9rem;
  line-height: 1.5;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}

.modal-btn {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 0.85rem;
}

.modal-btn-danger {
  background: #e84b4b;
  border-color: #e84b4b;
}

.shortcut-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
}

.shortcut-key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  margin-right: 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.1);
  font-weight: 400;
  font-size: 1rem;
  font-family: "Roboto Mono", ui-monospace, SFMono-Regular, Menlo, Monaco,
    Consolas, "Liberation Mono", "Courier New", monospace;
  color: #fff;
}

.overlay {
  position: absolute;
  background: rgba(30, 31, 35, 0.96);
  border: 0px solid var(--panel-border);
  border-radius: 12px 12px 12px 0;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(12px);
  z-index: 5;
}

.picker {
  /* left: 24px; */
  left: 0px;
  /* bottom: 24px; */
  bottom: 0px;
  --picker-base-w: 360px;
  --picker-base-h: 280px;
  --picker-expanded-w: 360px;
  --picker-expanded-h: 280px;
  width: var(--picker-base-w);
  height: var(--picker-base-h);
  aspect-ratio: calc(var(--picker-base-w) / var(--picker-base-h));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width 220ms ease, height 220ms ease;
  /* transition: width 0 ease, height 0 ease; */
}

.picker.is-hidden {
  display: none;
}

.picker.is-expanded {
  width: var(--picker-expanded-w);
  height: var(--picker-expanded-h);
}

.toggle-btn {
  appearance: none;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 120ms ease;
  backdrop-filter: blur(6px);
}

.toggle-btn:hover {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.2);
}

.toggle-btn.is-active {
  background: rgba(79, 140, 255, 0.2);
  color: #eaf0ff;
  border-color: rgba(79, 140, 255, 0.45);
}

.map {
  flex: 1;
}

.map-controls * {
  outline: none;
  user-select: none;
}

.map-controls {
  position: relative;
  display: inline-flex;
  gap: 6px;
  padding: 6px;
  border-radius: 12px;
  background: rgba(24, 25, 30, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
}

.map-controls-row {
  position: absolute;
  top: 6px;
  left: 6px;
  right: 6px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
}

.map-controls-secondary {
  position: relative;
}

/* .map-controls-secondary .toggle-btn {
  color: #ff8a3d;
} */

.map-controls-secondary .toggle-btn i {
  font-size: 0.9rem;
}

.api-key {
  top: 50%;
  left: 50%;
  right: auto;
  width: 100%;
  max-width: 600px;
  transform: translate(-50%, -50%);
  padding: 20px 22px 18px;
}

.api-key.is-hidden {
  display: none;
}

.api-title {
  font-size: 1rem;
  font-weight: 500;
  margin-bottom: 8px;
}

.api-row {
  display: flex;
  gap: 8px;
}

.api-input {
  flex: 1;
  border-radius: 8px;
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  padding: 8px 10px;
  font-size: 0.92rem;
}

.api-input::placeholder {
  color: rgba(255, 255, 255, 0.35);
}

.api-button {
  border: none;
  border-radius: 8px;
  padding: 8px 12px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-size: 0.85rem;
}

.api-button:hover {
  filter: brightness(1.05);
}

.api-hint {
  margin-top: 8px;
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.5);
}

.api-steps {
  margin: 12px 0 0;
  padding-left: 18px;
  color: rgba(255, 255, 255, 0.75);
  font-size: 1rem;
  line-height: 1.4;
}

.api-steps li {
  margin-bottom: 6px;
}

@media (max-width: 768px) {
  .picker {
    width: calc(100% - 32px);
    height: 420px;
    left: 16px;
    bottom: 16px;
  }

  .api-key {
    width: calc(100% - 32px);
    left: 16px;
    right: 16px;
    top: 16px;
  }
}
