:root {
  color-scheme: dark;

  /* Base surfaces (Palantir/Blueprint-inspired dark console palette) */
  --bg-app: #10161a;
  --bg-panel: #161b22;
  --bg-panel-strong: #0b0f14;
  --bg-elevated: #1c232c;

  /* Borders */
  --stroke: rgba(255, 255, 255, 0.1);
  --stroke-strong: rgba(255, 255, 255, 0.18);

  /* Text */
  --ink: #f5f8fa;
  --muted: #8a9ba8;

  /* Accent (Blueprint blue) */
  --accent: #2d72d2;
  --accent-strong: #1a4c93;
  --accent-bright: #48aff0;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;

  /* Re-theme precompiled Bootstrap 5.3 tokens to the palette above (no Sass rebuild in this project) */
  --bs-body-bg: var(--bg-app);
  --bs-body-color: var(--ink);
  --bs-emphasis-color: #ffffff;
  --bs-secondary-color: var(--muted);
  --bs-secondary-bg: var(--bg-panel);
  --bs-tertiary-bg: var(--bg-elevated);
  --bs-border-color: var(--stroke);
  --bs-border-color-translucent: var(--stroke);
  --bs-link-color: var(--accent-bright);
  --bs-link-color-rgb: 72, 175, 240;
  --bs-link-hover-color: var(--accent);
  --bs-primary: var(--accent);
  --bs-primary-rgb: 45, 114, 210;
  --bs-focus-ring-color: rgba(45, 114, 210, 0.4);
  --bs-border-radius: 0.3rem;
  --bs-border-radius-sm: 0.2rem;
  --bs-border-radius-lg: 0.4rem;

  --bs-card-bg: var(--bg-panel);
  --bs-card-border-color: var(--stroke);
  --bs-card-cap-bg: var(--bg-panel-strong);

  --bs-list-group-bg: var(--bg-panel);
  --bs-list-group-border-color: var(--stroke);
  --bs-list-group-action-hover-bg: var(--bg-elevated);
  --bs-list-group-action-hover-color: var(--ink);
  --bs-list-group-action-active-bg: var(--bg-elevated);
}

.btn-primary {
  --bs-btn-color: #fff;
  --bs-btn-bg: var(--accent);
  --bs-btn-border-color: var(--accent);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--accent-strong);
  --bs-btn-hover-border-color: var(--accent-strong);
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: var(--accent-strong);
  --bs-btn-active-border-color: var(--accent-strong);
  --bs-btn-disabled-bg: var(--accent);
  --bs-btn-disabled-border-color: var(--accent);
  --bs-btn-focus-shadow-rgb: 45, 114, 210;
}

.btn-outline-light {
  --bs-btn-color: var(--ink);
  --bs-btn-border-color: var(--stroke-strong);
  --bs-btn-hover-color: var(--ink);
  --bs-btn-hover-bg: var(--bg-elevated);
  --bs-btn-hover-border-color: var(--stroke-strong);
  --bs-btn-active-color: var(--ink);
  --bs-btn-active-bg: var(--bg-elevated);
  --bs-btn-active-border-color: var(--stroke-strong);
}

/* Mode toggle: the non-active button should read as a quiet ghost control so the
   active one (solid accent) is unambiguous, rather than both looking equally "on". */
.mode-button {
  --bs-btn-color: var(--ink);
  --bs-btn-bg: var(--bg-elevated);
  --bs-btn-border-color: var(--stroke-strong);
  --bs-btn-hover-color: var(--ink);
  --bs-btn-hover-bg: var(--bg-elevated);
  --bs-btn-hover-border-color: var(--accent);
}

.mode-button.active {
  --bs-btn-color: #fff;
  --bs-btn-bg: var(--accent);
  --bs-btn-border-color: var(--accent);
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: var(--accent);
  --bs-btn-active-border-color: var(--accent);
}

.status-badge {
  background: var(--bg-elevated);
  color: var(--accent-bright);
  border: 1px solid var(--stroke-strong);
  font-family: var(--font-mono);
  font-weight: 500;
  letter-spacing: 0.02em;
}

body {
  font-family: var(--font-sans);
  color: var(--ink);
  background: radial-gradient(circle at 50% -10%, #141b22 0%, var(--bg-app) 45%, #0a0d11 100%);
  min-height: 100vh;
}

/* Standard WCAG "skip to main content" pattern; Bootstrap's visually-hidden-focusable
   utility handles the hide/reveal-on-focus, this just positions the revealed state. */
.skip-link {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 1050;
  padding: 10px 16px;
  border-radius: 4px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
}

html[dir="rtl"] .skip-link {
  right: 8px;
  left: auto;
}

.topbar {
  background: var(--bg-panel-strong);
  border-bottom: 1px solid var(--stroke);
  padding: 12px 4px;
}

.viewport-card {
  position: relative;
  overflow: hidden;
  min-height: 720px;
  border-color: var(--stroke) !important;
  border-radius: 6px;
}

#viewport {
  display: block;
  width: 100%;
  height: 720px;
  background: radial-gradient(circle at 50% 15%, #1a3350 0%, #0c1826 55%, #060a0f 100%);
}

#viewport[hidden] {
  display: none;
}

