/* Music of the Spheres — Maya Labs Playground */

:root {
  --font-display: 'Syne', 'DM Sans', system-ui, sans-serif;
  --font-text: 'DM Sans', system-ui, sans-serif;
  --ease-out: cubic-bezier(0.2, 0.7, 0, 1);
  --gutter: clamp(16px, 2.4vw, 28px);
  --topbar-h: 64px;
}

/* Night: a deep wine sky, paper linework, amber for anything sounding */
body[data-theme='night'] {
  --sky-ground: #12050a;
  --sky-ground-2: #3d1222;
  --sky-line: #f3e6d4;
  --sky-ink: #faf6ee;
  --sky-muted: #c9b7a7;
  --sky-active: #fcb531;
  --sky-sun: #ff393a;
  --sky-core: #ffe2a6;
  --sky-weave: rgba(252, 181, 49, 0.15);
  --sky-stipple: #f3e6d4;

  --ui-bg: rgba(30, 8, 15, 0.62);
  --ui-solid: #250a12;
  --ui-raise: rgba(250, 246, 238, 0.06);
  --ui-hover: rgba(250, 246, 238, 0.1);
  --ui-hair: rgba(250, 246, 238, 0.14);
  --ui-text: #faf6ee;
  --ui-muted: #c9b7a7;
  --ui-accent: #fcb531;
  --ui-on-accent: #2a0c16;
  --ui-shadow: 0 24px 60px rgba(8, 2, 4, 0.45);
  color-scheme: dark;
}

/* Paper: the same plate, printed */
body[data-theme='paper'] {
  --sky-ground: #e6d8c3;
  --sky-ground-2: #fcf8f1;
  --sky-line: #332923;
  --sky-ink: #332923;
  --sky-muted: #6b584d;
  --sky-active: #ad193e;
  --sky-sun: #ff393a;
  --sky-core: #fcb531;
  --sky-weave: rgba(173, 25, 62, 0.09);
  --sky-stipple: #6b584d;

  --ui-bg: rgba(255, 250, 243, 0.74);
  --ui-solid: #fffaf3;
  --ui-raise: rgba(51, 41, 35, 0.04);
  --ui-hover: rgba(51, 41, 35, 0.07);
  --ui-hair: rgba(51, 41, 35, 0.16);
  --ui-text: #332923;
  --ui-muted: #6b584d;
  --ui-accent: #ad193e;
  --ui-on-accent: #fff8ef;
  --ui-shadow: 0 18px 44px rgba(51, 41, 35, 0.14);
  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
}

body {
  background: var(--sky-ground);
  color: var(--ui-text);
  font-family: var(--font-text);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  font-optical-sizing: auto;
  transition: background-color 0.4s;
}

#sky {
  position: fixed;
  inset: 0;
  display: block;
  touch-action: manipulation;
}

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

button {
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--ui-accent);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- shared controls ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--ui-hair);
  border-radius: 10px;
  background: var(--ui-raise);
  font-weight: 500;
  white-space: nowrap;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

.btn:hover,
.btn[aria-expanded='true'] {
  background: var(--ui-hover);
  border-color: color-mix(in srgb, var(--ui-text) 30%, transparent);
}

.btn.ghost {
  border-color: transparent;
  background: transparent;
}

.btn.ghost:hover {
  background: var(--ui-hover);
}

.btn.primary {
  height: 48px;
  padding: 0 24px;
  border: 0;
  border-radius: 999px;
  background: var(--ui-accent);
  color: var(--ui-on-accent);
  font-weight: 600;
  font-size: 16px;
}

.btn.primary:hover {
  filter: brightness(1.06);
}

.btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
}

.btn svg .fill {
  fill: currentColor;
  stroke: none;
}

.ui {
  transition: opacity 0.6s var(--ease-out), transform 0.8s var(--ease-out), visibility 0s;
}

body.intro .ui {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0s 0.3s;
}

body.intro .dock {
  transform: translate(-50%, 16px);
}

body.intro .roster {
  transform: translateX(-12px);
}

/* ---------- 3D view ---------- */

