:root {
  --进度条颜色-已填充: rgb(41, 126, 78);
  --进度条颜色-未填充: rgba(224, 224, 224, 0.85);
  --拇指宽度: 16px;
  --渐变类型-选中: #3a873c;
  --渐变类型-未选中: #555;
  --色标-默认: #ff6b6b;
  --色标-悬停: #ff8e8e;
  --色标-选中: #ff5252;
  --控制点-默认: #2196f3;
  --控制点-悬停: #42a5f5;
  --控制点-选中: #1976d2;
  --conic-stop-scale: 1;
}

.总区 {
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
}

input[type="range"]::-webkit-slider-thumb {
  scale: 1.25;
  border: none;
  background-color: #95e6a8;
}

.外部容器 {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 20px;
  max-width: 1200px;
  margin: 0 auto;
}

.展示区 {
  width: min(80vw, 1000px);
  height: max(500px, 60vh);
  position: relative;
  border-radius: 10px;
}

.canvas-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  visibility: hidden;
  z-index: 1;
}

.canvas-container.active {
  visibility: visible;
}

.gradient-canvas {
  width: 100%;
  height: 100%;
  cursor: crosshair;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1; /* Canvas在overlay后面 */
}

/* 径向渐变的Canvas需要特殊处理，确保在overlay后面 */
#radial-canvas {
  position: fixed !important;
  top: 0;
  left: 0;
  width: 100vw !important;
  height: 100vh !important;
  z-index: 5;
}

/* 渐变类型选择器 */
.gradient-type-selector {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 20px;
  padding: 15px;
  border-radius: 8px;
}

.gradient-type-btn {
  padding: 10px 20px;
  background-color: var(--渐变类型-未选中);
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.3s ease;
}

.gradient-type-btn:hover {
  background-color: #878787;
}

.gradient-type-btn.active {
  background-color: var(--渐变类型-选中);
}

/* 控制区样式 */
.控制区 {
  width: min(90vw, 1500px);
  border-radius: 10px;
  padding: 20px;
  margin: 0 auto;
  z-index: 1;
}

.控制区:has() .control-section {
  margin-bottom: 20px;
  padding: 15px;
  border-radius: 8px;
}

/* 线性渐变控制 */
.linear-controls {
  display: none;
}

.linear-controls.active {
  display: block;
}

.canvas-color-stop {
  position: absolute;
  width: 20px;
  height: 20px;
  background-color: var(--色标-默认);
  border: 2px solid white;
  border-radius: 3px;
  cursor: url("/Images/Common/鼠标-指向.cur"), pointer;
  transform: translateX(-50%);
  z-index: 10;
  user-select: none;
}

.canvas-color-stop.dragging-down {
  transform: translateX(-50%) scale(1.2);
  opacity: 0.7;
}

.canvas-color-stop.delete-zone {
  background-color: #e74c3c !important;
  box-shadow: 0 0 15px rgba(231, 76, 60, 0.8);
}

.canvas-color-stop:hover {
  background-color: var(--色标-悬停);
  transform: translateX(-50%) scale(1.1);
}

.canvas-color-stop.selected {
  background-color: var(--色标-选中);
  box-shadow: 0 0 10px rgba(255, 82, 82, 0.6);
}

.preview-color-stop {
  position: absolute;
  width: 20px;
  height: 20px;
  border: 2px solid white;
  border-radius: 3px;
  transform: translateX(-50%);
  z-index: 10;
  pointer-events: none !important;
  opacity: 0.25;
  user-select: none;
}

.preview-color-stop::after {
  content: "";
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 8px solid white;
}

.canvas-color-stop::after {
  content: "";
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 8px solid white;
}

/* 径向渐变控制 */
.radial-controls {
  display: none;
  width: 100%;
  margin: 0 auto;
}

.radial-controls.active {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.radial-options {
  display: flex;
  gap: 50px;
  margin-bottom: 15px;
}

.option-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.option-label {
  color: #bdc3c7;
  font-size: 16px;
}

.radio-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.radio-option {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
  padding: 0 12px;
  border: 2px solid #535e5f;
  border-radius: 20px;
  background: #fff1;
  color: #aaa;
  font-size: 16px;
  font-weight: 500;
  height: 35px;
  justify-content: center;
}

.radio-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.radio-option:hover {
  border-color: #647172;
  background: #2c3d4d;
  color: #ccc;
}

.radio-option:has(input[type="radio"]:checked) {
  border-color: lightskyblue;
  background: #2c3d4d;
}

.radio-option input[type="radio"]:checked + span {
  color: lightskyblue;
}

.radio-option input[type="radio"]:checked ~ .radio-option {
  border-color: #3498db;
  background: #3498db;
  color: #2c3e50;
  box-shadow: 0 0 10px rgba(52, 152, 219, 0.3);
}

.radio-option span {
  color: inherit;
  font-size: inherit;
  font-weight: inherit;
}

.size-controls {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-top: 10px;
}

.size-slider {
  flex: 1;
}

.size-slider input[type="range"] {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: #34495e;
  outline: none;
  -webkit-appearance: none;
}

.size-slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #3498db;
  cursor: pointer;
}

