/* ═══════════════════════════════════════════════════════════
   천문서재 — 내 사주 보기 전용 스타일 (별·달 컨셉)
   짙은 남색 + 은색 + 골드 포인트
   ═══════════════════════════════════════════════════════════ */

:root {
    --saju-deep-navy:   #0a1228;
    --saju-mid-navy:    #1a2444;
    --saju-soft-navy:   #2a3458;
    --saju-silver:      #d8dde8;
    --saju-dim-silver:  #8b94a8;
    --saju-gold:        #d4af37;
    --saju-gold-soft:   #f4d27a;
    --saju-star:        #ffffff;
    --saju-line:        rgba(216, 221, 232, 0.18);
    --saju-glow:        rgba(212, 175, 55, 0.35);
}

/* ───── 전체 래퍼 ─────
   기본은 투명, 입력 화면일 때만 네이비 박스 표시 */
.saju-screen-wrap {
    position: relative;
    width: 100%;
    min-height: 80vh;
    border-radius: 24px;
    overflow: hidden;
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 40px 24px;
    transition: background 0.3s ease, border-color 0.3s ease;
}
.saju-screen-wrap:has(#sajuInputScreen.active) {
    background:
        radial-gradient(ellipse at 50% 0%, rgba(58, 74, 122, 0.35) 0%, transparent 60%),
        radial-gradient(ellipse at 50% 100%, rgba(26, 36, 68, 0.6) 0%, transparent 70%),
        linear-gradient(180deg, #0a1228 0%, #050914 100%);
    border: 1px solid var(--saju-line);
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.5),
        inset 0 0 80px rgba(212, 175, 55, 0.04);
}
/* 환영 화면일 때 별/별자리 숨김 */
.saju-screen-wrap:has(#sajuWelcomeScreen.active) .saju-stars,
.saju-screen-wrap:has(#sajuWelcomeScreen.active) .saju-constellation {
    display: none !important;
}

/* ───── 별 배경 (반짝임) ───── */
.saju-stars {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
}
.saju-stars .star {
    position: absolute;
    width: 2px; height: 2px;
    background: var(--saju-star);
    border-radius: 50%;
    box-shadow: 0 0 4px rgba(255,255,255,0.8);
    animation: starTwinkle 3s ease-in-out infinite;
}
.saju-stars .s1  { top: 8%;  left: 12%; animation-delay: 0s; }
.saju-stars .s2  { top: 15%; left: 78%; animation-delay: .4s; width:3px;height:3px; }
.saju-stars .s3  { top: 22%; left: 45%; animation-delay: .8s; }
.saju-stars .s4  { top: 30%; left: 88%; animation-delay: 1.2s; }
.saju-stars .s5  { top: 38%; left: 8%;  animation-delay: 1.6s; width:3px;height:3px; }
.saju-stars .s6  { top: 45%; left: 65%; animation-delay: 2s; }
.saju-stars .s7  { top: 55%; left: 22%; animation-delay: .2s; }
.saju-stars .s8  { top: 62%; left: 92%; animation-delay: .6s; }
.saju-stars .s9  { top: 70%; left: 38%; animation-delay: 1s; width:3px;height:3px; }
.saju-stars .s10 { top: 78%; left: 70%; animation-delay: 1.4s; }
.saju-stars .s11 { top: 85%; left: 15%; animation-delay: 1.8s; }
.saju-stars .s12 { top: 92%; left: 55%; animation-delay: 2.2s; }
@keyframes starTwinkle {
    0%, 100% { opacity: 0.3; transform: scale(0.8); }
    50%      { opacity: 1;   transform: scale(1.2); }
}

/* ───── 별자리 SVG ───── */
.saju-constellation {
    position: absolute;
    top: 8%;
    left: 50%;
    transform: translateX(-50%);
    width: 70%;
    max-width: 480px;
    height: 200px;
    pointer-events: none;
    z-index: 1;
    opacity: 0.45;
}
.saju-constellation line {
    stroke: var(--saju-gold-soft);
    stroke-width: 0.6;
    opacity: 0.5;
}
.saju-constellation circle {
    fill: var(--saju-gold-soft);
    opacity: 0.85;
}

/* ───── 화면 전환 (환영 ↔ 입력) ───── */
.saju-screen {
    display: none;
    position: relative;
    z-index: 2;
    width: 100%;
    animation: screenFade 0.5s ease-out;
    border: none;
    box-shadow: none;
}
.saju-screen.active {
    display: block;
}
@keyframes screenFade {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ═══════════════════════════════════════════════════════════
   1단계: 환영 화면 (도사 일러스트 + 우하단 네모 버튼)
   ═══════════════════════════════════════════════════════════ */

#sajuWelcomeScreen {
    text-align: center;
    padding: 20px 0;
    min-height: auto;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    outline: none !important;
}
#sajuWelcomeScreen.active {
    display: flex;
}