#viewport.telescope-active {
  cursor: crosshair;
  touch-action: none;
}

#globe3dCanvas {
  display: block;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at 50% 15%, #1a3350 0%, #0c1826 55%, #060a0f 100%);
}

#globe3dCanvas[hidden] {
  display: none;
}

.globe-hover-label {
  position: absolute;
  z-index: 6;
  max-width: min(320px, calc(100% - 28px));
  padding: 6px 9px;
  border: 1px solid rgba(154, 226, 203, 0.65);
  border-radius: 4px;
  background: rgba(6, 13, 20, 0.92);
  color: #e7fff7;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.38);
  font: 600 0.78rem/1.2 var(--font-mono);
  letter-spacing: 0.02em;
  pointer-events: none;
  opacity: 0;
  transform: translateY(3px);
  transition: opacity 90ms ease, transform 90ms ease;
  white-space: nowrap;
}

.globe-hover-label.visible {
  opacity: 1;
  transform: translateY(0);
}

.hud {
  position: absolute;
  top: 14px;
  left: 14px;
  display: flex;
  gap: 14px;
  font-size: 0.85rem;
  font-family: var(--font-mono);
  color: var(--ink);
  background: rgba(11, 15, 20, 0.75);
  border: 1px solid var(--stroke-strong);
  border-radius: 4px;
  padding: 8px 10px;
  backdrop-filter: blur(6px);
}

html[dir="rtl"] .hud {
  right: 14px;
  left: auto;
}

.hud strong {
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  margin-right: 4px;
}

html[dir="rtl"] .hud strong {
  margin-right: 0;
  margin-left: 4px;
}

.mode-controls {
  position: absolute;
  top: 14px;
  right: 14px;
}

html[dir="rtl"] .mode-controls {
  right: auto;
  left: 14px;
}

.observer-controls {
  position: absolute;
  left: 14px;
  bottom: 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px;
  background: rgba(11, 15, 20, 0.82);
  border: 1px solid var(--stroke-strong);
  border-radius: 4px;
  padding: 10px;
  backdrop-filter: blur(6px);
}

html[dir="rtl"] .observer-controls {
  right: 14px;
  left: auto;
}

.observer-controls .form-label {
  display: block;
  color: var(--muted);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}

.observer-controls .form-control {
  width: 130px;
  font-family: var(--font-mono);
}

.search-results {
  margin-top: 10px;
  max-height: 290px;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--stroke-strong) transparent;
}

.search-results::-webkit-scrollbar {
  width: 8px;
}

.search-results::-webkit-scrollbar-thumb {
  background: var(--stroke-strong);
  border-radius: 4px;
}

.search-item strong {
  display: block;
  font-size: 0.9rem;
  color: var(--ink);
}

.search-item span {
  color: var(--muted);
  font-size: 0.8rem;
}

.empty-state {
  font-size: 0.9rem;
}

#selectionMeta {
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 8px;
  font-size: 0.86rem;
}

#selectionMeta dt {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

#selectionMeta dd {
  margin: 0;
  font-family: var(--font-mono);
}

.site-footer {
  border-top: 1px solid var(--stroke);
}

.street-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 7, 10, 0.82);
  display: grid;
  place-items: center;
  padding: 18px;
  z-index: 1040;
}

.street-overlay[hidden] {
  display: grid;
  visibility: hidden;
  pointer-events: none;
}

.street-shell {
  width: min(1200px, 100%);
  height: min(760px, 94vh);
  display: grid;
  grid-template-rows: auto 1fr;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--stroke-strong);
  background: var(--bg-panel-strong);
}

.street-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  color: var(--ink);
  background: var(--bg-panel);
  border-bottom: 1px solid var(--stroke);
}

#streetViewFrame {
  width: 100%;
  height: 100%;
  border: none;
}

@media (max-width: 1080px) {
  .viewport-card {
    min-height: 520px;
  }

  #viewport {
    height: 520px;
  }
}

.account-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.account-avatar,
.profile-avatar {
  display: inline-grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--stroke-strong);
  border-radius: 50%;
  background: var(--bg-elevated);
}

.account-avatar { width: 26px; height: 26px; }
.profile-avatar { width: 48px; height: 48px; font-size: 1.25rem; }
.account-avatar img,
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }

.auth-splash {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 24px;
  background:
    radial-gradient(circle at 18% 15%, rgba(45, 114, 210, 0.22), transparent 31%),
    radial-gradient(circle at 80% 78%, rgba(104, 232, 186, 0.12), transparent 27%),
    #070b10;
}