.size-unit {
  width: 80px;
}

.size-unit select {
  width: 100%;
  padding: 5px;
  background-color: #34495e;
  color: #ecf0f1;
  border: 1px solid #7f8c8d;
  border-radius: 3px;
}

/* 角度渐变控制 */
.conic-controls {
  display: none;
}

.conic-controls.active {
  display: block;
}

/* 通用控制元素 */
.control-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 auto 10px;
  width: fit-content;
}

.radial-controls .control-row {
  height: 75px;
}

.control-label {
  color: #bdc3c7;
  font-size: 16px;
  min-width: 65px;
  text-wrap: nowrap;
}

.control-label .css-text {
  color: #48b392;
  margin-right: 2px;
}

.control-label .code-text {
  color: #dfdfdf;
}

.control-input {
  padding: 8px 12px;
  background-color: #fff2;
  color: #ecf0f1;
  border: 1px solid #7f8c8da0;
  border-radius: 3px;
  font-family: "JetBrains Mono", monospace;
  font-size: 14px;
  min-width: 0;
  word-break: break-all;
}

.css-code {
  font-family: "JetBrains Mono", monospace;
  font-size: 15px;
  line-height: 1.4;
}

.css-bracket {
  color: #ee75f0;
}

.css-function {
  color: #55b67d;
}

.css-shape {
  color: gold;
}

.css-keyword {
  color: silver;
}

.css-dash {
  color: #e74c3c;
}

.css-comma {
  color: #f39c12;
}

.css-number {
  color: #3498db;
}

.css-hash {
  color: greenyellow;
}

.css-unit {
  color: #e67e22;
  margin-left: 2px;
}

.control-input:focus {
  outline: none;
  border-color: #3498db;
  box-shadow: 0 0 5px rgba(52, 152, 219, 0.3);
}

/* Canvas上的交互元素 */
.canvas-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 5;
}

.canvas-overlay * {
  pointer-events: auto;
}

/* 径向渐变的overlay特殊样式 */
#radial-overlay {
  pointer-events: none;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.direction-indicator {
  position: absolute;
  height: 4px;
  background-color: rgba(255, 255, 255, 0.8);
  border-radius: 2px;
  cursor: pointer;
  display: none;
}

.canvas-container:hover .direction-indicator {
  display: block;
}

.direction-handle {
  position: absolute;
  width: 16px;
  height: 16px;
  background-color: #3498db;
  border: 3px solid white;
  border-radius: 50%;
  cursor: url("/Images/Common/鼠标-指向.cur"), pointer;
  transform: translate(-50%, -50%);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.direction-handle:hover {
  background-color: #42a5f5;
  transform: translate(-50%, -50%) scale(1.2);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.center-point {
  position: absolute;
  width: 16px;
  height: 16px;
  background-color: #000000;
  border: 2px solid white;
  border-radius: 50%;
  cursor: move;
  transform: translate(-50%, -50%);
}

.size-indicator {
  position: absolute;
  border: 2px dashed rgba(255, 255, 255, 0.6);
  border-radius: 50%;
  pointer-events: none;
}

.size-handle {
  position: absolute;
  width: 15px;
  height: 15px;
  background-color: #e74c3c;
  border: 2px solid white;
  border-radius: 50%;
  cursor: url("/Images/Common/鼠标-指向.cur"), pointer;
  transform: translate(-50%, -50%);
}

.angle-indicator {
  position: absolute;
  width: 2px;
  background-color: rgba(255, 255, 255, 0.8);
  transform-origin: center;
}

.angle-handle {
  position: absolute;
  width: 12px;
  height: 12px;
  background-color: #f39c12;
  border: 2px solid white;
  border-radius: 50%;
  cursor: url("/Images/Common/鼠标-指向.cur"), pointer;
  transform: translate(-50%, -50%);
}

/* 色标样式 */
.radial-color-stop {
  position: absolute;
  width: 18px;
  height: 18px;
  cursor: url("/Images/Common/鼠标-指向.cur"), pointer;
  transform: translate(-50%, -50%);
  user-select: none;
  background: none;
  z-index: 20;
}

/* 色标主体 - 菱形设计 */
.radial-color-stop::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--色标-默认);
  border: 2px solid white;
  border-radius: 4px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  z-index: 1;
  transform: rotate(45deg);
}

