/* app/assets/stylesheets/slime.css
   ── CSS スライムマスコット ── */

/* スライム状態変数（JSで動的に設定） */
:root {
  --slime-hue: 145;
  --slime-saturation: 70%;
  --slime-lightness: 55%;
  --slime-stage: 2;
}

/* ── 基本構造 ── */
.slime {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
  user-select: none;
}

.slime-body {
  position: relative;
  background: hsl(var(--slime-hue), var(--slime-saturation), var(--slime-lightness));
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  animation: slime-bounce 2.5s ease-in-out infinite;
  box-shadow:
    inset -4px -6px 12px rgba(0,0,0,0.15),
    inset 4px 4px 8px rgba(255,255,255,0.25),
    0 4px 16px hsla(var(--slime-hue), 60%, 40%, 0.3);
  overflow: visible;
}

/* ── サイズ ── */
.slime-sm .slime-body { width: 40px; height: 32px; }
.slime-md .slime-body { width: 64px; height: 48px; }
.slime-lg .slime-body { width: 88px; height: 66px; }

/* ── 顔 ── */
.slime-face {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.slime-eye {
  position: absolute;
  width: 14%;
  height: 20%;
  background: var(--color-text-primary, #2D2B3D);
  border-radius: 50%;
  top: 30%;
}
.slime-eye-l { left: 28%; }
.slime-eye-r { right: 28%; }

/* 目のハイライト */
.slime-eye::after {
  content: "";
  position: absolute;
  width: 40%;
  height: 40%;
  background: #fff;
  border-radius: 50%;
  top: 15%;
  right: 10%;
}

.slime-mouth {
  position: absolute;
  bottom: 25%;
  left: 50%;
  transform: translateX(-50%);
  width: 16%;
  height: 6%;
  background: rgba(0,0,0,0.2);
  border-radius: 0 0 50% 50%;
}

/* ── ムード ── */
.slime-happy .slime-mouth {
  height: 10%;
  border-radius: 0 0 50% 50%;
}
.slime-worried .slime-eye {
  top: 35%;
}
.slime-worried .slime-mouth {
  width: 10%;
  height: 8%;
  border-radius: 50%;
  background: rgba(0,0,0,0.25);
}
.slime-excited .slime-eye {
  height: 12%;
  top: 32%;
}
.slime-excited .slime-mouth {
  height: 14%;
  width: 20%;
}

/* ── 影 ── */
.slime-shadow {
  width: 60%;
  height: 6px;
  background: rgba(0,0,0,0.15);
  border-radius: 50%;
  margin-top: 2px;
  animation: slime-shadow 2.5s ease-in-out infinite;
}

/* ── バウンスアニメーション ── */
@keyframes slime-bounce {
  0%, 100% {
    transform: scaleX(1) scaleY(1) translateY(0);
  }
  25% {
    transform: scaleX(1.06) scaleY(0.94) translateY(2px);
  }
  50% {
    transform: scaleX(0.94) scaleY(1.06) translateY(-4px);
  }
  75% {
    transform: scaleX(1.03) scaleY(0.97) translateY(1px);
  }
}

@keyframes slime-shadow {
  0%, 100% { transform: scaleX(1); opacity: 0.15; }
  50% { transform: scaleX(0.8); opacity: 0.1; }
}

/* ── アクセサリースロット ── */
.slime-accessory-slot {
  position: absolute;
  top: -30%;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.7em;
  pointer-events: none;
}
.slime-sm .slime-accessory-slot { font-size: 12px; }
.slime-md .slime-accessory-slot { font-size: 16px; }
.slime-lg .slime-accessory-slot { font-size: 22px; }

/* ── フローティング配置（customise等のページ用） ── */
.slime-floating {
  position: fixed;
  bottom: 5rem;
  left: 1.5rem;
  z-index: 90;
  pointer-events: none;
}

/* ── マイページ用（大きく表示） ── */
.slime-profile {
  display: flex;
  justify-content: center;
  margin: 1rem 0;
}

/* ── Mobile ── */
@media (max-width: 640px) {
  .slime-floating { bottom: 4rem; left: 0.75rem; }
  .slime-floating .slime-body { transform: scale(0.8); }
}

/* ── 「カスタマイズ」の演出：スライムが左上から広がり、通りすぎたマスから中身があらわれる ──
   献立表（customise）と入口ページの見本で使う。JS は slime_spread.js */
/* 外枠ではみ出しを切る（.calendar-wrap は縦スクロールできるので、直接置くとスクロールが伸びる） */
.slime-spread { position: absolute; inset: 0; z-index: 5; overflow: hidden; pointer-events: none; }
.slime-spread::before {
  content: ""; position: absolute; left: 0; top: 0;
  width: 290%; aspect-ratio: 1; translate: -50% -50%;
  background: radial-gradient(circle at 60% 60%, hsl(145 70% 68% / .9), hsl(145 70% 50% / .85));
  animation: slime-spread 1.7s ease-out forwards;
}
@keyframes slime-spread {
  0%   { scale: 0;   border-radius: 58% 42% 55% 45% / 45% 58% 42% 55%; opacity: 1; }
  30%  { scale: .4;  border-radius: 42% 58% 44% 56% / 57% 43% 58% 42%; }
  55%  { scale: .75; border-radius: 55% 45% 60% 40% / 42% 56% 44% 58%; opacity: 1; }
  75%  { scale: 1;   border-radius: 46% 54% 48% 52% / 54% 46% 55% 45%; opacity: .8; }
  100% { scale: 1.05; border-radius: 50%; opacity: 0; }
}
/* キラキラ: 光の帯が斜めに流れ、4つ角の星がまたたく */
.slime-spread::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(115deg, transparent 42%, rgb(255 255 255 / .7) 50%, transparent 58%) 120% 0 / 300% 100% no-repeat;
  animation: slime-shimmer 1.3s ease-in-out .5s forwards;
}
@keyframes slime-shimmer { to { background-position: -20% 0; } }
.slime-sparkle {
  position: absolute; width: var(--size); aspect-ratio: 1; translate: -50% -50%; scale: 0;
  background: radial-gradient(circle, #fff 30%, #FFF3A8);
  clip-path: polygon(50% 0, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0 50%, 40% 40%);
  filter: drop-shadow(0 0 4px #fff);
  animation: slime-sparkle .9s ease-in-out var(--delay) forwards;
}
@keyframes slime-sparkle {
  0%, 100% { scale: 0; rotate: 0deg; }
  45%      { scale: 1.2; rotate: 45deg; }
  70%      { scale: .7; rotate: 70deg; }
}
.slime-reveal { animation: slime-reveal .5s cubic-bezier(.3,1.5,.5,1) var(--slime-delay, 0ms) backwards; }
@keyframes slime-reveal {
  from { opacity: 0; transform: scale(.7); }
  to   { opacity: 1; transform: none; }
}
