:root {
  font-family: -apple-system, system-ui, sans-serif;
  --topbar-height: 64px;
  --facility-image-width: 220px;
  --route-sheet-height: 280px;
}
body {
  margin: 0;
  padding: 0;
  background: #f3f4f6;
  overflow-x: hidden;
}
body.nav-active {
  overflow: hidden;
  height: 100vh;
}
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  box-sizing: border-box;
  height: calc(var(--topbar-height) + env(safe-area-inset-top, 0px));
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  padding: calc(env(safe-area-inset-top, 0px) + 5px) 12px 5px;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  z-index: 1000;
  gap: 10px;
}
.app-title {
  justify-self: start;
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 15px;
  font-weight: 700;
  color: #111;
}
.app-title-wordmark {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  white-space: nowrap;
  font-size: inherit;
  font-weight: 800;
  line-height: 0.92;
  letter-spacing: -0.02em;
}
.app-brand-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  object-fit: cover;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.18);
}
.icon-btn {
  background: none;
  border: none;
  font-size: 30px;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 10px;
  color: #111;
  transition: background 0.2s;
}
.topbar .icon-btn {
  box-sizing: border-box;
  display: grid;
  flex: 0 0 44px;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  font-size: 27px;
  line-height: 1;
}
.topbar-action-icon {
  width: 27px;
  height: 27px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.25;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon-btn:hover {
  background: #f3f4f6;
}
.topbar-actions {
  display: flex;
  align-items: center;
  justify-self: end;
  gap: 4px;
}
.theme-toggle {
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 12px;
  color: #111;
  user-select: none;
  margin-top: 4px;
}
.theme-toggle input {
  display: none;
}
.theme-toggle .slider {
  width: 36px;
  height: 20px;
  background: #e5e7eb;
  border-radius: 999px;
  position: relative;
  transition: background 0.2s ease;
}
.theme-toggle .slider::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  top: 2px;
  left: 2px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s ease;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.theme-toggle input:checked + .slider {
  background: #3b82f6;
}
.theme-toggle input:checked + .slider::after {
  transform: translateX(16px);
}
.theme-toggle .theme-label {
  font-weight: 600;
  line-height: 1;
}

body.dark {
  background: #0b0f14;
  color: #e5e7eb;
}
body.dark .topbar {
  background: #0f1520;
  border-bottom-color: #1f2937;
}
body.dark .app-title {
  color: #e5e7eb;
}
body.dark .icon-btn {
  color: #e5e7eb;
}
body.dark .icon-btn:hover {
  background: #1f2937;
}
body.dark .card {
  background: #0b0f14;
}
body.dark .tab-btn {
  color: #9ca3af;
}
body.dark .tab-btn:hover {
  background: #1f2937;
  color: #e5e7eb;
}
body.dark .tab-btn.active {
  background: #111827;
  color: #f9fafb;
}
body.dark .btn {
  background: #1f2937;
  color: #f9fafb;
  border-color: #374151;
}
body.dark .btn.secondary {
  background: #0f1520;
  color: #e5e7eb;
  border-color: #374151;
}
body.dark input,
body.dark select,
body.dark textarea {
  background: #0f1520;
  color: #e5e7eb;
  border-color: #374151;
}
body.dark label,
body.dark .muted {
  color: #9ca3af;
}
body.dark .value {
  color: #f9fafb;
}
body.dark .route-panel {
  background: #0f1520;
}
body.dark .map-route-fab {
  background: #111827 !important;
  color: #f9fafb !important;
  box-shadow: 0 6px 18px rgba(0,0,0,0.45);
}
body.dark .live-nav {
  background: #0f1520;
  border-color: #1f2937;
}
body.dark .live-nav-item {
  background: #111827;
  border-color: #1f2937;
}
body.dark .live-nav-title {
  color: #f9fafb;
}
body.dark .live-nav-item span {
  color: #9ca3af;
}
body.dark .modal-content {
  background: #0f1520;
  color: #e5e7eb;
}
body.dark .theme-toggle {
  color: #e5e7eb;
}
body.dark .theme-toggle .slider {
  background: #374151;
}
body.dark .theme-toggle input:checked + .slider {
  background: #2563eb;
}
body.dark .leaflet-bar a,
body.dark .leaflet-control-zoom-in,
body.dark .leaflet-control-zoom-out {
  background: #0f1520;
  color: #e5e7eb;
  border-color: #1f2937;
}
body.dark .leaflet-bar a:hover {
  background: #1f2937;
}
body.dark .leaflet-bar {
  box-shadow: 0 6px 18px rgba(0,0,0,0.35);
}
body.dark .bottom-sheet {
  background: #0f1520;
}
body.dark .sheet-handle {
  background: #4b5563;
}
body.dark .nav-search-results {
  background: #0f1520;
  border-color: #1f2937;
  color: #e5e7eb;
}
body.dark .nav-search-results div,
body.dark .nav-search-option {
  border-bottom-color: #1f2937;
  color: #e5e7eb;
}
body.dark .nav-search-results div:hover,
body.dark .nav-search-option:hover {
  background: #111827;
}
body.dark .route-info {
  background: #0f1520;
  border-color: #1f2937;
  color: #e5e7eb;
}
body.dark .calculated-route-summary {
  background: #0f1520;
  border-color: #1f2937;
}
body.dark .calculated-route-metric {
  background: #111827;
  border-color: #1f2937;
}
body.dark .calculated-route-metric span,
body.dark .calculated-route-summary-note {
  color: #9ca3af;
}
body.dark .calculated-route-metric strong {
  color: #f9fafb;
}
body.dark .map-fab,
body.dark .map-fab.btn {
  background: transparent !important;
  box-shadow: none !important;
}
body.dark .leaflet-popup-content-wrapper {
  background: #0f1520;
  color: #e5e7eb;
}
body.dark .leaflet-popup-tip {
  background: #0f1520;
}
body.dark .live-nav-compact {
  background: #0f1520;
  border: 1px solid #1f2937;
}
body.dark .live-nav-compact-label {
  color: #9ca3af;
}
body.dark .live-nav-compact-value {
  color: #f9fafb;
}
.card {
  max-width: none;
  margin: 0;
  background: white;
  border-radius: 0;
  padding: calc(var(--topbar-height) + 16px + env(safe-area-inset-top, 0px)) 16px 16px;
  box-shadow: none;
  min-height: 100vh;
  overflow: auto;
}
body.nav-active .card {
  overflow: hidden;
}

/* Tabs */
.tabs {
  display: flex;
  align-items: center;
  justify-self: center;
  gap: 8px;
  margin: 0;
  border-bottom: none;
  padding: 0;
}
.tab-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  padding: 8px 12px;
  margin: 0;
  min-width: 58px;
  line-height: 1.2;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  color: #6b7280;
  border-radius: 10px;
  transition: all 0.2s;
}
.tab-btn:hover {
  background: #f3f4f6;
  color: #111;
}
.tab-btn.active {
  color: #111;
  background: #f1f5f9;
}
.tab-content {
  display: none;
}
.tab-content.active {
  display: block;
}

/* Map and Navigation */
.map-container {
  position: fixed;
  top: calc(var(--topbar-height) + env(safe-area-inset-top, 0px));
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: auto;
  border-radius: 0;
  margin: 0;
  border: none;
  z-index: 1;
  transform-origin: center center;
}

/* Rotate mode: Make map huge to cover corners without scaling artifacts */
.map-container.map-rotating {
  width: 150vmax;
  height: 150vmax;
  left: 50%;
  top: 50%;
  /* Combine centering translate with rotation */
  transform: translate(-50%, -50%) rotate(var(--map-rotation, 0deg));
  /* Override top offset since we center absolutely */
  margin-top: 0;
  /* Z-index adjustments */
  z-index: 1;
}

/* Hide navigation controls when rotating (they would be off-screen) */
.map-container.map-rotating .leaflet-control-container {
  display: none;
}

/* Rotate each complete marker exactly once to keep it upright. */
.map-container.map-rotating .temple-map-symbol,
.map-container.map-rotating .facility-map-symbol,
.map-container.map-rotating .facility-pie-marker {
  transform: rotate(var(--map-rotation-inverse, 0deg));
  transform-origin: center center;
}
.map-container.map-rotating .facility-marker .marker-icon {
  transform: rotate(var(--map-rotation-inverse, 0deg));
  transform-origin: center center;
  display: block;
}

/* Rotate the WHOLE popup (box + tip) using modern rotate property to compose with Leaflet's transform */
.map-container.map-rotating .leaflet-popup {
  rotate: var(--map-rotation-inverse, 0deg);
  transform-origin: center bottom;
  /* Visual adjustments: Move up to clear marker, move right to center */
  margin-bottom: 30px;
  margin-left: 1px;
}

/* Reset inner parts to default */
.map-container.map-rotating .leaflet-popup-content-wrapper,
.map-container.map-rotating .leaflet-popup-tip-container {
  transform: none;
  display: block;
}
.map-container.map-rotating .leaflet-popup-content-wrapper {
  transform-origin: center bottom;
}

