/* ─── Reset & Base ────────────────────────────────────────────────────────── */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  overflow: hidden;
  font-family: 'DM Mono', monospace;
  background-color: #1f6460;
  color: #fff;
}

/* ─── Design Tokens ───────────────────────────────────────────────────────── */

:root {
  --teal:            #297b6f;
  --teal-dark:       #1f6460;
  --navy:            rgba(35, 67, 94, 0.92);
  --navy-solid:      #23435e;
  --amber:           #f9a526;
  --amber-bg:        rgba(249, 165, 38, 0.15);
  --teal-light:      #a8d5d0;
  --teal-light-bg:   rgba(168, 213, 208, 0.15);
  --terracotta:      #bc4e35;
  --terracotta-bg:   rgba(188, 78, 53, 0.50);
  --terracotta-border: rgba(188, 78, 53, 0.45);

  --text-primary:    #ffffff;
  --text-secondary:  rgba(255, 255, 255, 0.62);
  --text-muted:      rgba(255, 255, 255, 0.40);
  --divider:         rgba(255, 255, 255, 0.14);
}

/* ─── App Shell ───────────────────────────────────────────────────────────── */

#app {
  position: fixed;
  inset: 0;
  overflow: hidden;
}

#map {
  position: absolute;
  inset: 0;
  z-index: 0;
  background-color: var(--teal-dark);
  transition: background-color 0.8s ease;
}

/* ─── Typography ──────────────────────────────────────────────────────────── */

.font-header {
  font-family: 'Alata', sans-serif;
  letter-spacing: 0.01em;
}

/* ─── Leaflet overrides ───────────────────────────────────────────────────── */

.leaflet-control-attribution {
  display: none;
}

.leaflet-control-zoom {
  display: none;
}

/* GPS dot — no default leaflet marker styles */
.leaflet-div-icon {
  background: none;
  border: none;
}

/* ─── Top Bar ─────────────────────────────────────────────────────────────── */

#top-bar {
  position: absolute;
  top: max(1rem, env(safe-area-inset-top));
  left: 0.5rem;
  right: 0.5rem;
  z-index: 55; /* above all overlays so Maps button is always reachable */
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  pointer-events: none;
}

.title-pill {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 0.75rem;
  background: var(--navy-solid);
  border: none;
  cursor: pointer;
  pointer-events: auto;
  color: var(--text-primary);
  max-width: 60%;
}

@media (min-width: 768px) {
  .title-pill { max-width: 70%; }
}

.title-pill-logo {
  height: 1.5rem;
  width: auto;
  flex-shrink: 0;
  filter: brightness(0) invert(1);
  opacity: 0.9;
}

.title-pill-sep {
  width: 1px;
  height: 1.125rem;
  background: rgba(255,255,255,0.2);
  flex-shrink: 0;
}

.title-pill-text {
  font-size: 0.9375rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-pill {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.625rem;
  border-radius: 0.75rem;
  background: var(--navy-solid);
  flex-shrink: 0;
}

.status-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot--online  { background: #4ade80; }
.status-dot--offline { background: var(--amber); }

.status-label {
  font-size: 0.6875rem;
  color: var(--text-secondary);
}

/* ─── Right Controls ──────────────────────────────────────────────────────── */

#north-arrow {
  position: absolute;
  /* Always sit below the top bar regardless of safe-area-inset height.
     Formula: top-bar-top + top-bar-height(~2.5rem) + gap(1.5rem) */
  top: calc(max(1rem, env(safe-area-inset-top)) + 4rem);
  right: 0.5rem;
  z-index: 9; /* below top-bar (z-index:10) so it never occludes Maps button */
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.375rem;
}

.right-btn {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: var(--teal);
  color: var(--teal-light);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 4px rgba(0,0,0,0.35);
  transition: opacity 0.15s;
}

.right-btn:active:not(:disabled) {
  opacity: 0.7;
}

.right-btn--zoom {
  font-size: 1.125rem;
  font-weight: 300;
  line-height: 1;
  background: var(--navy-solid);
  color: #fff;
}

.right-btn:disabled,
.right-btn--dim {
  opacity: 0.35;
  cursor: default;
}

.right-btn--active {
  background: var(--amber);
  color: #fff;
}

.compass-rose {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: var(--navy-solid);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 4px rgba(0,0,0,0.35);
  pointer-events: none;
  transition: transform 0.15s linear;
}

/* ─── Status Banner ───────────────────────────────────────────────────────── */

#status-banner {
  position: absolute;
  bottom: calc(2rem + env(safe-area-inset-bottom));
  left: 0.5rem;
  right: 0.5rem;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.75rem;
  border-radius: 0.75rem;
  background: var(--terracotta);
  border: none;
}

#status-banner[hidden] { display: none; }

.banner-action {
  margin-left: auto;
  flex-shrink: 0;
  font-size: 0.6875rem;
  font-weight: 600;
  color: rgba(255,255,255,0.85);
  background: none;
  border: none;
  cursor: pointer;
  font-family: 'DM Mono', monospace;
  padding: 0;
}

.banner-icon {
  color: var(--terracotta);
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.banner-text {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.9);
}

/* ─── Switch Banner (bundle sheet suggestion) ─────────────────────────────── */

#switch-banner {
  position: absolute;
  bottom: calc(2.5rem + env(safe-area-inset-bottom));
  left: 0.5rem;
  right: calc(54px + 1rem);   /* clear the br-map-controls stack (54px inset + gap) */
  z-index: 40;
  transition: left 0.3s cubic-bezier(0.32, 0.72, 0, 1),
              right 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.75rem;
  background: rgba(20, 40, 60, 0.92);
  border: 1px solid rgba(255,255,255,0.14);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

#switch-banner[hidden] { display: none; }

.switch-banner-text {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.9);
  flex: 1;
}

.switch-banner-btn {
  flex-shrink: 0;
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--navy);
  background: var(--amber);
  border: none;
  border-radius: 0.375rem;
  padding: 0.3rem 0.625rem;
  cursor: pointer;
  font-family: 'DM Mono', monospace;
}

.switch-banner-dismiss {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  background: none;
  border: none;
  color: rgba(255,255,255,0.45);
  cursor: pointer;
  padding: 0;
}

/* Desktop: wider inset (63px) needs a wider right clearance */
@media (min-width: 600px) {
  #switch-banner { right: calc(63px + 1rem); }
}

/* Shift left when side panel is open */
@media (min-width: 600px) {
  body.panel-open #switch-banner { left: calc(300px + 0.75rem); }
}
@media (min-width: 768px) {
  body.panel-open #switch-banner { left: calc(360px + 0.75rem); }
}

/* PWA standalone: reduce base offset since env() already handles home indicator */
@media (display-mode: standalone) {
  #switch-banner {
    bottom: calc(2rem + env(safe-area-inset-bottom));
  }
}

/* ─── Bottom Bar ──────────────────────────────────────────────────────────── */

#bottom-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 10;
  background: var(--navy-solid);
  border-top: 1px solid rgba(255,255,255,0.10);
  padding: 0.25rem 0.75rem;
  padding-bottom: calc(0.5rem + env(safe-area-inset-bottom));
}

/* PWA standalone: safe-area-inset-bottom is ~34px on iPhone, making the bar
   huge. Keep the inset for the home indicator but reduce extra padding. */
