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

body {
  font-family: -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  overflow: hidden;
  background: #0a0a0a;
  color: #fff;
  height: 100vh;
  width: 100vw;
}

#app {
  position: relative;
  width: 100%;
  height: 100%;
}

#canvas3d {
  display: block;
  width: 100%;
  height: 100%;
}

/* Header */
#header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: linear-gradient(180deg, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0) 100%);
  z-index: 100;
  pointer-events: none;
}

#header h1 {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 2px;
  text-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

#btn-screenshot {
  pointer-events: auto;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.2s;
}
#btn-screenshot:hover { background: rgba(255,255,255,0.2); }

/* Panels */
.clothing-panel, #clothing-panel, #control-panel {
  position: fixed;
  top: 64px;
  bottom: 48px;
  width: 260px;
  padding: 16px;
  overflow-y: auto;
  z-index: 50;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.2) transparent;
}

#clothing-panel {
  left: 12px;
  background: linear-gradient(135deg, rgba(15,15,25,0.92) 0%, rgba(20,20,35,0.88) 100%);
  border-radius: 16px;
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.08);
}

#control-panel {
  right: 12px;
  background: linear-gradient(135deg, rgba(15,15,25,0.92) 0%, rgba(20,20,35,0.88) 100%);
  border-radius: 16px;
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.08);
}

#clothing-panel h2, #control-panel h2 {
  font-size: 14px;
  font-weight: 600;
  color: rgba(255,255,255,0.6);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin: 16px 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
#clothing-panel h2:first-child, #control-panel h2:first-child {
  margin-top: 0;
}

/* Clothing Items */
.clothing-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  margin-bottom: 6px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.25s ease;
  background: rgba(255,255,255,0.03);
  border: 1px solid transparent;
}
.clothing-item:hover {
  background: rgba(255,255,255,0.08);
  transform: translateX(4px);
}
.clothing-item.active {
  background: rgba(100,140,255,0.15);
  border-color: rgba(100,140,255,0.4);
  box-shadow: 0 0 20px rgba(100,140,255,0.1);
}

.clothing-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.clothing-info {
  flex: 1;
}
.clothing-info .name {
  font-size: 14px;
  font-weight: 500;
}
.clothing-info .desc {
  font-size: 11px;
  color: rgba(255,255,255,0.4);
  margin-top: 2px;
}

/* Controls */
.control-group {
  margin-bottom: 14px;
}
.control-group label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: rgba(255,255,255,0.7);
  margin-bottom: 6px;
}
.control-group label span {
  color: #6488ff;
  font-weight: 600;
  font-size: 12px;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: rgba(255,255,255,0.1);
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #6488ff;
  cursor: pointer;
  box-shadow: 0 0 8px rgba(100,136,255,0.5);
  transition: transform 0.15s;
}
input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}
input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #6488ff;
  cursor: pointer;
  border: none;
  box-shadow: 0 0 8px rgba(100,136,255,0.5);
}

/* Color picker */
#color-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}
.color-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}
.color-btn:hover { transform: scale(1.15); }
.color-btn.active { border-color: #fff; box-shadow: 0 0 12px rgba(255,255,255,0.3); }

/* Animation buttons */
.anim-btn {
  width: 100%;
  padding: 8px;
  margin-bottom: 6px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  color: rgba(255,255,255,0.6);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}
.anim-btn:hover { background: rgba(255,255,255,0.1); color: #fff; }
.anim-btn.active {
  background: rgba(100,140,255,0.15);
  border-color: rgba(100,140,255,0.4);
  color: #6488ff;
}

/* Footer */
#footer {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: linear-gradient(0deg, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0) 100%);
  font-size: 12px;
  color: rgba(255,255,255,0.35);
  z-index: 100;
  pointer-events: none;
}

#fps-counter { color: rgba(100,200,100,0.6); }

/* Loading */
#loading {
  position: fixed;
  inset: 0;
  background: #0a0a0a;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.5s;
}
#loading.hidden { opacity: 0; pointer-events: none; }

.spinner {
  width: 48px;
  height: 48px;
  border: 3px solid rgba(255,255,255,0.1);
  border-top-color: #6488ff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

#loading p {
  margin-top: 16px;
  color: rgba(255,255,255,0.5);
  font-size: 14px;
}

/* Responsive */
@media (max-width: 900px) {
  #clothing-panel { width: 200px; left: 8px; }
  #control-panel { width: 200px; right: 8px; }
}

@media (max-width: 640px) {
  #clothing-panel, #control-panel {
    position: fixed;
    top: auto;
    bottom: 48px;
    width: 100%;
    left: 0; right: 0;
    height: 200px;
    border-radius: 16px 16px 0 0;
    display: none;
  }
  #clothing-panel.show, #control-panel.show { display: block; }
}
