:root {
  /* Verified TinyWoolf brand tokens. */
  --paper: #f7f5f1;
  --ink: #1e1e1e;
  --primary: #3663e4;
  --rule: rgba(30, 30, 30, 0.18);
  --branch-shadow: drop-shadow(1px 0 0 var(--paper))
    drop-shadow(-1px 0 0 var(--paper))
    drop-shadow(0 1px 0 var(--paper))
    drop-shadow(0 -1px 0 var(--paper));
  --font-heading: "effra-cc", Arial, sans-serif;
  --font-body: "neue-haas-grotesk-text", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --glass-rim: rgba(255, 255, 255, 0.82);
  --glass-shine: linear-gradient(145deg,
    rgba(255, 255, 255, 0.86),
    rgba(255, 255, 255, 0.22) 38%,
    rgba(255, 255, 255, 0.02) 70%,
    rgba(255, 255, 255, 0.34));
  --glass-shadow: 0 6px 24px rgba(30, 30, 30, 0.07),
    inset 0 1px 0 rgba(255, 255, 255, 0.94),
    inset 0 -1px 0 rgba(30, 30, 30, 0.04);
  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 1.5rem;
  --space-4: 2rem;
  --space-5: 3rem;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1rem/1.5 var(--font-body);
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--primary); color: var(--paper); }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.backdrop {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.landscape {
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 100%;
  min-width: 64rem;
  height: auto;
  transform: translateX(-50%);
  /* Feather the top edge into the paper, for scenes drawn right up to it. */
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 14%);
  mask-image: linear-gradient(to bottom, transparent, #000 14%);
  /* Leaving scene: lingers beneath, then fades once the new one is mostly in. */
  opacity: 0;
  transition: opacity 1.6s ease 1.6s;
}

/* Arriving scene: fades in slowly on top. */
.landscape.is-active {
  z-index: 1;
  opacity: 1;
  transition: opacity 3s ease;
}

/* Blue mist: soft banks of layered radial haze (no hard edges, no blur
   filter) drift slowly left to right and gently thicken and thin. */
.mist { position: absolute; z-index: 2; inset: 0; overflow: hidden; }

.mist-bank {
  position: absolute;
  top: var(--y);
  left: 0;
  width: var(--w);
  height: var(--h);
  opacity: var(--o);
  background:
    radial-gradient(ellipse 38% 46% at 28% 58%, rgba(54, 99, 228, 0.55), rgba(54, 99, 228, 0) 100%),
    radial-gradient(ellipse 34% 40% at 62% 44%, rgba(54, 99, 228, 0.45), rgba(54, 99, 228, 0) 100%),
    radial-gradient(ellipse 50% 50% at 48% 52%, rgba(126, 154, 238, 0.5), rgba(126, 154, 238, 0) 100%),
    radial-gradient(ellipse 22% 30% at 82% 60%, rgba(54, 99, 228, 0.35), rgba(54, 99, 228, 0) 100%);
  animation:
    mist-drift var(--t) linear var(--d) infinite,
    mist-breathe 17s ease-in-out var(--d) infinite alternate;
  will-change: transform, opacity;
  /* Fade every bank to nothing before its box edge, so no straight seams show. */
  -webkit-mask-image: radial-gradient(closest-side, #000 35%, transparent 100%);
  mask-image: radial-gradient(closest-side, #000 35%, transparent 100%);
}

/* A second shape so the banks don't all look alike. */
.mist-bank--alt {
  background:
    radial-gradient(ellipse 30% 44% at 22% 46%, rgba(54, 99, 228, 0.45), rgba(54, 99, 228, 0) 100%),
    radial-gradient(ellipse 44% 38% at 58% 58%, rgba(126, 154, 238, 0.55), rgba(126, 154, 238, 0) 100%),
    radial-gradient(ellipse 26% 34% at 84% 42%, rgba(54, 99, 228, 0.4), rgba(54, 99, 228, 0) 100%);
  animation-duration: var(--t), 23s;
}

@keyframes mist-drift {
  from { transform: translateX(-100%); }
  to { transform: translateX(100vw); }
}

@keyframes mist-breathe {
  from { opacity: var(--o); }
  to { opacity: calc(var(--o) * 0.55); }
}

.workspace {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100svh;
  padding: var(--space-4) var(--space-3) var(--space-3);
}

.workspace-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
}
.logo { display: block; width: 4.25rem; height: auto; }

.music-player {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  width: min(100%, 26rem);
  padding: 0.375rem;
  border-radius: 2rem;
}

.music-control {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  transition: background-color 160ms ease;
}

.music-toggle { background: var(--primary); color: var(--paper); }
.music-control:disabled { cursor: default; }
/* Extra room on the right keeps the time clear of the pill's rounded end. */
.music-info { flex: 1; min-width: 0; padding-inline: 0.25rem 0.875rem; }

/* Track title row: the dropdown, then the volume speaker right after its arrow. */
.music-title-row {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  min-width: 0;
}

.music-info select {
  display: block;
  flex: 0 1 auto;
  width: auto;
  max-width: 100%;
  min-width: 0;
  padding: 0.125rem 0.375rem;
  margin-left: -0.375rem;
  border: 0;
  border-radius: 0.5rem;
  background: transparent;
  color: var(--ink);
  font: 400 0.75rem/1.5 var(--font-body);
  text-overflow: ellipsis;
  cursor: pointer;
  outline: none;
  transition: background-color 160ms ease;
}
/* No solid outline: hover and keyboard focus get a soft glass tint instead. */
.music-info select:hover,
.music-info select:focus-visible { background-color: rgba(54, 99, 228, 0.08); }

/* Browsers with customizable <select> (Chrome/Edge 135+) get a liquid-glass list;
   others keep their native menu. */
@supports (appearance: base-select) {
  .music-info select,
  .music-info select::picker(select) { appearance: base-select; }

  .music-info select {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    overflow: hidden;
    white-space: nowrap;
  }
  .music-info select:open { background-color: rgba(54, 99, 228, 0.08); }
  .music-info select::picker-icon {
    content: "";
    flex-shrink: 0;
    width: 0.4rem;
    height: 0.4rem;
    margin: -0.15rem 0.125rem 0;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(45deg);
    transition: transform 200ms ease, margin 200ms ease;
  }
  .music-info select:open::picker-icon { margin-top: 0.2rem; transform: rotate(-135deg); }

  .music-info select::picker(select) {
    width: 17rem;
    max-height: min(26rem, 60vh);
    margin-top: 0.5rem;
    padding: 0.375rem;
    border: 1px solid var(--glass-rim);
    border-radius: 1.125rem;
    background-color: rgba(247, 245, 241, 0.8);
    background-image: var(--glass-shine);
    background-origin: border-box;
    background-size: 200% 200%;
    box-shadow: 0 18px 44px rgba(30, 30, 30, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.94);
    -webkit-backdrop-filter: blur(22px) saturate(1.4);
    backdrop-filter: blur(22px) saturate(1.4);
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(54, 99, 228, 0.3) transparent;
    opacity: 0;
    translate: 0 -0.25rem;
    transition: opacity 180ms ease, translate 180ms ease, overlay 180ms allow-discrete, display 180ms allow-discrete;
  }
  .music-info select:open::picker(select) { opacity: 1; translate: 0 0; }
  @starting-style {
    .music-info select:open::picker(select) { opacity: 0; translate: 0 -0.25rem; }
  }

  /* Group headings: small blue caps; the tracks inside keep normal text. */
  .music-info optgroup {
    padding-top: 0.25rem;
    color: var(--primary);
    font: 600 0.625rem/1.6 var(--font-body);
    letter-spacing: 0.06em;
    text-transform: uppercase;
  }
  .music-info optgroup + optgroup {
    margin-top: 0.25rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--rule);
  }
  .music-info option {
    padding: 0.375rem 0.625rem;
    border-radius: 0.625rem;
    color: var(--ink);
    font: 400 0.8125rem/1.35 var(--font-body);
    letter-spacing: 0;
    text-transform: none;
    white-space: normal;
    overflow-wrap: anywhere;
    cursor: pointer;
    outline: none;
    transition: background-color 120ms ease;
  }
  .music-info option:hover,
  .music-info option:focus-visible { background-color: rgba(54, 99, 228, 0.08); }
  .music-info option:checked { background-color: rgba(54, 99, 228, 0.14); color: var(--primary); }
  .music-info option::checkmark { display: none; }

  @media (prefers-reduced-transparency: reduce), (prefers-contrast: more) {
    .music-info select::picker(select) {
      background: var(--paper);
      border-color: var(--rule);
      -webkit-backdrop-filter: none;
      backdrop-filter: none;
    }
  }
}

/* Spinning ring while a track loads or buffers. */
.music-toggle { position: relative; }
.music-toggle.is-loading::after {
  content: "";
  position: absolute;
  inset: -3px;
  border: 2px solid transparent;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: music-spin 800ms linear infinite;
}
@keyframes music-spin { to { rotate: 360deg; } }

/* Slim ink range (seek bar and volume); --progress is set by music-player.js. */
.music-range {
  --progress: 0%;
  display: block;
  width: 100%;
  height: 0.875rem;
  margin: 0;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}
.music-range::-webkit-slider-runnable-track {
  height: 3px;
  border-radius: 2px;
  background: linear-gradient(to right, var(--primary) var(--progress), var(--rule) var(--progress));
}
.music-range::-webkit-slider-thumb {
  width: 10px;
  height: 10px;
  margin-top: -3.5px;
  border: 2px solid var(--paper);
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 1px rgba(54, 99, 228, 0.3);
  -webkit-appearance: none;
  appearance: none;
}
.music-range::-moz-range-track { height: 3px; border-radius: 2px; background: var(--rule); }
.music-range::-moz-range-progress { height: 3px; border-radius: 2px; background: var(--primary); }
.music-range::-moz-range-thumb {
  width: 10px;
  height: 10px;
  border: 2px solid var(--paper);
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 1px rgba(54, 99, 228, 0.3);
}
.music-range:disabled { cursor: default; }
.music-range:disabled::-webkit-slider-thumb { visibility: hidden; }
.music-range:disabled::-moz-range-thumb { visibility: hidden; }

/* Transport: previous / play / next kept together, like every familiar player. */
.music-transport {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 0.125rem;
}

/* Volume: a small speaker after the dropdown arrow opens a compact glass panel. */
.music-volume { position: relative; flex-shrink: 0; }

.music-volume-toggle,
.music-mute {
  position: relative;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  outline: none;
  transition: background-color 160ms ease, color 160ms ease;
}
/* A larger invisible hit area for touch, without changing the layout. */
.music-volume-toggle::before {
  content: "";
  position: absolute;
  inset: -0.5rem;
}
.music-volume-toggle:hover,
.music-volume-toggle:focus-visible,
.music-volume-toggle[aria-expanded="true"],
.music-mute:hover,
.music-mute:focus-visible { background-color: rgba(54, 99, 228, 0.1); color: var(--primary); }

.music-volume-panel {
  position: absolute;
  z-index: 10;
  top: calc(100% + 0.625rem);
  right: -0.75rem;
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.75rem 0.375rem 0.375rem;
  border: 1px solid var(--glass-rim);
  border-radius: 2rem;
  background-color: rgba(247, 245, 241, 0.8);
  background-image: var(--glass-shine);
  background-origin: border-box;
  background-size: 200% 200%;
  box-shadow: 0 14px 36px rgba(30, 30, 30, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.94);
  -webkit-backdrop-filter: blur(22px) saturate(1.4);
  backdrop-filter: blur(22px) saturate(1.4);
  animation: music-panel-in 160ms ease;
}
@keyframes music-panel-in {
  from { opacity: 0; translate: 0 -0.25rem; }
}
.music-volume-slider { width: 6.5rem; }
.music-volume-slider:hover::-webkit-slider-thumb { transform: scale(1.2); }
.music-volume-slider:hover::-moz-range-thumb { transform: scale(1.2); }
.music-volume-level {
  min-width: 2.25rem;
  font-size: 0.6875rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

/* On mouse-driven screens the secondary buttons can be tighter than touch targets. */
@media (hover: hover) and (pointer: fine) {
  .music-transport .music-control:not(.music-toggle) { width: 2.25rem; height: 2.25rem; }
}

/* While the browser holds sound back, the speaker gently pulses to invite a click. */
.music-volume-toggle.is-inviting { color: var(--primary); }
.music-volume-toggle.is-inviting::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 1.5px solid var(--primary);
  border-radius: 50%;
  animation: music-invite 1.8s ease-out infinite;
  pointer-events: none;
}
@keyframes music-invite {
  from { opacity: 0.7; transform: scale(0.8); }
  to { opacity: 0; transform: scale(1.45); }
}

/* Speaker icon: muted shows the cross, low one wave, high both waves. */
[data-level] .volume-off,
[data-level="muted"] .volume-wave-1,
[data-level="muted"] .volume-wave-2,
[data-level="low"] .volume-wave-2 { display: none; }
[data-level="muted"] .volume-off { display: inline; }

.has-notice .music-time { display: none; }

.music-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-1);
}

