html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background:
    radial-gradient(
      circle at 20% 20%,
      rgba(45, 57, 114, 0.3),
      rgba(2, 2, 15, 0.9)
    ),
    radial-gradient(
    circle at 80% 80%,
    rgba(7, 40, 94, 0.25),
    rgba(2, 2, 10, 0.95)
  ),
    #00000e;
  color: #fff;
  font-family:
    "Inter", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

.firefly-wrapper {
  width: 100vw;
  height: 100vh;
  position: relative;
  background:
    radial-gradient(
      circle at 30% 20%,
      rgba(45, 68, 139, 0.35),
      transparent 55%
    ),
    radial-gradient(circle at 70% 80%, rgba(12, 40, 88, 0.35), transparent 55%),
    #010013;
}

.firefly-canvas {
  width: 100%;
  height: 100%;
  display: block;
  filter: drop-shadow(0 0 50px rgba(255, 255, 190, 0.05));
}

.primary-bar {
  position: absolute;
  top: 20px;
  left: 20px;
  z-index: 3;
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  background-color: rgba(12, 12, 22, 0.45);
  border-radius: 999px;
  backdrop-filter: blur(10px);
}

.ghost-btn {
  background-color: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  padding: 8px 18px;
  cursor: pointer;
  transition:
    background-color 0.25s ease,
    color 0.25s ease,
    transform 0.25s ease;
}

.ghost-btn:hover,
.ghost-btn:focus-visible {
  background-color: rgba(255, 193, 111, 0.9);
  color: #0f0f19;
  transform: translateY(-1px);
}

.controls-root {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(380px, calc(100vw - 40px));
}

.controls-toggle {
  width: 100%;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(12, 12, 22, 0.7);
  color: rgba(255, 255, 255, 0.9);
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.controls-toggle:hover,
.controls-toggle:focus-visible {
  background: rgba(255, 255, 255, 0.9);
  color: #0e1020;
  transform: translateY(-1px);
}

.controls-panel {
  width: 100%;
  margin-top: 12px;
  padding: 0 8px 8px;
  border-radius: 16px;
  background: rgba(5, 5, 15, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5);
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 0.35s ease, opacity 0.35s ease;
}

.controls-root.open .controls-panel {
  max-height: 70vh;
  opacity: 1;
}

.preset-panel {
  margin: 12px 12px 0;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.03);
}

.preset-panel-title {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 4px;
}

.preset-panel-copy {
  margin: 0 0 10px;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.7);
}

.preset-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.preset-btn {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  padding: 10px 12px;
  text-align: left;
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.9);
  cursor: pointer;
  transition:
    background-color 0.2s ease,
    color 0.2s ease,
    border-color 0.2s ease,
    transform 0.2s ease;
}

.preset-btn:hover,
.preset-btn:focus-visible {
  background: rgba(255, 255, 255, 0.12);
  transform: translateY(-1px);
}

.preset-btn.active {
  background: rgba(255, 193, 111, 0.95);
  color: #0d0f1c;
  border-color: rgba(255, 193, 111, 1);
}

.preset-name {
  display: block;
  font-weight: 600;
  font-size: 0.95rem;
}

.preset-desc {
  display: block;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.8);
}

.control-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 8px 10px 12px;
  max-height: 64vh;
  overflow-y: auto;
  scrollbar-width: thin;
}

.control-grid::-webkit-scrollbar {
  width: 8px;
}

.control-grid::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.control-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.85);
}

.control-value {
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
}

.control-pair {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.control-pair .control-group {
  flex: 1;
}

.control-group input[type="range"] {
  width: 100%;
  accent-color: #ffc45b;
  cursor: pointer;
}

.color-group input[type="color"] {
  border: none;
  padding: 0;
  width: 100%;
  height: 36px;
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
}

.controls-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.action-btn {
  flex: 1;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.9);
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 500;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.action-btn:hover,
.action-btn:focus-visible {
  background: rgba(255, 214, 132, 0.95);
  color: #0f0f1a;
}

.toggle-row {
  display: flex;
  gap: 8px;
}

.toggle-btn {
  flex: 1;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.9);
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
  transition:
    background-color 0.2s ease,
    color 0.2s ease,
    border-color 0.2s ease,
    transform 0.2s ease;
}

.toggle-btn:hover,
.toggle-btn:focus-visible {
  background: rgba(255, 255, 255, 0.12);
  transform: translateY(-1px);
}

.toggle-btn.active {
  background: rgba(255, 214, 132, 0.95);
  color: #0f0f1a;
  border-color: rgba(255, 214, 132, 0.9);
}

.toggle-btn.active:hover,
.toggle-btn.active:focus-visible {
  background: rgba(255, 214, 132, 1);
}

.hidden-upload {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  pointer-events: none;
}