@media (display-mode: standalone) {
  #bottom-bar {
    padding-top: 0.125rem;
    padding-bottom: calc(0.125rem + env(safe-area-inset-bottom));
  }
  .coords-text { font-size: 0.625rem; }
}

.coords-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.coords-text {
  font-family: 'DM Mono', monospace;
  font-size: 0.6875rem;
  color: var(--text-secondary);
}

/* ─── Bottom-right control stack (scale bar + bundle inset) ──────────────── */

#br-map-controls {
  position: absolute;
  bottom: calc(3.25rem + env(safe-area-inset-bottom));
  right: 0.5rem;
  z-index: 15;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.375rem;
}

@media (display-mode: standalone) {
  #br-map-controls {
    bottom: calc(2.875rem + env(safe-area-inset-bottom));
  }
}

/* 600–767px: bottom bar still visible — clear it the same as mobile */
@media (min-width: 600px) and (max-width: 767px) {
  #br-map-controls { bottom: calc(3.25rem + env(safe-area-inset-bottom)); }
}

/* 768px+: bottom bar hidden — add safe area clearance below pill */
@media (min-width: 768px) {
  #br-map-controls { bottom: max(0.875rem, env(safe-area-inset-bottom)); }
}

/* Bundle inset — flows inside the stack, no longer self-positioned */
#bundle-inset {
  position: static;
}

/* Scale bar pill */
#scale-bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 0.375rem 0.625rem;
  border-radius: 0.625rem;
  background: rgba(31, 100, 96, 0.3);
}

.scale-bar-label {
  font-family: 'DM Mono', monospace;
  font-size: 0.6875rem;
  font-weight: 500;
  color: rgba(255,255,255,0.88);
  text-align: center;
  line-height: 1;
  white-space: nowrap;
}

.scale-bar-line {
  height: 7px;
  min-width: 40px;
  border-top: none;
  border-left: 1.5px solid rgba(255,255,255,0.85);
  border-right: 1.5px solid rgba(255,255,255,0.85);
  border-bottom: 1.5px solid rgba(255,255,255,0.85);
}

/* ─── Onboarding ─────────────────────────────────────────────────────────── */

#onboarding {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(1.5rem, env(safe-area-inset-top)) 0.75rem max(1.5rem, env(safe-area-inset-bottom));
  pointer-events: auto;
  background: rgba(0,0,0,0.25);
}

.onboarding-card {
  background: var(--teal);
  border-radius: 1rem;
  padding: 1rem;
  width: min(380px, calc(100% - 1.5rem));
  box-shadow: 0 8px 32px rgba(0,0,0,0.35);
}

.onboarding-thumb {
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 1rem;
  background: rgba(255,255,255,0.1);
  border: 2px dashed rgba(255,255,255,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.45);
  margin: 0 auto 0.5rem;
}

.onboarding-title {
  font-size: 0.875rem;
  font-weight: 700;
  color: #fff;
  text-align: center;
  margin: 0;
}

.onboarding-byline {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-align: center;
  margin-top: 0.125rem;
  margin-bottom: 0.75rem;
}

.onboarding-info {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  background: var(--teal-dark);
  border-radius: 0.75rem;
  padding: 0.625rem;
  margin-bottom: 0.75rem;
  color: var(--amber);
}

.onboarding-info p {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.85);
  line-height: 1.5;
  margin: 0;
}

.onboarding-cta {
  width: 100%;
  padding: 0.625rem;
  border-radius: 0.75rem;
  border: none;
  cursor: pointer;
  background: var(--amber);
  color: #fff;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.onboarding-map-desc {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.65);
  line-height: 1.55;
  text-align: center;
  margin-bottom: 0.5rem;
}

.onboarding-subscribe-feedback {
  font-size: 0.6875rem;
  margin-top: 0.25rem;
  min-height: 1em;
}

.onboarding-divider {
  border: none;
  border-top: 1px solid var(--divider);
  margin-bottom: 0.625rem;
}

.onboarding-checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.onboarding-checkbox {
  width: 0.875rem;
  height: 0.875rem;
  border-radius: 0.25rem;
  border: 2px solid rgba(255,255,255,0.35);
  flex-shrink: 0;
  margin-top: 0.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s;
}

.onboarding-checkbox.is-checked {
  background: var(--amber);
  border-color: var(--amber);
}

.onboarding-checkbox-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.onboarding-email {
  width: 100%;
  padding: 0.375rem 0.625rem;
  border-radius: 0.5rem;
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.9);
  font-family: 'DM Mono', monospace;
  font-size: 0.75rem;
  margin-bottom: 0.375rem;
  box-sizing: border-box;
}

.onboarding-email::placeholder {
  color: rgba(255,255,255,0.35);
}

.onboarding-email-section {
  display: none;
}

.onboarding-email-section.is-visible {
  display: block;
}

.onboarding-subscribe {
  width: 100%;
  padding: 0.375rem;
  border-radius: 0.5rem;
  border: 1px solid rgba(255,255,255,0.2);
  background: none;
  color: rgba(255,255,255,0.5);
  font-size: 0.75rem;
  cursor: pointer;
}

.onboarding-skip {
  display: block;
  width: 100%;
  text-align: center;
  padding: 0.25rem;
  margin-top: 0.5rem;
  border: none;
  background: none;
  color: rgba(255,255,255,0.35);
  font-size: 0.75rem;
  cursor: pointer;
  font-family: 'DM Mono', monospace;
}

/* ─── Map Info Sheet ──────────────────────────────────────────────────────── */

#detail-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  pointer-events: none;
}

#detail-overlay.is-open {
  pointer-events: auto;
}

.detail-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0);
  transition: background 0.3s;
}

#detail-overlay.is-open .detail-backdrop {
  background: rgba(0,0,0,0.3);
}

.detail-sheet {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--teal);
  border-radius: 1rem 1rem 0 0;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}

#detail-overlay.is-open .detail-sheet {
  transform: translateY(0);
}

.detail-handle-row {
  display: flex;
  justify-content: center;
  padding: 0.75rem 0 0.25rem;
}

.detail-handle {
  width: 2rem;
  height: 0.25rem;
  border-radius: 9999px;
  background: rgba(255,255,255,0.3);
}

.detail-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem 0.5rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
}

.detail-sheet-title {
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
}

