/* ============================================================
   METALHEART//GENERATOR — Y2K chrome lab UI
   ============================================================ */

:root {
  --bg: #05060a;
  --panel-bg: rgba(10, 12, 20, 0.78);
  --panel-border: rgba(125, 249, 255, 0.22);
  --cyan: #7df9ff;
  --magenta: #ff7ad9;
  --violet: #b388ff;
  --text: #d7dde8;
  --text-dim: #7a8499;
  --chrome-a: #f2f4fa;
  --chrome-b: #9aa3b8;
  --chrome-c: #4a5368;
  --radius: 10px;
}

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

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

#app { display: flex; height: 100vh; width: 100vw; }

/* ---------------- viewport ---------------- */
#viewport {
  flex: 1;
  position: relative;
  min-width: 0;
  background:
    radial-gradient(120% 90% at 70% 20%, rgba(60, 40, 90, 0.25), transparent 60%),
    radial-gradient(100% 80% at 20% 90%, rgba(0, 60, 70, 0.18), transparent 55%),
    #05060a;
}
#viewport canvas { display: block; width: 100%; height: 100%; }

.hud {
  position: absolute;
  top: 14px;
  left: 16px;
  display: flex;
  gap: 10px;
  pointer-events: none;
  z-index: 5;
}
.hud-item {
  font-family: Consolas, "Courier New", monospace;
  font-size: 11px;
  letter-spacing: 1.5px;
  color: var(--cyan);
  text-shadow: 0 0 8px rgba(125, 249, 255, 0.8);
  background: rgba(5, 6, 10, 0.55);
  border: 1px solid rgba(125, 249, 255, 0.25);
  border-radius: 4px;
  padding: 4px 10px;
  backdrop-filter: blur(4px);
}

.webgl-error {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
  padding: 24px;
  background: #0a0c14;
  z-index: 10;
}
.webgl-error h2 { color: var(--magenta); letter-spacing: 3px; font-size: 18px; }
.webgl-error p { color: var(--text-dim); max-width: 420px; font-size: 13px; line-height: 1.7; }
.hidden { display: none !important; }

/* ---------------- panel ---------------- */
#panel {
  width: 372px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--panel-bg);
  border-left: 1px solid var(--panel-border);
  backdrop-filter: blur(14px);
  box-shadow: -8px 0 30px rgba(0, 0, 0, 0.55);
  z-index: 6;
}

.panel-header {
  padding: 18px 20px 14px;
  border-bottom: 1px solid rgba(125, 249, 255, 0.15);
  background: linear-gradient(180deg, rgba(125, 249, 255, 0.07), transparent);
}
.title {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: 2px;
  background: linear-gradient(92deg, var(--cyan) 10%, var(--violet) 55%, var(--magenta) 90%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 12px rgba(125, 249, 255, 0.35));
  white-space: nowrap;
}
.title .slash { color: var(--magenta); -webkit-text-fill-color: var(--magenta); }
.subtitle {
  margin-top: 6px;
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--text-dim);
}

.controls {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px 20px;
  scrollbar-width: thin;
  scrollbar-color: rgba(125, 249, 255, 0.35) transparent;
}
.controls::-webkit-scrollbar { width: 6px; }
.controls::-webkit-scrollbar-thumb { background: rgba(125, 249, 255, 0.3); border-radius: 3px; }

/* ---------------- sections & controls ---------------- */
.section { margin-bottom: 16px; }
.section-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2.5px;
  color: var(--text);
}
.section-head .dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan);
  flex-shrink: 0;
}
.section-head .en {
  color: var(--text-dim);
  font-weight: 400;
  letter-spacing: 1.5px;
  font-size: 9px;
}

.row { margin-bottom: 10px; }
.row-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 4px;
  font-size: 12px;
  color: var(--text);
}
.row-label .val {
  font-family: Consolas, monospace;
  font-size: 11px;
  color: var(--cyan);
  text-shadow: 0 0 6px rgba(125, 249, 255, 0.5);
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(90deg, #1d2333, #39415c);
  outline: none;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--chrome-a), var(--chrome-b) 55%, var(--chrome-c));
  border: 1px solid rgba(125, 249, 255, 0.6);
  box-shadow: 0 0 8px rgba(125, 249, 255, 0.55);
  cursor: pointer;
}
input[type="range"]::-moz-range-thumb {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--chrome-a), var(--chrome-b) 55%, var(--chrome-c));
  border: 1px solid rgba(125, 249, 255, 0.6);
  box-shadow: 0 0 8px rgba(125, 249, 255, 0.55);
  cursor: pointer;
}

