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

html, body {
  height: 100%;
  overflow: hidden;
  background: #000;
  font-family: "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
  color: #e8e8f0;
}

#canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: crosshair;
}

#nogl {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.hidden { display: none !important; }

#toggle-panel {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 20;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(10, 10, 25, 0.55);
  backdrop-filter: blur(10px);
  color: #e8e8f0;
  font-size: 1.1rem;
  cursor: pointer;
  transition: transform 0.25s;
}
#toggle-panel:hover { transform: rotate(45deg); }

#panel {
  position: fixed;
  top: 14px;
  right: 64px;
  z-index: 10;
  width: 270px;
  padding: 18px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(8, 10, 24, 0.62);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
  transition: opacity 0.25s, transform 0.25s;
}

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

#panel h1 {
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 14px;
  color: #9fb4ff;
}

#panel label {
  display: block;
  margin-bottom: 12px;
  font-size: 0.72rem;
}

#panel label span {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
  color: #aab;
}

#panel select {
  width: 100%;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(20, 24, 48, 0.8);
  color: #e8e8f0;
  font: inherit;
  font-size: 0.75rem;
}

#panel input[type="range"] {
  width: 100%;
  accent-color: #6c8cff;
}

.row {
  display: flex;
  gap: 8px;
  margin: 4px 0 12px;
}

.row button {
  flex: 1;
  padding: 7px 0;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(40, 50, 100, 0.5);
  color: #e8e8f0;
  font: inherit;
  font-size: 0.75rem;
  cursor: pointer;
  transition: background 0.15s;
}
.row button:hover { background: rgba(70, 90, 170, 0.6); }

.stats {
  font-size: 0.72rem;
  line-height: 1.6;
  color: #9fb4ff;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 8px;
}

.hint {
  margin-top: 10px;
  font-size: 0.65rem;
  line-height: 1.5;
  color: #778;
}

.palette-editor {
  margin-bottom: 12px;
  padding: 8px;
  border-radius: 8px;
  background: rgba(20, 24, 48, 0.6);
}

.palette-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.palette-row:last-child { margin-bottom: 0; }

.palette-row span {
  font-size: 0.72rem;
  color: #aab;
}

.palette-row input[type="color"] {
  width: 36px;
  height: 22px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  background: none;
  cursor: pointer;
}

@media (max-width: 600px) {
  #panel {
    right: 12px;
    top: 62px;
    width: calc(100vw - 24px);
  }
}
