@import url('https://cdn.jsdelivr.net/gh/moonspam/NanumSquare@2.0/nanumsquare.css');

:root {
    --primary-color: #4CAF50;
    --primary-dark: #2E7D32;
    --gold-accent: #FFD700;
    --bg-gradient: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    --surface-color: rgba(255, 255, 255, 0.95);
    --text-color: #333;
    --text-secondary: #555;
    --radius-lg: 24px;
    --radius-md: 16px;
    --shadow-soft: 0 10px 30px rgba(0,0,0,0.08);
}

[data-theme="dark"] {
    --bg-gradient: linear-gradient(135deg, #232526 0%, #414345 100%);
    --surface-color: rgba(40, 40, 40, 0.95);
    --text-color: #f0f0f0;
    --text-secondary: #bbb;
    --primary-color: #81C784;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    overflow-x: hidden;
    font-family: 'NanumSquare', 'Pretendard', 'Nunito', -apple-system, BlinkMacSystemFont, system-ui, Roboto, sans-serif;
    background: var(--bg-gradient);
    color: var(--text-color);
    line-height: 1.7;
    word-break: keep-all;
    overflow-wrap: break-word;
    font-size: 17px;
}

h1, h2, h3, h4, h5, h6 {
    line-height: 1.3;
    margin-bottom: 1rem;
    font-weight: 700;
}

p {
    margin-bottom: 1rem;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header */
.app-header {
    background: var(--surface-color);
    backdrop-filter: blur(10px);
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    height: 70px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    flex-shrink: 0;
}

.logo a {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary-color);
    text-decoration: none;
    display: block;
    white-space: nowrap;
}

.header-nav { 
    height: 100%; 
    display: flex; 
    align-items: center; 
    justify-content: center; /* 가운데 정렬 복구 */
    /* overflow-x: auto;  <-- Removed to fix dropdown clipping */
    flex-grow: 1;
}

/* Mobile Scroll Support */
@media (max-width: 900px) {
    .header-nav {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        justify-content: flex-start;
    }
}

.header-nav::-webkit-scrollbar { display: none; }

.nav-list { 
    list-style: none; 
    margin: 0 auto; 
    padding: 0; 
    display: flex; 
    height: 100%; 
    gap: 15px;
}
.nav-item { position: relative; height: 100%; display: flex; align-items: center; flex-shrink: 0; }

.nav-link {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 700;
    font-size: 1rem;
    padding: 8px 12px;
    border-radius: 12px;
    transition: all 0.2s;
    cursor: pointer;
    white-space: nowrap;
    display: flex;
    align-items: center;
}

.nav-link:hover, .nav-item:hover > .nav-link, .nav-link.active {
    color: var(--primary-color);
    background: rgba(0,0,0,0.05);
}

/* Dropdown - Simplified and Bulletproof */
.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -80px; /* Half of min-width for centering */
    margin-top: 0px;
    background: white;
    min-width: 160px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border-radius: 8px;
    padding: 8px 0;
    visibility: hidden;
    opacity: 0;
    z-index: 9999;
    border: 1px solid #e0e0e0;
    transition: visibility 0s, opacity 0.2s ease;
    pointer-events: none;
}

[data-theme="dark"] .dropdown-menu {
    background: #2c2c2c;
    border-color: #444;
}

/* Show dropdown on hover - desktop */
.nav-item:hover > .dropdown-menu {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
}

/* Keep dropdown visible when hovering over it */
.dropdown-menu:hover {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
}

.dropdown-item {
    padding: 10px 20px;
    color: var(--text-color);
    text-decoration: none;
    font-size: 0.95rem;
    display: block;
    white-space: nowrap;
}
.dropdown-item:hover {
    background: rgba(76, 175, 80, 0.1);
    color: var(--primary-color);
}

