/* ============================================================
   CyberSea 装饰特效层：水下微弱光影折射 + 像素小章鱼
   ------------------------------------------------------------
   纯装饰，不承载任何业务逻辑；可整体删除引用而不影响功能。
   ============================================================ */

/* ---------------- 深海微弱光影折射（替代原泡泡动画） ---------------- */
#light-ray-layer {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
  opacity: 0.55;
}

/* 一道冷光斜扫 */
#light-ray-layer::before {
  content: "";
  position: absolute;
  top: -30vh;
  left: -20vw;
  width: 150vw;
  height: 15vh;
  background: linear-gradient(
    to bottom,
    transparent 0%,
    rgba(160, 210, 255, 0.2) 40%,
    rgba(160, 210, 255, 0.35) 50%,
    rgba(160, 210, 255, 0.2) 60%,
    transparent 100%
  );
  transform-origin: 0 0;
  transform: rotate(35deg) translateY(-100vh);
  filter: blur(20px);
  animation: ray-sweep 25s cubic-bezier(0.4, 0, 0.6, 1) infinite;
  will-change: transform, opacity;
}

/* 第二道辅光，错开节奏 */
#light-ray-layer::after {
  content: "";
  position: absolute;
  top: -50vh;
  left: 30vw;
  width: 150vw;
  height: 8vh;
  background: linear-gradient(
    to bottom,
    transparent 0%,
    rgba(180, 220, 255, 0.2) 50%,
    transparent 100%
  );
  transform-origin: 0 0;
  transform: rotate(25deg) translateY(-100vh);
  filter: blur(25px);
  animation: ray-sweep 35s cubic-bezier(0.3, 0.1, 0.7, 0.9) 12s infinite;
  will-change: transform, opacity;
}

@keyframes ray-sweep {
  0% {
    transform: rotate(var(--ray-angle, 35deg)) translateY(-150vh);
    opacity: 0;
  }
  20% { opacity: 0.9; }
  50% {
    transform: rotate(var(--ray-angle, 35deg)) translateY(150vh);
    opacity: 0;
  }
  100% {
    transform: rotate(var(--ray-angle, 35deg)) translateY(250vh);
    opacity: 0;
  }
}

/* 确保主要内容层在光影之上 */
.topbar, #chat-container, #input-bar, .form-container {
  position: relative;
  z-index: 1;
}

/* ---------------- 深海粒子层（浮游生物/气泡） ---------------- */
#deepsea-particles {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.dp {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}

@keyframes dp-rise {
  0% {
    transform: translateY(0) translateX(0);
    opacity: 0;
  }
  3% {
    opacity: 1;
  }
  25% {
    transform: translateY(-27vh) translateX(var(--sway, 6px));
  }
  50% {
    transform: translateY(-52vh) translateX(calc(var(--sway, 6px) * -0.7));
  }
  75% {
    transform: translateY(-77vh) translateX(calc(var(--sway, 6px) * 0.5));
  }
  97% {
    opacity: 1;
  }
  100% {
    transform: translateY(-105vh) translateX(0);
    opacity: 0;
  }
}

/* ---------------- 像素小章鱼（可拖动） ---------------- */
#octopus-widget {
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: 64px;
  height: 64px;
  z-index: 50;
  cursor: grab;
  touch-action: none;
  user-select: none;
  animation: octopus-bob 6s ease-in-out infinite;
  filter: drop-shadow(0 0 6px rgba(79, 217, 200, 0.35));
}

#octopus-widget.dragging {
  cursor: grabbing;
  animation-play-state: paused;
}

#octopus-widget svg {
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none; /* 拖动判定交给外层 div，svg 内部元素不拦截 */
}

@keyframes octopus-bob {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  25%      { transform: translate(-3px, -6px) rotate(-3deg); }
  50%      { transform: translate(2px, -2px) rotate(2deg); }
  75%      { transform: translate(-2px, -4px) rotate(-1deg); }
}

