/* 基础样式 - 所有设备通用 */

:root {
  /* 统一间距变量 - 默认值，各媒体查询中会被覆盖 */
  --form-padding-top: 24px;
  --form-container-bottom: 10%;
  --form-estimated-height: 88px;
  --result-container-gap: 20px;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: "Segoe UI", "Lucida Grande", Helvetica, Arial, sans-serif;
  color: #1f2933;
}

/* 加载动画 - 全屏白色背景 */
.loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #ffffff;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.3s ease;
}

.loading-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.loading-logo {
  width: 80px;
  height: 80px;
  animation: rotate 2s linear infinite;
}

.loading-text {
  font-size: 16px;
  color: #666;
  font-weight: 500;
}

@keyframes rotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Logo 容器 - 固定在左上角 */
.logo-container {
  position: fixed;
  top: 20px;
  left: 20px;
  z-index: 1000;
  pointer-events: none; /* 不阻挡其他元素的交互 */
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-img {
  display: block;
  height: auto;
  max-width: 100%;
  /* 默认尺寸会在响应式 CSS 中设置 */
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.15));
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.logo-img:hover {
  transform: scale(1.05);
}

.team-name {
  font-size: 20px;
  font-weight: 600;
  color: #1f2933;
  letter-spacing: 2px;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.15));
  transition: all 0.3s ease;
}


/* 全屏按钮 */
.fullscreen-btn {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  color: #1f2933;
  font-size: 20px;
}

.fullscreen-btn:hover {
  background: rgba(255, 255, 255, 1);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
  transform: scale(1.05);
}

.fullscreen-btn:active {
  transform: scale(0.95);
}

/* 操作指南按钮 */
.guide-btn {
  position: fixed;
  top: 20px;
  right: 80px;
  z-index: 1000;
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  color: #1f2933;
  font-size: 20px;
}

.exit-btn {
  position: fixed;
  top: 20px;
  right: 140px;
  z-index: 1000;
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  color: #1f2933;
  font-size: 20px;
}

.exit-btn:hover {
  background: rgba(255, 255, 255, 1);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
  transform: scale(1.05);
}

.exit-btn:active {
  transform: scale(0.95);
}

.guide-btn:hover {
  background: rgba(255, 255, 255, 1);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
  transform: scale(1.05);
}

.guide-btn:active {
  transform: scale(0.95);
}

/* 右上角按钮组 */
.top-right-buttons {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  display: flex;
  gap: 12px;
  align-items: center;
}

.action-btn {
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  color: #1f2933;
  font-size: 20px;
}

.action-btn:hover {
  background: rgba(255, 255, 255, 1);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
  transform: scale(1.05);
}

.action-btn:active {
  transform: scale(0.95);
}

/* 操作指南提示框 */
.guide-tooltip {
  position: fixed;
  top: 80px;
  right: 20px;
  transform: scale(0.9);
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
  transform-origin: top right;
}

.guide-tooltip.show {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
}

.guide-tooltip-content {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  padding: 24px;
  min-width: 320px;
  max-width: 400px;
  position: relative;
}

.guide-tooltip-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: none;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #666;
  font-size: 16px;
  transition: all 0.2s ease;
}

.guide-tooltip-close:hover {
  background: rgba(0, 0, 0, 0.1);
  color: #333;
  transform: scale(1.1);
}

.guide-tooltip-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  padding-right: 32px;
}

.guide-tooltip-header i {
  font-size: 24px;
  color: #ffc107;
}

.guide-tooltip-header h4 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: #1f2933;
}

.guide-tooltip-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.guide-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: rgba(0, 0, 0, 0.02);
  border-radius: 8px;
  transition: all 0.2s ease;
}

.guide-item:hover {
  background: rgba(0, 0, 0, 0.05);
  transform: translateX(4px);
}

.guide-item i {
  font-size: 20px;
  color: #4a90e2;
  flex-shrink: 0;
}

.guide-item span {
  font-size: 15px;
  color: #555;
  line-height: 1.5;
}