.saju-welcome-layout {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

/* ───── 도사 일러스트 컨테이너 ───── */
.saju-welcome-image {
    position: relative;          /* 우하단 버튼 절대배치 기준 */
    display: inline-block;
    max-width: 500px;
    width: 100%;
    margin: 0 auto;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    overflow: visible !important;
}

/* ───── 도사 이미지 — 흰 배경을 어두운 배경에 녹이기 ───── */
.dosa-illustration {
    display: block;
    width: 100%;
    height: auto;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: transparent !important;
    /* 핵심: 검정/짙은 네이비 배경에서 흰 배경이 자연스럽게 사라짐 */
    mix-blend-mode: screen;
    filter:
        drop-shadow(0 14px 32px rgba(0, 0, 0, 0.6))
        drop-shadow(0 0 24px rgba(212, 175, 55, 0.18));
    transition: transform 0.4s ease, filter 0.4s ease;
}
.dosa-illustration:hover {
    transform: translateY(-3px) scale(1.01);
    filter:
        drop-shadow(0 18px 42px rgba(0, 0, 0, 0.7))
        drop-shadow(0 0 32px rgba(212, 175, 55, 0.28));
}

/* ───── 도사 이미지 우하단 네모 버튼 ───── */
.dosa-corner-btn {
    position: absolute;
    right: 16px;
    bottom: 16px;
    width: 100px;
    height: 100px;
    padding: 0;
    border-radius: 10px;
    background: linear-gradient(135deg, #d4af37 0%, #b8902a 60%, #8a6d20 100%);
    color: #fffdf6;
    font-family: 'Noto Serif KR', serif;
    font-size: 14px;
    font-weight: 800;
    line-height: 1.4;
    letter-spacing: 0.05em;
    border: 1.5px solid rgba(255, 253, 246, 0.45);
    box-shadow:
        0 8px 22px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(212, 175, 55, 0.3),
        inset 0 0 0 1px rgba(255, 255, 255, 0.18);
    cursor: pointer;
    transition: transform .25s ease, box-shadow .25s ease, filter .25s ease;
    z-index: 5;
    /* 블렌드 모드 영향 안 받도록 격리 */
    isolation: isolate;
    mix-blend-mode: normal;
}
.dosa-corner-btn:hover {
    transform: translateY(-2px) scale(1.04);
    filter: brightness(1.08);
    box-shadow:
        0 12px 28px rgba(0, 0, 0, 0.6),
        0 0 0 1px rgba(212, 175, 55, 0.55),
        inset 0 0 0 1px rgba(255, 255, 255, 0.28);
}
.dosa-corner-btn:active {
    transform: translateY(0) scale(0.98);
}

/* ───── (구) 캐릭터/말풍선/시작버튼 — 환영 화면에서 강제 숨김 ───── */
#sajuWelcomeScreen .saju-character,
#sajuWelcomeScreen .saju-bubble,
#sajuWelcomeScreen .saju-start-area,
#sajuWelcomeScreen .saju-start-btn,
#sajuWelcomeScreen .saju-subtext,
.saju-screen-wrap:has(#sajuWelcomeScreen.active) .saju-start-area,
.saju-screen-wrap:has(#sajuWelcomeScreen.active) .saju-start-btn,
.saju-screen-wrap:has(#sajuWelcomeScreen.active) .saju-subtext {
    display: none !important;
}

/* ───── 입력 화면용 작은 아바타 (보존) ───── */
.saju-character-small {
    width: 90px;
    height: 126px;
    margin: 0 auto 16px;
    position: relative;
}
.saju-character-small .character-svg {
    position: relative;
    width: 100%;
    height: 100%;
    z-index: 2;
    filter: drop-shadow(0 8px 20px rgba(0,0,0,0.6));
}
.saju-character-small .character-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 110px;
    height: 110px;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, var(--saju-glow) 0%, transparent 65%);
    border-radius: 50%;
    z-index: 1;
    animation: glowPulse 4s ease-in-out infinite;
}
@keyframes glowPulse {
    0%, 100% { opacity: 0.6; transform: translate(-50%, -50%) scale(1); }
    50%      { opacity: 1;   transform: translate(-50%, -50%) scale(1.08); }
}

/* ───── (구) 말풍선 / 시작버튼 스타일 — 다른 곳에서 쓸 수 있어 정의는 유지 ───── */
.saju-bubble {
    position: relative;
    display: inline-block;
    max-width: 420px;
    margin: 0 auto;
    padding: 20px 28px;
    background: linear-gradient(135deg, var(--saju-mid-navy) 0%, var(--saju-deep-navy) 100%);
    border: 1.5px solid var(--saju-gold);
    border-radius: 18px;
    box-shadow:
        0 8px 24px rgba(0,0,0,0.5),
        inset 0 1px 0 rgba(255,255,255,0.05);
}
.saju-bubble .bubble-line {
    color: var(--saju-silver);
    font-size: 15px;
    font-weight: 500;
    line-height: 1.7;
    margin: 0;
    letter-spacing: 0.02em;
}
.saju-bubble .bubble-line + .bubble-line { margin-top: 4px; }
.saju-bubble .bubble-gold {
    color: var(--saju-gold-soft);
    font-weight: 700;
}
.saju-bubble .bubble-tail {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%) rotate(45deg);
    width: 18px;
    height: 18px;
    background: linear-gradient(135deg, var(--saju-mid-navy) 0%, var(--saju-mid-navy) 50%, transparent 50%);
    border-top: 1.5px solid var(--saju-gold);
    border-left: 1.5px solid var(--saju-gold);
}

.saju-start-area { margin-top: 8px; }
.saju-start-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 16px 44px;
    background: linear-gradient(135deg, var(--saju-gold) 0%, #b8902a 100%);
    color: #1a1410;
    font-size: 16px;
    font-weight: 800;
    letter-spacing: 0.15em;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    box-shadow:
        0 8px 24px rgba(212, 175, 55, 0.4),
        inset 0 1px 0 rgba(255,255,255,0.3);
    transition: all 0.25s ease;
}
.saju-start-btn:hover {
    transform: translateY(-2px);
    box-shadow:
        0 12px 32px rgba(212, 175, 55, 0.55),
        inset 0 1px 0 rgba(255,255,255,0.4);
}
.saju-start-btn:active { transform: translateY(0); }
.saju-subtext {
    margin-top: 14px;
    font-size: 10px;
    letter-spacing: 0.4em;
    text-transform: uppercase;
    color: var(--saju-dim-silver);
    font-weight: 700;
}

/* ═══════════════════════════════════════════════════════════
   2단계: 입력 화면
   ═══════════════════════════════════════════════════════════ */

.saju-title-gold {
    color: var(--saju-gold-soft);
    text-shadow: 0 2px 12px rgba(212, 175, 55, 0.3);
    letter-spacing: 0.05em;
}
.saju-soft-text {
    color: var(--saju-dim-silver);
}

.saju-input-card {
    background: rgba(10, 18, 40, 0.55);
    border: 1px solid var(--saju-line);
    border-radius: 16px;
    padding: 32px 26px 28px;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    box-shadow: 0 12px 32px rgba(0,0,0,0.4);
}

.saju-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: var(--saju-dim-silver);
    margin-bottom: 6px;
    text-transform: none;
}