.octopus-tentacle {
  transform-origin: top center;
  animation: tentacle-sway 3.2s ease-in-out infinite;
}
.octopus-tentacle:nth-child(2) { animation-delay: 0.15s; }
.octopus-tentacle:nth-child(3) { animation-delay: 0.3s; }
.octopus-tentacle:nth-child(4) { animation-delay: 0.45s; }
.octopus-tentacle:nth-child(5) { animation-delay: 0.6s; }

@keyframes tentacle-sway {
  0%, 100% { transform: rotate(0deg); }
  50%      { transform: rotate(8deg); }
}

/* 章鱼浮动菜单气泡 */
.octopus-bubble {
  position: fixed;
  z-index: 55;
  min-width: 150px;
  background: var(--color-surface-translucent-strong);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--color-border-glow);
  border-radius: 14px;
  padding: 6px 0;
  box-shadow: var(--shadow-soft);
  opacity: 0;
  transform: scale(0.85);
  pointer-events: none;
  transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.octopus-bubble.show {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}
.octopus-bubble-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 16px;
  border: none;
  background: transparent;
  color: var(--color-text);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.octopus-bubble-item:hover {
  background: var(--color-primary-soft);
  color: var(--color-primary);
}
.octopus-bubble-item svg {
  flex-shrink: 0;
  opacity: 0.6;
  transition: opacity 0.15s ease;
}
.octopus-bubble-item:hover svg {
  opacity: 1;
}

/* 章鱼天气弹窗 — 深海主题精致版 */
.octopus-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  z-index: 120; /* 高于章鱼(z-index:50)和气泡(z-index:55) */
  display: none;
  align-items: center;
  justify-content: center;
}
.octopus-modal-card {
  width: 290px;
  max-width: 88vw;
  background: var(--color-surface-translucent-strong);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--color-border-glow);
  border-radius: 18px;
  padding: 22px 20px 16px;
  box-shadow:
    0 0 40px var(--color-primary-soft),
    var(--shadow-soft);
  display: flex;
  flex-direction: column;
  gap: 0;
  animation: weather-fade-in 0.25s ease;
  transition: box-shadow 0.5s ease, border-color 0.5s ease;
  position: relative;
  overflow: hidden;
}
/* 卡片内部氛围光（伪元素） */
.octopus-modal-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.6s ease;
  z-index: 0;
}
/* ===== 天气氛围变体 ===== */
.octopus-modal-card.atmo-sunny {
  border-color: rgba(244, 213, 141, 0.22);
  box-shadow:
    0 0 50px rgba(244, 213, 141, 0.08),
    0 8px 32px rgba(2, 6, 18, 0.5),
    inset 0 1px 0 rgba(255, 220, 150, 0.05);
}
.octopus-modal-card.atmo-sunny::before {
  opacity: 0.5;
  background: radial-gradient(ellipse at 50% 30%, rgba(244, 213, 141, 0.07) 0%, transparent 70%);
}
.octopus-modal-card.atmo-rainy {
  border-color: rgba(140, 180, 220, 0.2);
  box-shadow:
    0 0 40px rgba(140, 180, 220, 0.06),
    0 8px 32px rgba(2, 6, 18, 0.5),
    inset 0 1px 0 rgba(160, 200, 230, 0.04);
}
.octopus-modal-card.atmo-rainy::before {
  opacity: 0.45;
  background: radial-gradient(ellipse at 50% 25%, rgba(140, 180, 220, 0.06) 0%, transparent 70%);
}
.octopus-modal-card.atmo-snowy {
  border-color: rgba(200, 220, 240, 0.2);
  box-shadow:
    0 0 45px rgba(200, 220, 240, 0.06),
    0 8px 32px rgba(2, 6, 18, 0.5),
    inset 0 1px 0 rgba(220, 235, 250, 0.05);
}
.octopus-modal-card.atmo-snowy::before {
  opacity: 0.4;
  background: radial-gradient(ellipse at 50% 25%, rgba(210, 225, 245, 0.06) 0%, transparent 70%);
}
.octopus-modal-card.atmo-thunderstorm {
  border-color: rgba(160, 140, 210, 0.22);
  box-shadow:
    0 0 45px rgba(140, 120, 200, 0.07),
    0 8px 32px rgba(2, 6, 18, 0.5),
    inset 0 1px 0 rgba(170, 155, 215, 0.05);
}
.octopus-modal-card.atmo-thunderstorm::before {
  opacity: 0.4;
  background: radial-gradient(ellipse at 50% 25%, rgba(150, 130, 210, 0.06) 0%, transparent 70%);
}
.octopus-modal-card.atmo-haze {
  border-color: rgba(180, 170, 150, 0.18);
  box-shadow:
    0 0 35px rgba(180, 170, 140, 0.05),
    0 8px 32px rgba(2, 6, 18, 0.5),
    inset 0 1px 0 rgba(200, 190, 170, 0.04);
}
.octopus-modal-card.atmo-haze::before {
  opacity: 0.35;
  background: radial-gradient(ellipse at 50% 30%, rgba(180, 170, 150, 0.05) 0%, transparent 70%);
}