.sky3d {
  position: fixed;
  inset: 0;
  display: none;
  background: radial-gradient(ellipse at 50% 55%, var(--sky-ground-2) 0%, var(--sky-ground) 72%);
}

body[data-view='3d'] .sky3d {
  display: block;
}

body[data-view='3d'] #sky {
  visibility: hidden;
}

.sky3d-canvas {
  display: block;
  cursor: grab;
}

.sky3d-canvas.grabbing {
  cursor: grabbing;
}

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

.label3d {
  position: absolute;
  left: 0;
  top: 0;
  color: var(--sky-muted);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0.8;
  will-change: transform;
}

.viewbar {
  position: fixed;
  top: calc(var(--topbar-h) + 4px);
  right: var(--gutter);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  z-index: 9;
}

.viewbar .seg {
  background: var(--ui-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.viewbar .seg button {
  min-width: 44px;
  font-weight: 600;
}

.viewbar .seg.loading button[data-view='3d'] {
  animation: blink 1s steps(2, jump-none) infinite;
}

.view3d-tools {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.tilt {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 4px 4px 12px;
  border: 1px solid var(--ui-hair);
  border-radius: 12px;
  background: var(--ui-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  font-size: 12.5px;
  color: var(--ui-muted);
}

.tilt .chips button {
  height: 28px;
  min-width: 40px;
}

.view3d-tools .btn {
  height: 32px;
  background: var(--ui-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

@media (max-width: 860px) {
  .viewbar {
    top: calc(var(--topbar-h) + 2px);
    flex-direction: row;
    flex-wrap: wrap-reverse;
    justify-content: flex-end;
    left: var(--gutter);
  }
  .view3d-tools {
    flex-direction: row;
    align-items: center;
  }
  .view3d-tools .btn {
    padding: 0 10px;
  }
}

/* ---------- top bar ---------- */

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 var(--gutter);
  padding-top: env(safe-area-inset-top);
  z-index: 10;
  pointer-events: none;
}

.topbar > * {
  pointer-events: auto;
}

.wordmark {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 19px;
  letter-spacing: -0.03em;
  color: var(--ui-text);
  text-decoration: none;
  white-space: nowrap;
}

.systems {
  display: flex;
  gap: 2px;
  margin: 0 auto;
  padding: 3px;
  border: 1px solid var(--ui-hair);
  border-radius: 999px;
  background: var(--ui-bg);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  overflow-x: auto;
  scrollbar-width: none;
}

.systems::-webkit-scrollbar {
  display: none;
}

.systems button {
  flex: none;
  height: 32px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ui-muted);
  font-weight: 500;
  white-space: nowrap;
  transition: color 0.15s, background-color 0.2s;
}

.systems button:hover {
  color: var(--ui-text);
}

.systems button[aria-pressed='true'] {
  background: var(--ui-text);
  color: var(--sky-ground);
}

.top-actions {
  display: flex;
  gap: 4px;
}

/* ---------- roster ---------- */

.roster {
  position: fixed;
  top: calc(var(--topbar-h) + 12px);
  left: var(--gutter);
  width: 272px;
  max-height: calc(100vh - var(--topbar-h) - 140px);
  display: flex;
  flex-direction: column;
  z-index: 5;
}

.roster-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 0 4px 10px 12px;
}

.roster h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.01em;
}

.roster-sub {
  color: var(--ui-muted);
  font-size: 12px;
}

.worlds {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  scrollbar-width: thin;
}

.world {
  display: grid;
  grid-template-columns: 28px 1fr auto 40px;
  align-items: center;
  border-radius: 10px;
  position: relative;
  transition: background-color 0.15s;
}

.world:hover {
  background: var(--ui-hover);
}

.world.selected {
  background: var(--ui-bg);
  box-shadow: inset 0 0 0 1px var(--ui-hair);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.world .mute {
  width: 28px;
  height: 36px;
  border: 0;
  background: none;
  display: grid;
  place-items: center;
  padding: 0 0 0 8px;
}

.world .mute .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 1.5px solid var(--ui-text);
  background: var(--ui-text);
  transition: background-color 0.15s, transform 0.2s var(--ease-out);
}

.world.muted .mute .dot {
  background: transparent;
  opacity: 0.6;
}

.world.ringing .mute .dot {
  background: var(--ui-accent);
  border-color: var(--ui-accent);
  transform: scale(1.35);
}

.world .name {
  border: 0;
  background: none;
  padding: 8px 6px;
  text-align: left;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 14.5px;
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.world.muted .name,
.world.muted .period,
.world.muted .note {
  opacity: 0.45;
}

.world .period {
  color: var(--ui-muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.world .note {
  justify-self: end;
  padding-right: 10px;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--ui-text);
  transition: color 0.15s;
}

.world.ringing .note {
  color: var(--ui-accent);
}

.world .detail {
  grid-column: 2 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 14px;
  padding: 0 10px 10px 6px;
  color: var(--ui-muted);
  font-size: 12px;
}

.world .detail b {
  color: var(--ui-text);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.world .remove {
  margin-left: auto;
  border: 0;
  background: none;
  color: var(--ui-muted);
  font-size: 12px;
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 2px 0;
}

.world .remove:hover {
  color: var(--ui-text);
}

.roster-hint {
  margin: 12px 0 0;
  padding: 0 12px;
  color: var(--ui-muted);
  font-size: 12px;
  max-width: 30ch;
}

/* ---------- dock ---------- */

.dock {
  position: fixed;
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border: 1px solid var(--ui-hair);
  border-radius: 20px;
  background: var(--ui-bg);
  backdrop-filter: blur(20px) saturate(1.25);
  -webkit-backdrop-filter: blur(20px) saturate(1.25);
  box-shadow: var(--ui-shadow);
  z-index: 10;
  max-width: calc(100vw - 2 * var(--gutter));
}

.dock-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.dock-group + .dock-group {
  padding-left: 10px;
  border-left: 1px solid var(--ui-hair);
}

.transport {
  gap: 12px;
}

.play {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 0;
  background: var(--ui-text);
  color: var(--sky-ground);
  display: grid;
  place-items: center;
  flex: none;
  transition: transform 0.2s var(--ease-out);
}

.play:active {
  transform: scale(0.94);
}

.play svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
  grid-area: 1 / 1;
}

.play .i-play,
.play.paused .i-pause {
  display: none;
}

.play.paused .i-play {
  display: block;
}

.time {
  display: grid;
  gap: 2px;
  min-width: 200px;
  padding-right: 4px;
}

.clock-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.home {
  border: 0;
  background: none;
  padding: 0;
  color: var(--ui-accent);
  font-size: 12px;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.home[hidden] {
  display: none;
}

.reverse {
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--ui-hair);
  background: transparent;
  display: grid;
  place-items: center;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

.reverse svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.reverse:hover {
  background: var(--ui-hover);
}

.reverse[aria-pressed='true'] {
  background: var(--ui-accent);
  border-color: var(--ui-accent);
  color: var(--ui-on-accent);
}

.clock {
  border: 0;
  background: none;
  padding: 0;
  text-align: left;
  border-bottom: 1px dashed transparent;
  transition: border-color 0.15s, color 0.15s;
}

.clock:hover,
.clock[aria-expanded='true'] {
  border-bottom-color: var(--ui-muted);
}

#pop-date {
  left: 0;
  right: auto;
  transform-origin: bottom left;
}

.date-form {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.date-form .field {
  flex: 1;
  min-width: 0;
}

.date-form input {
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--ui-hair);
  border-radius: 10px;
  background: var(--ui-raise);
  width: 100%;
  font-variant-numeric: tabular-nums;
}

.date-form .btn.primary.small {
  padding: 0 18px;
}

.moments ul {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: grid;
  gap: 2px;
}

.moment {
  width: 100%;
  display: grid;
  gap: 1px;
  padding: 9px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  text-align: left;
}

.moment:hover {
  background: var(--ui-hover);
}

.moment strong {
  font-weight: 600;
  font-size: 13.5px;
}

.moment span {
  color: var(--ui-muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.date-note {
  color: var(--ui-muted);
  font-size: 12px;
}

.clock {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

.speed {
  display: flex;
  align-items: center;
  gap: 10px;
}

.speed output {
  color: var(--ui-muted);
  font-size: 12px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  min-width: 92px;
}

input[type='range'] {
  -webkit-appearance: none;
  appearance: none;
  width: 110px;
  height: 18px;
  background: transparent;
  margin: 0;
}

input[type='range']::-webkit-slider-runnable-track {
  height: 2px;
  background: var(--ui-hair);
  border-radius: 2px;
}

input[type='range']::-moz-range-track {
  height: 2px;
  background: var(--ui-hair);
}

input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  margin-top: -6px;
  border-radius: 50%;
  background: var(--ui-text);
  border: 3px solid var(--ui-solid);
  box-shadow: 0 0 0 1px var(--ui-hair);
}

input[type='range']::-moz-range-thumb {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--ui-text);
  border: 3px solid var(--ui-solid);
}

.seg {
  display: flex;
  padding: 3px;
  border-radius: 12px;
  background: var(--ui-raise);
  border: 1px solid var(--ui-hair);
}

.seg button {
  height: 30px;
  padding: 0 12px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--ui-muted);
  font-weight: 500;
  transition: color 0.15s, background-color 0.2s;
}

.seg button:hover {
  color: var(--ui-text);
}

.seg button[aria-checked='true'] {
  background: var(--ui-text);
  color: var(--sky-ground);
}

.rec-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--sky-sun);
}

.btn.rec.on {
  border-color: var(--sky-sun);
  color: var(--ui-text);
}

.btn.rec.on .rec-dot {
  animation: blink 1.2s steps(2, jump-none) infinite;
}

@keyframes blink {
  50% {
    opacity: 0.25;
  }
}

.worlds-btn {
  display: none;
}

/* ---------- popovers ---------- */

.pop {
  position: absolute;
  bottom: calc(100% + 12px);
  right: 0;
  width: 320px;
  padding: 18px;
  border: 1px solid var(--ui-hair);
  border-radius: 16px;
  background: var(--ui-solid);
  box-shadow: var(--ui-shadow);
  display: grid;
  gap: 16px;
  transform-origin: bottom right;
  animation: pop-in 0.22s var(--ease-out);
}

.pop[hidden] {
  display: none;
}

@keyframes pop-in {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.98);
  }
}