.detail-close {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.detail-body {
  padding: 0.625rem 1rem 2.5rem;
}

.detail-header {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.detail-thumbnail {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 0.75rem;
  flex-shrink: 0;
  background: rgba(255,255,255,0.1);
  border: 2px dashed rgba(255,255,255,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.45);
}

.detail-title {
  font-size: 0.875rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.3;
  margin: 0;
}

.detail-subtitle {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

.detail-dates {
  background: var(--teal-dark);
  border-radius: 0.75rem;
  padding: 0.75rem;
  margin-top: 0.625rem;
  margin-bottom: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.detail-date-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.detail-date-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.detail-date-value {
  font-size: 0.75rem;
  font-weight: 500;
  color: #fff;
}

.detail-divider {
  height: 1px;
  background: var(--divider);
}

.detail-section {
  margin-bottom: 1rem;
}

.detail-label {
  font-family: 'Alata', sans-serif;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  margin-bottom: 0.375rem;
}

.detail-desc {
  font-size: 0.6875rem;
  color: rgba(255,255,255,0.72);
  line-height: 1.6;
}

.detail-footer-link {
  display: block;
  text-align: center;
  font-size: 0.6875rem;
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.5rem 0 0.25rem;
  margin-top: auto;
}
.detail-footer-link:hover { color: var(--text-secondary); }

/* ─── Detail Action Tiles (3-up: Download / Share / Save offline) ───────────── */

.detail-actions {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.detail-action-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  padding: 0.75rem 0.25rem;
  border-radius: 0.75rem;
  background: rgba(168,213,208,0.15);
  border: none;
  color: var(--teal-light);
  font-family: 'DM Mono', monospace;
  font-size: 0.625rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s;
  text-align: center;
  line-height: 1.2;
}

.detail-action-btn:hover { background: rgba(168,213,208,0.25); }

.detail-action-btn--saved {
  background: rgba(168,213,208,0.15);
  color: var(--amber);
}

.detail-action-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ─── Offline Sheet ───────────────────────────────────────────────────────── */

#offline-overlay {
  position: absolute;
  inset: 0;
  z-index: 25;
  pointer-events: none;
  display: flex;
  align-items: flex-end;
}

#offline-overlay.is-open {
  pointer-events: auto;
}

.offline-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0);
  transition: background 0.3s;
}

#offline-overlay.is-open .offline-backdrop {
  background: rgba(0,0,0,0.3);
}

.offline-sheet {
  position: relative;
  width: 100%;
  background: var(--teal);
  border-radius: 1rem 1rem 0 0;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  z-index: 1;
}

#offline-overlay.is-open .offline-sheet {
  transform: translateY(0);
}

.offline-handle-row {
  display: flex;
  justify-content: center;
  padding: 0.75rem 0 0.25rem;
}

.offline-handle {
  width: 2rem;
  height: 0.25rem;
  border-radius: 9999px;
  background: rgba(255,255,255,0.3);
}

.offline-body {
  padding: 0.25rem 1rem 2.5rem;
}

.offline-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.offline-icon-wrap {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.75rem;
  background: rgba(249,165,38,0.2);
  color: var(--amber);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.offline-icon-wrap svg {
  width: 1.125rem;
  height: 1.125rem;
}

.offline-title {
  font-size: 0.875rem;
  font-weight: 700;
  color: #fff;
}

.offline-subtitle {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 0.125rem;
}

.offline-info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--teal-dark);
  border-radius: 0.75rem;
  padding: 0.75rem;
  margin-bottom: 0.75rem;
}

.offline-info-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.offline-info-value {
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
}

.offline-desc {
  font-size: 0.6875rem;
  color: rgba(255,255,255,0.55);
  line-height: 1.6;
  margin-bottom: 1rem;
}

.offline-cta {
  width: 100%;
  padding: 0.625rem;
  border-radius: 0.75rem;
  border: none;
  cursor: pointer;
  background: var(--amber);
  color: #fff;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  font-family: 'DM Mono', monospace;
}

.offline-cancel {
  display: block;
  width: 100%;
  padding: 0.375rem;
  border: none;
  background: none;
  color: rgba(255,255,255,0.4);
  font-size: 0.75rem;
  cursor: pointer;
  font-family: 'DM Mono', monospace;
}

/* Progress bar */

.progress-track {
  width: 100%;
  height: 0.5rem;
  border-radius: 9999px;
  background: rgba(255,255,255,0.15);
  margin-bottom: 0.5rem;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 9999px;
  background: var(--amber);
  transition: width 0.2s linear;
}

.progress-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.6875rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

/* Done state icon */

.offline-done-icon {
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 50%;
  background: rgba(249,165,38,0.2);
  color: var(--amber);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0.5rem auto 0.75rem;
}

.offline-done-icon svg {
  width: 1.5rem;
  height: 1.5rem;
}

/* Offline button saved state */

.right-btn--saved {
  background: var(--amber);
  color: #fff;
}

/* ─── Install Guide Sheet ─────────────────────────────────────────────────── */

#install-overlay {
  position: absolute;
  inset: 0;
  z-index: 35;
  pointer-events: none;
  display: flex;
  align-items: flex-end;
}

#install-overlay.is-open {
  pointer-events: auto;
}

.install-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0);
  transition: background 0.3s;
}

#install-overlay.is-open .install-backdrop {
  background: rgba(0,0,0,0.3);
}

.install-sheet {
  position: relative;
  width: 100%;
  background: var(--teal);
  border-radius: 1rem 1rem 0 0;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  z-index: 1;
}

#install-overlay.is-open .install-sheet {
  transform: translateY(0);
}

.install-steps {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background: var(--teal-dark);
  border-radius: 0.75rem;
  padding: 0.875rem;
  margin-bottom: 1rem;
}

.install-step {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.install-step-num {
  width: 1.375rem;
  height: 1.375rem;
  border-radius: 50%;
  background: var(--amber);
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.install-step-text {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.8);
  line-height: 1.45;
}

.install-step-text strong {
  color: #fff;
  font-weight: 600;
}

.install-step-text svg {
  display: inline;
  vertical-align: middle;
  margin: 0 1px -1px;
}

/* ─── Right button group (wraps track + offline buttons) ─────────────────── */

.right-btn-group {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

/* ─── Permission Sheet ────────────────────────────────────────────────────── */

#perm-overlay {
  position: absolute;
  inset: 0;
  z-index: 30;
  pointer-events: none;
  display: flex;
  align-items: flex-end;
}

#perm-overlay.is-open {
  pointer-events: auto;
}

.perm-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0);
  transition: background 0.3s;
}

#perm-overlay.is-open .perm-backdrop {
  background: rgba(0,0,0,0.3);
}

.perm-sheet {
  position: relative;
  width: 100%;
  background: var(--teal);
  border-radius: 1rem 1rem 0 0;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  z-index: 1;
}

#perm-overlay.is-open .perm-sheet {
  transform: translateY(0);
}

/* ─── Tablet Layout (768px+) ──────────────────────────────────────────────── */

