* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #ff9ec7, #ffc9dd);
    min-height: 100vh;
}

.header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 2px solid #ff9ec7;
    box-shadow: 0 4px 20px rgba(255, 158, 199, 0.3);
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 20px 40px;
    max-width: 1200px;
    margin: 0 auto;
}

.logo {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 32px;
    font-weight: bold;
    color: #e91e63;
    text-decoration: none;
    transition: transform 0.3s ease;
}

.logo:hover {
    transform: scale(1.05);
}

.logo-text {
    font-size: 36px;
    font-weight: 900;
    background: linear-gradient(45deg, #e91e63, #ff5722);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 2px 2px 4px rgba(233, 30, 99, 0.3);
}

.gacha-machine {
    width: 60px;
    height: 80px;
    position: relative;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

.machine-top {
    width: 50px;
    height: 15px;
    background: linear-gradient(45deg, #1565c0, #0d47a1);
    border-radius: 10px 10px 5px 5px;
    border: 3px solid #0d47a1;
    position: relative;
}

.machine-top::before {
    content: '';
    position: absolute;
    top: 3px;
    left: 5px;
    width: 8px;
    height: 3px;
    background: #ffebee;
    border-radius: 2px;
}

.machine-top::after {
    content: '';
    position: absolute;
    top: 8px;
    left: 5px;
    width: 35px;
    height: 2px;
    background: #e53935;
}

.machine-body {
    width: 50px;
    height: 40px;
    background: linear-gradient(45deg, #4dd0e1, #26c6da);
    border: 3px solid #0d47a1;
    border-radius: 5px;
    position: relative;
    margin-top: -2px;
}

.machine-window {
    position: absolute;
    top: 5px;
    left: 8px;
    width: 30px;
    height: 25px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 3px;
    border: 2px solid #0d47a1;
}

.machine-ball {
    position: absolute;
    top: 8px;
    left: 12px;
    width: 15px;
    height: 15px;
    background: linear-gradient(45deg, #ffd54f, #ffb300);
    border-radius: 50%;
    border: 2px solid #0d47a1;
}

.machine-ball::after {
    content: '';
    position: absolute;
    top: 6px;
    left: 0;
    width: 100%;
    height: 1px;
    background: #e53935;
}

.machine-controls {
    width: 50px;
    height: 20px;
    background: linear-gradient(45deg, #e53935, #c62828);
    border: 3px solid #0d47a1;
    border-radius: 0 0 8px 8px;
    position: relative;
    margin-top: -2px;
}

.control-button {
    position: absolute;
    top: 3px;
    left: 8px;
    width: 12px;
    height: 12px;
    background: #ffebee;
    border-radius: 50%;
    border: 2px solid #0d47a1;
}

.control-knob {
    position: absolute;
    top: 5px;
    right: 8px;
    width: 8px;
    height: 8px;
    background: #90a4ae;
    border-radius: 50%;
    border: 2px solid #0d47a1;
}

.auth-buttons {
    display: flex;
    gap: 15px;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.btn-login {
    background: transparent;
    color: #e91e63;
    border: 2px solid #e91e63;
}

.btn-login:hover {
    background: #e91e63;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(233, 30, 99, 0.3);
}

.btn-signup {
    background: linear-gradient(45deg, #e91e63, #ff5722);
    color: white;
}

.btn-signup:hover {
    background: linear-gradient(45deg, #c2185b, #e64a19);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(233, 30, 99, 0.4);
}

.nav-menu {
    background: rgba(255, 255, 255, 0.9);
    border-top: 1px solid #ffcdd2;
    padding: 0 40px;
    max-width: 1200px;
    margin: 0 auto;
}

.nav-list {
    display: flex;
    list-style: none;
    gap: 40px;
    padding: 15px 0;
    justify-content: center;
}

.nav-item a {
    color: #e91e63;
    text-decoration: none;
    font-weight: 600;
    font-size: 16px;
    padding: 10px 15px;
    border-radius: 20px;
    transition: all 0.3s ease;
    position: relative;
}

.nav-item a::before {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    width: 0;
    height: 2px;
    background: linear-gradient(45deg, #e91e63, #ff5722);
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.nav-item a:hover {
    background: rgba(233, 30, 99, 0.1);
    color: #c2185b;
    transform: translateY(-2px);
}

.nav-item a:hover::before {
    width: 100%;
}

.nav-item a.active {
    background: rgba(233, 30, 99, 0.1);
    color: #c2185b;
}

.nav-item a.active::before {
    width: 100%;
}

.main-content {
    background: white;
    min-height: calc(100vh - 200px);
    padding: 40px;
    max-width: 1200px;
    margin: 0 auto;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.1);
}

.page-header {
    text-align: center;
    margin-bottom: 40px;
}

.page-title {
    font-size: 32px;
    font-weight: 900;
    color: #e91e63;
    margin-bottom: 10px;
    background: linear-gradient(45deg, #e91e63, #ff5722);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.page-subtitle {
    font-size: 16px;
    color: #666;
}

.category-tabs {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
    justify-content: center;
}

.tab-button {
    padding: 15px 30px;
    border: none;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #f5f5f5;
    color: #666;
    text-decoration: none;
    display: inline-block;
}

.tab-button.active {
    background: linear-gradient(45deg, #e91e63, #ff5722);
    color: white;
    box-shadow: 0 4px 15px rgba(233, 30, 99, 0.3);
}

.tab-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
}

.search-container {
    margin-bottom: 40px;
}

.search-box {
    position: relative;
    max-width: 500px;
    margin: 0 auto;
}

.search-input {
    width: 100%;
    padding: 15px 50px 15px 20px;
    border: 2px solid #e0e0e0;
    border-radius: 25px;
    font-size: 16px;
    outline: none;
    transition: all 0.3s ease;
}

.search-input:focus {
    border-color: #e91e63;
    box-shadow: 0 0 0 3px rgba(233, 30, 99, 0.1);
}

.search-button {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    background: linear-gradient(45deg, #e91e63, #ff5722);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: white;
    font-size: 18px;
}

.search-button:hover {
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 4px 15px rgba(233, 30, 99, 0.3);
}

.gacha-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 20px;
    margin-bottom: 40px;
}

.gacha-item {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    position: relative;
}

.gacha-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

/* 기존 .gacha-image 스타일 수정 */
.gacha-image {
    width: 100%;
    height: 150px; /* 고정 높이 유지 */
    background: linear-gradient(45deg, #ff9ec7, #ffc9dd);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: #666;
    overflow: hidden; /* 이미지가 넘치지 않도록 */
}

/* 이미지 스타일 수정 - 핵심 부분 */
.gacha-image img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* 이미지가 컨테이너에 맞게 크롭됨 */
    object-position: center; /* 이미지를 중앙에 배치 */
    border-radius: 0; /* 상위 컨테이너의 border-radius를 따름 */
    display: block; /* 인라인 요소의 기본 여백 제거 */
    max-width: 100%; /* 최대 너비 제한 */
    max-height: 100%; /* 최대 높이 제한 */
}

/* 가챠 아이템 전체 구조 확실히 하기 */
.gacha-item {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    position: relative;
    display: flex;
    flex-direction: column; /* 세로 배치 */
    height: auto; /* 자동 높이 */
}

/* 텍스트 영역이 이미지 아래에 확실히 오도록 */
.gacha-info {
    padding: 15px;
    background: white;
    position: relative;
    z-index: 1;
    flex-shrink: 0; /* 압축되지 않도록 */
    min-height: 60px; /* 최소 높이 보장 */
}

/* 하트 버튼 위치 조정 */
.heart-button {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #e91e63;
    z-index: 10; /* 이미지 위에 확실히 표시 */
}

/* 메달 위치도 조정 */
.medal {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    color: white;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    z-index: 10; /* 이미지 위에 확실히 표시 */
}

.medal.gold {
    background: linear-gradient(45deg, #ffd700, #ffb300);
    border: 2px solid #ff8f00;
    box-shadow: 0 2px 8px rgba(255, 215, 0, 0.4);
}

.medal.silver {
    background: linear-gradient(45deg, #c0c0c0, #9e9e9e);
    border: 2px solid #757575;
    box-shadow: 0 2px 8px rgba(192, 192, 192, 0.4);
}

.medal.bronze {
    background: linear-gradient(45deg, #cd7f32, #8d5524);
    border: 2px solid #5d4e37;
    box-shadow: 0 2px 8px rgba(205, 127, 50, 0.4);
}

.heart-button {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #e91e63;
    z-index: 3; /* 이미지 위에 표시되도록 */
}

.heart-button:hover {
    background: #e91e63;
    color: white;
    transform: scale(1.1);
}

.heart-button.liked {
    background: #e91e63;
    color: white;
}

.gacha-info {
    padding: 15px;
    background: white; /* 배경색 명시 */
    position: relative; /* z-index 적용을 위해 */
    z-index: 1;
}

.gacha-title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    line-height: 1.3;
}

.gacha-price {
    font-size: 16px;
    font-weight: 700;
    color: #e91e63;
}

.pagination {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 40px;
}

.page-button {
    width: 45px;
    height: 45px;
    border: 2px solid #e0e0e0;
    background: white;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    color: #666;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.page-button:hover {
    border-color: #e91e63;
    color: #e91e63;
    transform: translateY(-2px);
}

.page-button.active {
    background: linear-gradient(45deg, #e91e63, #ff5722);
    border-color: #e91e63;
    color: white;
    box-shadow: 0 4px 15px rgba(233, 30, 99, 0.3);
}
/* 모달 배경 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}
.modal-overlay.active {
    display: flex;
}

/* 모달 열릴 때 애니메이션 */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* 모달 박스 */
.modal {
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 400px;
    position: relative;
    animation: slideUp 0.3s ease;
}

/* 닫기 버튼 */
.modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    font-size: 24px;
    color: #999;
    cursor: pointer;
}
.modal-close:hover {
    color: #e91e63;
}

/* 제목 */
.modal-title {
    text-align: center;
    font-size: 28px;
    font-weight: 700;
    color: #e91e63;
    margin-bottom: 30px;
    background: linear-gradient(45deg, #e91e63, #ff5722);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* 입력 필드 */
.form-group {
    margin-bottom: 20px;
}
.form-input {
    width: 100%;
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 16px;
    background: #fafafa;
    transition: all 0.3s ease;
}
.form-input:focus {
    outline: none;
    border-color: #e91e63;
    background: white;
    box-shadow: 0 0 0 3px rgba(233, 30, 99, 0.1);
}

/* 제출 버튼 */
.form-btn {
    width: 100%;
    padding: 15px;
    background: linear-gradient(45deg, #e91e63, #ff5722);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    margin: 20px 0;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(233, 30, 99, 0.3);
}
.form-btn:hover {
    background: linear-gradient(45deg, #c2185b, #e64a19);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(233, 30, 99, 0.4);
}

/* 모달 배경 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}
.modal-overlay.active {
    display: flex;
}

/* 모달 열릴 때 애니메이션 */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* 모달 박스 */
.modal {
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 400px;
    position: relative;
    animation: slideUp 0.3s ease;
}

/* 닫기 버튼 */
.modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    font-size: 24px;
    color: #999;
    cursor: pointer;
}
.modal-close:hover {
    color: #e91e63;
}

/* 제목 */
.modal-title {
    text-align: center;
    font-size: 28px;
    font-weight: 700;
    color: #e91e63;
    margin-bottom: 30px;
    background: linear-gradient(45deg, #e91e63, #ff5722);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* 입력 필드 */
.form-group {
    margin-bottom: 20px;
}
.form-input {
    width: 100%;
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 16px;
    background: #fafafa;
    transition: all 0.3s ease;
}
.form-input:focus {
    outline: none;
    border-color: #e91e63;
    background: white;
    box-shadow: 0 0 0 3px rgba(233, 30, 99, 0.1);
}

/* 제출 버튼 */
.form-btn {
    width: 100%;
    padding: 15px;
    background: linear-gradient(45deg, #e91e63, #ff5722);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    margin: 20px 0;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(233, 30, 99, 0.3);
}
.form-btn:hover {
    background: linear-gradient(45deg, #c2185b, #e64a19);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(233, 30, 99, 0.4);
}
/* 폼 라벨 */
.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

/* 폼 링크들 (아이디 찾기, 비밀번호 재설정) */
.form-links {
    display: flex;
    justify-content: space-between;
    margin-top: 15px;
    gap: 10px;
}

.form-link {
    color: #e91e63;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: color 0.2s ease;
}

.form-link:hover {
    color: #c2185b;
    text-decoration: underline;
}

/* 회원가입/로그인 전환 링크 */
.switch-link {
    text-align: center;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

.switch-text {
    color: #666;
    font-size: 14px;
    margin-right: 8px;
}

.switch-btn {
    background: none;
    border: none;
    color: #e91e63;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: color 0.2s ease;
}

.switch-btn:hover {
    color: #c2185b;
    text-decoration: underline;
}

/* 중복확인 버튼 */
.btn-small {
    padding: 12px 16px;
    background: #f5f5f5;
    color: #333;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-small:hover {
    background: #e0e0e0;
    border-color: #d0d0d0;
}

/* 플렉스 레이아웃 (아이디, 닉네임 입력창과 확인 버튼) */
.form-group div[style*="display: flex"] {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.form-group div[style*="display: flex"] .form-input {
    flex: 1;
}

/* 작은 안내 텍스트 */
small {
    color: #888;
    display: block;
    margin-top: 5px;
    font-size: 12px;
    line-height: 1.4;
}

/* 결과 메시지 */
#find-id-result,
#reset-pw-result {
    margin-top: 15px;
    color: #e91e63;
    text-align: center;
    font-weight: 600;
    font-size: 14px;
    padding: 10px;
    border-radius: 8px;
    background: rgba(233, 30, 99, 0.1);
    display: none;
}

#find-id-result.show,
#reset-pw-result.show {
    display: block;
}

/* 비밀번호 재설정 추가 필드 */
#reset-extra-fields {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

/* 입력 필드 validation 상태 */
.form-input.error {
    border-color: #f44336;
    background: #fff5f5;
    box-shadow: 0 0 0 3px rgba(244, 67, 54, 0.1);
}

.form-input.success {
    border-color: #4caf50;
    background: #f5fff5;
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

/* 모바일 반응형 */
@media (max-width: 480px) {
    .modal {
        margin: 20px;
        padding: 30px 20px;
        max-width: calc(100% - 40px);
    }
    
    .modal-title {
        font-size: 24px;
        margin-bottom: 25px;
    }
    
    .form-links {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .form-group div[style*="display: flex"] {
        flex-direction: column;
        gap: 8px;
    }
    
    .btn-small {
        width: 100%;
    }
}

/* 접근성 개선 */
.form-input:focus,
.form-btn:focus,
.btn-small:focus,
.switch-btn:focus {
    outline: 2px solid #e91e63;
    outline-offset: 2px;
}

/* 로딩 상태 버튼 */
.form-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.form-btn:disabled:hover {
    transform: none;
    box-shadow: 0 4px 15px rgba(233, 30, 99, 0.3);
}

@media (max-width: 1024px) {
    .gacha-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 768px) {
    .top-bar {
        padding: 15px 20px;
        flex-direction: row;
        align-items: flex-start;
        gap: 10px;
    }

    .nav-menu {
        padding: 0 20px;
    }

    .nav-list {
        flex-wrap: wrap;
        gap: 20px;
        justify-content: center;
    }

    .main-content {
        padding: 20px;
        margin: 0 10px;
    }

    .logo-text {
        font-size: 28px;
    }

    .gacha-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    .category-tabs {
        flex-wrap: wrap;
        gap: 10px;
    }

    .tab-button {
        padding: 12px 20px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .gacha-grid {
        grid-template-columns: 1fr;
    }
}