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

:root {
  --panel-bg: rgba(10, 14, 28, 0.72);
  --panel-border: rgba(120, 150, 220, 0.18);
  --text: #dce6f5;
  --text-dim: #8b98b8;
  --accent: #7aa2ff;
  --accent-soft: rgba(122, 162, 255, 0.16);
}

html, body {
  height: 100%;
  overflow: hidden;
  background: #04060e;
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

#space {
  position: fixed;
  inset: 0;
  display: block;
  cursor: crosshair;
  touch-action: none;
}

/* ---------- control panel ---------- */

#panel {
  position: fixed;
  top: 16px;
  left: 16px;
  width: 252px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  padding: 16px 16px 10px;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.45);
  user-select: none;
  scrollbar-width: thin;
  scrollbar-color: rgba(122, 162, 255, 0.3) transparent;
}
#panel::-webkit-scrollbar { width: 7px; }
#panel::-webkit-scrollbar-track { background: transparent; }
#panel::-webkit-scrollbar-thumb {
  background: rgba(122, 162, 255, 0.25);
  border-radius: 4px;
}

#panel header { margin-bottom: 12px; }

#panel h1 {
  font-size: 17px;
  letter-spacing: 3px;
  font-weight: 700;
  background: linear-gradient(90deg, #ffcf6b, #ff7ab8, #7aa2ff);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: #ffcf6b;
}

.tagline { font-size: 11px; color: var(--text-dim); letter-spacing: 1px; margin-top: 2px; }

.field-label {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: var(--text-dim);
  margin: 12px 0 5px;
}
.field-label span { color: var(--text); float: right; letter-spacing: 0; }

select {
  width: 100%;
  padding: 7px 8px;
  font-size: 13px;
  color: var(--text);
  background: rgba(20, 28, 52, 0.9);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  outline: none;
}
select:focus { border-color: var(--accent); }
optgroup { font-style: normal; color: var(--text-dim); }
option { color: var(--text); }

#preset-desc {
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--text-dim);
  margin-top: 7px;
  min-height: 32px;
}

.btn-row { display: flex; gap: 6px; margin-top: 10px; }
.btn-row button {
  flex: 1;
  padding: 7px 0;
  font-size: 15px;
  color: var(--text);
  background: var(--accent-soft);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, transform 0.05s;
}
.btn-row button:hover { background: rgba(122, 162, 255, 0.3); }
.btn-row button:active { transform: scale(0.94); }

input[type="range"] {
  width: 100%;
  height: 4px;
  appearance: none;
  -webkit-appearance: none;
  background: rgba(122, 162, 255, 0.25);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 13px; height: 13px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #0a0e1c;
  box-shadow: 0 0 8px rgba(122, 162, 255, 0.8);
}
input[type="range"]::-moz-range-thumb {
  width: 11px; height: 11px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #0a0e1c;
}

.chips { display: flex; gap: 5px; flex-wrap: wrap; }
.chip {
  padding: 5px 9px;
  font-size: 11px;
  color: var(--text-dim);
  background: transparent;
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s;
}
.chip:hover { color: var(--text); }
.chip.active {
  color: #0a0e1c;
  background: var(--accent);
  border-color: var(--accent);
  font-weight: 600;
}

.toggles { margin-top: 14px; display: grid; gap: 7px; }
.toggles label {
  font-size: 12px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
}
.toggles label:hover { color: var(--text); }
.toggles input { accent-color: var(--accent); }

#panel footer {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid var(--panel-border);
  text-align: center;
}

.link {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 11px;
  letter-spacing: 1px;
  cursor: pointer;
  text-decoration: underline dotted;
}
.link:hover { color: var(--accent); }

/* ---------- HUD & hint ---------- */

#hud {
  position: fixed;
  right: 14px;
  bottom: 12px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 11px;
  color: rgba(160, 180, 215, 0.75);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9);
  pointer-events: none;
  white-space: pre;
}

#hint {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  padding: 8px 18px;
  font-size: 12.5px;
  color: var(--text);
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  backdrop-filter: blur(10px);
  opacity: 0;
  transition: opacity 0.4s, transform 0.4s;
  pointer-events: none;
}
#hint.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- selection card ---------- */

#sel-info {
  position: fixed;
  right: 14px;
  top: 14px;
  min-width: 150px;
  padding: 10px 14px;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  backdrop-filter: blur(10px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}
#sel-info.show { opacity: 1; pointer-events: auto; }
#sel-name { font-size: 13px; font-weight: 600; margin-bottom: 3px; display: flex; align-items: center; gap: 7px; }
#sel-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: none;
  box-shadow: 0 0 8px currentColor;
}
#sel-stats {
  font-family: ui-monospace, monospace;
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 6px;
  white-space: pre;
}

/* ---------- about modal ---------- */

#about {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(2, 4, 10, 0.7);
  backdrop-filter: blur(6px);
  z-index: 20;
}
#about.open { display: flex; }

#about-card {
  position: relative;
  width: min(560px, calc(100vw - 40px));
  max-height: 80vh;
  overflow-y: auto;
  padding: 28px 30px;
  background: rgba(12, 17, 34, 0.95);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  box-shadow: 0 20px 80px rgba(0, 0, 0, 0.6);
  font-size: 13.5px;
  line-height: 1.65;
}
#about-card h2 { font-size: 20px; margin-bottom: 12px; }
#about-card h3 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-dim);
  margin: 16px 0 6px;
}
#about-card p { margin-bottom: 10px; }
#about-card ul { margin: 0 0 10px 18px; }
#about-card li { margin-bottom: 4px; }
#about-card .fine { font-size: 11px; color: var(--text-dim); margin-top: 14px; }
#about-close {
  position: absolute;
  top: 12px; right: 14px;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 15px;
  cursor: pointer;
}
#about-close:hover { color: var(--text); }

/* ---------- small screens ---------- */

@media (max-width: 640px) {
  #panel {
    top: auto;
    bottom: 0;
    left: 0;
    width: 100%;
    max-height: 45vh;
    border-radius: 14px 14px 0 0;
  }
  #hud { bottom: auto; top: 10px; right: 10px; }
  #hint { bottom: auto; top: 46px; }
  #sel-info { top: 80px; }
}