@media (min-width: 768px) {

  /* Top bar — full-width solid bar */
  #top-bar {
    top: 0;
    left: 0;
    right: 0;
    background: var(--navy-solid);
    border-bottom: 1px solid rgba(255,255,255,0.12);
    padding: 0.5rem 1rem;
    gap: 1rem;
    align-items: center;
  }

  /* Title pill loses its pill shape, becomes plain text */
  .title-pill {
    background: transparent;
    padding: 0.25rem 0;
    border-radius: 0;
    max-width: none;
    gap: 0.5rem;
  }

  .title-pill:hover { background: transparent; }

  .title-pill-sep { display: none; }

  .title-pill-text { font-size: 1rem; }

  /* Status pill hidden — online status moves to tablet top right */
  .status-pill { display: none; }

  /* Tablet top-right: coords + GPS status + online indicator */
  .tablet-top-right {
    display: flex !important;
    align-items: center;
    gap: 0.875rem;
    flex-shrink: 0;
  }

  .tablet-coords {
    font-size: 0.6875rem;
    color: rgba(255,255,255,0.62);
    white-space: nowrap;
    letter-spacing: 0.02em;
  }

  .tablet-elev {
    font-size: 0.6875rem;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
  }

  .tablet-status-pill {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.5rem;
    font-size: 0.6875rem;
    white-space: nowrap;
    background: var(--terracotta);
    color: rgba(255,255,255,0.9);
  }

  .tablet-online-indicator {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    flex-shrink: 0;
  }

  .tablet-online-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    flex-shrink: 0;
  }

  .tablet-online-dot--online  { background: #4ade80; }
  .tablet-online-dot--offline { background: var(--amber); }

  .tablet-online-label {
    font-size: 0.6875rem;
    color: rgba(255,255,255,0.75);
  }

  .tablet-fix-btn {
    font-size: 0.6875rem;
    font-weight: 600;
    color: rgba(255,255,255,0.85);
    background: none;
    border: none;
    cursor: pointer;
    font-family: 'DM Mono', monospace;
    padding: 0;
    white-space: nowrap;
  }

  /* Right controls — positioned below solid top bar */
  #north-arrow {
    top: 3.5rem;
  }

  /* Compass rose slightly larger on tablet */
  .compass-rose {
    width: 2rem;
    height: 2rem;
    align-self: center;
  }

  /* Bottom bar hidden — coords are in top bar */
  #bottom-bar { display: none; }

  /* Status banner hidden — GPS state is in top bar */
  #status-banner { display: none !important; }

  /* Sheets — constrained width, centered as cards */
  #offline-overlay,
  #perm-overlay,
  #install-overlay {
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    transition: left 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  }

  /* When side panel is open, center modals in the remaining map area */
  body.panel-open #offline-overlay,
  body.panel-open #perm-overlay,
  body.panel-open #install-overlay {
    left: 360px;
  }

  .offline-sheet,
  .perm-sheet,
  .install-sheet {
    max-width: 420px;
    width: 100%;
    border-radius: 1rem;
    transform: scale(0.95);
    transition: transform 0.25s cubic-bezier(0.32, 0.72, 0, 1),
                opacity 0.25s ease;
    opacity: 0;
  }

  #offline-overlay.is-open .offline-sheet,
  #perm-overlay.is-open .perm-sheet,
  #install-overlay.is-open .install-sheet {
    transform: scale(1);
    opacity: 1;
  }

  /* Map info sheet — constrained */
  #detail-overlay {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
  }

  .detail-sheet {
    position: relative;
    bottom: auto;
    left: auto;
    right: auto;
    max-width: 420px;
    width: 100%;
    border-radius: 1rem;
    transform: scale(0.95);
    transition: transform 0.25s cubic-bezier(0.32, 0.72, 0, 1),
                opacity 0.25s ease;
    opacity: 0;
  }

  #detail-overlay.is-open .detail-sheet {
    transform: scale(1);
    opacity: 1;
  }

}

/* ─── Maps Button ──────────────────────────────────────────────────────────── */

/* Mobile: combined status+maps pill */
.top-bar-right {
  display: flex;
  align-items: stretch;
  gap: 0;
  flex-shrink: 0;
  background: var(--navy-solid);
  border-radius: 0.75rem;
  overflow: hidden;
}

.status-pill {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.625rem;
  background: transparent;
  flex-shrink: 0;
  border-radius: 0;
}

.maps-btn {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.625rem;
  border-radius: 0;
  background: transparent;
  border: none;
  border-left: 1px solid rgba(255,255,255,0.15);
  cursor: pointer;
  pointer-events: auto;
  color: var(--text-primary);
  font-family: 'DM Mono', monospace;
  font-size: 0.75rem;
  font-weight: 500;
  flex-shrink: 0;
}
.maps-btn:hover { background: rgba(255,255,255,0.12); }
.maps-btn-label { display: none; }

@media (min-width: 768px) {
  /* Desktop: separate pills again */
  .top-bar-right {
    background: transparent;
    border-radius: 0;
    gap: 0.5rem;
    align-items: center;
    overflow: visible;
  }
  /* Status pill hidden on tablet/desktop — online status lives in tablet-top-right */
  .status-pill { display: none; }
  .maps-btn {
    background: transparent;
    padding: 0.375rem 0.75rem;
    border-radius: 0.5rem;
    border-left: none;
    font-size: 0.875rem;
    gap: 0.5rem;
  }
  .maps-btn svg { width: 16px; height: 16px; }
  .maps-btn:hover { background: rgba(255,255,255,0.1); }
  .maps-btn-label { display: inline; }
}

/* ─── Maps Overlay & Sheet ─────────────────────────────────────────────────── */

#maps-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-end;
  pointer-events: none;
}
#maps-overlay.is-open { pointer-events: auto; }

.maps-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.5);
  opacity: 0;
  transition: opacity 0.25s ease;
}
#maps-overlay.is-open .maps-backdrop { opacity: 1; }

.maps-sheet {
  position: relative;
  width: 100%;
  background: var(--teal);
  border-radius: 1.25rem 1.25rem 0 0;
  border-top: 1px solid rgba(255,255,255,0.15);
  padding-bottom: calc(0.5rem + env(safe-area-inset-bottom));
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.32,0.72,0,1);
  max-height: 72vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#maps-overlay.is-open .maps-sheet { transform: translateY(0); }

/* iPhone SE and short screens: reduce sheet height to keep map visible */
@media (max-height: 680px) {
  .maps-sheet { max-height: 65vh; }
}

.maps-header {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 0.625rem 1.25rem 0.875rem;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(255,255,255,0.12);
}
.maps-header-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
}
.maps-header-count {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.45);
  margin-top: 0.2rem;
}
.maps-close-btn {
  width: 1.875rem;
  height: 1.875rem;
  border-radius: 50%;
  background: rgba(255,255,255,0.12);
  border: none;
  color: rgba(255,255,255,0.7);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
}
.maps-close-btn:hover { background: rgba(255,255,255,0.2); }

.maps-empty {
  padding: 2.5rem 1.25rem;
  text-align: center;
  color: rgba(255,255,255,0.45);
  font-size: 0.875rem;
  line-height: 1.6;
}

.maps-list {
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
}

.maps-footer {
  padding: 0.75rem 1.25rem 0.25rem;
  border-top: 1px solid rgba(255,255,255,0.1);
  flex-shrink: 0;
}
.maps-add-btn {
  font-family: 'DM Mono', monospace;
  font-size: 0.8125rem;
  color: var(--teal-light);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  transition: opacity 0.15s;
}
.maps-add-btn:hover { opacity: 0.75; }

/* ─── Map Row ──────────────────────────────────────────────────────────────── */

.map-row + .map-row {
  border-top: 1px solid rgba(255,255,255,0.08);
}

.map-row-inner {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.75rem 1rem;
  cursor: pointer;
  transition: background 0.15s ease;
  border-left: 3px solid transparent;
}
.map-row-inner:active { background: rgba(0,0,0,0.1); }

.map-row--active .map-row-inner {
  background: var(--teal-dark);
  border-left-color: rgba(255,255,255,0.4);
}

.map-row-thumb {
  width: 2.625rem;
  height: 2.625rem;
  border-radius: 0.5rem;
  overflow: hidden;
  flex-shrink: 0;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
}
.map-row-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.map-row-info { flex: 1; min-width: 0; }

.map-row-title-row {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  min-width: 0;
}

