/* ============================================================
   CSS 변수
   ============================================================ */
:root {
    --bg-dark: #0f051d;
    --primary-glow: #bc6ff1;
    --accent-gold: #f9d949;
    --bujeok-red: #c0392b;
    --bubble-bg: rgba(255, 255, 255, 0.08);
    --text-main: #f5f5f5;
    --primary-color: #FF8BA0;
    --border-color: rgba(255, 255, 255, 0.1);
    --text-muted: #aaaaaa;
    --chip-yong: #DBEAFE;
    --chip-hee: #DCFCE7;
    --chip-gi: #FEE2E2;
}

/* ============================================================
   기본 레이아웃
   ============================================================ */
body {
    background: #F8F9FA;
}

#app {
    background: linear-gradient(180deg, #130722 0%, var(--bg-dark) 100%);
    color: var(--text-main);
}

/* ============================================================
   인트로 오버레이
   ============================================================ */
.page-intro {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-dark);
    z-index: var(--z-loading);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.8s ease-in-out, visibility 0.8s ease-in-out;
}

.page-intro.hide {
    opacity: 0;
    visibility: hidden;
}

.intro-symbol {
    font-size: 80px;
    margin-bottom: 20px;
    animation: pulseGlow 1.5s infinite;
    filter: drop-shadow(0 0 30px var(--primary-glow));
}

.intro-text {
    font-family: 'Jua', sans-serif;
    font-size: 26px;
    color: var(--accent-gold);
    letter-spacing: 2px;
    animation: textShine 1.5s infinite alternate;
}

/* ============================================================
   화면 전환
   ============================================================ */
.screen {
    display: none;
    padding: 30px 20px 80px;
    flex-direction: column;
    align-items: center;
    flex-grow: 1;
    width: 100%;
    overflow-y: auto;
    justify-content: flex-start;
}

.screen.active {
    display: flex;
    animation: slideUp 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.screen--center {
    justify-content: center;
    text-align: center;
}

.screen.mystic-active {
    display: flex;
    animation: mysticalReveal 1.5s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

/* ============================================================
   진행 바
   ============================================================ */
.progress-container {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    display: none;
    position: absolute;
    top: 54px;
    left: 0;
    z-index: 99;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary-glow), var(--accent-gold));
    box-shadow: 0 0 10px var(--primary-glow);
    transition: width 0.4s ease;
}

/* ============================================================
   도사 / 말풍선
   ============================================================ */
.dosa-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    margin-bottom: 30px;
    margin-top: 10px;
}

.dosa-avatar {
    font-size: 50px;
    margin-bottom: 15px;
    filter: drop-shadow(0 0 15px rgba(249, 217, 73, 0.4));
}

.chat-bubble {
    position: relative;
    background: var(--bubble-bg);
    border: 1px solid rgba(188, 111, 241, 0.3);
    backdrop-filter: blur(10px);
    padding: 20px 24px;
    border-radius: var(--radius-sm);
    width: 100%;
    font-size: 16px;
    line-height: 1.6;
    color: #fff;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    word-break: keep-all;
}

/* ============================================================
   입력 폼
   ============================================================ */
.input-group {
    width: 100%;
    margin-bottom: 20px;
}

.input-group label {
    font-size: 13px;
    color: var(--primary-glow);
    font-weight: bold;
    margin-left: 5px;
    margin-bottom: 8px;
    display: block;
    letter-spacing: 0.5px;
}

.input-box,
.select-box {
    width: 100%;
    padding: 16px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 16px;
    outline: none;
    transition: border-color var(--transition-base);
    appearance: none;
    -webkit-appearance: none;
}

.input-box:focus,
.select-box:focus {
    border-color: var(--primary-glow);
    box-shadow: 0 0 15px rgba(188, 111, 241, 0.2);
}

.input-box::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.select-box option {
    background-color: var(--bg-dark);
    color: #fff;
}

.toggle-group {
    display: flex;
    gap: 10px;
    width: 100%;
}

.toggle-btn {
    flex: 1;
    padding: 14px;
    text-align: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    color: #888;
    font-weight: bold;
    cursor: pointer;
    transition: var(--transition-base);
}

.toggle-btn.active {
    background: rgba(188, 111, 241, 0.15);
    border-color: var(--primary-glow);
    color: #fff;
}

.select-wrapper {
    position: relative;
    width: 100%;
}