.facility-marker .facility-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}
.facility-marker .facility-icon--image {
  overflow: visible;
  width: 32px;
  height: 32px;
  background-color: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
}
.facility-marker .facility-icon-image {
  width: 28px;
  height: 28px;
  object-fit: contain;
  display: block;
}
.facility-marker .marker-icon {
  font-size: 16px;
  line-height: 1;
}
.temple-marker,
.facility-marker {
  background: transparent;
  border: 0;
}
.temple-map-symbol {
  position: relative;
  width: 40px;
  height: 40px;
  transform-origin: center;
}
.temple-torii-marker {
  position: relative;
  display: block;
  width: 40px;
  height: 40px;
}
.temple-torii-marker img {
  display: block;
  width: 40px;
  height: 37px;
  object-fit: contain;
  filter: drop-shadow(0 0 1px #fff) drop-shadow(0 0 2px #fff) drop-shadow(0 2px 2px rgba(15, 23, 42, 0.68));
}
.facility-map-symbol {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--facility-marker-color);
  border: 2px solid rgba(255, 255, 255, 0.98);
  color: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.38);
  transform-origin: center;
}
.facility-pie-marker {
  position: relative;
  display: block;
  overflow: hidden;
  width: var(--pie-marker-size, 42px);
  height: var(--pie-marker-size, 42px);
  box-sizing: border-box;
  border: 2.5px solid rgba(255, 255, 255, 0.98);
  border-radius: 50%;
  color: #fff;
  box-shadow: 0 3px 8px rgba(15, 23, 42, 0.45);
  transform-origin: center;
  isolation: isolate;
}
.facility-pie-divider {
  position: absolute;
  left: calc(50% - 1px);
  top: 0;
  z-index: 1;
  width: 2px;
  height: 50%;
  background: rgba(255, 255, 255, 0.94);
  transform: rotate(var(--pie-divider-angle, 0deg));
  transform-origin: center bottom;
}
.facility-pie-icon {
  position: absolute;
  left: var(--pie-x, 50%);
  top: var(--pie-y, 50%);
  z-index: 2;
  display: grid;
  width: var(--pie-icon-size, 15px);
  height: var(--pie-icon-size, 15px);
  place-items: center;
  color: #fff;
  filter: drop-shadow(0 1px 1px rgba(15, 23, 42, 0.8));
  transform: translate(-50%, -50%);
}
.facility-pie-icon .facility-svg-icon,
.facility-pie-icon .facility-icon-badged {
  width: 100%;
  height: 100%;
}
.facility-pie-icon .facility-24-badge {
  display: none;
}
.facility-pie-count {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 3;
  display: grid;
  min-width: 24px;
  height: 22px;
  padding: 0 4px;
  box-sizing: border-box;
  place-items: center;
  border: 1.5px solid #fff;
  border-radius: 999px;
  color: #fff;
  background: rgba(15, 23, 42, 0.92);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.55);
  font-size: 11px;
  line-height: 1;
  transform: translate(-50%, -50%);
}
.facility-svg-icon {
  display: block;
  width: 20px;
  height: 20px;
  overflow: visible;
  vector-effect: non-scaling-stroke;
}
.facility-icon-badged {
  position: relative;
  display: block;
  width: 20px;
  height: 20px;
  font-size: initial;
  line-height: normal;
}
.facility-icon-badged .facility-svg-icon {
  width: 100%;
  height: 100%;
}
.facility-24-badge {
  position: absolute;
  z-index: 1;
  top: -5px;
  right: -5px;
  display: grid;
  width: 16px;
  height: 16px;
  place-items: center;
  box-sizing: border-box;
  border: 1.5px solid #365314;
  border-radius: 50%;
  background: #fff;
  color: #365314;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.5);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 9.5px;
  font-weight: 900;
  letter-spacing: -0.8px;
  line-height: 1;
}
.facility-map-symbol > span {
  font-size: 16px;
  line-height: 1;
}
body.facility-symbols-plain .facility-map-symbol {
  width: 32px;
  height: 32px;
  color: var(--facility-marker-color);
  background: transparent;
  border: 0;
  box-shadow: none;
  filter: drop-shadow(0 1px 2px rgba(255,255,255,0.95)) drop-shadow(0 2px 2px rgba(0,0,0,0.55));
}
body.facility-symbols-plain .facility-svg-icon {
  width: 28px;
  height: 28px;
  stroke-width: 2.5;
}
body.facility-symbols-plain .facility-icon-badged {
  width: 28px;
  height: 28px;
}
body.facility-symbols-plain .facility-24-badge {
  top: -3px;
  right: -3px;
  width: 17px;
  height: 17px;
  font-size: 10px;
}
body.facility-symbols-plain .facility-map-symbol > span {
  font-size: 23px;
}
.facility-popup-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}
.facility-composite-popup {
  min-width: min(270px, 70vw);
}
.facility-composite-popup-title {
  display: block;
  margin-bottom: 3px;
  font-size: 14px;
}
.facility-composite-popup > p {
  margin: 0 0 9px;
  color: #64748b;
  font-size: 11px;
  line-height: 1.35;
}
.facility-composite-popup-list {
  display: grid;
  gap: 5px;
  max-height: min(52vh, 400px);
  padding-right: 2px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.facility-composite-popup-item {
  overflow: hidden;
  border: 1px solid #dbe3ed;
  border-radius: 9px;
  background: #fff;
}
.facility-composite-popup-item > summary {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-height: 38px;
  padding: 4px 7px;
  cursor: pointer;
  list-style: none;
}
.facility-composite-popup-item > summary::-webkit-details-marker {
  display: none;
}
.facility-composite-popup-item > summary::after {
  content: '›';
  grid-column: 3;
  color: #64748b;
  font-size: 20px;
  transform: rotate(90deg);
  transition: transform 120ms ease;
}
.facility-composite-popup-item[open] > summary::after {
  transform: rotate(-90deg);
}
.facility-composite-popup-item > summary strong,
.facility-composite-popup-item > summary small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.facility-composite-popup-item > summary small {
  color: #64748b;
  font-size: 10px;
}
.facility-composite-popup-symbol,
.facility-composite-popup-symbol .facility-map-symbol {
  display: grid;
  width: 26px;
  height: 26px;
  box-sizing: border-box;
  place-items: center;
}
.facility-composite-popup-symbol .facility-svg-icon {
  width: 17px;
  height: 17px;
}
body.facility-symbols-plain .facility-composite-popup-symbol .facility-map-symbol {
  width: 26px;
  height: 26px;
  border: 2px solid #fff;
  color: #fff;
  background: var(--facility-marker-color);
  box-shadow: none;
  filter: none;
}
body.facility-symbols-plain .facility-composite-popup-symbol .facility-svg-icon,
body.facility-symbols-plain .facility-composite-popup-symbol .facility-icon-badged {
  width: 17px;
  height: 17px;
}
.facility-composite-popup-detail {
  padding: 8px;
  border-top: 1px solid #e2e8f0;
}
body.dark .facility-composite-popup > p,
body.dark .facility-composite-popup-item > summary small {
  color: #94a3b8;
}
body.dark .facility-composite-popup-item {
  border-color: #334155;
  background: #111827;
}
body.dark .facility-composite-popup-detail {
  border-color: #334155;
}
.facility-popup-actions .btn {
  flex: 1;
  padding: 6px 8px;
  font-size: 12px;
}
.facility-popup-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 30px;
  align-items: start;
  gap: 8px;
}
.facility-popup-heading > div {
  min-width: 0;
}
.facility-special-lodging-warning {
  margin: 8px 0 4px;
  padding: 7px 8px;
  border: 1px solid #f59e0b;
  border-radius: 8px;
  background: #fffbeb;
  color: #78350f;
  font-size: 11px;
  line-height: 1.35;
}
body.dark .facility-special-lodging-warning {
  border-color: #92400e;
  background: #2a1b0d;
  color: #fde68a;
}
.leaflet-overlay-pane svg,
.leaflet-zoom-animated {
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.henro-route-line,
.planned-route-line {
  vector-effect: non-scaling-stroke;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.active-route-highlighted .planned-route-line {
  filter: drop-shadow(0 0 1px rgba(255, 255, 255, 0.95)) drop-shadow(0 1px 2px rgba(15, 23, 42, 0.65));
}
.henro-walked-line {
  stroke: #16a34a;
}
.nav-container {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
}

.map-container.map-rotating .facility-marker img {
  transform: rotate(var(--map-rotation-inverse, 0deg));
  transform-origin: center center;
  display: block;
}

.map-fab {
  padding: 0;
  border: none;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
#getCurrentLocation {
  position: fixed;
  top: calc(var(--topbar-height) + env(safe-area-inset-top, 0px) + 14px);
  right: 12px;
  left: auto;
  bottom: auto;
  z-index: 900;
  width: 38px;
  height: 38px;
  padding: 0;
  background: transparent;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
.map-fab.btn {
  border: none;
  background: transparent;
  box-shadow: none;
}
.map-fab-icon {
  width: 31px;
  height: 31px;
  display: block;
  background: transparent;
}
.map-route-planning-controls {
  position: fixed;
  bottom: calc(var(--route-sheet-height) + env(safe-area-inset-bottom, 0px) + 16px);
  right: 16px;
  z-index: 900;
  display: flex;
  align-items: stretch;
  gap: 10px;
  max-width: calc(100vw - 32px);
  pointer-events: none;
}
.map-route-planning-controls > * {
  pointer-events: auto;
}
.map-route-planning-controls .calculated-route-summary {
  width: min(560px, calc(100vw - 184px));
  margin: 0;
  box-shadow: 0 6px 18px rgba(0,0,0,0.15);
}
.map-route-fab {
  background: #fff !important;
  color: #111 !important;
  border: none !important;
  box-shadow: 0 6px 18px rgba(0,0,0,0.15);
  padding: 10px 14px;
  border-radius: 999px;
  font-size: 14px;
  align-self: center;
  flex: 0 0 auto;
  white-space: nowrap;
}

.compass-fab {
  position: fixed;
  top: calc(var(--topbar-height) + env(safe-area-inset-top, 0px) + 25px);
  right: 10px;
  z-index: 900;
  background: #fff;
  box-shadow: 0 6px 18px rgba(0,0,0,0.15);
  width: 48px;
  height: 48px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, transform 0.2s ease;
}

.compass-fab.hidden {
  display: none;
}

.compass-fab:active {
  transform: scale(0.95);
}

.compass-fab.active {
  background: #fff;
  color: #111;
  box-shadow: 0 6px 18px rgba(0,0,0,0.15), 0 0 0 3px rgba(59, 130, 246, 0.35);
}

.compass-icon {
  width: 42px;
  height: 42px;
  transition: transform 0.3s ease;
  transform: translate(-9.7px, -8.3px);
  display: block;
  object-fit: contain;
}

.compass-fab.active .compass-icon {
  color: white;
}

.compass-icon-dark {
  display: none;
}

body.dark .compass-fab {
  background: #0f1520;
  box-shadow: 0 6px 18px rgba(0,0,0,0.45);
}

body.dark .compass-fab.active {
  background: #0f1520;
  box-shadow: 0 6px 18px rgba(0,0,0,0.45), 0 0 0 3px rgba(59, 130, 246, 0.35);
}

body.dark .compass-icon-light {
  display: none;
}

body.dark .compass-icon-dark {
  display: block;
}

.leaflet-top {
  top: 20px;
}
.leaflet-top .leaflet-control {
  margin-top: 0;
}
.bottom-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: #fff;
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -8px 24px rgba(0,0,0,0.15);
  height: var(--route-sheet-height);
  overflow: hidden;
  z-index: 900;
  transition: height 0.2s ease;
  will-change: height;
}

.bottom-sheet.live-nav-hidden {
  display: none;
}
.bottom-sheet.dragging {
  transition: none;
  user-select: none;
}
.sheet-content {
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  max-height: calc(100% - 24px);
  padding-bottom: 8px;
  scrollbar-width: none;
}
.sheet-content::-webkit-scrollbar {
  width: 0;
  height: 0;
}
.bottom-sheet.open {
  max-height: none;
}
.sheet-handle {
  width: 44px;
  height: 5px;
  background: #d1d5db;
  border-radius: 999px;
  margin: 10px auto -9px;
  position: relative;
  z-index: 2;
  cursor: ns-resize;
  touch-action: none;
}
.sheet-content {
  padding: 0 16px 16px;
}
.bottom-sheet .route-panel h3 {
  margin-top: 4px;
}
.bottom-sheet .route-actions,
.bottom-sheet .sheet-extra {
  display: none;
}
.bottom-sheet.open .route-actions,
.bottom-sheet.open .sheet-extra {
  display: block;
}
.bottom-sheet.peek .sheet-content {
  opacity: 0;
  pointer-events: none;
}
.bottom-sheet.peek .sheet-handle {
  width: 58px;
  height: 6px;
  margin-top: 12px;
}
.location-select-btn {
  width: 34px;
  height: 34px;
  padding: 2px;
  margin: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
}
.route-start-input .location-select-btn {
  position: absolute;
  left: 7px;
  top: 50%;
  z-index: 2;
  transform: translateY(-50%);
}
.route-start-input input {
  padding-left: 48px;
}
.location-select-btn img {
  display: block;
  width: 30px;
  height: 30px;
  object-fit: contain;
}
.map-filter-status,
.settings-help {
  color: #64748b;
  font-size: 12px;
}
.map-filter-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.map-display-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.map-display-options label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  font-size: 13px;
  font-weight: 650;
}
.map-display-options select {
  width: 100%;
  margin: 0;
  padding: 9px 10px;
}
.map-filter-categories {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 8px;
}
.map-filter-item {
  display: flex !important;
  align-items: center;
  gap: 10px;
  margin: 0 !important;
  padding: 10px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  font-weight: 500 !important;
}
.map-filter-item input {
  width: 18px !important;
  margin: 0 !important;
}
.map-filter-symbol {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--filter-color);
  color: #fff;
}
.map-filter-symbol .facility-svg-icon { width: 18px; height: 18px; }
.map-filter-label {
  flex: 1;
}
.map-filter-count {
  color: #64748b;
  font-size: 12px;
}