.map-active-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4ade80;
  flex-shrink: 0;
}
.map-row-title {
  font-family: 'Alata', sans-serif;
  font-size: 0.875rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.map-row-subtitle {
  font-size: 0.6875rem;
  color: rgba(255,255,255,0.45);
  margin-top: 0.2rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.map-badge {
  font-size: 0.5625rem;
  font-family: 'DM Mono', monospace;
  padding: 0.1rem 0.4rem;
  border-radius: 0.25rem;
  font-weight: 500;
  line-height: 1.6;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}
.map-badge--open   { background: var(--teal); color: #fff; }
.map-badge--active { background: rgba(74,222,128,0.15); color: #4ade80; border: 1px solid rgba(74,222,128,0.25); }
.map-badge--saved  { background: rgba(255,255,255,0.07); color: var(--text-secondary); border: 1px solid rgba(255,255,255,0.1); }

/* ─── Row Action Buttons ───────────────────────────────────────────────────── */

.map-row-actions {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  flex-shrink: 0;
}

.map-row-action {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.625rem;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, opacity 0.15s;
  background: rgba(168,213,208,0.15);
  color: var(--teal-light);
}
.map-row-action:hover { background: rgba(168,213,208,0.25); }

.map-row-action--cache.is-cached {
  background: rgba(168,213,208,0.15);
  color: var(--amber);
}
.map-row-action--cache.is-cached:hover { background: rgba(168,213,208,0.25); }

.map-row-action--delete {
  background: var(--terracotta);
  color: #fff;
  border: 1px solid rgba(0,0,0,0.15);
}
.map-row-action--delete:hover { background: #a8432c; }

a.map-row-action {
  text-decoration: none;
}

/* ─── Code Entry Screen ────────────────────────────────────────────────────── */

.code-entry-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--teal-dark);
  padding: 2rem;
  z-index: 100;
}
.code-entry-card {
  width: 100%;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.375rem;
}
.code-entry-logo {
  height: 2.25rem;
  width: auto;
  filter: brightness(0) invert(1);
  opacity: 0.85;
  margin-bottom: 1.25rem;
}
.code-entry-heading {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}
.code-entry-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin: 0 0 0.5rem;
  line-height: 1.5;
}
.code-entry-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  border: 1.5px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.07);
  color: var(--text-primary);
  font-family: 'DM Mono', monospace;
  font-size: 1rem;
  letter-spacing: 0.1em;
  text-align: center;
  text-transform: uppercase;
  outline: none;
  margin-top: 0;
}
.code-entry-input::placeholder { color: var(--text-muted); text-transform: none; letter-spacing: 0; }
.code-entry-input:focus { border-color: rgba(255,255,255,0.4); background: rgba(255,255,255,0.1); }
.code-entry-error {
  font-family: 'DM Mono', monospace;
  font-size: 0.75rem;
  color: var(--terracotta);
  margin: 0;
  min-height: 0;
}
.code-entry-back {
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: 'DM Mono', monospace;
  font-size: 0.8125rem;
  cursor: pointer;
  padding: 0.25rem 0;
  margin-top: 0.25rem;
}
.code-entry-back:hover { color: var(--text-secondary); }

/* Desktop: maps sheet displayed as centered card */
@media (min-width: 768px) {
  #maps-overlay {
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
  }
  .maps-sheet {
    max-width: 480px;
    width: 100%;
    border-radius: 1.125rem;
    border: 1px solid rgba(255,255,255,0.14);
    box-shadow: 0 24px 64px rgba(0,0,0,0.5), 0 4px 16px rgba(0,0,0,0.25);
    transform: translateY(8px) scale(0.97);
    transition: transform 0.22s cubic-bezier(0.32,0.72,0,1), opacity 0.22s ease;
    opacity: 0;
    max-height: 70vh;
    align-self: center;
    padding-bottom: 0;
  }
  #maps-overlay.is-open .maps-sheet { transform: translateY(0) scale(1); opacity: 1; }
  .maps-sheet .offline-handle-row { display: none; }
  .maps-footer { padding-bottom: 0.875rem; }
}

/* ─── Side Panel (tablet + desktop) ─────────────────────────────────────────── */

/* Hidden on mobile — bottom sheets handle it there */
#side-panel { display: none; }

@media (min-width: 600px) {
  #side-panel {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 300px;
    z-index: 30; /* above map (0), below top-bar (55) */
    background: var(--teal);
    border-right: 1px solid rgba(255,255,255,0.10);
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
    pointer-events: none;
  }

  #side-panel.is-open {
    transform: translateX(0);
    pointer-events: auto;
  }

  #side-panel.no-transition {
    transition: none !important;
  }
}

@media (min-width: 600px) {
  .side-panel-inner {
    height: 100%;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
  }

  /* Inline close button — sits in each section header row */
  .side-panel-close {
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.25rem;
    transition: color 0.15s;
    flex-shrink: 0;
  }
  .side-panel-close:hover { color: var(--text-primary); }
  .side-panel-close svg { width: 15px; height: 15px; }


  .side-panel-section {
    padding: 1rem 1.25rem 1.25rem;
  }

  /* First section clears the top bar.
     Tablet (600–767px): mobile pill top bar is ~3rem from top + 1rem offset.
     Desktop (768px+): full-width bar is ~3rem tall, override below. */
  .side-panel-section:first-child {
    padding-top: 3.5rem;
  }

  .side-panel-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 0.625rem;
    border-bottom: 1px solid rgba(255,255,255,0.12);
    margin-bottom: 0.75rem;
  }

  /* Detail section */
  .side-panel-detail {
    border-bottom: 1px solid rgba(255,255,255,0.12);
  }

  .side-panel-thumb {
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 0.75rem;
    overflow: hidden;
    margin-bottom: 1rem;
  }
  .side-panel-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
}

@media (min-width: 768px) {
  #side-panel { width: 360px; }

  /* Desktop top bar is full-width ~3rem tall — needs more clearance */
  .side-panel-section:first-child {
    padding-top: 4rem;
  }

  .side-panel-thumb {
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 0.75rem;
    overflow: hidden;
    margin-bottom: 1rem;
  }
  .side-panel-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  /* Maps section */
  .side-panel-maps {
    flex: 1;
    padding-bottom: 0;
  }

  .side-panel-maps-header {
    padding-bottom: 0.625rem;
    border-bottom: 1px solid rgba(255,255,255,0.12);
    margin-bottom: 0.25rem;
  }

  /* Override maps-list scroll behaviour — outer panel scrolls as one unit */
  #side-panel .maps-list {
    overflow-y: visible;
    flex: none;
  }
}

/* ─── Sheets Button (top bar, bundle mode only) ────────────────────────────── */

/* Mobile: sits inside the combined .top-bar-right pill, same style as .maps-btn */
.sheets-btn {
  display: flex;
  align-items: center;
  padding: 0.375rem 0.625rem;
  border-radius: 0;
  background: transparent;
  border: none;
  border-left: 1px solid rgba(255,255,255,0.15);
  cursor: pointer;
  pointer-events: auto;
  color: var(--text-primary);
  flex-shrink: 0;
  transition: background 0.15s;
}
.sheets-btn:hover { background: rgba(255,255,255,0.12); }

@media (min-width: 768px) {
  .sheets-btn {
    background: transparent;
    padding: 0.375rem 0.625rem;
    border-radius: 0.5rem;
    border-left: none;
  }
  .sheets-btn svg { width: 15px; height: 15px; }
}

