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

:root {
  --color-beige: #e1cba6;
  --color-rust: #a34d32;
  --color-sage: #7a9a93;
  --color-beige-light: #efe2cf;
  --color-beige-dark: #d8c09c;
  --color-rust-light: #b85a3d;
  --color-sage-light: #8aada5;
}

body {
  font-family: "Microsoft YaHei", sans-serif;
  background: linear-gradient(
    135deg,
    var(--color-beige-light),
    var(--color-beige)
  );
  color: #3a3a3a;
  line-height: 1.6;
  overflow: hidden;
  position: relative;
}

body::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: radial-gradient(
      circle at 20% 30%,
      var(--color-sage-light) 0%,
      transparent 10%
    ),
    radial-gradient(
      circle at 80% 20%,
      var(--color-rust-light) 0%,
      transparent 12%
    ),
    radial-gradient(
      circle at 40% 70%,
      var(--color-sage-light) 0%,
      transparent 8%
    ),
    radial-gradient(
      circle at 70% 60%,
      var(--color-rust-light) 0%,
      transparent 7%
    );
  opacity: 0.06;
  pointer-events: none;
  z-index: -1;
}

.app-container {
  display: flex;
  height: 100vh;
  width: 100vw;
}

/* 侧边栏样式 */
.sidebar {
  width: 220px;
  height: 100%;
  background: linear-gradient(170deg, var(--color-sage), #6a8a83);
  padding: 15px 10px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE and Edge */
  border-right: 3px solid transparent;
  position: relative;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
}

.sidebar::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 3px;
  height: 100%;
  background: linear-gradient(
    to bottom,
    var(--color-rust),
    var(--color-rust-light),
    var(--color-rust)
  );
}

.sidebar::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
}

.sidebar::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Opera */
}

.logo {
  text-align: center;
  margin-bottom: 15px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  padding-bottom: 15px;
  position: relative;
}

.logo::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 25%;
  width: 50%;
  height: 1px;
  background: linear-gradient(
    to right,
    transparent,
    var(--color-beige),
    transparent
  );
}

.logo h2 {
  color: #fff;
  font-size: 1.5rem;
  font-weight: 300;
  letter-spacing: 1px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

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

.sidebar-section h3 {
  font-size: 0.9rem;
  color: var(--color-beige-light);
  margin-bottom: 10px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* 主内容区样式 */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: linear-gradient(
    135deg,
    var(--color-beige-light),
    var(--color-beige)
  );
  overflow: hidden;
}

/* 画布容器 */
.canvas-container {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  background: radial-gradient(
    ellipse at center,
    var(--color-beige-light),
    var(--color-beige-dark)
  );
  padding: 0;
  position: relative;
  overflow: auto;
}

.canvas-container::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 18c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm48 25c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm-43-7c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm63 31c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM34 90c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm56-76c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM12 86c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm28-65c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm23-11c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-6 60c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm29 22c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zM32 63c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm57-13c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-9-21c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM60 91c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM35 41c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM12 60c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2z' fill='%237a9a93' fill-opacity='0.05' fill-rule='evenodd'/%3E%3C/svg%3E");
  pointer-events: none;
}

#drawing-canvas {
  max-width: 100%;
  max-height: 100%;
  cursor: pointer;
  border: none;
  background-color: #fff;
  transform-origin: center center;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1), 0 0 0 1px var(--color-sage);
  border-radius: 2px;
  transition: box-shadow 0.3s ease;
}

#drawing-canvas:hover {
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15), 0 0 0 1px var(--color-sage);
}

/* 底部工具栏 */
.bottom-toolbar {
  background: linear-gradient(
    to right,
    var(--color-sage),
    var(--color-sage-light)
  );
  padding: 6px 12px;
  border-top: none;
  display: flex;
  gap: 15px;
  min-height: 45px;
  align-items: flex-start;
  width: 100%;
  max-width: 100%;
  margin: 0;
  border-radius: 0;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
  position: relative;
  overflow: hidden;
}

.bottom-toolbar::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(
    to right,
    var(--color-rust),
    var(--color-beige),
    var(--color-rust)
  );
}

