body {
  margin: 0;
  overflow: hidden;
  background: #fff;
  font-family: 'Segoe UI', sans-serif;
  color: #1e293b;
}
canvas {
  display: block;
}

/* Glassmorphism Panel (copied from 3-金刚石晶胞.html) */
.glass-panel {
  position: absolute;
  top: 16px;
  left: 16px;
  width: 240px; /* Reduced from 300px */
  z-index: 1000;
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.05);
  border-radius: 12px;
  padding: 14px; /* Reduced from 20px */
  transition: all 0.25s ease-in-out;
  transform-origin: top left;
}

.glass-panel.panel-collapsed {
  display: none !important;
}

.panel-header {
  display: flex;
  align-items: center;
  margin-bottom: 8px; /* Reduced from 12px */
  cursor: move;
  user-select: none;
}

.panel-title {
  font-size: 16px; /* Reduced from 18px */
  font-weight: 800;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 6px; /* Reduced from 8px */
}

.panel-title-icon {
  color: #2563eb;
  font-size: 16px; /* Reduced from 18px */
}

.panel-toggle-btn {
  margin-left: auto;
  width: 28px; /* Reduced from 32px */
  height: 28px; /* Reduced from 32px */
  border-radius: 6px; /* Reduced from 8px */
  border: none;
  background: #f1f5f9;
  color: #334155;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  pointer-events: auto; /* Ensure clickable */
}

.panel-toggle-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.panel-content {
  max-height: 80vh;
  overflow-y: auto;
  /* Custom Scrollbar */
  scrollbar-width: thin;
  scrollbar-color: rgba(0,0,0,0.2) rgba(0,0,0,0.05);
}

.panel-content::-webkit-scrollbar { width: 4px; }
.panel-content::-webkit-scrollbar-track { background: rgba(0,0,0,0.05); }
.panel-content::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.2); border-radius: 2px; }

/* FAB Expand Button */
#panel-expand-btn {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 9999;
  background: transparent;
  border: 0;
  color: #0ea5e9;
  font-size: 24px;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
}

/* 适配 lil-gui 嵌入 */
.lil-gui {
  position: static !important;
  width: 100% !important;
  min-width: 0 !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  margin: 0 !important;
  padding: 0 !important;
  --background-color: transparent;
  --text-color: #334155;
  --title-background-color: transparent;
  --title-text-color: #334155;
  --widget-color: rgba(0, 0, 0, 0.05);
  --hover-color: rgba(0, 0, 0, 0.05);
  --focus-color: rgba(0, 0, 0, 0.1);
  --number-color: #0f172a;
  --string-color: #0f172a;
  --input-background-color: rgba(0, 0, 0, 0.05);
  --folder-text-color: #334155;
}

.lil-gui .lil-title,
.lil-gui .title {
  display: none !important; /* Hide original title */
}

.lil-gui .lil-children,
.lil-gui .children {
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
}

.lil-gui .controller {
  margin-bottom: 4px; /* Reduced from 6px */
}

.lil-gui .controller .name {
  color: #475569;
  font-weight: 600;
  font-size: 12px; /* Reduced from 13px */
  line-height: 1.2;
}

.lil-gui input[type="checkbox"] {
  border: 1px solid #cbd5e1;
  border-radius: 4px;
}

/* Nav Return Button */
.nav-return {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 9999;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: rgba(255, 255, 255, 0.9);
  color: #0f172a;
  font-weight: 800;
  font-size: 13px;
  text-decoration: none;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  user-select: none;
  transition: all 0.2s;
}

.nav-return:hover {
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 16px 34px rgba(15, 23, 42, 0.14);
}

.label {
  color: #111;
  font-family: sans-serif;
  font-size: 30px;
  font-weight: bold;
  text-shadow: -1px -1px 0 #fff, 1px -1px 0 #fff, -1px 1px 0 #fff, 1px 1px 0 #fff, 0 0 6px rgba(255,255,255,0.8);
  pointer-events: none;
  margin-top: -1em;
}

.angle-label {
  color: #ef4444; /* red-500 */
  background: #fef08a; /* yellow-200 */
  border: 1.2px solid #ef4444; /* Slightly thinner border */
  padding: 0px 1px; /* Extremely tight padding */
  border-radius: 2px; /* Sharper corners */
  font-size: 40px; /* Increased from 26px */
  font-weight: bold;
  pointer-events: none;
  white-space: nowrap;
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
  line-height: 0.9; /* Even tighter vertical fit */
}

.icosahedron-label {
  color: #ef4444;
  background: #fef08a;
  border: 1.2px solid #ef4444; /* Thinner border for compactness */
  padding: 0px 4px; /* Reduced from 4px 12px */
  border-radius: 4px; /* Sharper corners for compactness */
  font-size: 42px; /* Large as requested */
  font-weight: 900;
  text-align: center;
  pointer-events: none;
  white-space: nowrap;
  box-shadow: 0 1px 6px rgba(0,0,0,0.15); /* Smaller shadow */
  line-height: 0.9; /* Tight vertical fit */
}

.gui-row {
  display: flex;
  gap: 6px;
  align-items: center;
}
.gui-row .controller { flex: 1; }
.gui-row .controller.gui-row-right { flex: 0 0 auto; }
.gui-row .controller.gui-row-right .name { display: none; }