.saju-line-input {
    width: 100%;
    padding: 8px 4px 10px;
    background: transparent;
    border: none;
    border-bottom: 1.5px solid var(--saju-line);
    border-radius: 0;
    color: var(--saju-silver);
    font-size: 15px;
    font-weight: 500;
    letter-spacing: 0.02em;
    outline: none;
    transition: border-color 0.2s ease, color 0.2s ease;
    -webkit-appearance: none;
    appearance: none;
}
.saju-line-input::placeholder { color: rgba(139, 148, 168, 0.5); }
.saju-line-input:focus {
    border-bottom-color: var(--saju-gold);
    color: var(--saju-gold-soft);
}
.saju-line-input:disabled { opacity: 0.4; cursor: not-allowed; }
.saju-line-input[id="sajuGender"],
.saju-line-input[id="sajuType"],
select.saju-line-input {
    background-image:
        linear-gradient(45deg, transparent 50%, var(--saju-dim-silver) 50%),
        linear-gradient(135deg, var(--saju-dim-silver) 50%, transparent 50%);
    background-position:
        calc(100% - 14px) 50%,
        calc(100% - 9px) 50%;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
    padding-right: 24px;
    cursor: pointer;
}
select.saju-line-input option {
    background: var(--saju-deep-navy);
    color: var(--saju-silver);
}
.saju-line-input[type="number"]::-webkit-inner-spin-button,
.saju-line-input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.saju-line-input[type="number"] { -moz-appearance: textfield; }
#sajuTimeUnknown { accent-color: var(--saju-gold); }

