html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg-canvas);
  color: var(--text-primary);
  font-family: var(--font-family-base);
}

body {
  overscroll-behavior: none;
}

.native-app {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.native-device {
  width: min(100%, 430px);
  height: min(880px, calc(100vh - 36px));
  height: min(880px, calc(100dvh - 36px));
  min-height: min(880px, calc(100vh - 36px));
  min-height: min(880px, calc(100dvh - 36px));
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-soft);
  border-radius: 34px;
  background: var(--bg-device);
  box-shadow: var(--shadow-frame);
  overflow: hidden;
}

.native-safe-top {
  height: var(--safe-top);
  background: var(--bg-device);
}

.native-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: 12px var(--space-5) 14px;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--border-soft);
  backdrop-filter: blur(18px);
}

.native-header-copy {
  min-width: 0;
}

.native-header-eyebrow {
  display: block;
  margin-bottom: var(--space-1);
  color: var(--text-tertiary);
  font-size: var(--font-size-xs);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.native-header-title {
  color: var(--text-primary);
  font-size: var(--font-size-md);
  font-weight: 700;
}

.native-header-subtitle {
  margin-top: var(--space-1);
  color: var(--text-secondary);
  font-size: var(--font-size-xs);
}

.native-content {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  height: 100%;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 0 var(--space-5);
  background: var(--bg-device);
}

.screen-root {
  display: grid;
  gap: var(--space-4);
  padding: var(--space-5) 0 var(--space-6);
  opacity: 1;
  transform: translateY(0);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.screen-root.screen-transition {
  opacity: 0.74;
  transform: translateY(6px);
}

.screen-root.is-auth-layout {
  flex: 1 1 auto;
  height: 100%;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: clamp(16px, 4vh, 36px) 0;
}

.screen-intro {
  display: grid;
  gap: var(--space-2);
}

.screen-actions-inline {
  display: grid;
  gap: var(--space-3);
}

.native-tabbar {
  position: sticky;
  bottom: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-2);
  padding: 10px var(--space-4) var(--safe-bottom);
  border-top: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(18px);
}

.native-tabbar button {
  min-height: 58px;
  padding: 10px 12px;
  border-radius: 20px;
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
  box-shadow: none;
}

.native-tabbar button:hover {
  background: var(--surface-muted);
}

.native-tabbar button.is-active {
  background: var(--text-primary);
  color: var(--text-inverse);
}

.tab-label {
  display: block;
  font-size: var(--font-size-sm);
  font-weight: 600;
}

.tab-hint {
  display: block;
  margin-top: 2px;
  font-size: var(--font-size-xs);
  opacity: 0.72;
}

.map-shell {
  display: grid;
  gap: var(--space-3);
}

.map-surface {
  position: relative;
  min-height: 360px;
  border: 1px solid var(--border-soft);
  border-radius: 28px;
  background: var(--surface-muted);
  box-shadow: inset 0 0 0 1px rgba(17, 17, 17, 0.02);
  overflow: hidden;
}

.map-surface::before {
  content: '';
  position: absolute;
  inset: 12% 10%;
  border-radius: 24px;
  border: 1px dashed rgba(17, 17, 17, 0.08);
}

.map-layer {
  position: absolute;
  inset: 0;
}

.map-center-pill {
  position: absolute;
  left: 50%;
  top: 18px;
  transform: translateX(-50%);
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--border-soft);
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
  z-index: 2;
}

.map-caption {
  display: grid;
  gap: var(--space-1);
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
}

.map-marker,
.map-marker-duplicate {
  position: absolute;
  border: 0;
  transform: translate(-50%, -50%);
}

.map-marker {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: var(--text-primary);
  box-shadow: 0 0 0 5px rgba(17, 17, 17, 0.08);
  cursor: pointer;
  user-select: none;
  touch-action: none;
}

.map-marker::after {
  content: '';
  position: absolute;
  left: 50%;
  top: calc(100% - 4px);
  width: 8px;
  height: 8px;
  background: var(--text-primary);
  transform: translateX(-50%) rotate(45deg);
  border-radius: 2px;
}

.map-marker.is-self {
  width: 18px;
  height: 18px;
  background: #6b6b6b;
  box-shadow: 0 0 0 5px rgba(107, 107, 107, 0.12);
  cursor: default;
}

.map-marker.is-draft {
  width: 24px;
  height: 24px;
}

.map-marker.is-editing {
  cursor: grab;
}

.map-marker.is-editing:active {
  cursor: grabbing;
}

.map-marker-duplicate {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 2px solid rgba(17, 17, 17, 0.26);
  background: rgba(17, 17, 17, 0.08);
}

.fab {
  position: absolute;
  right: 16px;
  bottom: 16px;
  width: auto;
  padding: 0 16px;
  border-radius: 999px;
  z-index: 3;
}

.native-metadata {
  display: grid;
  gap: var(--space-3);
}

@media (max-width: 480px) {
  .native-app {
    height: 100vh;
    height: 100dvh;
    padding: 0;
    align-items: stretch;
  }

  .native-device {
    width: 100%;
    height: 100vh;
    height: 100dvh;
    min-height: 100vh;
    min-height: 100dvh;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
  }
}