.auth-splash[hidden] { display: none; }

.auth-splash::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.5;
  background-image:
    radial-gradient(circle, rgba(255,255,255,.78) 0 1px, transparent 1.3px),
    radial-gradient(circle, rgba(114,184,255,.58) 0 1px, transparent 1.4px);
  background-position: 0 0, 43px 27px;
  background-size: 73px 73px, 109px 109px;
}

.auth-splash-backdrop {
  position: absolute;
  left: max(-80px, calc(50% - 650px));
  top: 50%;
  width: 650px;
  height: 650px;
  transform: translateY(-50%);
  opacity: 0.72;
  isolation: isolate;
  pointer-events: none;
}

.splash-earth {
  position: absolute;
  inset: 175px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(126, 200, 255, 0.5);
  border-radius: 50%;
  color: #86cfff;
  background: radial-gradient(circle at 34% 30%, #245f8f 0%, #102942 51%, #07101b 100%);
  box-shadow: 0 0 80px rgba(72, 175, 240, 0.22);
  font-size: 9rem;
  z-index: 2;
  animation: auth-planet-spin-up 4.8s linear .3s both;
  will-change: transform, filter, box-shadow;
}

.splash-earth::after {
  content: "";
  position: absolute;
  inset: -18px;
  border: 1px solid rgba(134, 207, 255, 0);
  border-radius: 50%;
  animation: auth-planet-energy 4.8s ease-out .3s both;
}

.orbit {
  position: absolute;
  inset: 85px;
  border: 1px solid rgba(116, 230, 184, 0.35);
  border-radius: 50%;
  transform: rotate(18deg) scaleY(.38);
}

.orbit::after {
  content: "";
  position: absolute;
  top: 45%;
  right: -5px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #74e6b8;
  box-shadow: 0 0 14px #74e6b8;
}

.orbit-one { animation: auth-orbit-spin-up 4.8s linear .3s both; }
.orbit-two { inset: 40px; transform: rotate(-26deg) scaleY(.52); border-color: rgba(255, 204, 85, .28); }
.orbit-two { animation: auth-orbit-spin-up-reverse 4.8s linear .3s both; }
.orbit-two::after { background: #ffcc55; box-shadow: 0 0 14px #ffcc55; }

.gravity-wave {
  position: absolute;
  inset: 175px;
  z-index: 1;
  border: 1px solid rgba(116, 230, 184, 0.72);
  border-radius: 50%;
  opacity: 0;
  background: radial-gradient(circle, transparent 58%, rgba(134, 207, 255, 0.16) 61%, transparent 65%);
  box-shadow:
    0 0 18px rgba(116, 230, 184, 0.28),
    inset 0 0 18px rgba(134, 207, 255, 0.2);
  mix-blend-mode: screen;
  animation: auth-gravity-wave 2.45s cubic-bezier(.12, .58, .18, 1) forwards;
  will-change: transform, opacity;
}

.gravity-wave-one { animation-delay: 4.38s; }
.gravity-wave-two { animation-delay: 4.62s; border-color: rgba(134, 207, 255, 0.62); }
.gravity-wave-three { animation-delay: 4.86s; border-color: rgba(255, 204, 85, 0.48); }

@keyframes auth-planet-spin-up {
  0% { transform: rotate(0deg) scale(1); filter: brightness(1); }
  14% { transform: rotate(18deg) scale(1); }
  28% { transform: rotate(78deg) scale(1.01); }
  42% { transform: rotate(220deg) scale(1.01); }
  56% { transform: rotate(500deg) scale(1.02); }
  70% { transform: rotate(980deg) scale(1.03); }
  82% { transform: rotate(1540deg) scale(1.06); filter: brightness(1.25); }
  90% { transform: rotate(2020deg) scale(.94); filter: brightness(1.7); }
  94% { transform: rotate(2240deg) scale(1.11); filter: brightness(2.2); }
  100% { transform: rotate(2304deg) scale(1); filter: brightness(1); }
}

@keyframes auth-planet-energy {
  0%, 72% { border-color: rgba(134, 207, 255, 0); transform: scale(.9); opacity: 0; }
  86% { border-color: rgba(116, 230, 184, .42); opacity: .65; }
  94% { border-color: rgba(255, 255, 255, .88); transform: scale(1.08); opacity: 1; }
  100% { border-color: rgba(134, 207, 255, 0); transform: scale(1.34); opacity: 0; }
}

@keyframes auth-orbit-spin-up {
  0% { transform: rotate(18deg) scaleY(.38); }
  28% { transform: rotate(48deg) scaleY(.38); }
  56% { transform: rotate(198deg) scaleY(.38); }
  82% { transform: rotate(558deg) scaleY(.38); }
  94% { transform: rotate(918deg) scaleY(.32); }
  100% { transform: rotate(1098deg) scaleY(.38); }
}

@keyframes auth-orbit-spin-up-reverse {
  0% { transform: rotate(-26deg) scaleY(.52); }
  28% { transform: rotate(-56deg) scaleY(.52); }
  56% { transform: rotate(-206deg) scaleY(.52); }
  82% { transform: rotate(-566deg) scaleY(.52); }
  94% { transform: rotate(-926deg) scaleY(.44); }
  100% { transform: rotate(-1106deg) scaleY(.52); }
}

@keyframes auth-gravity-wave {
  0% { transform: scale(.72); opacity: 0; }
  12% { opacity: .86; }
  48% { opacity: .48; }
  100% { transform: scale(2.15); opacity: 0; }
}

.auth-card {
  position: relative;
  z-index: 1;
  width: min(480px, 100%);
  margin-left: min(48vw, 530px);
  padding: clamp(28px, 5vw, 46px);
  border: 1px solid var(--stroke-strong);
  border-radius: 18px;
  background: rgba(15, 21, 28, 0.92);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.48);
  backdrop-filter: blur(18px);
}

.auth-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: 24px;
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(145deg, var(--accent), #1d4e83);
  font-size: 1.25rem;
}

.auth-eyebrow,
.account-kicker {
  color: #74e6b8;
  font: 700 .72rem/1 var(--font-mono);
  letter-spacing: .12em;
  text-transform: uppercase;
}

.auth-card h1 { max-width: 420px; margin-bottom: 16px; font-size: clamp(2rem, 5vw, 3rem); line-height: 1.02; letter-spacing: -.04em; }
.auth-copy { color: #aebbc5; font-size: 1rem; line-height: 1.62; }
.auth-benefits { display: flex; flex-wrap: wrap; gap: 8px; margin: 22px 0 28px; }
.auth-benefits span { padding: 7px 9px; border: 1px solid var(--stroke); border-radius: 999px; color: #cad4dc; font-size: .78rem; }
.auth-benefits i { margin-right: 4px; color: #74e6b8; }
.google-sign-in {
  display: flex;
  justify-content: center;
  min-height: 44px;
  background: transparent;
}
.google-sign-in > div { background: transparent !important; }
.google-sign-in iframe {
  display: block;
  background: transparent;
  clip-path: inset(3px 10px round 999px);
}
.auth-message { min-height: 1.4em; margin: 14px 0 0; color: var(--muted); text-align: center; font-size: .83rem; }
.auth-message.error { color: #ff9a9a; }
.auth-fineprint { margin: 18px 0 0; color: #6f7d88; font-size: .72rem; line-height: 1.5; }

.account-dialog {
  width: min(620px, calc(100vw - 24px));
  max-height: min(820px, calc(100vh - 24px));
  padding: 0;
  border: 1px solid var(--stroke-strong);
  border-radius: 12px;
  color: var(--ink);
  background: var(--bg-panel-strong);
  box-shadow: 0 30px 100px rgba(0,0,0,.62);
}

.account-dialog::backdrop { background: rgba(3, 7, 10, .78); backdrop-filter: blur(5px); }
.account-dialog-shell { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; max-height: inherit; }
.account-dialog-header,
.account-dialog-footer { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; background: var(--bg-panel); }
.account-dialog-header { border-bottom: 1px solid var(--stroke); }
.account-dialog-footer { border-top: 1px solid var(--stroke); }
.account-dialog-body { display: grid; gap: 24px; overflow: auto; padding: 20px; }
.account-dialog-body section { padding-bottom: 22px; border-bottom: 1px solid var(--stroke); }
.account-dialog-body section:last-child { padding-bottom: 0; border-bottom: 0; }
.saved-entities { display: grid; gap: 8px; }
.saved-entity { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 10px; align-items: center; padding: 11px 12px; border: 1px solid var(--stroke); border-radius: 7px; background: var(--bg-panel); }
.saved-entity strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.saved-entity-meta { color: var(--muted); font: .72rem/1.4 var(--font-mono); text-transform: uppercase; }

@media (max-width: 900px) {
  .auth-splash-backdrop { left: 50%; top: 15%; width: 420px; height: 420px; transform: translate(-50%, -50%); opacity: .28; }
  .splash-earth { inset: 115px; font-size: 5.5rem; }
  .gravity-wave { inset: 115px; }
  .orbit { inset: 58px; }
  .orbit-two { inset: 28px; }
  .auth-card { margin: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .splash-earth,
  .splash-earth::after,
  .orbit,
  .gravity-wave { animation: none; }
}

/* Immersive authenticated application shell. The renderer remains the bottom layer while every
   control is independently interactive above it. */
html,
body { width: 100%; height: 100%; overflow: hidden; }

body { min-height: 100dvh; }

.render-stage {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100dvh;
  padding: 0;
}

.render-stage .viewport-card {
  position: absolute;
  inset: 0;
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: #060a0f;
}

.render-stage #viewport,
.render-stage #globe3dCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 64px;
  padding: 10px 14px;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(5, 10, 15, .86), rgba(5, 10, 15, .52) 72%, transparent);
}

.app-header > * { pointer-events: auto; }

.app-brand {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 9px;
  color: var(--ink);
  font-weight: 700;
  letter-spacing: -.02em;
  text-decoration: none;
  text-shadow: 0 2px 12px #000;
}

.app-brand i { color: #74e6b8; font-size: 1.15rem; }

.header-panel {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto minmax(0, 150px);
  align-items: center;
  flex: 1 1 auto;
  gap: 12px;
  min-width: 0;
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.header-toggle {
  display: none;
  place-items: center;
  width: 42px;
  height: 42px;
  margin-left: auto;
  border: 1px solid var(--stroke-strong);
  border-radius: 10px;
  color: var(--ink);
  background: rgba(11, 15, 20, .82);
  backdrop-filter: blur(14px);
  font-size: 1.3rem;
}

.catalog-search {
  position: relative;
  width: 100%;
  max-width: 680px;
  min-width: 220px;
}

.catalog-search-icon {
  position: absolute;
  top: 50%;
  left: 14px;
  z-index: 2;
  transform: translateY(-50%);
  color: #a5b3bd;
  pointer-events: none;
}

.catalog-search-input {
  width: 100%;
  min-height: 42px;
  padding: 9px 42px;
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 999px;
  outline: none;
  color: var(--ink);
  background: rgba(9, 14, 20, .78);
  box-shadow: 0 10px 34px rgba(0, 0, 0, .26);
  backdrop-filter: blur(16px);
}

.catalog-search-input:focus {
  border-color: rgba(116, 230, 184, .72);
  box-shadow: 0 0 0 3px rgba(116, 230, 184, .12), 0 14px 40px rgba(0, 0, 0, .32);
}

.catalog-search .search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 60;
  max-height: min(430px, calc(100dvh - 120px));
  margin: 0;
  padding: 6px;
  overflow: auto;
  border: 1px solid var(--stroke-strong);
  border-radius: 14px;
  background: rgba(8, 13, 19, .94);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .56);
  backdrop-filter: blur(20px);
}

.catalog-search .search-item {
  min-height: 52px;
  padding: 9px 12px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  touch-action: manipulation;
}

.catalog-search .search-item:hover,
.catalog-search .search-item:focus-visible { background: rgba(72, 175, 240, .14); }

.app-header .mode-controls,
.app-header .observer-controls {
  position: static;
  flex: 0 0 auto;
}

.app-header .mode-controls .btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  touch-action: manipulation;
}

.app-header .observer-controls {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px 5px;
  border: 1px solid var(--stroke);
  border-radius: 10px;
  background: rgba(11, 15, 20, .7);
  backdrop-filter: blur(14px);
}

.app-header .coordinate-field {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 4px;
  margin: 0;
  padding: 2px 5px;
  border-radius: 7px;
}

.app-header .coordinate-field:focus-within { background: rgba(72, 175, 240, .1); }
.app-header .coordinate-field span { color: var(--muted); font: 700 .58rem/1 var(--font-mono); text-transform: uppercase; }
.app-header .coordinate-field input {
  width: 72px;
  min-height: 30px;
  padding: 3px 2px;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font: 600 .74rem/1 var(--font-mono);
}

.header-dataset-status {
  overflow: hidden;
  color: #9fb2bf;
  font: 600 .62rem/1.25 var(--font-mono);
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

html[dir="rtl"] .header-dataset-status {
  text-align: left;
}

.render-filters { position: relative; }
.render-filters > summary { list-style: none; }
.render-filters > summary::-webkit-details-marker { display: none; }
.header-action-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 8px 11px;
  border: 1px solid var(--stroke-strong);
  border-radius: 9px;
  color: var(--ink);
  background: rgba(11, 15, 20, .74);
  cursor: pointer;
  user-select: none;
  backdrop-filter: blur(14px);
}
.render-filters[open] .header-action-button,
.header-action-button:hover { border-color: rgba(116, 230, 184, .55); background: rgba(24, 39, 46, .9); }
.render-filter-panel {
  position: absolute;
  top: calc(100% + 9px);
  right: 0;
  z-index: 70;
  width: 280px;
  padding: 14px;
  border: 1px solid var(--stroke-strong);
  border-radius: 14px;
  background: rgba(8, 13, 19, .96);
  box-shadow: 0 24px 70px rgba(0,0,0,.56);
  backdrop-filter: blur(20px);
}

html[dir="rtl"] .render-filter-panel {
  right: auto;
  left: 0;
}
.filter-panel-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.filter-panel-heading strong { font-size: .86rem; }
.filter-panel-heading span { color: var(--muted); font-size: .65rem; }
.render-filter-panel fieldset { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin: 0 0 12px; padding: 0; border: 0; }
.render-filter-panel fieldset:last-child { margin-bottom: 0; }
.render-filter-panel legend { grid-column: 1 / -1; margin-bottom: 2px; color: #74e6b8; font: 700 .62rem/1 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; }
.render-filter-panel label { display: flex; align-items: center; gap: 7px; min-height: 30px; color: #dce6ec; font-size: .76rem; cursor: pointer; }
.render-filter-panel input { accent-color: #2d72d2; }

.app-header .account-button { margin-left: 0; min-height: 40px; touch-action: manipulation; }

.language-field {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 40px;
  padding: 0 8px;
  border: 1px solid var(--stroke-strong);
  border-radius: 9px;
  color: var(--ink);
  background: rgba(11, 15, 20, .74);
}
.language-field i { color: #74e6b8; }
.language-select {
  max-width: 84px;
  border: 0;
  outline: 0;
  color: inherit;
  background: transparent;
  font: 700 .68rem/1 var(--font-mono);
  cursor: pointer;
}
.language-select option { color: #eaf1f5; background: #10171e; }

.credential-lock { display: inline-flex; align-items: center; gap: 5px; color: #74e6b8; font: 700 .66rem/1 var(--font-mono); white-space: nowrap; }
.credential-fineprint { color: var(--muted); font-size: .7rem; line-height: 1.45; }
.ai-credential-section .input-group { flex-wrap: nowrap; }
.ai-credential-section .form-control { min-width: 0; font-family: var(--font-mono); }

.render-stage .hud {
  top: 76px;
  left: 14px;
  z-index: 10;
  background: rgba(7, 12, 18, .58);
  backdrop-filter: blur(10px);
}

html[dir="rtl"] .render-stage .hud {
  right: 14px;
  left: auto;
}

.sky-time-controls {
  position: absolute;
  top: 76px;
  left: 50%;
  z-index: 12;
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 42px;
  padding: 5px;
  border: 1px solid var(--stroke-strong);
  border-radius: 12px;
  background: rgba(7, 12, 18, .76);
  box-shadow: 0 12px 34px rgba(0, 0, 0, .34);
  backdrop-filter: blur(12px);
  transform: translateX(-50%);
}

.sky-time-controls[hidden] { display: none; }

.sky-telescope-controls {
  position: absolute;
  top: 126px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px;
  border: 1px solid rgba(151, 199, 234, .22);
  border-radius: 10px;
  background: rgba(5, 14, 25, .72);
  backdrop-filter: blur(8px);
}
.sky-preset-field { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font: 700 .7rem/1 var(--font-mono); }
.sky-preset-field select { min-height: 30px; border: 0; border-radius: 6px; color: var(--ink); background: rgba(255,255,255,.08); font: inherit; }

.sky-time-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 5px 9px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: #dce6ec;
  background: transparent;
  font: 700 .7rem/1 var(--font-mono);
  touch-action: manipulation;
}

.sky-time-button:hover,
.sky-time-button:focus-visible,
.sky-time-button.active {
  border-color: rgba(116, 230, 184, .42);
  color: #effff8;
  background: rgba(28, 107, 79, .36);
}

.sky-speed-field {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding-left: 7px;
  border-left: 1px solid var(--stroke-strong);
  color: var(--muted);
  font: 700 .62rem/1 var(--font-mono);
  text-transform: uppercase;
  letter-spacing: .06em;
}

html[dir="rtl"] .sky-speed-field {
  padding-right: 7px;
  padding-left: 0;
  border-right: 1px solid var(--stroke-strong);
  border-left: 0;
}

.sky-speed-field select {
  min-height: 30px;
  padding: 3px 24px 3px 7px;
  border: 1px solid var(--stroke-strong);
  border-radius: 7px;
  color: #effff8;
  background: #0b1219;
  font: 700 .7rem/1 var(--font-mono);
}

.sky-time-state {
  min-width: 54px;
  padding: 5px 7px;
  border-radius: 999px;
  color: #74e6b8;
  background: rgba(116, 230, 184, .09);
  font: 800 .61rem/1 var(--font-mono);
  text-align: center;
  letter-spacing: .05em;
}

.selection-panel {
  position: absolute;
  top: 78px;
  right: 16px;
  bottom: calc(5vh + 16px);
  z-index: 20;
  width: min(390px, calc(100vw - 32px));
  max-height: 640px;
  padding: 16px;
  overflow: auto;
  border: 1px solid var(--stroke-strong);
  border-radius: 16px;
  color: var(--ink);
  background: rgba(8, 13, 19, .86);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .48);
  backdrop-filter: blur(20px);
}

.selection-panel[hidden] { display: none; }

.selection-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.selection-kicker {
  margin: 0;
  color: #74e6b8;
  font: 700 .68rem/1 var(--font-mono);
  letter-spacing: .11em;
  text-transform: uppercase;
}

.selection-close {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--stroke);
  border-radius: 50%;
  color: var(--ink);
  background: rgba(255,255,255,.04);
  touch-action: manipulation;
}

.selection-close:hover,
.selection-close:focus-visible { border-color: var(--stroke-strong); background: rgba(255,255,255,.1); }
.selection-panel h2 { margin: 0 0 14px; font-size: 1.35rem; }
.star-insight { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--stroke); color: var(--ink); }
.star-insight h3 { margin: 0 0 8px; font-size: 1rem; }
.star-insight h4 { margin: 14px 0 5px; color: var(--accent-bright); font-size: .78rem; text-transform: uppercase; }
.star-insight p, .star-insight li { font-size: .86rem; line-height: 1.55; }
.star-insight ul { margin: 0; padding-left: 20px; }
.star-insight dl { display: grid; grid-template-columns: minmax(82px, .8fr) 1.2fr; gap: 4px 10px; margin: 10px 0 0; }
.star-insight dl dt { color: var(--ink-muted); font-size: .76rem; }
.star-insight dl dd { margin: 0; font-size: .8rem; }
.star-insight-note { color: var(--ink-muted); font-size: .74rem !important; }
.selection-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 16px; }
.selection-actions #askStarButton:not([hidden]) { grid-column: 1 / -1; }
.selection-actions .btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 44px; touch-action: manipulation; }

.reset-view-button {
  position: absolute;
  top: 130px;
  left: 14px;
  z-index: 18;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(7, 12, 18, .82);
  box-shadow: 0 12px 30px rgba(0, 0, 0, .34);
  backdrop-filter: blur(12px);
}

.reset-view-button[hidden] { display: none; }
html[dir="rtl"] .reset-view-button { right: 14px; left: auto; }

.globe-hover-label,
.canvas-hover-preview {
  z-index: 25;
  max-width: min(300px, calc(100vw - 28px));
  padding: 8px 10px;
  border-radius: 9px;
  background: rgba(6, 12, 18, .9);
  backdrop-filter: blur(12px);
  white-space: normal;
}

.globe-hover-label strong,
.canvas-hover-preview strong { display: block; margin-bottom: 3px; color: #fff; font: 700 .82rem/1.2 var(--font-sans); }
.globe-hover-label span,
.canvas-hover-preview span { display: block; color: #9fb2bf; font: 500 .7rem/1.35 var(--font-mono); }

.canvas-hover-preview {
  position: absolute;
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 120ms ease, transform 120ms ease;
}

.canvas-hover-preview.visible { opacity: 1; transform: translateY(0); }

.site-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 35;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 5vh;
  min-height: 34px;
  padding: 5px 14px;
  overflow: hidden;
  border-top: 1px solid rgba(255,255,255,.12);
  background: rgba(130, 138, 146, .22);
  backdrop-filter: blur(5px) saturate(.7);
  color: #fff;
  font: 600 clamp(.58rem, .76vw, .72rem)/1.2 var(--font-mono);
  mix-blend-mode: difference;
}

.site-footer a { color: inherit; text-decoration-color: currentColor; }
.footer-link-button {
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

.cookie-notice {
  position: fixed;
  right: 18px;
  bottom: calc(max(5vh, 34px) + 14px);
  left: 18px;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 20px;
  border: 1px solid rgba(141, 235, 208, .42);
  border-radius: 8px;
  background: rgba(10, 16, 19, .98);
  box-shadow: 0 18px 50px rgba(0,0,0,.52);
  color: #edf5f7;
}
.cookie-notice[hidden] { display: none; }
.cookie-notice-copy { max-width: 850px; }
.cookie-notice h2 { margin: 0 0 5px; font-size: 1rem; }
.cookie-notice p { margin: 0; color: #c1ced3; font-size: .82rem; line-height: 1.45; }
.cookie-notice-actions { display: flex; flex: 0 0 auto; align-items: center; gap: 8px; }

.cookie-details-dialog {
  width: min(680px, calc(100vw - 28px));
  max-height: min(82dvh, 760px);
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--stroke-strong);
  border-radius: 8px;
  background: #0b1114;
  color: var(--text);
}
.cookie-details-dialog::backdrop { background: rgba(0,0,0,.76); backdrop-filter: blur(4px); }
.cookie-details-shell { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; max-height: inherit; }
.cookie-details-shell > header,
.cookie-details-shell > footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 15px 18px; background: #11191d; }
.cookie-details-shell > header { border-bottom: 1px solid var(--stroke); }
.cookie-details-shell > footer { justify-content: flex-end; border-top: 1px solid var(--stroke); }
.cookie-details-shell header p { margin: 0 0 3px; color: var(--muted); font: 700 .68rem/1.2 var(--font-mono); text-transform: uppercase; }
.cookie-details-shell header h2 { margin: 0; font-size: 1.05rem; }
.cookie-details-body { overflow: auto; padding: 18px; }
.cookie-details-body section { padding: 0 0 14px; }
.cookie-details-body h3 { margin: 0 0 5px; font-size: .9rem; }
.cookie-details-body p { margin: 0; color: var(--muted); font-size: .8rem; line-height: 1.5; }
.cookie-details-body a { color: var(--accent); font-size: .8rem; }
.cookie-details-body .gpc-status { margin: 2px 0 14px; padding: 10px; border-left: 3px solid var(--accent); background: rgba(55, 221, 174, .08); color: var(--text); }

@media (max-width: 1380px) {
  .header-panel { grid-template-columns: minmax(240px, 1fr) auto; }
  .header-dataset-status { display: none; }
  .app-header #accountName { display: none; }
}

@media (max-width: 1180px) {
  .app-header .observer-controls { display: none; }
  .header-action-button span,
  .app-header .mode-controls span { display: none; }
}

@media (max-width: 760px) {
  .app-header { min-height: 60px; padding: 9px 10px; }
  .header-toggle { display: grid; }
  .header-panel {
    position: absolute;
    top: calc(100% + 2px);
    left: 10px;
    right: 10px;
    display: none;
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 9px;
    padding: 10px;
    border: 1px solid var(--stroke-strong);
    border-radius: 14px;
    background: rgba(7, 12, 18, .94);
    box-shadow: 0 24px 70px rgba(0,0,0,.54);
    backdrop-filter: blur(20px);
  }
  .header-panel.open { display: grid; }
  .catalog-search { flex: 0 0 auto; width: 100%; max-width: none; min-width: 0; }
  .header-actions { display: grid; grid-template-columns: auto 1fr; align-items: stretch; width: 100%; }
  .render-filters { min-width: 0; }
  .header-action-button { justify-content: center; width: 100%; }
  .header-action-button span,
  .app-header .mode-controls span { display: inline; }
  .render-filter-panel { right: auto; left: 0; width: min(320px, calc(100vw - 40px)); }
  .catalog-search .search-results { position: relative; top: auto; margin-top: 8px; max-height: min(46dvh, 360px); }
  .app-header .mode-controls { display: flex; width: 100%; }
  .app-header .mode-controls .btn { flex: 1 1 50%; justify-content: center; }
  .app-header .observer-controls { display: flex; grid-column: 1 / -1; width: 100%; }
  .app-header .coordinate-field { flex: 1 1 50%; }
  .app-header .coordinate-field input { width: 100%; min-width: 0; }
  .app-header .account-button { grid-column: 1 / -1; justify-content: center; width: 100%; }
  .language-field { justify-content: center; min-width: 0; }
  .language-select { max-width: none; }
  .app-header #accountName { display: inline; }
  .header-dataset-status { display: block; max-width: 100%; text-align: left; }
  .render-stage .hud { top: 66px; max-width: calc(100vw - 28px); font-size: .68rem; }
  .render-stage .hud div:last-child { display: none; }
  .sky-time-controls {
    top: 112px;
    width: calc(100vw - 20px);
    justify-content: center;
  }
  .sky-time-button { flex: 0 1 auto; }
  .sky-speed-field > span { display: none; }
  .sky-time-state { min-width: 48px; }
  .selection-panel {
    top: auto;
    right: 8px;
    bottom: calc(max(5vh, 34px) + 8px);
    left: 8px;
    width: auto;
    max-height: min(56dvh, 520px);
    border-radius: 14px;
  }
  .sky-telescope-controls { top: 161px; max-width: calc(100vw - 20px); }
  .sky-telescope-controls .sky-time-button { min-width: 44px; min-height: 44px; justify-content: center; }
  .sky-telescope-controls .sky-preset-field select { min-height: 44px; }
  .sky-telescope-controls .sky-time-state { min-width: 70px; line-height: 1.2; text-align: center; }
  .sky-preset-field > span { display: none; }
  .reset-view-button {
    top: 222px;
    left: 10px;
  }
  html[dir="rtl"] .reset-view-button { right: 10px; left: auto; }
  .selection-actions { position: sticky; bottom: -16px; margin: 16px -16px -16px; padding: 10px 16px 16px; background: linear-gradient(transparent, rgba(8,13,19,.98) 28%); }
  .site-footer { justify-content: center; padding-inline: 8px; text-align: center; }
  .site-footer span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .site-footer .footer-tools { display: inline; flex: 0 0 auto; }
  .site-footer .footer-diagnostics { display: none; }
  .cookie-notice { right: 8px; bottom: calc(max(5vh, 34px) + 8px); left: 8px; display: grid; gap: 14px; padding: 15px; }
  .cookie-notice-actions { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .cookie-notice-actions .btn { width: 100%; }
  .cookie-notice-actions .btn:last-child { grid-column: 1 / -1; }
}