.field {
  display: grid;
  gap: 8px;
}

.field > span {
  display: flex;
  justify-content: space-between;
  font-weight: 600;
  font-size: 13px;
}

.field output {
  color: var(--ui-muted);
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}

.field small {
  color: var(--ui-muted);
  font-size: 12px;
  line-height: 1.4;
}

.field input[type='range'] {
  width: 100%;
}

select {
  height: 38px;
  padding: 0 34px 0 12px;
  border: 1px solid var(--ui-hair);
  border-radius: 10px;
  background: var(--ui-raise)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none' stroke='%23998877' stroke-width='1.5'%3E%3Cpath d='M1 1l4 4 4-4'/%3E%3C/svg%3E")
    no-repeat right 12px center;
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
}

select option {
  background: var(--ui-solid);
  color: var(--ui-text);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.chips button {
  min-width: 36px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--ui-hair);
  border-radius: 8px;
  background: transparent;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.chips button:hover {
  background: var(--ui-hover);
}

.chips button[aria-checked='true'] {
  background: var(--ui-text);
  border-color: var(--ui-text);
  color: var(--sky-ground);
}

.pop-lede {
  margin: 0;
  color: var(--ui-muted);
  font-size: 13px;
}

.weave-pick {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.pop-actions {
  display: flex;
  gap: 8px;
}

#pop-export {
  gap: 4px;
  padding: 8px;
  width: 300px;
}

.menu-item {
  display: grid;
  gap: 2px;
  padding: 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  text-align: left;
}

.menu-item:hover {
  background: var(--ui-hover);
}

.menu-item strong {
  font-weight: 600;
}

.menu-item span {
  color: var(--ui-muted);
  font-size: 12.5px;
}

/* ---------- intro ---------- */

.intro-panel {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: flex-start;
  padding: var(--gutter) var(--gutter) clamp(28px, 7vh, 72px) clamp(20px, 5vw, 72px);
  pointer-events: none;
  transition: opacity 0.7s var(--ease-out), visibility 0s 0.7s;
}

.intro-panel::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, var(--sky-ground) 0%, color-mix(in srgb, var(--sky-ground) 70%, transparent) 32%, transparent 62%);
  z-index: -1;
}