@keyframes weather-fade-in {
  from { opacity: 0; transform: translateY(12px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* 顶部：城市名 + 编辑铅笔 */
.weather-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  position: relative;
  z-index: 1;
}
.weather-city-name {
  font-size: 20px;
  font-weight: 800;
  color: #4fd9c8;
  text-shadow: 0 0 18px rgba(79, 217, 200, 0.35);
  letter-spacing: 0.03em;
  line-height: 1.3;
}
.weather-edit-btn {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(79, 217, 200, 0.22);
  border-radius: 50%;
  background: rgba(79, 217, 200, 0.06);
  color: rgba(79, 217, 200, 0.6);
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 0;
}
.weather-edit-btn:hover {
  background: rgba(79, 217, 200, 0.16);
  color: #4fd9c8;
  border-color: rgba(79, 217, 200, 0.5);
  box-shadow: 0 0 12px rgba(79, 217, 200, 0.2);
}

/* 城市输入行 */
.weather-city-input-row {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.25s ease, opacity 0.2s ease, margin 0.25s ease;
  margin: 0;
  position: relative;
  z-index: 1;
}
.weather-city-input-row.show {
  max-height: 40px;
  opacity: 1;
  margin: 10px 0 2px;
}
.weather-city-input {
  width: 100%;
  padding: 7px 12px;
  border: 1px solid rgba(79, 217, 200, 0.35);
  border-radius: 10px;
  background: rgba(10, 16, 30, 0.7);
  color: #eaf1ff;
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  box-sizing: border-box;
}
.weather-city-input:focus {
  outline: none;
  border-color: rgba(79, 217, 200, 0.7);
  box-shadow: 0 0 10px rgba(79, 217, 200, 0.12);
}
.weather-city-input::placeholder {
  color: rgba(157, 176, 216, 0.5);
}

/* ===== 天气主体：图标 + 状态 + 温度 + 风速 ===== */
.weather-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px 0 14px;
  position: relative;
  z-index: 1;
}

/* 天气图标容器 */
.weather-icon-wrap {
  width: 72px;
  height: 72px;
  margin-bottom: 4px;
  filter: drop-shadow(0 0 12px rgba(79, 217, 200, 0.3));
  animation: weather-icon-float 4s ease-in-out infinite;
}
.weather-icon-wrap svg {
  width: 100%;
  height: 100%;
  display: block;
}
@keyframes weather-icon-float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-4px); }
}

/* 天气状态文字 */
.weather-condition {
  font-size: 16px;
  font-weight: 700;
  color: #eaf1ff;
  letter-spacing: 0.04em;
}