body:not(.nav-active) .nav-only-action {
  display: none;
}

.map-global-search {
  box-sizing: border-box;
  width: 100%;
  padding: 13px 14px;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  font-size: 16px;
}

.map-global-search-results {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
}

.map-search-result {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px;
  border: 1px solid #e2e8f0;
  border-radius: 11px;
  background: #fff;
  color: #0f172a;
  text-align: left;
  cursor: pointer;
}

.map-search-result-symbol {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--result-color, #64748b);
}
.map-search-result-symbol .facility-svg-icon { width: 20px; height: 20px; }
.map-search-result-symbol .temple-torii-marker,
.map-search-result-symbol .temple-torii-marker img { width: 28px; height: 27px; }
.map-search-result-symbol .temple-torii-marker strong { top: 10px; min-width: 15px; height: 11px; font-size: 7px; }

.map-search-result-copy {
  min-width: 0;
}

.map-search-result-copy strong,
.map-search-result-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.map-search-result-copy small,
.map-search-result-distance {
  color: #64748b;
  font-size: 12px;
}

.onboarding-modal {
  z-index: 12000;
}

.onboarding-content {
  width: min(92vw, 540px);
  max-height: min(90dvh, 760px);
  overflow-y: auto;
  padding: 22px;
}

.onboarding-brand {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 4px;
  margin-bottom: 24px;
}
.onboarding-logo {
  display: block;
  width: 112px;
  height: 112px;
  margin: 0 auto 14px;
  border-radius: 24px;
  object-fit: cover;
  box-shadow: 0 12px 28px rgba(68, 78, 48, 0.2);
}

.onboarding-brand h2 {
  margin: 6px 0 2px;
}

.onboarding-brand strong {
  color: #b91c1c;
  font-size: 19px;
}

.onboarding-brand span {
  color: #64748b;
  font-size: 13px;
}

.onboarding-progress {
  position: absolute;
  top: 0;
  right: 0;
  color: #64748b;
  font-size: 12px;
}

.onboarding-step h3 {
  margin-top: 0;
  text-align: center;
}

.onboarding-step .onboarding-priority-heading {
  margin-top: 30px;
}

.onboarding-step > p {
  color: #64748b;
  text-align: center;
}

.onboarding-choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.onboarding-choice-grid.three-columns {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.onboarding-choice {
  min-height: 58px;
  padding: 10px;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
  color: #0f172a;
  font-size: 15px;
  cursor: pointer;
}

.onboarding-choice.selected {
  border-color: #2563eb;
  background: #eff6ff;
  box-shadow: 0 0 0 2px rgba(37,99,235,0.14);
}

.onboarding-lodging-list {
  display: grid;
  gap: 8px;
}

.onboarding-lodging-list label {
  display: grid !important;
  grid-template-columns: 24px 28px 1fr;
  align-items: center;
  gap: 6px;
  margin: 0 !important;
  padding: 11px;
  border: 1px solid #e2e8f0;
  border-radius: 11px;
}

.onboarding-lodging-list label.selected {
  border-color: #2563eb;
  background: #eff6ff;
  box-shadow: 0 0 0 2px rgba(37,99,235,0.14);
}

.onboarding-lodging-list input {
  width: 18px !important;
  margin: 0 !important;
}

.onboarding-route-list label {
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: start;
}

.onboarding-route-list label.disabled {
  opacity: 0.58;
  cursor: not-allowed;
}

.route-profile-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.route-profile-copy strong,
.route-profile-copy small {
  display: block;
}

.route-profile-copy small {
  color: #64748b;
  line-height: 1.35;
}

.route-profile-hint {
  margin: 10px 0 2px;
  padding: 10px 12px;
  border: 1px solid #c4b5fd;
  border-radius: 10px;
  background: #f5f3ff;
  color: #4c1d95;
  font-size: 12px;
  line-height: 1.45;
}

.bekkaku-map-symbol .temple-torii-marker img {
  filter: drop-shadow(0 0 1px #fff) drop-shadow(0 0 3px #ede9fe) drop-shadow(0 2px 2px rgba(76, 29, 149, 0.72));
}

.bekkaku-map-symbol strong {
  min-width: 22px;
  border-color: #6d28d9;
  color: #5b21b6;
  background: rgba(245, 243, 255, 0.98);
  font-size: 8px;
}

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

.onboarding-skip {
  display: block;
  margin: 16px auto 0;
}

.settings-inline-select {
  width: auto !important;
  min-width: 108px;
  margin: 0 !important;
  padding: 6px 8px !important;
}

.settings-debug-panel {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #e2e8f0;
}

.settings-debug-panel h3 {
  margin: 0;
  font-size: 15px;
}

.settings-debug-panel > p {
  margin: 4px 0 10px;
}

.route-debug-details {
  padding: 10px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
  color: #334155;
  font-size: 12px;
}

.route-debug-details dl {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 6px 10px;
  margin: 0;
}

.route-debug-details dt {
  color: #64748b;
}

.route-debug-details dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

body.dark .map-search-result,
body.dark .onboarding-choice,
body.dark .onboarding-lodging-list label {
  background: #0f1520;
  color: #e5e7eb;
  border-color: #334155;
}

body.dark .settings-debug-panel {
  border-color: #334155;
}

body.dark .route-debug-details {
  background: #111827;
  border-color: #334155;
  color: #e5e7eb;
}

body.dark .route-debug-details dt {
  color: #9ca3af;
}

body.dark .route-profile-copy small {
  color: #94a3b8;
}

body.dark .route-profile-hint {
  border-color: #6d28d9;
  background: #25164a;
  color: #ddd6fe;
}

body.dark .onboarding-choice.selected {
  background: #172554;
  border-color: #60a5fa;
}

body.dark .onboarding-lodging-list label.selected {
  background: #172554;
  border-color: #60a5fa;
}

body.dark .journey-ground-rules {
  background: #111827;
  border-color: #334155;
  color: #cbd5e1;
}

@media (max-width: 680px) {
  .topbar {
    padding-left: 8px;
    padding-right: 7px;
    gap: 4px;
  }
  .topbar-actions {
    gap: 2px;
  }
  .topbar .icon-btn {
    flex-basis: 44px;
    width: 44px;
    height: 44px;
    padding: 0;
    font-size: 27px;
  }
  .topbar-action-icon {
    width: 27px;
    height: 27px;
  }
  .app-title {
    gap: 6px;
    font-size: 13px;
  }
  .app-brand-icon {
    width: 28px;
    height: 28px;
  }
  .onboarding-choice-grid,
  .onboarding-choice-grid.three-columns {
    grid-template-columns: 1fr;
  }
}
.route-panel {
  background: transparent;
  padding: 0;
  border-radius: 0;
  margin-top: 0;
}
.nav-controls {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.nav-start-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.18fr);
  gap: 8px;
  margin-bottom: 10px;
}
#startLiveNav,
.map-route-fab {
  min-height: 44px;
  color: #fff !important;
  background: #1d4ed8 !important;
  border-color: #1d4ed8 !important;
  box-shadow: 0 5px 14px rgba(29, 78, 216, 0.32);
  font-weight: 800;
}
#startLiveNav::before,
.map-route-fab::before {
  content: '▶';
  margin-right: 7px;
  font-size: 0.82em;
}
#startLiveNav:active,
.map-route-fab:active {
  transform: translateY(1px);
  box-shadow: 0 2px 7px rgba(29, 78, 216, 0.28);
}
.live-nav {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px;
}
.live-nav-title {
  font-weight: 700;
  margin-bottom: 8px;
  font-size: 14px;
  color: #0f172a;
}
.live-nav-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #334155;
  margin-bottom: 10px;
}
.live-nav-toggle input {
  width: 16px;
  height: 16px;
}
.nav-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #334155;
}
.nav-toggle input {
  width: 16px;
  height: 16px;
}
.live-nav-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.live-nav-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px;
}
.live-nav-item span {
  font-size: 12px;
  color: #64748b;
}
.live-nav-item strong {
  font-size: 16px;
  color: #0f172a;
}
.nav-controls .btn {
  padding: 8px 12px;
  font-size: 14px;
}
.route-panel {
  background: #fafafa;
  padding: 0px 16px 16px 16px;
  border-radius: 12px;
  margin-top: 16px;
}
.route-panel h3 {
  margin: 0 0 12px;
  font-size: 16px;
}
.route-panel select {
  margin-bottom: 12px;
}
.nav-hidden-select {
  display: none;
}
.nav-search-results {
  max-height: 180px;
  overflow-y: auto;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: white;
  margin: 6px 0 12px;
  display: none;
}
.nav-search-results.active {
  display: block;
}
.nav-search-results div,
.nav-search-option {
  padding: 10px;
  cursor: pointer;
  border-bottom: 1px solid #eee;
  font-size: 14px;
}
.nav-search-option {
  display: block;
  width: 100%;
  border-top: 0;
  border-right: 0;
  border-left: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
}
.nav-search-results div:hover,
.nav-search-option:hover {
  background: #f9f9f9;
}
.nav-search-results div:last-child,
.nav-search-option:last-child {
  border-bottom: none;
}
.calculated-route-summary {
  margin-top: 12px;
  padding: 12px;
  background: white;
  border-radius: 8px;
  border: 1px solid #ddd;
}

.calculated-route-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.calculated-route-metric {
  min-width: 0;
  padding: 8px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #f8fafc;
}

.calculated-route-metric span,
.calculated-route-summary-note {
  display: block;
  color: #64748b;
  font-size: 11px;
  line-height: 1.3;
}

.calculated-route-metric strong {
  display: block;
  margin-top: 3px;
  color: #0f172a;
  font-size: 15px;
  overflow-wrap: anywhere;
}

.calculated-route-summary-note {
  margin-top: 9px;
}