.saju-back-btn {
    flex: 0 0 auto;
    padding: 14px 24px;
    background: transparent;
    border: 1px solid var(--saju-line);
    border-radius: 50px;
    color: var(--saju-dim-silver);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: all 0.2s ease;
}
.saju-back-btn:hover {
    border-color: var(--saju-silver);
    color: var(--saju-silver);
}

.saju-submit-btn {
    flex: 1;
    padding: 14px 24px;
    background: linear-gradient(135deg, var(--saju-gold) 0%, #b8902a 100%);
    border: none;
    border-radius: 50px;
    color: #1a1410;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 0.15em;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(212, 175, 55, 0.35);
    transition: all 0.2s ease;
}
.saju-submit-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 24px rgba(212, 175, 55, 0.5);
}

.saju-consult-btn {
    display: inline-flex;
    align-items: center;
    padding: 12px 28px;
    background: transparent;
    border: 1px solid var(--saju-gold);
    border-radius: 50px;
    color: var(--saju-gold-soft);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.08em;
    cursor: pointer;
    transition: all 0.2s ease;
}
.saju-consult-btn:hover {
    background: var(--saju-gold);
    color: #1a1410;
}

/* ═══════════════════════════════════════════════════════════
   청월당 스타일 입력 폼 (.cwd-*)
   ═══════════════════════════════════════════════════════════ */

.cwd-field {
    position: relative;
    margin-bottom: 26px;
}
.cwd-field-no-line { margin-bottom: 32px; }

.cwd-label {
    display: block;
    font-size: 14px;
    font-weight: 700;
    color: var(--saju-silver);
    margin-bottom: 10px;
    letter-spacing: 0.02em;
}
.cwd-label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.cwd-label-row .cwd-label { margin-bottom: 0; }

.cwd-input {
    width: 100%;
    padding: 8px 0 12px;
    background: transparent;
    border: none;
    color: var(--saju-silver);
    font-size: 16px;
    font-weight: 500;
    letter-spacing: 0.02em;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}
.cwd-input::placeholder {
    color: rgba(139, 148, 168, 0.55);
    font-weight: 400;
}
.cwd-input:focus { color: var(--saju-gold-soft); }
.cwd-input:disabled { opacity: 0.4; cursor: not-allowed; }

.cwd-line {
    height: 1px;
    background: rgba(216, 221, 232, 0.25);
    transition: background 0.2s ease;
}
.cwd-field:focus-within .cwd-line { background: var(--saju-gold); }

.cwd-radio-group {
    display: flex;
    gap: 14px;
}
.cwd-radio {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    user-select: none;
}
.cwd-radio input { display: none; }
.cwd-radio-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 1.5px solid var(--saju-dim-silver);
    position: relative;
    transition: all 0.2s ease;
    flex-shrink: 0;
    background: transparent;
}
.cwd-radio input:checked + .cwd-radio-dot {
    border-color: var(--saju-gold);
    background: var(--saju-gold);
    box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.2);
}
.cwd-radio input:checked + .cwd-radio-dot::after {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%) rotate(45deg);
    width: 4px; height: 8px;
    border-right: 2px solid #1a1410;
    border-bottom: 2px solid #1a1410;
    margin-top: -1px;
}
.cwd-radio-text {
    font-size: 13px;
    font-weight: 600;
    color: var(--saju-silver);
}

.cwd-select-wrap { position: relative; }
.cwd-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    cursor: pointer;
    padding-right: 28px;
    background: transparent;
}
.cwd-select::-ms-expand { display: none; }
.cwd-select option {
    background: var(--saju-deep-navy);
    color: var(--saju-silver);
}
.cwd-select-arrow {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-30%);
    color: var(--saju-dim-silver);
    font-size: 12px;
    pointer-events: none;
    transition: color 0.2s ease;
}
.cwd-field:focus-within .cwd-select-arrow { color: var(--saju-gold); }

