:root {
  color-scheme: dark;
  --bg: #06100b;
  --panel: rgba(7, 20, 13, 0.88);
  --panel-border: rgba(116, 255, 176, 0.22);
  --accent: #7bffaf;
  --accent-soft: rgba(123, 255, 175, 0.14);
  --echo-amber: #d99a4e;
  --text: #e7ffee;
  --muted: rgba(231, 255, 238, 0.7);
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.42);
  --font: ui-monospace, "SF Mono", Menlo, Monaco, "Cascadia Code", monospace;
}

* {
  box-sizing: border-box;
}

.family-bar {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 0.55rem 1rem;
  border-bottom: 1px solid rgba(231, 255, 238, 0.15);
  background: #090d0b;
  color: rgba(231, 255, 238, 0.58);
  font-size: 0.76rem;
  line-height: 1.3;
}

.family-bar a {
  display: inline-flex;
  gap: 0.3rem;
  color: rgba(231, 255, 238, 0.76);
  text-decoration: none;
}

.family-bar a:hover,
.family-bar a[aria-current="page"] {
  color: #fff;
}

.family-bar a strong {
  color: var(--accent);
  text-transform: uppercase;
}

.family-label {
  color: rgba(231, 255, 238, 0.42);
  letter-spacing: 0.12em;
}

html {
  min-height: 100%;
  background:
    radial-gradient(circle at top, rgba(123, 255, 175, 0.12), transparent 42%),
    linear-gradient(180deg, #08110c 0%, #030705 100%);
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  background:
    linear-gradient(rgba(123, 255, 175, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(123, 255, 175, 0.035) 1px, transparent 1px);
  background-size: 32px 32px;
  overflow-x: hidden;
}

a {
  color: var(--accent);
}

.shell {
  width: min(100%, 960px);
  margin: 0 auto;
  padding: 48px 20px 64px;
}

.masthead {
  margin-bottom: 30px;
}

.eyebrow,
.label {
  margin: 0 0 8px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.78rem;
  color: var(--muted);
}

.masthead h1,
.card h2 {
  margin: 0;
  line-height: 1.08;
}

.masthead h1 {
  font-size: clamp(2.4rem, 7vw, 4.4rem);
  text-wrap: balance;
}

.masthead-intro {
  max-width: 720px;
  margin: 12px 0 0;
  font-size: clamp(1.05rem, 2.4vw, 1.35rem);
  line-height: 1.5;
  color: var(--text);
}

.masthead-concept {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.card {
  position: relative;
  min-width: 0;
  padding: 24px;
  border: 1px solid var(--panel-border);
  border-radius: 22px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(123, 255, 175, 0.06);
}

.card-header,
.controls,
.footer {
  display: flex;
  gap: 16px;
}

.card-header {
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}

.signal {
  display: inline-flex;
  gap: 8px;
  align-items: flex-end;
  min-height: 38px;
}

.signal span {
  width: 10px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(123, 255, 175, 0.28), var(--accent));
  box-shadow: 0 0 18px rgba(123, 255, 175, 0.35);
  animation: pulse 1.6s ease-in-out infinite;
}

.signal span:nth-child(1) {
  height: 16px;
}

.signal span:nth-child(2) {
  height: 30px;
  animation-delay: 0.15s;
}

.signal span:nth-child(3) {
  height: 22px;
  animation-delay: 0.3s;
}

.set-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px;
  margin: 0 0 20px;
}

.set-meta div {
  padding: 12px 14px;
  border-radius: 16px;
  background: var(--accent-soft);
  border: 1px solid rgba(123, 255, 175, 0.12);
}

.set-meta dt {
  margin: 0 0 6px;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
}

.set-meta dd {
  margin: 0;
  font-size: 1rem;
}

.echo-booth {
  --booth-brightness: 0.78;
  --booth-saturation: 0.9;
  position: relative;
  min-width: 0;
  aspect-ratio: 16 / 9;
  margin: 0 0 20px;
  overflow: hidden;
  border: 1px solid rgba(217, 154, 78, 0.24);
  border-radius: 18px;
  background: #03090b;
  isolation: isolate;
}

.echo-booth[data-program="focus"] {
  --booth-brightness: 0.94;
  --booth-saturation: 0.72;
}

.echo-booth[data-program="drive"] {
  --booth-brightness: 1;
  --booth-saturation: 0.86;
}

.echo-booth[data-program="surge"] {
  --booth-brightness: 0.9;
  --booth-saturation: 1.12;
}

.booth-scene,
.booth-frame,
.booth-atmosphere {
  position: absolute;
  inset: 0;
}

.booth-scene {
  animation: booth-breathe 9s ease-in-out infinite;
  transform-origin: 34% 62%;
}

.booth-frame {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(var(--booth-brightness)) saturate(var(--booth-saturation));
  transition: filter 1.8s ease;
}

.booth-frame-blink {
  opacity: 0;
  animation: booth-blink 11s linear infinite;
}

.booth-atmosphere {
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(90deg, transparent 42%, rgba(1, 7, 9, 0.18) 54%, rgba(1, 7, 9, 0.62) 100%),
    repeating-linear-gradient(0deg, rgba(123, 255, 175, 0.018) 0 1px, transparent 1px 4px);
  box-shadow: inset 0 0 70px rgba(0, 0, 0, 0.36);
}

.echo-booth[data-program="focus"] .booth-atmosphere {
  background:
    linear-gradient(135deg, rgba(150, 190, 198, 0.12), transparent 44%),
    linear-gradient(90deg, transparent 42%, rgba(1, 7, 9, 0.16) 54%, rgba(1, 7, 9, 0.58) 100%);
}

.echo-booth[data-program="drive"] .booth-atmosphere {
  background:
    linear-gradient(145deg, rgba(217, 154, 78, 0.13), transparent 46%),
    linear-gradient(90deg, transparent 42%, rgba(1, 7, 9, 0.14) 54%, rgba(1, 7, 9, 0.56) 100%);
}

.echo-booth[data-program="surge"] .booth-atmosphere {
  background:
    radial-gradient(circle at 27% 54%, rgba(217, 154, 78, 0.13), transparent 30%),
    linear-gradient(90deg, transparent 40%, rgba(1, 7, 9, 0.18) 54%, rgba(1, 7, 9, 0.65) 100%);
}

.echo-wire {
  position: absolute;
  z-index: 2;
  inset: 7% 4% 7% auto;
  display: flex;
  flex-direction: column;
  width: 43%;
  padding: 18px;
  overflow: hidden;
  border: 1px solid rgba(217, 154, 78, 0.2);
  border-radius: 16px;
  background: rgba(2, 8, 9, 0.68);
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(10px);
}

.echo-wire-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(217, 154, 78, 0.16);
}

