/**
 * ガチャ演出スタイル
 * JUMP_PROTOCOL - DECRYPT Identity演出
 *
 * レアリティコード:
 * - COMMON: CORRUPT_DATA (くすんだグレー)
 * - RARE: VALID_CODE (鮮やかな緑)
 * - EPIC: SECURITY_BREACH (紫の衝撃波)
 * - LEGENDARY: ROOT_ACCESS (黄金、サイレン)
 * - UNIQUE: VOID_ERROR (禍々しい赤黒)
 */

/* ============================================
   基本スタイル
   ============================================ */

.gacha-container {
  position: relative;
}

.gacha-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #0a0a0f;
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  font-family: 'Courier New', Consolas, monospace;
  --rarity-color: #888888;
}

.gacha-overlay.active {
  display: flex;
  animation: fadeIn 0.3s ease;
  opacity: 1;
}

.gacha-overlay.closing {
  display: flex;
  /* コンテナ側でフェードアウトするのでoverlay自体はフェードしない */
  background: #0a0a0f;
}

/* マトリックス背景キャンバス */
.gacha-matrix-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.gacha-content {
  position: relative;
  z-index: 1;
  text-align: center;
  color: #00ff00;
}

/* ============================================
   スピナー
   ============================================ */

.gacha-spinner {
  width: 80px;
  height: 80px;
  margin: 0 auto 30px;
  border: 3px solid #333;
  border-top-color: var(--rarity-color);
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.3s;
}

.gacha-spinner.spinning {
  opacity: 1;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ============================================
   テキスト表示
   ============================================ */

.gacha-text {
  font-size: 24px;
  color: #00ff00;
  text-shadow: 0 0 10px #00ff00;
  margin-bottom: 20px;
  min-height: 36px;
}

.gacha-result {
  font-size: 36px;
  font-weight: bold;
  min-height: 50px;
  margin-bottom: 30px;
}

.gacha-result span {
  display: inline-block;
}

/* ============================================
   COMMON (CORRUPT_DATA)
   テーマ: 「落差の暴力」- 期待させて突き落とす
   ============================================ */

.gacha-overlay.rarity-common {
  background: rgba(10, 10, 10, 0.98);
}

.gacha-overlay.rarity-common .gacha-text {
  color: #555555;
  text-shadow: none;
}

/* 電源断のようなカットオフ */
.gacha-overlay.common-cutoff {
  animation: commonCutoff 0.1s ease;
}

@keyframes commonCutoff {
  0% { filter: brightness(1); }
  50% { filter: brightness(0.3); }
  100% { filter: brightness(1); }
}

.common-text {
  color: #555555;
  text-shadow: none;
  opacity: 0.7;
  animation: commonFadeIn 0.3s ease;
}

@keyframes commonFadeIn {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 0.7; transform: translateY(0); }
}

/* ============================================
   RARE (VALID_CODE)
   テーマ: 緑のマトリックス、肯定的な電子音
   ============================================ */

.gacha-overlay.rarity-rare {
  background: linear-gradient(
    135deg,
    rgba(0, 20, 0, 0.95) 0%,
    rgba(0, 40, 0, 0.95) 50%,
    rgba(0, 20, 0, 0.95) 100%
  );
}

.gacha-overlay.rarity-rare .gacha-text {
  color: #00ff00;
  text-shadow: 0 0 10px #00ff00;
}

/* 緑フラッシュ */
.gacha-overlay.rare-flash {
  background: radial-gradient(circle, rgba(0, 255, 100, 0.6) 0%, rgba(0, 100, 0, 0.8) 100%) !important;
}

.rare-text {
  color: #00ff00;
  text-shadow: 0 0 15px #00ff00, 0 0 30px #00ff00;
  animation: rarePulse 0.8s ease infinite alternate;
}