/* 全屏模式下隐藏容器 */
body:fullscreen .result-container,
body:-webkit-full-screen .result-container,
body:-moz-full-screen .result-container,
body:-ms-fullscreen .result-container {
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(100vh);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

body:fullscreen .form-container,
body:-webkit-full-screen .form-container,
body:-moz-full-screen .form-container,
body:-ms-fullscreen .form-container {
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(100vh);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

/* 使用类名控制（兼容性更好） */
body.fullscreen-mode .result-container,
body.fullscreen-mode .form-container {
  opacity: 0 !important;
  pointer-events: none !important;
  transform: translateX(-50%) translateY(100vh) !important;
  transition: opacity 0.3s ease, transform 0.3s ease !important;
}

/* 剪纸碎屑动画容器 */
.paper-scraps-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 100;
  overflow: hidden;
}

/* 剪纸碎屑 - 默认三角形，通过JS动态设置clip-path */
.paper-scrap {
  position: absolute;
  opacity: 0.95;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.3);
  background-color: #ad221f;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
  z-index: 50;
  animation: fall-scrap 2.5s ease-out forwards;
}

/* 碎屑掉落动画 */
@keyframes fall-scrap {
  0% {
    transform: translateY(0) translateX(0) rotate(var(--initial-rotation, 0deg)) scale(1);
    opacity: 1;
  }
  30% {
    transform: translateY(30vh) translateX(calc(var(--horizontal-offset, 0px) * 0.3)) rotate(calc(var(--initial-rotation, 0deg) + 120deg)) scale(0.95);
    opacity: 0.9;
  }
  60% {
    transform: translateY(60vh) translateX(calc(var(--horizontal-offset, 0px) * 0.6)) rotate(calc(var(--initial-rotation, 0deg) + 240deg)) scale(0.85);
    opacity: 0.75;
  }
  100% {
    transform: translateY(100vh) translateX(var(--horizontal-offset, 0px)) rotate(calc(var(--initial-rotation, 0deg) + 360deg)) scale(0.7);
    opacity: 0;
  }
}

/* 3D 全屏背景 */
.viewer3d-fullscreen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

.viewer3d__canvas {
  width: 100%;
  height: 100%;
  position: relative;
}

/* 确保 canvas 正常显示 */
.viewer3d__canvas canvas {
  position: relative;
  z-index: 0;
}

.viewer3d__canvas canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

/* 生成结果图片容器 */
.result-container {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  z-index: 25; /* 提高 z-index，确保在 form-container 之上，可以交互 */
  pointer-events: none; /* 容器本身不接收事件，但子元素可以 */
  width: auto;
  text-align: center;
  transition: bottom 0.4s ease, opacity 0.4s ease;
  opacity: 1;
  display: flex;
  align-items: center; /* 改为垂直居中，确保内容可见 */
  justify-content: center;
  overflow: visible;
  padding-bottom: 15px; /* 底部内边距 */
}

.result-container.interacting {
  opacity: 0.3;
}

/* 历史记录容器 - 使用 Swiper */
.history-wrapper {
  height: 140px;
  overflow: visible; /* 改为 visible，确保内容不被裁切 */
  position: relative;
  pointer-events: auto;
  width: 100%;
  padding-right: var(--bs-gutter-x, 1.5rem); /* Bootstrap 默认右边距 */
  padding-bottom: 15px; /* 底部内边距，对应 result-container 的 padding-bottom */
  box-sizing: border-box; /* 确保 padding 包含在高度内 */
}

/* Swiper 容器 */
.history-swiper {
  width: 100%;
  height: 100%;
  /* 不做溢出隐藏，让 Swiper 自己管理可见区域 */
  overflow: visible;
}

.history-swiper .swiper-wrapper {
  align-items: center; /* PC 端垂直居中 */
  display: flex; /* 确保使用 flex 布局 */
  justify-content: center; /* PC 端水平居中 */
}

.history-swiper .swiper-slide {
  width: auto !important; /* 覆盖 Swiper 内联样式的宽度，例如 117.667px */
  height: auto;
  display: flex;
  align-items: center;
  justify-content: flex-start; /* 左对齐 */
}

/* 确保 active 状态的 slide 也左对齐 */
.history-swiper .swiper-slide-active {
  display: flex;
  align-items: center;
  justify-content: flex-start; /* 左对齐 */
}

.history-item {
  flex-shrink: 0;
  width: 100px;
  height: 100px;
  cursor: grab;
  position: relative;
  border-radius: 50%;
  overflow: visible;
  background: transparent;
  padding: 0;
  margin: 0 5px 0 0; /* 右侧5px外边距，左侧0 */
  box-sizing: border-box;
  transition: transform 0.1s ease;
  user-select: none;
  -webkit-user-select: none;
  display: flex;
  align-items: center;
  justify-content: center;
  transform-origin: center center;
}

