:root {
    --bg-color: #0A0E27;
    --card-bg: rgba(26, 31, 58, 0.6);
    --card-border: rgba(255, 255, 255, 0.1);
    --primary: #0074D9;
    --secondary: #FFDC00;
    --text-white: #FFFFFF;
    --text-gray: #E0E6ED;
    --hover-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, Roboto, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-white);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-x: hidden;
}

.background-glob {
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 50% 50%, rgba(0, 31, 63, 0.4) 0%, transparent 60%);
    z-index: -1;
    animation: pulse 10s infinite alternate;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 0.5;
    }

    100% {
        transform: scale(1.1);
        opacity: 0.8;
    }
}

.container {
    width: 100%;
    max-width: 1200px;
    padding: 2rem;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: 380px;
    gap: 1.5rem;
    margin: 2rem auto;
}

/* Card Common Styles */
.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 2.5rem;
    position: relative;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: var(--text-white);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.card:hover {
    transform: translateY(-8px) scale(1.01);
    box-shadow: var(--hover-shadow);
    border-color: rgba(255, 255, 255, 0.2);
    z-index: 2;
}

.wide {
    grid-column: span 2;
}

.square {
    grid-column: span 1;
}

.card-content {
    position: relative;
    z-index: 2;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.card-content.centered {
    align-items: center;
    text-align: center;
}

/* 1. Hero Card */
.hero-card {
    background: linear-gradient(135deg, rgba(0, 31, 63, 0.8) 0%, rgba(26, 31, 58, 0.6) 100%);
}

.badge {
    display: inline-block;
    padding: 6px 16px;
    background: rgba(0, 116, 217, 0.2);
    color: #4dabf7;
    border-radius: 100px;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    border: 1px solid rgba(0, 116, 217, 0.3);
}

.hero-title {
    font-size: 3rem;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 1.5rem;
    letter-spacing: -0.02em;
}

.gradient-text {
    background: linear-gradient(135deg, #4dabf7 0%, #FFDC00 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-desc {
    font-size: 1.125rem;
    color: var(--text-gray);
    line-height: 1.6;
    margin-bottom: 2rem;
    max-width: 90%;
}

.stats {
    display: flex;
    justify-content: space-between;
    /* 양쪽 끝으로 배분 */
    margin-top: auto;
}

.stat-item {
    display: flex;
    flex-direction: column;
}

.stat-item.right-align {
    align-items: flex-end;
    /* Flex item 오른쪽 정렬 */
    text-align: right;
    /* 텍스트 오른쪽 정렬 */
}

.stat-num {
    font-size: 2rem;
    font-weight: 700;
    color: var(--secondary);
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-gray);
    margin-top: 0.25rem;
}

/* 2. Profile Card (Flip Effect) */
.profile-card {
    padding: 0;
    /* 내부 flip-card-inner가 padding 역할을 대신하거나 꽉 채움 */
    background: transparent;
    /* 배경은 inner에서 처리 */
    border: none;
    /* 테두리도 inner로 이동 */
    overflow: visible;
    /* 3D 효과를 위해 visible */
    perspective: 1000px;
    /* 3D 원근감 */
}

/* Hover 시 뒤집기 (데스크톱) */
.profile-card:hover .flip-card-inner {
    transform: rotateY(180deg);
}

/* 클릭 시 뒤집기 (모바일/JS) */
.profile-card.flipped .flip-card-inner {
    transform: rotateY(180deg);
}

.flip-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.8s cubic-bezier(0.4, 0.2, 0.2, 1);
    transform-style: preserve-3d;
    border-radius: 24px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* 앞면 & 뒷면 공통 */
.flip-card-front,
.flip-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    border-radius: 24px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--card-border);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

/* 앞면 스타일 */
.flip-card-front {
    background: var(--card-bg);
    z-index: 2;
}

/* 뒷면 스타일 */
.flip-card-back {
    background: linear-gradient(135deg, rgba(0, 31, 63, 0.95) 0%, rgba(0, 116, 217, 0.9) 100%);
    transform: rotateY(180deg);
    color: white;
    overflow-y: auto;
    /* 내용이 넘칠 경우 스크롤 */
    padding: 2rem 1.5rem;
}

