/* =============================
   基本設定
============================= */

* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  margin: 0;
  font-family:
    "Hiragino Maru Gothic ProN",
    "Rounded Mplus 1c",
    "Yu Gothic",
    sans-serif;
  background: linear-gradient(to bottom, #a8e6ff, #d4f7ff);
  min-height: 100vh;
  overflow-x: hidden;
}

/* =============================
   ヘッダー
============================= */

header {
  text-align: center;
  padding: clamp(1rem, 3vw, 2rem);
  background: #7ed6ff;
  position: relative;
  z-index: 10;
}

header h1 {
  margin: 0;
  font-size: clamp(1.2rem, 3.5vw, 2rem);
  color: white;
}

/* =============================
   カード全体ラッパー（ある場合）
============================= */

.container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(clamp(150px, 25vw, 220px), 1fr));
  gap: clamp(1rem, 3vw, 2rem);
  padding: clamp(1rem, 4vw, 3rem);
  justify-items: center;
}

/* =============================
   カード
============================= */

.fish-card {
  width: clamp(150px, 25vw, 240px);
  aspect-ratio: 4 / 3;
  perspective: 1000px;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.fish-card:hover {
  transform: scale(1.05);
}

/* =============================
   フリップ構造
============================= */

.fish-inner {
  width: 100%;
  height: 100%;
  position: relative;
  transition: transform 0.6s;
  transform-style: preserve-3d;
}

.fish-card.flipped .fish-inner {
  transform: rotateY(180deg);
}

.fish-front,
.fish-back {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 1.2rem;
  backface-visibility: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(0.8rem, 2vw, 1.5rem);
  text-align: center;
  box-shadow: 0 0.4rem 1rem rgba(0,0,0,0.15);
}

.fish-front {
  background: #ffffff;
}

.fish-back {
  background: #ffeaa7;
  transform: rotateY(180deg);
}

/* =============================
   表：漢字
============================= */

.fish-name {
  font-size: clamp(1.6rem, 5vw, 2.5rem);
  font-weight: bold;
  color: #ff4f81;

  /* 白縁取り */
  text-shadow:
    -2px -2px 0 white,
     2px -2px 0 white,
    -2px  2px 0 white,
     2px  2px 0 white;
}

/* =============================
   裏：読み
============================= */

.fish-reading {
  font-size: clamp(0.9rem, 2.8vw, 1.2rem);
  font-weight: bold;
  color: #333;
  line-height: 1.5;
  word-break: break-word;
}

/* =============================
   泡アニメーション
============================= */

.bubble {
  position: fixed;
  bottom: -10vh;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, white, rgba(255,255,255,0.3));
  opacity: 0.6;
  pointer-events: none;
  animation: bubbleUp linear infinite;
  will-change: transform;
}

@keyframes bubbleUp {
  0%   { transform: translateY(0) translateX(0); }
  50%  { transform: translateY(-60vh) translateX(1vw); }
  100% { transform: translateY(-120vh) translateX(-1vw); }
}


/* =============================
   iPhone向け微調整
============================= */

@media (max-width: 480px) {

  .container {
    gap: 1rem;
    padding: 1rem;
  }

  .fish-card {
    width: 45vw;
  }

}

/* =============================
   水中ふよふよアニメ
============================= */

.fish-card {
  width: clamp(150px, 25vw, 240px);
  aspect-ratio: 4 / 3;
  perspective: 1000px;
  cursor: pointer;

  animation: floatSwim var(--float-speed, 5s) ease-in-out infinite;
}

/* ふよふよ＋左右＋少し回転 */
@keyframes floatSwim {
  0% {
    transform:
      translateY(0)
      translateX(0)
      rotate(0deg);
  }

  25% {
    transform:
      translateY(calc(var(--float-y) * -1))
      translateX(var(--float-x))
      rotate(var(--float-rot));
  }

  50% {
    transform:
      translateY(0)
      translateX(calc(var(--float-x) * -1))
      rotate(0deg);
  }

  75% {
    transform:
      translateY(var(--float-y))
      translateX(var(--float-x))
      rotate(calc(var(--float-rot) * -1));
  }

  100% {
    transform:
      translateY(0)
      translateX(0)
      rotate(0deg);
  }
}

/* =============================
   水面の光ゆらぎ
============================= */

.water-light {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(circle at 30% 20%, rgba(255,255,255,0.25), transparent 40%),
    radial-gradient(circle at 70% 60%, rgba(255,255,255,0.2), transparent 50%);
  animation: waterMove 12s ease-in-out infinite alternate;
}

@keyframes waterMove {
  from { transform: translateX(-2vw) translateY(-1vh); }
  to   { transform: translateX(2vw) translateY(1vh); }
}

