body {
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  font-family: 'Noto Sans KR', Arial, sans-serif;
  background: linear-gradient(135deg, #e9ecef 0%, #f7fafc 100%);
  min-height: 100vh;
}

#container {
  /* unchanged */

  position: absolute;
  left: 0;
  top: 0;
  width: calc(100vw - 240px);
  height: 100vh;
  box-sizing: border-box;
}

/* 비디오 사이드바 스타일 */
.video-item {
  margin-bottom: 10px;
  padding: 8px;
  border-radius: 6px;
  border: 2px solid transparent;
  background: rgba(248, 250, 252, 0.8);
  transition: all 0.2s ease;
}

.video-item.placed {
  border-color: #22c55e;
  background: rgba(34, 197, 94, 0.1);
}

.video-item.unplaced {
  border-color: #f59e0b;
  background: rgba(245, 158, 11, 0.1);
}

.video-item.placing {
  border-color: #3b82f6;
  background: rgba(59, 130, 246, 0.1);
  animation: video-pulse 1s infinite;
}

@keyframes video-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.place-video-btn:hover {
  background: #1976D2 !important;
  transform: translateY(-1px);
}

#video-sidebar {
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

#start-video-btn:hover {
  background: #45a049 !important;
}

#stop-video-btn:hover {
  background: #da190b !important;
}

#color-picker {
  /* unchanged */

  position: absolute;
  right: 0;
  top: 0;
  width: 240px;
  height: 100vh;
  background: #fff;
  border-left: 1px solid #ccc;
  box-shadow: -2px 0 8px rgba(0,0,0,0.04);
  padding: 32px 24px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-y: auto;
}

#color-picker h3 {
  margin-top: 0;
  margin-bottom: 24px;
  font-size: 1.2rem;
  color: #333;
}

/* 상단 버튼 그룹 스타일 */
.button-group {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  width: 100%;
  justify-content: center;
}

.icon-button {
  position: relative;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 12px;
  width: 48px;
  height: 48px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
  background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

.icon-button .icon {
  font-size: 20px;
  line-height: 1;
}

/* 툴팁 스타일 */
.icon-button::before {
  content: attr(data-tooltip);
  position: absolute;
  bottom: -35px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
  z-index: 1000;
}

.icon-button::after {
  content: '';
  position: absolute;
  bottom: -25px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-bottom: 4px solid rgba(0, 0, 0, 0.8);
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
  z-index: 1000;
}

.icon-button:hover::before,
.icon-button:hover::after {
  opacity: 1;
  visibility: visible;
}

/* 조명 토글 버튼 특별 스타일 */
.lighting-on {
  background: linear-gradient(135deg, #ffd700 0%, #ffb347 100%) !important;
  box-shadow: 0 4px 12px rgba(255, 215, 0, 0.3) !important;
}

.lighting-on:hover {
  background: linear-gradient(135deg, #ffb347 0%, #ffd700 100%) !important;
  box-shadow: 0 8px 20px rgba(255, 215, 0, 0.4) !important;
}

.lighting-off {
  background: linear-gradient(135deg, #6c757d 0%, #495057 100%) !important;
  box-shadow: 0 4px 12px rgba(108, 117, 125, 0.2) !important;
}

.lighting-off:hover {
  background: linear-gradient(135deg, #495057 0%, #6c757d 100%) !important;
  box-shadow: 0 8px 20px rgba(108, 117, 125, 0.3) !important;
}

#cubeColor {
  /* unchanged */

  width: 80px;
  height: 80px;
  border: none;
  background: none;
  cursor: pointer;
  margin-bottom: 16px;
}

#preset-colors {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-bottom: 12px;
  width: 100%;
}

.color-preset {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  cursor: pointer;
  border: 2px solid #e2e8f0;
  transition: all 0.2s ease;
  position: relative;
}

.color-preset:hover {
  transform: scale(1.1);
  border-color: #6366f1;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.color-preset.selected {
  border-color: #6366f1;
  border-width: 3px;
  transform: scale(1.05);
  box-shadow: 0 0 0 2px #a5b4fc44;
}

.color-preset[style*="ffffff"] {
  border-color: #cbd5e1;
}

.color-preset[style*="ffffff"]:hover,
.color-preset[style*="ffffff"].selected {
  border-color: #6366f1;
}

/* 조작키 가이드 스타일 */
#controls-guide {
  margin-top: 24px;
  padding: 16px;
  background: #f8fafc;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  font-size: 0.85rem;
}

#controls-guide h4 {
  margin: 0 0 12px 0;
  font-size: 1rem;
  color: #1e293b;
  text-align: center;
  font-weight: 600;
}

.control-section {
  margin-bottom: 12px;
}

.control-section:last-child {
  margin-bottom: 0;
}

.control-title {
  font-weight: 600;
  color: #334155;
  margin-bottom: 6px;
  font-size: 0.9rem;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 2px;
}

.control-item {
  margin-bottom: 3px;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 6px;
}

.control-item:last-child {
  margin-bottom: 0;
}

kbd {
  background: #334155;
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  font-size: 0.75rem;
  font-weight: bold;
  min-width: 16px;
  text-align: center;
  display: inline-block;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* ---- 로그인/회원가입/공간 카드 스타일 ---- */

#login-container, #spaces-container {
  max-width: 350px;
  margin: 80px auto;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 6px 32px 0 rgba(0,0,0,0.10), 0 1.5px 4px 0 rgba(0,0,0,0.03);
  padding: 38px 34px 30px 34px;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

#login-container h2, #spaces-container h2 {
  margin-top: 0;
  margin-bottom: 8px;
  font-size: 2rem;
  color: #2d3748;
  font-weight: 700;
  letter-spacing: -1px;
}

#login-container h3 {
  margin-top: 32px;
  margin-bottom: 8px;
  font-size: 1.1rem;
  color: #4a5568;
}