.cwd-gender-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.cwd-gender-btn {
    padding: 14px 0;
    background: transparent;
    border: 1.5px solid rgba(216, 221, 232, 0.3);
    border-radius: 8px;
    color: var(--saju-silver);
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: all 0.2s ease;
}
.cwd-gender-btn:hover { border-color: var(--saju-silver); }
.cwd-gender-btn.active {
    border-color: var(--saju-gold);
    color: var(--saju-gold-soft);
    background: rgba(212, 175, 55, 0.08);
    box-shadow: 0 0 0 1px var(--saju-gold) inset;
}

.cwd-btn-row {
    display: grid;
    grid-template-columns: 90px 1fr;
    gap: 12px;
    margin-top: 8px;
}
.cwd-btn-prev {
    padding: 14px 0;
    background: transparent;
    border: 1.5px solid rgba(216, 221, 232, 0.3);
    border-radius: 10px;
    color: var(--saju-silver);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}
.cwd-btn-prev:hover { border-color: var(--saju-silver); }
.cwd-btn-submit {
    padding: 14px 0;
    background: linear-gradient(135deg, #f4d27a 0%, #c9a85a 100%);
    border: none;
    border-radius: 10px;
    color: #1a1410;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: 0.05em;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(212, 175, 55, 0.35);
    transition: all 0.2s ease;
}
.cwd-btn-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 24px rgba(212, 175, 55, 0.5);
}
.cwd-btn-submit:active { transform: translateY(0); }

/* ═══════════════════════════════════════════════════════════
   반응형 (태블릿 / 모바일)
   ═══════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
    .saju-screen-wrap {
        padding: 28px 14px;
        border-radius: 18px;
        min-height: 75vh;
    }
    .saju-welcome-image { max-width: 92%; }
    .dosa-corner-btn {
        width: 86px;
        height: 86px;
        font-size: 13px;
        right: 12px;
        bottom: 12px;
    }
    .saju-bubble {
        max-width: 92%;
        padding: 16px 20px;
    }
    .saju-bubble .bubble-line { font-size: 14px; }
    .saju-start-btn {
        padding: 14px 32px;
        font-size: 14px;
    }
    .saju-input-card { padding: 24px 18px 22px; }
    .saju-character-small {
        width: 70px;
        height: 98px;
    }
    .saju-character-small .character-glow {
        width: 90px;
        height: 90px;
    }
    .saju-constellation {
        height: 150px;
        opacity: 0.3;
    }
    .cwd-label { font-size: 13px; }
    .cwd-input { font-size: 15px; }
    .cwd-radio-text { font-size: 12px; }
    .cwd-gender-btn { font-size: 14px; padding: 12px 0; }
}

@media (max-width: 480px) {
    .dosa-corner-btn {
        width: 76px;
        height: 76px;
        font-size: 12px;
        right: 8px;
        bottom: 8px;
        line-height: 1.35;
    }
    .saju-bubble .bubble-line { font-size: 13px; }
    .saju-line-input { font-size: 14px; }
}

/* ═══════════════════════════════════════════════════════════
   AI 리포트 전체 화면 모달 (천문서재 톤 — 골드 + 다크 네이비)
   ═══════════════════════════════════════════════════════════ */

.ai-report-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}
.ai-report-modal.open {
    opacity: 1;
    pointer-events: auto;
}

