/* ── 3D Helmholtz module layout ── */
html, body {
  height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ── Sub-nav bar ── */
.sub-nav-bar {
  height: 34px;
  background: var(--bg-primary);
  border-bottom: 1px solid rgba(108,99,255,0.1);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 16px;
  flex-shrink: 0;
}
.sub-nav-item {
  font-family: 'Inter', sans-serif;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  border: none;
  padding: 5px 14px;
  border-radius: 6px;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
  display: flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}
.sub-nav-item:hover {
  color: var(--text-secondary);
  background: rgba(108,99,255,0.08);
}
.sub-nav-item.active {
  color: var(--text-primary);
  background: rgba(108,99,255,0.2);
}
.sub-nav-icon { width: 16px; height: 16px; flex-shrink: 0; }

/* ── App container ── */
.app {
  display: flex;
  flex: 1;
  width: 100%;
  overflow: hidden;
}

/* ── Left: 3D display panel ── */
.display-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 18px 24px;
  position: relative;
}
.display-panel::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 30% 20%, rgba(0,212,170,0.06) 0%, transparent 60%),
              radial-gradient(ellipse at 70% 80%, rgba(108,99,255,0.05) 0%, transparent 60%);
  pointer-events: none;
}

h1 {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 10px;
  background: linear-gradient(135deg, var(--accent-3), var(--accent-1));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-align: center;
  position: relative;
  z-index: 1;
}

.three-wrap {
  position: relative;
  z-index: 1;
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 12px;
  border: 1px solid rgba(108,99,255,0.15);
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 900px;
  flex: 1;
  min-height: 0;
}
#threeContainer {
  width: 100%;
  flex: 1;
  min-height: 0;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
}
#threeContainer canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

.canvas-label {
  margin-top: 8px;
  font-size: 0.82rem;
  color: var(--text-muted);
  text-align: center;
}

.status-bar {
  margin-top: 8px;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-family: 'Fira Code', monospace;
  position: relative;
  z-index: 1;
}

/* ── Fullscreen button ── */
.fullscreen-btn {
  position: absolute;
  top: 8px; right: 8px;
  font-size: 0.62rem;
  padding: 3px 10px;
  border-radius: 6px;
  border: 1px solid rgba(108,99,255,0.25);
  background: rgba(36,36,64,0.85);
  color: var(--text-secondary);
  cursor: pointer;
  z-index: 20;
  transition: background 0.15s, color 0.15s;
}
.fullscreen-btn:hover {
  background: rgba(108,99,255,0.3);
  color: var(--text-primary);
}

/* ── Right: control panel (matches 2D helmholtz) ── */
.control-panel {
  width: 320px;
  background: var(--bg-slide);
  border-left: 1px solid rgba(108,99,255,0.12);
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex-shrink: 0;
}
.control-panel::-webkit-scrollbar { width: 6px; }
.control-panel::-webkit-scrollbar-track { background: transparent; }
.control-panel::-webkit-scrollbar-thumb { background: rgba(108,99,255,0.3); border-radius: 3px; }

.panel-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--accent-1);
  text-align: center;
  padding-bottom: 8px;
  border-bottom: 2px solid rgba(108,99,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

/* ── Sections (matches 2D helmholtz) ── */
.section {
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  border: 1px solid rgba(108,99,255,0.1);
}
.section h3 {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--accent-3);
  margin-bottom: 10px;
}

.separator {
  height: 1px;
  background: rgba(108,99,255,0.12);
  margin: 10px 0;
}

/* ── Slider group (matches 2D helmholtz) ── */
.slider-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-bottom: 10px;
}
.slider-group:last-child { margin-bottom: 0; }
.slider-group label {
  font-size: 0.78rem;
  color: var(--text-secondary);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.slider-group label .param-name { font-weight: 500; }
.slider-group label .val {
  font-family: 'Fira Code', monospace;
  font-size: 0.72rem;
  color: var(--accent-4);
}
.slider-group input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: rgba(108,99,255,0.15);
  outline: none;
}
.slider-group input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--accent-1);
  cursor: pointer;
  transition: transform 0.1s;
}
.slider-group input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

/* ── Select group ── */
.select-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-bottom: 10px;
}
.select-group:last-child { margin-bottom: 0; }
.select-group label {
  font-size: 0.78rem;
  color: var(--text-secondary);
  font-weight: 500;
}
.select-group select {
  font-size: 0.78rem;
  padding: 5px 8px;
  border-radius: 6px;
  border: 1px solid rgba(108,99,255,0.2);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
}

/* ── CIF upload row ── */
.cif-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
}
.cif-row .val {
  flex: 1;
  font-size: 0.78rem;
  color: var(--accent-4, #ff9f43);
  font-family: 'Fira Code', 'Cascadia Code', monospace;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cif-upload-btn {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 5px;
  border: 1px solid rgba(108,99,255,0.3);
  background: rgba(108,99,255,0.1);
  color: var(--accent-1, #6c63ff);
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}
.cif-upload-btn:hover {
  background: rgba(108,99,255,0.25);
}

/* ── Toggle row ── */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.toggle-row:last-child { margin-bottom: 0; }
.toggle-row label {
  font-size: 0.78rem;
  color: var(--text-secondary);
  font-weight: 500;
}
.toggle-row input[type="checkbox"] {
  accent-color: var(--accent-1);
}

/* ── Info button ── */
.info-page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 1px solid rgba(108,99,255,0.3);
  background: rgba(108,99,255,0.1);
  color: var(--accent-1);
  font-size: 0.7rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}
.info-page-btn:hover { background: rgba(108,99,255,0.3); }

/* ── Info overlay ── */
.info-page-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,15,26,0.92);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}
.info-page-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}
.info-page-close {
  position: absolute;
  top: 18px; right: 24px;
  font-size: 1.8rem;
  color: var(--text-muted);
  background: none; border: none;
  cursor: pointer; line-height: 1;
}
.info-page-content {
  max-width: 700px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 40px 48px;
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid rgba(108,99,255,0.15);
  color: var(--text-secondary);
  font-size: 0.82rem;
  line-height: 1.7;
}
.info-page-content h1 {
  font-size: 1.4rem;
  margin-bottom: 18px;
}
.info-page-content h2 {
  font-size: 1rem;
  color: var(--accent-3);
  margin: 20px 0 8px;
}
.info-page-content p { margin-bottom: 10px; }
.info-page-content code {
  font-family: 'Fira Code', monospace;
  font-size: 0.78rem;
  background: rgba(108,99,255,0.1);
  padding: 1px 5px;
  border-radius: 4px;
}
.info-page-content .math-block {
  display: block;
  text-align: center;
  font-family: 'Fira Code', monospace;
  font-size: 0.82rem;
  padding: 10px;
  margin: 10px 0;
  background: rgba(0,0,0,0.2);
  border-radius: 8px;
}