select {
  width: 100%;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid rgba(125, 249, 255, 0.28);
  background: #0d1019;
  color: var(--text);
  font-size: 12px;
  outline: none;
  cursor: pointer;
}
select:focus { border-color: var(--cyan); box-shadow: 0 0 8px rgba(125, 249, 255, 0.35); }

.color-row { display: flex; gap: 8px; align-items: center; }
input[type="color"] {
  -webkit-appearance: none;
  appearance: none;
  width: 34px; height: 26px;
  border: 1px solid rgba(125, 249, 255, 0.35);
  border-radius: 6px;
  background: none;
  cursor: pointer;
  padding: 0;
}
input[type="color"]::-webkit-color-swatch-wrapper { padding: 2px; }
input[type="color"]::-webkit-color-swatch { border: none; border-radius: 4px; }

input[type="number"], input[type="text"] {
  width: 100%;
  padding: 7px 10px;
  border-radius: 6px;
  border: 1px solid rgba(125, 249, 255, 0.28);
  background: #0d1019;
  color: var(--text);
  font-family: Consolas, monospace;
  font-size: 12px;
  outline: none;
}
input[type="number"]:focus, input[type="text"]:focus { border-color: var(--cyan); }

/* toggle switch */
.switch-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.switch-row .row-label { margin-bottom: 0; }
.switch {
  position: relative;
  width: 40px; height: 20px;
  flex-shrink: 0;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider-knob {
  position: absolute;
  inset: 0;
  border-radius: 10px;
  background: #1d2333;
  border: 1px solid #39415c;
  transition: 0.2s;
  cursor: pointer;
}
.slider-knob::before {
  content: "";
  position: absolute;
  width: 14px; height: 14px;
  left: 2px; top: 2px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--chrome-a), var(--chrome-b) 60%, var(--chrome-c));
  transition: 0.2s;
}
.switch input:checked + .slider-knob {
  background: linear-gradient(90deg, rgba(125, 249, 255, 0.4), rgba(255, 122, 217, 0.4));
  border-color: var(--cyan);
  box-shadow: 0 0 10px rgba(125, 249, 255, 0.4);
}
.switch input:checked + .slider-knob::before { transform: translateX(20px); }

/* buttons */
.btn-row { display: flex; gap: 10px; margin-bottom: 4px; }
.btn {
  flex: 1;
  padding: 11px 10px;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  color: #10131c;
  background: linear-gradient(180deg, var(--chrome-a), var(--chrome-b) 55%, var(--chrome-c));
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.6);
  transition: transform 0.08s, box-shadow 0.15s, filter 0.15s;
  user-select: none;
}
.btn:hover { filter: brightness(1.08); box-shadow: 0 2px 0 rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.6), 0 0 14px rgba(125, 249, 255, 0.35); }
.btn:active { transform: translateY(1px); }
.btn-primary {
  color: #031016;
  background: linear-gradient(180deg, var(--cyan), #4fd6ff 45%, var(--violet));
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.7), 0 0 16px rgba(125, 249, 255, 0.45);
}
.btn-primary:hover { filter: brightness(1.1); box-shadow: 0 2px 0 rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.7), 0 0 22px rgba(255, 122, 217, 0.55); }
.btn-ghost {
  background: linear-gradient(180deg, #232a3d, #151a29);
  color: var(--cyan);
  border: 1px solid rgba(125, 249, 255, 0.35);
  box-shadow: none;
}
.btn-ghost:hover { filter: brightness(1.25); box-shadow: 0 0 12px rgba(125, 249, 255, 0.25); }

.panel-footer {
  padding: 12px 20px;
  border-top: 1px solid rgba(125, 249, 255, 0.12);
  font-size: 10px;
  letter-spacing: 1px;
  color: var(--text-dim);
  text-align: center;
}
.panel-footer .footer-links { margin-top: 6px; letter-spacing: 0.5px; }
.footer-links a { color: var(--text-dim); text-decoration: none; }
.footer-links a:hover { color: var(--cyan); text-shadow: 0 0 8px rgba(125, 249, 255, 0.6); }

@media (max-width: 820px) {
  #app { flex-direction: column; }
  #panel { width: 100%; height: 45vh; border-left: none; border-top: 1px solid var(--panel-border); }
  #viewport { height: 55vh; }
}