/* ─── Bundle Inset Widget ────────────────────────────────────────────────────── */

#bundle-inset {
  width: 54px;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s;
  border-radius: 0.625rem;
  padding: 0.3rem;
  background: rgba(31, 100, 96, 0.3);
  -webkit-tap-highlight-color: transparent;
}
#bundle-inset:hover,
#bundle-inset:focus-visible { opacity: 1; outline: none; }

@media (min-width: 600px) {
  #bundle-inset { width: 63px; }
}

/* ─── Bundle Index Popup ─────────────────────────────────────────────────────── */

.bundle-map-sheet {
  position: relative;
  width: 100%;
  background: var(--teal);
  border-radius: 1.25rem 1.25rem 0 0;
  border-top: 1px solid rgba(255,255,255,0.15);
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  max-height: 82vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#bundle-index-overlay.is-open .bundle-map-sheet { transform: translateY(0); }

.bmap-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.625rem 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,0.12);
  flex-shrink: 0;
}
.bmap-header-title { font-size: 0.9375rem; }

.bmap-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* SVG panel */
.bmap-svg-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,0.10);
  background: rgba(0,0,0,0.10);
  flex-shrink: 0;
}
.bmap-svg-panel svg { max-height: 34vh; width: auto; height: auto; max-width: 100%; filter: drop-shadow(0 1px 3px rgba(0,0,0,0.65)); }
#bundle-inset svg { filter: drop-shadow(0 1px 3px rgba(0,0,0,0.65)); }

/* List panel */
.bmap-list-panel { overflow-y: auto; flex: 1; }

.bmap-list-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  width: 100%;
  padding: 0.75rem 1.25rem;
  background: none;
  border: none;
  border-left: 3px solid transparent;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  color: var(--text-primary);
  font-family: 'DM Mono', monospace;
  font-size: 0.875rem;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s;
}
.bmap-list-item:last-child { border-bottom: none; }
.bmap-list-item:hover:not(:disabled) { background: rgba(255,255,255,0.07); }
.bmap-list-item:disabled { cursor: default; }
.bmap-list-item--active {
  background: var(--teal-dark);
  border-left-color: rgba(255,255,255,0.4);
}

.bmap-list-num {
  font-size: 0.6875rem;
  color: var(--text-secondary);
  padding-top: 0.1rem;
  width: 1.25rem;
  flex-shrink: 0;
  text-align: right;
}
.bmap-list-title {
  flex: 1;
  font-size: 0.8125rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.35;
}
.bmap-list-chevron { color: var(--text-secondary); flex-shrink: 0; }

/* Tablet (600–767px): side-by-side */
@media (min-width: 600px) and (max-width: 767px) {
  .bundle-map-sheet { max-height: 60vh; }
  .bmap-body { flex-direction: row; }
  .bmap-svg-panel {
    border-bottom: none;
    border-right: 1px solid rgba(255,255,255,0.10);
    width: 50%;
    flex-shrink: 0;
    max-height: none;
  }
  .bmap-svg-panel svg { max-height: none; width: 100%; height: auto; }
}

/* Tablet + desktop: inside side panel */
@media (min-width: 600px) {
  .side-panel-bundle-section {
    border-bottom: 1px solid rgba(255,255,255,0.12);
  }

  .sp-bmap-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 0 0.625rem;
    border-bottom: 1px solid rgba(255,255,255,0.10);
    margin-bottom: 0.75rem;
  }

  .side-panel-bundle-section .bmap-body {
    flex-direction: row;
    gap: 0.75rem;
    align-items: flex-start;
    overflow: visible;
  }

  .side-panel-bundle-section .bmap-svg-panel {
    padding: 0;
    border: none;
    background: none;
    width: 45%;
    flex-shrink: 0;
    align-items: flex-start;
    justify-content: flex-start;
  }

  .side-panel-bundle-section .bmap-svg-panel svg {
    max-height: none;
    width: 100%;
    height: auto;
  }

  .side-panel-bundle-section .bmap-list-panel {
    flex: 1;
    overflow-y: visible;
    padding: 0;
  }

  .side-panel-bundle-section .bmap-list-item {
    padding: 0.5rem 0;
    font-size: 0.8125rem;
    border-bottom-color: rgba(255,255,255,0.06);
    gap: 0.5rem;
  }

  .side-panel-bundle-section .bmap-list-item:last-child { border-bottom: none; }
}

/* ─── Bundle Index Overlay ─────────────────────────────────────────────────── */

#bundle-index-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: flex-end;
  z-index: 70;
  pointer-events: none;
}
#bundle-index-overlay.is-open { pointer-events: auto; }

.bundle-index-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.5);
  opacity: 0;
  transition: opacity 0.25s ease;
}
#bundle-index-overlay.is-open .bundle-index-backdrop { opacity: 1; }

.bundle-index-sheet {
  position: relative;
  width: 100%;
  background: var(--teal);
  border-radius: 1.25rem 1.25rem 0 0;
  border-top: 1px solid rgba(255,255,255,0.15);
  padding-bottom: calc(0.5rem + env(safe-area-inset-bottom));
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.32,0.72,0,1);
  max-height: 72vh;
  overflow: hidden;
}
#bundle-index-overlay.is-open .bundle-index-sheet { transform: translateY(0); }

.bundle-index-list {
  overflow-y: auto;
  max-height: calc(72vh - 5.5rem);
  padding-bottom: 0.5rem;
}

.bundle-index-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 1rem;
  cursor: pointer;
  transition: background 0.15s;
}
.bundle-index-row:not(.bundle-index-row--active):hover { background: rgba(255,255,255,0.07); }
.bundle-index-row--active { pointer-events: none; }

.bundle-index-info {
  flex: 1;
  min-width: 0;
}
.bundle-index-title {
  font-size: 0.875rem;
  font-weight: 500;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bundle-index-num {
  font-size: 0.6875rem;
  color: var(--text-secondary);
  margin-top: 0.125rem;
}
.bundle-index-chevron { color: var(--text-muted); }

@media (min-width: 768px) {
  #bundle-index-overlay {
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
  }
  .bundle-index-sheet {
    max-width: 480px;
    width: 100%;
    border-radius: 1.125rem;
    border: 1px solid rgba(255,255,255,0.14);
    box-shadow: 0 24px 64px rgba(0,0,0,0.5), 0 4px 16px rgba(0,0,0,0.25);
    transform: translateY(8px) scale(0.97);
    transition: transform 0.22s cubic-bezier(0.32,0.72,0,1), opacity 0.22s ease;
    opacity: 0;
    max-height: 70vh;
    align-self: center;
    padding-bottom: 0;
  }
  #bundle-index-overlay.is-open .bundle-index-sheet { transform: translateY(0) scale(1); opacity: 1; }
  .bundle-index-sheet .offline-handle-row { display: none; }
}

/* ─── Bundle Welcome Sheet ─────────────────────────────────────────────────── */

