:root {
  --bg0: #0c1210;
  --bg1: #152019;
  --ink: #e8f0ea;
  --muted: #8fa396;
  --line: #2a3b31;
  --accent: #3ecf8e;
  --accent-dim: #1f6b48;
  --danger: #e85d5d;
  --field: #0a100e;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "DM Sans", system-ui, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 10% -10%, #1a3d2c 0%, transparent 55%),
    radial-gradient(900px 500px at 100% 0%, #243528 0%, transparent 50%),
    linear-gradient(165deg, var(--bg0), var(--bg1) 55%, #0e1612);
  min-height: 100vh;
}

.glow {
  position: fixed;
  inset: auto -20% -30% auto;
  width: 55vw;
  height: 55vw;
  background: radial-gradient(circle, rgba(62, 207, 142, 0.12), transparent 65%);
  pointer-events: none;
  z-index: 0;
}

.shell {
  position: relative;
  z-index: 1;
  max-width: 920px;
  margin: 0 auto;
  padding: 48px 20px 64px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 16px;
  align-items: start;
}

.main-column {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.layout .panel {
  margin-bottom: 0;
}

.main-column .actions {
  margin: 0;
}

.log-panel {
  height: 100%;
  align-self: stretch;
}

header h1 {
  font-family: "Instrument Serif", Georgia, serif;
  font-size: clamp(2.4rem, 8vw, 3.4rem);
  font-weight: 400;
  line-height: 1.05;
  margin: 0;
  letter-spacing: -0.02em;
}

.brand-header {
  margin-bottom: 24px;
}

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

.brand-monkey {
  width: 112px;
  height: auto;
  max-height: 78px;
  object-fit: contain;
  flex-shrink: 0;
  image-rendering: auto;
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.28));
}

.monkey-emote {
  display: inline-block;
  width: 28px;
  height: auto;
  margin-right: 6px;
  vertical-align: -6px;
  image-rendering: pixelated;
}

.eyebrow {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent);
}

.lede {
  display: none;
}

.panel {
  background: rgba(10, 16, 14, 0.72);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 20px;
  backdrop-filter: blur(10px);
  margin-bottom: 16px;
}

.field-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--muted);
}

.channel-input {
  width: 100%;
  font-size: 1.35rem;
  font-weight: 600;
  padding: 16px 18px;
  border-radius: 12px;
  border: 2px solid var(--line);
  background: var(--field);
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  margin-bottom: 12px;
}

.controls-panel .actions {
  margin: 0 0 16px;
}

.voice-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.voice-head .field-label {
  margin-bottom: 0;
}

.voice-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.queue-hint {
  margin: 0 0 10px;
  font-size: 0.75rem;
  color: var(--muted);
  min-height: 1.1em;
}

.voice-list {
  display: block;
  width: 100%;
  font-size: 1.05rem;
  font-weight: 600;
  padding: 6px;
  border-radius: 12px;
  border: 2px solid var(--line);
  background: var(--field);
  color: var(--ink);
  margin-bottom: 14px;
  cursor: pointer;
  min-height: 9.5rem;
  appearance: auto;
  -webkit-appearance: listbox;
}

.voice-list option {
  padding: 10px 12px;
  border-radius: 8px;
  margin: 2px 0;
  color: var(--ink);
  background: var(--field);
}

.voice-list option:checked,
.voice-list option:hover {
  background: rgba(62, 207, 142, 0.22);
}

.btn-test {
  appearance: none;
  border: 2px solid var(--line);
  background: var(--field);
  color: var(--ink);
  font-weight: 700;
  font-size: 0.95rem;
  padding: 8px 16px;
  border-radius: 12px;
  cursor: pointer;
  flex-shrink: 0;
}

.btn-test:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Remove old broken dropdown / chip styles from interfering */
.voice-row,
.choice-row,
.choice-btn,
.voice-select {
  /* no-op leftovers avoided — classes unused */
}

.audio-row {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 4px;
}

.toggle-row {
  display: flex;
  gap: 10px;
  margin: 4px 0 12px;
}