.bottom-toolbar::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url("data:image/svg+xml,%3Csvg width='52' height='26' viewBox='0 0 52 26' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M10 10c0-2.21-1.79-4-4-4-3.314 0-6-2.686-6-6h2c0 2.21 1.79 4 4 4 3.314 0 6 2.686 6 6 0 2.21 1.79 4 4 4 3.314 0 6 2.686 6 6 0 2.21 1.79 4 4 4v2c-3.314 0-6-2.686-6-6 0-2.21-1.79-4-4-4-3.314 0-6-2.686-6-6zm25.464-1.95l8.486 8.486-1.414 1.414-8.486-8.486 1.414-1.414z' /%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
}

.toolbar-section {
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
}

.toolbar-section:not(:last-child)::after {
  content: "";
  position: absolute;
  right: -10px;
  top: 25%;
  height: 50%;
  width: 1px;
  background: linear-gradient(
    to bottom,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
}

.toolbar-section:first-child {
  flex: 3;
  min-width: 360px;
}

.toolbar-section:nth-child(2) {
  flex: 1.5;
  min-width: 180px;
}

.toolbar-section:last-child {
  flex: 1.2;
  min-width: 170px;
}

.toolbar-section h3 {
  font-size: 0.75rem;
  color: #fff;
  margin-bottom: 3px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* 主题选择器 */
.theme-selector {
  display: flex;
  justify-content: center;
  margin-bottom: 8px;
  gap: 6px;
  flex-wrap: wrap;
}

.theme-btn {
  padding: 3px 10px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 14px;
  cursor: pointer;
  font-size: 0.7rem;
  font-weight: 500;
  color: #fff;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  border: 1px solid transparent;
}

.theme-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: translateY(-1px);
}

.theme-btn.active {
  background: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.4);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  font-weight: 600;
}

/* 颜色选择区域 */
.color-selection-row {
  display: flex;
  align-items: center;
  gap: 15px;
  flex-direction: column;
}

.preset-colors {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 0;
  width: 100%;
  min-width: 240px;
  background: rgba(255, 255, 255, 0.1);
  padding: 6px 10px;
  border-radius: 16px;
  justify-content: center;
  display: none; /* 默认隐藏所有颜色面板 */
}

.preset-colors.active-palette {
  display: flex; /* 只显示激活的颜色面板 */
}

.color-btn {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.5);
}

.color-btn:hover {
  transform: scale(1.15);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.25);
}

.color-btn.active {
  transform: scale(1.15);
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--color-rust);
}

.custom-color {
  margin-top: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.1);
  padding: 6px 10px;
  border-radius: 16px;
  justify-content: center;
}

.custom-color label {
  color: #fff;
  font-size: 0.75rem;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
}

#custom-color-picker {
  width: 24px;
  height: 24px;
  padding: 0;
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  cursor: pointer;
  background: transparent;
  overflow: hidden;
}

/* 操作按钮 */
.actions {
  display: flex;
  flex-direction: row;
  gap: 8px;
  flex-wrap: wrap;
}

.actions button {
  padding: 4px 8px;
  border: none;
  border-radius: 18px;
  background: linear-gradient(
    135deg,
    var(--color-rust),
    var(--color-rust-light)
  );
  color: #fff;
  font-size: 0.7rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  min-width: 60px;
  white-space: nowrap;
  margin-bottom: 3px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
}

.actions button:hover {
  background: linear-gradient(
    135deg,
    var(--color-rust-light),
    var(--color-rust)
  );
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.actions button:active {
  transform: translateY(1px);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.actions button i {
  margin-right: 4px;
  width: 12px;
  text-align: center;
  opacity: 0.9;
}

/* 缩放控制 */
.zoom-controls {
  display: flex;
  flex-direction: row;
  gap: 6px;
}

/* 缩略图样式 */
.thumbnails {
  display: grid;
  grid-template-columns: repeat(1, 1fr);
  gap: 15px;
  max-height: calc(100vh - 150px);
  overflow-y: auto;
  padding-right: 5px;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE and Edge */
}

.thumbnails::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Opera */
}

.thumbnails::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

.thumbnails::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}

.thumbnails::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

.thumbnail {
  position: relative;
  border: 2px solid transparent;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.3s ease;
  padding-top: 75%; /* 4:3 宽高比 */
  background-color: var(--color-beige-light);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
}

.thumbnail img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.thumbnail.active {
  border-color: var(--color-rust);
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 8px 15px rgba(163, 77, 50, 0.3);
}

.thumbnail:hover:not(.active) {
  transform: translateY(-2px);
  box-shadow: 0 5px 12px rgba(0, 0, 0, 0.15);
  border-color: var(--color-sage);
}

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

