:root {
  color-scheme: dark;
  --card-size: clamp(7rem, 10vw, 10rem);
  --surface: #10172acc;
  --text: #f5f7ff;
  --muted: #9fb0cd;
  --focus: #ffffff;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  background:
    radial-gradient(circle at 50% 35%, #242a4c 0, #15192e 48%, #0b0e19 100%);
}

.constellation {
  position: fixed;
  inset: 0;
  overflow: hidden;
}

.app-card {
  --accent: #6ea8fe;
  position: absolute;
  width: var(--card-size);
  height: var(--card-size);
  display: grid;
  place-content: center;
  gap: 0.55rem;
  padding: 0.75rem;
  color: var(--text);
  text-align: center;
  text-decoration: none;
  border: 2px solid var(--accent);
  border-radius: 1rem;
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
  box-shadow: 0 10px 35px color-mix(in srgb, var(--accent) 24%, transparent);
  transition: opacity 0.25s ease, scale 0.25s ease, box-shadow 0.2s ease;
  will-change: transform;
}

.app-card[data-phase="entering"],
.app-card[data-phase="leaving"] {
  opacity: 0;
  scale: 0.75;
}

.app-card[data-phase="leaving"] {
  pointer-events: none;
}

.app-card:is(:hover, :focus-visible) {
  z-index: 10;
  outline: 3px solid var(--focus);
  outline-offset: 4px;
  box-shadow: 0 14px 48px color-mix(in srgb, var(--accent) 45%, transparent);
}

.app-host {
  overflow: hidden;
  opacity: 0;
  color: var(--muted);
  font-size: 0.7rem;
  text-overflow: ellipsis;
  transition: opacity 0.15s ease;
}

.app-card:is(:hover, :focus-visible) .app-host {
  opacity: 1;
}

.masthead {
  position: fixed;
  z-index: 20;
  top: 0;
  right: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  pointer-events: none;
  background: linear-gradient(#0b0e19e6, transparent);
}

.masthead h1 {
  margin: 0;
  font-size: clamp(1.2rem, 3vw, 2rem);
}

.eyebrow {
  margin: 0 0 0.2rem;
  color: var(--muted);
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.status {
  margin: 0;
  padding: 0.5rem 0.75rem;
  color: var(--muted);
  border: 1px solid #31405d;
  border-radius: 999px;
  background: var(--surface);
  text-align: right;
}

.status[data-state="offline"] {
  color: #f6c85f;
  border-color: #f6c85f;
}

.skip-link {
  position: fixed;
  z-index: 30;
  top: -4rem;
  left: 1rem;
  padding: 0.7rem 1rem;
  color: #000;
  background: #fff;
}

.skip-link:focus {
  top: 1rem;
}

.app-icon {
  font-size: 2rem;
  font-weight: 800;
}

.app-name {
  font-size: 0.85rem;
  font-weight: 750;
}

.empty-state,
.error-state {
  position: fixed;
  inset: 0;
  display: grid;
  place-content: center;
  color: var(--muted);
}

@media (max-width: 720px), (prefers-reduced-motion: reduce) {
  body {
    overflow: auto;
  }

  .masthead {
    background: #0b0e19f2;
  }

  .constellation {
    position: relative;
    min-height: 100vh;
    padding: 7rem 1rem 2rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(7rem, 1fr));
    gap: 1rem;
  }

  .app-card {
    position: relative;
    inset: auto !important;
    width: 100%;
    transform: none !important;
  }
}