.music-status {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  min-width: 0;
  font-size: 0.625rem;
  line-height: 1.4;
}

.music-status-text {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

@media (max-width: 26rem) {
  .music-place { display: none; }
}

.music-time {
  flex-shrink: 0;
  font-size: 0.625rem;
  line-height: 1.4;
  font-variant-numeric: tabular-nums;
}

/* Three tiny ink bars that only move while music is playing. */
.music-bars { display: inline-flex; align-items: flex-end; gap: 2px; height: 0.5rem; }
.music-bars i {
  width: 2px;
  height: 30%;
  border-radius: 1px;
  background: var(--primary);
  transform-origin: bottom;
}
.is-playing .music-bars i { animation: music-bar 900ms ease-in-out infinite alternate; }
.is-playing .music-bars i:nth-child(2) { animation-delay: -300ms; animation-duration: 700ms; }
.is-playing .music-bars i:nth-child(3) { animation-delay: -600ms; animation-duration: 1100ms; }

@keyframes music-bar {
  from { height: 25%; }
  to { height: 100%; }
}
.music-fallback { width: min(100%, 23rem); }

@media (hover: hover) {
  .music-control:not(.music-toggle):hover { background: rgba(54, 99, 228, 0.08); }
  .music-toggle:hover { background: var(--ink); }
}

.workspace-main {
  flex: 1;
  display: grid;
  place-items: center;
  padding-block: var(--space-5) 6rem;
}

.neuron {
  --neuron-close-ms: 620;
  position: relative;
  width: min(100%, 56rem);
  height: 28rem;
}

.neuron-branches {
  position: absolute;
  z-index: 1;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.branch {
  fill: none;
  stroke: var(--primary);
  stroke-width: 2;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

.branch--halo {
  stroke: var(--paper);
  stroke-width: 5;
}

.branch--management, .app-node--management { --order: 0; }
.branch--os, .app-node--os { --order: 1; }
.branch--studio, .app-node--studio { --order: 2; }
.branch--more, .app-node--more { --order: 3; }

.neuron::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 50%;
  background: var(--primary);
  transform: translate(-50%, -50%);
}

.gateway-toggle {
  position: absolute;
  z-index: 3;
  top: 50%;
  left: 50%;
  display: none;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1);
  border: 0;
  border-radius: 2.5rem;
  background: transparent;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  /* Align the core, rather than the label, to the branch origin. */
  --core-size: 4.5rem;
  transform: translate(-50%, calc(-1 * (var(--space-1) + var(--core-size) / 2)));
}

/* A soft paper clearing behind the hub, beneath the branches, so the yarn
   ball and its orbit read clearly over the dense illustration. */
.is-enhanced::after {
  content: "";
  position: absolute;
  z-index: 0;
  top: var(--hub-y, 50%);
  left: 50%;
  width: 13rem;
  height: 13rem;
  border-radius: 50%;
  background: radial-gradient(closest-side,
    rgba(247, 245, 241, 0.94) 50%,
    rgba(247, 245, 241, 0.7) 72%,
    rgba(247, 245, 241, 0));
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.hub-core {
  position: relative;
  display: grid;
  place-items: center;
  width: var(--core-size);
  height: var(--core-size);
  border: 1px solid var(--primary);
  border-radius: 50%;
  background: var(--paper);
  transition: border-color 220ms ease, box-shadow 220ms ease, transform 220ms ease;
}

/* A slow dashed orbit carrying one bead per app. */
.hub-orbit {
  position: absolute;
  inset: -1.125rem;
  width: calc(100% + 2.25rem);
  height: calc(100% + 2.25rem);
  overflow: visible;
  pointer-events: none;
  filter: drop-shadow(0 0 1.5px var(--paper)) drop-shadow(0 0 1px var(--paper));
  animation: hub-orbit 48s linear infinite;
}

.hub-orbit-ring {
  fill: none;
  stroke: var(--primary);
  stroke-width: 1.1;
  stroke-dasharray: 2 4.2;
  stroke-linecap: round;
  opacity: 0.85;
  transition: opacity 400ms ease;
}

.hub-bead {
  fill: var(--primary);
  stroke: var(--paper);
  stroke-width: 1.2;
  transform-box: fill-box;
  transform-origin: center;
  transition: opacity 260ms ease, scale 360ms ease;
  transition-delay: calc((3 - var(--order)) * 40ms);
}

.hub-yarn {
  position: relative;
  width: 3.25rem;
  height: 3.25rem;
  overflow: visible;
  fill: none;
  stroke: var(--primary);
  stroke-width: 1.3;
  stroke-linecap: round;
  stroke-linejoin: round;
  animation: hub-bob 4.8s ease-in-out infinite;
}

.hub-yarn-fill { fill: var(--paper); stroke: none; }

.hub-yarn-ball {
  transform-box: fill-box;
  transform-origin: center;
  transition: rotate 900ms cubic-bezier(0.3, 0.7, 0.2, 1), scale 900ms ease;
}

.hub-yarn-tail {
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 500ms ease;
}

@keyframes hub-orbit { to { rotate: 360deg; } }

@keyframes hub-bob {
  0%, 100% { translate: 0 1px; rotate: -3deg; }
  50% { translate: 0 -2px; rotate: 3deg; }
}

.hub-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.25rem 0.875rem 0.3125rem;
  border-radius: 1.25rem;
  background: var(--paper);
  font-size: 0.75rem;
  line-height: 1.35;
  white-space: nowrap;
}

.hub-hint {
  font-size: 0.625rem;
  font-style: italic;
  color: var(--primary);
}

.hub-hint--open,
.is-open .hub-hint--closed { display: none; }
.is-open .hub-hint--open { display: inline; }

.app-directory { position: absolute; z-index: 2; inset: 0; }

.app-node {
  position: absolute;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-1);
  width: 28%;
  min-width: 0;
  padding: 1rem 1.125rem;
  border-radius: 1.25rem;
  background: var(--paper);
  color: var(--ink);
  text-decoration: none;
  transform: translateY(-50%);
}