.route-primary-actions {
  margin-top: 10px;
}
.route-travel-mode {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(150px, 0.9fr);
  align-items: center;
  gap: 12px;
  margin: 12px 0 4px;
}
.route-travel-mode > span {
  color: #475569;
  font-size: 13px;
  font-weight: 750;
}
.route-travel-mode select {
  margin: 0;
  padding: 9px 34px 9px 10px;
  font-size: 14px;
}
.transit-route-panel {
  margin: 12px 0;
  padding: 13px;
  border: 1px solid #bae6fd;
  border-radius: 14px;
  background: #f0f9ff;
}
.transit-route-panel > strong { color: #075985; }
.transit-route-panel > p,
.transit-route-panel > small {
  display: block;
  margin: 6px 0 0;
  color: #475569;
  font-size: 11px;
  line-height: 1.45;
}
.transit-nearby-stops {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}
.transit-nearby-stops section {
  min-width: 0;
  padding: 9px;
  border-radius: 10px;
  background: #fff;
}
.transit-nearby-stops h4 { margin: 0 0 6px; color: #075985; font-size: 11px; }
.transit-nearby-stops ul { display: grid; gap: 5px; margin: 0; padding: 0; list-style: none; }
.transit-nearby-stops li { display: flex; min-width: 0; justify-content: space-between; gap: 6px; font-size: 10px; }
.transit-nearby-stops li strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.transit-nearby-stops li span { flex: 0 0 auto; color: #64748b; }
.transit-nearby-stops p { margin: 0; color: #64748b; font-size: 10px; }
.transit-route-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.transit-route-actions .btn { display: grid; min-height: 42px; place-items: center; padding: 8px; text-align: center; text-decoration: none; font-size: 12px; }
body.dark .transit-route-panel { border-color: #075985; background: #082f49; }
body.dark .transit-route-panel > strong,
body.dark .transit-nearby-stops h4 { color: #bae6fd; }
body.dark .transit-route-panel > p,
body.dark .transit-route-panel > small { color: #cbd5e1; }
body.dark .transit-nearby-stops section { background: #0f172a; }
.calculated-route-summary.hidden {
  display: none;
}

@media (max-width: 640px) {
  .map-route-planning-controls {
    left: 12px;
    right: 12px;
    bottom: calc(var(--route-sheet-height) + env(safe-area-inset-bottom, 0px) + 12px);
    flex-direction: column-reverse;
    align-items: flex-end;
  }
  .map-route-planning-controls .calculated-route-summary {
    width: 100%;
    box-sizing: border-box;
  }
  .route-travel-mode { grid-template-columns: 1fr; gap: 5px; }
  .transit-nearby-stops,
  .transit-route-actions { grid-template-columns: 1fr; }
}

label { display:block; margin: 12px 0 6px; font-weight: 600; }
input, select {
  width: 100%; padding: 12px; font-size: 16px;
  border: 1px solid #ddd; border-radius: 12px;
}
.grid { display:grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.chips { display:flex; flex-wrap:wrap; gap:8px; }
.chip {
  border: 1px solid #ddd; background:#fff; border-radius: 999px;
  padding: 8px 10px; font-size: 13px; cursor:pointer; user-select:none;
}
.chip.active { border-color:#111; }
.facilities-container { display: block; }
.facilities-container.hidden { display: none; }
.hidden { display: none !important; }

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

.route-header h3 {
  margin: 0;
  flex: 1;
}

.input-with-clear {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-clear input {
  flex: 1;
  padding-right: 40px;
}

.clear-btn {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  font-size: 24px;
  color: #999;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  transition: color 0.2s;
}

.clear-btn:hover {
  color: #333;
}

.clear-btn:active {
  color: #111;
}

.detail { margin-top: 14px; padding: 12px; background:#fafafa; border-radius: 12px; border:1px solid #eee; }
.temple-image-container { display: none; margin: 14px 0; }
.temple-image-container img {
  width: 100%;
  max-height: 360px;
  object-fit: cover;
  border-radius: 12px;
  display: block;
}
.temple-image-credit {
  display: block;
  margin-top: 6px;
  color: #6b7280;
  line-height: 1.35;
}
.temple-image-credit a { color: inherit; }
.temple-popup-image {
  width: 240px;
  max-width: 100%;
  height: 132px;
  object-fit: cover;
  display: block;
  margin: 8px 0;
  border-radius: 9px;
}
.temple-popup-location {
  display: block;
  color: #6b7280;
  margin-top: 3px;
}
.temple-popup-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 10px;
}
.temple-popup-actions .temple-details-button { grid-column: 1 / -1; }
.temple-detail-modal-content {
  width: min(94%, 680px);
  max-height: 92vh;
}
.temple-detail-hero {
  position: relative;
  margin: -16px -16px 0;
  overflow: hidden;
  background: #e5e7eb;
}
.temple-detail-hero img {
  width: 100%;
  height: clamp(220px, 44vh, 390px);
  object-fit: cover;
  display: block;
}
.temple-detail-photo-credit {
  margin: 7px 0 0;
  color: #6b7280;
  font-size: 12px;
}
.temple-detail-photo-credit a { color: inherit; }
.temple-detail-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  align-items: start;
  gap: 10px;
  margin: 18px 0 6px;
}
.temple-detail-heading span {
  display: block;
  color: #b91c1c;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.temple-detail-heading h3 {
  margin: 4px 0 0;
  font-size: 24px;
  line-height: 1.2;
}
.temple-feedback-open,
.facility-feedback-open {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  margin: 0;
  padding: 0;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  background: #fff;
  color: #475569;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}
.temple-feedback-open {
  width: 34px;
  height: 34px;
}
.temple-feedback-open:hover,
.facility-feedback-open:hover {
  border-color: #2563eb;
  color: #1d4ed8;
  background: #eff6ff;
}
.temple-detail-description {
  margin: 10px 0 18px;
  color: #4b5563;
  line-height: 1.55;
}
.temple-detail-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}
.temple-detail-fact {
  padding: 10px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #f9fafb;
}
.temple-detail-fact dt {
  color: #6b7280;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}
.temple-detail-fact dd {
  margin: 4px 0 0;
  font-weight: 650;
  overflow-wrap: anywhere;
}
.temple-detail-actions,
.temple-detail-sources {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}
.temple-detail-sources .btn { font-size: 13px; padding: 8px 10px; }
body.dark .temple-detail-description,
body.dark .temple-detail-photo-credit,
body.dark .temple-image-credit,
body.dark .temple-popup-location { color: #9ca3af; }
body.dark .temple-detail-fact {
  background: #111827;
  border-color: #273244;
}
body.dark .temple-detail-fact dt { color: #9ca3af; }
@media (max-width: 520px) {
  .temple-detail-modal-content {
    width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
  }
  .temple-detail-facts { grid-template-columns: 1fr; }
  .temple-detail-actions .btn { flex: 1; text-align: center; }
}
.facility-popup-image {
  width: var(--facility-image-width);
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  display: block;
  margin: 8px 0;
}

.facility-feedback-modal {
  width: min(94vw, 620px);
  max-width: 620px;
  max-height: min(92dvh, 820px);
}

.facility-feedback-modal .modal-header > div {
  min-width: 0;
}

.facility-feedback-modal .modal-header strong,
.facility-feedback-modal .modal-header small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.facility-feedback-modal .modal-header strong {
  margin-top: 4px;
}

.facility-feedback-intro {
  margin-top: 0;
  color: #475569;
  line-height: 1.45;
}

.facility-feedback-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 12px;
}

.facility-feedback-grid .wide {
  grid-column: 1 / -1;
}

.facility-feedback-body textarea {
  box-sizing: border-box;
  width: 100%;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 8px;
  resize: vertical;
  font: inherit;
}

.facility-feedback-privacy {
  display: block;
  margin-top: 8px;
  color: #64748b;
}

.facility-feedback-status {
  margin: 12px 0 0;
  padding: 10px 12px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  color: #1e40af;
  background: #eff6ff;
  line-height: 1.4;
}

.facility-feedback-status.success {
  color: #166534;
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.facility-feedback-status.warning {
  color: #92400e;
  border-color: #fde68a;
  background: #fffbeb;
}

.facility-feedback-status.error {
  color: #991b1b;
  border-color: #fecaca;
  background: #fef2f2;
}

body.dark .facility-feedback-intro,
body.dark .facility-feedback-privacy {
  color: #cbd5e1;
}

body.dark .facility-feedback-body input,
body.dark .facility-feedback-body select,
body.dark .facility-feedback-body textarea {
  color: #f8fafc;
  border-color: #475569;
  background: #0f172a;
}

body.dark .facility-feedback-status {
  color: #bfdbfe;
  border-color: #1d4ed8;
  background: #172554;
}

body.dark .facility-feedback-status.success {
  color: #bbf7d0;
  border-color: #15803d;
  background: #052e16;
}

body.dark .facility-feedback-status.warning {
  color: #fde68a;
  border-color: #b45309;
  background: #451a03;
}

body.dark .facility-feedback-status.error {
  color: #fecaca;
  border-color: #b91c1c;
  background: #450a0a;
}

@media (max-width: 520px) {
  .facility-feedback-modal {
    width: 100%;
    max-width: none;
    max-height: 100dvh;
    height: 100dvh;
    border-radius: 0;
  }

  .facility-feedback-grid {
    grid-template-columns: 1fr;
  }

  .facility-feedback-grid .wide {
    grid-column: auto;
  }
}
.muted { color:#6b7280; }
.value { font-size: 18px; font-weight: 800; margin-top: 4px; }
.actions { margin-top: 10px; }
.btn {
  display:inline-block; padding: 10px 12px; border-radius: 12px;
  border: 1px solid #111; text-decoration:none; color:#111;
}
.dropdown {
  max-height: 200px; overflow-y: auto; border: 1px solid #ddd; border-radius: 12px; background: white; margin-top: 4px;
}
.dropdown div {
  padding: 10px; cursor: pointer; border-bottom: 1px solid #eee;
}
.dropdown div:hover { background: #f9f9f9; }
.dropdown div:last-child { border-bottom: none; }

.note textarea {
  width: 100%; padding: 8px; font-size: 14px; border: 1px solid #ddd; border-radius: 8px;
}
.note-actions { margin-top: 6px; display: flex; gap: 8px; align-items: center; }
.btn.secondary { border-color: #ccc; color: #333; background: #fff; }
.location-icon { display: inline-block; transform: translateX(-12px); }
.sync-config { display: none; }

.app-version {
  position: fixed;
  right: 12px;
  bottom: 296px;
  background: rgba(0,0,0,0.72);
  color: #fff;
  padding: 6px 8px;
  border-radius: 8px;
  font-size: 12px;
  z-index: 850;
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  display: flex;
  align-items: center;
  gap: 8px;
}

.impressum-btn {
  background: none;
  border: 1px solid rgba(255,255,255,0.4);
  color: #fff;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.impressum-btn:hover {
  border-color: #fff;
  background: rgba(255,255,255,0.1);
}

.impressum-btn:active {
  background: rgba(255,255,255,0.2);
}

.search-bar {
  display: flex;
  gap: 8px;
  margin: 6px 0;
}

.search-bar input {
  flex: 1;
}

.search-bar .btn {
  padding: 12px 12px;
  font-size: 14px;
  white-space: nowrap;
}

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: white;
  border-radius: 12px;
  width: 90%;
  max-width: 500px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid #eee;
}

.modal-header h2 {
  margin: 0;
  font-size: 18px;
}

.close-btn {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #999;
}

.close-btn:hover {
  color: #333;
}

/* Route type decision shown when start or destination is away from the Henro track. */
.route-choice-overlay {
  position: fixed;
  inset: 0;
  z-index: 10020;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(16px, env(safe-area-inset-top, 0px)) 16px max(16px, env(safe-area-inset-bottom, 0px));
  background: rgba(15, 23, 42, 0.58);
  backdrop-filter: blur(2px);
}

.route-choice-dialog {
  box-sizing: border-box;
  width: min(100%, 440px);
  max-height: calc(100dvh - 32px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 20px;
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  background: #fff;
  color: #172033;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.28);
}

.route-choice-dialog:focus {
  outline: none;
}

.route-choice-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.route-choice-header h2 {
  margin: 0;
  color: #172033;
  font-size: 21px;
  line-height: 1.25;
}

.route-choice-header p {
  margin: 7px 0 0;
  color: #64748b;
  font-size: 14px;
  line-height: 1.45;
}

.route-choice-info-button {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border: 1px solid #cbd5e1;
  border-radius: 50%;
  background: #f8fafc;
  color: #334155;
  font: 700 18px/1 Georgia, serif;
  cursor: pointer;
}

.route-choice-info-button:hover,
.route-choice-info-button[aria-expanded="true"] {
  border-color: #94a3b8;
  background: #e2e8f0;
}

.route-choice-journey {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  margin: 16px 0;
  padding: 10px 12px;
  border-radius: 11px;
  background: #f1f5f9;
  color: #334155;
  font-size: 13px;
  line-height: 1.35;
}

.route-choice-location {
  min-width: 0;
  overflow-wrap: anywhere;
}

.route-choice-location--destination {
  text-align: right;
}

.route-choice-arrow {
  color: #94a3b8;
  font-size: 17px;
}

.route-choice-temple-warning {
  margin: 0 0 14px;
  padding: 12px 13px;
  border: 2px solid #d97706;
  border-radius: 12px;
  background: #fff7ed;
  color: #7c2d12;
  font-size: 13px;
  line-height: 1.45;
}

.route-choice-temple-warning-title {
  display: block;
  color: #9a3412;
  font-size: 14px;
  line-height: 1.35;
}

.route-choice-temple-warning-text {
  margin: 5px 0 0;
}

.route-choice-info {
  margin: 0 0 14px;
  padding: 13px 14px;
  border: 1px solid #bfdbfe;
  border-radius: 12px;
  background: #eff6ff;
  color: #334155;
  font-size: 13px;
  line-height: 1.45;
}

.route-choice-info[hidden] {
  display: none;
}

.route-choice-info h3 {
  margin: 0 0 8px;
  color: #1e3a5f;
  font-size: 15px;
}

.route-choice-info p {
  margin: 6px 0;
}

.route-choice-info .route-choice-safety {
  margin-top: 9px;
  padding-top: 9px;
  border-top: 1px solid #bfdbfe;
  color: #475569;
}

.route-choice-options {
  display: grid;
  gap: 10px;
}

.route-choice-option {
  box-sizing: border-box;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 78px;
  padding: 12px 14px;
  border: 2px solid;
  border-radius: 13px;
  background: #fff;
  color: #172033;
  text-align: left;
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease, transform 120ms ease;
}

.route-choice-option:hover {
  transform: translateY(-1px);
}

.route-choice-option--direct {
  border-color: #f59e0b;
}

.route-choice-option--direct:hover {
  background: #fffbeb;
}

.route-choice-option--henro {
  border-color: #b91c1c;
}

.route-choice-option--henro:hover {
  background: #fff7f7;
}

.route-choice-option-symbol {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  font-size: 21px;
  font-weight: 800;
  line-height: 1;
}

.route-choice-option--direct .route-choice-option-symbol {
  background: #fef3c7;
  color: #9a5700;
}

.route-choice-option--henro .route-choice-option-symbol {
  background: #fee2e2;
  color: #991b1b;
}

.route-choice-option-copy {
  display: block;
  min-width: 0;
}

.route-choice-option-copy strong,
.route-choice-option-copy small {
  display: block;
}

.route-choice-option-copy strong {
  font-size: 16px;
  line-height: 1.25;
}

.route-choice-option-copy small {
  margin-top: 4px;
  color: #64748b;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.35;
}

.route-choice-cancel {
  width: 100%;
  min-height: 44px;
  margin-top: 12px;
  border: 0;
  border-radius: 10px;
  background: #f1f5f9;
  color: #475569;
  font-size: 14px;
  font-weight: 650;
  cursor: pointer;
}

.route-choice-cancel:hover {
  background: #e2e8f0;
}

.route-choice-info-button:focus-visible,
.route-choice-option:focus-visible,
.route-choice-cancel:focus-visible {
  outline: 3px solid #2563eb;
  outline-offset: 2px;
}

body.dark .route-choice-dialog {
  border-color: #334155;
  background: #0f1520;
  color: #e5e7eb;
}

body.dark .route-choice-header h2,
body.dark .route-choice-option {
  color: #f8fafc;
}

body.dark .route-choice-header p,
body.dark .route-choice-option-copy small {
  color: #aeb8c7;
}

body.dark .route-choice-info-button,
body.dark .route-choice-cancel {
  border-color: #475569;
  background: #1e293b;
  color: #e2e8f0;
}

body.dark .route-choice-info-button:hover,
body.dark .route-choice-info-button[aria-expanded="true"],
body.dark .route-choice-cancel:hover {
  background: #334155;
}

body.dark .route-choice-journey {
  background: #172033;
  color: #cbd5e1;
}

body.dark .route-choice-info {
  border-color: #1e4a72;
  background: #10233a;
  color: #cbd5e1;
}

body.dark .route-choice-temple-warning {
  border-color: #f59e0b;
  background: #2b2110;
  color: #fed7aa;
}

body.dark .route-choice-temple-warning-title {
  color: #fdba74;
}

body.dark .route-choice-info h3 {
  color: #dbeafe;
}

body.dark .route-choice-info .route-choice-safety {
  border-top-color: #1e4a72;
  color: #aeb8c7;
}

body.dark .route-choice-option {
  background: #111827;
}

body.dark .route-choice-option--direct:hover {
  background: #2b2110;
}

body.dark .route-choice-option--henro:hover {
  background: #2b171b;
}

@media (max-width: 420px) {
  .route-choice-overlay {
    align-items: flex-end;
    padding: 10px 10px max(10px, env(safe-area-inset-bottom, 0px));
  }

  .route-choice-dialog {
    max-height: calc(100dvh - 10px - env(safe-area-inset-bottom, 0px));
    padding: 17px;
    border-radius: 18px 18px 14px 14px;
  }

  .route-choice-header h2 {
    font-size: 19px;
  }
}

.modal-body {
  padding: 16px;
}

.settings-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.settings-item {
  box-sizing: border-box;
  width: 100%;
  text-align: left;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 10px;
  background: #fff;
  font-size: 15px;
  cursor: pointer;
}
.settings-link {
  box-sizing: border-box;
  text-decoration: none;
  color: inherit;
}

.native-ios .support-donation-link {
  display: none;
}

.native-ios .native-ios-only {
  display: block !important;
}

.account-danger-zone {
  margin-top: 24px;
  padding: 14px;
  border: 1px solid #fecaca;
  border-radius: 14px;
  background: #fff7f7;
}

.account-danger-zone summary {
  color: #991b1b;
  font-weight: 700;
  cursor: pointer;
}

.account-danger-zone label,
.account-danger-zone input {
  display: block;
  width: 100%;
  box-sizing: border-box;
}

.account-danger-zone label {
  margin: 12px 0 5px;
  font-weight: 600;
}

.btn.danger {
  margin-top: 14px;
  background: #b91c1c;
  border-color: #991b1b;
  color: #fff;
}

body.dark .account-danger-zone {
  background: #240f12;
  border-color: #7f1d1d;
}

.settings-item:hover {
  background: #f9fafb;
}

.search-more-results {
  box-sizing: border-box;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  background: #eff6ff;
  color: #1d4ed8;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.search-more-results:hover {
  background: #dbeafe;
}

body.dark .temple-feedback-open,
body.dark .facility-feedback-open,
body.dark .search-more-results {
  color: #bfdbfe;
  border-color: #334155;
  background: #172554;
}

.legal-settings-link {
  border: 0;
  background: transparent;
  color: #64748b;
  font-size: 13px;
  padding-inline: 4px;
}

.legal-draft-warning {
  padding: 12px;
  border-radius: 10px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
}

.legal-draft-warning p {
  margin-bottom: 0;
}

#impressumContent address {
  line-height: 1.6;
  font-style: normal;
}

.support-modal-body {
  text-align: center;
}

.support-icon {
  font-size: 44px;
}

.support-modal-body small {
  display: block;
  margin-top: 10px;
  color: #64748b;
}

.support-donation-link {
  display: inline-flex;
  width: auto;
  margin-top: 8px;
  text-decoration: none;
}

body.dark .settings-item,
body.dark .map-filter-item {
  background: #0f1520;
  color: #e5e7eb;
  border-color: #334155;
}

body.dark .settings-item:hover {
  background: #1f2937;
}

body.dark .legal-settings-link {
  background: transparent;
  color: #94a3b8;
}

body.dark .legal-draft-warning {
  background: #431407;
  border-color: #9a3412;
  color: #fed7aa;
}

.settings-toggle-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.settings-toggle-item input {
  width: 18px;
  height: 18px;
}

.settings-version {
  margin-top: 12px;
  font-size: 12px;
  color: #6b7280;
}

.modal-body label {
  display: block;
  margin: 12px 0 6px;
  font-weight: 600;
}

.modal-body select,
.modal-body input {
  width: 100%;
  padding: 10px;
  margin-bottom: 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
}

.modal-body select[multiple] {
  min-height: 100px;
}

.modal-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 12px;
  border-top: 1px solid #eee;
}

.modal-footer .btn {
  padding: 10px 12px;
  font-size: 14px;
}

/* Toast notifications */
@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

@keyframes slideDown {
  from {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
  to {
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
  }
}

/* Pulse animation for map markers */
@keyframes pulse {
  0% {
    r: 12px;
    opacity: 0.8;
  }
  100% {
    r: 30px;
    opacity: 0;
  }
}

/* Live Navigation Compact Panel (Google Maps style) */
.live-nav-compact {
  position: fixed;
  bottom: 20px;
  left: 12px;
  right: 12px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 950;
  transition: opacity 0.3s ease;
}

.live-nav-compact.hidden {
  display: none;
}

.live-nav-compact-stats {
  display: flex;
  flex: 1;
  gap: 8px;
  overflow-x: auto;
}

.live-nav-compact-item {
  flex: 1;
  min-width: 70px;
  text-align: center;
}

.live-nav-compact-label {
  font-size: 11px;
  color: #6b7280;
  margin-bottom: 2px;
}

.live-nav-compact-value {
  font-size: 15px;
  font-weight: 600;
  color: #111827;
}

.live-nav-stop-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #ef4444;
  color: white;
  border: none;
  font-size: 20px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.3);
  transition: background 0.2s ease;
}

.live-nav-stop-btn:hover {
  background: #dc2626;
}

.live-nav-stop-btn:active {
  transform: scale(0.95);
}
/* Account & Statistics Styles */

#accountBtn {
  position: relative;
  background: none !important;
  border: none !important;
  color: #6b7280 !important;
  cursor: pointer;
  border-radius: 10px;
  transition: all 0.2s ease !important;
}

#accountBtn:hover {
  background: #f3f4f6 !important;
  color: #111 !important;
}

#accountBtn.logged-in {
  color: #10b981 !important;
}

#accountBtn.logged-in::after {
  content: '';
  position: absolute;
  top: 4px;
  right: 6px;
  width: 8px;
  height: 8px;
  background: #10b981;
  border-radius: 50%;
  border: 2px solid white;
}

#accountBtn.logged-out {
  color: #9ca3af !important;
}

body.dark #accountBtn {
  color: #6b7280 !important;
}

body.dark #accountBtn:hover {
  background: #374151 !important;
  color: #f3f4f6 !important;
}

body.dark #accountBtn.logged-in::after {
  border-color: #0f1520;
}

body.dark #accountBtn.logged-out {
  color: #6b7280 !important;
}

body.dark #accountBtn {
  color: #6b7280;
}

body.dark #accountBtn:hover {
  background: #374151;
  color: #f3f4f6;
}

body.dark #accountBtn.logged-in::after {
  border-color: #0f1520;
}

.account-modal, .stats-modal {
  box-sizing: border-box;
  width: min(500px, calc(100vw - 24px)) !important;
  max-width: 500px !important;
  max-height: 85vh !important;
  overflow-y: auto !important;
}

#accountModal .modal-body,
#accountModalContent,
.account-auth,
.auth-form,
.account-profile,
.profile-section {
  min-width: 0;
  max-width: 100%;
}

#accountModal input:not([type="checkbox"]):not([type="radio"]),
#accountModal select {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  font-size: 16px;
}

