/* ============================================================
   CSS 변수 (정적값)
   ============================================================ */
:root {
    --text-main: #333333;
    --text-sub: #666666;
    --btn-bg: #FFFFFF;
    --urdy-blue: #2d63ff;
}

/* ============================================================
   기본 레이아웃
   ============================================================ */
html,
body {
    background-color: var(--bg-color);
    color: var(--text-main);
}

#app {
    background-color: var(--bg-color);
}

/* ============================================================
   헤더
   ============================================================ */
.header .back-btn {
    all: unset;
    position: absolute;
    left: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-main);
    padding: 8px;
}

/* ============================================================
   화면 전환
   ============================================================ */
.screen {
    display: none;
    flex-direction: column;
    flex-grow: 1;
    padding: 16px 20px 24px;
    animation: mongleFadeIn 0.5s ease;
    width: 100%;
}

.screen.active {
    display: flex;
}

/* ============================================================
   시작 화면
   ============================================================ */
.cover-image {
    width: 100%;
    max-height: 200px;
    border-radius: var(--radius-lg);
    margin-bottom: 16px;
    box-shadow: var(--shadow-card);
    display: block;
    object-fit: cover;
}

.test-title-main {
    font-size: 24px;
    line-height: 1.3;
    margin-bottom: 12px;
    text-align: center;
    color: var(--text-main);
    word-break: keep-all;
}

.name-input-section {
    background-color: #ffffff;
    padding: 16px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-card);
    margin-bottom: 15px;
    text-align: center;
}

.name-input-label {
    font-size: 16px;
    font-weight: bold;
    color: var(--text-main);
    margin-bottom: 10px;
    display: block;
}

.name-input-box {
    background: #f9f9f9;
    border: 2px solid #eee;
    border-radius: var(--radius-md);
    padding: 14px;
    font-size: 15px;
    text-align: center;
    width: 100%;
    margin-bottom: 8px;
    outline: none;
}

.participant-count {
    font-size: 12px;
    color: var(--text-sub);
    text-align: center;
}

.start-btn {
    width: 100%;
    font-size: var(--btn-font-size-lg);
    background-color: var(--primary-color) !important;
    color: #ffffff !important;
    border: none;
    padding: var(--btn-padding);
    border-radius: var(--btn-radius);
    cursor: pointer;
    text-align: center;
}

/* ============================================================
   질문 화면
   ============================================================ */
.progress-bar {
    width: 100%;
    height: 6px;
    background-color: rgba(0, 0, 0, 0.05);
    display: none;
    overflow: hidden;
    margin-top: 10px;
    border-radius: var(--radius-sm);
}

.progress-fill {
    height: 100%;
    background-color: var(--primary-color);
    width: 0%;
    transition: width 0.4s ease;
    border-radius: var(--radius-sm);
}

.q-num-wrapper {
    text-align: center;
}

.q-label {
    font-size: 15px;
    font-weight: bold;
    margin-bottom: 10px;
    display: inline-block;
    color: var(--primary-color);
}

.q-title {
    font-size: 22px;
    margin-bottom: 24px;
    line-height: 1.4;
    color: var(--text-main);
    word-break: keep-all;
}

.answer-btn {
    background: var(--btn-bg);
    border: 2px solid transparent;
    color: var(--text-main);
    padding: var(--btn-padding);
    font-size: var(--btn-font-size);
    cursor: pointer;
    border-radius: var(--btn-radius);
    box-shadow: var(--shadow-card);
    transition: all var(--transition-base) ease;
    text-align: left;
    margin-bottom: 12px;
    width: 100%;
    line-height: 1.4;
    font-weight: 600;
}

.answer-btn:hover {
    transform: translateY(-2px);
    border-color: var(--primary-color);
}

/* ============================================================
   로딩 화면
   ============================================================ */
#loadingScreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: var(--z-loading);
    justify-content: center;
    align-items: center;
}

#loadingScreen.active {
    display: flex;
    animation: fadeInOverlay 0.4s ease-out forwards;
}

.loading-container {
    width: 100%;
    max-width: 340px;
    text-align: center;
    padding: 0 20px;
    background: transparent;
    box-shadow: none;
    position: relative;
}

.tiky-aura-wrapper {
    position: relative;
    width: 100px;
    height: 100px;
    margin: 0 auto 40px;
}

#tikyLogo {
    width: 100px;
    height: 100px;
    display: block;
    object-fit: contain;
    animation: heartbeat 2s ease-in-out infinite;
    transform-origin: center;
    position: relative;
    z-index: 2;
}

#tikyLogo.beat-fast   { animation-duration: 1s; }
#tikyLogo.beat-faster { animation-duration: 0.5s; }

.tiky-aura-wrapper::before,
.tiky-aura-wrapper::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(1);
    border: 5px solid rgba(0, 0, 0, 0.05);
    animation: pulseWave 1.5s ease-out infinite;
    z-index: 1;
}

.tiky-aura-wrapper::after {
    border-width: 3px;
    border-color: rgba(0, 0, 0, 0.02);
    animation-delay: 0.7s;
}