@keyframes rarePulse {
  from { text-shadow: 0 0 10px #00ff00; }
  to { text-shadow: 0 0 20px #00ff00, 0 0 40px #00ff00; }
}

/* ============================================
   EPIC (SECURITY_BREACH)
   テーマ: ファイアウォール突破、紫の衝撃波
   ============================================ */

.gacha-overlay.rarity-epic {
  background: linear-gradient(
    135deg,
    rgba(20, 0, 30, 0.95) 0%,
    rgba(50, 0, 80, 0.95) 50%,
    rgba(20, 0, 30, 0.95) 100%
  );
}

.gacha-overlay.rarity-epic .gacha-text {
  color: #aa00ff;
  text-shadow: 0 0 15px #aa00ff;
}

/* 衝撃波エフェクト */
.epic-shockwave {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 10px;
  height: 10px;
  border: 4px solid #aa00ff;
  border-radius: 50%;
  animation: epicShockwaveExpand 0.8s ease-out forwards;
  pointer-events: none;
  z-index: 0;
}

@keyframes epicShockwaveExpand {
  0% {
    width: 10px;
    height: 10px;
    opacity: 1;
    border-width: 4px;
  }
  100% {
    width: 200vmax;
    height: 200vmax;
    opacity: 0;
    border-width: 2px;
  }
}

.epic-text {
  color: #aa00ff;
  text-shadow: 0 0 15px #aa00ff, 0 0 30px #aa00ff;
  animation: epicGlow 0.3s ease infinite alternate;
}

@keyframes epicGlow {
  from {
    text-shadow: 0 0 15px #aa00ff;
    filter: brightness(1);
  }
  to {
    text-shadow: 0 0 30px #aa00ff, 0 0 50px #cc44ff;
    filter: brightness(1.2);
  }
}

/* ============================================
   LEGENDARY (ROOT_ACCESS)
   テーマ: サイレン、明滅、黄金パーティクル
   ============================================ */

.gacha-overlay.rarity-legendary {
  background: linear-gradient(
    135deg,
    rgba(30, 15, 0, 0.95) 0%,
    rgba(60, 30, 0, 0.95) 50%,
    rgba(30, 15, 0, 0.95) 100%
  );
}

.gacha-overlay.rarity-legendary .gacha-text {
  color: #ffaa00;
  text-shadow: 0 0 15px #ffaa00;
}

/* サイレン/アラート演出 */
.gacha-overlay.legendary-alert {
  animation: legendaryAlert 0.3s ease infinite;
}

@keyframes legendaryAlert {
  0%, 100% {
    background: linear-gradient(135deg, rgba(30, 15, 0, 0.95) 0%, rgba(60, 30, 0, 0.95) 50%, rgba(30, 15, 0, 0.95) 100%);
  }
  50% {
    background: linear-gradient(135deg, rgba(80, 30, 0, 0.95) 0%, rgba(120, 60, 0, 0.95) 50%, rgba(80, 30, 0, 0.95) 100%);
  }
}

/* ゴールドフラッシュ */
.gacha-overlay.legendary-flash {
  background: radial-gradient(circle, rgba(255, 220, 100, 0.95) 0%, rgba(255, 150, 0, 0.9) 100%) !important;
}

/* 暗転 */
.gacha-overlay.legendary-blackout {
  background: #000 !important;
}

/* ★ ホワイトアウト（Epic→Legendary昇格時） */
.gacha-overlay.legendary-whiteout {
  background: radial-gradient(circle, rgba(255, 255, 255, 1) 0%, rgba(255, 220, 150, 0.95) 100%) !important;
  animation: legendaryWhiteout 0.3s ease;
}

@keyframes legendaryWhiteout {
  0% { opacity: 0; }
  50% { opacity: 1; }
  100% { opacity: 1; }
}

/* バースト時の背景 */
.gacha-overlay.legendary-burst {
  background: radial-gradient(
    circle,
    rgba(255, 200, 50, 0.4) 0%,
    rgba(80, 40, 0, 0.95) 50%,
    rgba(30, 15, 0, 0.95) 100%
  ) !important;
}

/* 光線バーストコンテナ */
.legendary-burst-container {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

.legendary-rays {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
}

.legendary-ray {
  position: absolute;
  top: 0;
  left: -2px;
  width: 4px;
  height: 300vh;
  background: linear-gradient(
    to top,
    transparent 0%,
    rgba(255, 200, 50, 0.8) 20%,
    rgba(255, 220, 100, 1) 50%,
    rgba(255, 200, 50, 0.8) 80%,
    transparent 100%
  );
  transform-origin: bottom center;
  animation: legendaryRayExpand 0.8s ease-out forwards;
  opacity: 0;
}

@keyframes legendaryRayExpand {
  0% {
    opacity: 0;
    height: 0;
  }
  20% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    height: 300vh;
  }
}

/* 黄金パーティクル */
.legendary-particles {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 0;
  height: 0;
  pointer-events: none;
  z-index: 2;
}

.legendary-particle {
  position: absolute;
  width: var(--size, 6px);
  height: var(--size, 6px);
  background: radial-gradient(circle, #fff 0%, #ffcc00 50%, #ff8800 100%);
  border-radius: 50%;
  box-shadow: 0 0 10px #ffcc00, 0 0 20px #ff8800;
  animation: legendaryParticleExplode 1.2s ease-out forwards;
  animation-delay: var(--delay, 0s);
  opacity: 0;
}

@keyframes legendaryParticleExplode {
  0% {
    opacity: 1;
    transform: translate(0, 0) scale(1);
  }
  100% {
    opacity: 0;
    transform:
      translate(
        calc(cos(var(--angle)) * var(--distance)),
        calc(sin(var(--angle)) * var(--distance))
      )
      scale(0);
  }
}

/* テキストスタイル（RGB変化） */
.legendary-text {
  font-size: 42px;
  animation: legendaryTextShimmer 2s linear infinite, legendaryRGB 3s linear infinite;
  background: linear-gradient(
    90deg,
    #ff6600 0%,
    #ffaa00 25%,
    #ffee00 50%,
    #ffaa00 75%,
    #ff6600 100%
  );
  background-size: 200% 100%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 15px rgba(255, 170, 0, 0.9)) drop-shadow(0 0 30px rgba(255, 100, 0, 0.6));
}

.legendary-reveal {
  animation:
    legendaryTextShimmer 2s linear infinite,
    legendaryRGB 3s linear infinite,
    legendaryRevealScale 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

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

@keyframes legendaryRGB {
  0%, 100% { filter: drop-shadow(0 0 15px rgba(255, 170, 0, 0.9)) drop-shadow(0 0 30px rgba(255, 100, 0, 0.6)); }
  33% { filter: drop-shadow(0 0 15px rgba(255, 100, 100, 0.9)) drop-shadow(0 0 30px rgba(255, 50, 0, 0.6)); }
  66% { filter: drop-shadow(0 0 15px rgba(255, 220, 100, 0.9)) drop-shadow(0 0 30px rgba(200, 150, 0, 0.6)); }
}

@keyframes legendaryRevealScale {
  0% {
    transform: scale(0) rotate(-10deg);
    opacity: 0;
  }
  50% {
    transform: scale(1.3) rotate(5deg);
  }
  70% {
    transform: scale(0.9) rotate(-2deg);
  }
  100% {
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
}

/* ============================================
   UNIQUE (VOID_ERROR)
   テーマ: フリーズ、BSOD、画面割れ、禍々しい赤黒
   ============================================ */

.gacha-overlay.rarity-unique {
  background: linear-gradient(
    135deg,
    rgba(30, 0, 0, 0.95) 0%,
    rgba(60, 0, 0, 0.95) 50%,
    rgba(30, 0, 0, 0.95) 100%
  );
}

.gacha-overlay.rarity-unique .gacha-text {
  color: #ff0000;
  text-shadow: 0 0 15px #ff0000;
}

/* フリーズ演出（ノイズ/砂嵐） */
.gacha-overlay.unique-freeze {
  animation: uniqueNoise 0.1s steps(10) infinite;
}

.gacha-overlay.unique-freeze::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><filter id="n"><feTurbulence type="fractalNoise" baseFrequency="0.8" numOctaves="4" stitchTiles="stitch"/></filter><rect width="100%" height="100%" filter="url(%23n)"/></svg>');
  opacity: 0.3;
  pointer-events: none;
  z-index: 10;
}

@keyframes uniqueNoise {
  0%, 100% { filter: contrast(1); }
  50% { filter: contrast(1.2); }
}

/* ★ BSOD後の完全暗転（恐怖の沈黙） */
.gacha-overlay.unique-blackout {
  background: #000 !important;
}

/* 心臓の鼓動エフェクト */
.gacha-overlay.unique-heartbeat {
  animation: uniqueHeartbeat 0.8s ease infinite;
}

@keyframes uniqueHeartbeat {
  0%, 100% {
    background: linear-gradient(135deg, rgba(30, 0, 0, 0.95) 0%, rgba(60, 0, 0, 0.95) 50%, rgba(30, 0, 0, 0.95) 100%);
  }
  15%, 30% {
    background: linear-gradient(135deg, rgba(80, 0, 0, 0.95) 0%, rgba(120, 0, 0, 0.95) 50%, rgba(80, 0, 0, 0.95) 100%);
  }
}

/* 画面割れエフェクト */
.unique-screen-crack {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 5;
  background:
    linear-gradient(45deg, transparent 45%, rgba(255, 0, 0, 0.3) 45%, rgba(255, 0, 0, 0.3) 55%, transparent 55%),
    linear-gradient(-45deg, transparent 45%, rgba(255, 0, 0, 0.3) 45%, rgba(255, 0, 0, 0.3) 55%, transparent 55%),
    linear-gradient(90deg, transparent 48%, rgba(100, 0, 0, 0.5) 48%, rgba(100, 0, 0, 0.5) 52%, transparent 52%);
  background-size: 100% 100%;
  animation: crackAppear 0.3s ease forwards;
}

@keyframes crackAppear {
  0% {
    opacity: 0;
    transform: scale(0.8);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* テキストスタイル（禍々しい赤黒） */
.unique-text {
  font-size: 44px;
  color: #ff0000;
  text-shadow:
    0 0 10px #ff0000,
    0 0 20px #880000,
    0 0 40px #440000;
  animation: uniqueGlitch 0.1s infinite, uniquePulse 1s ease infinite;
}

@keyframes uniqueGlitch {
  0% { transform: translate(0); }
  20% { transform: translate(-3px, 2px); }
  40% { transform: translate(3px, -2px); }
  60% { transform: translate(-2px, -2px); }
  80% { transform: translate(2px, 2px); }
  100% { transform: translate(0); }
}

@keyframes uniquePulse {
  0%, 100% {
    text-shadow: 0 0 10px #ff0000, 0 0 20px #880000, 0 0 40px #440000;
  }
  50% {
    text-shadow: 0 0 20px #ff0000, 0 0 40px #aa0000, 0 0 60px #660000;
  }
}

.unique-reveal {
  animation: uniqueReveal 0.5s ease forwards, uniqueGlitch 0.1s infinite, uniquePulse 1s ease infinite;
}

@keyframes uniqueReveal {
  0% {
    transform: scale(0) rotate(10deg);
    opacity: 0;
    filter: blur(10px);
  }
  50% {
    transform: scale(1.3) rotate(-5deg);
    filter: blur(0);
  }
  100% {
    transform: scale(1) rotate(0);
    opacity: 1;
  }
}

/* ============================================
   クラッシュ演出（UNIQUE専用BSOD）
   ============================================ */

.gacha-crash-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #0078d7;
  z-index: 20000;
  display: flex;
  justify-content: center;
  align-items: center;
  animation: crashAppear 0.1s ease;
}

@keyframes crashAppear {
  0% {
    clip-path: polygon(0 50%, 100% 50%, 100% 50%, 0 50%);
  }
  100% {
    clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
  }
}

.crash-bsod {
  color: white;
  font-family: 'Segoe UI', 'Courier New', monospace;
  max-width: 800px;
  width: 90%;
  padding: 50px;
  box-sizing: border-box;
  overflow-y: auto;
  max-height: 100vh;
}

.crash-header {
  font-size: clamp(24px, 8vw, 60px);
  margin-bottom: clamp(15px, 4vw, 30px);
  white-space: nowrap;
}

.crash-body {
  font-size: clamp(14px, 3.5vw, 20px);
  line-height: 1.6;
}

.crash-body p {
  margin-bottom: clamp(10px, 3vw, 20px);
}

.crash-progress {
  margin-top: clamp(20px, 5vw, 40px);
  font-size: clamp(14px, 3vw, 18px);
}

.crash-error {
  margin-top: clamp(20px, 5vw, 40px);
  font-size: clamp(12px, 2.5vw, 16px);
  opacity: 0.8;
  word-break: break-all;
}

.gacha-crash-overlay.crash-glitch {
  animation: crashGlitch 0.5s ease;
}

@keyframes crashGlitch {
  0% { filter: none; transform: translate(0); }
  20% { filter: hue-rotate(90deg); transform: translate(-5px, 5px); }
  40% { filter: hue-rotate(180deg); transform: translate(5px, -5px); }
  60% { filter: hue-rotate(270deg); transform: translate(-3px, -3px); }
  80% { filter: hue-rotate(360deg); transform: translate(3px, 3px); }
  100% { filter: none; transform: translate(0); }
}

.gacha-crash-overlay.crash-fadeout {
  animation: crashFadeout 0.5s ease forwards;
}

@keyframes crashFadeout {
  0% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(0.9); }
}

/* ============================================
   フラッシュエフェクト（汎用）
   ============================================ */

.gacha-overlay.flash {
  background: white !important;
}

/* ============================================
   Identity プレビュー
   ============================================ */

.gacha-identity-preview {
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.5s ease;
}

.gacha-identity-preview.visible {
  opacity: 1;
  transform: translateY(0);
}

.identity-card {
  display: inline-block;
  padding: 20px 40px;
  border: 2px solid var(--primary-color, #00ff00);
  background: rgba(0, 0, 0, 0.5);
  box-shadow: 0 0 20px var(--glow-color, #00ff00);
}

.identity-avatar {
  width: 60px;
  height: 60px;
  margin: 0 auto 15px;
  position: relative;
}

.identity-body {
  width: 100%;
  height: 100%;
  background: var(--primary-color, #00ff00);
  box-shadow: 0 0 15px var(--glow-color, #00ff00);
}

.identity-eye {
  position: absolute;
  top: 35%;
  right: 20%;
  width: 12px;
  height: 12px;
  background: var(--eye-color, #0a0a0f);
}

.identity-code {
  font-size: 14px;
  color: var(--primary-color, #00ff00);
  text-shadow: 0 0 5px var(--glow-color, #00ff00);
  font-family: 'Courier New', monospace;
}

/* Identity追加要素 */
.identity-highlight {
  position: absolute;
  top: 10%;
  left: 10%;
  width: 30%;
  height: 20%;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.5) 0%, transparent 100%);
  pointer-events: none;
}

.identity-aura {
  position: absolute;
  top: -10px;
  left: -10px;
  right: -10px;
  bottom: -10px;
  border: 2px solid var(--secondary-color, var(--primary-color));
  opacity: 0.5;
  animation: identityAuraPulse 1.5s ease infinite;
  pointer-events: none;
}

@keyframes identityAuraPulse {
  0%, 100% { opacity: 0.3; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(1.05); }
}

.identity-glitch-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--primary-color);
  mix-blend-mode: difference;
  animation: identityGlitchLayer 0.2s steps(3) infinite;
  pointer-events: none;
}

@keyframes identityGlitchLayer {
  0% { clip-path: inset(0 0 90% 0); }
  33% { clip-path: inset(40% 0 40% 0); }
  66% { clip-path: inset(80% 0 0 0); }
  100% { clip-path: inset(0 0 90% 0); }
}

/* エフェクト情報表示 */
.identity-effects {
  margin-top: 8px;
  font-size: 10px;
  color: #666;
  display: flex;
  gap: 10px;
  justify-content: center;
}

.effect-trail, .effect-death {
  padding: 2px 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
}

/* ============================================
   レアリティ別スタイル
   ============================================ */

/* COMMON (1): くすんだ、地味 */
.identity-card.identity-rarity-1 {
  border-color: #555;
  box-shadow: none;
}
.identity-card.identity-rarity-1 .identity-body {
  box-shadow: none;
}
.identity-card.identity-rarity-1 .identity-code {
  text-shadow: none;
  color: #666;
}

/* RARE (2): 鮮やかな単色 + グロー */
.identity-card.identity-rarity-2 {
  animation: identityRareGlow 2s ease infinite;
}
@keyframes identityRareGlow {
  0%, 100% { box-shadow: 0 0 15px var(--glow-color); }
  50% { box-shadow: 0 0 25px var(--glow-color); }
}

/* EPIC (3): 二色グラデーション */
.identity-card.identity-rarity-3 .identity-body {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  box-shadow: 0 0 20px var(--glow-color);
}
.identity-card.identity-rarity-3 {
  border-image: linear-gradient(135deg, var(--primary-color), var(--secondary-color)) 1;
  animation: identityEpicPulse 1.5s ease infinite;
}
@keyframes identityEpicPulse {
  0%, 100% { box-shadow: 0 0 20px var(--glow-color); }
  50% { box-shadow: 0 0 35px var(--glow-color), 0 0 50px var(--secondary-color); }
}

/* LEGENDARY (4): RGB変化 */
.identity-card.identity-rarity-4 {
  animation: identityLegendaryRGB 3s linear infinite;
}
.identity-card.identity-rarity-4 .identity-body {
  background: linear-gradient(
    135deg,
    var(--primary-color) 0%,
    var(--secondary-color) 50%,
    var(--tertiary-color) 100%
  );
  background-size: 200% 200%;
  animation: identityLegendaryShift 2s ease infinite;
}
@keyframes identityLegendaryShift {
  0% { background-position: 0% 0%; }
  50% { background-position: 100% 100%; }
  100% { background-position: 0% 0%; }
}
@keyframes identityLegendaryRGB {
  0%, 100% {
    box-shadow: 0 0 30px var(--primary-color), 0 0 60px var(--secondary-color);
  }
  33% {
    box-shadow: 0 0 30px var(--secondary-color), 0 0 60px var(--tertiary-color);
  }
  66% {
    box-shadow: 0 0 30px var(--tertiary-color), 0 0 60px var(--primary-color);
  }
}
.identity-card.identity-rarity-4 .identity-eye {
  animation: identityLegendaryEye 0.5s ease infinite;
}
@keyframes identityLegendaryEye {
  0%, 100% { box-shadow: 0 0 5px var(--eye-color); }
  50% { box-shadow: 0 0 15px var(--eye-color), 0 0 25px var(--eye-color); }
}

/* UNIQUE (5): 禍々しい/特殊 */
.identity-card.identity-rarity-5 {
  border-color: #ff0000;
  animation: identityUniqueFlicker 0.1s steps(2) infinite;
}
@keyframes identityUniqueFlicker {
  0% { border-color: #ff0000; box-shadow: 0 0 30px #ff0000; }
  50% { border-color: #880000; box-shadow: 0 0 20px #880000; }
  100% { border-color: #ff0000; box-shadow: 0 0 30px #ff0000; }
}

/* パターン別スタイル */
.identity-pattern-gradient .identity-body {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
}

.identity-pattern-rgb-shift .identity-body {
  animation: patternRGBShift 2s linear infinite;
}
@keyframes patternRGBShift {
  0% { filter: hue-rotate(0deg); }
  100% { filter: hue-rotate(360deg); }
}

.identity-pattern-glitch .identity-body {
  animation: patternGlitch 0.3s steps(5) infinite;
}
@keyframes patternGlitch {
  0% { transform: translate(0); filter: none; }
  20% { transform: translate(-2px, 1px); filter: hue-rotate(90deg); }
  40% { transform: translate(2px, -1px); filter: hue-rotate(180deg); }
  60% { transform: translate(-1px, -1px); filter: hue-rotate(270deg); }
  80% { transform: translate(1px, 1px); filter: hue-rotate(360deg); }
  100% { transform: translate(0); filter: none; }
}

.identity-pattern-prismatic .identity-body {
  background: linear-gradient(
    135deg,
    #ff0000 0%,
    #ff8000 14%,
    #ffff00 28%,
    #00ff00 42%,
    #00ffff 56%,
    #0000ff 70%,
    #ff00ff 84%,
    #ff0000 100%
  );
  background-size: 400% 400%;
  animation: patternPrismatic 3s linear infinite;
}
@keyframes patternPrismatic {
  0% { background-position: 0% 0%; }
  100% { background-position: 100% 100%; }
}

.identity-pattern-metallic .identity-body {
  background: linear-gradient(
    135deg,
    #c0c0c0 0%,
    #ffffff 25%,
    #c0c0c0 50%,
    #808080 75%,
    #c0c0c0 100%
  );
  background-size: 200% 200%;
  animation: patternMetallic 2s ease infinite;
}
@keyframes patternMetallic {
  0%, 100% { background-position: 0% 0%; }
  50% { background-position: 100% 100%; }
}

/* アニメーション別スタイル */
.identity-anim-pulse .identity-body {
  animation: animPulse 1s ease infinite;
}
@keyframes animPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.identity-anim-heartbeat .identity-body {
  animation: animHeartbeat 0.8s ease infinite;
}
@keyframes animHeartbeat {
  0%, 100% { transform: scale(1); }
  15%, 30% { transform: scale(1.1); }
}

.identity-anim-shimmer .identity-body::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
  animation: animShimmer 2s ease infinite;
}
@keyframes animShimmer {
  0% { left: -100%; }
  100% { left: 100%; }
}

.identity-anim-rainbow-cycle {
  animation: animRainbowCycle 5s linear infinite;
}
@keyframes animRainbowCycle {
  0% { filter: hue-rotate(0deg); }
  100% { filter: hue-rotate(360deg); }
}

/* ============================================
   アニメーション（汎用）
   ============================================ */

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* アイコン用アニメーション */
@keyframes iconPrismatic {
  0% { background-position: 0% 0%; }
  100% { background-position: 100% 100%; }
}

@keyframes iconMetallic {
  0%, 100% { background-position: 0% 0%; }
  50% { background-position: 100% 100%; }
}

@keyframes iconGlitch {
  0% { transform: translate(0); }
  33% { transform: translate(-1px, 1px); }
  66% { transform: translate(1px, -1px); }
  100% { transform: translate(0); }
}

/* ============================================
   レスポンシブ
   ============================================ */

@media (max-width: 768px) {
  .gacha-text {
    font-size: 18px;
  }

  .gacha-result {
    font-size: 28px;
  }

  .legendary-text {
    font-size: 32px;
  }

  .unique-text {
    font-size: 32px;
  }

  .crash-bsod {
    padding: 30px 20px;
  }

  .crash-body {
    line-height: 1.5;
  }
}

/* 小型スマホ向け追加調整 */
@media (max-width: 480px) {
  .gacha-text {
    font-size: 14px;
  }

  .gacha-result {
    font-size: 22px;
  }

  .legendary-text {
    font-size: 24px;
  }

  .unique-text {
    font-size: 24px;
  }

  .crash-bsod {
    padding: 20px 15px;
    width: 95%;
  }

  .crash-body {
    line-height: 1.4;
  }

  .crash-body p {
    margin-bottom: 10px;
  }
}

/* 超小型画面向け（横向きなど） */
@media (max-height: 500px) {
  .crash-bsod {
    padding: 15px;
  }

  .crash-header {
    margin-bottom: 10px;
  }

  .crash-body p {
    margin-bottom: 8px;
  }

  .crash-progress,
  .crash-error {
    margin-top: 15px;
  }
}