.history-item-hover {
  position: absolute;
  top: -20px;
  right: -20px;
  width: 60px;
  height: 60px;
  pointer-events: none;
  z-index: 15;
  overflow: visible;
}

.history-item:hover .history-item-hover,
.history-item-hover:hover {
  pointer-events: auto;
}

.history-item:hover,
.history-item:has(.history-delete:hover),
.history-item:has(.history-item-hover:hover) {
  z-index: 20;
  transform: scale(1.2);
}

.history-wrapper.dragging .history-item {
  cursor: grabbing;
}

.history-item:active {
  cursor: grabbing;
  transform: scale(1.14);
}

.history-item.active {
  border: 2px solid #2563eb;
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.3);
}

.history-item img {
  width: 100px;
  height: 100px;
  object-fit: cover;
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  display: block;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: auto;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  transform-origin: center center;
  clip-path: circle(50px at center);
}

.history-item:hover img {
  border-radius: 50%;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  clip-path: circle(50px at center);
}

.history-delete {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 22px;
  height: 22px;
  background: #dc2626;
  color: white;
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  line-height: 1;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  transition: background 0.2s ease, top 0.2s ease, right 0.2s ease;
  z-index: 25;
  pointer-events: auto;
  transform-origin: center center;
  overflow: visible;
}

.history-item:hover .history-delete,
.history-item-hover:hover .history-delete {
  display: flex;
  top: -4px;
  right: 3px;
}

.history-delete:hover {
  background: #b91c1c;
  transform: scale(1.15);
  top: 2px;
  right: 2px;
}

.result__image {
  width: 100px;
  height: 100px;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  display: block;
}

