:root {
    --bg-color: #f8f9fa;
    --text-color: #2c3e50;
    --card-bg: #ffffff;
    --primary-color: #6c5ce7;
    --accent-color: #a29bfe;
    --ball-bg: #ffd700;
    --ball-text: #333;
    --input-bg: #ffffff;
    --input-border: #dee2e6;
    --shadow: 0 4px 20px rgba(0,0,0,0.08);
    --border-radius: 16px;
}

[data-theme="dark"] {
    --bg-color: #1a1a2e;
    --text-color: #e8e8f0;
    --card-bg: #16213e;
    --primary-color: #a29bfe;
    --accent-color: #6c5ce7;
    --ball-bg: #ff9800;
    --ball-text: #fff;
    --input-bg: #0f3460;
    --input-border: #2d3561;
    --shadow: 0 4px 20px rgba(0,0,0,0.3);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Noto Sans KR', 'Malgun Gothic', 'Segoe UI', sans-serif;
    transition: background-color 0.3s, color 0.3s;
    min-height: 100vh;
}

/* ===== 3컬럼 레이아웃 ===== */
.page-layout {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    min-height: 100vh;
    padding: 16px 0 40px;
    gap: 0;
}

.main-content {
    flex: 1;
    max-width: 560px;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 12px;
}

/* ===== 사이트 헤더 ===== */
.site-header {
    display: none;
}

/* ===== 로고 섹션 ===== */
.logo-section {
    width: 100%;
    margin: 0 0 16px;
    display: flex;
    justify-content: center;
    padding: 0;
}
.site-logo-main {
    width: 100%;
    height: auto;
    display: block;
    box-shadow: var(--shadow);
}

.theme-toggle-btn {
    padding: 6px 14px; font-size: 0.82rem; cursor: pointer;
    background: var(--card-bg); color: var(--text-color);
    border: 1px solid var(--input-border); border-radius: 20px;
    transition: all 0.3s; box-shadow: none; width: auto;
}
.theme-toggle-btn:hover {
    background: var(--primary-color); color: white;
    border-color: var(--primary-color);
}

/* ===== 히어로 컨테이너 ===== */
.hero-container {
    text-align: center;
    background: var(--card-bg);
    padding: 2.5rem 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    width: 100%;
    border: 1px solid rgba(108,92,231,0.1);
}

.hero-icon {
    font-size: 3.5rem;
    margin-bottom: 0.5rem;
    animation: float 3s ease-in-out infinite;
}

.hero-logo {
    margin-bottom: 1rem;
}

.site-logo {
    height: 64px;
    width: auto;
    max-width: 100%;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.hero-container h1 {
    font-size: 1.7rem;
    font-weight: 800;
    color: var(--primary-color);
    margin-bottom: 0.4rem;
    letter-spacing: -0.5px;
}

.hero-subtitle {
    color: var(--text-color);
    opacity: 0.6;
    font-size: 0.88rem;
    margin-bottom: 1.8rem;
}

/* ===== 메뉴 그리드 ===== */
.menu-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
    margin-top: 0;
}

.menu-box { display: flex; }

.menu-btn {
    width: 100%;
    padding: 1.2rem 0.8rem;
    font-size: 1rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    border: none;
    border-radius: 14px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    box-shadow: 0 4px 15px rgba(108,92,231,0.3);
    text-decoration: none;
}

.menu-btn:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(108,92,231,0.45);
}

.menu-btn:active { transform: scale(0.97); }

.menu-icon { font-size: 1.8rem; }
.menu-label { font-size: 1.05rem; font-weight: 800; }
.menu-desc { font-size: 0.72rem; opacity: 0.85; font-weight: 400; }

/* ===== 테마 토글 ===== */
.theme-toggle {
    position: fixed;
    top: 10px;
    right: 16px;
    z-index: 200;
}

.theme-toggle button {
    padding: 8px 16px;
    font-size: 0.85rem;
    cursor: pointer;
    background: var(--card-bg);
    color: var(--text-color);
    border: 1px solid var(--input-border);
    border-radius: 20px;
    transition: all 0.3s;
    box-shadow: var(--shadow);
}

.theme-toggle button:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* ===== 제휴 문의 플로팅 버튼 ===== */
.contact-float-btn {
    position: fixed;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 300;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 0 12px 12px 0;
    padding: 14px 10px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    box-shadow: 3px 0 15px rgba(108,92,231,0.4);
    transition: all 0.3s;
    writing-mode: vertical-rl;
    text-orientation: mixed;
}

