:root {
  --bg: #050816;
  --bg-2: #0a1630;
  --panel: rgba(7, 12, 28, 0.74);
  --panel-strong: rgba(11, 18, 40, 0.92);
  --line: rgba(255, 255, 255, 0.1);
  --text: #eef2ff;
  --muted: rgba(226, 232, 240, 0.74);
  --blue: #60a5fa;
  --amber: #f59e0b;
  --teal: #2dd4bf;
  --violet: #a78bfa;
  --ok: #34d399;
  --warn: #fbbf24;
  --danger: #fb7185;
  --shadow: 0 28px 80px rgba(2, 6, 23, 0.42);
  --radius: 26px;
  --safe-bottom: calc(env(safe-area-inset-bottom, 0px) + 14px);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
  background: radial-gradient(circle at top, rgba(96, 165, 250, 0.12), transparent 28%), linear-gradient(180deg, #050816 0%, #071125 48%, #0b1431 100%);
}

body {
  color: var(--text);
  font: 500 16px/1.45 "Space Grotesk", "Segoe UI", sans-serif;
}

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

button,
input,
select,
textarea {
  font: inherit;
}

#space-canvas,
.backdrop-glow {
  position: fixed;
  inset: 0;
}

#space-canvas {
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
}

.backdrop-glow {
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 12% 18%, rgba(96, 165, 250, 0.18), transparent 24%),
    radial-gradient(circle at 84% 16%, rgba(167, 139, 250, 0.18), transparent 20%),
    radial-gradient(circle at 56% 74%, rgba(45, 212, 191, 0.12), transparent 24%);
}

.app-shell,
.layout,
.space-stage,
.sheet,
.focus-card,
.metric-grid,
.stop-list,
.utility-grid,
.booking-stack,
.link-stack,
.pulse-list,
.stop-card,
.focus-top,
.action-row,
.topbar,
.topbar-meta,
.day-strip,
.mobile-dock {
  min-width: 0;
}