.result__preview {
  color: #fff;
  text-align: center;
  font-size: 16px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* 表单容器 */
.form-container {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  width: 100%;
  max-width: 100%;
  pointer-events: auto;
  transition: bottom 0.4s ease, opacity 0.4s ease;
  opacity: 1;
}

.form-container-inner {
  width: 100%;
  max-width: 100%;
  padding: 0 10px;
  box-sizing: border-box;
}

.form-container.interacting {
  opacity: 0.3;
}

.form-tip {
  color: #1f2933;
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 12px;
}

.form-tip > span {
  flex: 1;
  min-width: 0;
}

.voice-input-toggle-btn,
.history-icon-btn,
.camera-btn {
  background: transparent;
  border: none;
  color: #4b5563;
  font-size: 18px;
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  width: 40px;
  height: 40px;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.voice-input-toggle-btn i,
.history-icon-btn i,
.camera-btn i {
  display: block;
}

.voice-input-toggle-btn:hover,
.history-icon-btn:hover,
.camera-btn:hover {
  background-color: rgba(37, 99, 235, 0.06);
  color: #2563eb;
}

.voice-input-toggle-btn:active,
.history-icon-btn:active,
.camera-btn:active {
  background-color: rgba(37, 99, 235, 0.12);
}

.voice-input-toggle-btn.active {
  background-color: rgba(37, 99, 235, 0.12);
  color: #2563eb;
}

.btn-voice-record {
  padding: 10px 20px;
  height: 44px;
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  transition: transform 0.1s ease, box-shadow 0.2s ease, opacity 0.2s ease;
  display: none; /* 默认隐藏，避免页面加载时闪动 */
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-right: 12px;
}

.btn-voice-record:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 16px rgba(16, 185, 129, 0.25);
  background: linear-gradient(135deg, #059669, #047857);
}

.btn-voice-record:active {
  transform: translateY(0);
  background: linear-gradient(135deg, #047857, #065f46);
}

.btn-voice-record.recording {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  animation: pulse-recording 1.5s ease-in-out infinite;
}

.btn-voice-record.recording:hover {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
}

@keyframes pulse-recording {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(239, 68, 68, 0);
  }
}

.form {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  gap: 16px;
  position: relative;
  transition: box-shadow 0.3s ease;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

/* 彩虹加载动画 */
@keyframes rainbow-shadow {
  0% {
    box-shadow: 0 8px 32px rgba(255, 0, 0, 0.4), 0 0 0 0 rgba(255, 0, 0, 0.2);
  }
  16.66% {
    box-shadow: 0 8px 32px rgba(255, 165, 0, 0.4), 0 0 0 0 rgba(255, 165, 0, 0.2);
  }
  33.33% {
    box-shadow: 0 8px 32px rgba(255, 255, 0, 0.4), 0 0 0 0 rgba(255, 255, 0, 0.2);
  }
  50% {
    box-shadow: 0 8px 32px rgba(0, 255, 0, 0.4), 0 0 0 0 rgba(0, 255, 0, 0.2);
  }
  66.66% {
    box-shadow: 0 8px 32px rgba(0, 165, 255, 0.4), 0 0 0 0 rgba(0, 165, 255, 0.2);
  }
  83.33% {
    box-shadow: 0 8px 32px rgba(75, 0, 130, 0.4), 0 0 0 0 rgba(75, 0, 130, 0.2);
  }
  100% {
    box-shadow: 0 8px 32px rgba(238, 130, 238, 0.4), 0 0 0 0 rgba(238, 130, 238, 0.2);
  }
}

.form-container.loading .form {
  animation: rainbow-shadow 2s linear infinite;
}

.form__input-group {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form__input-controls {
  display: flex;
  flex-direction: row-reverse;
  align-items: flex-end;
  gap: 12px;
  width: 100%;
}

.form textarea.form-control {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  min-height: 44px;
  height: 44px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  resize: none;
  outline: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  line-height: 1.5;
  overflow-y: auto;
  background-color: #fff;
}

.form textarea.form-control:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.form__button-group {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  height: fit-content;
  flex-shrink: 0;
}

.form-button-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
}

.form button.btn-primary {
  padding: 10px 24px;
  height: 44px;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  transition: transform 0.1s ease, box-shadow 0.2s ease, opacity 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.form button.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
}

.form button.btn-primary:not(:disabled):hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 16px rgba(37, 99, 235, 0.25);
  background: linear-gradient(135deg, #1d4ed8, #1e40af);
}

.status {
  min-height: 20px;
  color: #2563eb;
  font-size: 12px;
  text-align: right;
  white-space: nowrap;
  margin: 0;
  order: -1;
}

/* 历史记录侧边栏 */
.history-sidebar {
  position: fixed;
  top: 0;
  left: -50%;
  width: 50%;
  height: 100vh;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(10px);
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  transition: left 0.3s ease;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.history-sidebar.show {
  left: 0;
}

.history-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid #e5e7eb;
  background: rgba(255, 255, 255, 0.95);
  position: sticky;
  top: 0;
  z-index: 10;
}

.history-sidebar-header h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: #1f2933;
}

.history-sidebar-close {
  background: transparent;
  border: none;
  color: #6b7280;
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: background-color 0.2s ease, color 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
}

.history-sidebar-close:hover {
  background-color: rgba(107, 114, 128, 0.1);
  color: #1f2933;
}

.history-sidebar-content {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
}

.history-sidebar-item {
  display: flex;
  gap: 16px;
  padding: 16px;
  margin-bottom: 16px;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
  position: relative;
}

.history-sidebar-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.history-sidebar-item-image {
  width: 120px;
  height: 120px;
  flex-shrink: 0;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.history-sidebar-item-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.history-sidebar-item-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
}

.history-sidebar-item-prompt {
  color: #1f2933;
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 8px;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.history-sidebar-item-time {
  color: #6b7280;
  font-size: 12px;
  align-self: flex-end;
  margin-top: auto;
}

.history-sidebar-item-download {
  background: transparent;
  border: none;
  color: #6b7280;
  font-size: 20px;
  cursor: pointer;
  padding: 8px;
  border-radius: 6px;
  transition: background-color 0.2s ease, color 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
}

.history-sidebar-item-download:hover {
  background-color: rgba(37, 99, 235, 0.1);
  color: #2563eb;
}

.history-sidebar-item-download i {
  font-size: 18px;
}

.history-sidebar-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: #9ca3af;
  text-align: center;
}

.history-sidebar-empty i {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.history-sidebar-empty p {
  margin: 0;
  font-size: 14px;
}

.history-sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.3);
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.history-sidebar-overlay.show {
  opacity: 1;
  visibility: visible;
}

.history-sidebar-footer {
  padding: 16px 24px;
  border-top: 1px solid #e5e7eb;
  background: rgba(255, 255, 255, 0.95);
  position: sticky;
  bottom: 0;
  z-index: 10;
}

.history-sidebar-tip {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #6b7280;
  font-size: 13px;
  line-height: 1.5;
}

.history-sidebar-tip i {
  font-size: 14px;
  color: #2563eb;
  flex-shrink: 0;
}

.history-sidebar-tip span {
  flex: 1;
}

/* 图片上传/拍照弹窗 */
.image-upload-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.image-upload-modal-overlay.show {
  opacity: 1;
  visibility: visible;
}

.image-upload-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  background: white;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  z-index: 2001;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
  min-width: 320px;
  max-width: 90%;
  width: 400px;
}

.image-upload-modal.show {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%) scale(1);
}

