:root {
  --ink: #edf0e8;
  --muted: #858c91;
  --line: rgba(219, 231, 229, 0.18);
  --signal: #ef4b2f;
  --amber: #f6b83f;
  --void: #03060b;
  --utility: #b8c1c2;
  --utility-dim: #929da0;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--void);
  color: var(--ink);
}

body {
  font-family: "DM Mono", monospace;
}

button,
a {
  color: inherit;
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
}

#scene.is-dragging {
  cursor: grabbing;
}

.grain {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.055;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.95' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.8'/%3E%3C/svg%3E");
}

.frame {
  position: fixed;
  inset: 0 18px 18px;
  z-index: 2;
  pointer-events: none;
  border: 1px solid rgba(222, 229, 226, 0.1);
  border-top: 0;
}

.topbar,
main,
footer {
  position: relative;
  z-index: 3;
}

.topbar {
  height: 72px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  padding: 0 54px;
  background: rgba(3, 6, 11, 0.72);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
  position: relative;
}

.topbar-brand {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  line-height: 0;
  transition: transform 180ms ease, filter 180ms ease;
}

.topbar-brand:hover,
.topbar-brand:focus-visible {
  transform: translate(-50%, -50%) scale(1.06);
  filter: drop-shadow(0 0 10px rgba(239, 75, 47, 0.45));
}

.topbar-brand img {
  width: 40px;
  height: 40px;
  display: block;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.55));
}

.set-navigation {
  display: flex;
  align-items: center;
  gap: 18px;
}

.set-navigation:empty {
  display: none;
}

.set-navigation a,
.set-navigation span {
  color: #858c91;
  text-decoration: none;
  text-transform: uppercase;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.13em;
  transition: color 180ms ease;
}

.set-navigation a:hover,
.set-navigation a:focus-visible,
.set-navigation [aria-current="page"] {
  color: var(--ink);
}

.repository-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  color: #a2a9ab;
  text-decoration: none;
  transition: color 180ms ease;
}

.repository-link svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.repository-link:hover,
.repository-link:focus-visible {
  color: var(--ink);
}

.topbar-actions {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sound-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  background: none;
  color: #9da3a3;
  text-transform: uppercase;
  font-size: 9px;
  letter-spacing: 0.16em;
}

.sound-bars {
  height: 12px;
  display: flex;
  align-items: end;
  gap: 2px;
}

.sound-bars i {
  width: 2px;
  height: 4px;
  background: currentColor;
}

.sound-bars i:nth-child(2) {
  height: 9px;
}

.sound-bars i:nth-child(3) {
  height: 6px;
}

main {
  height: calc(100vh - 132px);
  min-height: 0;
  pointer-events: none;
}

.instructions button {
  pointer-events: auto;
}

.playback-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  pointer-events: auto;
}

.playback-controls button {
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
}

#rebuildButton {
  padding: 8px 10px;
  background: transparent;
  color: #a6acab;
  text-transform: uppercase;
  transition: color 180ms;
}

#rebuildButton:hover {
  color: var(--amber);
}

#rebuildButton i {
  font-size: 14px;
  font-style: normal;
}

.hero {
  position: absolute;
  top: clamp(60px, 10vh, 122px);
  left: clamp(38px, 6vw, 104px);
  max-width: 470px;
  pointer-events: none;
}

.eyebrow {
  margin: 0 0 16px;
  color: var(--amber);
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  text-transform: uppercase;
  font-family: "Barlow Condensed", sans-serif;
  line-height: 0.84;
  letter-spacing: -0.045em;
}

h1 span {
  display: block;
  margin-bottom: 7px;
  color: #737a7c;
  font-size: clamp(28px, 2.8vw, 46px);
  font-weight: 500;
}

h1 strong {
  display: block;
  font-size: clamp(48px, 4.8vw, 78px);
  font-weight: 700;
}

.intro {
  margin: 21px 0 0 3px;
  color: #9da3a3;
  font-size: 10px;
  line-height: 1.9;
  letter-spacing: 0.03em;
}

.telemetry {
  position: absolute;
  right: clamp(38px, 5.2vw, 90px);
  bottom: clamp(68px, 10vh, 118px);
  width: clamp(250px, 22vw, 350px);
  text-shadow: 0 1px 10px rgba(3, 6, 11, 0.95);
}

.telemetry-heading {
  display: flex;
  justify-content: space-between;
  margin-bottom: 13px;
  text-transform: uppercase;
  color: var(--utility);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.11em;
}

.telemetry-heading span:last-child {
  color: var(--amber);
}

.progress-track {
  position: relative;
  height: 2px;
  background: rgba(255, 255, 255, 0.15);
}

#progressBar {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  background: var(--signal);
  box-shadow: 0 0 12px rgba(239, 75, 47, 0.5);
}