.ai-report-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(5, 9, 20, 0.78);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.ai-report-panel {
    position: relative;
    width: 100%;
    max-width: 880px;
    height: 90vh;
    max-height: 90vh;
    background: #fffdf6;
    border-radius: 18px;
    border: 1.5px solid var(--saju-gold, #d4af37);
    box-shadow:
        0 30px 80px rgba(0, 0, 0, 0.65),
        0 0 0 1px rgba(212, 175, 55, 0.25),
        inset 0 0 60px rgba(212, 175, 55, 0.04);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(24px) scale(0.98);
    transition: transform 0.3s cubic-bezier(0.2, 0.9, 0.3, 1);
}
.ai-report-modal.open .ai-report-panel {
    transform: translateY(0) scale(1);
}

.ai-report-header {
    flex: 0 0 auto;
    background: linear-gradient(135deg, #d4af37 0%, #b8902a 60%, #8a6d20 100%);
    color: #fffdf6;
    padding: 16px 22px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(0, 0, 0, 0.15);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}
.ai-report-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    font-size: 15px;
    letter-spacing: 0.12em;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}
.ai-report-title i {
    font-size: 16px;
    opacity: 0.95;
}
.ai-report-actions {
    display: flex;
    gap: 8px;
}
.ai-report-btn-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    color: #fffdf6;
    border: 1px solid rgba(255, 255, 255, 0.25);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.ai-report-btn-icon:hover {
    background: rgba(255, 255, 255, 0.32);
    transform: scale(1.05);
}
.ai-report-btn-icon:active { transform: scale(0.95); }

.ai-report-body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 36px 44px;
    font-size: 14px;
    line-height: 2;
    color: #2d2418;
    background: linear-gradient(180deg, #fffdf6 0%, #fff9ec 100%);
    letter-spacing: 0.01em;
    word-break: keep-all;
}
.ai-report-body::-webkit-scrollbar { width: 10px; }
.ai-report-body::-webkit-scrollbar-track {
    background: #fff5dc;
    border-radius: 5px;
}
.ai-report-body::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #d4af37, #a87f2a);
    border-radius: 5px;
    border: 2px solid #fff5dc;
}
.ai-report-body::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #b8902a, #8a6d20);
}
.ai-report-body h2,
.ai-report-body h3,
.ai-report-body h4 { word-break: keep-all; }
.ai-report-body p { margin-bottom: 14px; }
.ai-report-body strong { color: #6b4a0e; }

.ai-report-footer {
    flex: 0 0 auto;
    padding: 14px 22px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 14px;
    border-top: 1px solid #f0e5cc;
    background: #fffaf0;
}
.ai-report-btn-text {
    background: transparent;
    border: none;
    color: #888;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    padding: 8px 16px;
    border-radius: 999px;
    transition: all 0.2s ease;
    letter-spacing: 0.05em;
}
.ai-report-btn-text:hover {
    color: #b8902a;
    background: rgba(212, 175, 55, 0.08);
}
.ai-report-btn-bottom {
    padding: 9px 32px;
    background: #4a4540;
    color: #fff;
    border: none;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
    letter-spacing: 0.12em;
    transition: all 0.2s ease;
}
.ai-report-btn-bottom:hover {
    background: #2d2418;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}
.ai-report-btn-bottom:active { transform: translateY(0); }

@media (max-width: 640px) {
    .ai-report-modal { padding: 0; }
    .ai-report-panel {
        width: 100vw;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
        border: none;
    }
    .ai-report-header { padding: 14px 16px; }
    .ai-report-title { font-size: 13px; letter-spacing: 0.08em; }
    .ai-report-btn-icon { width: 32px; height: 32px; font-size: 12px; }
    .ai-report-body { padding: 22px 18px; font-size: 13px; line-height: 1.9; }
    .ai-report-footer { padding: 12px 16px; gap: 8px; }
    .ai-report-btn-bottom { padding: 8px 24px; font-size: 11px; }
}

@media (min-width: 641px) and (max-width: 900px) {
    .ai-report-panel { max-width: 92vw; }
    .ai-report-body { padding: 28px 28px; }
}

/* ───── 인쇄용 ───── */
@media print {
    body * { visibility: hidden; }
    .ai-report-modal,
    .ai-report-modal * { visibility: visible; }
    .ai-report-modal {
        position: absolute;
        inset: 0;
        background: #fff;
        opacity: 1 !important;
        padding: 0;
    }
    .ai-report-backdrop,
    .ai-report-header,
    .ai-report-footer { display: none !important; }
    .ai-report-panel {
        position: static;
        width: 100%;
        height: auto;
        max-height: none;
        max-width: 100%;
        box-shadow: none;
        border: none;
        border-radius: 0;
        transform: none !important;
    }
    .ai-report-body {
        overflow: visible;
        padding: 30px 40px;
        background: #fff;
        font-size: 12pt;
        line-height: 1.8;
        color: #000;
    }
    .ai-report-body::-webkit-scrollbar { display: none; }
    .ai-report-body h2,
    .ai-report-body h3 { page-break-after: avoid; }
    .ai-report-body p { orphans: 3; widows: 3; }
}
/* ═══════════════════════════════════════════════════════════
   환영 화면 — 도사 이미지를 화면 맨 위로 올리기
   ═══════════════════════════════════════════════════════════ */
.saju-screen-wrap {
    padding-top: 0 !important;
}
#sajuWelcomeScreen {
    padding-top: 0 !important;
    margin-top: 0 !important;
}
.saju-welcome-layout {
    margin-top: 0 !important;
    padding-top: 0 !important;
    align-items: flex-start !important;
}
.saju-welcome-image {
    margin-top: 0 !important;
}

@media (max-width: 768px) {
    .saju-screen-wrap { padding-top: 0 !important; }
}
/* ═══════════════════════════════════════════════════════════
   사주 입력 오버레이 (도사 이미지 위에 떠오름)
   ═══════════════════════════════════════════════════════════ */

/* 오버레이 컨테이너 — 평소엔 숨김 */
.saju-form-overlay {
    position: absolute;
    inset: 0;                           /* 도사 이미지 영역 전체 덮음 */
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    background: rgba(5, 9, 20, 0.55);   /* 어두운 반투명 — 이미지 어둡게 */
    backdrop-filter: blur(8px);         /* 배경 흐리기 */
    -webkit-backdrop-filter: blur(8px);
    border-radius: 16px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s ease;
    z-index: 10;
}
.saju-form-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

/* 오버레이가 열려있을 때 도사 이미지 자체도 추가로 살짝 흐리게 */
.saju-welcome-image.form-open .dosa-illustration {
    filter:
        blur(2px)
        brightness(0.7)
        drop-shadow(0 14px 32px rgba(0, 0, 0, 0.6));
    transition: filter 0.35s ease;
}

/* 오버레이 열려있을 때 우하단 "내 사주보기" 버튼 숨기기 */
.saju-welcome-image.form-open .dosa-corner-btn {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

/* ───── 입력 카드 ───── */
.saju-form-card {
    position: relative;
    width: 100%;
    max-width: 380px;
    max-height: 90%;
    overflow-y: auto;
    background: linear-gradient(180deg, rgba(15, 22, 48, 0.96) 0%, rgba(8, 14, 32, 0.96) 100%);
    border: 1.5px solid var(--saju-gold);
    border-radius: 16px;
    padding: 28px 24px 22px;
    box-shadow:
        0 25px 60px rgba(0, 0, 0, 0.7),
        0 0 0 1px rgba(212, 175, 55, 0.25),
        inset 0 0 30px rgba(212, 175, 55, 0.05);
    transform: translateY(20px) scale(0.96);
    transition: transform 0.35s cubic-bezier(0.2, 0.9, 0.3, 1);
}
.saju-form-overlay.open .saju-form-card {
    transform: translateY(0) scale(1);
}

/* 카드 스크롤바 */
.saju-form-card::-webkit-scrollbar { width: 6px; }
.saju-form-card::-webkit-scrollbar-track { background: transparent; }
.saju-form-card::-webkit-scrollbar-thumb {
    background: rgba(212, 175, 55, 0.4);
    border-radius: 3px;
}

/* 닫기 버튼 (X) */
.saju-form-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(216, 221, 232, 0.2);
    color: var(--saju-silver);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    z-index: 2;
}
.saju-form-close:hover {
    background: rgba(212, 175, 55, 0.15);
    border-color: var(--saju-gold);
    color: var(--saju-gold-soft);
    transform: rotate(90deg);
}

/* 카드 타이틀 */
.saju-form-title {
    margin: 4px 0 6px;
    font-size: 18px;
    font-weight: 800;
    text-align: center;
    letter-spacing: 0.02em;
}
.saju-form-desc {
    margin: 0 0 22px;
    font-size: 12px;
    color: var(--saju-dim-silver);
    text-align: center;
    letter-spacing: 0.02em;
}

/* 폼 본문 */
.saju-form-body .cwd-field { margin-bottom: 20px; }
.saju-form-body .cwd-field:last-of-type { margin-bottom: 24px; }

/* ───── 모바일 반응형 ───── */
@media (max-width: 640px) {
    .saju-form-overlay { padding: 12px; }
    .saju-form-card {
        max-width: 100%;
        max-height: 92%;
        padding: 22px 18px 18px;
    }
    .saju-form-title { font-size: 16px; }
    .saju-form-desc { font-size: 11px; margin-bottom: 16px; }
}