.contact-float-btn:hover {
    background: #5a4bd1;
    padding-right: 14px;
    box-shadow: 4px 0 20px rgba(108,92,231,0.6);
}

.contact-float-icon { font-size: 1.1rem; writing-mode: horizontal-tb; }
.contact-float-label { font-size: 0.78rem; font-weight: 700; letter-spacing: 2px; }

/* ===== 슬라이드 패널 오버레이 ===== */
.contact-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 400;
    opacity: 0;
    transition: opacity 0.3s;
}

.contact-overlay.active {
    display: block;
    opacity: 1;
}

/* ===== 슬라이드 패널 ===== */
.contact-panel {
    position: fixed;
    left: -380px;
    top: 0;
    width: 360px;
    max-width: 90vw;
    height: 100vh;
    background: var(--card-bg);
    z-index: 500;
    box-shadow: 4px 0 30px rgba(0,0,0,0.2);
    transition: left 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    padding: 0;
}

.contact-panel.open {
    left: 0;
}

.contact-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.4rem 1.5rem 1rem;
    border-bottom: 1px solid var(--input-border);
    position: sticky;
    top: 0;
    background: var(--card-bg);
    z-index: 1;
}

.contact-panel-header h2 {
    font-size: 1.2rem;
    color: var(--primary-color);
    font-weight: 800;
}

.contact-panel-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--text-color);
    padding: 4px 8px;
    border-radius: 6px;
    transition: background 0.2s;
}

.contact-panel-close:hover { background: var(--input-border); }

/* ===== 제휴 문의 폼 ===== */
.contact-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-color);
}

.form-group input,
.form-group textarea {
    padding: 10px 12px;
    border: 1.5px solid var(--input-border);
    border-radius: 10px;
    background: var(--input-bg);
    color: var(--text-color);
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group textarea {
    min-height: 110px;
    resize: vertical;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(108,92,231,0.15);
}

.contact-submit-btn {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    border: none;
    padding: 12px;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 15px rgba(108,92,231,0.3);
}

.contact-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(108,92,231,0.45);
}

