/* ========================================
   プロフィール画面専用スタイル
   ======================================== */

/* カード出現アニメーション */
@keyframes profile-card-enter {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.profile-card-enter {
    animation: profile-card-enter 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    opacity: 0;
}

/* プレイヤーカードのグロー効果 */
@keyframes profile-card-glow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(34, 211, 238, 0.3),
                    0 0 40px rgba(34, 211, 238, 0.2),
                    0 0 60px rgba(34, 211, 238, 0.1);
    }
    50% {
        box-shadow: 0 0 30px rgba(34, 211, 238, 0.5),
                    0 0 60px rgba(34, 211, 238, 0.3),
                    0 0 90px rgba(34, 211, 238, 0.2);
    }
}

.profile-card-glow {
    animation: profile-card-glow 3s ease-in-out infinite;
}

/* アバターの回転＋パルス効果 */
@keyframes avatar-pulse {
    0%, 100% {
        transform: scale(1) rotate(0deg);
        box-shadow: 0 0 20px rgba(34, 211, 238, 0.5);
    }
    50% {
        transform: scale(1.05) rotate(5deg);
        box-shadow: 0 0 40px rgba(34, 211, 238, 0.8),
                    0 0 60px rgba(168, 85, 247, 0.6);
    }
}

.profile-avatar > div {
    animation: avatar-pulse 4s ease-in-out infinite;
}

/* レベルバッジのアニメーション */
@keyframes level-badge-spin {
    0% {
        transform: rotate(0deg) scale(1);
    }
    10% {
        transform: rotate(10deg) scale(1.1);
    }
    20% {
        transform: rotate(-10deg) scale(1.1);
    }
    30% {
        transform: rotate(0deg) scale(1);
    }
    100% {
        transform: rotate(0deg) scale(1);
    }
}

.level-badge {
    animation: level-badge-spin 3s ease-in-out infinite;
}

/* XPバーのグラデーションアニメーション */
@keyframes xp-bar-shine {
    0% {
        background-position: -200% center;
    }
    100% {
        background-position: 200% center;
    }
}

.xp-bar {
    background: linear-gradient(
        90deg,
        #06b6d4 0%,
        #22d3ee 25%,
        #a855f7 50%,
        #22d3ee 75%,
        #06b6d4 100%
    );
    background-size: 200% 100%;
    animation: xp-bar-shine 2s linear infinite;
}

/* XPカウンターのパルス */
@keyframes xp-pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.05);
    }
}

.xp-counter {
    animation: xp-pulse 2s ease-in-out infinite;
}

/* 統計カードのホバーエフェクト */
.stat-card > div {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stat-card:hover > div {
    transform: translateY(-5px);
}

/* 統計カードの背景グロー */
.stats-card {
    position: relative;
    overflow: hidden;
}

.stats-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(34, 211, 238, 0.1) 0%, transparent 70%);
    animation: stats-glow-rotate 10s linear infinite;
    pointer-events: none;
}

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

/* 統計行のホバーエフェクト */
.stat-row {
    padding: 8px 12px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.stat-row:hover {
    background: rgba(34, 211, 238, 0.1);
}

/* 勝率バーのグラデーション */
.winrate-bar {
    background: linear-gradient(
        90deg,
        #10b981 0%,
        #22d3ee 100%
    );
    position: relative;
    overflow: hidden;
}

.winrate-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.3) 50%,
        transparent 100%
    );
    animation: winrate-shine 2s ease-in-out infinite;
}

@keyframes winrate-shine {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* 勝率数値のパルス */
.winrate-number {
    animation: winrate-pulse 1.5s ease-in-out infinite;
}

@keyframes winrate-pulse {
    0%, 100% {
        transform: scale(1);
        text-shadow: 0 0 10px currentColor;
    }
    50% {
        transform: scale(1.1);
        text-shadow: 0 0 20px currentColor, 0 0 30px currentColor;
    }
}

/* 称号バッジのアニメーション */
@keyframes achievement-badge-pop {
    from {
        opacity: 0;
        transform: scale(0) rotate(-180deg);
    }
    to {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

.achievement-badge-profile {
    animation: achievement-badge-pop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    opacity: 0;
}

.achievement-badge-profile > div {
    transition: transform 0.3s ease;
}

.achievement-badge-profile:hover > div {
    transform: scale(1.15) rotate(5deg);
}

/* 称号カードのアニメーション */
.achievement-card {
    animation: profile-card-enter 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    opacity: 0;
}

/* 統計数値のカウントアップ時の強調 */
.stat-number {
    transition: all 0.3s ease;
    position: relative;
}

.stat-number::after {
    content: '';
    position: absolute;
    inset: -5px;
    background: radial-gradient(circle, currentColor 0%, transparent 70%);
    opacity: 0;
    z-index: -1;
    transition: opacity 0.3s ease;
}

.stat-number:hover::after {
    opacity: 0.2;
}

/* モノスペースフォント */
.mono {
    font-family: 'Roboto Mono', monospace;
    letter-spacing: 0.05em;
}

/* プロフィール画面のスクロール */
#profile-screen {
    overflow-y: auto;
    max-height: 100vh;
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}

/* スクロールバーを非表示に（Webkit系ブラウザ） */
#profile-screen::-webkit-scrollbar {
    display: none;
}

/* プロフィール画面内のスクロール可能エリア */
#profile-screen .overflow-y-auto {
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}

#profile-screen .overflow-y-auto::-webkit-scrollbar {
    display: none;
}

/* ユーザー名編集モーダル */
#username-edit-modal .modal-content {
    animation: modal-slide-up 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

/* 連勝記録の炎エフェクト */
@keyframes fire-flicker {
    0%, 100% {
        text-shadow: 0 0 5px #ff6b00,
                     0 0 10px #ff6b00,
                     0 0 15px #ff6b00,
                     0 0 20px #ff4500;
    }
    50% {
        text-shadow: 0 0 10px #ff6b00,
                     0 0 20px #ff6b00,
                     0 0 30px #ff6b00,
                     0 0 40px #ff4500;
    }
}

/* 連勝中の特殊エフェクト */
.streak-active {
    animation: fire-flicker 1s ease-in-out infinite;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .profile-avatar > div {
        width: 80px;
        height: 80px;
        font-size: 32px;
    }
    
    .level-badge {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }
    
    .grid.grid-cols-4 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .grid.md\\:grid-cols-2 {
        grid-template-columns: 1fr;
    }
}

/* 統計カードのインナーシャドウ */
.stat-card > div {
    position: relative;
}

.stat-card > div::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 0.75rem;
    padding: 2px;
    background: linear-gradient(135deg, transparent 0%, rgba(34, 211, 238, 0.5) 50%, transparent 100%);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.stat-card:hover > div::before {
    opacity: 1;
}

/* Best Opponent の装飾 */
.best-opponent {
    position: relative;
    display: inline-block;
}

.best-opponent::before {
    content: '👑';
    position: absolute;
    left: -25px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    animation: crown-bounce 2s ease-in-out infinite;
}

@keyframes crown-bounce {
    0%, 100% {
        transform: translateY(-50%) rotate(0deg);
    }
    50% {
        transform: translateY(-60%) rotate(10deg);
    }
}

/* グリッドギャップのアニメーション遅延 */
.grid > *:not(.profile-card-enter):not(.stat-card):not(.achievement-badge-profile) {
    animation-fill-mode: backwards;
}
