/* 자미두수 테스트 공통 스타일 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans KR', sans-serif;
    background: linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%);
    min-height: 100vh;
    color: #e2e8f0;
    line-height: 1.6;
}

.container {
    max-width: 700px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
}

/* ========== 공통 헤더 ========== */
.header {
    text-align: center;
    padding: 40px 20px 30px;
}

.header-emoji {
    font-size: 3.5rem;
    margin-bottom: 16px;
    display: block;
}

.header-title {
    font-size: 2rem;
    font-weight: 700;
    color: #e2d9f3;
    margin-bottom: 10px;
    text-shadow: 0 0 20px rgba(167, 139, 250, 0.5);
}

.header-subtitle {
    font-size: 1rem;
    color: rgba(226, 232, 240, 0.75);
    font-weight: 300;
}

/* ========== 카드 기본 ========== */
.card {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    padding: 28px;
    margin-bottom: 20px;
    backdrop-filter: blur(10px);
}

/* ========== 입력 폼 ========== */
.form-card {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(167, 139, 250, 0.3);
    border-radius: 24px;
    padding: 32px;
    margin-bottom: 24px;
    backdrop-filter: blur(20px);
}

.form-group {
    margin-bottom: 24px;
}

.form-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: #c4b5fd;
    margin-bottom: 10px;
    letter-spacing: 0.5px;
}

.form-input {
    width: 100%;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.08);
    border: 1.5px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    color: #e2e8f0;
    font-size: 1rem;
    transition: all 0.3s ease;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.form-input:focus {
    border-color: #a78bfa;
    background: rgba(167, 139, 250, 0.1);
    box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.2);
}

.form-input::placeholder {
    color: rgba(226, 232, 240, 0.35);
}

.form-input option {
    background: #302b63;
    color: #e2e8f0;
}

/* 성별 선택 */
.gender-options {
    display: flex;
    gap: 12px;
}

.gender-btn {
    flex: 1;
    padding: 16px;
    background: rgba(255, 255, 255, 0.08);
    border: 1.5px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    color: #e2e8f0;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.gender-btn .gender-emoji {
    font-size: 2rem;
}

.gender-btn:hover {
    border-color: #a78bfa;
    background: rgba(167, 139, 250, 0.12);
}

.gender-btn.selected {
    border-color: #a78bfa;
    background: rgba(167, 139, 250, 0.2);
    color: #c4b5fd;
    box-shadow: 0 0 0 2px rgba(167, 139, 250, 0.3);
}

/* 에러 메시지 */
.form-error {
    color: #fc8181;
    font-size: 0.8rem;
    margin-top: 6px;
    min-height: 18px;
}

/* 제출 버튼 */
.submit-btn {
    width: 100%;
    padding: 18px;
    background: linear-gradient(135deg, #7c3aed 0%, #5b21b6 100%);
    color: white;
    border: none;
    border-radius: 14px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 8px;
    letter-spacing: 0.3px;
}

.submit-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(124, 58, 237, 0.5);
}

.submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ========== 로딩 상태 ========== */
.loading-state {
    text-align: center;
    padding: 60px 20px;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(167, 139, 250, 0.2);
    border-top-color: #a78bfa;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

.loading-text {
    color: #c4b5fd;
    font-size: 1rem;
}

/* ========== 결과 페이지 ========== */

/* 기본 정보 배지 */
.info-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(167, 139, 250, 0.15);
    border: 1px solid rgba(167, 139, 250, 0.3);
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 0.82rem;
    color: #c4b5fd;
    margin: 4px;
}

.info-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    margin-bottom: 8px;
}

/* 생시 미확인 배지 */
.unknown-time-badge {
    background: rgba(251, 191, 36, 0.15);
    border: 1px solid rgba(251, 191, 36, 0.4);
    border-radius: 12px;
    padding: 10px 16px;
    font-size: 0.85rem;
    color: #fcd34d;
    text-align: center;
    margin-bottom: 20px;
}

/* 12궁 명반 격자 */
.palace-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(4, auto);
    gap: 4px;
    margin-bottom: 24px;
}

.palace-cell {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    padding: 10px 8px;
    min-height: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    transition: all 0.3s ease;
}