.account-auth {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.account-intro,
.account-privacy-note {
  margin: 0;
  color: #6b7280;
  line-height: 1.5;
}

.account-intro {
  font-size: 14px;
}

.account-privacy-note {
  font-size: 12px;
}

.account-form-status {
  margin: 0;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.4;
}

.account-form-status.info {
  color: #1e40af;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
}

.account-form-status.success {
  color: #166534;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
}

.account-form-status.error {
  color: #991b1b;
  background: #fef2f2;
  border: 1px solid #fecaca;
}

.account-loading {
  padding: 24px 0;
  color: #6b7280;
  text-align: center;
}

.auth-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 2px solid #e5e7eb;
}

.auth-tab {
  flex: 1;
  padding: 12px;
  background: none;
  border: none;
  font-size: 14px;
  font-weight: 500;
  color: #6b7280;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.2s;
}

.auth-tab.active {
  color: #3b82f6;
  border-bottom-color: #3b82f6;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-form.hidden {
  display: none;
}

.auth-form input {
  padding: 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 16px;
}

.auth-form input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.auth-form label,
.profile-section label {
  font-size: 13px;
  font-weight: 600;
  color: #374151;
}

.btn-link {
  appearance: none;
  padding: 4px;
  color: #2563eb;
  background: none;
  border: 0;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.btn-link:disabled {
  opacity: 0.55;
  cursor: wait;
}

.account-profile, .statistics-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.profile-header {
  padding: 16px;
  background: #f3f4f6;
  border-radius: 8px;
}

.profile-header h3 {
  margin: 0 0 4px 0;
  font-size: 18px;
}

.profile-header p {
  margin: 0;
}

.verification-badge {
  display: inline-flex;
  margin-top: 10px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.verification-badge.verified {
  color: #166534;
  background: #dcfce7;
}

.verification-badge.pending {
  color: #92400e;
  background: #fef3c7;
}

.profile-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.profile-section h4 {
  margin: 12px 0 8px 0;
  font-size: 14px;
  font-weight: 600;
  color: #374151;
}

.profile-input {
  padding: 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 16px;
}

.profile-input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.profile-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  cursor: pointer;
}

.profile-checkbox input {
  width: 18px;
  height: 18px;
  margin: 1px 0 0;
  flex: 0 0 auto;
}

body.dark .account-intro,
body.dark .account-privacy-note,
body.dark .account-loading {
  color: #9ca3af;
}

body.dark .auth-form label,
body.dark .profile-section label,
body.dark .profile-section h4 {
  color: #e5e7eb;
}

body.dark .auth-form input,
body.dark .profile-input,
body.dark .profile-checkbox {
  color: #f3f4f6;
  background: #111827;
  border-color: #4b5563;
}

body.dark .profile-header,
body.dark .stat-card,
body.dark .session-item {
  background: #1f2937;
  border-color: #374151;
}

body.dark .stat-value,
body.dark .session-stats {
  color: #f3f4f6;
}

.profile-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
}

