/* 基础样式 */
:root {
  --primary-color: #2196F3;
  --secondary-color: #FF5252;
  --accent-color: #FFC107;
  --bg-color: #121212;
  --panel-bg: rgba(30, 30, 30, 0.9);
  --text-color: #FFFFFF;
  --border-color: #333333;
  --shadow-color: rgba(0, 0, 0, 0.5);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  overflow: hidden;
  touch-action: none;
  user-select: none;
  height: 100vh;
  width: 100vw;
  display: flex;
  justify-content: center;
  align-items: center;
}

.container {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
}

/* 返回链接 */
.back-link {
  position: fixed;
  top: 15px;
  right: 15px;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.6);
  color: var(--text-color);
  padding: 8px 15px;
  border-radius: 4px;
  text-decoration: none;
  font-size: 0.9rem;
  backdrop-filter: blur(5px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: all 0.3s ease;
}

.back-link:hover {
  background: rgba(0, 0, 0, 0.8);
  border-color: var(--primary-color);
}

/* 画布容器 */
.canvas-container {
  flex: 1;
  height: 100%;
  overflow: hidden;
  position: relative;
}

#shadowCanvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--bg-color);
  cursor: crosshair;
}

/* 工具面板 */
.tools-panel {
  width: 250px;
  height: 100%;
  background-color: var(--panel-bg);
  border-left: 1px solid var(--border-color);
  padding: 20px 15px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto;
  box-shadow: -2px 0 10px var(--shadow-color);
  z-index: 10;
}

.tool-section {
  margin-bottom: 15px;
}

.section-title {
  font-size: 1.1rem;
  margin-bottom: 10px;
  color: var(--primary-color);
  font-weight: bold;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 5px;
}

/* 光源选择 */
.light-options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.light-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.light-option:hover {
  background: rgba(255, 255, 255, 0.1);
}

.light-option.active {
  background: rgba(33, 150, 243, 0.2);
  border-color: var(--primary-color);
}

.light-icon {
  font-size: 1.5rem;
  margin-bottom: 5px;
}

.light-name {
  font-size: 0.9rem;
}

/* 物体选择 */
.object-options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.object-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.object-option:hover {
  background: rgba(255, 255, 255, 0.1);
}

.object-option.active {
  background: rgba(255, 82, 82, 0.2);
  border-color: var(--secondary-color);
}

.object-icon {
  font-size: 1.5rem;
  margin-bottom: 5px;
}

.object-name {
  font-size: 0.9rem;
}

/* 颜色选择器 */
.color-picker {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.color-option {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 2px solid var(--border-color);
}

.color-option:hover {
  transform: scale(1.1);
}

.color-option.active {
  border: 2px solid var(--text-color);
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

/* 控制按钮 */
.control-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: auto;
}

.control-btn {
  background-color: rgba(255, 255, 255, 0.1);
  color: var(--text-color);
  border: 1px solid var(--border-color);
  border-radius: 5px;
  padding: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: inherit;
}

.control-btn:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

/* 设置面板 */
.settings-panel {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
  max-width: 400px;
  background-color: var(--panel-bg);
  border-radius: 10px;
  box-shadow: 0 5px 20px var(--shadow-color);
  z-index: 100;
  overflow: hidden;
}

.settings-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  background-color: rgba(33, 150, 243, 0.2);
  border-bottom: 1px solid var(--border-color);
}

.settings-header h3 {
  margin: 0;
  font-size: 1.2rem;
}

.close-btn {
  background: none;
  border: none;
  color: var(--text-color);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
}

.settings-content {
  padding: 20px;
}

.setting-item {
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
}

.setting-item label {
  width: 120px;
  font-size: 0.9rem;
}

.setting-item input[type="range"] {
  flex: 1;
  height: 5px;
  -webkit-appearance: none;
  background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
  outline: none;
  border-radius: 5px;
  margin: 0 10px;
}

.setting-item input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--text-color);
  cursor: pointer;
  border: 2px solid var(--primary-color);
}

.value-display {
  width: 40px;
  text-align: right;
  font-size: 0.9rem;
}

.setting-item.checkbox {
  display: flex;
  justify-content: space-between;
}

.setting-item.checkbox input {
  width: 20px;
  height: 20px;
}

/* 操作提示 */
.instructions-panel {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.6);
  color: var(--text-color);
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 0.9rem;
  backdrop-filter: blur(5px);
  z-index: 50;
  text-align: center;
}

.instructions-panel span {
  color: var(--primary-color);
  font-weight: bold;
}

.hidden {
  display: none !important;
}

/* 响应式调整 */
@media (max-width: 768px) {
  .container {
    flex-direction: column;
  }
  
  .tools-panel {
    width: 100%;
    height: auto;
    max-height: 40%;
    border-left: none;
    border-top: 1px solid var(--border-color);
    padding: 10px;
    flex-direction: row;
    flex-wrap: wrap;
    overflow-x: auto;
    overflow-y: hidden;
  }
  
  .tool-section {
    min-width: 150px;
    margin-right: 15px;
  }
  
  .control-buttons {
    flex-direction: row;
    margin-top: 0;
    margin-left: auto;
  }
  
  .control-btn {
    padding: 8px 12px;
    font-size: 0.9rem;
  }
  
  .instructions-panel {
    bottom: auto;
    top: 20px;
  }
}

@media (max-width: 480px) {
  .tools-panel {
    max-height: 50%;
    gap: 10px;
  }
  
  .light-options, .object-options {
    grid-template-columns: repeat(2, 1fr);
    gap: 5px;
  }
  
  .color-picker {
    grid-template-columns: repeat(4, 1fr);
    gap: 5px;
  }
  
  .color-option {
    width: 30px;
    height: 30px;
  }
  
  .light-option, .object-option {
    padding: 5px;
  }
  
  .light-icon, .object-icon {
    font-size: 1.2rem;
  }
  
  .light-name, .object-name {
    font-size: 0.8rem;
  }
  
  .control-buttons {
    width: 100%;
    justify-content: space-between;
  }
  
  .control-btn {
    flex: 1;
    font-size: 0.8rem;
    padding: 6px 8px;
  }
}