.bundle-welcome-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: flex-end;
  z-index: 80;
}
.bundle-welcome-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.5);
}
.bundle-welcome-sheet {
  position: relative;
  width: 100%;
  background: var(--teal);
  border-radius: 1.25rem 1.25rem 0 0;
  border-top: 1px solid rgba(255,255,255,0.15);
  padding-bottom: calc(1rem + env(safe-area-inset-bottom));
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.32,0.72,0,1);
}
.bundle-welcome-sheet.is-open { transform: translateY(0); }
.bundle-welcome-body { padding: 0.5rem 1.25rem 0; }
.bundle-welcome-icon {
  color: var(--teal-light);
  margin-bottom: 0.75rem;
}
.bundle-welcome-title {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}
.bundle-welcome-desc {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.55;
  margin-bottom: 1rem;
}
.bundle-welcome-list {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}
.bundle-welcome-row {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-size: 0.8125rem;
}
.bundle-welcome-num {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6875rem;
  font-weight: 600;
  flex-shrink: 0;
}
.bundle-welcome-name { color: var(--text-primary); }

/* ─── Maps Sheet Bundle Grouping ───────────────────────────────────────────── */

.maps-group-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.875rem 1rem 0.25rem;
  color: var(--teal-light);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.maps-group-icon { opacity: 0.75; flex-shrink: 0; }
.maps-group-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.map-row--bundle {
  border-left: 2px solid rgba(168,213,208,0.25);
  margin-left: 0.75rem;
}

/* ─── Add Map Modal ──────────────────────────────────────────────────────────── */

#add-map-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 80;
  align-items: flex-end;
  justify-content: center;
  background: transparent;
}
#add-map-overlay.is-open { display: flex; }

.add-map-sheet {
  width: 100%;
  max-height: 92dvh;
  background: var(--teal);
  border-radius: 1.25rem 1.25rem 0 0;
  border: 1px solid rgba(255,255,255,0.10);
  border-bottom: none;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(100%);
  transition: transform 0.28s cubic-bezier(0.32,0.72,0,1);
}
#add-map-overlay.is-open .add-map-sheet { transform: translateY(0); }

.add-map-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 0.625rem 1.25rem 0.875rem;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(255,255,255,0.12);
}
.add-map-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
}
.add-map-subtitle {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.45);
  margin-top: 0.2rem;
}

.add-map-body {
  overflow-y: auto;
  padding: 1rem 1.25rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.add-map-section-label {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--teal-light);
  margin: 0 0 0.375rem;
}
.add-map-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin: 0 0 0.625rem;
  line-height: 1.5;
}
.add-map-section .code-entry-input {
  text-align: left;
  margin-top: 0;
  margin-bottom: 0.5rem;
}
.add-map-section .code-entry-error { min-height: 0; }

.add-map-or {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.25rem 0;
}
.add-map-or-line {
  flex: 1;
  height: 1px;
  background: rgba(255,255,255,0.10);
}
.add-map-or-text {
  font-family: 'DM Mono', monospace;
  font-size: 0.6875rem;
  color: var(--text-muted);
}

.add-map-import-btn {
  width: 100%;
  padding: 0.875rem 1rem;
  border-radius: 0.875rem;
  border: none;
  background: rgba(168,213,208,0.2);
  color: var(--text-primary);
  font-family: 'DM Mono', monospace;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.625rem;
  transition: background 0.15s;
}
.add-map-import-btn:active { background: rgba(168,213,208,0.32); }
.add-map-import-btn svg { flex-shrink: 0; width: 15px; height: 15px; }

/* Full-screen code entry — import option */
.code-entry-import-section {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
}
.code-entry-or {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  margin: 0.75rem 0;
}
.code-entry-or-line {
  flex: 1;
  height: 1px;
  background: rgba(255,255,255,0.10);
}
.code-entry-or-text {
  font-family: 'DM Mono', monospace;
  font-size: 0.6875rem;
  color: var(--text-muted);
}
.code-entry-import-btn {
  width: 100%;
  padding: 0.625rem 1rem;
  border-radius: 0.875rem;
  border: 1.5px dashed rgba(168,213,208,0.35);
  background: rgba(168,213,208,0.06);
  color: var(--teal-light);
  font-family: 'DM Mono', monospace;
  font-size: 0.8125rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: background 0.15s, border-color 0.15s;
}
.code-entry-import-btn:active {
  background: rgba(168,213,208,0.12);
  border-color: rgba(168,213,208,0.55);
}

/* ─── Import Sheet ───────────────────────────────────────────────────────────── */

.import-back-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: 'DM Mono', monospace;
  font-size: 0.8125rem;
  cursor: pointer;
  padding: 0 0 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.375rem;
}
.import-back-btn:hover { color: var(--text-secondary); }

.import-file-info {
  background: var(--teal-dark);
  border-radius: 0.875rem;
  padding: 0.875rem 1rem;
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}
.import-file-name-row {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
}
.import-file-icon {
  width: 2rem;
  height: 2rem;
  border-radius: 0.5rem;
  background: rgba(168,213,208,0.15);
  color: var(--teal-light);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.import-file-name {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-primary);
  word-break: break-all;
  line-height: 1.3;
  margin: 0;
}
.import-file-size {
  font-family: 'DM Mono', monospace;
  font-size: 0.6875rem;
  color: var(--text-muted);
  margin: 0.125rem 0 0;
}
.import-meta-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.25rem 0.875rem;
}
.import-meta-label {
  font-size: 0.6875rem;
  color: var(--text-muted);
  white-space: nowrap;
  padding: 0.1rem 0;
}
.import-meta-value {
  font-family: 'DM Mono', monospace;
  font-size: 0.6875rem;
  color: var(--text-primary);
  padding: 0.1rem 0;
  word-break: break-word;
}
.import-meta-value--pending { color: var(--text-muted); font-style: italic; }
.import-meta-value--good { color: #4ade80; }
.import-meta-value--warn { color: var(--amber); }

.import-path-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  background: rgba(168,213,208,0.12);
  color: var(--teal-light);
  border-radius: 0.5rem;
  padding: 0.25rem 0.625rem;
  font-family: 'DM Mono', monospace;
  font-size: 0.625rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  align-self: flex-start;
}

.import-actions {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  margin-bottom: 1rem;
}
.import-action-btn {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 0.875rem;
  border: none;
  cursor: pointer;
  font-family: 'DM Mono', monospace;
  font-size: 0.8125rem;
  font-weight: 500;
  transition: opacity 0.15s, background 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}
.import-action-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.import-action-btn--primary {
  background: var(--amber);
  color: #fff;
}
.import-action-btn--secondary {
  background: rgba(168,213,208,0.15);
  color: var(--teal-light);
  border: 1px solid rgba(168,213,208,0.2);
}
.import-action-btn--primary:not(:disabled):active { opacity: 0.85; }
.import-action-btn--secondary:not(:disabled):active { background: rgba(168,213,208,0.25); }

.import-progress-wrap {
  display: none;
  flex-direction: column;
  gap: 0.375rem;
  margin-bottom: 1rem;
}
.import-progress-wrap.is-visible { display: flex; }
.import-progress-label {
  font-family: 'DM Mono', monospace;
  font-size: 0.6875rem;
  color: var(--text-secondary);
}
.import-progress-bar-track {
  width: 100%;
  height: 4px;
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
  overflow: hidden;
}
.import-progress-bar-fill {
  height: 100%;
  background: var(--teal-light);
  border-radius: 2px;
  width: 0%;
  transition: width 0.25s ease;
}