.echo-wire .label {
  margin-bottom: 5px;
  color: rgba(217, 154, 78, 0.82);
}

.echo-wire h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.booth-presence {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
  color: rgba(231, 255, 238, 0.52);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.booth-presence i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(217, 154, 78, 0.38);
  transition: background 160ms ease, box-shadow 160ms ease;
}

.echo-booth.is-playing .booth-presence i {
  background: var(--accent);
  box-shadow: 0 0 12px rgba(123, 255, 175, 0.75);
}

.echo-wire-list {
  min-height: 0;
  margin: 0;
  padding: 4px 0 0;
  overflow: auto;
  list-style: none;
  scrollbar-color: rgba(217, 154, 78, 0.28) transparent;
}

.echo-wire-list li {
  display: grid;
  grid-template-columns: 3.4rem 1fr;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(231, 255, 238, 0.08);
  animation: wire-in 420ms ease both;
}

.echo-wire-list time {
  padding-top: 2px;
  color: var(--echo-amber);
  font-size: 0.66rem;
}

.echo-wire-list p {
  margin: 0;
  color: rgba(231, 255, 238, 0.84);
  font-size: clamp(0.72rem, 1.25vw, 0.84rem);
  line-height: 1.45;
}

.echo-wire-footer {
  margin: auto 0 0;
  padding-top: 10px;
  color: rgba(231, 255, 238, 0.4);
  font-size: 0.62rem;
  line-height: 1.45;
}

.echo-wire-footer a {
  color: rgba(217, 154, 78, 0.82);
}

.program-context {
  margin: 0 0 20px;
  padding: 16px;
  border: 1px solid rgba(123, 255, 175, 0.12);
  border-radius: 16px;
  background: rgba(2, 6, 4, 0.42);
}

#program-description {
  margin: 0 0 14px;
  max-width: 720px;
  color: var(--muted);
  line-height: 1.5;
}

.dayparts {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.dayparts li {
  padding: 10px 12px;
  border: 1px solid rgba(123, 255, 175, 0.1);
  border-radius: 12px;
  color: rgba(231, 255, 238, 0.48);
}

.dayparts li.is-current {
  border-color: rgba(123, 255, 175, 0.42);
  background: var(--accent-soft);
  color: var(--text);
}

.dayparts time,
.dayparts span {
  display: block;
}

.dayparts time {
  margin-bottom: 4px;
  font-size: 0.7rem;
  color: var(--muted);
}

.dayparts span {
  font-size: 0.82rem;
}

.time-note {
  margin: 10px 0 0;
  color: rgba(231, 255, 238, 0.44);
  font-size: 0.7rem;
}

.activity-shell {
  margin: 0 0 20px;
  padding: 14px 16px 12px;
  border: 1px solid rgba(123, 255, 175, 0.12);
  border-radius: 16px;
  background:
    linear-gradient(rgba(123, 255, 175, 0.035) 1px, transparent 1px),
    rgba(2, 6, 4, 0.62);
  background-size: 100% 25%;
  overflow: hidden;
}

.activity-shell figcaption {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
  color: rgba(231, 255, 238, 0.44);
  font-size: 0.7rem;
}

.activity-shell .label {
  margin: 0;
}

#pattern-activity {
  display: block;
  width: 100%;
  height: 132px;
}