.captcha-group label { font-size: 0.9rem; color: var(--text-color); font-weight: 700; }
.captcha-group input { max-width: 130px; }
.captcha-error { color: #e74c3c; font-size: 0.82rem; margin-top: 4px; display: block; }

/* ===== 공통 버튼 ===== */
button {
    padding: 10px 20px;
    font-size: 1rem;
    cursor: pointer;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    transition: transform 0.1s, background-color 0.3s;
}

button:active { transform: scale(0.97); }

/* ===== 로또 볼 ===== */
.lotto-balls {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin: 20px 0;
    flex-wrap: wrap;
}

.ball {
    width: 50px;
    height: 50px;
    background: var(--ball-bg);
    color: var(--ball-text);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.2rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    animation: popIn 0.3s ease-out;
}

@keyframes popIn {
    0% { transform: scale(0); }
    80% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* ===== 컨테이너 (서브페이지용) ===== */
.container {
    text-align: center;
    background: var(--card-bg);
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin: 0 auto 2rem;
    width: 90%;
    max-width: 500px;
}

/* ===== 서브페이지 body 가운데 정렬 ===== */
body:not(:has(.page-layout)) {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 60px 16px 40px;
}

/* ===== 반응형 ===== */
@media (max-width: 900px) {
    .page-layout { padding: 50px 0 30px; }
}

@media (max-width: 600px) {
    .hero-container { padding: 1.8rem 1.2rem; }
    .hero-container h1 { font-size: 1.4rem; }
    .menu-grid { gap: 10px; }
    .menu-btn { padding: 1rem 0.6rem; }
    .contact-panel { width: 100%; max-width: 100vw; }
}

/* ===== SEO 텍스트 콘텐츠 섹션 ===== */
.seo-content {
    width: 100%;
    max-width: 560px;
    margin: 0 auto;
    padding: 1.5rem 1.2rem;
    background: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    text-align: left;
    font-size: 0.85rem;
    color: var(--text-color);
    opacity: 0.85;
    border-top: 3px solid var(--primary-color);
}

.seo-content h2 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.6rem;
}

.seo-content h3 {
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 0.3rem;
}

.seo-content h3 a {
    color: var(--primary-color);
    text-decoration: none;
}

.seo-content h3 a:hover { text-decoration: underline; }

.seo-content p {
    line-height: 1.7;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.seo-content ul {
    padding-left: 1.2rem;
    margin: 0.5rem 0;
    line-height: 1.8;
}

.seo-content a {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.82rem;
}

.seo-content a:hover { text-decoration: underline; }

.seo-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 0.5rem;
}

/* 타로/사주 페이지의 SEO 섹션 (어두운 배경용) */
.tarro-seo, .saju-seo {
    background: rgba(30, 10, 60, 0.6);
    border-top-color: #f0c040;
    color: #c9a8e8;
    max-width: 800px;
    margin: 1rem auto 0;
}

.tarro-seo h2, .saju-seo h2 { color: #f0c040; }
.tarro-seo p, .saju-seo p { color: #c9a8e8; }
.tarro-seo a, .saju-seo a { color: #f0c040; }

@media (max-width: 600px) {
    .seo-grid { grid-template-columns: 1fr; }
    .seo-content { font-size: 0.8rem; }
}

/* ===== Footer ===== */
.site-footer {
    text-align: center;
    padding: 24px 16px;
    margin-top: 40px;
    border-top: 1px solid rgba(0,0,0,0.08);
    font-size: 0.82rem;
    color: #888;
    line-height: 2;
}
.site-footer a {
    color: #6c63ff;
    text-decoration: none;
    margin: 0 8px;
}
.site-footer a:hover { text-decoration: underline; }
[data-theme="dark"] .site-footer {
    border-top-color: rgba(255,255,255,0.1);
    color: #aaa;
}

/* ===== 다른 서비스 추천 ===== */
.recommend-section {
    width: 100%; margin-top: 1.4rem;
    border-top: 1px solid var(--input-border);
    padding-top: 1.2rem;
}
.recommend-title {
    font-size: 0.78rem; color: #888; text-align: center;
    margin-bottom: 0.8rem; letter-spacing: 0.5px;
}
.recommend-grid {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
}
.recommend-btn {
    display: flex; flex-direction: column; align-items: center; gap: 5px;
    padding: 0.75rem 0.4rem; border-radius: 12px;
    background: var(--card-bg);
    border: 1.5px solid var(--input-border);
    color: var(--text-color); font-size: 0.73rem; font-weight: 600;
    cursor: pointer; text-decoration: none;
    transition: all 0.2s;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}
.recommend-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(108,92,231,0.18);
}
.recommend-btn .rec-icon { font-size: 1.5rem; line-height: 1; }
.recommend-btn .rec-label { line-height: 1.2; text-align: center; }
@media (max-width: 400px) {
    .recommend-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ===== 공유 버튼 (공통) ===== */
.share-buttons { display: flex; gap: 10px; margin: 16px 0; flex-wrap: wrap; }
.share-btn { display: flex; align-items: center; gap: 8px; padding: 10px 18px; border: none; border-radius: 10px; font-size: 0.9rem; font-weight: 600; cursor: pointer; transition: opacity 0.2s; }
.share-kakao { background: #fee500; color: #3c1e1e; }
.share-copy  { background: var(--card-bg); color: var(--text-color); border: 2px solid var(--input-border); }
.share-btn:hover { opacity: 0.85; }
.shared-banner { background: var(--card-bg); border: 1px solid var(--primary-color); border-radius: 10px; padding: 10px 16px; margin-bottom: 16px; font-size: 0.9rem; text-align: center; }

/* ===== 블로그 참고 링크 섹션 ===== */
.blog-ref-section {
    margin: 24px 0 8px;
}

.blog-ref-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--accent-color);
    margin-bottom: 10px;
    letter-spacing: 0.02em;
}

.blog-ref-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--card-bg);
    border: 1px solid var(--input-border);
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 8px;
    text-decoration: none;
    color: var(--text-color);
    transition: border-color 0.2s, transform 0.15s;
}

.blog-ref-item:hover {
    border-color: var(--primary-color);
    transform: translateX(3px);
}

.blog-ref-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.blog-ref-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.blog-ref-text strong {
    font-size: 0.88rem;
    font-weight: 700;
    line-height: 1.3;
}

.blog-ref-text span {
    font-size: 0.78rem;
    opacity: 0.65;
}

.blog-ref-arrow {
    font-size: 0.9rem;
    color: var(--primary-color);
    flex-shrink: 0;
}