.loading-title {
    font-family: 'Jua', sans-serif !important;
    font-size: 26px;
    line-height: 1.4;
    margin-bottom: 12px;
    word-break: keep-all;
}

.loading-name {
    color: var(--primary-color);
}

.loading-subtext-wrapper {
    height: 24px;
    margin-bottom: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.loading-subtext {
    font-family: 'Jua', sans-serif !important;
    font-size: 15px;
    color: var(--text-sub);
    margin: 0;
    word-break: keep-all;
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.4s ease-in-out, transform 0.4s ease-in-out;
}

.loading-subtext.fade-out-down {
    opacity: 0;
    transform: translateY(15px);
}

.loading-subtext.wait-top {
    opacity: 0;
    transform: translateY(-15px);
    transition: none !important;
}

.loading-gauge-bg {
    width: 100%;
    height: 6px;
    background-color: rgba(0, 0, 0, 0.06);
    border-radius: var(--radius-sm);
}

.loading-gauge-fill {
    height: 100%;
    background: var(--primary-color);
    width: 0%;
    border-radius: var(--radius-sm);
    transition: width var(--transition-base) cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================================
   결과 화면 - 기본
   ============================================================ */
.result-box {
    margin-bottom: 30px;
    text-align: center;
    width: 100%;
}

.result-label {
    font-size: 15px;
    color: var(--text-main);
    margin-bottom: 12px;
    display: inline-block;
    font-weight: bold;
}

.result-title {
    font-size: 20px;
    margin-bottom: 20px;
    color: var(--primary-color);
}

.keyword-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    margin-bottom: 20px;
}

.keyword-card {
    padding: 6px 12px;
    border-radius: var(--radius-pill);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-sub);
}

.desc {
    font-size: 15px;
    line-height: 1.6;
    text-align: left;
    margin-bottom: 24px;
    word-break: keep-all;
    color: var(--text-main);
}

/* ============================================================
   결과 화면 - 캐릭터
   ============================================================ */
.character-container {
    display: none;
    margin: 0 auto 24px;
    text-align: center;
}

.character-wrapper {
    position: relative;
    display: inline-block;
}

.character-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 220px;
    height: 220px;
    background-color: var(--primary-color);
    opacity: 0.1;
    border-radius: 50%;
    z-index: -1;
}

.character-img {
    width: 100%;
    max-width: 250px;
    display: block;
    filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.1));
}

/* ============================================================
   결과 화면 - 궁합
   ============================================================ */
.match-container {
    display: flex;
    flex-direction: row;
    gap: 12px;
    width: 100%;
}

.match-box {
    flex: 1;
    background-color: #f8f9fa;
    border: 1px solid #e9e9e9;
    border-radius: var(--radius-lg);
    padding: 16px 10px;
    text-align: center;
}

.match-box h4 {
    font-size: 13px;
    color: var(--text-sub);
    margin-bottom: 8px;
    font-weight: 600;
}

.match-box p {
    font-size: 15px;
    color: var(--primary-color);
    font-weight: 800;
    word-break: keep-all;
    margin: 0;
}

.match-img {
    display: none;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    margin: 0 auto 10px;
    object-fit: cover;
}