.progress-notch {
  position: absolute;
  top: -2px;
  width: 1px;
  height: 6px;
  background: #697074;
}

.n1 { left: 34%; }
.n2 { left: 68%; }
.n3 { right: 0; }

.readouts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-top: 22px;
}

.readouts > div:last-child {
  padding-left: 28px;
  border-left: 1px solid var(--line);
}

.readouts small {
  display: block;
  margin-bottom: 7px;
  color: var(--utility-dim);
  text-transform: uppercase;
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.1em;
}

.readouts strong {
  color: #d9ded9;
  font-family: "Barlow Condensed", sans-serif;
  font-size: 25px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.readouts em {
  margin-left: 5px;
  color: var(--utility);
  font-family: "DM Mono", monospace;
  font-size: 10px;
  font-weight: 500;
  font-style: normal;
}

.instructions {
  position: absolute;
  left: 50%;
  bottom: 28px;
  display: flex;
  gap: 24px;
  align-items: center;
  transform: translateX(-50%);
  color: var(--utility);
  text-transform: uppercase;
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.09em;
  text-shadow: 0 1px 10px rgba(3, 6, 11, 0.98);
}

.instructions span,
.instructions button {
  display: flex;
  align-items: center;
  gap: 8px;
}

.instructions button {
  padding: 8px 10px;
  background: transparent;
  color: #a6acab;
  text-transform: uppercase;
  transition: color 180ms;
}

.instructions button:hover {
  color: var(--amber);
}

.instructions button i {
  font-size: 14px;
  font-style: normal;
}

.mouse-icon {
  width: 10px;
  height: 14px;
  border: 1px solid var(--utility-dim);
  border-radius: 6px;
}

.mouse-icon::after {
  content: "";
  display: block;
  width: 1px;
  height: 3px;
  margin: 2px auto;
  background: #899093;
}

footer {
  height: 60px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 54px;
  border-top: 1px solid var(--line);
  color: var(--utility-dim);
  text-transform: uppercase;
  font-size: 8px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-shadow: 0 1px 8px rgba(3, 6, 11, 0.95);
  pointer-events: auto;
}

footer > span:last-child {
  justify-self: end;
}

#pauseButton {
  display: flex;
  gap: 9px;
  align-items: center;
  padding: 10px 14px;
  background: none;
  color: #858c8d;
  text-transform: uppercase;
  font-size: 8px;
  letter-spacing: 0.13em;
}

.pause-icon,
.pause-icon::after {
  width: 2px;
  height: 8px;
  background: currentColor;
}

.pause-icon {
  position: relative;
  display: block;
  margin-right: 3px;
}

.pause-icon::after {
  content: "";
  position: absolute;
  left: 5px;
}

button:focus-visible,
a:focus-visible {
  outline: 1px solid var(--amber);
  outline-offset: 4px;
}

@media (max-width: 760px) {
  .grain {
    display: none;
  }

  .topbar,
  footer {
    backdrop-filter: none;
    background: rgba(3, 6, 11, 0.97);
  }

  .frame {
    inset: 0 10px 10px;
  }

  .topbar {
    height: 72px;
    grid-template-columns: 1fr auto;
    padding: 0 24px;
  }

  .topbar-brand {
    width: 38px;
    height: 38px;
  }

  .topbar-brand img {
    width: 34px;
    height: 34px;
  }

  .set-navigation {
    max-width: calc(50% - 28px);
  }

  main {
    height: calc(100vh - 122px);
  }

  .hero {
    top: 46px;
    left: 25px;
  }

  h1 span {
    font-size: 27px;
  }

  h1 strong {
    font-size: clamp(42px, 12.5vw, 56px);
  }

  .intro {
    margin-top: 19px;
  }

  .telemetry {
    right: 25px;
    bottom: calc(88px + env(safe-area-inset-bottom, 0px));
    width: calc(100% - 50px);
  }

  .instructions {
    display: none;
  }

  footer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 6;
    height: auto;
    min-height: 64px;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(3, 6, 11, 0.94);
    backdrop-filter: blur(16px);
    border-top: 1px solid var(--line);
    pointer-events: auto;
  }

  footer > span {
    display: none;
  }

  .playback-controls {
    width: min(100%, 360px);
    gap: 10px;
  }

  #pauseButton,
  #rebuildButton {
    flex: 1;
    justify-content: center;
    min-height: 44px;
    padding: 10px 14px;
    border: 1px solid rgba(219, 231, 229, 0.28);
    border-radius: 999px;
    background: rgba(10, 16, 24, 0.92);
    color: var(--ink);
    font-size: 10px;
    letter-spacing: 0.12em;
    text-shadow: none;
  }

  #pauseButton:hover,
  #rebuildButton:hover {
    color: var(--amber);
    border-color: rgba(246, 184, 63, 0.45);
  }
}

