:root {
  color-scheme: dark;
  --bg: #05091e;
  --surface: #0a112b;
  --ink: #f4f0df;
  --muted: #8f99b3;
  --line: rgba(124, 151, 197, .17);
  --cyan: #35d4ec;
  --green: #58e0a5;
  --orange: #ffad4c;
  --violet: #bd8cff;
  --serif: "DM Serif Display", Georgia, serif;
  --sans: Inter, system-ui, sans-serif;
  --mono: "DM Mono", monospace;
}

html { min-width: 320px; min-height: 100%; background: var(--bg); }
body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  font-family: var(--sans);
  background:
    linear-gradient(rgba(124,151,197,.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(124,151,197,.07) 1px, transparent 1px),
    radial-gradient(circle at 77% 34%, rgba(28,105,149,.16), transparent 35%),
    var(--bg);
  background-size: 72px 72px, 72px 72px, auto, auto;
}
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }

.topbar {
  height: 76px;
  padding: 0 clamp(20px, 3.2vw, 52px);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  border-bottom: 1px solid var(--line);
  background: rgba(5,9,30,.82);
  backdrop-filter: blur(18px);
  position: relative;
  z-index: 5;
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 700; }
.brand img { filter: drop-shadow(0 0 12px rgba(53,212,236,.28)); }
.page-label { color: #74809c; font: 500 10px/1 var(--mono); letter-spacing: .16em; }
.top-actions { justify-self: end; display: flex; align-items: center; gap: 8px; }
.quiet-button, .home-link {
  height: 36px;
  padding: 0 13px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: rgba(124,151,197,.045);
  color: #aeb5c8;
  font-size: 11px;
  text-decoration: none;
}
.quiet-button:hover, .home-link:hover { color: var(--ink); border-color: rgba(53,212,236,.4); background: rgba(53,212,236,.08); }
.home-link { width: 36px; padding: 0; border-radius: 50%; font-size: 23px; font-weight: 300; }

.app {
  min-height: calc(100vh - 76px);
  display: grid;
  grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
}
.library {
  padding: 38px 28px 32px;
  border-right: 1px solid var(--line);
  background: rgba(5,9,30,.56);
}
.library-head h1, .studio-head h2 {
  margin: 0;
  font: 400 32px/1.1 var(--serif);
  letter-spacing: -.02em;
}
.library-head > p:last-child { margin: 11px 0 24px; color: var(--muted); font-size: 13px; line-height: 1.55; }
.eyebrow { margin: 0 0 9px; color: var(--cyan); font: 500 10px/1 var(--mono); letter-spacing: .15em; }

.band-tabs { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; margin-bottom: 20px; }
.band-tab {
  height: 54px;
  padding: 7px 4px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: rgba(124,151,197,.035);
  color: #737e9b;
  font: 500 9px/1 var(--mono);
  transition: border-color .2s, background .2s, color .2s;
}
.band-tab::after { content: ""; display: block; width: 18px; height: 2px; margin: 8px auto 0; border-radius: 2px; background: var(--band-color); box-shadow: 0 0 9px var(--band-color); }
.band-tab[aria-selected="true"] { color: var(--ink); border-color: color-mix(in srgb, var(--band-color) 55%, transparent); background: color-mix(in srgb, var(--band-color) 9%, transparent); }

.symbol-search { height: 42px; padding: 0 12px; display: flex; align-items: center; gap: 9px; border: 1px solid var(--line); border-radius: 3px; background: rgba(7,14,34,.8); }
.symbol-search:focus-within { border-color: rgba(53,212,236,.5); }
.symbol-search svg { width: 16px; fill: none; stroke: #75809b; stroke-width: 1.7; }
.symbol-search input { width: 100%; border: 0; outline: 0; background: none; color: var(--ink); font-size: 12px; }
.symbol-search input::placeholder { color: #626d88; }
.filter-row { display: flex; gap: 5px; margin: 12px 0; overflow-x: auto; scrollbar-width: none; }
.filter {
  flex: none;
  padding: 6px 9px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: #717c97;
  font-size: 10px;
}
.filter.active { border-color: var(--line); background: rgba(124,151,197,.08); color: #cbd0de; }
.symbol-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px; }
.symbol-option {
  aspect-ratio: 1;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: linear-gradient(145deg, rgba(124,151,197,.055), rgba(8,14,37,.5));
  font-family: var(--serif);
  font-size: 23px;
  color: #c9cddd;
  position: relative;
  transition: transform .16s, border-color .16s, background .16s;
}
.symbol-option:hover { transform: translateY(-2px); border-color: rgba(53,212,236,.38); }
.symbol-option.selected { color: var(--active-color); border-color: color-mix(in srgb, var(--active-color) 58%, transparent); background: color-mix(in srgb, var(--active-color) 10%, transparent); box-shadow: inset 0 0 18px color-mix(in srgb, var(--active-color) 6%, transparent); }
.symbol-option.selected::after { content: ""; position: absolute; top: 5px; right: 5px; width: 4px; height: 4px; border-radius: 50%; background: var(--active-color); box-shadow: 0 0 7px var(--active-color); }
.empty-search { grid-column: 1 / -1; padding: 24px 0; color: var(--muted); text-align: center; font-size: 12px; }

.studio { min-width: 0; padding: 38px clamp(24px, 4vw, 70px) 28px; display: flex; flex-direction: column; }
.studio-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 27px; }
.studio-head h2 { font-size: clamp(28px, 3vw, 42px); }
.speed-control { display: flex; align-items: center; gap: 10px; color: var(--muted); font: 500 10px/1 var(--mono); text-transform: uppercase; }
.speed-control input { width: 95px; accent-color: var(--cyan); }
.speed-control output { min-width: 36px; color: #c6ccda; }

.bands-stage {
  flex: 1;
  min-height: 520px;
  display: block;
}
.morph-band {
  min-height: 100%;
  overflow: hidden;
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(260px, 1fr) auto;
  padding: 20px 24px 25px;
  border: 1px solid color-mix(in srgb, var(--band-color) 23%, var(--line));
  border-radius: 3px;
  background:
    radial-gradient(ellipse at 50% 52%, color-mix(in srgb, var(--band-color) 15%, transparent), transparent 60%),
    linear-gradient(135deg, color-mix(in srgb, var(--band-color) 5%, rgba(8,14,37,.94)), rgba(5,9,30,.9));
  cursor: pointer;
  transition: border-color .2s, transform .2s;
}
.morph-band:hover { border-color: color-mix(in srgb, var(--band-color) 45%, transparent); }
.morph-band.selected { border-color: color-mix(in srgb, var(--band-color) 65%, transparent); box-shadow: 0 0 28px color-mix(in srgb, var(--band-color) 7%, transparent); }
.band-head { display: flex; align-items: center; justify-content: space-between; position: relative; z-index: 2; }
.band-name { color: #d1d5e1; font: 500 10px/1 var(--mono); letter-spacing: .12em; }
.band-status { width: 6px; height: 6px; border-radius: 50%; background: var(--band-color); box-shadow: 0 0 10px var(--band-color); opacity: .5; }
.playing .band-status { opacity: 1; animation: blink 1.2s ease-in-out infinite; }
.glyph-stage { display: grid; place-items: center; position: relative; }
.morph-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.glyph-stage::before {
  display: none;
}
.glyph {
  position: absolute;
  z-index: 1;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.symbol-explanation {
  width: min(100%, 680px);
  margin: 0 auto;
  padding: 20px clamp(10px, 4vw, 42px) 0;
  border-top: 1px solid color-mix(in srgb, var(--band-color) 20%, transparent);
  text-align: center;
}
.symbol-meaning {
  color: var(--band-color);
  font: 400 clamp(28px, 3vw, 42px)/1 var(--serif);
}
.symbol-explanation p {
  max-width: 560px;
  margin: 11px auto 14px;
  color: #acb4c8;
  font: 400 13px/1.7 var(--sans);
}
.symbol-explanation code {
  display: inline-block;
  padding: 7px 11px;
  border: 1px solid color-mix(in srgb, var(--band-color) 18%, transparent);
  border-radius: 3px;
  color: #dfe2ec;
  background: rgba(5,9,30,.38);
  font: 500 12px/1 var(--mono);
}

.transport {
  min-height: 82px;
  margin-top: 18px;
  padding: 13px 14px 13px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: rgba(7,14,34,.78);
}
.transport-copy { display: flex; flex-direction: column; gap: 6px; }
.transport-copy span { color: var(--cyan); font: 500 9px/1 var(--mono); letter-spacing: .13em; }
.transport-copy strong { color: #a6aec1; font-size: 12px; font-weight: 500; }
.play-button {
  min-width: 174px;
  height: 52px;
  padding: 0 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 0;
  border-radius: 3px;
  background: linear-gradient(105deg, var(--cyan), var(--green));
  color: #03151f;
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 8px 28px rgba(53,212,236,.19);
}
.play-button:hover { filter: brightness(1.07); }
.play-button svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; }
.play-button .play-icon { fill: currentColor; stroke: none; }
.pause-icon, .play-button.playing .play-icon { display: none; }
.play-button.playing .pause-icon { display: block; }

@keyframes breathe { 50% { transform: scale(1.055); filter: drop-shadow(0 0 10px var(--band-color)); } }
@keyframes blink { 50% { opacity: .35; } }

@media (max-width: 980px) {
  .app { grid-template-columns: 290px minmax(0, 1fr); }
  .library { padding: 30px 20px; }
  .studio { padding: 30px 22px 24px; }
  .bands-stage { min-height: 520px; }
  .morph-band { min-height: 520px; }
}
@media (max-width: 700px) {
  .topbar { height: 68px; grid-template-columns: 1fr auto; padding: 0 18px; }
  .brand { font-size: 14px; }
  .brand img { width: 30px; height: 30px; }
  .page-label, .quiet-button { display: none; }
  .app { grid-template-columns: 1fr; }
  .library { border-right: 0; border-bottom: 1px solid var(--line); }
  .symbol-grid { grid-template-columns: repeat(8, 1fr); }
  .symbol-option { font-size: 20px; }
  .studio { padding-top: 28px; }
  .studio-head { align-items: flex-start; flex-direction: column; }
  .bands-stage { min-height: auto; }
  .morph-band { min-height: 520px; }
  .glyph { font-size: clamp(110px, 34vw, 170px); }
}
@media (max-width: 430px) {
  .library { padding: 26px 16px; }
  .symbol-grid { grid-template-columns: repeat(6, 1fr); }
  .studio { padding: 28px 16px 20px; }
  .transport { padding: 12px; }
  .transport-copy strong { max-width: 90px; line-height: 1.35; }
  .play-button { min-width: 145px; padding: 0 15px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