.image-upload-modal-content {
  padding: 24px;
}

.image-upload-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.image-upload-modal-header h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: #1f2933;
}

.image-upload-modal-close {
  background: transparent;
  border: none;
  color: #6b7280;
  font-size: 24px;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: background-color 0.2s ease, color 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
}

.image-upload-modal-close:hover {
  background-color: rgba(107, 114, 128, 0.1);
  color: #1f2933;
}

.image-upload-modal-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.image-upload-option-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px 24px;
  background: #f9fafb;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 16px;
  font-weight: 500;
  color: #1f2933;
}

.image-upload-option-btn:hover {
  background: #f3f4f6;
  border-color: #2563eb;
  color: #2563eb;
}

.image-upload-option-btn:active {
  transform: scale(0.98);
}

.image-upload-option-btn i {
  font-size: 24px;
}

/* 摄像头预览容器 */
.camera-preview-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  z-index: 2002;
  display: none;
}

.camera-preview-content {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.camera-video {
  width: 100%;
  max-width: 1280px;
  height: auto;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 8px;
}

.camera-preview-actions {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 20px;
  align-items: center;
}

.camera-preview-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 500;
  transition: all 0.2s ease;
  color: white;
}

.camera-cancel-btn {
  background: rgba(107, 114, 128, 0.8);
}

.camera-cancel-btn:hover {
  background: rgba(107, 114, 128, 1);
}

.camera-capture-btn {
  background: rgba(37, 99, 235, 0.8);
}

.camera-capture-btn:hover {
  background: rgba(37, 99, 235, 1);
}

.camera-preview-btn:active {
  transform: scale(0.95);
}

.camera-preview-btn i {
  font-size: 20px;
}

/* 语音识别加载提示样式 */
.asr-loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  /* 确保遮罩层不会阻挡交互，除非明确显示 */
  visibility: hidden;
}

.asr-loading-overlay.show {
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
}

.asr-loading-content {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.9));
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 20px;
  padding: 40px 50px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3),
              0 0 0 1px rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  max-width: 90%;
  text-align: center;
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

.asr-loading-overlay.show .asr-loading-content {
  transform: scale(1);
}

.asr-loading-spinner {
  width: 64px;
  height: 64px;
  border: 4px solid rgba(255, 128, 0, 0.2);
  border-top-color: #ff8000;
  border-right-color: #ff8000;
  border-radius: 50%;
  animation: asr-spin 1s linear infinite;
  position: relative;
  box-shadow: 0 0 20px rgba(255, 128, 0, 0.4);
}

.asr-loading-spinner::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 128, 0, 0.1) 0%, transparent 70%);
}

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

.asr-loading-text {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.asr-loading-title {
  font-size: 20px;
  font-weight: 600;
  color: #1f2937;
  margin: 0;
  letter-spacing: 0.5px;
}

.asr-loading-subtitle {
  font-size: 14px;
  color: #6b7280;
  margin: 0;
  font-weight: 400;
}

/* 移动端优化 */
@media (max-width: 767.98px) {
  .asr-loading-content {
    padding: 32px 36px;
    border-radius: 16px;
  }

  .asr-loading-spinner {
    width: 56px;
    height: 56px;
    border-width: 3px;
  }

  .asr-loading-spinner::after {
    width: 36px;
    height: 36px;
  }

  .asr-loading-title {
    font-size: 18px;
  }

  .asr-loading-subtitle {
    font-size: 13px;
  }
}