.match-img--good { border: 3px solid #35fb44; }
.match-img--bad  { border: 3px solid #f83555; }

/* ============================================================
   버튼
   ============================================================ */
.btn-group {
    display: flex;
    flex-direction: row;
    gap: 12px;
    width: 100%;
    margin-bottom: 10px;
}

.sub-btn {
    flex: 1;
    background-color: #fff !important;
    color: var(--text-main) !important;
    border: 1px solid #ddd;
    padding: var(--btn-padding);
    font-size: var(--btn-font-size);
    border-radius: var(--btn-radius);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.sub-btn:hover {
    background-color: #e9ecef !important;
}

.share-btn-wrapper {
    flex: 1;
    position: relative;
    display: flex;
}

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

.btn--share {
    background-color: #FEE500 !important;
    color: #3c1e1e !important;
    font-weight: 600;
}

.btn--save {
    width: 100%;
    margin-bottom: 30px;
    background-color: #ffffff !important;
    border: 1px solid #ddd !important;
}

.text--primary {
    color: var(--primary-color);
}

.floating-tip {
    position: absolute;
    top: -40px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #ffffff;
    color: var(--text-main);
    padding: 6px 12px;
    border-radius: var(--radius-pill);
    font-size: 12px;
    white-space: nowrap;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    animation: floatingTip 2s infinite;
    z-index: 10;
}

.floating-tip::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    border-top: 8px solid #ffffff;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
}

/* ============================================================
   추천 섹션
   ============================================================ */
.recommend-section {
    padding-top: 20px;
    border-top: 2px dashed rgba(0, 0, 0, 0.05);
    margin-top: 10px;
    margin-bottom: 20px;
}

.recommend-title {
    font-size: 16px;
    font-weight: 800;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.swiper-wrapper {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 12px;
    padding-bottom: 4px;
}

.swiper-wrapper::-webkit-scrollbar {
    display: none;
}

.swiper-slide {
    flex: 0 0 85%;
    scroll-snap-align: center;
}

.recommend-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.recommend-card {
    display: flex;
    align-items: center;
    gap: 10px;
    background-color: #ffffff;
    padding: 10px;
    border-radius: var(--radius-md);
    text-decoration: none;
    box-shadow: var(--shadow-card);
}

.recommend-grid .recommend-card {
    flex-direction: column;
    text-align: center;
}

.recommend-thumb {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    flex-shrink: 0;
}

.recommend-grid .recommend-thumb {
    width: 80px;
    height: 80px;
}

.recommend-test-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.3;
}

.recommend-count {
    font-size: 11px;
    color: #bbb;
}

/* ============================================================
   광고 배너
   ============================================================ */
.urdy-banner-container {
    display: block;
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 20px;
    margin: 15px 0;
    text-decoration: none;
    box-shadow: var(--shadow-card);
    text-align: center;
}

.urdy-logo-img {
    height: 28px;
    margin: 0 auto;
    margin-bottom: 15px;
}

.urdy-banner-text {
    font-size: 14px;
    color: #333;
    line-height: 1.6;
    margin: 0;
    font-weight: 500;
}

.urdy-banner-text strong {
    font-weight: 800;
}

.urdy-banner-c2a {
    display: inline-block;
    font-size: 13px;
    color: var(--urdy-blue);
    font-weight: 700;
    opacity: 0.8;
}

.native-ad-banner {
    display: none;
    cursor: pointer;
}

.native-ad-box {
    display: block;
    transition: transform var(--transition-fast) ease, box-shadow var(--transition-fast) ease;
}

.native-ad-box:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(74, 136, 255, 0.12);
}

.native-ad-box .urdy-logo-img {
    margin-bottom: 20px;
}

.native-ad-text {
    font-size: 16px;
    color: #333;
    margin-bottom: 18px;
    line-height: 1.6;
    word-break: keep-all;
}

.native-ad-btn {
    display: inline-block;
    background-color: var(--urdy-blue);
    color: #ffffff !important;
    padding: 16px 24px;
    border-radius: var(--radius-lg);
    font-size: 16px;
    font-weight: 800;
    text-decoration: none;
    width: 100%;
    box-shadow: 0 4px 12px rgba(74, 136, 255, 0.2);
    transition: transform var(--transition-fast) ease, box-shadow var(--transition-fast) ease;
}

.native-ad-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(74, 136, 255, 0.3);
}

.result-ad-header {
    font-size: 13px;
    color: var(--urdy-blue);
    font-weight: 800;
    background-color: #EEF4FF;
    display: inline-block;
    padding: 6px 14px;
    border-radius: var(--radius-pill);
    margin-bottom: 12px;
    word-break: keep-all;
}

.ad-container {
    text-align: center;
    margin: 16px 0;
    min-height: 60px;
}

/* ============================================================
   배너 텍스트 애니메이션
   ============================================================ */
.result-banner-hook {
    font-size: 13px;
    color: var(--text-sub);
    font-weight: 600;
}

.result-banner-title {
    color: var(--urdy-blue);
    font-size: 17px;
}

.result-banner-cta {
    margin-top: 18px;
}

.result-banner-cta-text {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-main);
    text-decoration: underline;
}

.glitch-fixer {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    vertical-align: top;
}

.glitch-fixer-cell {
    display: grid;
    grid-template-columns: 1fr;
    justify-items: center;
    align-items: center;
}

.ghost-text {
    grid-column: 1 / 2;
    grid-row: 1 / 2;
    visibility: hidden;
    white-space: nowrap;
    pointer-events: none;
    font-weight: 800;
}

.dynamic-phrase {
    grid-column: 1 / 2;
    grid-row: 1 / 2;
    display: inline-block;
    white-space: nowrap;
    transition: opacity 0.4s ease, transform 0.4s ease;
    opacity: 1;
    transform: translateY(0);
}

.dynamic-phrase.fade-out-up {
    opacity: 0;
    transform: translateY(-8px);
}

.dynamic-phrase.wait-bottom {
    opacity: 0;
    transform: translateY(8px);
    transition: none !important;
}

/* ============================================================
   아이콘
   ============================================================ */
.icon-view {
    width: 14px;
    height: 14px;
    fill: #bbb;
    vertical-align: middle;
    margin-right: 2px;
    margin-top: -2px;
}

/* ============================================================
   애니메이션
   ============================================================ */
@keyframes mongleFadeIn {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

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

@keyframes floatingTip {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(-6px); }
}

@keyframes heartbeat {
    0%, 60%, 100% { transform: scale(1); }
    15% { transform: scale(1.15); }
    45% { transform: scale(1.1); }
}

@keyframes pulseWave {
    0%   { transform: translate(-50%, -50%) scale(1); border-width: 6px; opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(1.8); border-width: 1px; opacity: 0; }
}
