@import url("https://fonts.googleapis.com/css2?family=Noto+Sans+Symbols+2&display=swap");

#animated-background {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: linear-gradient(135deg, rgba(243, 152, 0, 0.45) 0%, rgba(255, 235, 200, 0.35) 15%, rgba(255, 240, 210, 0.3) 35%, rgba(255, 245, 225, 0.25) 55%, rgba(255, 248, 240, 0.15) 75%, rgba(255, 252, 248, 0.08) 88%, rgba(255, 255, 255, 0.03) 100%);
  user-select: none;
  pointer-events: none;
  z-index: -1;
}

#animated-background > div {
  --size: 4vw;
  --symbol: "⚕";
  --image-url: "";
  --pos_x: 0vw;
  --pos_y: 50vh;
  --float_speed: 16s;
  --drift_x: 40px;
  --drift_y: 30px;
  --rotation_speed: 25s;
  --delay_move: 0s;
  --duration_clip: 15s;
  --delay_clip: 0s;
  --hue: 0deg;
  --spin_direction: 360deg;
  --move_x1: 50px;
  --move_y1: 30px;
  --move_x2: -40px;
  --move_y2: 60px;
  --move_x3: 80px;
  --move_y3: -20px;
  --move_x4: -60px;
  --move_y4: -50px;
  --move_x5: 30px;
  --move_y5: 70px;
  --move_x6: -80px;
  --move_y6: 20px;
  --move_x7: 60px;
  --move_y7: -40px;

  position: absolute;
  top: var(--pos_y);
  left: var(--pos_x);
  font-size: clamp(20px, var(--size), 60px);
  font-family: "Noto Sans Symbols 2", sans-serif;
  transform-origin: center;
}

#animated-background span {
  display: block;
  position: relative;
  transform-origin: center;
  transform: rotate(0deg);
}

#animated-background span:after {
  content: var(--symbol);
  -webkit-text-stroke: 0.5px rgba(0, 0, 0, 0.1);
  text-stroke: 0.5px rgba(0, 0, 0, 0.1);
  line-height: 1.2;
  position: relative;
  display: block;
  color: rgba(0, 123, 255, 0.15);
  filter: brightness(1.1) hue-rotate(var(--hue));
  -webkit-background-clip: text;
  background-clip: text;
  background-image: linear-gradient(45deg, rgba(0, 123, 255, 0.2), rgba(40, 167, 69, 0.2));
  background-size: 200px auto;
  background-repeat: repeat;
  transform: translateZ(0);
  animation: bg1 var(--duration_clip) var(--delay_clip) linear infinite alternate both;
}

/* MDUCちゃん画像用スタイル */
#animated-background .mduc-image {
  width: clamp(30px, var(--size), 80px);
  height: clamp(30px, var(--size), 80px);
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1)) hue-rotate(var(--hue));
  opacity: 0.8;
}

#animated-background .mduc-element span {
  width: clamp(30px, var(--size), 80px);
  height: clamp(30px, var(--size), 80px);
  background-image: var(--image-url);
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  display: block;
  filter: brightness(1.1) hue-rotate(var(--hue)) drop-shadow(0 2px 4px rgba(0,0,0,0.3));
  opacity: 0.9;
}

#animated-background .mduc-element span:before,
#animated-background .mduc-element span:after {
  content: "";
  display: none;
}

#animated-background > div:nth-child(even) span:after {
  animation-name: bg2;
}

@keyframes bg1 {
  0% {
    background-position: 0% 0%;
  }
  100% {
    background-position: 100% 100%;
  }
}

@keyframes bg2 {
  0% {
    background-position: 100% 0%;
  }
  100% {
    background-position: 0% 100%;
  }
}

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



/* シンボル設定はJavaScriptでランダム化されるので削除 */

/* 位置設定はJavaScriptでランダム化されるので削除 */

/* 色相設定はJavaScriptでランダム化されるので削除 */

/* 移動遅延設定はJavaScriptでランダム化されるので削除 */

/* 移動時間設定はJavaScriptでランダム化されるので削除 */

/* 回転時間設定はJavaScriptでランダム化されるので削除 */

/* サイズ設定はJavaScriptでランダム化されるので削除 */

/* デバッグ用: 画像名表示（開発時のみ使用） */
/* 以下のコメントアウトを外すと画像名が表示されます */
/*
#animated-background .mduc-element:after {
  content: attr(data-image-name);
  position: absolute;
  bottom: -20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  color: #333;
  background: rgba(255,255,255,0.8);
  padding: 2px 4px;
  border-radius: 2px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 10;
}
*/

/* モバイルデバイスでは背景アニメーションを無効化 */
@media (max-width: 767px) {
  #animated-background {
    display: none !important;
  }
}