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

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: #0f0f1a;
  color: #e0e0e0;
  overflow: hidden;
  height: 100vh;
}

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

#canvas-container {
  flex: 1;
  height: 100vh;
  position: relative;
}

#panel {
  width: 340px;
  min-width: 340px;
  background: linear-gradient(180deg, #1a1a2e 0%, #16162a 100%);
  border-left: 1px solid rgba(255, 255, 255, 0.06);
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow-y: auto;
  backdrop-filter: blur(10px);
}

h1 {
  font-size: 20px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.3px;
}

.subtitle {
  font-size: 12px;
  color: #8888aa;
  font-weight: 400;
  margin-top: -14px;
}

.control-group {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  padding: 14px 16px;
}

.label-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.joint-name {
  font-weight: 600;
  font-size: 14px;
  color: #ffffff;
}

.joint-axis {
  font-size: 11px;
  color: #8888aa;
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 8px;
  border-radius: 4px;
}

.joint-value {
  margin-left: auto;
  font-size: 14px;
  font-weight: 600;
  color: #ff6b35;
  font-variant-numeric: tabular-nums;
}

/* Custom range slider */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(90deg, #2a2a4a, #4a4a8a);
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ff6b35;
  cursor: pointer;
  border: 2px solid rgba(255, 107, 53, 0.3);
  transition: transform 0.15s, box-shadow 0.15s;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 0 12px rgba(255, 107, 53, 0.4);
}

input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ff6b35;
  cursor: pointer;
  border: 2px solid rgba(255, 107, 53, 0.3);
}

.range-labels {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: #6666aa;
  margin-top: 6px;
}

#position-display {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  padding: 14px 16px;
}

#position-display h3 {
  font-size: 13px;
  font-weight: 600;
  color: #aaaacc;
  margin-bottom: 10px;
}

.pos-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.pos-item {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 8px;
  padding: 10px 8px;
  text-align: center;
}

.pos-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: #6666aa;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.pos-item span:last-child {
  font-size: 16px;
  font-weight: 700;
  color: #ffffff;
  font-variant-numeric: tabular-nums;
}

.actions {
  display: flex;
  gap: 10px;
}

#reset-btn {
  flex: 1;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: #ccccee;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

#reset-btn:hover {
  background: rgba(255, 107, 53, 0.15);
  border-color: rgba(255, 107, 53, 0.3);
  color: #ffffff;
}

.footer {
  font-size: 11px;
  color: #55557a;
  text-align: center;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

/* Header row with theme toggle */
.header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

#theme-toggle {
  padding: 6px 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  color: #aaaacc;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}

#theme-toggle:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

/* Light theme */
#panel.light {
  background: linear-gradient(180deg, #f0f0f8 0%, #e8e8f2 100%);
  border-left-color: rgba(0, 0, 0, 0.06);
}

#panel.light h1 { color: #1a1a2e; }

#panel.light .subtitle { color: #8888aa; }

#panel.light .control-group {
  background: rgba(255, 255, 255, 0.7);
  border-color: rgba(0, 0, 0, 0.08);
}

#panel.light .joint-name { color: #1a1a2e; }

#panel.light .joint-axis {
  color: #8888aa;
  background: rgba(0, 0, 0, 0.04);
}

#panel.light input[type="range"] {
  background: linear-gradient(90deg, #cccce0, #aaaacc);
}

#panel.light .range-labels { color: #8888aa; }

#panel.light #position-display {
  background: rgba(255, 255, 255, 0.7);
  border-color: rgba(0, 0, 0, 0.08);
}

#panel.light #position-display h3 { color: #666688; }

#panel.light .pos-item { background: rgba(0, 0, 0, 0.03); }

#panel.light .pos-label { color: #8888aa; }

#panel.light .pos-item span:last-child { color: #1a1a2e; }

#panel.light #reset-btn {
  border-color: rgba(0, 0, 0, 0.1);
  background: rgba(0, 0, 0, 0.02);
  color: #444466;
}

#panel.light #reset-btn:hover {
  background: rgba(255, 107, 53, 0.1);
  color: #1a1a2e;
}

#panel.light #poses-section {
  background: rgba(255, 255, 255, 0.7);
  border-color: rgba(0, 0, 0, 0.08);
}

#panel.light #poses-section h3 { color: #666688; }

#panel.light .pose-btn {
  border-color: rgba(0, 0, 0, 0.1);
  background: rgba(0, 0, 0, 0.02);
  color: #444466;
}

#panel.light .pose-btn:hover {
  background: #ff6b35;
  color: #ffffff;
  border-color: #ff6b35;
}

#panel.light #theme-toggle {
  border-color: rgba(0, 0, 0, 0.1);
  background: rgba(0, 0, 0, 0.02);
  color: #666688;
}

#panel.light #theme-toggle:hover {
  background: rgba(0, 0, 0, 0.06);
  color: #1a1a2e;
}

#panel.light .footer { color: #aaaacc; border-top-color: rgba(0, 0, 0, 0.06); }

/* Poses section */
#poses-section {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  padding: 14px 16px;
}

#poses-section h3 {
  font-size: 13px;
  font-weight: 600;
  color: #aaaacc;
  margin-bottom: 10px;
}

.poses-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.pose-btn {
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: #ccccee;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.pose-btn:hover {
  background: #ff6b35;
  color: #ffffff;
  border-color: #ff6b35;
}

/* Scrollbar */
#panel::-webkit-scrollbar {
  width: 4px;
}

#panel::-webkit-scrollbar-track {
  background: transparent;
}

#panel::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
}
