:root {
  --bg: #03070d;
  --glass: rgba(5, 12, 22, 0.72);
  --glass-strong: rgba(5, 12, 22, 0.88);
  --border: rgba(91, 196, 255, 0.28);
  --blue: #38a8ff;
  --cyan: #5ee7ff;
  --green: #3cff9a;
  --red: #ff4d4d;
  --text: #eef7ff;
  --muted: #9fb4c8;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow: hidden;
}

.pulse-shell {
  position: relative;
  width: 100vw;
  height: 100vh;
}

#pulseWebgl {
  position: fixed;
  inset: 0;
  z-index: 0;
}

.studio-stage {
  position: relative;
  width: 100%;
  height: 100%;
  padding: 18px;
  z-index: 1;
}

.studio-bg {
  position: absolute;
  inset: 86px 16px 76px 150px;
  width: calc(100% - 166px);
  height: calc(100% - 162px);
  object-fit: cover;
  border-radius: 24px;
  filter: brightness(0.72) saturate(1.15);
  box-shadow: 0 0 60px rgba(0, 0, 0, 0.75);
  z-index: 1;
}

.glass {
  background: linear-gradient(145deg, rgba(6, 15, 28, 0.82), rgba(3, 9, 17, 0.72));
  border: 1px solid var(--border);
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.5),
    inset 0 0 28px rgba(56, 168, 255, 0.05);
  backdrop-filter: blur(18px);
  border-radius: 18px;
}

.topbar {
  position: relative;
  z-index: 5;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  background: rgba(2, 7, 14, 0.7);
  border-bottom: 1px solid rgba(91, 196, 255, 0.12);
}

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

.brand img {
  width: 70px;
  height: 34px;
}

.brand h1 {
  margin: 0;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 24px;
}

.brand p {
  margin: 2px 0 0;
  color: var(--blue);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.mode-pill {
  color: var(--cyan);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.mode-pill span {
  display: inline-block;
  width: 10px;
  height: 10px;
  background: var(--green);
  border-radius: 999px;
  box-shadow: 0 0 16px var(--green);
  margin-right: 8px;
}

.side-nav {
  position: absolute;
  z-index: 6;
  top: 98px;
  left: 18px;
  width: 120px;
  padding: 10px;
  border-radius: 18px;
  background: rgba(4, 10, 18, 0.82);
  border: 1px solid rgba(91, 196, 255, 0.2);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.side-nav button {
  height: 74px;
  border-radius: 14px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 15px;
  cursor: pointer;
}

.side-nav button:hover,
.side-nav .nav-active {
  color: var(--cyan);
  border-color: rgba(56, 168, 255, 0.35);
  background: rgba(56, 168, 255, 0.1);
}

.create-card,
.control-card,
.chat-card {
  position: absolute;
  z-index: 8;
  bottom: 96px;
  padding: 22px;
}

.create-card {
  left: 172px;
  width: 430px;
}

.control-card {
  left: 616px;
  width: 350px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.chat-card {
  right: 32px;
  width: 540px;
}

h2 {
  margin: 0 0 14px;
  color: var(--blue);
  text-transform: uppercase;
  font-size: 15px;
  letter-spacing: 0.08em;
}

label {
  display: block;
  margin: 12px 0 8px;
  color: white;
  font-size: 14px;
}

textarea,
select {
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(91, 196, 255, 0.22);
  background: rgba(0, 5, 12, 0.68);
  color: var(--text);
  padding: 14px;
  outline: none;
}

textarea {
  min-height: 84px;
  resize: none;
}

.chat-card textarea {
  min-height: 118px;
}

.start-btn,
.end-btn,
#sendDirectiveBtn {
  width: 100%;
  border: none;
  border-radius: 14px;
  height: 64px;
  color: white;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
}

.start-btn {
  background: linear-gradient(135deg, rgba(14, 180, 100, 0.95), rgba(0, 80, 50, 0.8));
  box-shadow: 0 0 28px rgba(60, 255, 154, 0.25);
  border: 1px solid rgba(60, 255, 154, 0.7);
}

.end-btn {
  background: linear-gradient(135deg, rgba(230, 55, 55, 0.95), rgba(80, 0, 0, 0.8));
  box-shadow: 0 0 28px rgba(255, 77, 77, 0.22);
  border: 1px solid rgba(255, 77, 77, 0.65);
}

#sendDirectiveBtn {
  margin-top: 10px;
  height: 44px;
  background: linear-gradient(135deg, #1b75ff, #0b357c);
}

.status-box {
  border: 1px solid rgba(91, 196, 255, 0.22);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  justify-content: space-between;
}

.status-box span {
  color: var(--muted);
}

.status-box strong {
  color: var(--blue);
}

audio {
  width: 100%;
}

.quick-prompts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 14px;
}

.quick-prompts button {
  border: 1px solid rgba(91, 196, 255, 0.22);
  background: rgba(0, 8, 18, 0.7);
  color: var(--text);
  border-radius: 10px;
  padding: 10px;
  cursor: pointer;
}

.library-panel {
  position: absolute;
  z-index: 20;
  top: 100px;
  right: 34px;
  width: 480px;
  max-height: calc(100vh - 200px);
  padding: 22px;
  display: none;
  overflow: auto;
}

.library-panel.open {
  display: block;
}

.library-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.library-head button {
  background: rgba(255,255,255,0.08);
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 10px;
  padding: 8px 12px;
}

.library-item {
  border: 1px solid rgba(91, 196, 255, 0.18);
  border-radius: 14px;
  padding: 14px;
  margin-top: 12px;
  background: rgba(0, 6, 14, 0.6);
}

.library-item h3 {
  margin: 0 0 6px;
}

.library-item p {
  margin: 0 0 10px;
  color: var(--muted);
}

.library-item button {
  background: rgba(56,168,255,0.18);
  border: 1px solid rgba(56,168,255,0.4);
  color: var(--cyan);
  border-radius: 10px;
  padding: 8px 12px;
}

.bottom-status {
  position: absolute;
  z-index: 9;
  left: 18px;
  right: 18px;
  bottom: 18px;
  height: 58px;
  border-radius: 16px;
  background: rgba(2, 8, 16, 0.88);
  border: 1px solid rgba(91, 196, 255, 0.15);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  align-items: center;
  padding: 0 22px;
  color: var(--muted);
}

.bottom-status strong {
  color: var(--green);
}

.meter {
  display: inline-block;
  width: 120px;
  height: 10px;
  margin-left: 10px;
  border-radius: 99px;
  background: repeating-linear-gradient(
    90deg,
    var(--green) 0,
    var(--green) 5px,
    transparent 5px,
    transparent 9px
  );
}