.palace-cell.center-cell {
    background: transparent;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.palace-cell.soul-palace {
    background: rgba(167, 139, 250, 0.2);
    border-color: rgba(167, 139, 250, 0.5);
    box-shadow: 0 0 12px rgba(167, 139, 250, 0.3);
}

.palace-name {
    font-size: 0.7rem;
    color: #94a3b8;
    margin-bottom: 4px;
}

.palace-stem-branch {
    font-size: 0.65rem;
    color: #64748b;
    margin-bottom: 4px;
}

.palace-stars {
    font-size: 0.78rem;
    color: #e2e8f0;
    font-weight: 600;
    line-height: 1.4;
}

.palace-cell.soul-palace .palace-name {
    color: #c4b5fd;
}

.palace-cell.soul-palace .palace-stars {
    color: #e9d5ff;
}

.center-label {
    font-size: 0.9rem;
    color: rgba(196, 181, 253, 0.6);
    text-align: center;
    line-height: 1.6;
}

/* 공궁 표시 */
.empty-palace {
    font-size: 0.7rem;
    color: #475569;
    font-style: italic;
}

/* 명궁 주성 해석 카드 */
.star-card {
    border-radius: 24px;
    padding: 32px;
    margin-bottom: 20px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.star-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.05) 0%, transparent 60%);
    pointer-events: none;
}

.star-emoji {
    font-size: 3.5rem;
    display: block;
    margin-bottom: 16px;
}

.star-alias {
    font-size: 1rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 8px;
}