.intro-panel > * {
  pointer-events: auto;
}

body:not(.intro) .intro-panel {
  opacity: 0;
  visibility: hidden;
}

.kicker {
  color: var(--ui-muted);
  text-decoration: none;
  font-size: 14px;
  margin-bottom: 18px;
  opacity: 0;
  animation: fade 0.9s 0.9s var(--ease-out) forwards;
}

.kicker:hover {
  color: var(--ui-text);
}

.intro-panel h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(60px, 10.5vw, 168px);
  line-height: 0.86;
  letter-spacing: -0.055em;
  color: var(--sky-ink);
}

.intro-panel h1 .line {
  display: block;
  overflow: hidden;
  padding-bottom: 0.06em;
}

.intro-panel h1 .line > span {
  display: inline-block;
  transform: translateY(105%);
  animation: rise 1.1s var(--ease-out) forwards;
}

.intro-panel h1 .line:nth-child(2) > span {
  animation-delay: 0.09s;
  /* "of the" sits indented, like a line set against an orbit */
  margin-left: 0.62em;
}

.intro-panel h1 .line:nth-child(3) > span {
  animation-delay: 0.18s;
}

.lede {
  max-width: 46ch;
  margin: 28px 0 0;
  font-size: clamp(15px, 1.25vw, 17px);
  line-height: 1.6;
  color: var(--ui-muted);
  opacity: 0;
  animation: fade 1s 0.6s var(--ease-out) forwards;
}

