@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;700&display=swap');

:root {
  --bg-dark: #050a12;
  --bg-panel: rgba(10, 18, 30, 0.4);
  --border-light: rgba(255, 255, 255, 0.08);
  --accent-color: #00f0ff;
  --accent-rgb: 0, 240, 255;
  --text-primary: #f0f4f8;
  --text-secondary: #90a0b0;
  --panel-width: 320px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-drag: none;
}

body {
  font-family: 'Outfit', sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-primary);
  overflow: hidden;
  width: 100vw;
  height: 100vh;
}

#canvas-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* Glassmorphism Control Panel */
.control-panel {
  position: absolute;
  top: 20px;
  right: 20px;
  width: var(--panel-width);
  max-height: calc(100vh - 40px);
  background: var(--bg-panel);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.6);
  z-index: 10;
  display: flex;
  flex-direction: column;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
  overflow: hidden;
}

.control-panel.collapsed {
  transform: translateX(calc(100% + 40px));
  opacity: 0;
  pointer-events: none;
}

.panel-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.panel-header h1 {
  font-size: 1.15rem;
  font-weight: 500;
  letter-spacing: 1px;
  background: linear-gradient(135deg, #fff 0%, var(--accent-color) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 20px rgba(var(--accent-rgb), 0.2);
}

.close-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.close-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

.panel-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.control-group {
  margin-bottom: 20px;
}

.control-group:last-child {
  margin-bottom: 0;
}

.control-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--text-secondary);
  margin-bottom: 8px;
  letter-spacing: 0.5px;
}

.control-val {
  color: var(--accent-color);
  font-weight: 500;
  font-size: 0.8rem;
}

/* Custom sliders */
input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--text-primary);
  box-shadow: 0 0 10px rgba(var(--accent-rgb), 0.5);
  transition: all 0.15s ease-in-out;
  border: 1px solid var(--accent-color);
}

input[type="range"]::-webkit-slider-thumb:hover {
  background: var(--accent-color);
  transform: scale(1.2);
  box-shadow: 0 0 15px rgba(var(--accent-rgb), 0.8);
}

/* Select element */
select {
  width: 100%;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
  cursor: pointer;
  transition: all 0.2s ease;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2390a0b0' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

select:hover, select:focus {
  background-color: rgba(255, 255, 255, 0.08);
  border-color: var(--accent-color);
  box-shadow: 0 0 10px rgba(var(--accent-rgb), 0.15);
}

/* Toggle Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.1);
  transition: .3s;
  border-radius: 20px;
  border: 1px solid var(--border-light);
}

.slider:before {
  position: absolute;
  content: "";
  height: 12px;
  width: 12px;
  left: 3px;
  bottom: 3px;
  background-color: var(--text-secondary);
  transition: .3s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: rgba(var(--accent-rgb), 0.2);
  border-color: var(--accent-color);
}

input:checked + .slider:before {
  transform: translateX(16px);
  background-color: var(--accent-color);
  box-shadow: 0 0 8px rgba(var(--accent-rgb), 0.6);
}

/* Color pickers group */
.color-pickers {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 8px;
}

.color-picker-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.color-picker-wrapper span {
  font-size: 0.7rem;
  color: var(--text-secondary);
}

input[type="color"] {
  -webkit-appearance: none;
  border: none;
  width: 100%;
  height: 32px;
  border-radius: 6px;
  cursor: pointer;
  background: none;
}

input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

input[type="color"]::-webkit-color-swatch {
  border: 1px solid var(--border-light);
  border-radius: 6px;
}

/* Custom button */
.btn-primary {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, rgba(var(--accent-rgb), 0.1) 0%, rgba(var(--accent-rgb), 0.25) 100%);
  border: 1px solid rgba(var(--accent-rgb), 0.4);
  border-radius: 8px;
  color: var(--accent-color);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: 10px;
}

.btn-primary:hover {
  background: linear-gradient(135deg, rgba(var(--accent-rgb), 0.2) 0%, rgba(var(--accent-rgb), 0.4) 100%);
  box-shadow: 0 0 15px rgba(var(--accent-rgb), 0.3);
  border-color: var(--accent-color);
  color: #fff;
}

/* Float Open Button */
.settings-toggle-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  background: var(--bg-panel);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-primary);
  z-index: 9;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.settings-toggle-btn:hover {
  background: rgba(10, 18, 30, 0.6);
  border-color: var(--accent-color);
  color: var(--accent-color);
  box-shadow: 0 0 15px rgba(var(--accent-rgb), 0.3);
  transform: rotate(30deg);
}

.settings-toggle-btn.hidden {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.8);
}

/* Water Ripples / Vignette overlay */
.overlay-vignette {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
  box-shadow: inset 0 0 100px rgba(0, 0, 0, 0.8);
  background: radial-gradient(circle at 50% 50%, rgba(0, 0, 0, 0) 40%, rgba(5, 10, 18, 0.7) 100%);
}

.ocean-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
  background: linear-gradient(180deg, rgba(0, 240, 255, 0.03) 0%, rgba(0,0,0,0) 50%, rgba(0, 10, 20, 0.3) 100%);
}

/* Custom Scrollbar for panel body */
.panel-body::-webkit-scrollbar {
  width: 6px;
}

.panel-body::-webkit-scrollbar-track {
  background: transparent;
}

.panel-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

.panel-body::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}
