.cosmos-explorer {
  --cx-bg: #02040a;
  --cx-panel: rgba(4, 8, 15, 0.76);
  --cx-line: rgba(255, 255, 255, 0.11);
  --cx-muted: rgba(255, 255, 255, 0.58);
  --cx-text: #ffffff;
  --cx-blue: #60a5fa;
  position: relative;
  overflow: hidden;
  width: 100%;
  min-height: 760px;
  border: 1px solid var(--cx-line);
  border-radius: 24px;
  background: radial-gradient(circle at 50% 38%, #17263f 0, #080d18 38%, #02040a 80%);
  color: var(--cx-text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  isolation: isolate;
}

.cosmos-explorer *, .cosmos-explorer *::before, .cosmos-explorer *::after { box-sizing: border-box; }
.cosmos-explorer button, .cosmos-explorer select, .cosmos-explorer input { font: inherit; }
.cosmos-explorer button, .cosmos-explorer select { color: inherit; }
.cosmos-explorer button:focus-visible, .cosmos-explorer select:focus-visible, .cosmos-explorer input:focus-visible { outline: 2px solid #8ac2ff; outline-offset: 2px; }

.cx-stars {
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: 0.56;
  background-image: radial-gradient(circle, #fff 0 1px, transparent 1.3px);
  background-size: 53px 47px;
  mask-image: linear-gradient(#000 0%, #000 72%, transparent 100%);
}

.cx-header {
  position: relative;
  z-index: 8;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 22px 22px 0;
}
.cx-header h2 { margin: 6px 0 8px; font-size: clamp(28px, 4vw, 46px); line-height: 0.98; letter-spacing: -0.045em; }
.cx-header p { max-width: 560px; margin: 0; color: var(--cx-muted); font-size: 14px; line-height: 1.5; }
.cx-kicker, .cx-label { color: rgba(255,255,255,.44); font-size: 10px; font-weight: 800; letter-spacing: .18em; text-transform: uppercase; }
.cx-live { display: inline-flex; align-items: center; gap: 8px; padding: 9px 12px; border: 1px solid rgba(74,222,128,.24); border-radius: 999px; background: rgba(3,18,11,.56); color: #c8fbd7; font-size: 11px; font-weight: 700; white-space: nowrap; }
.cx-live span { width: 7px; height: 7px; border-radius: 50%; background: #4ade80; box-shadow: 0 0 12px #4ade80; }

.cx-tabs { position: relative; z-index: 9; display: flex; gap: 8px; padding: 18px 22px 0; overflow-x: auto; scrollbar-width: none; }
.cx-tabs::-webkit-scrollbar { display: none; }
.cx-tab, .cx-control-buttons button, .cx-control-buttons select {
  min-height: 44px;
  border: 1px solid var(--cx-line);
  border-radius: 13px;
  background: rgba(4,9,17,.72);
  backdrop-filter: blur(16px);
  padding: 0 14px;
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
  white-space: nowrap;
}
.cx-tab.is-active { border-color: rgba(255,255,255,.25); background: rgba(255,255,255,.115); }

.cx-loading { min-height: 500px; display: flex; align-items: center; justify-content: center; gap: 12px; color: var(--cx-muted); font-size: 13px; }
.cx-loader { width: 20px; height: 20px; border: 2px solid rgba(255,255,255,.16); border-top-color: #fff; border-radius: 50%; animation: cx-spin .8s linear infinite; }
@keyframes cx-spin { to { transform: rotate(360deg); } }
.cx-error { margin: 28px 22px; padding: 18px; border: 1px solid rgba(248,113,113,.28); border-radius: 16px; background: rgba(127,29,29,.14); color: #fecaca; font-size: 13px; line-height: 1.5; }

.cx-viewport { position: relative; z-index: 2; height: 510px; margin-top: 2px; }
.cx-panel { display: none; position: relative; width: 100%; height: 100%; }
.cx-panel.is-active { display: block; }
.cx-main-svg { display: block; width: 100%; height: 100%; }
.cx-orbit { fill: none; stroke: rgba(255,255,255,.125); stroke-width: 1; }
.cx-orbit-dashed { stroke-dasharray: 5 6; }
.cx-svg-label, .cx-map-label { fill: rgba(255,255,255,.62); font-size: 11px; font-family: inherit; }
.cx-galaxy-center { fill: #402a12; font-size: 11px; font-weight: 900; }

.cx-card { border: 1px solid var(--cx-line); border-radius: 17px; background: var(--cx-panel); backdrop-filter: blur(18px); }
.cx-clock-card { position: absolute; z-index: 6; top: 14px; right: 20px; width: 230px; padding: 13px 14px; }
.cx-clock { margin-top: 5px; font-size: 30px; font-weight: 820; line-height: 1; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.cx-date { margin-top: 7px; color: rgba(255,255,255,.72); font-size: 12px; line-height: 1.4; }
.cx-muted { margin-top: 4px; color: var(--cx-muted); font-size: 11px; line-height: 1.45; }

.cx-planet-detail { position: absolute; z-index: 5; bottom: 18px; left: 20px; width: 285px; padding: 12px 14px; }
.cx-detail-name { margin-top: 4px; font-size: 20px; font-weight: 800; letter-spacing: -.03em; }
.cx-detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; margin-top: 10px; }
.cx-detail-grid div { min-width: 0; padding: 9px; border-radius: 11px; background: rgba(255,255,255,.045); }
.cx-detail-grid span { display: block; color: rgba(255,255,255,.45); font-size: 10px; }
.cx-detail-grid strong { display: block; margin-top: 3px; font-size: 12px; line-height: 1.3; }

.cx-moon-card { position: absolute; z-index: 6; top: 148px; right: 20px; width: 230px; padding: 13px 14px; }
.cx-moon-phase { margin-top: 5px; font-size: 24px; font-weight: 820; line-height: 1.05; letter-spacing: -.035em; }
.cx-next-full { margin-top: 11px; padding-top: 10px; border-top: 1px solid rgba(255,255,255,.09); }
.cx-next-full span { display: block; color: rgba(255,255,255,.45); font-size: 10px; }
.cx-next-full strong { display: block; margin-top: 4px; font-size: 12px; line-height: 1.45; }

.cx-eclipse-layout { display: grid; grid-template-columns: minmax(0,1.1fr) minmax(300px,.9fr); gap: 18px; height: 100%; padding: 26px 22px 18px; align-items: start; }
.cx-eclipse-layout h3 { margin: 6px 0 8px; font-size: 30px; letter-spacing: -.035em; }
.cx-copy { max-width: 620px; margin: 0; color: var(--cx-muted); font-size: 13px; line-height: 1.55; }
.cx-eclipse-list { display: grid; gap: 9px; margin-top: 16px; }
.cx-eclipse-item { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 12px 13px; border: 1px solid var(--cx-line); border-radius: 15px; background: rgba(255,255,255,.035); }
.cx-eclipse-index { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 50%; background: rgba(250,204,21,.10); color: #fde68a; font-size: 11px; font-weight: 800; }
.cx-eclipse-title { font-size: 14px; font-weight: 780; }
.cx-eclipse-meta { margin-top: 3px; color: var(--cx-muted); font-size: 11px; line-height: 1.4; }
.cx-eclipse-time { font-size: 13px; font-weight: 760; text-align: right; font-variant-numeric: tabular-nums; }
.cx-eclipse-side { display: grid; gap: 10px; }
.cx-local-eclipse, .cx-eclipse-map-card { padding: 14px; }
.cx-local-type { margin-top: 6px; font-size: 23px; font-weight: 820; letter-spacing: -.03em; }
.cx-local-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
.cx-eclipse-map-card svg { width: 100%; height: auto; margin-top: 8px; }
.cx-map-label { font-size: 8px; }
.cx-map-coords { margin-top: 4px; font-size: 14px; font-weight: 750; }

.cx-galaxy-clock { position: absolute; z-index: 6; top: 14px; right: 20px; width: 245px; padding: 14px; }
.cx-divider { height: 1px; margin: 12px 0; background: rgba(255,255,255,.1); }
.cx-galactic-years { margin-top: 5px; font-size: 22px; font-weight: 820; letter-spacing: -.03em; }
.cx-galaxy-info { position: absolute; z-index: 6; left: 20px; bottom: 18px; width: min(350px, calc(100% - 40px)); padding: 13px 14px; }
.cx-galaxy-info strong { display: block; margin-top: 5px; font-size: 15px; }
.cx-galaxy-info p { margin: 5px 0 0; color: var(--cx-muted); font-size: 11px; line-height: 1.5; }

.cx-controls, .cx-galaxy-controls { position: relative; z-index: 9; display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 10px; align-items: end; padding: 0 20px 18px; }
.cx-timeline, .cx-galaxy-controls > .cx-card { max-width: 680px; padding: 12px 14px; }
.cx-control-title { font-size: 13px; font-weight: 760; }
.cx-timeline input, .cx-galaxy-controls input { width: 100%; margin-top: 8px; accent-color: #fff; }
.cx-control-buttons { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.cx-control-buttons select { appearance: auto; }

.cx-planet-node { cursor: pointer; }
.cx-planet-hit { fill: transparent; }
.cx-planet-label { fill: rgba(255,255,255,.65); font-size: 10px; pointer-events: none; }
.cx-earth-pulse { animation: cx-pulse 2.2s ease-in-out infinite; transform-origin: center; }
@keyframes cx-pulse { 0%,100% { opacity:.35; } 50% { opacity:.8; } }

@media (hover:hover) and (pointer:fine) {
  .cx-tab:hover, .cx-control-buttons button:hover, .cx-control-buttons select:hover { background: rgba(255,255,255,.09); }
  .cx-planet-node:hover > circle:first-child { stroke-width: 2.5; }
}

@media (prefers-reduced-motion: reduce) {
  .cx-loader, .cx-earth-pulse { animation: none; }
}

@media (max-width: 760px) {
  .cosmos-explorer { min-height: 860px; border-radius: 18px; }
  .cx-header { padding: 16px 14px 0; }
  .cx-header p { max-width: 300px; font-size: 12px; }
  .cx-live { display: none; }
  .cx-tabs { padding: 14px 14px 0; }
  .cx-viewport { height: 590px; }
  .cx-clock-card, .cx-galaxy-clock { top: 10px; right: 10px; width: 180px; padding: 10px; }
  .cx-clock { font-size: 24px; }
  .cx-moon-card { top: 128px; right: 10px; width: 180px; padding: 10px; }
  .cx-moon-phase { font-size: 20px; }
  .cx-planet-detail { left: 10px; bottom: 10px; width: 220px; padding: 10px; }
  .cx-eclipse-layout { grid-template-columns: 1fr; padding: 16px 12px; overflow-y: auto; }
  .cx-eclipse-side { grid-template-columns: 1fr 1fr; }
  .cx-eclipse-item { grid-template-columns: auto 1fr; }
  .cx-eclipse-time { grid-column: 2; text-align: left; }
  .cx-galaxy-info { left: 10px; bottom: 10px; width: calc(100% - 20px); }
  .cx-controls, .cx-galaxy-controls { grid-template-columns: 1fr; padding: 0 10px 10px; }
  .cx-control-buttons { justify-content: stretch; }
  .cx-control-buttons button, .cx-control-buttons select { flex: 1 1 auto; min-width: 0; }
}

@media (max-width: 520px) {
  .cosmos-explorer { min-height: 895px; }
  .cx-header h2 { font-size: 30px; }
  .cx-viewport { height: 610px; }
  .cx-eclipse-side { grid-template-columns: 1fr; }
  .cx-eclipse-map-card { display: none; }
}


/* Sterrenstelsels.nl integration */
.cosmos-explorer { margin: 18px 0 8px; }
.cosmos-explorer [hidden] { display: none !important; }
.cosmos-page-note { margin-top: 12px; color: var(--muted, #6b7280); font-size: .92rem; }