.select-wrapper::after {
    content: '▼';
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.5);
    font-size: 12px;
    pointer-events: none;
}

/* ============================================================
   버튼
   ============================================================ */
.btn {
    width: 100%;
    padding: var(--btn-padding);
    border-radius: var(--btn-radius);
    border: none;
    font-size: var(--btn-font-size-lg);
    cursor: pointer;
    transition: transform var(--transition-fast);
    margin-bottom: 12px;
}

.btn-primary {
    background: linear-gradient(135deg, #7b2cbf 0%, #bc6ff1 100%);
    color: white;
    font-family: 'Jua', sans-serif;
    letter-spacing: 1px;
    box-shadow: 0 4px 20px rgba(123, 44, 191, 0.4);
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-answer {
    background: rgba(255, 255, 255, 0.06);
    color: #e0e0e0;
    border: 1px solid rgba(255, 255, 255, 0.08);
    text-align: left;
    padding: 18px 20px;
    line-height: 1.4;
}

.btn-answer:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(188, 111, 241, 0.5);
    color: #fff;
}

.btn-share {
    font-size: 16px;
    background: #fee500;
    color: #3c1e1e;
    border: none;
}

.btn-list-go {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-retry {
    background: var(--primary-glow);
    color: #fff;
}

.btn--full {
    width: 100%;
}

/* 인트로 화면 시작 버튼 상단 여백 */
#introScreen .btn-primary {
    margin-top: 10px;
}

/* ============================================================
   로딩 화면
   ============================================================ */
.answer-list {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.k-mystic-wrapper {
    position: relative;
    width: 160px;
    height: 160px;
    margin: 40px 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

.magic-circle {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 2px dashed rgba(249, 217, 73, 0.4);
    border-radius: 50%;
    animation: spin 6s linear infinite;
    pointer-events: none;
}

.magic-circle::before,
.magic-circle::after {
    content: '';
    position: absolute;
    top: -10px;
    left: 50%;
    width: 20px;
    height: 20px;
    background: var(--accent-gold);
    border-radius: 50%;
    transform: translateX(-50%);
    box-shadow: 0 0 15px var(--accent-gold);
}

.magic-circle::after {
    top: auto;
    bottom: -10px;
}

.bujeok {
    width: 70px;
    height: 110px;
    background-color: #f1c40f;
    border: 3px solid var(--bujeok-red);
    border-radius: var(--radius-xs);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 25px rgba(241, 196, 15, 0.6);
    animation: floatBujeok 2s ease-in-out infinite;
    z-index: 10;
}

.bujeok::before {
    content: '萬事\A如意';
    white-space: pre;
    color: var(--bujeok-red);
    font-family: 'Jua', sans-serif;
    font-size: 26px;
    text-align: center;
    line-height: 1.1;
    letter-spacing: 2px;
}

.loading-text {
    font-family: 'Jua', sans-serif;
    color: var(--primary-glow);
    font-size: 22px;
    margin-bottom: 15px;
    height: 30px;
    transition: opacity 0.4s;
}

.loading-progress-container {
    width: 80%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    margin: 0 auto;
    overflow: hidden;
}

.loading-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary-glow), var(--accent-gold));
    transition: width var(--transition-base) ease-out;
}

.progress-text {
    font-size: 15px;
    color: rgba(255, 255, 255, 0.8);
    margin-top: 15px;
    font-weight: bold;
    font-family: 'Jua', sans-serif;
}

/* ============================================================
   결과 화면
   ============================================================ */
.result-box {
    width: 100%;
}

.result-title {
    font-size: 26px;
    margin-bottom: 12px;
    color: var(--accent-gold);
    font-family: 'Jua', sans-serif;
    text-shadow: 0 0 15px rgba(249, 217, 73, 0.3);
    line-height: 1.3;
    word-break: keep-all;
    text-align: center;
}

.res-keyword {
    color: var(--primary-glow);
    font-size: 14px;
    font-weight: bold;
    margin-bottom: 24px;
    text-align: center;
}

.desc-text {
    font-size: 15px;
    line-height: 1.75;
    color: #ddd;
    text-align: left;
    word-break: keep-all;
    margin-bottom: 20px;
}

/* ============================================================
   오행 칩
   ============================================================ */
.ohaeng-chips {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
}

.chip-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.chip-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 600;
}

.chip {
    padding: 6px 16px;
    border-radius: var(--radius-pill);
    font-size: 0.9rem;
    font-weight: 600;
}

