html, body {
  height: 100%;
  margin: 0;
  background: #0f1115;
  color: #e6e6e6;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Arial, Helvetica, "Apple Color Emoji", "Segoe UI Emoji";
}
*, *::before, *::after {
  box-sizing: border-box;
}
#app {
  position: fixed;
  inset: 0;
  overflow: hidden;
}
.ui-panel {
  position: absolute;
  top: 0px;
  right: 0px;
  background: rgba(20, 22, 28, 0.92);
  border: 1px solid #2a2e39;
  border-radius: 0px;
  padding: 12px;
  backdrop-filter: blur(4px);
  box-shadow: 0 6px 24px rgba(0,0,0,0.35);
  width: 320px;
  z-index: 10;
  box-sizing: border-box;
}
.ui-panel h2 {
  margin: 0 0 8px 0;
  font-size: 16px;
  color: #b7c1ff;
  font-weight: 600;
}
.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}
.row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}
label {
  display: block;
  font-size: 12px;
  color: #b4b8c7;
  margin-bottom: 4px;
}
input[type="number"], input[type="text"], select {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  border: 1px solid #2a2e39;
  border-radius: 8px;
  background: #12151c;
  color: #e6e6e6;
  outline: none;
}
input[type="color"] {
  width: 100%;
  height: 36px;
  padding: 0;
  border: 1px solid #2a2e39;
  border-radius: 8px;
  background: #12151c;
}
.inline {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 12px;
  color: #b4b8c7;
}
.note {
  font-size: 11px;
  color: #8f95a5;
  margin-top: 6px;
}
.footer {
  margin-top: 8px;
  display: flex;
  gap: 8px;
  font-size: 12px;
  color: #8f95a5;
  align-items: center;
  justify-content: space-between;
}
.link {
  color: #b7c1ff;
  text-decoration: none;
}
canvas { display: block; }

.ui-panel.collapsed {
  display: none;
}

.panel-toggle {
  position: fixed;
  top: 10px;
  right: 10px;
  z-index: 20;
  background: #2a7cff;
  color: #fff;
  border: 1px solid #2a2e39;
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
}

/* Mobile optimizations */
@media (max-width: 768px) {
  .ui-panel {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100vw;
    max-height: 50vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 0px;
    padding: 12px 12px calc(12px + env(safe-area-inset-bottom));
  }

  .row,
  .row-3 {
    grid-template-columns: 1fr;
  }

  input[type="number"],
  input[type="text"],
  select,
  input[type="color"] {
    font-size: 16px;
    padding: 12px 14px;
  }

  button#exportStl {
    padding: 12px 14px !important;
  }
  .panel-toggle {
    top: auto;
    right: 10px;
    bottom: calc(env(safe-area-inset-bottom) + 10px);
  }
}

@media (max-width: 480px) {
  .ui-panel {
    max-height: 60vh;
    padding: 10px 10px calc(10px + env(safe-area-inset-bottom));
  }
  .ui-panel h2 {
    font-size: 14px;
  }
}