.app-node--management, .app-node--studio { left: 0; }
.app-node--os, .app-node--more { right: 0; }
.app-node--management, .app-node--os { top: 25.65%; }
.app-node--studio, .app-node--more { top: 74.78%; }

.node-copy { min-width: 0; }
h1, h2, p { margin: 0; }

.node-copy h2 {
  font: 400 1.25rem/1.25 var(--font-heading);
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}

.node-copy p {
  margin-top: 0.25rem;
  font-size: 0.75rem;
  overflow-wrap: anywhere;
}

.node-copy .node-status {
  margin-top: var(--space-1);
  font-size: 0.6875rem;
}

.node-arrow { flex-shrink: 0; font: 1rem/1 Arial, sans-serif; }
.app-node--unavailable h2, .app-node--placeholder h2 { font-size: 1.0625rem; }
.app-node--placeholder { border-top: 1px dashed var(--rule); }
.app-node--active {
  transition: border-color 220ms ease, box-shadow 220ms ease, background-position 400ms ease;
}

@media (hover: hover) {
  .gateway-toggle:hover .hub-core {
    border-color: rgba(54, 99, 228, 0.35);
    transform: scale(1.05);
  }

  .app-node--active:hover {
    border-color: rgba(54, 99, 228, 0.28);
    background-position: 0% 0%;
    box-shadow: 0 10px 28px rgba(30, 30, 30, 0.1),
      inset 0 1px 0 rgba(255, 255, 255, 0.98),
      inset 0 -1px 0 rgba(54, 99, 228, 0.08);
  }

  .workspace-footer a:hover { text-decoration-thickness: 2px; }
}