.star-name {
    font-size: 2rem;
    font-weight: 700;
    color: white;
    margin-bottom: 16px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.star-description {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.6;
    margin-bottom: 24px;
}

.traits-list {
    list-style: none;
    text-align: left;
    margin-bottom: 20px;
}

.traits-list li {
    padding: 8px 0;
    font-size: 0.92rem;
    color: rgba(255, 255, 255, 0.85);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.traits-list li::before {
    content: '✦';
    color: rgba(255, 255, 255, 0.5);
    flex-shrink: 0;
    margin-top: 1px;
}

.traits-list li:last-child {
    border-bottom: none;
}

.love-career-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.mini-card {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    padding: 16px;
    text-align: left;
}

.mini-card-title {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 8px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mini-card-text {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.5;
}

/* 대궁 차용 안내 */
.borrowed-badge {
    display: inline-block;
    background: rgba(251, 191, 36, 0.2);
    border: 1px solid rgba(251, 191, 36, 0.4);
    border-radius: 8px;
    padding: 6px 14px;
    font-size: 0.8rem;
    color: #fcd34d;
    margin-bottom: 16px;
}

/* 공유 버튼 영역 */
.share-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
}

.share-btn {
    padding: 15px;
    border-radius: 14px;
    border: none;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.share-btn:hover {
    transform: translateY(-2px);
}

.kakao-btn {
    background: #fee500;
    color: #3a1d1d;
}

.kakao-btn:hover {
    box-shadow: 0 6px 20px rgba(254, 229, 0, 0.4);
}

.copy-btn {
    background: rgba(255, 255, 255, 0.12);
    color: #e2e8f0;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.copy-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.image-share-btn {
    width: 100%;
    background: linear-gradient(135deg, rgba(167, 139, 250, 0.2) 0%, rgba(124, 58, 237, 0.2) 100%);
    color: #c4b5fd;
    border: 1px solid rgba(167, 139, 250, 0.4);
    margin-bottom: 12px;
}

.image-share-btn:hover {
    background: linear-gradient(135deg, rgba(167, 139, 250, 0.3) 0%, rgba(124, 58, 237, 0.3) 100%);
    box-shadow: 0 6px 20px rgba(167, 139, 250, 0.25);
}

/* 이미지 미리보기 모달 */
.image-preview-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

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

.image-preview-modal {
    max-width: 400px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.image-preview-modal img {
    width: 100%;
    max-height: 70vh;
    object-fit: contain;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.image-preview-actions {
    display: flex;
    gap: 10px;
    width: 100%;
}

.image-preview-actions button {
    flex: 1;
    padding: 12px;
    border-radius: 12px;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.preview-save-btn {
    background: linear-gradient(135deg, #7c3aed, #a78bfa);
    color: white;
}

.preview-save-btn:hover {
    box-shadow: 0 4px 16px rgba(124, 58, 237, 0.4);
}

.preview-share-btn {
    background: linear-gradient(135deg, #2563eb, #60a5fa);
    color: white;
}

.preview-share-btn:hover {
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.4);
}

.preview-close-btn {
    background: rgba(255, 255, 255, 0.12);
    color: #e2e8f0;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
}

.preview-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.retry-btn {
    width: 100%;
    padding: 14px;
    background: transparent;
    color: rgba(226, 232, 240, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 14px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 20px;
}

.retry-btn:hover {
    color: #e2e8f0;
    border-color: rgba(255, 255, 255, 0.3);
}

/* 면책 문구 */
.disclaimer {
    text-align: center;
    color: rgba(226, 232, 240, 0.4);
    font-size: 0.78rem;
    padding: 20px;
    line-height: 1.6;
}

/* ========== 강점 & 약점 ========== */
.sw-card {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 20px;
    padding: 24px;
    margin-bottom: 20px;
}

.sw-section {
    padding: 8px 0;
}

.sw-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: #c4b5fd;
    margin-bottom: 14px;
    letter-spacing: 0.5px;
}

.sw-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sw-list li {
    font-size: 0.9rem;
    color: #e2e8f0;
    line-height: 1.5;
    padding: 10px 14px;
    border-radius: 10px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.strengths-list li {
    background: rgba(74, 222, 128, 0.08);
    border: 1px solid rgba(74, 222, 128, 0.2);
}

.strengths-list li::before {
    content: '💪';
    flex-shrink: 0;
    font-size: 0.95rem;
}

.weaknesses-list li {
    background: rgba(251, 191, 36, 0.08);
    border: 1px solid rgba(251, 191, 36, 0.2);
}

.weaknesses-list li::before {
    content: '🌱';
    flex-shrink: 0;
    font-size: 0.95rem;
}

.sw-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 20px 0;
}

/* ========== 궁합 주성 ========== */
.section-container {
    margin-bottom: 20px;
}

.section-label {
    font-size: 0.88rem;
    font-weight: 700;
    color: #c4b5fd;
    letter-spacing: 0.5px;
    margin-bottom: 14px;
    padding: 0 4px;
}

.compat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.compat-card {
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 16px;
    padding: 18px 16px;
    text-align: center;
    transition: all 0.3s ease;
}

.compat-card:hover {
    background: rgba(167, 139, 250, 0.1);
    border-color: rgba(167, 139, 250, 0.3);
}

.compat-emoji {
    font-size: 2rem;
    margin-bottom: 8px;
}

.compat-star {
    font-size: 1.1rem;
    font-weight: 700;
    color: #e2e8f0;
    margin-bottom: 2px;
}

.compat-alias {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-bottom: 10px;
}

.compat-reason {
    font-size: 0.8rem;
    color: rgba(226, 232, 240, 0.75);
    line-height: 1.5;
    text-align: left;
}

/* ========== 이달의 운세 ========== */
.fortune-card {
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.2) 0%, rgba(30, 64, 175, 0.2) 100%);
    border: 1px solid rgba(167, 139, 250, 0.3);
    border-radius: 20px;
    padding: 24px 28px;
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
}

.fortune-card::before {
    content: '🔮';
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 3rem;
    opacity: 0.15;
}

.fortune-month {
    font-size: 0.82rem;
    font-weight: 700;
    color: #a78bfa;
    letter-spacing: 1px;
    margin-bottom: 10px;
    text-transform: uppercase;
}

.fortune-message {
    font-size: 1rem;
    color: #e2e8f0;
    line-height: 1.7;
    font-weight: 400;
}

/* ========== 공유 페이지 ========== */
.share-result-card {
    border-radius: 24px;
    padding: 40px 32px;
    text-align: center;
    margin-bottom: 24px;
}

.share-friend-name {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 8px;
}

.share-result-label {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.65);
    margin-bottom: 6px;
}

.share-star-name {
    font-size: 2.2rem;
    font-weight: 700;
    color: white;
    margin-bottom: 8px;
}

.share-alias {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 20px;
}

.share-desc {
    font-size: 0.92rem;
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.6;
}

.cta-btn {
    width: 100%;
    padding: 18px;
    background: linear-gradient(135deg, #7c3aed 0%, #5b21b6 100%);
    color: white;
    border: none;
    border-radius: 14px;
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 12px;
}

.cta-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(124, 58, 237, 0.5);
}

/* ========== 토스트 메시지 ========== */
.toast {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(124, 58, 237, 0.95);
    color: white;
    padding: 12px 24px;
    border-radius: 10px;
    z-index: 9999;
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: 0 4px 20px rgba(124, 58, 237, 0.4);
    animation: toastIn 0.3s ease;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(-50%) translateY(-10px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ========== 반응형 ========== */
@media (max-width: 480px) {
    .header-title {
        font-size: 1.6rem;
    }

    .form-card {
        padding: 24px 20px;
    }

    .palace-cell {
        min-height: 65px;
        padding: 8px 4px;
    }

    .palace-stars {
        font-size: 0.68rem;
    }

    .palace-name {
        font-size: 0.6rem;
    }

    .star-card {
        padding: 24px 20px;
    }

    .love-career-grid {
        grid-template-columns: 1fr;
    }

    .share-section {
        grid-template-columns: 1fr;
    }
}