.btn-mute {
  appearance: none;
  border: 2px solid var(--line);
  background: var(--field);
  color: var(--ink);
  font-weight: 700;
  font-size: 0.95rem;
  padding: 12px 16px;
  border-radius: 12px;
  cursor: pointer;
  flex: 1;
  min-width: 0;
}

.btn-mute.is-muted {
  border-color: var(--danger);
  color: #ffd0d0;
  background: rgba(232, 93, 93, 0.15);
}

.volume-wrap {
  flex: 1;
  min-width: 0;
}

.volume-label {
  margin-bottom: 6px;
}

.volume-slider {
  width: 100%;
  accent-color: var(--accent);
  cursor: pointer;
}

.volume-slider:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.volume-value {
  display: inline-block;
  margin-top: 4px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.pitch-wrap {
  display: block;
  margin: 12px 0 4px;
}

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

.pitch-row .volume-slider {
  flex: 1;
  min-width: 0;
}

.pitch-row .volume-value {
  margin-top: 0;
  min-width: 3.2rem;
  text-align: right;
}

.pitch-hint {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}


.voice-select:focus,
.channel-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(62, 207, 142, 0.18);
}

.channel-input::placeholder {
  color: #4d6356;
  font-weight: 500;
}

.btn-primary {
  appearance: none;
  border: 0;
  cursor: pointer;
  width: 100%;
  padding: 16px 20px;
  border-radius: 12px;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #04140c;
  background: linear-gradient(180deg, #55e0a0, var(--accent));
  box-shadow: 0 10px 28px rgba(62, 207, 142, 0.25);
  transition: transform 0.12s ease, filter 0.12s ease;
}

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

.btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  filter: none;
  box-shadow: none;
}

.btn-primary:active {
  transform: translateY(1px);
}

.btn-primary.stopping {
  color: #fff;
  background: linear-gradient(180deg, #f07878, var(--danger));
  box-shadow: 0 10px 28px rgba(232, 93, 93, 0.22);
}

.hint-status {
  margin: 10px 0 0;
  font-size: 0.85rem;
  color: var(--muted);
  min-height: 1.2em;
}

.voice-info {
  margin: 10px 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.log-panel h2,
.filters-panel h2 {
  margin: 0 0 12px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.filters-panel {
  margin-top: 16px;
}

.filter-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.filter-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: 10px;
  row-gap: 2px;
  align-items: start;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
}

.filter-item input {
  grid-row: 1 / span 2;
  margin-top: 3px;
  accent-color: var(--accent);
  cursor: pointer;
}

.filter-name {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--ink);
}

.filter-desc {
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.3;
}

.connection-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 16px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
}

.conn-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: #6b7f73;
  box-shadow: 0 0 0 3px rgba(107, 127, 115, 0.16);
}

.conn-dot[data-state="connecting"] {
  background: #e0b34a;
  box-shadow: 0 0 0 3px rgba(224, 179, 74, 0.18);
  animation: pulse-dot 1.1s ease-in-out infinite;
}

.conn-dot[data-state="connected"] {
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(62, 207, 142, 0.2);
}

.conn-dot[data-state="error"] {
  background: var(--danger);
  box-shadow: 0 0 0 3px rgba(232, 93, 93, 0.18);
}

.conn-dot[data-state="disconnected"] {
  background: #6b7f73;
  box-shadow: 0 0 0 3px rgba(107, 127, 115, 0.16);
}

@keyframes pulse-dot {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.45;
  }
}

.connection-text {
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 10px;
}

.conn-state {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.conn-detail {
  margin: 0;
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.3;
}

.log-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.log {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1;
  min-height: 180px;
  max-height: min(420px, 55vh);
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.log li {
  font-size: 0.92rem;
  line-height: 1.35;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.04);
  color: #c5d6cb;
}

.log li:first-child {
  border-color: rgba(62, 207, 142, 0.35);
  color: var(--ink);
}

@media (max-width: 760px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .log {
    max-height: 220px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .btn-primary,
  .channel-input {
    transition: none;
  }

  .conn-dot[data-state="connecting"] {
    animation: none;
  }
}