.gateway-toggle:active .hub-core { transform: scale(0.96); }

.is-enhanced::before { display: none; }
.is-enhanced .gateway-toggle { display: flex; }
.is-enhanced .branch {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  transition: stroke-dashoffset calc((var(--neuron-close-ms) - 120) * 1ms) ease-in;
  transition-delay: calc((3 - var(--order)) * 40ms);
}

.is-enhanced .app-node {
  --node-y: -50%;
  opacity: 0;
  transform: translateY(calc(var(--node-y) + 0.5rem));
  transition: opacity 220ms ease, transform 350ms ease,
    border-color 220ms ease, box-shadow 220ms ease, background-position 400ms ease;
  transition-delay: calc((3 - var(--order)) * 40ms), calc((3 - var(--order)) * 40ms), 0ms, 0ms, 0ms;
}

.is-open .branch {
  stroke-dashoffset: 0;
  transition-duration: 600ms;
  transition-timing-function: ease-out;
  transition-delay: calc(var(--order) * 70ms);
}

.is-open .app-node {
  opacity: 1;
  transform: translateY(var(--node-y));
  transition-delay: calc(160ms + var(--order) * 70ms), calc(160ms + var(--order) * 70ms), 0ms, 0ms, 0ms;
}

.is-open .app-node:focus-visible { transition: none; }
.is-closing .app-directory { pointer-events: none; }