#login-form, #signup-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 0;
}

#login-form input, #signup-form input {
  padding: 12px 14px;
  border-radius: 8px;
  border: 1.5px solid #cbd5e1;
  outline: none;
  font-size: 1rem;
  margin-bottom: 0;
  background: #f7fafc;
  transition: border 0.2s, box-shadow 0.2s;
}
#login-form input:focus, #signup-form input:focus {
  border: 1.5px solid #6366f1;
  box-shadow: 0 0 0 2px #a5b4fc44;
}

#login-form button, #signup-form button, #create-space, #logout-btn, .delete-btn {
  background: linear-gradient(90deg, #6366f1 0%, #60a5fa 100%);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 12px 0;
  margin-top: 8px;
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 8px 0 rgba(99,102,241,0.07);
  transition: background 0.2s, transform 0.1s;
}
#login-form button:hover, #signup-form button:hover, #create-space:hover, #logout-btn:hover, .delete-btn:hover {
  background: linear-gradient(90deg, #6366f1 20%, #2563eb 100%);
  transform: translateY(-2px) scale(1.03);
}

#login-message {
  margin-top: 18px;
  color: #e53e3e;
  font-size: 0.97rem;
  min-height: 18px;
  text-align: center;
}

#spaces-container #user-info {
  font-size: 1.08rem;
  color: #64748b;
  margin-bottom: 18px;
  text-align: left;
  width: 100%;
}
#spaces-container ul#space-list {
  width: 100%;
  list-style: none;
  padding-left: 0;
  margin-bottom: 24px;
}
#spaces-container ul#space-list li {
  background: #f1f5f9;
  border-radius: 7px;
  margin-bottom: 10px;
  padding: 13px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 1.08rem;
  box-shadow: 0 1px 3px 0 rgba(0,0,0,0.03);
  transition: box-shadow 0.2s, background 0.15s;
}
#spaces-container ul#space-list li:hover {
  background: #e0e7ef;
  box-shadow: 0 2px 7px 0 rgba(99,102,241,0.09);
}
#spaces-container ul#space-list a {
  color: #6366f1;
  font-weight: 600;
  text-decoration: none;
  transition: color 0.2s;
}
#spaces-container ul#space-list a:hover {
  color: #2563eb;
  text-decoration: underline;
}
.delete-btn {
  background: #e53e3e;
  color: #fff;
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 0.97rem;
  margin-left: 10px;
  box-shadow: none;
  transition: background 0.2s;
}
.delete-btn:hover {
  background: #c53030;
}
#logout-btn {
  margin-top: 18px;
  width: 100%;
  background: #64748b;
  background: linear-gradient(90deg, #64748b 0%, #94a3b8 100%);
  color: #fff;
}
#logout-btn:hover {
  background: #334155;
}