.chip.yongshin { background: var(--chip-yong); color: #1e40af; }
.chip.heeshin  { background: var(--chip-hee);  color: #166534; }
.chip.gishin   { background: var(--chip-gi);   color: #991b1b; }

/* ============================================================
   조언 / 행운 / 한줄평
   ============================================================ */
.advice-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}

.advice-card {
    padding: 14px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    word-break: keep-all;
    line-height: 1.4;
}

.advice-good {
    background: rgba(46, 125, 50, 0.15);
    border: 1px solid rgba(129, 199, 132, 0.3);
    color: #A5D6A7;
}

.advice-bad {
    background: rgba(198, 40, 40, 0.15);
    border: 1px solid rgba(229, 115, 115, 0.3);
    color: #EF9A9A;
}

.advice-label {
    display: block;
    font-size: 12px;
    margin-bottom: 6px;
    font-weight: bold;
}

.advice-good .advice-label { color: #81C784; }
.advice-bad .advice-label  { color: #E57373; }

.lucky-color-box {
    text-align: center;
    padding: 14px;
    background: rgba(249, 217, 73, 0.08);
    border: 1px solid rgba(249, 217, 73, 0.3);
    border-radius: var(--radius-md);
    margin-bottom: 24px;
}

.lucky-color-label {
    display: block;
    font-size: 12px;
    color: var(--accent-gold);
    margin-bottom: 4px;
}

.lucky-color-val {
    font-size: 16px;
    font-weight: bold;
    color: #fff;
}

.comfort-word {
    font-family: 'Gowun Batang', serif;
    font-size: 18px;
    line-height: 1.7;
    color: var(--primary-color);
    text-align: center;
    padding: 24px 10px;
    border-top: 1px dashed rgba(255, 139, 160, 0.3);
    border-bottom: 1px dashed rgba(255, 139, 160, 0.3);
    text-shadow: 0 0 10px rgba(255, 139, 160, 0.2);
}

/* ============================================================
   공유 / 결과 버튼
   ============================================================ */
.result-button-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    margin-top: 30px;
}

.btn-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.recommend-bubble-wrapper {
    position: relative;
    margin-top: 25px;
    width: 100%;
}

.recommend-chat-bubble {
    position: absolute;
    top: -45px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary-color);
    color: white;
    padding: 8px 16px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: bold;
    white-space: nowrap;
    animation: bounceBubble 1.5s infinite ease-in-out;
}

.recommend-chat-bubble::after {
    content: '';
    position: absolute;
    bottom: -7px;
    left: 50%;
    transform: translateX(-50%);
    border-top: 8px solid var(--primary-color);
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
}

/* ============================================================
   추천 목록
   ============================================================ */
.suggestion-section {
    margin-top: 40px;
}

.suggestion-title {
    font-family: 'Jua', sans-serif;
    font-size: 18px;
    color: var(--accent-gold);
    margin-bottom: 15px;
}

.mini-test-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.05);
    padding: 10px;
    border-radius: var(--radius-md);
    margin-bottom: 10px;
    cursor: pointer;
}

.mini-thumb {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    object-fit: cover;
}

.mini-title {
    font-size: 14px;
    color: #eee;
    margin: 0;
    font-weight: 600;
}

.mini-tag {
    font-size: 11px;
    color: var(--primary-glow);
}

/* ============================================================
   광고 배너
   ============================================================ */
.ad-banner {
    position: relative;
    width: 100%;
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-top: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.ad-banner img {
    width: 100%;
    display: block;
}

.ad-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: var(--radius-xs);
    font-weight: bold;
}

/* ============================================================
   애니메이션
   ============================================================ */
@keyframes pulseGlow {
    0%, 100% { transform: scale(0.9); opacity: 0.8; }
    50% { transform: scale(1.1); opacity: 1; }
}

@keyframes textShine {
    from { text-shadow: 0 0 5px var(--accent-gold); }
    to { text-shadow: 0 0 20px var(--accent-gold), 0 0 30px #fff; }
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes mysticalReveal {
    0% { opacity: 0; transform: scale(0.95) translateY(20px); filter: blur(10px); }
    50% { filter: blur(0); box-shadow: 0 0 50px rgba(188, 111, 241, 0.5); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes floatBujeok {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-15px) scale(1.05); }
}

@keyframes bounceBubble {
    0%, 100% { transform: translate(-50%, 0); }
    50% { transform: translate(-50%, -5px); }
}