.is-open .hub-core {
  border-color: rgba(54, 99, 228, 0.4);
  box-shadow: 0 6px 26px rgba(54, 99, 228, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.98),
    inset 0 -2px 4px rgba(54, 99, 228, 0.1);
}

/* Opening unravels the ball: it spins and shrinks a little as its threads
   run out to the apps, the tail tucks in, and the orbit beads fly away. */
.is-open .hub-yarn-ball { rotate: 220deg; scale: 0.9; }
.is-open .hub-yarn-tail { stroke-dashoffset: 1; }
.is-open .hub-orbit-ring { opacity: 0.25; }
.is-open .hub-bead {
  opacity: 0;
  scale: 0.2;
  transition-delay: calc(var(--order) * 70ms);
}

.workspace-footer {
  align-self: center;
  padding: 0.5rem 0.875rem;
  border-radius: 2rem;
  background: var(--paper);
  font-size: 0.6875rem;
}

.workspace-footer a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

/* Footer: one font and size throughout. The product name is in ink, everything
   else in a softer ink; links get a hairline underline. Dots sit centred
   between items with equal space on both sides. */
.workspace-footer {
  --footer-muted: rgba(30, 30, 30, 0.66);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  row-gap: 0.25rem;
  max-width: calc(100% - 2rem);
  color: var(--footer-muted);
  font: 400 0.6875rem/1.2 var(--font-body);
  text-align: center;
}
.footer-item { display: inline-flex; align-items: center; white-space: nowrap; }
.footer-item + .footer-item::before {
  content: "";
  width: 2px;
  height: 2px;
  margin-inline: 0.625rem;
  border-radius: 50%;
  background: currentColor;
}
.footer-product { color: var(--ink); }
.footer-version {
  margin-left: 0.375rem;
  padding: 0.0625rem 0.3125rem;
  border: 1px solid var(--rule);
  border-radius: 1rem;
  color: var(--footer-muted);
  font-size: 0.5625rem;
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
}
.workspace-footer a {
  margin-left: 0.3em;
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: rgba(30, 30, 30, 0.28);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: text-decoration-color 160ms ease;
}
.workspace-footer a:hover { text-decoration-color: currentColor; text-decoration-thickness: 1px; }
.workspace-footer .footer-credit { display: inline-flex; align-items: center; }
.footer-github { flex-shrink: 0; width: 0.6875rem; height: 0.6875rem; margin-right: 0.25em; }
/* Narrow screens: the items stack, without dots. */
@media (max-width: 26rem) {
  .workspace-footer { flex-direction: column; border-radius: 1.25rem; }
  .footer-item + .footer-item::before { display: none; }
}