.profile-actions .btn {
  width: 100%;
}

/* Statistics Styles */

.stats-header {
  text-align: center;
  padding-bottom: 12px;
  border-bottom: 1px solid #e5e7eb;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.stat-card {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 16px;
  text-align: center;
}

.stat-label {
  font-size: 12px;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: #111827;
  line-height: 1;
}

.stat-unit {
  font-size: 12px;
  color: #6b7280;
  margin-top: 4px;
}

.stats-history {
  margin-top: 16px;
}

.stats-history h4 {
  margin: 0 0 12px 0;
  font-size: 14px;
  font-weight: 600;
}

.session-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 300px;
  overflow-y: auto;
}

.session-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-size: 13px;
}

.session-date {
  color: #6b7280;
  font-weight: 500;
}

.session-stats {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  flex-wrap: wrap;
  color: #374151;
}

.session-stats span {
  font-weight: 500;
}

.session-source {
  color: #6b7280;
}

@media (max-width: 420px) {
  .session-item {
    flex-direction: column;
  }

  .session-stats {
    justify-content: flex-start;
  }
}

.modal-footer {
  display: flex;
  gap: 8px;
  padding-top: 16px;
  border-top: 1px solid #e5e7eb;
  margin-top: 16px;
}

.modal-footer .btn {
  flex: 1;
}

/* One predictable scroll area per dialog. */
.modal-content:not(.onboarding-content) {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  max-height: min(88dvh, 780px);
  overflow: hidden;
}
.modal-content:not(.onboarding-content) > .modal-header,
.modal-content:not(.onboarding-content) > .modal-footer {
  flex: 0 0 auto;
}
.modal-content:not(.onboarding-content) > .modal-body,
.modal-content:not(.onboarding-content) > form > .modal-body {
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.modal-content:not(.onboarding-content) > form {
  min-height: 0;
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  overflow: hidden;
}
.modal-content:not(.onboarding-content) > form > .modal-footer {
  flex: 0 0 auto;
  margin-top: 0;
}
.onboarding-content {
  display: block;
  overflow-x: hidden;
  overflow-y: auto;
}

.settings-modal-content {
  width: min(92vw, 410px);
  max-width: 410px;
}
#settingsModal .modal-header {
  padding: 13px 15px;
}
#settingsModal .modal-body {
  padding: 12px;
}
#settingsModal .settings-list {
  gap: 6px;
}
#settingsModal .settings-item {
  max-width: 100%;
  min-height: 42px;
  margin: 0;
  padding: 9px 11px;
  border-radius: 9px;
  font-size: 14px;
}
#settingsModal .settings-toggle-item input[type="checkbox"] {
  flex: 0 0 auto;
  width: 19px !important;
  height: 19px;
  margin: 0;
  padding: 0;
}
#settingsModal .settings-inline-select {
  min-width: 0;
  max-width: 52%;
  margin: 0 !important;
  padding: 5px 7px !important;
}
#settingsModal .legal-settings-link {
  min-height: 30px;
  padding-inline: 4px;
}
#settingsModal .settings-version {
  margin-top: 8px;
  text-align: right;
}

.leaflet-control-zoom.leaflet-bar {
  overflow: hidden;
  border-radius: 12px;
}
.leaflet-control-zoom-in {
  border-radius: 10px 10px 0 0 !important;
}
.leaflet-control-zoom-out {
  border-radius: 0 0 10px 10px !important;
}

@media (max-width: 520px) {
  .modal-content:not(.onboarding-content) {
    max-height: min(92dvh, 780px);
  }
  .temple-detail-modal-content,
  .facility-feedback-modal {
    max-height: 100dvh;
  }
}

/* Multi-day walking plan and walking-mode dashboard */
.journey-planner-top-btn {
  font-size: inherit;
}

/* My Henro / Today and offline emergency card */
.today-dashboard-modal {
  width: min(94vw, 720px);
  max-width: 720px;
  max-height: min(92dvh, 860px) !important;
}

.today-dashboard-modal .modal-header > div {
  min-width: 0;
}

.today-dashboard-modal .modal-header small {
  display: block;
  margin-top: 3px;
}

.today-dashboard-body {
  display: flex;
  flex-direction: column;
  gap: 13px;
  background: #f8fafc;
}

.today-empty,
.today-complete-card {
  padding: 24px 18px;
  border: 1px solid #bfdbfe;
  border-radius: 16px;
  background: #fff;
  text-align: center;
}

.today-empty-icon,
.today-complete-card > span {
  display: block;
  font-size: 42px;
}

.today-empty h3,
.today-complete-card h3 {
  margin: 9px 0 5px;
}

.today-empty p,
.today-complete-card p {
  margin: 0 auto 16px;
  max-width: 500px;
  color: #475569;
}

.today-hero-card {
  padding: 16px;
  border: 1px solid #86efac;
  border-radius: 16px;
  background: linear-gradient(135deg, #f0fdf4, #eff6ff);
}

.today-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #166534;
  font-size: 12px;
  font-weight: 700;
}

.today-status-row strong {
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
}

.today-hero-card h3 {
  margin: 11px 0 2px;
  color: #0f172a;
  font-size: 20px;
  line-height: 1.3;
}

.today-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
}

.today-stat-grid > div {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
  padding: 9px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.82);
}

.today-stat-grid span,
.today-priority-grid article > span {
  color: #64748b;
  font-size: 10px;
  font-weight: 700;
}

.today-stat-grid strong {
  color: #0f172a;
  font-size: 14px;
}

.today-priority-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.today-priority-grid article {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 5px;
  padding: 13px;
  border: 1px solid #e2e8f0;
  border-radius: 13px;
  background: #fff;
}

.today-priority-grid article strong {
  overflow-wrap: anywhere;
  color: #0f172a;
  font-size: 14px;
}

.today-priority-grid article small {
  color: #475569;
}

.today-safety-card {
  padding: 13px;
  border: 1px solid #fed7aa;
  border-radius: 13px;
  background: #fff7ed;
}

.today-safety-card h3 {
  margin: 0 0 7px;
  color: #9a3412;
  font-size: 15px;
}

.today-safety-card p,
.today-safety-card ul {
  margin: 0;
  color: #7c2d12;
  font-size: 12px;
  line-height: 1.45;
}

.today-safety-card ul {
  padding-left: 20px;
}

.today-warning {
  margin: 5px 0;
}

.today-warning--danger {
  color: #991b1b;
  font-weight: 700;
}

.today-actions,
.emergency-location-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.today-emergency-shortcut {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px;
  border: 1px solid #fecaca;
  border-radius: 13px;
  color: #7f1d1d;
  background: #fff;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.today-emergency-shortcut > span {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 11px;
  color: #fff;
  background: #b91c1c;
  font-size: 12px;
  font-weight: 900;
}

.today-emergency-shortcut small {
  color: #991b1b;
  font-weight: 800;
}

.emergency-modal-content {
  width: min(94vw, 620px);
  max-width: 620px;
  max-height: min(94dvh, 860px) !important;
}

.emergency-modal-header {
  color: #fff;
  background: #991b1b;
  border-bottom-color: #7f1d1d;
}

