@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500&display=swap");

:root {
  color-scheme: dark;
}

body {
  overflow: hidden;
  margin: 0;
  font-family: "Space Grotesk", "Helvetica Neue", sans-serif;
  color: #f5f5f5;
}

canvas {
  display: block;
}

.control-panel {
  position: fixed;
  top: 1.5rem;
  left: 1.5rem;
  width: clamp(220px, 22vw, 320px);
  max-height: calc(100vh - 3rem);
  overflow-y: auto;
  padding: 1rem 1.25rem;
  background: rgba(3, 3, 3, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  backdrop-filter: blur(18px);
  box-shadow: 0 25px 55px rgba(0, 0, 0, 0.25);
  font-size: 0.85rem;
  z-index: 10;
}

.control-panel__title {
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.75);
  margin-bottom: 0.75rem;
}

.control-panel label {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 0.85rem;
  color: rgba(255, 255, 255, 0.85);
}

.control-panel input[type="text"] {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  color: inherit;
  padding: 0.4rem 0.6rem;
  font-size: 0.9rem;
}

.control-panel input[type="range"] {
  appearance: none;
  height: 4px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  outline: none;
}

.control-panel input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.2);
}

.control-panel input[type="color"] {
  border: none;
  width: 100%;
  height: 32px;
  padding: 0;
  background: transparent;
}

.control-panel__swatch span {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.control-panel__mic-btn {
  flex: 1;
  padding: 0.45rem 0.5rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.82rem;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
  white-space: nowrap;
}

.control-panel__mic-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

.control-panel__mic-btn--active {
  background: rgba(220, 80, 80, 0.35);
  border-color: rgba(220, 80, 80, 0.7);
  color: #fff;
}

.control-panel select {
  appearance: none;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.85);
  padding: 0.4rem 0.6rem;
  font-size: 0.85rem;
  cursor: pointer;
  width: 100%;
  outline: none;
}

.control-panel select:hover {
  background: rgba(255, 255, 255, 0.1);
}

.control-panel input[type="file"] {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.75);
  cursor: pointer;
  width: 100%;
}

/* ---- Save-config row ---------------------------------------------------- */

.control-panel__save-row {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.control-panel__save-row input[type="text"] {
  flex: 1;
  min-width: 0;
}

/* Generic small action button used in save row and config items */
.control-panel__btn {
  flex-shrink: 0;
  padding: 0.4rem 0.6rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.8rem;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s, border-color 0.2s;
}

.control-panel__btn:hover {
  background: rgba(255, 255, 255, 0.13);
}

.control-panel__btn--active {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.38);
}

/* ---- Saved-configurations panel ----------------------------------------- */

.configs-panel {
  left: calc(clamp(220px, 22vw, 320px) + 3rem);
  width: clamp(240px, 26vw, 360px);
}

.config-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.config-item:last-child {
  border-bottom: none;
}

.config-item__name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.85);
}

.config-item__name-input {
  flex: 1;
  min-width: 0;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 6px;
  color: inherit;
  padding: 0.25rem 0.5rem;
  font-size: 0.82rem;
  outline: none;
}

/* ---- UI visibility toggle (top-right corner) ---------------------------- */

.ui-toggle {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(3, 3, 3, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(18px);
  color: rgba(255, 255, 255, 0.75);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
}

.ui-toggle:hover {
  background: rgba(30, 30, 30, 0.88);
  color: rgba(255, 255, 255, 0.95);
}