.radial-color-stop.preview {
  pointer-events: none;
  z-index: 25;
}

/* 角度渐变色标样式 */
.conic-color-stop {
  position: absolute;
  width: 18px;
  height: 18px;
  cursor: url("/Images/Common/鼠标-指向.cur"), pointer;
  transform: translate(-50%, -50%);
  user-select: none;
  background: none;
  z-index: 20;
}

/* 色标主体 - 菱形设计 */
.conic-color-stop::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--色标-默认);
  border: 2px solid white;
  border-radius: 4px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  z-index: 1;
  transform: rotate(45deg);
}

.conic-color-stop.preview {
  pointer-events: none;
  z-index: 25;
}

.conic-color-stop:hover {
  transform: translate(-50%, -50%) scale(1.25);
}

.conic-color-stop:hover::before {
  background: var(--色标-悬停);
}

.conic-color-stop.selected {
  box-shadow: 0 0 10px rgba(255, 82, 82, 0.6);
}

.conic-color-stop.selected::before {
  background: var(--色标-选中);
}

.conic-color-stop.dragging-down {
  transform: translate(-50%, -50%) scale(1.3);
  opacity: 0.7;
}

.conic-color-stop.dragging-down::before {
  background: var(--色标-悬停);
}

.conic-color-stop.delete-zone {
  box-shadow: 0 0 15px rgba(192, 57, 43, 0.9);
}

.conic-color-stop.delete-zone::before {
  background: #e74c3c !important;
}



.radial-color-stop:hover {
  transform: translate(-50%, -50%) scale(1.25);
}

.radial-color-stop:hover::before {
  background: var(--色标-悬停);
}

.radial-color-stop.selected {
  box-shadow: 0 0 10px rgba(255, 82, 82, 0.6);
}

.radial-color-stop.selected::before {
  background: var(--色标-选中);
}

.radial-color-stop.dragging-down {
  transform: translate(-50%, -50%) scale(1.3);
  opacity: 0.7;
}

.radial-color-stop.dragging-down::before {
  background: var(--色标-悬停);
}

.radial-color-stop.delete-zone {
  box-shadow: 0 0 15px rgba(192, 57, 43, 0.9);
}

.radial-color-stop.delete-zone::before {
  background: #e74c3c !important;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .展示区,
  .控制区 {
    width: 90vw;
    max-width: 500px;
  }

  .gradient-type-selector {
    flex-direction: column;
    gap: 10px;
  }

  .radial-options {
    flex-direction: column;
    gap: 10px;
  }
}

/* 现代化拾色器样式 */
.color-picker-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.color-picker-overlay.show {
  opacity: 1;
  visibility: visible;
}

.color-picker {
  background-color: #2c3e50;
  border-radius: 12px;
  padding: 10px 20px 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  width: 320px;
  max-width: 90vw;
  position: absolute;
}

.color-picker-overlay.show .color-picker {
  transform: scale(1) !important;
  transition: transform 0.3s ease;
}

.color-picker-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 1px solid #34495e;
  cursor: move;
}

.color-picker-drag-handle {
  color: #bdc3c7;
  font-size: 16px;
  cursor: move;
  user-select: none;
  padding: 5px;
  border-radius: 3px;
  transition: all 0.2s ease;
}

.color-picker-drag-handle:hover {
  color: #ecf0f1;
  background-color: #34495e;
}

.color-picker-title {
  color: #ecf0f1;
  font-size: 16px;
  font-weight: bold;
  flex: 1;
  text-align: center;
}

.color-picker-close {
  background: none;
  border: none;
  color: #bdc3c7;
  font-size: 20px;
  cursor: pointer;
  width: 25px;
  height: 25px;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.color-picker-close:hover {
  background-color: #45617d;
  color: #ecf0f1;
}

.color-picker-main {
  display: flex;
  gap: 15px;
  margin-bottom: 15px;
}

.color-picker-controls {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.color-wheel-container {
  position: relative;
  width: 200px;
  height: 200px;
  margin: 0 auto;
}

#color-wheel {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  cursor: crosshair;
  border: 2px solid #34495e;
}

.color-wheel-cursor {
  position: absolute;
  width: 12px;
  height: 12px;
  background-color: white;
  border: 2px solid #333;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.brightness-slider-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.color-picker-sliders {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.slider-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.slider-label {
  color: #bdc3c7;
  font-size: 16px;
  width: 50px;
}

.slider-input {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(to right, #000, #fff);
  outline: none;
  -webkit-appearance: none;
  cursor: pointer;
}

.slider-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #34495e;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  position: relative;
  z-index: 10;
}

.slider-input::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #34495e;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  position: relative;
  z-index: 10;
}

