/* 基础样式 */
:root {
  --primary-color: #00f3ff;
  --secondary-color: #ff00a0;
  --accent-color: #ffcc00;
  --bg-color: #0a0a12;
  --panel-bg: rgba(20, 20, 35, 0.85);
  --text-color: #e0e0e0;
  --shadow-color: rgba(0, 0, 0, 0.5);
  --transition-speed: 0.3s;
}

* {
  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);
  min-height: 100vh;
  overflow: hidden;
  position: relative;
}

.container {
  width: 100%;
  height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* 标题样式 */
.header {
  text-align: center;
  padding: 15px 0;
  z-index: 10;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  pointer-events: none; /* 允许点击穿透 */
}

.title {
  font-size: 2.5rem;
  color: var(--primary-color);
  text-shadow:
    0 0 5px var(--primary-color),
    0 0 10px rgba(0, 243, 255, 0.5);
  letter-spacing: 1px;
  margin-bottom: 5px;
}

.subtitle {
  color: var(--text-color);
  opacity: 0.8;
  font-size: 1rem;
}

/* 返回链接 */
.back-link {
  position: fixed;
  top: 15px;
  left: 15px;
  z-index: 100;
  background: rgba(0, 0, 0, 0.6);
  color: var(--text-color);
  padding: 10px 15px;
  border-radius: 4px;
  text-decoration: none;
  font-size: 0.9rem;
  backdrop-filter: blur(5px);
  border: 1px solid rgba(0, 243, 255, 0.3);
  transition: all var(--transition-speed) ease;
  display: flex;
  align-items: center;
  gap: 5px;
}

.back-link:hover, .back-link:active {
  background: rgba(0, 243, 255, 0.2);
  border-color: var(--primary-color);
}

/* 加载指示器 */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 10, 18, 0.9);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  backdrop-filter: blur(5px);
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(0, 243, 255, 0.3);
  border-radius: 50%;
  border-top: 4px solid var(--primary-color);
  animation: spin 1s linear infinite;
}

.loading-text {
  margin-top: 15px;
  color: var(--primary-color);
  font-size: 1.1rem;
}

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

/* 3D场景容器 */
.scene-container {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  overflow: hidden;
}

/* 控制面板 */
.controls-panel {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background: var(--panel-bg);
  border-radius: 15px 15px 0 0;
  backdrop-filter: blur(10px);
  box-shadow: 0 -5px 15px rgba(0, 0, 0, 0.3);
  z-index: 50;
  transition: transform 0.4s ease;
  max-height: 70vh;
  overflow-y: auto;
}

.controls-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.controls-header h3 {
  color: var(--primary-color);
  margin: 0;
}

.toggle-btn {
  background: transparent;
  border: none;
  color: var(--text-color);
  font-size: 1.2rem;
  cursor: pointer;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s ease;
}

.toggle-btn.active {
  transform: rotate(180deg);
}

.controls-content {
  padding: 20px;
  max-height: 60vh;
  overflow-y: auto;
}

/* 上传部分 */
.upload-section {
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.preset-images {
  display: flex;
  gap: 10px;
  margin-top: 15px;
  justify-content: center;
  flex-wrap: wrap;
}

.preset-image {
  width: 60px;
  height: 60px;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.3s ease;
}

.preset-image:hover, .preset-image.active {
  border-color: var(--primary-color);
  transform: translateY(-2px);
  box-shadow: 0 5px 10px rgba(0, 0, 0, 0.3);
}

.preset-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* 滑块控制 */
.control-group {
  margin-bottom: 15px;
}

.control-group label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.95rem;
}

.slider-container {
  display: flex;
  align-items: center;
  gap: 15px;
}

.slider {
  flex: 1;
  height: 8px;
  -webkit-appearance: none;
  background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
  outline: none;
  border-radius: 5px;
  cursor: pointer;
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--text-color);
  cursor: pointer;
  border: 2px solid var(--primary-color);
  box-shadow: 0 0 5px var(--primary-color);
}

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

/* 颜色控制 */
.color-controls {
  display: flex;
  gap: 15px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.color-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.color-option label {
  font-size: 0.9rem;
}

input[type="color"] {
  -webkit-appearance: none;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  background: none;
}

input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
  border-radius: 50%;
}

input[type="color"]::-webkit-color-swatch {
  border: 2px solid var(--text-color);
  border-radius: 50%;
}

/* 预设效果 */
.presets-container {
  margin-bottom: 20px;
}

.presets-container h4 {
  margin-bottom: 10px;
  color: var(--text-color);
}