/* Solid paper is the readable fallback when backdrop blur is unavailable. */
.hub-core,
.hub-label,
.app-node,
.music-player,
.workspace-footer {
  border: 1px solid var(--glass-rim);
  background-color: var(--paper);
  background-image: var(--glass-shine);
  background-origin: border-box;
  background-size: 200% 200%;
  background-position: 100% 100%;
  box-shadow: var(--glass-shadow);
}

.hub-core {
  background-image: radial-gradient(ellipse at 28% 18%,
    rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0) 60%), var(--glass-shine);
}

.app-node--unavailable,
.app-node--placeholder {
  box-shadow: 0 3px 14px rgba(30, 30, 30, 0.04),
    inset 0 1px 0 rgba(255, 255, 255, 0.88);
}

.app-node--placeholder {
  border-style: dashed;
  border-color: var(--rule);
}

@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .hub-core,
  .hub-label,
  .app-node,
  .music-player,
  .workspace-footer {
    background-color: rgba(247, 245, 241, 0.78);
    -webkit-backdrop-filter: blur(18px) saturate(1.35);
    backdrop-filter: blur(18px) saturate(1.35);
  }
}

@media (prefers-reduced-transparency: reduce), (prefers-contrast: more) {
  .hub-core,
  .hub-label,
  .app-node,
  .music-player,
  .workspace-footer {
    background: var(--paper);
    border-color: var(--rule);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    box-shadow: none;
  }

  .is-open .hub-core,
  .app-node--active:hover { box-shadow: none; }
}