.intro-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 18px;
  margin-top: 30px;
  opacity: 0;
  animation: fade 1s 0.75s var(--ease-out) forwards;
}

.intro-note {
  color: var(--ui-muted);
  font-size: 13px;
}

@keyframes rise {
  to {
    transform: translateY(0);
  }
}

@keyframes fade {
  to {
    opacity: 1;
  }
}

/* ---------- about ---------- */

.about {
  width: min(620px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  padding: 36px 40px 32px;
  border: 1px solid var(--ui-hair);
  border-radius: 20px;
  background: var(--ui-solid);
  color: var(--ui-text);
  box-shadow: var(--ui-shadow);
  line-height: 1.6;
  font-size: 15px;
}

.about::backdrop {
  background: color-mix(in srgb, var(--sky-ground) 55%, transparent);
  backdrop-filter: blur(3px);
}

.about h2 {
  margin: 0 0 16px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 30px;
  letter-spacing: -0.03em;
  line-height: 1.05;
}

.about h3 {
  margin: 26px 0 8px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
}

.about p,
.about li {
  color: var(--ui-muted);
  max-width: 62ch;
}

.about p {
  margin: 0 0 12px;
}

.about ul {
  margin: 0;
  padding-left: 18px;
}

.about li {
  margin-bottom: 6px;
}

.about a {
  color: var(--ui-text);
  text-underline-offset: 3px;
}

.about-close {
  position: absolute;
  top: 14px;
  right: 14px;
  margin: 0;
}

.keys {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px 20px;
  margin: 0;
}

.keys div {
  display: flex;
  gap: 10px;
  align-items: baseline;
}

.keys dt {
  min-width: 52px;
  padding: 1px 7px;
  border: 1px solid var(--ui-hair);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
}

.keys dd {
  margin: 0;
  color: var(--ui-muted);
  font-size: 13.5px;
}

.about-foot {
  margin-top: 24px !important;
  padding-top: 16px;
  border-top: 1px solid var(--ui-hair);
  font-size: 13px;
}

/* ---------- Kepler's score ---------- */

.kepler {
  position: fixed;
  top: calc(var(--topbar-h) + 6px);
  right: var(--gutter);
  bottom: calc(var(--dock-h, 72px) + 30px + env(safe-area-inset-bottom));
  width: min(440px, calc(100vw - 2 * var(--gutter)));
  display: flex;
  flex-direction: column;
  border: 1px solid var(--ui-hair);
  border-radius: 18px;
  background: var(--ui-solid);
  box-shadow: var(--ui-shadow);
  z-index: 11;
  animation: sheet-in 0.32s var(--ease-out);
}

.top-actions .short {
  display: none;
}

.kepler[hidden] {
  display: none;
}

@keyframes sheet-in {
  from {
    opacity: 0;
    transform: translateX(14px);
  }
}

.kepler-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 14px 10px 24px;
  border-bottom: 1px solid var(--ui-hair);
}