.emergency-modal-header .close-btn {
  color: #fff;
}

.emergency-modal-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: #fffafa;
}

.emergency-intro {
  margin: 0;
  color: #450a0a;
  line-height: 1.45;
}

.emergency-call-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.emergency-call {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14px;
  border: 2px solid #b91c1c;
  border-radius: 15px;
  color: #fff;
  background: #b91c1c;
  text-decoration: none;
}

.emergency-call--rescue {
  color: #7f1d1d;
  background: #fff;
}

.emergency-call span,
.emergency-call small {
  font-size: 11px;
  font-weight: 700;
}

.emergency-call strong {
  font-size: 34px;
  line-height: 1.1;
}

.emergency-location-card,
.emergency-phrases {
  padding: 13px;
  border: 1px solid #fecaca;
  border-radius: 13px;
  background: #fff;
}

.emergency-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.emergency-section-heading h3,
.emergency-phrases h3 {
  margin: 0;
  color: #7f1d1d;
  font-size: 15px;
}

.emergency-network-status {
  padding: 4px 7px;
  border-radius: 999px;
  color: #166534;
  background: #dcfce7;
  font-size: 10px;
  font-weight: 800;
}

.emergency-network-status.offline {
  color: #92400e;
  background: #fef3c7;
}

.emergency-coordinates {
  display: block;
  margin: 12px 0 3px;
  color: #111827;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: clamp(16px, 4.5vw, 24px);
  font-weight: 800;
  overflow-wrap: anywhere;
}

.emergency-location-card > small {
  display: block;
  min-height: 17px;
  margin-bottom: 10px;
  color: #64748b;
}

.emergency-phrases ul {
  display: grid;
  gap: 8px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.emergency-phrases li {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 9px;
  border-radius: 9px;
  background: #fff7ed;
}

.emergency-phrases li strong {
  color: #7f1d1d;
  font-size: 17px;
}

.emergency-phrases li span {
  color: #475569;
  font-size: 11px;
}

.emergency-disclaimer {
  margin: 0;
  color: #7f1d1d;
  font-size: 11px;
  line-height: 1.45;
}

body.dark .today-dashboard-body,
body.dark .emergency-modal-body {
  background: #0b0f14;
}

body.dark .today-empty,
body.dark .today-complete-card,
body.dark .today-priority-grid article,
body.dark .today-emergency-shortcut,
body.dark .emergency-location-card,
body.dark .emergency-phrases {
  color: #e2e8f0;
  border-color: #334155;
  background: #0f172a;
}

body.dark .today-hero-card {
  border-color: #166534;
  background: linear-gradient(135deg, #052e16, #082f49);
}

body.dark .today-hero-card h3,
body.dark .today-stat-grid strong,
body.dark .today-priority-grid article strong,
body.dark .emergency-coordinates {
  color: #f8fafc;
}

body.dark .today-stat-grid > div {
  background: rgba(15, 23, 42, 0.86);
}

body.dark .today-safety-card {
  border-color: #9a3412;
  background: #431407;
}

body.dark .today-safety-card h3,
body.dark .today-safety-card p,
body.dark .today-safety-card ul {
  color: #fed7aa;
}

body.dark .emergency-intro,
body.dark .emergency-section-heading h3,
body.dark .emergency-phrases h3,
body.dark .emergency-disclaimer,
body.dark .today-emergency-shortcut,
body.dark .today-emergency-shortcut small {
  color: #fecaca;
}

body.dark .emergency-phrases li {
  background: #431407;
}

body.dark .emergency-phrases li strong {
  color: #fecaca;
}

body.dark .emergency-phrases li span {
  color: #e2e8f0;
}

.journey-mode-summary {
  margin: 0 0 10px;
  padding: 8px;
  border: 1px solid #bfdbfe;
  border-radius: 14px;
  background: linear-gradient(135deg, #eff6ff, #f0fdf4);
}

.journey-mode-open {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  width: 100%;
  padding: 0;
  border: 0;
  color: #0f172a;
  background: transparent;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.journey-mode-icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
  font-size: 20px;
}

.journey-mode-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
}

.journey-mode-copy strong,
.journey-mode-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.journey-mode-copy small {
  color: #475569;
  font-size: 11px;
}

.journey-mode-progress {
  position: relative;
  height: 5px;
  margin: 8px 4px 1px 43px;
  overflow: visible;
  border-radius: 999px;
  background: #cbd5e1;
}

.journey-mode-progress > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #16a34a;
}

.journey-mode-progress > small {
  position: absolute;
  right: 0;
  bottom: 6px;
  color: #475569;
  font-size: 9px;
}

.journey-planner-modal {
  width: min(94vw, 920px);
  max-width: 920px;
  max-height: min(94dvh, 900px) !important;
}

.journey-planner-modal .modal-header > div {
  min-width: 0;
}

.journey-planner-modal .modal-header small {
  display: block;
  margin-top: 3px;
}

.journey-planner-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px;
}

.journey-plan-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 15px;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background: #f8fafc;
}

.journey-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.journey-form-grid label,
.journey-debug-controls label,
.journey-debug-slider {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 5px;
  color: #334155;
  font-size: 12px;
  font-weight: 700;
}

.journey-form-grid input,
.journey-form-grid select,
.journey-debug-controls select,
.journey-custom-goal input,
.journey-custom-goal select,
.journey-alternative-label select {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  padding: 10px;
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  background: #fff;
  font: inherit;
  font-size: 14px;
}

.journey-lodging-fieldset {
  min-width: 0;
  margin: 0;
  padding: 12px;
  border: 1px solid #cbd5e1;
  border-radius: 11px;
}

.journey-lodging-fieldset legend {
  padding: 0 5px;
  color: #334155;
  font-size: 12px;
  font-weight: 700;
}

.journey-lodging-options {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.journey-lodging-options label {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 9px;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  color: #334155;
  background: #fff;
  font-size: 12px;
  cursor: pointer;
}

.journey-lodging-options input {
  width: 16px;
  height: 16px;
  margin: 0;
}

.journey-planner-disclaimer {
  margin: 0;
  padding: 10px 12px;
  border-left: 4px solid #f59e0b;
  border-radius: 7px;
  color: #78350f;
  background: #fffbeb;
  font-size: 12px;
  line-height: 1.45;
}

.journey-ground-rules {
  padding: 12px;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #334155;
  font-size: 12px;
  line-height: 1.5;
}

.journey-ground-rules strong {
  display: block;
  margin-bottom: 6px;
}

.journey-ground-rules ul {
  margin: 0;
  padding-left: 18px;
}

.journey-primary-action {
  align-self: flex-start;
  border-color: #166534;
  color: #fff;
  background: #166534;
  font-weight: 700;
  cursor: pointer;
}

.journey-plan-results {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.journey-plan-overview {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px;
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(135deg, #14532d, #15803d);
}

.journey-plan-overview small {
  color: #dcfce7;
}

.journey-custom-goal {
  position: relative;
  padding: 12px;
  border: 1px solid #bfdbfe;
  border-radius: 12px;
  background: #eff6ff;
}

.journey-custom-goal-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  color: #1e3a8a;
}

.journey-custom-goal-heading select {
  width: auto;
  max-width: 130px;
  padding: 6px 8px;
}

.journey-custom-goal-results {
  display: none;
  max-height: 280px;
  margin-top: 6px;
  overflow-y: auto;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #fff;
}

.journey-custom-goal-results.active {
  display: block;
}

.journey-custom-goal-results button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 10px;
  border: 0;
  border-bottom: 1px solid #e2e8f0;
  color: #0f172a;
  background: #fff;
  text-align: left;
  cursor: pointer;
}

.journey-custom-goal-results button:last-child {
  border-bottom: 0;
}

.journey-custom-goal-results button:hover {
  background: #f8fafc;
}

.journey-custom-goal-results button > span:first-child {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.journey-custom-goal-results button strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.journey-custom-goal-results button small,
.journey-custom-goal-results button > span:last-child {
  color: #64748b;
  font-size: 11px;
}

.journey-custom-goal-results p {
  margin: 0;
  padding: 14px;
  color: #64748b;
  font-size: 13px;
}

.journey-day-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.journey-day-card {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}

.journey-day-card.current {
  border-color: #22c55e;
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.13);
}

.journey-day-card > summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 12px;
  cursor: pointer;
  list-style: none;
}

.journey-day-card > summary::-webkit-details-marker {
  display: none;
}

.journey-day-number {
  padding: 4px 7px;
  border-radius: 7px;
  color: #166534;
  background: #dcfce7;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.journey-day-summary-destination {
  overflow: hidden;
  color: #334155;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.journey-day-card > summary > strong {
  color: #0f172a;
  font-size: 13px;
  white-space: nowrap;
}

.journey-day-content {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
  padding: 0 12px 12px;
  border-top: 1px solid #f1f5f9;
}

.journey-day-temple {
  grid-column: 1 / -1;
  padding-top: 11px;
  color: #7f1d1d;
  font-size: 13px;
  font-weight: 700;
}

.journey-destination-card {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 3px;
  padding: 11px;
  border-radius: 10px;
  background: #f0fdf4;
}

.journey-destination-card > span,
.journey-destination-card small {
  color: #166534;
  font-size: 11px;
}

.journey-destination-card strong {
  overflow-wrap: anywhere;
  color: #14532d;
}

.journey-alternative-label {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 4px;
  color: #475569;
  font-size: 11px;
  font-weight: 700;
}

.journey-route-button {
  justify-self: start;
  cursor: pointer;
}

.journey-safety-card {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 11px;
  border: 1px solid #fed7aa;
  border-radius: 10px;
  background: #fff7ed;
}

.journey-safety-card > strong {
  color: #9a3412;
}

.journey-safety-card > small {
  color: #9a3412;
}

.journey-safety-card ul,
.journey-active-warnings {
  margin: 5px 0 0;
  padding-left: 19px;
}

.journey-warning {
  margin: 5px 0;
  color: #7c2d12;
  font-size: 12px;
  line-height: 1.4;
}

.journey-warning--danger {
  color: #991b1b;
  font-weight: 700;
}

.journey-plan-actions,
.journey-active-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.journey-plan-actions .btn,
.journey-active-actions .btn {
  cursor: pointer;
}

.journey-active-dashboard {
  padding: 14px;
  border: 1px solid #86efac;
  border-radius: 14px;
  background: linear-gradient(135deg, #f0fdf4, #ecfeff);
}

.journey-active-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.journey-active-header > div {
  display: flex;
  flex-direction: column;
}

.journey-active-header small {
  color: #15803d;
}

.journey-active-header strong {
  color: #14532d;
  font-size: 18px;
}

.journey-active-header > span {
  padding: 5px 8px;
  border-radius: 999px;
  color: #14532d;
  background: #dcfce7;
  font-size: 11px;
  font-weight: 700;
  text-align: right;
}

.journey-progress-track {
  height: 7px;
  margin: 12px 0;
  overflow: hidden;
  border-radius: 999px;
  background: #bbf7d0;
}

.journey-progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #16a34a;
}

.journey-active-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.journey-active-stats > div {
  display: flex;
  min-width: 0;
  flex-direction: column;
  padding: 9px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.75);
}

.journey-active-stats span {
  color: #64748b;
  font-size: 10px;
}