/* Header Buttons */
.header-buttons { display: flex; gap: 10px; flex-shrink: 0; margin-left: 10px; }
.header-btn {
    width: 40px; height: 40px; border-radius: 50%; border: 1px solid rgba(0,0,0,0.1);
    background: var(--surface-color); color: var(--text-color);
    cursor: pointer; display: flex; justify-content: center; align-items: center;
    transition: all 0.2s; font-weight: bold;
}
.header-btn:hover { background: var(--primary-color); color: white; border-color: transparent; }

/* Layout */
.app-container {
    flex: 1;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 3rem 2rem;
    display: flex;
    flex-direction: column;
}

/* Home Split Layout */
.home-split-layout {
    display: flex;
    gap: 30px;
    margin-bottom: 3rem;
    align-items: stretch;
    min-height: 400px;
    width: 100%;
    max-width: 1100px;
    margin-left: auto;
    margin-right: auto;
}

.home-left-visual {
    flex: 0.65;
    background: url('main.jpg') center top/cover no-repeat;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 3rem;
    color: white;
    z-index: 0;
    height: auto;
}
.home-left-visual::before {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0.1) 60%, rgba(0,0,0,0) 100%);
    z-index: -1;
}

.visual-content { position: relative; z-index: 1; }
.visual-title { font-size: 3rem; font-weight: 800; margin-bottom: 1rem; line-height: 1.2; text-shadow: 0 4px 10px rgba(0,0,0,0.3); }
.visual-desc { font-size: 1.2rem; opacity: 0.9; text-shadow: 0 2px 5px rgba(0,0,0,0.3); }

/* Scroll Reveal */
.reveal { opacity: 1; transform: translateY(0); transition: all 0.8s ease-out; }
.reveal.active { opacity: 1; transform: translateY(0); }

.home-right-menu {
    flex: 1.35;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    align-content: center;
    max-width: 700px;
}

.menu-card {
    background: var(--surface-color);
    border-radius: var(--radius-lg);
    padding: 1.2rem;
    text-align: center;
    text-decoration: none;
    color: var(--text-color);
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    transition: all 0.3s;
    border: 1px solid rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 130px;
}
.menu-card:hover { transform: translateY(-8px); border-color: var(--primary-color); box-shadow: 0 15px 30px rgba(0,0,0,0.1); }
.menu-icon { font-size: 2.5rem; margin-bottom: 0.8rem; }
.menu-card h3 { margin: 0; font-size: 1.2rem; font-weight: 800; color: var(--text-color); }
.menu-card p { font-size: 0.9rem; color: var(--text-secondary); margin: 0.5rem 0 0 0; }

/* SEO Content */
.seo-content {
    background: var(--surface-color);
    padding: 3rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    line-height: 1.8;
    width: 100%;
}

/* Footer */
.app-footer {
    padding: 3rem 2rem;
    text-align: center;
    position: relative;
    border-top: 1px solid rgba(0,0,0,0.05);
    background: var(--surface-color);
    margin-top: auto;
    flex-shrink: 0;
}

.footer-nav {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.footer-nav a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    transition: color 0.2s;
}

.footer-nav a:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

.contributors {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-top: 15px;
    text-align: center;
}

@media (max-width: 768px) {
    .footer-nav {
        gap: 15px;
    }

    .footer-nav a {
        font-size: 0.85rem;
    }
}

/* Forms */
.input-form {
    background: var(--surface-color);
    padding: 3rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    max-width: 600px;
    margin: 0 auto;
    width: 100%;
}
.form-group { margin-bottom: 1.5rem; width: 100%; }
.form-group label { font-weight: 700; margin-bottom: 0.8rem; display: block; color: var(--text-color); font-size: 1.1rem; }
input, select {
    width: 100%; padding: 14px; border: 1px solid #ddd; border-radius: 12px;
    font-size: 1rem; height: 52px; background: #fff; color: var(--text-color); margin-bottom: 0;
}
.date-row { display: flex; gap: 10px; width: 100%; flex-wrap: wrap; }
.date-row > div { flex: 1; min-width: 120px; }

.date-select-group {
    display: flex;
    gap: 10px;
    width: 100%;
    margin-bottom: 12px;
}

