* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: #060612;
  overflow: hidden;
  font-family: 'JetBrains Mono', monospace;
  color: #c8d6e5;
  user-select: none;
  -webkit-user-select: none;
}

canvas#canvas {
  display: block;
  width: 100vw;
  height: 100vh;
  cursor: crosshair;
}

#toggle-panel {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 1001;
  background: rgba(10, 10, 30, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(80, 200, 255, 0.2);
  color: #fff;
  font-size: 20px;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

#toggle-panel:hover {
  border-color: rgba(80, 200, 255, 0.5);
  box-shadow: 0 0 20px rgba(80, 200, 255, 0.15);
}

#panel {
  position: fixed;
  top: 60px;
  right: 12px;
  z-index: 1000;
  width: 280px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  background: rgba(10, 10, 30, 0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(80, 200, 255, 0.15);
  border-radius: 14px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5), 0 0 30px rgba(80, 200, 255, 0.05);
  transition: opacity 0.35s ease, transform 0.35s ease;
  opacity: 1;
  transform: translateX(0);
}

#panel.panel-hidden {
  opacity: 0;
  transform: translateX(20px);
  pointer-events: none;
}

#panel.panel-visible {
  opacity: 1;
  transform: translateX(0);
}

.panel-header {
  padding: 16px 18px 8px;
  border-bottom: 1px solid rgba(80, 200, 255, 0.1);
}

.panel-title {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 1px;
  background: linear-gradient(135deg, #50c8ff, #00ffc8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.panel-body {
  padding: 12px 18px 18px;
}

.control-row {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.btn-icon {
  flex: 1;
  background: rgba(80, 200, 255, 0.08);
  border: 1px solid rgba(80, 200, 255, 0.2);
  border-radius: 8px;
  color: #c8d6e5;
  font-size: 18px;
  padding: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-icon:hover {
  background: rgba(80, 200, 255, 0.15);
  border-color: rgba(80, 200, 255, 0.4);
  box-shadow: 0 0 12px rgba(80, 200, 255, 0.1);
}

.btn-icon:active {
  transform: scale(0.95);
}

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

.control-group label {
  display: block;
  font-size: 11px;
  font-weight: 400;
  color: rgba(200, 214, 229, 0.7);
  margin-bottom: 5px;
  letter-spacing: 0.5px;
}

.control-group label span {
  color: #50c8ff;
  font-weight: 700;
}

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

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #50c8ff;
  box-shadow: 0 0 8px rgba(80, 200, 255, 0.4);
  cursor: pointer;
  transition: box-shadow 0.2s;
}

input[type="range"]::-webkit-slider-thumb:hover {
  box-shadow: 0 0 16px rgba(80, 200, 255, 0.7);
}

input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #50c8ff;
  border: none;
  box-shadow: 0 0 8px rgba(80, 200, 255, 0.4);
  cursor: pointer;
}

.dual-inputs {
  display: flex;
  align-items: center;
  gap: 6px;
}

.dual-inputs input[type="number"] {
  width: 80px;
  background: rgba(80, 200, 255, 0.06);
  border: 1px solid rgba(80, 200, 255, 0.2);
  border-radius: 6px;
  color: #c8d6e5;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  padding: 5px 8px;
  outline: none;
  transition: border-color 0.2s;
}

.dual-inputs input[type="number"]:focus {
  border-color: rgba(80, 200, 255, 0.5);
}

.separator {
  color: rgba(200, 214, 229, 0.3);
  font-size: 14px;
}

select {
  width: 100%;
  background: rgba(80, 200, 255, 0.06);
  border: 1px solid rgba(80, 200, 255, 0.2);
  border-radius: 6px;
  color: #c8d6e5;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  padding: 6px 8px;
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s;
}

select:focus {
  border-color: rgba(80, 200, 255, 0.5);
}

select option {
  background: #0a0a1e;
  color: #c8d6e5;
}

#stats-bar {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 20px;
  align-items: center;
  background: rgba(10, 10, 30, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(80, 200, 255, 0.1);
  border-radius: 10px;
  padding: 6px 18px;
  font-size: 11px;
  font-weight: 400;
  color: rgba(200, 214, 229, 0.6);
  letter-spacing: 0.5px;
  z-index: 100;
}

#stat-help {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid rgba(80, 200, 255, 0.3);
  font-size: 10px;
  font-weight: 700;
  color: #50c8ff;
  cursor: help;
  position: relative;
}

#footer {
  position: fixed;
  bottom: 8px;
  left: 12px;
  font-size: 10px;
  color: rgba(200, 214, 229, 0.15);
  z-index: 100;
  transition: color 0.3s;
  letter-spacing: 0.3px;
}

#footer:hover {
  color: rgba(200, 214, 229, 0.6);
}

#footer a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

#footer a:hover {
  color: #50c8ff;
}

/* Scrollbar styling */
#panel::-webkit-scrollbar {
  width: 4px;
}

#panel::-webkit-scrollbar-track {
  background: transparent;
}

#panel::-webkit-scrollbar-thumb {
  background: rgba(80, 200, 255, 0.2);
  border-radius: 2px;
}

/* Responsive */
@media (max-width: 600px) {
  #panel {
    width: 240px;
    right: 8px;
    top: 54px;
  }
  
  .panel-body {
    padding: 10px 14px 14px;
  }
  
  #stats-bar {
    gap: 12px;
    padding: 5px 12px;
    font-size: 10px;
  }
}