.gateway-toggle:focus-visible,
.app-node--active:focus-visible,
.music-control:focus-visible,
.workspace-footer a:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 4px;
  box-shadow: 0 0 0 7px var(--paper), var(--glass-shadow);
}

.music-range:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 0.25rem;
}

@media (max-width: 40rem) {
  .workspace-main {
    place-items: start center;
    padding-block: var(--space-4) var(--space-5);
  }
  .neuron {
    --hub-y: 16rem;
    --hub-y: clamp(9rem, calc(50svh - 7rem), 22rem);
    height: auto;
    min-height: calc(var(--hub-y) + 7rem);
  }
  .neuron-branches { display: none; }
  .neuron:not(.is-enhanced) { padding-top: var(--space-5); }
  .neuron:not(.is-enhanced)::before { top: var(--space-2); }
  .neuron.is-open,
  .neuron.is-closing { padding-top: calc(var(--hub-y) + 7rem); }
  .gateway-toggle { top: var(--hub-y); }

  .app-directory {
    position: relative;
    inset: auto;
    display: grid;
    gap: var(--space-3);
    margin-left: var(--space-2);
    padding-left: var(--space-4);
  }

  .app-directory::before {
    content: "";
    position: absolute;
    top: -1rem;
    bottom: var(--space-4);
    left: 0;
    border-left: 2px solid var(--primary);
    filter: var(--branch-shadow);
  }

  .is-enhanced .app-directory::after {
    content: "";
    position: absolute;
    top: -3rem;
    left: 0;
    width: calc(50% - 0.5rem);
    height: var(--space-4);
    border-top: 2px solid var(--primary);
    border-left: 2px solid var(--primary);
    border-radius: 1.5rem 0 0 0;
    filter: var(--branch-shadow);
  }

  .app-node {
    position: relative;
    inset: auto;
    width: auto;
    padding-block: var(--space-1);
    transform: none;
  }

  .app-node::before {
    content: "";
    position: absolute;
    top: 1.25rem;
    left: -2rem;
    width: var(--space-4);
    border-top: 2px solid var(--primary);
    filter: var(--branch-shadow);
  }

  .is-enhanced .app-node { --node-y: 0rem; }

  .is-enhanced .app-directory::before {
    opacity: 0;
    transform: scaleY(0);
    transform-origin: top;
    transition: transform 500ms ease, opacity 500ms ease;
  }

  .is-enhanced .app-directory::after {
    opacity: 0;
    transform: scaleX(0);
    transform-origin: top right;
    transition: transform 300ms ease, opacity 300ms ease;
    transition-delay: 320ms;
  }

  .is-open .app-directory::before {
    opacity: 1;
    transform: scaleY(1);
    transition-delay: 120ms;
  }

  .is-open .app-directory::after {
    opacity: 1;
    transform: scaleX(1);
    transition-delay: 0ms;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }

  .is-open .branch { stroke-dashoffset: 0; }
  /* Mist rests in place instead of drifting. */
  .mist-bank { left: var(--x); }
}