.date-select-group select {
    flex: 1;
    padding: 14px;
    border: 1px solid #ddd;
    border-radius: 12px;
    font-size: 1rem;
    height: 52px;
    background: #fff;
    color: var(--text-color);
}

.date-select-group select:first-child {
    flex: 2;
}

.date-select-group select:nth-child(2),
.date-select-group select:nth-child(3) {
    flex: 1;
}

.radio-group {
    display: flex;
    gap: 20px;
    margin-top: 12px;
    align-items: center;
}

.radio-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    cursor: pointer;
    margin: 0;
}

.radio-group input[type="radio"] {
    width: 20px;
    height: 20px;
    margin: 0;
    cursor: pointer;
}

.primary-btn {
    width: 100%; padding: 16px; background: var(--primary-color); color: white; border: none;
    border-radius: 16px; font-size: 1.1rem; font-weight: 800; cursor: pointer; margin-top: 1rem;
}

/* Game Styles */
.game-tabs { display: flex; justify-content: center; gap: 15px; margin-bottom: 2rem; flex-wrap: wrap; }
.game-tab {
    padding: 12px 30px; background: var(--surface-color); border: 1px solid rgba(0,0,0,0.1);
    border-radius: 30px; cursor: pointer; font-weight: bold; color: var(--text-secondary);
    transition: all 0.2s; font-size: 1.1rem;
}
.game-tab.active { background: var(--primary-color); color: white; border-color: transparent; }
.game-content { width: 100%; }
.game-card {
    background: var(--surface-color); padding: 3rem; border-radius: var(--radius-lg);
    text-align: center; box-shadow: var(--shadow-soft); width: 100%; max-width: 900px; margin: 0 auto;
}

/* Cookie Game */
.cookie-stage { margin: 2rem 0; cursor: pointer; perspective: 1000px; display: inline-block; position: relative; width: 300px; height: 300px; }
.cookie-img { font-size: 8rem; transition: transform 0.5s; display: block; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); cursor: pointer; filter: drop-shadow(0 10px 15px rgba(0,0,0,0.2)); }
.cookie-open .cookie-img { transform: translate(-50%, -50%) scale(1.2) rotate(20deg); opacity: 0; }
.cookie-msg {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%) scale(0);
    font-size: 1.3rem; color: var(--primary-dark); font-weight: bold;
    padding: 2rem; background: #fff; border-radius: 15px; border: 3px solid var(--primary-color);
    opacity: 0; transition: all 0.5s 0.2s; width: 100%; box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    z-index: 10; pointer-events: none;
}
.cookie-open .cookie-msg { transform: translate(-50%, -50%) scale(1); opacity: 1; pointer-events: auto; }

/* Tarot Game */
#tarot-stage {
    min-height: 700px;
    position: relative;
    perspective: 1000px;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    padding: 20px 0;
    gap: 60px;
}

.tarot-grid {
    display: grid; grid-template-columns: repeat(6, 1fr); gap: 15px;
    justify-content: center; margin: 2rem auto; width: 100%;
}

/* TarotSystem - 새로운 타로 시스템 */
.tarot-deck-container {
    position: relative;
    bottom: auto;
    left: auto;
    transform: none;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 15px;
    width: fit-content;
    max-width: 95%;
    padding: 20px;
    z-index: 20;
    justify-content: center;
    justify-items: center;
    margin: auto auto 0 auto;
    transform-style: preserve-3d;
}

.tarot-card {
    width: 130px;
    aspect-ratio: 2/3;
    background: transparent;
    border-radius: 12px;
    cursor: pointer;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s, box-shadow 0.3s;
    box-shadow: 0 10px 20px rgba(0,0,0,0.3);
}
.tarot-card:hover { transform: translateY(-15px); box-shadow: 0 15px 30px rgba(0,0,0,0.4); }
.tarot-card.flipped { transform: rotateY(180deg); }
.tarot-card.selected { cursor: default; box-shadow: none; }

