/* Hallmark · shape: app screen · genre: editorial · theme: custom (Makoto Shinkai Noon / Dusk / Starry Night adaptive vector cartography) · contrast: pass · v2.0.0 */
/* Critique: Full-bleed CoMix Wave Films daylight, twilight, and starry-cobalt WebGL Hong Kong canvas framed by crisp sky-paper / twilight-paper / starry-cobalt glass chrome on a strict 4px rhythm. */

:root {
  --noon-canvas: #0d6cb5;
  --noon-surface: #f4f9ff;
  --noon-surface-subtle: #e5f0fb;
  --noon-surface-hover: #d7e7f8;
  --noon-ink: #10243e;
  --noon-ink-muted: #425d7d;
  --noon-border: rgba(20, 74, 138, 0.22);
  --noon-accent: #1468c4;
  --noon-accent-hover: #0e529e;
  --noon-accent-ink: #f8fbff;
  --noon-error-bg: #fff1f2;
  --noon-error-ink: #9f1239;
  --noon-error-border: rgba(159, 18, 57, 0.35);
  --noon-focus: #0b57d0;
  --noon-shadow: rgba(16, 44, 92, 0.14);

  --dusk-canvas: #2a1f5a;
  --dusk-surface: #fcf2e9;
  --dusk-surface-subtle: #f3e0d0;
  --dusk-surface-hover: #e7ccb7;
  --dusk-ink: #1d1542;
  --dusk-ink-muted: #5a4670;
  --dusk-border: rgba(29, 21, 66, 0.22);
  --dusk-accent: #c24929;
  --dusk-accent-hover: #9f391e;
  --dusk-accent-ink: #fffaf5;
  --dusk-focus: #b33f20;
  --dusk-shadow: rgba(29, 21, 66, 0.22);

  --night-canvas: #08142c;
  --night-surface: rgba(10, 22, 48, 0.86);
  --night-surface-subtle: rgba(18, 36, 72, 0.9);
  --night-surface-hover: rgba(28, 52, 98, 0.94);
  --night-ink: #e6f0ff;
  --night-ink-muted: #98b4dc;
  --night-border: rgba(82, 184, 255, 0.3);
  --night-accent: #38bdf8;
  --night-accent-hover: #0ea5e9;
  --night-accent-ink: #071326;
  --night-error-bg: rgba(76, 13, 32, 0.92);
  --night-error-ink: #fecdd3;
  --night-error-border: rgba(251, 113, 133, 0.45);
  --night-focus: #56ccff;
  --night-shadow: rgba(3, 10, 28, 0.56);

  --color-canvas: var(--noon-canvas);
  --color-surface: var(--noon-surface);
  --color-surface-subtle: var(--noon-surface-subtle);
  --color-surface-hover: var(--noon-surface-hover);
  --color-ink: var(--noon-ink);
  --color-ink-muted: var(--noon-ink-muted);
  --color-border: var(--noon-border);
  --color-accent: var(--noon-accent);
  --color-accent-hover: var(--noon-accent-hover);
  --color-accent-ink: var(--noon-accent-ink);
  --color-error-bg: var(--noon-error-bg);
  --color-error-ink: var(--noon-error-ink);
  --color-error-border: var(--noon-error-border);
  --color-focus: var(--noon-focus);
  --color-shadow: var(--noon-shadow);
  --font-sans: "PingFang HK", "Noto Sans SC", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, monospace;
  scrollbar-color: var(--color-ink-muted) transparent;
}

body[data-theme="shinkai_dusk"] {
  --color-canvas: var(--dusk-canvas);
  --color-surface: var(--dusk-surface);
  --color-surface-subtle: var(--dusk-surface-subtle);
  --color-surface-hover: var(--dusk-surface-hover);
  --color-ink: var(--dusk-ink);
  --color-ink-muted: var(--dusk-ink-muted);
  --color-border: var(--dusk-border);
  --color-accent: var(--dusk-accent);
  --color-accent-hover: var(--dusk-accent-hover);
  --color-accent-ink: var(--dusk-accent-ink);
  --color-focus: var(--dusk-focus);
  --color-shadow: var(--dusk-shadow);
}