/* Debug panel */
.import-debug {
  border-top: 1px solid rgba(255,255,255,0.08);
  padding-top: 0.875rem;
}
.import-debug-toggle {
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.375rem;
  color: var(--text-muted);
  font-family: 'DM Mono', monospace;
  font-size: 0.6875rem;
  padding: 0;
  width: 100%;
  text-align: left;
}
.import-debug-toggle:hover { color: var(--text-secondary); }
.import-debug-chevron {
  display: inline-block;
  transition: transform 0.18s ease;
  font-size: 0.5rem;
  color: var(--text-muted);
}
.import-debug-toggle.is-open .import-debug-chevron { transform: rotate(90deg); }

.import-debug-body {
  display: none;
  flex-direction: column;
  gap: 0.625rem;
  margin-top: 0.75rem;
}
.import-debug-body.is-open { display: flex; }

.import-timing-log {
  background: rgba(0,0,0,0.25);
  border-radius: 0.625rem;
  padding: 0.625rem 0.75rem;
  font-family: 'DM Mono', monospace;
  font-size: 0.625rem;
  color: rgba(255,255,255,0.55);
  line-height: 1.7;
  max-height: 12rem;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
  user-select: text;
  -webkit-user-select: text;
}
.import-timing-log:empty::before {
  content: 'No events yet.';
  color: rgba(255,255,255,0.25);
  font-style: italic;
}

.import-copy-btn {
  align-self: flex-end;
  background: rgba(168,213,208,0.12);
  border: none;
  border-radius: 0.5rem;
  color: var(--teal-light);
  font-family: 'DM Mono', monospace;
  font-size: 0.625rem;
  padding: 0.375rem 0.75rem;
  cursor: pointer;
}
.import-copy-btn:active { background: rgba(168,213,208,0.22); }

/* Ratings form */
.import-ratings {
  display: none;
  flex-direction: column;
  gap: 0.75rem;
  padding-top: 0.875rem;
  border-top: 1px solid rgba(255,255,255,0.08);
  margin-top: 0.875rem;
}
.import-ratings.is-visible { display: flex; }
.import-ratings-title {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--teal-light);
  margin: 0;
}
.import-rating-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.import-rating-label {
  font-size: 0.6875rem;
  color: var(--text-secondary);
  flex: 1;
  line-height: 1.3;
}
.import-rating-btns {
  display: flex;
  gap: 0.25rem;
  flex-shrink: 0;
}
.import-rating-btn {
  width: 1.625rem;
  height: 1.625rem;
  border-radius: 0.375rem;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.05);
  color: var(--text-muted);
  font-family: 'DM Mono', monospace;
  font-size: 0.625rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.import-rating-btn.is-selected {
  background: rgba(168,213,208,0.25);
  border-color: var(--teal-light);
  color: var(--teal-light);
}
.import-rating-tri-btns {
  display: flex;
  gap: 0.25rem;
  flex-shrink: 0;
}
.import-rating-tri-btn {
  padding: 0.25rem 0.5rem;
  border-radius: 0.375rem;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.05);
  color: var(--text-muted);
  font-family: 'DM Mono', monospace;
  font-size: 0.5625rem;
  cursor: pointer;
  white-space: nowrap;
}
.import-rating-tri-btn.is-selected {
  background: rgba(168,213,208,0.25);
  border-color: var(--teal-light);
  color: var(--teal-light);
}
.import-notes-input {
  width: 100%;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 0.625rem;
  color: var(--text-primary);
  font-family: 'DM Mono', monospace;
  font-size: 0.6875rem;
  padding: 0.5rem 0.75rem;
  resize: vertical;
  min-height: 3.5rem;
  outline: none;
  box-sizing: border-box;
}
.import-notes-input::placeholder { color: var(--text-muted); }
.import-notes-input:focus { border-color: rgba(255,255,255,0.28); }

/* Desktop: add map modal as centered card */
@media (min-width: 768px) {
  #add-map-overlay {
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
  }
  .add-map-sheet {
    max-width: 420px;
    width: 100%;
    border-radius: 1.125rem;
    border: 1px solid rgba(255,255,255,0.14);
    box-shadow: 0 24px 64px rgba(0,0,0,0.5), 0 4px 16px rgba(0,0,0,0.25);
    transform: translateY(8px) scale(0.97);
    transition: transform 0.22s cubic-bezier(0.32,0.72,0,1), opacity 0.22s ease;
    opacity: 0;
    max-height: 80vh;
  }
  #add-map-overlay.is-open .add-map-sheet {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
  .add-map-sheet .offline-handle-row { display: none; }
}
/* On panel-open desktop: center over the map area (right of panel) */
@media (min-width: 768px) {
  body.panel-open #add-map-overlay {
    left: 360px;
  }
}

/* ─── Delete Confirm Dialog ──────────────────────────────────────────────────── */

.confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  pointer-events: none;
}
.confirm-overlay .confirm-dialog {
  pointer-events: auto;
}
.confirm-dialog {
  background: var(--teal);
  border-radius: 1rem;
  border: 1px solid rgba(255,255,255,0.14);
  padding: 1.25rem 1.25rem 1rem;
  max-width: 320px;
  width: 100%;
  box-shadow: 0 16px 48px rgba(0,0,0,0.45);
}
.confirm-title {
  font-family: 'Alata', sans-serif;
  font-size: 0.9375rem;
  color: var(--text-primary);
  margin: 0 0 0.5rem;
}
.confirm-msg {
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0 0 1.125rem;
}
.confirm-map-name {
  color: var(--text-primary);
  font-weight: 600;
}
.confirm-actions {
  display: flex;
  gap: 0.625rem;
}
.confirm-btn {
  flex: 1;
  padding: 0.625rem;
  border-radius: 0.75rem;
  border: none;
  cursor: pointer;
  font-family: 'DM Mono', monospace;
  font-size: 0.8125rem;
  font-weight: 500;
}
.confirm-btn--cancel {
  background: rgba(255,255,255,0.08);
  color: var(--text-secondary);
}
.confirm-btn--cancel:hover { background: rgba(255,255,255,0.13); }
.confirm-btn--delete {
  background: var(--terracotta);
  color: #fff;
}
.confirm-btn--delete:hover { background: #a8432c; }
@media (min-width: 768px) {
  body.panel-open .confirm-overlay { left: 360px; }
}

/* ─── Add Map Modal — import-first layout ────────────────────────────────────── */

.add-map-import-section {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}
.add-map-import-label {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--teal-light);
  margin: 0;
}
.add-map-import-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin: 0 0 0.5rem;
  line-height: 1.5;
}
.add-map-code-section {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.add-map-code-label {
  font-size: 0.625rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(168,213,208,0.6);
  margin: 0 0 0.25rem;
}
.add-map-code-section .code-entry-input {
  text-align: left;
  font-size: 0.875rem;
  padding: 0.625rem 0.875rem;
  margin: 0;
}
.add-map-code-section .code-entry-error { min-height: 0; }
.add-map-code-submit {
  width: 100%;
  padding: 0.5rem;
  border-radius: 0.75rem;
  border: none;
  cursor: pointer;
  background: rgba(255,255,255,0.1);
  color: var(--text-secondary);
  font-family: 'DM Mono', monospace;
  font-size: 0.8125rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
  margin-top: 0.375rem;
}
.add-map-code-submit:hover { background: rgba(255,255,255,0.16); color: var(--text-primary); }
.add-map-code-submit:disabled { opacity: 0.5; cursor: not-allowed; }