.preset-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.preset-btn {
  padding: 8px 15px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(0, 243, 255, 0.3);
  border-radius: 20px;
  color: var(--text-color);
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.9rem;
}

.preset-btn:hover, .preset-btn.active {
  background: rgba(0, 243, 255, 0.2);
  border-color: var(--primary-color);
  transform: translateY(-2px);
}

/* 按钮样式 */
.buttons-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.btn {
  padding: 10px 15px;
  border: none;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.3);
  color: var(--text-color);
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
  flex: 1;
  min-width: 80px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.9rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn:hover {
  background: rgba(0, 243, 255, 0.2);
  transform: translateY(-2px);
}

.primary-btn {
  background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
  color: #000;
  border: none;
}

.primary-btn:hover {
  box-shadow: 0 0 10px rgba(0, 243, 255, 0.7);
}

/* 使用提示 */
.tips-container {
  position: fixed;
  top: 80px;
  right: 20px;
  background: var(--panel-bg);
  border-radius: 8px;
  padding: 15px;
  backdrop-filter: blur(5px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
  z-index: 40;
  max-width: 250px;
  border: 1px solid rgba(0, 243, 255, 0.2);
  transition: transform 0.3s ease, opacity 0.3s ease;
}

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

.tip:last-child {
  margin-bottom: 0;
}

.tip i {
  color: var(--primary-color);
  font-size: 1.2rem;
}

.close-btn {
  position: absolute;
  top: 5px;
  right: 5px;
  background: transparent;
  border: none;
  color: var(--text-color);
  font-size: 1rem;
  cursor: pointer;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 模态框 */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  z-index: 1000;
  backdrop-filter: blur(5px);
}

.modal-content {
  position: relative;
  background: var(--panel-bg);
  margin: 10% auto;
  padding: 20px;
  border-radius: 12px;
  width: 90%;
  max-width: 500px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(0, 243, 255, 0.2);
}

.close-modal {
  position: absolute;
  top: 10px;
  right: 15px;
  color: var(--text-color);
  font-size: 24px;
  font-weight: bold;
  cursor: pointer;
}

.modal h3 {
  color: var(--primary-color);
  margin-bottom: 15px;
  text-align: center;
}

.modal p {
  margin-bottom: 20px;
  line-height: 1.5;
}

/* 分享选项 */
.share-options {
  display: flex;
  justify-content: space-around;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
}

.share-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  background: transparent;
  border: none;
  color: var(--text-color);
  cursor: pointer;
  padding: 10px;
  border-radius: 8px;
  transition: all 0.3s ease;
}

.share-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.share-btn i {
  font-size: 1.5rem;
  margin-bottom: 5px;
}

.qr-code-container {
  display: flex;
  justify-content: center;
  margin-top: 15px;
}

/* GIF导出相关样式 */
.gif-settings {
  margin-bottom: 20px;
}

.setting-group {
  margin-bottom: 15px;
}

.setting-group label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.95rem;
}

.gif-preview-container {
  width: 100%;
  height: 200px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  margin-bottom: 20px;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

.gif-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: rgba(255, 255, 255, 0.5);
}

.gif-placeholder i {
  font-size: 3rem;
  margin-bottom: 10px;
}

.gif-progress {
  width: 100%;
  height: 20px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 10px;
  margin-bottom: 20px;
  overflow: hidden;
  position: relative;
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
  border-radius: 10px;
  transition: width 0.3s ease;
}

.progress-text {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-color);
}

.gif-preview-container img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 4px;
}

/* 响应式设计 */
@media (min-width: 768px) {
  .controls-panel {
    width: 350px;
    right: 20px;
    left: auto;
    border-radius: 12px;
    bottom: 20px;
    max-height: calc(100vh - 40px);
  }

  .tips-container {
    top: 100px;
  }

  .header {
    padding: 25px 0;
  }

  .title {
    font-size: 3rem;
  }

  .subtitle {
    font-size: 1.2rem;
  }
}

@media (max-width: 767px) {
  .controls-panel {
    transform: translateY(calc(100% - 60px));
  }

  .controls-panel.expanded {
    transform: translateY(0);
  }

  .title {
    font-size: 2rem;
  }

  .buttons-row {
    flex-direction: column;
  }

  .btn {
    width: 100%;
  }

  .modal-content {
    margin: 20% auto;
    width: 95%;
    padding: 15px;
  }
}

/* 触摸设备优化 */
@media (hover: none) {
  .btn:hover, .preset-btn:hover, .preset-image:hover {
    transform: none;
    box-shadow: none;
  }
}