.status-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: baseline;
  margin-bottom: 18px;
  min-height: 24px;
}

.status,
.copy-status {
  margin: 0;
  color: var(--muted);
}

.controls {
  flex-wrap: wrap;
  align-items: center;
  min-width: 0;
  margin-bottom: 22px;
}

.toggle,
.utility {
  font: inherit;
  border: 1px solid rgba(123, 255, 175, 0.28);
  cursor: pointer;
  transition:
    transform 140ms ease,
    border-color 140ms ease,
    background 140ms ease;
}

.toggle:hover,
.toggle:focus-visible,
.utility:hover,
.utility:focus-visible,
.remix-link:hover,
.remix-link:focus-visible,
.footer a:hover,
.footer a:focus-visible {
  outline: none;
  border-color: var(--accent);
  transform: translateY(-1px);
}

.toggle {
  padding: 16px 24px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(123, 255, 175, 0.24), rgba(123, 255, 175, 0.12));
  color: var(--text);
  font-size: 1.05rem;
  min-width: 180px;
}

.utility {
  padding: 12px 16px;
  border-radius: 14px;
  background: transparent;
  color: var(--accent);
}

.remix-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid transparent;
  color: var(--accent);
  text-decoration: none;
  overflow-wrap: anywhere;
}

.code-shell {
  min-width: 0;
  padding: 18px;
  border-radius: 18px;
  border: 1px solid rgba(123, 255, 175, 0.12);
  background: rgba(2, 6, 4, 0.78);
}

#pattern-code {
  margin: 0;
  max-width: 100%;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  line-height: 1.55;
  color: #d8ffe7;
}

.kc-shows {
  padding: 34px 0 10px;
}

.kc-shows-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--panel-border);
}

.kc-shows h2 {
  margin: 0;
  font-size: 1.25rem;
}

.kc-shows-header > a {
  font-size: 0.82rem;
}

.kc-shows-status {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.kc-shows-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.kc-show {
  display: grid;
  grid-template-columns: minmax(7rem, 0.32fr) 1fr;
  gap: 18px;
  padding: 14px 0;
  border-bottom: 1px solid rgba(116, 255, 176, 0.12);
}

.kc-show time {
  color: var(--accent);
  font-size: 0.82rem;
}

.kc-show-copy {
  min-width: 0;
}

.kc-show-copy a {
  color: var(--text);
  font-weight: 700;
  overflow-wrap: anywhere;
}

.kc-show-copy span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.84rem;
}

.footer {
  flex-wrap: wrap;
  margin-top: 20px;
  color: var(--muted);
  font-size: 0.92rem;
}

.footer p {
  margin: 0;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 0.45;
    transform: scaleY(0.82);
  }
  50% {
    opacity: 1;
    transform: scaleY(1);
  }
}

@keyframes booth-breathe {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.006);
  }
}

@keyframes booth-blink {
  0%,
  38%,
  40%,
  43%,
  100% {
    opacity: 0;
  }
  38.4%,
  39.3%,
  41.5%,
  42.2% {
    opacity: 1;
  }
}

@keyframes wire-in {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .booth-scene,
  .booth-frame-blink,
  .signal span,
  .echo-wire-list li {
    animation: none;
  }

  .booth-frame-blink {
    opacity: 0;
  }
}

@media (max-width: 720px) {
  .family-bar {
    justify-content: center;
    gap: 1.6rem;
  }

  .family-bar > * {
    flex: 0 0 auto;
  }

  .family-label {
    display: none;
  }

  .family-bar a span {
    display: none;
  }

  .shell {
    padding: 28px 16px 48px;
  }

  .dayparts {
    grid-template-columns: repeat(2, 1fr);
  }

  .echo-booth {
    display: flex;
    flex-direction: column;
    aspect-ratio: auto;
  }

  .booth-scene {
    position: relative;
    inset: auto;
    flex: 0 0 auto;
    width: 100%;
    aspect-ratio: 16 / 9;
  }

  .booth-atmosphere {
    bottom: auto;
    height: auto;
    aspect-ratio: 16 / 9;
  }

  .echo-wire {
    position: relative;
    inset: auto;
    width: 100%;
    min-height: 270px;
    border: 0;
    border-top: 1px solid rgba(217, 154, 78, 0.18);
    border-radius: 0;
    background: rgba(2, 8, 9, 0.94);
    backdrop-filter: none;
  }

  .echo-wire-list {
    max-height: 220px;
  }

  .card {
    padding: 18px;
    border-radius: 18px;
  }

  .status-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .toggle,
  .utility,
  .remix-link {
    width: 100%;
    justify-content: center;
    text-align: center;
  }

  .kc-show {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}