body[data-theme="shinkai_night"] {
  --color-canvas: var(--night-canvas);
  --color-surface: var(--night-surface);
  --color-surface-subtle: var(--night-surface-subtle);
  --color-surface-hover: var(--night-surface-hover);
  --color-ink: var(--night-ink);
  --color-ink-muted: var(--night-ink-muted);
  --color-border: var(--night-border);
  --color-accent: var(--night-accent);
  --color-accent-hover: var(--night-accent-hover);
  --color-accent-ink: var(--night-accent-ink);
  --color-error-bg: var(--night-error-bg);
  --color-error-ink: var(--night-error-ink);
  --color-error-border: var(--night-error-border);
  --color-focus: var(--night-focus);
  --color-shadow: var(--night-shadow);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

::selection {
  background-color: var(--color-accent);
  color: var(--color-accent-ink);
}

html,
body {
  width: 100%;
  height: 100dvh;
  overflow-x: clip;
  overflow-y: clip;
  background-color: var(--color-canvas);
  color: var(--color-accent-ink);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.45;
}

body[data-theme="shinkai_night"] {
  color: var(--color-ink);
}

button {
  font-family: inherit;
  color: inherit;
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

button:active:not(:disabled) {
  transform: translateY(1px);
}

button:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

button:focus-visible,
[tabindex]:focus-visible,
a:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
  transition: none;
}

#map {
  position: relative;
  width: 100%;
  height: 100dvh;
  background-color: var(--color-canvas);
}

.topbar {
  position: fixed;
  top: 16px;
  left: 16px;
  right: 16px;
  z-index: 900;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  padding: 8px 12px;
  background-color: var(--color-surface);
  color: var(--color-ink);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  box-shadow: 0 4px 16px var(--color-shadow);
}

body[data-theme="shinkai_night"] .topbar,
body[data-theme="shinkai_night"] .drawer,
body[data-theme="shinkai_night"] .inspector,
body[data-theme="shinkai_night"] .telemetry,
body[data-theme="shinkai_night"] .status-banner,
body[data-theme="shinkai_night"] .map-pin-pill,
body[data-theme="shinkai_night"] .maplibregl-ctrl-group {
  backdrop-filter: blur(12px);
}

.brand-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.app-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--color-ink);
  overflow-wrap: break-word;
  min-width: 0;
}

.app-subtitle {
  font-size: 12px;
  color: var(--color-ink-muted);
  font-variant-numeric: tabular-nums;
}

.control-strips {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.seg-group {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  padding: 4px;
  background-color: var(--color-surface-subtle);
  border: 1px solid var(--color-border);
  border-radius: 8px;
}

.seg-btn {
  min-height: 32px;
  padding: 0 8px;
  border: 0;
  border-radius: 6px;
  background-color: transparent;
  color: var(--color-ink-muted);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  transition: background-color 140ms ease, color 140ms ease;
}

.seg-btn:hover {
  background-color: var(--color-surface-hover);
  color: var(--color-ink);
}

.seg-btn.is-active {
  background-color: var(--color-accent);
  color: var(--color-accent-ink);
}

.seg-btn.is-active:hover {
  background-color: var(--color-accent-hover);
  color: var(--color-accent-ink);
}

.quick-actions {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.icon-btn,
.icon-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 36px;
  padding: 0 8px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background-color: transparent;
  color: var(--color-ink);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease;
}

.icon-btn:hover,
.icon-link:hover {
  background-color: var(--color-surface-hover);
}

.icon-btn[aria-pressed="true"] {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.drawer {
  position: fixed;
  top: 84px;
  right: 16px;
  z-index: 890;
  width: 352px;
  max-height: calc(100dvh - 168px);
  display: flex;
  flex-direction: column;
  background-color: var(--color-surface);
  color: var(--color-ink);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  box-shadow: 0 4px 16px var(--color-shadow);
  overflow: hidden;
  opacity: 0;
  transform: translateX(16px);
  pointer-events: none;
  transition: transform 180ms ease, opacity 180ms ease;
}

.drawer.is-open {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border);
}

.drawer-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-ink);
  overflow-wrap: break-word;
  min-width: 0;
}

.close-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid transparent;
  border-radius: 8px;
  background-color: transparent;
  color: var(--color-ink-muted);
  flex-shrink: 0;
  transition: background-color 140ms ease, color 140ms ease;
}

.close-btn:hover {
  background-color: var(--color-surface-hover);
  color: var(--color-ink);
}

.landmark-list {
  list-style: none;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.landmark-item-btn {
  width: 100%;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  background-color: transparent;
  transition: background-color 140ms ease, border-color 140ms ease;
}

.landmark-item-btn:hover {
  background-color: var(--color-surface-subtle);
  border-color: var(--color-border);
}

.landmark-item-btn.is-selected {
  background-color: var(--color-surface-subtle);
  border-color: var(--color-accent);
}

.landmark-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.landmark-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-ink);
  min-width: 0;
  overflow-wrap: break-word;
  text-wrap: balance;
}