@media (max-width: 500px) {
  #login-container, #spaces-container {
    max-width: 98vw;
    padding: 18px 4vw 18px 4vw;
    margin: 30px auto;
  }
  
  #container {
    width: 100vw;
    height: calc(100vh - 200px);
  }
  
  #color-picker {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100vw;
    height: 200px;
    border-left: none;
    border-top: 1px solid #ccc;
    flex-direction: column;
    justify-content: flex-start;
    padding: 12px;
    overflow-y: auto;
  }
  
  #color-picker h3 {
    margin: 0 0 8px 0;
    font-size: 0.9rem;
  }
  
  #preset-colors {
    grid-template-columns: repeat(10, 1fr);
    gap: 4px;
    margin-bottom: 8px;
  }
  
  .color-preset {
    width: 25px;
    height: 25px;
  }
  
  #cubeColor {
    width: 50px;
    height: 50px;
    margin: 0;
  }
  
  #downloadButton {
    padding: 8px 16px;
    font-size: 0.9rem;
    margin: 8px 0 0 0;
  }
  
  #homeButton {
    padding: 6px 12px;
    font-size: 0.8rem;
    margin-bottom: 8px;
  }
  
  #controls-guide {
    margin-top: 12px;
    padding: 12px;
    font-size: 0.75rem;
  }
  
  #controls-guide h4 {
    font-size: 0.9rem;
    margin-bottom: 8px;
  }
  
  .control-section {
    margin-bottom: 8px;
  }
  
  .control-title {
    font-size: 0.8rem;
    margin-bottom: 4px;
  }
  
  .control-item {
    margin-bottom: 2px;
  }
  
  kbd {
    padding: 1px 4px;
    font-size: 0.7rem;
    min-width: 14px;
  }
}

/* 로딩 스피너 */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid #e5e7eb;
  border-top: 4px solid #6366f1;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.loading-text {
  margin-top: 16px;
  font-size: 1.1rem;
  color: #6b7280;
  font-weight: 500;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* 토스트 알림 */
.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  background: #10b981;
  color: white;
  padding: 12px 20px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 10000;
  opacity: 0;
  transform: translateX(100px);
  transition: all 0.3s ease;
}

.toast.show {
  opacity: 1;
  transform: translateX(0);
}

.toast.error {
  background: #ef4444;
}

/* 모델 드롭존 */
#model-drop-zone {
  width: 100%;
  height: 120px;
  border: 2px dashed #cbd5e1;
  border-radius: 12px;
  background: #f8fafc;
  margin: 16px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
}

#model-drop-zone:hover {
  border-color: #6366f1;
  background: #f1f5f9;
}

#model-drop-zone.drag-over {
  border-color: #10b981;
  background: #ecfdf5;
  transform: scale(1.02);
}

.drop-zone-content {
  text-align: center;
  pointer-events: none;
}

.drop-zone-icon {
  font-size: 2rem;
  margin-bottom: 8px;
}

.drop-zone-text {
  font-size: 0.95rem;
  font-weight: 600;
  color: #475569;
  margin-bottom: 4px;
}

.drop-zone-subtext {
  font-size: 0.8rem;
  color: #64748b;
}

/* 모델 배치 모드 커서 */
.placement-mode {
  cursor: none !important;
}

.placement-cursor {
  position: fixed;
  pointer-events: none;
  z-index: 10000;
  border: 2px solid #10b981;
  background: rgba(16, 185, 129, 0.2);
  border-radius: 4px;
  transform: translate(-50%, -50%);
}