.kepler-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 24px;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.kepler-body {
  overflow-y: auto;
  padding: 20px 24px 28px;
  scrollbar-width: thin;
}

.kepler-body p {
  margin: 0 0 14px;
  color: var(--ui-muted);
  font-size: 14.5px;
  line-height: 1.62;
  max-width: 62ch;
}

.kepler-body .k-lede {
  color: var(--ui-text);
  font-size: 15.5px;
}

.kepler-body h3 {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.01em;
}

.choir {
  margin: 24px 0 28px;
  padding: 18px;
  border-radius: 14px;
  background: var(--ui-raise);
  border: 1px solid var(--ui-hair);
}

.voices {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px 16px;
  margin: 4px 0 18px;
}

.voices div {
  display: grid;
  gap: 1px;
}

.voices dt {
  font-size: 12px;
  color: var(--ui-muted);
}

.voices dd {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
}

.btn.primary.small {
  height: 40px;
  padding: 0 18px 0 14px;
  font-size: 14px;
}

.btn.primary svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
  stroke: none;
}

.songs-note {
  font-size: 13.5px !important;
}

.songs {
  list-style: none;
  margin: 18px 0 0;
  padding: 0;
  display: grid;
}

.song {
  display: grid;
  gap: 8px;
  padding: 18px 0;
  border-top: 1px solid var(--ui-hair);
}

.song:last-child {
  border-bottom: 1px solid var(--ui-hair);
}

.song-head {
  display: flex;
  align-items: center;
  gap: 14px;
}

.song-play {
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--ui-hair);
  background: transparent;
  display: grid;
  place-items: center;
  transition: background-color 0.15s, border-color 0.15s;
}

.song-play:hover {
  background: var(--ui-hover);
}

.song-play svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
  margin-left: 2px;
}

.song.playing .song-play {
  border-color: var(--ui-accent);
  color: var(--ui-accent);
}

.song-title {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.song-title strong {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.01em;
}

.song-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 12px;
  color: var(--ui-muted);
  font-size: 12.5px;
}

.song-meta b {
  color: var(--ui-text);
  font-weight: 600;
}

.staff {
  width: 100%;
  max-width: 100%;
  height: auto;
  display: block;
  margin: 2px 0;
}

.staff .staff-line,
.staff .ledger {
  stroke: var(--ui-text);
  stroke-width: 0.8;
  opacity: 0.4;
}

.staff .note {
  fill: var(--ui-text);
  transition: fill 0.12s;
}

.staff .note.lit {
  fill: var(--ui-accent);
}

.staff .syl {
  fill: var(--ui-muted);
  font: italic 400 11px var(--font-text);
  text-anchor: middle;
}

.song-text {
  margin: 0 !important;
  font-size: 13.5px !important;
}

.song-compare {
  margin: 0 !important;
  font-size: 12.5px !important;
  font-variant-numeric: tabular-nums;
}

.k-foot {
  margin-top: 22px !important;
  font-size: 13px !important;
}

