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

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body {
  background: #e8f3f0;
}

.breathing-sea {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  touch-action: none;
  cursor: crosshair;

background:
  linear-gradient(
    180deg,
    #174F9E 0%,
    #3267B5 42%,
    #5C85CB 100%
  );
}

#seaCanvas {
  position: absolute;
  inset: 0;

  width: 100%;
  height: 100%;

  display: block;
}

/* ===================================
   空气小颗粒
=================================== */

.air-particles {

  position: absolute;

  inset: 0;

  pointer-events: none;

  z-index: 2;
}


.air-particles span {

  position: absolute;

  width: 4px;
  height: 4px;

  border-radius: 50%;

  background:
    rgba(255,255,255,0.75);

  box-shadow:
    0 0 12px
    rgba(255,255,255,0.55);

  animation:
    floatParticle
    8s ease-in-out
    infinite;
}


.air-particles span:nth-child(1) {
  left: 13%;
  top: 38%;
}

.air-particles span:nth-child(2) {
  left: 27%;
  top: 26%;
  animation-delay: -2s;
}

.air-particles span:nth-child(3) {
  left: 44%;
  top: 42%;
  animation-delay: -4s;
}

.air-particles span:nth-child(4) {
  left: 58%;
  top: 32%;
  animation-delay: -1s;
}

.air-particles span:nth-child(5) {
  left: 71%;
  top: 42%;
  animation-delay: -5s;
}

.air-particles span:nth-child(6) {
  left: 82%;
  top: 28%;
  animation-delay: -3s;
}

.air-particles span:nth-child(7) {
  left: 91%;
  top: 48%;
  animation-delay: -6s;
}


@keyframes floatParticle {

  0%,
  100% {

    transform:
      translateY(0)
      scale(0.7);

    opacity: 0.15;

  }

  50% {

    transform:
      translateY(-18px)
      scale(1.4);

    opacity: 0.85;

  }

}



/* ===================================
   让 Canvas 保持最上层交互
=================================== */

#seaCanvas {

  position: absolute;

  inset: 0;

  width: 100%;
  height: 100%;

  display: block;

  z-index: 3;
}
/* ========================================
   左上角调色工具
======================================== */

.palette-widget {
  position: absolute;
  top: 24px;
  left: 24px;
  z-index: 20;
  font-family: inherit;
}


/* 调色按钮 */

.palette-toggle {
  width: 48px;
  height: 48px;

  display: grid;
  place-items: center;

  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 16px;

  background: rgba(255, 255, 255, 0.72);

  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);

  box-shadow: 0 6px 24px rgba(35, 65, 95, 0.10);

  color: #315f91;

  cursor: pointer;

  transition:
    transform 0.25s ease,
    background 0.25s ease,
    box-shadow 0.25s ease;
}

.palette-toggle:hover {
  transform: translateY(-2px) scale(1.04);

  background: rgba(255, 255, 255, 0.92);

  box-shadow: 0 10px 28px rgba(35, 65, 95, 0.16);
}

.palette-toggle svg {
  width: 24px;
  height: 24px;

  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;

  stroke-linecap: round;
  stroke-linejoin: round;
}

.palette-toggle svg circle {
  fill: currentColor;
  stroke: none;
}


/* ========================================
   调色面板
======================================== */

.palette-panel {
  position: absolute;

  top: 60px;
  left: 0;

  width: 280px;
  padding: 18px;

  border-radius: 22px;

  background: rgba(250, 252, 251, 0.91);

  border: 1px solid rgba(255, 255, 255, 0.9);

  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);

  box-shadow:
    0 18px 55px rgba(30, 55, 85, 0.16),
    0 2px 8px rgba(30, 55, 85, 0.04);

  color: #263d55;

  animation: paletteAppear 0.22s ease;
}


/* 确保关闭后真正隐藏 */

.palette-panel[hidden] {
  display: none !important;
}


@keyframes paletteAppear {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}


/* ========================================
   面板标题
======================================== */

.palette-heading {
  display: flex;

  align-items: center;
  justify-content: space-between;

  margin-bottom: 16px;
}

.palette-heading h3 {
  margin: 0;

  font-size: 16px;
  font-weight: 600;

  letter-spacing: 0.5px;
}

.palette-heading p {
  margin: 5px 0 0;

  font-size: 11px;

  color: #8b9ba8;
}


.palette-close {
  width: 30px;
  height: 30px;

  border: none;
  border-radius: 50%;

  background: rgba(220, 228, 232, 0.65);

  color: #71818c;

  font-size: 22px;
  line-height: 1;

  cursor: pointer;

  transition: background 0.2s ease;
}

.palette-close:hover {
  background: rgba(205, 218, 225, 0.9);
}


/* ========================================
   自定义颜色
======================================== */