/* 카드 뒷면 (선택 전 보이는 면) - 나노바나나 스타일 (정밀한 기하학적 패턴) */
.tarot-front {
    position: absolute; inset: 0; backface-visibility: hidden; border-radius: 12px;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    overflow: hidden;
    
    background-color: #1a1a2e;
    background-image: 
        repeating-linear-gradient(45deg, rgba(184, 134, 11, 0.2) 0px, rgba(184, 134, 11, 0.2) 2px, transparent 2px, transparent 10px),
        repeating-linear-gradient(-45deg, rgba(184, 134, 11, 0.2) 0px, rgba(184, 134, 11, 0.2) 2px, transparent 2px, transparent 10px),
        linear-gradient(0deg, rgba(0,0,0,0.2) 50%, transparent 50%),
        linear-gradient(90deg, rgba(0,0,0,0.2) 50%, transparent 50%);
    background-size: 20px 20px, 20px 20px, 10px 10px, 10px 10px;
    
    border: 4px double #b8860b;
    box-shadow: inset 0 0 15px rgba(0,0,0,0.9);
}

.tarot-front::after {
    content: '✵';
    font-size: 4rem;
    color: #ffd700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.7);
    opacity: 0.8;
}

.tarot-front span { display: none; }

/* 카드 앞면 (이미지 면) */
.tarot-back {
    position: absolute; inset: 0; backface-visibility: hidden; border-radius: 12px;
    background: white; transform: rotateY(180deg); color: #333;
    padding: 0; border: none;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.tarot-slots {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 30px;
    position: relative;
    top: auto;
    left: auto;
    width: 100%;
    z-index: 5;
    margin-top: 40px;
    pointer-events: none;
    flex-shrink: 0;
    min-height: 200px;
}

.tarot-slot {
    width: 130px;
    aspect-ratio: 2/3;
    position: relative;
    visibility: hidden;
    flex-shrink: 0;
}

/* Mobile Responsive - 최적화 */
@media (max-width: 900px) {
    .app-container { padding: 1rem 0.8rem; }
    .app-header {
        padding: 0.5rem 0.8rem;
        height: auto;
        min-height: 60px;
        flex-wrap: wrap;
        gap: 8px;
    }

    .logo a {
        font-size: 1.2rem;
    }

    .header-buttons {
        gap: 6px;
        margin-left: 6px;
    }

    .header-btn {
        width: 36px;
        height: 36px;
        font-size: 0.9rem;
    }

    .header-nav {
        width: 100%;
        margin-top: 6px;
        order: 3;
        overflow-x: auto;
        padding: 0 0 6px 0;
        justify-content: flex-start;
        -webkit-overflow-scrolling: touch;
    }

    .nav-list {
        width: max-content;
        gap: 8px;
        padding: 0 10px;
        margin: 0;
        flex-direction: row; /* 가로 배치 유지 */
    }

    .nav-item {
        flex-shrink: 0;
        height: auto;
    }

    .nav-link {
        font-size: 0.9rem;
        padding: 8px 12px;
        white-space: nowrap;
    }

    /* 모바일에서 드롭다운 클릭 시 표시 */
    .nav-item.active .dropdown-menu {
        visibility: visible;
        opacity: 1;
        position: absolute;
        display: flex;
        flex-direction: column;
        pointer-events: auto;
    }

    .dropdown-menu {
        position: absolute;
        top: 100%;
        left: 50%;
        transform: translateX(-50%);
        margin-top: 0px;
        min-width: 160px;
        width: auto;
        margin-left: 0;
    }

    .dropdown-item {
        padding: 10px 20px;
        text-align: left;
        width: 100%;
        white-space: nowrap;
    }

    .home-split-layout { 
        flex-direction: column; 
        gap: 20px; 
    }
    
    .home-left-visual { 
        min-height: 350px;
        background-position: center 20%;
        padding: 2rem 1.5rem; 
        background-attachment: scroll; 
    }
    .visual-title { font-size: 2rem; }
    
    .home-right-menu { 
        grid-template-columns: repeat(2, 1fr); 
    }
    
    .game-card { padding: 1.5rem; }
    
    .tarot-deck-container { 
        grid-template-columns: repeat(4, 1fr);
        gap: 8px; 
        width: 100%;
        margin-bottom: 20px;
        bottom: auto;
        top: auto;
        transform: none;
        max-width: 600px;
    }
    .tarot-card, .tarot-slot {
        width: 25vw;
        max-width: 100px;
        min-width: 60px;
    }
    
    #tarot-stage {
        min-height: 600px;
        gap: 30px;
    }
    .tarot-slots { 
        gap: 15px; 
        margin-top: 20px;
        min-height: 150px;
    }
}