.slider-value {
  color: #ecf0f1;
  font-size: 14px;
  font-family: "JetBrains Mono", monospace;
  min-width: 35px;
  text-align: right;
}

.color-picker-inputs {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 15px;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.input-label {
  color: #adadad;
  font-size: 14px;
  text-align: center;
}

.input-field {
  padding: 6px 8px;
  background-color: #34495e;
  color: #ecf0f1;
  border: 1px solid #7f8c8d;
  border-radius: 4px;
  font-family: "JetBrains Mono", monospace;
  font-size: 14px;
  text-align: center;
  min-height: 20px;
  line-height: 1.2;
}

.input-field:focus {
  outline: none;
  border-color: #3498db;
  box-shadow: 0 0 5px rgba(52, 152, 219, 0.3);
}

/* 拾色器输入框特殊字符颜色 */
.css-comma {
  color: #aaa;
}

.color-picker-buttons {
  display: flex;
  gap: 10px;
}

.color-picker-btn {
  flex: 1;
  padding: 10px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.color-picker-btn.primary {
  background-color: #3498db;
  color: white;
}

.color-picker-btn.primary:hover {
  background-color: #2980b9;
}

.color-picker-btn.secondary {
  background-color: #34495e;
  color: #ecf0f1;
}

.color-picker-btn.secondary:hover {
  background-color: #48647e;
}

/* RGB滑块特殊样式 */
.slider-input[data-type="red"] {
  background: linear-gradient(to right, #000, #ff0000);
}

.slider-input[data-type="green"] {
  background: linear-gradient(to right, #000, #00ff00);
}

.slider-input[data-type="blue"] {
  background: linear-gradient(to right, #000, #0000ff);
}

.slider-input[data-type="alpha"] {
  background: linear-gradient(to right, transparent, #000);
  background-image: linear-gradient(45deg, #ccc 25%, transparent 25%),
    linear-gradient(-45deg, #ccc 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #ccc 75%),
    linear-gradient(-45deg, transparent 75%, #ccc 75%);
  background-size: 10px 10px;
  background-position: 0 0, 0 5px, 5px -5px, -5px 0px;
  position: relative;
  z-index: 1;
}

.slider-input[data-type="alpha"]::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(to right, transparent, #000);
  border-radius: 3px;
  pointer-events: none;
  z-index: 2;
}

.slider-input[data-type="alpha"]::-webkit-slider-thumb {
  z-index: 20;
}

.slider-input[data-type="alpha"]::-moz-range-thumb {
  z-index: 20;
}

/* RGB输入容器样式 */
.rgb-input-container {
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #34495e;
  border: 1px solid #7f8c8d;
  border-radius: 4px;
  padding: 4px 8px;
  font-family: "JetBrains Mono", monospace;
  font-size: 14px;
}

.rgb-prefix,
.rgb-suffix,
.rgb-separator {
  color: #ecf0f1;
  font-size: 14px;
  user-select: none;
}

.rgb-prefix,
.rgb-suffix {
  color: #60c683;
}

.rgb-separator {
  margin-right: 5px;
  color: silver;
}

.rgb-input-field {
  width: 3ch;
  padding: 4px 0;
  background-color: transparent;
  color: white;
  border: none;
  border-radius: 2px;
  font-family: "JetBrains Mono", monospace;
  font-size: 14px;
  text-align: center;
  outline: none;
}

.rgb-input-field:focus {
  background-color: #45617d;
  box-shadow: 0 0 3px rgba(52, 152, 219, 0.5);
}

.rgb-input-field::-webkit-inner-spin-button,
.rgb-input-field::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.rgb-input-field[type="number"] {
  -moz-appearance: textfield;
}

/* 16进制输入容器样式 */
.hex-input-container {
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #34495e;
  border: 1px solid #7f8c8d;
  border-radius: 4px;
  padding: 4px 8px;
  font-family: "JetBrains Mono", monospace;
  font-size: 14px;
}

.hex-prefix {
  color: #60c683;
  font-size: 14px;
  user-select: none;
}

.hex-input-field {
  width: 2ch;
  padding: 4px 0;
  background-color: transparent;
  color: white;
  border: none;
  border-radius: 2px;
  font-family: "JetBrains Mono", monospace;
  font-size: 14px;
  text-align: center;
  outline: none;
  text-transform: lowercase;
}

.hex-input-field:focus {
  background-color: #45617d;
  box-shadow: 0 0 3px rgba(52, 152, 219, 0.5);
}