.app-shell {
  position: relative;
  z-index: 1;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: calc(env(safe-area-inset-top, 0px) + 12px) 14px 12px;
  backdrop-filter: blur(18px);
  background: linear-gradient(180deg, rgba(5, 8, 22, 0.92), rgba(5, 8, 22, 0.72));
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.brand-block {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 4px;
  color: rgba(226, 232, 240, 0.6);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.brand-title,
.space-stage h1,
.focus-card h2,
.active-stop h3 {
  margin: 0;
  font-family: "Fraunces", Georgia, serif;
  line-height: 1.02;
}

.brand-title {
  font-size: 1.12rem;
}

.topbar-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.meta-pill,
.day-pill,
.legend-chip,
.stop-chip,
.metric-label,
.orbital-label,
.link-chip,
.booking-chip,
.pulse-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  white-space: nowrap;
}

.meta-pill {
  padding: 9px 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.meta-pill.accent {
  background: rgba(96, 165, 250, 0.18);
  color: #dbeafe;
  border-color: rgba(96, 165, 250, 0.3);
}

.layout {
  display: grid;
  gap: 14px;
  padding: 14px 14px calc(92px + var(--safe-bottom));
}

.panel,
.panel-sub,
.utility-card,
.focus-card {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.panel,
.sheet,
.focus-card,
.utility-card {
  border-radius: var(--radius);
}

.space-stage {
  position: relative;
  overflow: hidden;
  min-height: min(48vh, 420px);
  padding: 18px;
  background: linear-gradient(180deg, rgba(8, 12, 28, 0.28), rgba(8, 12, 28, 0.08));
  touch-action: manipulation;
}

.space-stage::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 22%, transparent 78%, rgba(255, 255, 255, 0.05));
}

.stage-copy,
.stage-hud,
.legend,
.orbital-overlay {
  position: relative;
  z-index: 1;
}

.stage-copy {
  max-width: min(100%, 28rem);
}

.space-stage h1 {
  font-size: clamp(1.8rem, 7vw, 3.3rem);
  max-width: 12ch;
}

.stage-copy p {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.96rem;
  max-width: 34ch;
}

.stage-hud {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 18px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.ghost-btn,
.action-btn,
.dock-btn,
.day-pill,
.check-btn {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  cursor: pointer;
  transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease, opacity 0.18s ease;
}

.ghost-btn:hover,
.action-btn:hover,
.dock-btn:hover,
.day-pill:hover,
.check-btn:hover {
  transform: translateY(-1px);
}

.ghost-btn,
.action-btn,
.dock-btn {
  min-height: 44px;
  padding: 0 14px;
  font-size: 0.82rem;
  font-weight: 800;
}

.ghost-btn.compact {
  min-height: 38px;
  padding-inline: 12px;
}

.action-btn.primary {
  background: linear-gradient(135deg, #f8fafc, #c7d2fe);
  color: #0f172a;
  border-color: rgba(255, 255, 255, 0.18);
}

.action-btn[aria-disabled="true"] {
  opacity: 0.42;
  pointer-events: none;
}

.orbital-overlay {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.orbital-label {
  position: absolute;
  left: 0;
  top: 0;
  padding: 10px 12px;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(7, 12, 28, 0.72);
  color: #dbeafe;
  text-align: left;
  backdrop-filter: blur(14px);
  opacity: 0.88;
}

.orbital-label span,
.orbital-label strong {
  display: block;
}

.orbital-label span {
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(226, 232, 240, 0.65);
}

.orbital-label strong {
  margin-top: 2px;
  font-size: 0.82rem;
}

.orbital-label.active {
  background: rgba(96, 165, 250, 0.22);
  border-color: rgba(191, 219, 254, 0.46);
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.38);
}

.legend {
  position: absolute;
  right: 18px;
  bottom: 76px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.legend-chip {
  padding: 7px 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(7, 12, 28, 0.62);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.sheet {
  position: relative;
  margin-top: -26px;
  padding: 16px 14px calc(18px + var(--safe-bottom));
  background: var(--panel-strong);
}

.day-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}

.day-strip::-webkit-scrollbar {
  display: none;
}

.day-pill {
  flex: 0 0 auto;
  padding: 11px 14px;
}

.day-pill span,
.day-pill strong {
  display: block;
}

.day-pill span {
  font-size: 0.64rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(226, 232, 240, 0.58);
}

.day-pill strong {
  margin-top: 2px;
  font-size: 0.9rem;
}

.day-pill.active {
  background: linear-gradient(135deg, rgba(96, 165, 250, 0.28), rgba(45, 212, 191, 0.18));
  border-color: rgba(125, 211, 252, 0.36);
}

.focus-card {
  margin-top: 14px;
  padding: 16px;
}

.focus-top,
.section-head,
.action-row,
.active-stop-meta,
.metric-grid,
.pulse-row,
.booking-item,
.link-chip {
  display: grid;
  gap: 10px;
}

.focus-top {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
}

.focus-card h2,
.active-stop h3 {
  font-size: clamp(1.5rem, 5vw, 2rem);
}

.focus-subtitle,
.route-note,
.active-stop-desc,
.stop-card p,
.metric-card p,
.utility-card p,
.booking-item p,
.pulse-row p,
.section-head p {
  margin: 0;
  color: var(--muted);
}

.focus-subtitle {
  margin-top: 8px;
}

.route-note {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.metric-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 14px;
}

.metric-card {
  padding: 13px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.metric-label {
  margin-bottom: 10px;
  color: rgba(226, 232, 240, 0.56);
  font-size: 0.64rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.metric-card strong {
  display: block;
  margin-bottom: 6px;
  font-size: 0.96rem;
  line-height: 1.2;
}

.section-block,
.active-stop,
.utility-card {
  margin-top: 14px;
}

.section-head {
  grid-template-columns: minmax(0, 1fr);
  margin-bottom: 10px;
}

.section-head h3 {
  margin: 0;
  font-size: 1rem;
}

.stop-list {
  display: grid;
  gap: 10px;
}

.stop-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
}

.stop-card.active {
  background: rgba(96, 165, 250, 0.16);
  border-color: rgba(191, 219, 254, 0.34);
}

.stop-card.done {
  opacity: 0.64;
}

.stop-card.done .stop-name,
.stop-card.done p {
  text-decoration: line-through;
  text-decoration-color: rgba(226, 232, 240, 0.38);
}

.stop-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.stop-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.stop-chip {
  padding: 6px 10px;
  font-size: 0.68rem;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.stop-name {
  margin: 0;
  font-size: 1rem;
  line-height: 1.2;
}

.stop-mode {
  color: rgba(191, 219, 254, 0.88);
  font-size: 0.84rem;
  font-weight: 700;
}

.check-btn {
  min-width: 42px;
  min-height: 42px;
  padding: 0;
  font-size: 0.98rem;
  font-weight: 900;
}

.check-btn.done {
  background: rgba(52, 211, 153, 0.2);
  border-color: rgba(52, 211, 153, 0.4);
  color: #a7f3d0;
}

.panel-sub,
.utility-card {
  padding: 16px;
  border-radius: 24px;
}

.active-stop-meta {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 14px 0;
}

.active-stop-meta .stop-chip {
  justify-content: center;
}

.action-row {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 14px;
}

.utility-grid {
  display: grid;
  gap: 14px;
}

.booking-stack,
.pulse-list,
.link-stack {
  display: grid;
  gap: 10px;
}

.booking-item,
.pulse-row,
.link-chip {
  padding: 12px 13px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
}

.booking-item strong,
.pulse-row strong,
.link-chip strong {
  display: block;
  margin-bottom: 5px;
  font-size: 0.9rem;
}

.link-chip {
  grid-template-columns: minmax(0, 1fr);
}

.link-chip span {
  color: var(--muted);
  font-size: 0.82rem;
}

.empty-state {
  padding: 14px;
  border-radius: 18px;
  border: 1px dashed rgba(255, 255, 255, 0.18);
  color: var(--muted);
}

.mobile-dock {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: var(--safe-bottom);
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 8px;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(8, 12, 24, 0.92);
  backdrop-filter: blur(18px);
  box-shadow: 0 24px 44px rgba(2, 6, 23, 0.34);
}

.dock-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding-inline: 8px;
  text-align: center;
}

@media (max-width: 720px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-meta {
    width: 100%;
    justify-content: flex-start;
  }

  .focus-top,
  .action-row,
  .metric-grid,
  .active-stop-meta {
    grid-template-columns: minmax(0, 1fr);
  }

  .legend {
    right: 14px;
    left: 14px;
    bottom: 76px;
    justify-content: flex-start;
  }

  .orbital-label {
    padding: 8px 10px;
  }
}

@media (max-width: 560px) {
  .layout {
    padding-inline: 10px;
  }

  .space-stage {
    min-height: 44vh;
    padding: 16px;
  }

  .sheet {
    margin-top: -20px;
    padding-inline: 12px;
  }

  .stage-hud {
    grid-template-columns: minmax(0, 1fr);
  }

  .orbital-label span {
    font-size: 0.58rem;
  }

  .orbital-label strong {
    font-size: 0.74rem;
  }

  .legend {
    bottom: 164px;
  }
}

@media (min-width: 980px) {
  .topbar {
    padding-inline: 20px;
  }

  .layout {
    grid-template-columns: minmax(0, 1.2fr) minmax(380px, 460px);
    gap: 18px;
    align-items: start;
    padding: 18px 20px 24px;
  }

  .space-stage {
    position: sticky;
    top: 86px;
    min-height: calc(100svh - 110px);
    padding: 24px;
  }

  .space-stage h1 {
    max-width: 10ch;
  }

  .sheet {
    margin-top: 0;
    padding: 18px;
  }

  .mobile-dock {
    display: none;
  }
}