/* 操作提示区域 */
.tips-section {
  max-width: 160px;
}

.tips {
  font-size: 0.65rem;
  color: #fff;
  line-height: 1.2;
  background: rgba(255, 255, 255, 0.1);
  padding: 6px 8px;
  border-radius: 6px;
}

.tips p {
  margin-bottom: 5px;
  display: flex;
  align-items: center;
}

.tips i {
  margin-right: 6px;
  width: 14px;
  text-align: center;
  color: var(--color-beige-light);
}

/* 响应式设计 */
@media (max-width: 992px) {
  .app-container {
    flex-direction: column;
    height: auto;
  }

  .sidebar {
    width: 100%;
    height: auto;
    padding-bottom: 0;
  }

  .bottom-toolbar {
    max-width: 100%;
    border-radius: 0;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 15px;
    padding: 12px 15px;
    margin: 0;
  }

  .toolbar-section {
    min-width: auto !important;
  }

  .toolbar-section:first-child,
  .toolbar-section:nth-child(2),
  .toolbar-section:last-child {
    flex: 1 1 auto;
  }

  .toolbar-section:nth-child(2) {
    min-width: 200px !important;
  }

  .toolbar-section:not(:last-child)::after {
    display: none;
  }

  .preset-colors {
    min-width: auto;
  }

  .theme-selector {
    margin-bottom: 15px;
    flex-wrap: wrap;
  }

  .thumbnails {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  }
}

@media (max-width: 768px) {
  .bottom-toolbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 15px;
    padding: 15px;
  }

  .toolbar-section {
    width: 100%;
  }

  .toolbar-section:nth-child(2) {
    min-width: 100% !important;
  }

  .actions {
    justify-content: flex-start;
    width: 100%;
  }

  .actions button {
    flex: 0 0 auto;
    margin-right: 5px;
  }

  .color-selection-row {
    flex-wrap: wrap;
    gap: 15px;
  }

  .preset-colors {
    order: 1;
    width: 100%;
    justify-content: center;
    gap: 10px;
  }

  .theme-selector {
    width: 100%;
    flex-wrap: wrap;
    gap: 6px;
  }

  .theme-btn {
    flex: 1 1 calc(50% - 6px);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 6px 8px;
  }

  .custom-color {
    order: 2;
    margin-top: 5px;
    width: 100%;
    justify-content: center;
  }

  .thumbnails {
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  }
}

/* 导出成功提示 */
.toast-notification {
  position: fixed;
  top: 20px;
  right: 20px;
  background: linear-gradient(
    135deg,
    var(--color-sage),
    var(--color-sage-light)
  );
  color: white;
  padding: 12px 20px;
  border-radius: 8px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 1000;
  font-size: 0.9rem;
  transform: translateY(-100px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  border-left: 4px solid var(--color-beige);
}

.toast-notification.show {
  transform: translateY(0);
  opacity: 1;
}

.toast-notification i {
  font-size: 1.1rem;
  color: var(--color-beige-light);
}

/* 导出按钮加载状态 */
.actions button.exporting {
  background: linear-gradient(135deg, #8a4632, var(--color-rust));
  cursor: not-allowed;
  opacity: 0.8;
}

/* 音乐播放器样式 */
.music-player {
  position: absolute;
  top: 10px;
  right: 20px;
  z-index: 100;
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 30px;
  padding: 5px 15px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  border: 1px solid var(--color-beige-dark);
}

.music-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.music-button {
  background: var(--color-sage);
  color: white;
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.music-button:hover {
  background: var(--color-sage-light);
  transform: scale(1.05);
}

.volume-control {
  display: flex;
  align-items: center;
  gap: 8px;
}

.volume-control i {
  color: var(--color-sage);
  font-size: 1rem;
}

#volume-slider {
  width: 80px;
  -webkit-appearance: none;
  height: 4px;
  background: var(--color-beige-dark);
  border-radius: 2px;
  outline: none;
}

#volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--color-rust);
  cursor: pointer;
}

#volume-slider::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--color-rust);
  cursor: pointer;
  border: none;
}

/* 响应式调整 */
@media (max-width: 768px) {
  .music-player {
    top: 5px;
    right: 10px;
    padding: 3px 8px;
  }

  .music-button {
    width: 30px;
    height: 30px;
  }

  #volume-slider {
    width: 60px;
  }
}