/* Welcome screen: a glass card over a softly blurred hub. It only opens when the
   browser holds sound back, so its "Enter the hub" press can start the music. */
.music-gate {
  width: min(100% - 2rem, 20rem);
  max-height: none;
  margin: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  overflow: visible;
}
.music-gate::backdrop {
  background: rgba(247, 245, 241, 0.42);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.music-gate[open],
.music-gate[open]::backdrop { animation: music-gate-in 360ms ease both; }
@keyframes music-gate-in { from { opacity: 0; } }
.music-gate[open] .music-gate-card { animation: music-gate-rise 420ms cubic-bezier(0.2, 0.8, 0.2, 1) both; }
@keyframes music-gate-rise { from { opacity: 0; translate: 0 0.75rem; scale: 0.98; } }

.music-gate-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 1.75rem 1.5rem 1.25rem;
  border: 1px solid var(--glass-rim);
  border-radius: 1.75rem;
  background-color: rgba(247, 245, 241, 0.82);
  background-image: var(--glass-shine);
  background-origin: border-box;
  background-size: 200% 200%;
  box-shadow: 0 24px 60px rgba(30, 30, 30, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.94);
  -webkit-backdrop-filter: blur(22px) saturate(1.4);
  backdrop-filter: blur(22px) saturate(1.4);
  text-align: center;
}
.music-gate-logo { width: 5.5rem; height: auto; }
.music-gate-title {
  margin: 0.25rem 0 0;
  font: 400 1.125rem/1.25 var(--font-heading);
}
.music-gate-now {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.125rem;
  margin: 0;
  font: 400 0.75rem/1.35 var(--font-body);
}
.music-gate-label {
  color: var(--primary);
  font-size: 0.625rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.music-gate-track { font-size: 0.875rem; }
.music-gate-place { color: rgba(30, 30, 30, 0.66); }
.music-gate-place:empty { display: none; }

.music-gate-enter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  margin-top: 0.5rem;
  padding: 0 1.5rem;
  border: 0;
  border-radius: 2rem;
  background: var(--primary);
  color: #fff;
  font: 400 0.875rem/1 var(--font-body);
  box-shadow: 0 8px 22px rgba(54, 99, 228, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.28);
  cursor: pointer;
  transition: background-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}
.music-gate-enter:hover { background: #2a55d1; box-shadow: 0 10px 26px rgba(54, 99, 228, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.28); }
.music-gate-enter:active { transform: scale(0.97); }
.music-gate-quiet {
  padding: 0.375rem 0.75rem;
  border: 0;
  border-radius: 1rem;
  background: transparent;
  color: rgba(30, 30, 30, 0.66);
  font: 400 0.6875rem/1.2 var(--font-body);
  text-decoration: underline;
  text-decoration-color: rgba(30, 30, 30, 0.28);
  text-underline-offset: 3px;
  cursor: pointer;
}
.music-gate-quiet:hover { color: var(--ink); text-decoration-color: currentColor; }
.music-gate-enter:focus-visible,
.music-gate-quiet:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  .music-gate[open],
  .music-gate[open]::backdrop,
  .music-gate[open] .music-gate-card { animation: none; }
  .music-gate-enter:active { transform: none; }
}
@media (prefers-reduced-transparency: reduce), (prefers-contrast: more) {
  .music-gate::backdrop { background: rgba(247, 245, 241, 0.9); -webkit-backdrop-filter: none; backdrop-filter: none; }
  .music-gate-card { background: var(--paper); border-color: var(--rule); -webkit-backdrop-filter: none; backdrop-filter: none; }
}