/* 温度大字 */
.weather-temp {
  font-size: 28px;
  font-weight: 800;
  color: #eaf1ff;
  letter-spacing: 0.04em;
  line-height: 1.2;
  text-shadow: 0 0 10px rgba(160, 210, 255, 0.15);
}

/* 风速次要信息 */
.weather-wind {
  font-size: 13px;
  color: rgba(157, 176, 216, 0.7);
  letter-spacing: 0.03em;
}

/* ===== 底部：含蓄提醒按钮 ===== */
.weather-footer {
  display: flex;
  justify-content: center;
  position: relative;
  z-index: 1;
}
.weather-reminder-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  border: none;
  background: transparent;
  color: rgba(157, 176, 216, 0.4);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 10px;
  transition: all 0.25s ease;
  letter-spacing: 0.03em;
}
.weather-reminder-btn svg {
  flex-shrink: 0;
  opacity: 0.5;
  transition: opacity 0.25s ease;
}
.weather-reminder-btn:hover {
  color: #f4d58d;
  background: rgba(244, 213, 141, 0.06);
}
.weather-reminder-btn:hover svg {
  opacity: 0.9;
  filter: drop-shadow(0 0 4px rgba(244, 213, 141, 0.4));
}

@media (max-width: 600px) {
  #octopus-widget { width: 44px; height: 44px; right: 10px; bottom: 10px; }
}

/* ---------------- 黑胶唱片 BGM 播放器 ---------------- */
#vinyl-disc {
  position: fixed;
  right: 22px;
  bottom: 100px;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  cursor: pointer;
  z-index: 48;
  /* 黑胶唱片质感：同心圆模拟沟槽 */
  background:
    radial-gradient(circle at 50% 50%,
      /* 中心标签区 */
      rgba(20, 24, 40, 1) 0%,
      rgba(20, 24, 40, 1) 26%,
      /* 标签边缘 */
      rgba(40, 44, 60, 1) 26%,
      rgba(40, 44, 60, 1) 28%,
      /* 沟槽区域（深浅交替模拟密纹） */
      rgba(25, 25, 35, 1) 28%,
      rgba(30, 30, 42, 1) 30%,
      rgba(20, 20, 32, 1) 33%,
      rgba(32, 32, 44, 1) 36%,
      rgba(18, 18, 30, 1) 40%,
      rgba(34, 34, 46, 1) 44%,
      rgba(20, 20, 32, 1) 48%,
      rgba(32, 32, 44, 1) 53%,
      rgba(18, 18, 30, 1) 58%,
      rgba(34, 34, 46, 1) 63%,
      rgba(20, 20, 32, 1) 68%,
      rgba(32, 32, 44, 1) 74%,
      rgba(18, 18, 30, 1) 80%,
      rgba(36, 36, 48, 1) 86%,
      rgba(22, 22, 34, 1) 92%,
      rgba(40, 40, 55, 1) 97%,
      rgba(50, 50, 65, 0.6) 100%);
  box-shadow:
    0 4px 24px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(79, 217, 200, 0.12),
    inset 0 0 0 1px rgba(255, 255, 255, 0.03);
  transition: box-shadow 0.3s ease;
  overflow: hidden;
}
#vinyl-disc:hover {
  box-shadow:
    0 0 20px rgba(79, 217, 200, 0.15),
    0 4px 24px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(79, 217, 200, 0.25);
}

/* 中心标签 */
.vinyl-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 34%;
  height: 34%;
  border-radius: 50%;
  background: var(--color-surface, #0a0e1c);
  border: 2px solid rgba(79, 217, 200, 0.2);
  /* 中心小孔 */
  box-shadow: inset 0 0 0 3px rgba(0, 0, 0, 0.5);
}
.vinyl-label::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #111;
}

/* 旋转动画 */
#vinyl-disc.spinning {
  animation: vinyl-spin 3s linear infinite;
}
@keyframes vinyl-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