.journey-active-stats strong {
  color: #0f172a;
  font-size: 14px;
}

.journey-active-warnings {
  color: #9a3412;
  font-size: 12px;
}

.journey-complete {
  color: #166534;
  font-size: 18px;
  text-align: center;
}

.journey-debug-panel {
  padding: 13px;
  border: 1px dashed #a78bfa;
  border-radius: 12px;
  background: #faf5ff;
}

.journey-debug-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  color: #581c87;
}

.journey-debug-heading span {
  font-size: 10px;
}

.journey-debug-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 8px;
  margin-top: 9px;
}

.journey-debug-slider {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  margin: 12px 0 8px;
}

.journey-debug-report p {
  margin: 8px 0 0;
  padding: 8px;
  border-radius: 7px;
  font-size: 11px;
}

.journey-debug-report .success {
  color: #166534;
  background: #dcfce7;
}

.journey-debug-report .warning {
  color: #92400e;
  background: #fef3c7;
}

.journey-debug-report .error {
  color: #991b1b;
  background: #fee2e2;
}

body.dark .journey-mode-summary,
body.dark .journey-active-dashboard {
  border-color: #166534;
  background: linear-gradient(135deg, #052e16, #082f49);
}

body.dark .journey-mode-open,
body.dark .journey-day-card > summary > strong,
body.dark .journey-active-stats strong {
  color: #f8fafc;
}

body.dark .journey-mode-icon,
body.dark .journey-active-stats > div {
  background: #0f172a;
}

body.dark .journey-mode-copy small,
body.dark .journey-day-summary-destination,
body.dark .journey-custom-goal-results button small,
body.dark .journey-custom-goal-results button > span:last-child {
  color: #cbd5e1;
}

body.dark .journey-plan-form,
body.dark .journey-day-card,
body.dark .journey-custom-goal-results,
body.dark .journey-custom-goal-results button {
  color: #e2e8f0;
  border-color: #334155;
  background: #0f172a;
}

body.dark .journey-custom-goal {
  border-color: #1d4ed8;
  background: #172554;
}

body.dark .journey-custom-goal-heading,
body.dark .journey-form-grid label,
body.dark .journey-debug-controls label,
body.dark .journey-debug-slider,
body.dark .journey-lodging-fieldset legend {
  color: #bfdbfe;
}

body.dark .journey-lodging-options label,
body.dark .journey-destination-card {
  color: #dcfce7;
  border-color: #334155;
  background: #052e16;
}

body.dark .journey-destination-card strong,
body.dark .journey-destination-card > span,
body.dark .journey-destination-card small,
body.dark .journey-active-header strong,
body.dark .journey-active-header small {
  color: #bbf7d0;
}

body.dark .journey-safety-card {
  border-color: #9a3412;
  background: #431407;
}

body.dark .journey-safety-card > strong,
body.dark .journey-safety-card > small,
body.dark .journey-warning,
body.dark .journey-active-warnings {
  color: #fed7aa;
}

body.dark .journey-debug-panel {
  border-color: #7e22ce;
  background: #2e1065;
}

body.dark .journey-debug-heading {
  color: #e9d5ff;
}

@media (max-width: 720px) {
  .topbar-actions {
    gap: 2px;
  }

  .topbar-actions .icon-btn {
    flex-basis: 44px;
    width: 44px;
    height: 44px;
    padding: 0;
    font-size: 27px;
  }

  .journey-planner-modal {
    width: 100%;
    height: 100dvh;
    max-height: 100dvh !important;
    border-radius: 0;
  }

  .journey-form-grid,
  .journey-day-content {
    grid-template-columns: 1fr;
  }

  .journey-day-temple,
  .journey-safety-card {
    grid-column: auto;
  }

  .journey-active-stats {
    grid-template-columns: repeat(3, minmax(80px, 1fr));
    overflow-x: auto;
  }

  .today-dashboard-modal,
  .emergency-modal-content {
    width: 100%;
    height: 100dvh;
    max-height: 100dvh !important;
    border-radius: 0;
  }
}

@media (max-width: 430px) {
  .topbar {
    padding-inline: 7px;
    gap: 4px;
  }

  .app-title {
    gap: 6px;
    font-size: 13px;
  }

  .topbar-actions {
    gap: 1px;
  }

  .topbar-actions .icon-btn {
    flex-basis: 44px;
    width: 44px;
    height: 44px;
    padding: 0;
    font-size: 27px;
  }

  .topbar-action-icon {
    width: 27px;
    height: 27px;
  }

  .journey-planner-body {
    padding: 12px;
  }

  .journey-active-header,
  .journey-custom-goal-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .journey-custom-goal-heading select {
    width: 100%;
    max-width: none;
  }

  .journey-day-card > summary {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .journey-day-card > summary > strong {
    grid-column: 2;
  }

  .journey-debug-controls,
  .journey-debug-slider {
    grid-template-columns: 1fr;
  }

  .today-stat-grid,
  .today-priority-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .emergency-call-grid,
  .emergency-location-actions,
  .today-actions {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 350px) {
  .topbar {
    padding-inline: 6px;
    gap: 3px;
  }

  .app-title {
    gap: 0;
    font-size: 12px;
  }

  .app-brand-icon {
    display: none;
  }

  .topbar-actions {
    gap: 0;
  }
}

/* Pilgrimage cockpit: map density, bounded offline cache and cultural guidance */
.temple-map-symbol strong {
  position: absolute;
  left: 50%;
  top: 15px;
  z-index: 2;
  display: grid;
  min-width: 19px;
  height: 14px;
  padding: 0 2px;
  place-items: center;
  border: 1px solid #9f1239;
  border-radius: 4px;
  color: #881337;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.42);
  font-size: 9px;
  line-height: 1;
  transform: translateX(-50%);
}
.map-marker-cluster {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 3px solid rgba(255, 255, 255, 0.92);
  border-radius: 50%;
  color: #fff;
  background: #2563eb;
  box-shadow: 0 3px 10px rgba(15, 23, 42, 0.35);
  font-size: 13px;
  font-weight: 900;
}
.temple-cluster { grid-template-columns: auto auto; gap: 1px; background: #9f1239; }
.temple-cluster img { width: 18px; height: 18px; object-fit: contain; filter: drop-shadow(0 0 1px #fff); }
.temple-marker-cluster,
.facility-marker-cluster { background: transparent; border: 0; }

.offline-map-debug-status {
  position: static;
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  color: #166534;
  border-color: #86efac;
  background: #f0fdf4;
  font-weight: 800;
}
.offline-map-debug-status::before { content: '●'; margin-right: 9px; color: #16a34a; }
.offline-map-debug-status.offline { color: #92400e; border-color: #fbbf24; background: #fef3c7; }
.offline-map-debug-status.offline::before { color: #f59e0b; }

.temple-ritual { margin: 14px 0; padding: 12px; border: 1px solid #fde68a; border-radius: 13px; background: #fffbeb; }
.temple-ritual > summary { color: #92400e; font-weight: 850; cursor: pointer; }
.temple-ritual-intro { color: #78350f; font-size: 12px; line-height: 1.45; }
.temple-ritual-steps { display: grid; gap: 8px; margin: 10px 0; padding: 0; list-style: none; }
.temple-ritual-steps li { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 8px; }
.temple-ritual-number { display: grid; width: 24px; height: 24px; place-items: center; border-radius: 50%; color: #fff; background: #b45309; font-size: 11px; font-weight: 850; }
.temple-ritual-steps strong { color: #78350f; font-size: 12px; }
.temple-ritual-steps p { margin: 2px 0 0; color: #92400e; font-size: 11px; line-height: 1.4; }
.temple-ritual-manners { padding-left: 19px; color: #78350f; font-size: 11px; line-height: 1.45; }
.temple-ritual > a { color: #92400e; font-size: 11px; }
body.dark .temple-ritual { border-color: #92400e; background: #451a03; }
body.dark .temple-ritual > summary,
body.dark .temple-ritual-intro,
body.dark .temple-ritual-steps strong,
body.dark .temple-ritual-steps p,
body.dark .temple-ritual-manners,
body.dark .temple-ritual > a { color: #fde68a; }

.offline-map-modal-content { width: min(92vw, 520px); max-width: 520px; }
.offline-map-modal-body { display: flex; flex-direction: column; gap: 12px; }
.offline-map-modal-body > p { margin: 0; color: #475569; line-height: 1.5; }
.offline-map-network { align-self: flex-start; padding: 5px 9px; border-radius: 999px; color: #166534; background: #dcfce7; font-size: 11px; }
.offline-map-network.offline { color: #92400e; background: #fef3c7; }
.offline-map-cache-card { padding: 13px; border: 1px solid #bfdbfe; border-radius: 13px; background: #eff6ff; }
.offline-map-cache-card p { margin: 6px 0 0; color: #475569; font-size: 12px; line-height: 1.45; }
body.dark .offline-map-modal-body > p,
body.dark .offline-map-cache-card p { color: #cbd5e1; }
body.dark .offline-map-cache-card { border-color: #1d4ed8; background: #172554; }

.today-ahead { padding: 13px; border: 1px solid #bfdbfe; border-radius: 13px; background: #eff6ff; }
.today-reviewed-warnings { margin-bottom: 9px; padding: 9px; border-radius: 9px; background: rgba(255, 255, 255, 0.68); }
.today-reviewed-warnings > strong { display: block; margin-bottom: 6px; color: #7c2d12; font-size: 11px; }
.today-reviewed-warnings li { display: flex; flex-direction: column; gap: 2px; }
.today-reviewed-warnings li span,
.today-reviewed-warnings li small { font-weight: 500; }
body.dark .today-reviewed-warnings { background: rgba(15, 23, 42, 0.42); }
.today-ahead h3 { margin: 0 0 9px; color: #1e3a8a; font-size: 15px; }
.today-ahead-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.today-ahead-grid article { display: flex; min-width: 0; flex-direction: column; gap: 3px; padding: 10px; border-radius: 10px; background: #fff; }
.today-ahead-grid article span { color: #1d4ed8; font-size: 10px; font-weight: 800; }
.today-ahead-grid article strong { overflow-wrap: anywhere; color: #0f172a; font-size: 12px; }
.today-ahead-grid article small { color: #475569; font-size: 10px; }
.today-ahead-grid article .today-ahead-warning { color: #991b1b; font-weight: 800; line-height: 1.35; }
.today-ahead-grid > p { grid-column: 1 / -1; margin: 0; color: #475569; font-size: 12px; }
body.dark .today-ahead { border-color: #1e40af; background: #172554; }
body.dark .today-ahead h3 { color: #bfdbfe; }
body.dark .today-ahead-grid article { background: #0f172a; }
body.dark .today-ahead-grid article strong { color: #f8fafc; }
body.dark .today-ahead-grid article small,
body.dark .today-ahead-grid > p { color: #cbd5e1; }
body.dark .today-ahead-grid article .today-ahead-warning { color: #fecaca; }

.journey-day-calendar { grid-column: 1 / -1; padding-top: 10px; color: #475569; font-size: 11px; font-weight: 750; }
body.dark .journey-day-calendar { color: #cbd5e1; }

@media (max-width: 430px) {
  .today-ahead-grid { grid-template-columns: 1fr; }
}