.landmark-badge {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-accent);
  white-space: nowrap;
  flex-shrink: 0;
}

.landmark-desc {
  font-size: 12px;
  color: var(--color-ink-muted);
  line-height: 1.4;
}

.inspector {
  position: fixed;
  left: 16px;
  bottom: 68px;
  z-index: 895;
  width: 320px;
  background-color: var(--color-surface);
  color: var(--color-ink);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  box-shadow: 0 4px 16px var(--color-shadow);
  overflow: hidden;
}

.inspector[hidden] {
  display: none;
}

.inspector-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border);
}

.inspector-titles {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.inspector-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--color-ink);
  overflow-wrap: break-word;
  min-width: 0;
}

.inspector-subtitle {
  font-size: 12px;
  color: var(--color-ink-muted);
  overflow-wrap: break-word;
}

.inspector-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
  padding: 12px 16px;
}

.inspector-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.inspector-row dt {
  font-size: 12px;
  color: var(--color-ink-muted);
}

.inspector-row dd {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-ink);
  font-variant-numeric: tabular-nums;
  overflow-wrap: break-word;
}

.telemetry {
  position: fixed;
  left: 16px;
  bottom: 16px;
  z-index: 880;
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 8px 12px;
  background-color: var(--color-surface);
  color: var(--color-ink);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  box-shadow: 0 2px 10px var(--color-shadow);
  font-family: var(--font-mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.mode-readout {
  color: var(--color-accent);
  font-family: var(--font-sans);
  font-weight: 600;
  padding-left: 8px;
  border-left: 1px solid var(--color-border);
}

.credit-readout {
  color: var(--color-ink-muted);
  font-family: var(--font-sans);
  font-size: 12px;
  padding-left: 8px;
  border-left: 1px solid var(--color-border);
}

.status-banner {
  position: fixed;
  bottom: 68px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 950;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-ink);
}

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

.status-error {
  background-color: var(--color-error-bg);
  color: var(--color-error-ink);
  border-color: var(--color-error-border);
}

.retry-btn {
  padding: 4px 12px;
  border: 1px solid var(--color-error-border);
  border-radius: 999px;
  background-color: transparent;
  color: var(--color-error-ink);
  font-size: 12px;
  font-weight: 700;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin 750ms linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.map-pin-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 999px;
  background-color: var(--color-surface);
  border: 1px solid var(--color-accent);
  color: var(--color-ink);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 2px 8px var(--color-shadow);
  transition: background-color 140ms ease, color 140ms ease;
}

.map-pin-pill[hidden] {
  display: none;
}

.map-pin-pill:hover,
.map-pin-pill.is-selected {
  background-color: var(--color-accent);
  color: var(--color-accent-ink);
}

/* MapLibre GL JS core layout & tokenized NavigationControl chrome */
.maplibregl-map {
  position: relative;
  overflow: hidden;
  font-family: var(--font-sans);
}

.maplibregl-canvas {
  position: absolute;
  left: 0;
  top: 0;
}

.maplibregl-canvas-container.maplibregl-interactive,
.maplibregl-ctrl-group button.maplibregl-ctrl-compass {
  cursor: grab;
  user-select: none;
}

.maplibregl-canvas-container.maplibregl-interactive.maplibregl-track-pointer {
  cursor: pointer;
}

.maplibregl-canvas-container.maplibregl-interactive:active,
.maplibregl-ctrl-group button.maplibregl-ctrl-compass:active {
  cursor: grabbing;
}

.maplibregl-canvas-container.maplibregl-touch-zoom-rotate,
.maplibregl-canvas-container.maplibregl-touch-zoom-rotate .maplibregl-canvas {
  touch-action: pan-x pan-y;
}

.maplibregl-canvas-container.maplibregl-touch-drag-pan,
.maplibregl-canvas-container.maplibregl-touch-drag-pan .maplibregl-canvas {
  touch-action: pinch-zoom;
}

.maplibregl-canvas-container.maplibregl-touch-zoom-rotate.maplibregl-touch-drag-pan,
.maplibregl-canvas-container.maplibregl-touch-zoom-rotate.maplibregl-touch-drag-pan .maplibregl-canvas {
  touch-action: none;
}

.maplibregl-marker {
  position: absolute;
  left: 0;
  top: 0;
  will-change: transform;
  transition: opacity 160ms ease;
}

.maplibregl-ctrl-bottom-left,
.maplibregl-ctrl-bottom-right,
.maplibregl-ctrl-top-left,
.maplibregl-ctrl-top-right {
  position: absolute;
  z-index: 860;
  pointer-events: none;
}

.maplibregl-ctrl-top-left {
  left: 0;
  top: 0;
}

.maplibregl-ctrl-top-right {
  right: 0;
  top: 0;
}

.maplibregl-ctrl-bottom-left {
  left: 0;
  bottom: 0;
}

.maplibregl-ctrl-bottom-right {
  right: 0;
  bottom: 0;
}

.maplibregl-ctrl {
  clear: both;
  pointer-events: auto;
  transform: translate(0);
}

.maplibregl-ctrl-bottom-right .maplibregl-ctrl {
  float: right;
  margin: 0 16px 16px 0;
}

.maplibregl-ctrl-group {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  box-shadow: 0 2px 10px var(--color-shadow);
  overflow: hidden;
}

.maplibregl-ctrl-group button {
  display: block;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  background-color: transparent;
  color: var(--color-ink);
  cursor: pointer;
}

.maplibregl-ctrl-group button + button {
  border-top: 1px solid var(--color-border);
}

.maplibregl-ctrl-group button:hover:not(:disabled) {
  background-color: var(--color-surface-hover);
}

.maplibregl-ctrl button .maplibregl-ctrl-icon {
  display: block;
  width: 100%;
  height: 100%;
  background-position: 50%;
  background-repeat: no-repeat;
}

.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon {
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2310243e' viewBox='0 0 29 29'%3E%3Cpath d='M14.5 8.5c-.75 0-1.5.75-1.5 1.5v3h-3c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h3v3c0 .75.75 1.5 1.5 1.5S16 19.75 16 19v-3h3c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13h-3v-3c0-.75-.75-1.5-1.5-1.5'/%3E%3C/svg%3E");
}

.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon {
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' fill='%2310243e' viewBox='0 0 29 29'%3E%3Cpath d='M10 13c-.75 0-1.5.75-1.5 1.5S9.25 16 10 16h9c.75 0 1.5-.75 1.5-1.5S19.75 13 19 13z'/%3E%3C/svg%3E");
}

.maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon {
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath fill='%231468c4' d='m10.5 14 4-8 4 8z'/%3E%3Cpath fill='%23425d7d' d='m10.5 16 4 8 4-8z'/%3E%3C/svg%3E");
}

body[data-theme="shinkai_night"] .maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon,
body[data-theme="shinkai_night"] .maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon {
  filter: brightness(0) invert(0.92);
}

body[data-theme="shinkai_night"] .maplibregl-ctrl button.maplibregl-ctrl-compass .maplibregl-ctrl-icon {
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29'%3E%3Cpath fill='%2338bdf8' d='m10.5 14 4-8 4 8z'/%3E%3Cpath fill='%2398b4dc' d='m10.5 16 4 8 4-8z'/%3E%3C/svg%3E");
}

.noscript-fallback {
  position: fixed;
  inset: 0;
  z-index: 1200;
  padding: 24px;
  background-color: var(--color-canvas);
  overflow-y: auto;
}

.noscript-card {
  max-width: 720px;
  margin: 0 auto;
  padding: 20px;
  border-radius: 12px;
  background-color: var(--color-surface);
  color: var(--color-ink);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.noscript-card a {
  color: var(--color-accent);
  font-weight: 600;
  text-decoration: underline;
}

@media (max-width: 82rem) {
  .drawer {
    top: 132px;
    max-height: calc(100dvh - 216px);
  }
}

@media (max-width: 64rem) {
  .topbar {
    gap: 8px;
    padding: 8px 12px;
  }

  .app-subtitle,
  .credit-readout {
    display: none;
  }

  .drawer {
    top: auto;
    bottom: 60px;
    right: 16px;
    left: 16px;
    width: auto;
    max-height: 42dvh;
  }

  .inspector {
    left: 16px;
    right: 16px;
    bottom: 60px;
    width: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .seg-btn,
  .icon-btn,
  .icon-link,
  .drawer,
  .close-btn,
  .landmark-item-btn,
  .map-pin-pill,
  .maplibregl-marker {
    transition: none;
  }

  button:active:not(:disabled) {
    transform: none;
  }

  .spinner {
    animation: none;
  }
}