.palette-custom {
  display: grid;

  grid-template-columns: 38px 1fr 40px;

  align-items: center;
  gap: 10px;

  padding: 10px;

  border-radius: 15px;

  background: rgba(255, 255, 255, 0.72);

  border: 1px solid rgba(225, 233, 235, 0.75);

  cursor: pointer;
}


.palette-current-color {
  width: 36px;
  height: 36px;

  border-radius: 11px;

  background: #356bb4;

  border: 1px solid rgba(0, 0, 0, 0.06);
}


.palette-custom-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.palette-custom-text strong {
  font-size: 12px;
  font-weight: 600;
}

.palette-custom-text small {
  font-size: 10px;
  color: #91a0ab;
}


.palette-custom input[type="color"] {
  width: 38px;
  height: 34px;

  padding: 3px;

  border: none;
  border-radius: 9px;

  background: #ffffff;

  cursor: pointer;
}

.palette-custom input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 2px;
}

.palette-custom input[type="color"]::-webkit-color-swatch {
  border: none;
  border-radius: 6px;
}


/* ========================================
   预设色盘
======================================== */

.palette-swatches {
  display: grid;

  grid-template-columns: repeat(4, 1fr);

  gap: 15px;

  padding: 20px 5px;
}


.palette-swatch {
  width: 30px;
  height: 30px;

  justify-self: center;

  border: none;
  border-radius: 50%;

  background: var(--swatch);

  cursor: pointer;

  box-shadow: 0 0 0 1px rgba(35, 55, 75, 0.08);

  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

.palette-swatch:hover {
  transform: scale(1.13);
}

.palette-swatch.is-active {
  box-shadow:
    0 0 0 2px #ffffff,
    0 0 0 4px #7194b7;
}


/* ========================================
   随机配色按钮
======================================== */

.palette-random {
  display: flex;

  width: 100%;
  height: 42px;

  align-items: center;
  justify-content: space-between;

  padding: 0 14px;

  border: 1px solid rgba(220, 230, 233, 0.8);
  border-radius: 13px;

  background: rgba(233, 241, 242, 0.82);

  color: #385c7b;

  font-size: 12px;
  font-weight: 500;

  cursor: pointer;

  transition:
    background 0.2s ease,
    transform 0.2s ease;
}

.palette-random:hover {
  background: rgba(216, 232, 235, 0.95);

  transform: translateY(-1px);
}


.random-icon {
  font-size: 21px;

  transition: transform 0.35s ease;
}

.palette-random:hover .random-icon {
  transform: rotate(90deg);
}


.palette-note {
  margin: 12px 0 0;

  text-align: center;

  font-size: 10px;

  color: #9aaab3;
}


/* 小屏幕适配 */

@media (max-width: 600px) {
  .palette-widget {
    top: 14px;
    left: 14px;
  }

  .palette-panel {
    width: min(280px, calc(100vw - 28px));
  }
}

#seaCanvas {
  pointer-events: auto;
  z-index: 3;
}

.air-particles {
  pointer-events: none;
}

.palette-widget {
  z-index: 20;
}

/* 修复海浪画布的鼠标交互 */
#seaCanvas {
  pointer-events: auto !important;
}

/* 装饰颗粒不再拦截鼠标事件 */
.air-particles {
  pointer-events: none !important;
}
/* =========================
   摄像头交互面板
========================= */

.camera-widget {
  position: absolute;
  top: 24px;
  right: 24px;
  z-index: 30;
  width: 220px;
  padding: 12px;

  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 18px;

  background: rgba(255, 255, 255, 0.45);

  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);

  box-shadow: 0 10px 30px rgba(25, 60, 90, 0.12);

  color: #21496f;
  font-family: inherit;
}

/* 开启摄像头按钮 */

.camera-toggle {
  width: 100%;
  padding: 10px 12px;

  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 12px;

  background: rgba(255, 255, 255, 0.8);
  color: #285b87;

  font-family: inherit;
  font-size: 13px;

  cursor: pointer;

  transition:
    transform 0.2s ease,
    background 0.2s ease;
}

.camera-toggle:hover {
  transform: translateY(-1px);
  background: #fff;
}

.camera-toggle:disabled {
  opacity: 0.6;
  cursor: wait;
}

/* 识别状态 */

.gesture-status {
  margin: 8px 2px;

  font-size: 12px;
  line-height: 1.5;

  color: #3b607b;
}

/* 摄像头预览画面 */

#cameraVideo {
  display: block;

  width: 100%;
  aspect-ratio: 4 / 3;

  object-fit: cover;

  border-radius: 10px;

  background: rgba(25, 50, 75, 0.12);

  transform: scaleX(-1);
}

/* 手机屏幕适配 */

@media (max-width: 600px) {
  .camera-widget {
    top: 14px;
    right: 14px;

    width: 170px;
    padding: 9px;
  }

  .camera-toggle {
    padding: 8px;
    font-size: 11px;
  }
}