/*
 * card.css
 * 生き物カード（表裏フリップ）のスタイルを定義します。
 */

/* ── カードラッパー（位置はJS側でセット） ─────────── */
.card-wrap {
  position: absolute;
  cursor: pointer;
  z-index: 10;
  perspective: 600px;
}

/* ── カード本体（3D回転する） ──────────────────────── */
.card-inner {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 50%;
}

/* フリップ時に180度回転 */
.card-wrap.flipped .card-inner {
  transform: rotateY(180deg);
}

/* ── 表・裏 共通 ────────────────────────────────────── */
.card-face {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1.5px solid rgba(255, 255, 255, 0.13);
}

/* ── 表面 ───────────────────────────────────────────── */
.card-front {
  background: rgba(255, 255, 255, 0.05);
  box-shadow: 0 0 20px rgba(80, 180, 255, 0.1);
}

.card-wrap:hover .card-front {
  border-color: rgba(120, 220, 255, 0.4);
  box-shadow: 0 0 30px rgba(80, 180, 255, 0.28);
}

/* ── 裏面 ───────────────────────────────────────────── */
.card-back {
  background: rgba(8, 22, 48, 0.92);
  border-color: rgba(100, 200, 255, 0.3);
  box-shadow: 0 0 24px rgba(80, 180, 255, 0.2);
  transform: rotateY(180deg);
  flex-direction: column;
  gap: 6px;
  padding: 10px;
}

/* ── 画像（表・裏共通）サイズはJS側でCONFIGから設定 ── */
.card-img {
  object-fit: cover;
  display: block;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── 画像読み込み失敗時のフォールバック ─────────────── */
.card-fallback {
  font-size: 32px;
  line-height: 1;
  user-select: none;
}

/* ── 裏面：ユーザーアバター（back.jpg 失敗時） ──────── */
.user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(80, 160, 255, 0.2);
  border: 1px solid rgba(100, 200, 255, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 500;
  color: rgba(160, 220, 255, 0.95);
  flex-shrink: 0;
}

/* ── 裏面：ユーザー名 ───────────────────────────────── */
.user-name {
  font-size: 10px;
  color: rgba(180, 230, 255, 0.85);
  font-weight: 500;
  text-align: center;
  line-height: 1.3;
  word-break: break-all;
  max-width: 100%;
}

/* ── グロウリング ───────────────────────────────────── */
.glow-ring {
  position: absolute;
  border-radius: 50%;
  border: 0.5px solid rgba(100, 200, 255, 0.09);
  pointer-events: none;
  animation: glowPulse 6s ease-in-out infinite;
}

@keyframes glowPulse {
  0%, 100% { transform: scale(1);    opacity: 0.35; }
  50%       { transform: scale(1.12); opacity: 0.07; }
}