/* 스크롤바 커스텀 (뒷면) */
.flip-card-back::-webkit-scrollbar {
    width: 4px;
}

.flip-card-back::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
}

.profile-detail-text {
    font-size: 0.9rem;
    line-height: 1.6;
    text-align: left;
    word-break: keep-all;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.profile-detail-text strong {
    color: var(--secondary);
    font-weight: 700;
}

/* --- 편실된 스타일 복구 --- */
.profile-image-container {
    position: relative;
    width: 140px;
    height: 140px;
    margin-bottom: 1.5rem;
}

.profile-ring {
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    background: conic-gradient(from 0deg, var(--primary), var(--secondary), var(--primary));
    animation: rotate 4s linear infinite;
    filter: blur(8px);
    opacity: 0.7;
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.profile-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    position: relative;
    z-index: 2;
    border: 3px solid var(--bg-color);
}

.profile-card .card-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.profile-card .card-desc {
    font-size: 1rem;
    color: var(--text-gray);
    margin-bottom: 1.5rem;
}

.tags {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

.tag {
    font-size: 0.8rem;
    padding: 4px 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 100px;
}

/* 기존 프로필 이미지 컨테이너 유지 */
.profile-image-container {
    position: relative;
    width: 140px;
    /* 크기 약간 조정 */
    height: 140px;
    margin-bottom: 1rem;
}

/* 3. Lecture Card */
.lecture-card {
    background: linear-gradient(45deg, rgba(48, 62, 117, 0.4), rgba(26, 31, 58, 0.6));
}

.card-bg-icon {
    position: absolute;
    right: -20px;
    top: -20px;
    font-size: 15rem;
    opacity: 0.05;
    z-index: 1;
    transform: rotate(15deg);
    transition: transform 0.4s ease;
}

.card:hover .card-bg-icon {
    transform: rotate(0deg) scale(1.1);
    opacity: 0.1;
}

.lecture-card .card-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.lecture-card .card-desc {
    font-size: 1.1rem;
    color: var(--text-gray);
    margin-bottom: 2rem;
    max-width: 80%;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: linear-gradient(90deg, var(--primary), #0052a3);
    color: white;
    padding: 1rem 2rem;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 600;
    transition: transform 0.2s ease;
    align-self: flex-start;
}

.btn-primary:hover {
    transform: scale(1.05);
}

/* 4 & 6. Square Links (YouTube, Kakao) */
.icon-circle {
    width: 80px;
    height: 80px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    transition: transform 0.3s ease;
}

.youtube-card:hover .icon-circle {
    background: #FF0000;
    transform: scale(1.1) rotate(-10deg);
}

.kakao-card:hover .icon-circle {
    background: #FEE500;
    color: #000;
    transform: scale(1.1) rotate(10deg);
}

.mt-4 {
    margin-top: 1rem;
}

/* 5. Blog Card */
.blog-card {
    border: 1px solid rgba(255, 220, 0, 0.3);
}

.card-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.new-badge {
    background: var(--secondary);
    color: black;
    font-size: 0.75rem;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 4px;
}

.text-link {
    color: var(--secondary);
    text-decoration: none;
    font-weight: 600;
    margin-top: 1.5rem;
    display: inline-block;
    transition: transform 0.2s ease;
}

.text-link:hover {
    transform: translateX(5px);
}

/* Footer */
.footer {
    margin-top: auto;
    padding: 2rem;
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 1024px) {
    .container {
        grid-template-columns: repeat(2, 1fr);
        grid-auto-rows: minmax(350px, auto);
    }

    .wide {
        grid-column: span 2;
    }

    .square {
        grid-column: span 1;
    }

    .hero-title {
        font-size: 2.5rem;
    }
}

@media (max-width: 768px) {
    .container {
        grid-template-columns: 1fr;
        padding: 1rem;
    }

    .wide,
    .square {
        grid-column: span 1;
    }

    .hero-title {
        font-size: 2rem;
    }

    .card {
        padding: 1.5rem;
    }

    .stats {
        gap: 1.5rem;
    }

    .profile-img {
        width: 120px;
        height: 120px;
    }
}