@media (max-width: 860px) {
  .kepler {
    left: var(--gutter);
    right: var(--gutter);
    width: auto;
    z-index: 13;
  }
  .kepler-head {
    padding-left: 18px;
  }
  .kepler-body {
    padding: 16px 18px 24px;
  }
  .top-actions .long {
    display: none;
  }
  .top-actions .short {
    display: inline;
  }
  .top-actions svg.short {
    display: block;
  }
}

/* ---------- toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  top: calc(var(--topbar-h) + 14px);
  transform: translate(-50%, -8px);
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--ui-text);
  color: var(--sky-ground);
  font-weight: 500;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.35s var(--ease-out);
  z-index: 30;
  max-width: calc(100vw - 32px);
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- responsive ---------- */

@media (max-width: 1099px) {
  .roster {
    top: auto;
    bottom: calc(var(--dock-h, 72px) + 30px + env(safe-area-inset-bottom));
    left: 50%;
    width: min(380px, calc(100vw - 2 * var(--gutter)));
    max-height: 50vh;
    padding: 14px 8px 8px;
    border: 1px solid var(--ui-hair);
    border-radius: 18px;
    background: var(--ui-solid);
    box-shadow: var(--ui-shadow);
    transform: translate(-50%, 0);
    z-index: 12;
  }

  body:not(.show-roster) .roster,
  body.intro .roster {
    opacity: 0;
    visibility: hidden;
    transform: translate(-50%, 12px);
  }

  .worlds-btn {
    display: inline-flex;
  }
}

@media (max-width: 860px) {
  :root {
    --topbar-h: 96px;
  }

  .topbar {
    flex-wrap: wrap;
    align-content: center;
    gap: 8px 6px;
    height: auto;
    min-height: var(--topbar-h);
    padding-top: calc(10px + env(safe-area-inset-top));
    padding-bottom: 8px;
  }

  .wordmark {
    font-size: clamp(12px, 3.5vw, 15px);
    letter-spacing: -0.04em;
  }

  .topbar > .wordmark,
  .topbar > .top-actions {
    flex: none;
  }

  .top-actions {
    gap: 2px;
  }

  .top-actions .btn {
    height: 32px;
    padding: 0 7px;
    font-size: 13px;
  }

  .intro-panel h1 {
    font-size: clamp(44px, 13.2vw, 120px);
  }

  .top-actions {
    margin-left: auto;
  }

  .top-actions #themeLabel {
    display: none;
  }

  .systems {
    order: 3;
    flex: 1 0 100%;
    margin: 0;
  }

  .dock {
    flex-wrap: wrap;
    justify-content: center;
    width: calc(100vw - 2 * var(--gutter));
    gap: 8px;
    border-radius: 18px;
  }

  .dock-group + .dock-group {
    border-left: 0;
    padding-left: 0;
  }

  .transport {
    flex: 1 0 100%;
  }

  .time {
    flex: 1;
    min-width: 0;
  }

  .speed input {
    flex: 1;
  }

  .tools {
    flex: 1 0 100%;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
  }

  .tools .btn {
    height: 34px;
    padding: 0 4px;
    justify-content: center;
    gap: 6px;
    font-size: 13px;
  }

  .pop {
    left: 0;
    right: 0;
    width: auto;
    max-height: calc(100vh - var(--topbar-h) - var(--dock-h, 120px) - 40px);
    overflow-y: auto;
  }

  #pop-export {
    width: auto;
  }


  .intro-panel {
    padding-bottom: calc(32px + env(safe-area-inset-bottom));
  }

  .intro-panel::before {
    background: linear-gradient(0deg, var(--sky-ground) 0%, color-mix(in srgb, var(--sky-ground) 80%, transparent) 45%, transparent 75%);
  }

  .about {
    padding: 28px 22px 22px;
  }

  .keys {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 420px) {
  .seg button {
    padding: 0 10px;
  }
  .speed output {
    min-width: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0s !important;
    transition-duration: 0.01ms !important;
  }
  .intro-panel h1 .line > span,
  .kicker,
  .lede,
  .intro-actions {
    transform: none;
    opacity: 1;
  }
}