/* MBTI & Result Styles */
#mbti-result, #result-area {
    width: 100%;
    max-width: 800px;
    margin: 2rem auto;
}

.mbti-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.mbti-card {
    background: var(--surface-color);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    border: 1px solid rgba(0,0,0,0.05);
}

@media (max-width: 600px) {
    .tarot-deck-container { 
        grid-template-columns: repeat(4, 1fr); 
        gap: 6px;
        padding: 5px;
    }
    .tarot-card, .tarot-slot { 
        width: 28vw;
        max-width: 90px;
        border-radius: 6px;
    }
    .tarot-slots { 
        gap: 10px; 
        margin-top: 20px;
        min-height: 130px;
    }
    .tarot-front { border-width: 1px; }
    .tarot-front::after { font-size: 2rem; }
    
    .visual-title { font-size: 1.8rem; }
    .visual-desc { font-size: 1rem; }
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }/* Lucide Icons & Expert Styling */
.menu-icon-wrapper {
    background: linear-gradient(135deg, #fff 0%, #f0f0f0 100%);
    width: 70px;
    height: 70px;
    border-radius: 24px; /* More soft square like an app icon */
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 1.2rem;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 2px solid rgba(255, 215, 0, 0.3); /* Gold border */
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
}

.menu-card:hover .menu-icon-wrapper {
    transform: translateY(-5px) scale(1.1);
    background: linear-gradient(135deg, #FFD700 0%, #FFA000 100%); /* Gold Gradient */
    box-shadow: 0 10px 20px rgba(255, 160, 0, 0.4);
    border-color: white;
}

.menu-icon-lucide {
    color: #555;
    width: 32px;
    height: 32px;
    transition: all 0.3s;
    stroke-width: 1.5;
}

.menu-card:hover .menu-icon-lucide {
    color: white;
    stroke-width: 2;
}

/* Guide Page Styling */
.guide-section {
    background: var(--surface-color);
    padding: 3rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    margin-bottom: 2.5rem;
    transition: transform 0.3s ease;
    border: 1px solid rgba(0,0,0,0.03);
}

.guide-section:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0,0,0,0.08);
}

.guide-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid rgba(0,0,0,0.05);
}

.guide-icon-box {
    width: 50px;
    height: 50px;
    background: rgba(33, 150, 243, 0.1);
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--primary-color);
}

.guide-icon-lucide {
    width: 24px;
    height: 24px;
    color: var(--primary-dark);
    stroke-width: 2;
}

.guide-title {
    font-size: 1.6rem;
    color: var(--text-color);
    margin: 0;
    letter-spacing: -0.5px;
}

.element-card {
    background: var(--surface-color);
    padding: 1.8rem;
    border-radius: 15px;
    border: 1px solid rgba(0,0,0,0.05);
    transition: all 0.3s;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.element-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.08);
}

/* Element Colors for Element Cards */
.element-card i { margin-right: 5px; }

/* Enhanced Typography */
h1, h2, h3, h4 {
    letter-spacing: -0.03em;
}

.visual-title {
    font-family: 'Pretendard', sans-serif;
    letter-spacing: -0.04em;
    line-height: 1.1;
}

/* Floating Animation for Menu Icons */
@keyframes floatIcon {
    0% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
    100% { transform: translateY(0); }
}

.menu-card .menu-icon-wrapper {
    animation: floatIcon 6s ease-in-out infinite;
    animation-play-state: paused;
}

.menu-card:hover .menu-icon-wrapper {
    animation-play-state: running;
}
