:root {
    --bg-dark: #0f172a;
    --bg-darker: #020617;
    --primary-glow: #8b5cf6;
    --secondary-glow: #ec4899;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
}

/* 테마별 색상 변수 오버라이드 (새로운 해시태그 테마) */
body.theme-money {
    --bg-dark: #3f2e08;
    --bg-darker: #1a1303;
    --primary-glow: #fbbf24;
    --secondary-glow: #f59e0b;
}
body.theme-quit {
    --bg-dark: #450a0a;
    --bg-darker: #170303;
    --primary-glow: #ef4444;
    --secondary-glow: #dc2626;
}
body.theme-healing {
    --bg-dark: #064e3b;
    --bg-darker: #022c22;
    --primary-glow: #10b981;
    --secondary-glow: #059669;
}
body.theme-nothing {
    --bg-dark: #1e293b;
    --bg-darker: #0f172a;
    --primary-glow: #94a3b8;
    --secondary-glow: #cbd5e1;
}

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

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: 'Outfit', 'Noto Sans KR', sans-serif;
    overflow-x: hidden; /* 가로 스크롤만 방지 */
    scroll-behavior: smooth; /* 최신 브라우저용 부드러운 스크롤 */
}

/* --- 공통 레이아웃 --- */
#app {
    width: 100%;
    max-width: 600px;
    min-height: 100vh;
    min-height: 100svh;
    display: flex;
    flex-direction: column;
    position: relative; /* 하단 푸터 겹침 방지 복원 */
    margin: 0 auto; /* 중앙 정렬 복원 */
}

main { width: 100%; }

.site-header {
    width: 100%; display: flex; justify-content: space-between; align-items: center;
    gap: 14px; padding: 16px; border-bottom: 1px solid rgba(255,255,255,0.1);
    background: rgba(2,6,23,0.76);
}
.site-brand { color: #fff; text-decoration: none; font-size: 1.05rem; font-weight: 700; white-space: nowrap; }
.site-nav { display: flex; align-items: center; justify-content: flex-end; gap: 12px; }
.site-nav a { color: #cbd5e1; text-decoration: none; font-size: 0.82rem; }
.site-nav a:hover, .site-nav a:focus-visible, .site-nav a[aria-current="page"] { color: #fff; text-decoration: underline; text-underline-offset: 4px; }
.presented-by { margin-bottom: 1rem; color: var(--primary-glow); font-size: 0.9rem; font-weight: 500; text-align: center; }
.action-container { width: 100%; margin-top: 2rem; text-align: center; }
.action-container p { margin-bottom: 1rem; color: var(--text-muted); font-size: 0.95rem; line-height: 1.6; }
.action-container .btn { width: 100%; padding: 1rem 1.5rem; font-size: 1.05rem; }
.integrated-terminal { width: 100%; margin-top: 1.5rem; }
.terminal-intro { margin-bottom: 0.5rem; }
.integrated-terminal .terminal-container { margin-top: 0; }
.integrated-terminal #stage1-action { margin-top: 1.5rem; }
.integrated-terminal #stage1-action .btn { width: 100%; }

.stage {
    display: none; 
    width: 100%; 
    min-height: 100vh;
    min-height: 100svh;
    flex-direction: column;
    align-items: center;
    justify-content: center; /* 맥에서 상단으로 쏠리는 현상 방지용 중앙 정렬 복구 */
    padding: 2rem 1rem 3rem;
    box-sizing: border-box; /* 패딩 포함 크기 계산 (스크롤 넘침 방지) */
}

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

.stage.active {
    display: flex; 
}

/* 타이틀 */
.title {
    font-size: 2.5rem; font-weight: 700;
    margin-bottom: 0.5rem; text-align: center;
    background: linear-gradient(to right, #fff, var(--primary-glow));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.subtitle {
    font-size: 1rem; color: var(--text-muted);
    text-align: center; margin-bottom: 2rem; line-height: 1.5;
}

/* 트렌드 상단 컨테이너 */
.trend-container {
    text-align: center;
    margin-bottom: 1.5rem;
    padding: 1.5rem;
    background: rgba(0,0,0,0.3);
    border-radius: 15px;
    border: 1px solid rgba(255,255,255,0.1);
    width: 100%;
}
.trend-label {
    font-size: 1rem;
    color: #ef4444; 
    font-weight: 700;
    margin-bottom: 0.5rem;
}
.trend-keyword {
    font-size: 2rem;
    font-weight: 900;
    margin-bottom: 0.5rem;
    color: #fff;
    text-shadow: 0 0 15px rgba(255,255,255,0.3);
}
.trend-desc {
    font-size: 0.9rem;
    color: var(--text-muted);
}
.divider {
    width: 100%;
    border: 0;
    height: 1px;
    background: rgba(255,255,255,0.1);
    margin-bottom: 1.5rem;
}
.mbti-guide {
    text-align: center;
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: #e2e8f0;
}

/* 0단계: 테마 선택 버튼 그리드 */
.theme-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    padding: 0 10px;
}

.mbti-btn {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 30px; /* 알약 형태 */
    padding: 15px 25px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    cursor: pointer;
    transition: all 0.3s;
    color: white;
}
.mbti-btn:hover {
    background: rgba(255,255,255,0.15);
    transform: translateX(5px);
    border-color: var(--primary-glow);
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}
.mbti-btn .icon { font-size: 1.8rem; margin-right: 15px; }
.mbti-btn .theme-name { font-size: 1.2rem; font-weight: 700; }
.mbti-btn .theme-desc { display: none; }

/* 1단계: 동적 인터랙션 영역 */
.interaction-area {
    position: relative;
    width: 100%;
    height: 250px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 2rem;
    perspective: 1000px;
}

/* 테마별 UI 요소들 (JS에서 클래스 추가로 주입) */
/* 우주 구슬 (기본) */
.orb-core {
    width: 120px; height: 120px; border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #fff, var(--primary-glow));
    box-shadow: 0 0 30px var(--primary-glow);
    cursor: pointer; transition: transform 0.1s;
    touch-action: none; 
}
.orb-core:active, .orb-core.charging { transform: scale(0.95); box-shadow: 0 0 50px var(--secondary-glow); }

/* 새 테마별 상호작용 UI 요소들 */
.gold-coin {
    width: 120px; height: 120px;
    background: linear-gradient(45deg, #f59e0b, #fbbf24, #fcd34d);
    border-radius: 50%;
    display: flex; justify-content: center; align-items: center;
    font-size: 4rem;
    box-shadow: 0 10px 25px rgba(245, 158, 11, 0.5), inset 0 5px 15px rgba(255,255,255,0.8);
    border: 5px solid #b45309;
    cursor: pointer; transition: transform 0.1s;
}
.gold-coin:active { transform: scale(0.9) rotateY(20deg); box-shadow: 0 5px 15px rgba(245, 158, 11, 0.5); }

.resign-letter {
    width: 120px; height: 160px;
    background: white; color: black;
    border-radius: 5px;
    display: flex; justify-content: center; align-items: center;
    font-size: 1.5rem; font-weight: bold;
    box-shadow: 0 5px 15px rgba(255,255,255,0.2);
    border-top: 20px solid #ef4444;
    cursor: pointer; transition: transform 0.1s;
}
.resign-letter:active { transform: scale(0.9) rotate(5deg); }

.healing-aura {
    width: 120px; height: 120px;
    border-radius: 50%;
    display: flex; justify-content: center; align-items: center;
    font-size: 4rem;
    background: radial-gradient(circle at 50% 50%, rgba(16, 185, 129, 0.2), transparent);
    box-shadow: 0 0 30px rgba(16, 185, 129, 0.5);
    cursor: pointer; transition: transform 0.1s;
}
.healing-aura.charging { transform: scale(1.2); box-shadow: 0 0 60px rgba(16, 185, 129, 0.8); }

.tap-hint {
    position: absolute;
    top: 10px;
    font-size: 1.1rem;
    color: #fcd34d;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(0,0,0,0.8);
    pointer-events: none;
}
.pulse-text {
    animation: pulse 1s infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.1); }
}

/* 프로그레스 바 */
.progress-wrapper { width: 80%; display: flex; flex-direction: column; align-items: center; }
.progress-bar-container { width: 100%; height: 8px; background-color: rgba(255,255,255,0.1); border-radius: 4px; overflow: hidden; margin-bottom: 1rem; }
.progress-bar { width: 0%; height: 100%; background: linear-gradient(90deg, var(--primary-glow), var(--secondary-glow)); transition: width 0.1s ease-out; box-shadow: 0 0 10px var(--secondary-glow); }
#energy-text { font-size: 1.5rem; font-weight: 700; }

/* 2단계: 1~45 전체 번호를 넘겨보는 3개 페이지 */
.selection-mode-tabs {
    display: grid; grid-template-columns: 1fr 1fr; width: 100%; gap: 8px;
    margin-bottom: 1rem; padding: 5px; border-radius: 24px; background: rgba(0,0,0,0.25);
}
.mode-tab, .view-toggle {
    border: 0; border-radius: 20px; padding: 10px 12px; color: var(--text-muted);
    background: transparent; font-weight: 700; cursor: pointer;
}
.mode-tab.active, .view-toggle.active {
    color: #fff; background: linear-gradient(90deg, var(--primary-glow), var(--secondary-glow));
    box-shadow: 0 0 12px rgba(139,92,246,0.3);
}
.selection-panel { display: none; width: 100%; }
.selection-panel.active { display: flex; flex-direction: column; align-items: center; }
.manual-view-toggle {
    display: grid; grid-template-columns: 1fr 1fr; width: 100%; gap: 6px;
    margin-bottom: 0.8rem; padding: 4px; border: 1px solid rgba(255,255,255,0.1); border-radius: 22px;
}
.number-page-guide {
    width: 100%; display: flex; justify-content: center; align-items: center;
    gap: 1rem; margin-bottom: 0.8rem; color: var(--text-muted); font-weight: 700;
}
.page-nav-btn {
    width: 42px; height: 36px; border: 1px solid rgba(255,255,255,0.2);
    border-radius: 18px; background: rgba(255,255,255,0.08); color: #fff;
    font-size: 1.5rem; cursor: pointer;
}
.page-nav-btn:disabled { opacity: 0.25; cursor: default; }
#orb-field {
    position: relative; width: 100%; height: min(52vh, 440px); min-height: 350px;
    flex: 0 0 auto; margin-bottom: 1.5rem; overflow: hidden; touch-action: pan-y;
}
.number-pages-track {
    width: 100%; height: 100%; display: flex;
}
.number-page {
    min-width: 100%; height: 100%; display: grid;
    grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(5, 1fr);
    gap: 12px; padding: 8px 18px; place-items: center;
}
.candidate-orb {
    position: relative; width: 58px; height: 58px; border-radius: 50%;
    background: rgba(255,255,255,0.05); border: 1px solid var(--primary-glow);
    box-shadow: 0 0 15px rgba(0,0,0,0.5);
    display: flex; justify-content: center; align-items: center;
    font-size: 1.2rem; font-weight: 700; color: #fff;
    cursor: pointer; backdrop-filter: none;
    transition: background 0.2s, box-shadow 0.2s, transform 0.15s;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
}
.candidate-orb:hover { background: rgba(255,255,255,0.1); transform: scale(1.06); }
.candidate-orb.selected {
    background: var(--primary-glow); color: #fff;
    box-shadow: 0 0 20px var(--primary-glow); pointer-events: none;
}
.blind-view .candidate-orb:not(.selected) { color: transparent; }

.auto-description { color: var(--text-muted); text-align: center; margin: 0.5rem 0 1rem; }
#auto-games { width: 100%; display: flex; flex-direction: column; gap: 10px; }
.auto-game-row {
    display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px;
    border: 1px solid rgba(255,255,255,0.1); border-radius: 14px; background: rgba(0,0,0,0.2);
}
.auto-game-label { width: 48px; flex: 0 0 auto; color: var(--text-muted); font-size: 0.8rem; font-weight: 700; }
.auto-game-balls { flex: 1; display: flex; justify-content: space-between; gap: 5px; }
.auto-ball {
    width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 700; font-size: 0.9rem; box-shadow: 0 3px 8px rgba(0,0,0,0.35);
    opacity: 1; transform: translateX(0) scale(1);
    transition: opacity 0.32s ease, transform 0.38s cubic-bezier(0.2, 1.5, 0.45, 1);
}
.auto-ball.waiting { opacity: 0; }
.auto-ball.waiting.from-left { transform: translateX(-22px) scale(0.25); }
.auto-ball.waiting.from-right { transform: translateX(22px) scale(0.25); }
.auto-ball.waiting.show { opacity: 1; transform: translateX(0) scale(1); }
.auto-ball.yellow { background: linear-gradient(135deg, #facc15, #eab308); }
.auto-ball.blue { background: linear-gradient(135deg, #60a5fa, #3b82f6); }
.auto-ball.red { background: linear-gradient(135deg, #f87171, #ef4444); }
.auto-ball.gray { background: linear-gradient(135deg, #9ca3af, #6b7280); }
.auto-ball.green { background: linear-gradient(135deg, #34d399, #10b981); }
.auto-actions { display: flex; gap: 10px; margin-top: 1rem; }
.candidate-orb.selected { animation: selectedNumberPop 0.45s cubic-bezier(0.2, 1.5, 0.45, 1); }
@keyframes selectedNumberPop { 0% { transform: scale(0.7); } 60% { transform: scale(1.2); } 100% { transform: scale(1); } }

.lotto-disclaimer {
    margin-top: 1rem; color: #777; font-size: 0.75rem; line-height: 1.4; text-align: center;
}

/* 슬롯 */
.selection-slots { display: flex; gap: 10px; margin-bottom: 2rem; }
.slot {
    width: 45px; height: 45px; border-radius: 50%;
    border: 2px dashed rgba(255,255,255,0.2);
    display: flex; justify-content: center; align-items: center;
    font-size: 1.2rem; font-weight: 700; transition: all 0.3s;
}
.slot.filled { border-style: solid; border-color: var(--primary-glow); background: rgba(255,255,255,0.1); box-shadow: 0 0 10px var(--primary-glow); }

/* 결과 */
.result-container { display: flex; flex-wrap: wrap; justify-content: center; gap: 15px; margin-top: 2rem; margin-bottom: 3rem; }
.result-orb {
    width: 60px; height: 60px; border-radius: 50%; display: flex; justify-content: center; align-items: center;
    font-size: 1.5rem; font-weight: 700; color: #fff; box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) backwards;
}
@keyframes popIn { 0% { transform: scale(0); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }

.action-buttons { display: flex; gap: 15px; margin-bottom: 2rem; }
.btn { padding: 12px 24px; border-radius: 30px; border: none; font-size: 1rem; font-weight: 600; cursor: pointer; transition: transform 0.2s, opacity 0.2s; position: relative; z-index: 1; }
.btn:active { transform: scale(0.95); }
.btn.primary { background: linear-gradient(90deg, var(--primary-glow), var(--secondary-glow)); color: white; }
.btn.secondary { background: rgba(255,255,255,0.1); color: white; border: 1px solid rgba(255,255,255,0.2); }
.btn:hover { opacity: 0.9; }

/* Terminal UI */
.terminal-container {
    background: #0a0a0c;
    border: 1px solid var(--primary-glow);
    border-radius: 8px;
    padding: 1.5rem;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
    text-align: left;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.8);
    margin-top: 1.5rem;
    min-height: 180px;
}
.term-line {
    margin-bottom: 0.5rem;
    opacity: 0;
    animation: fadeInTerm 0.3s forwards;
}
@keyframes fadeInTerm {
    to { opacity: 1; }
}

@media (max-width: 600px) {
    .candidate-orb {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }
}

/* 데스크탑(맥/PC) 전용: 아이폰 주소창 버그와 무관하므로 100vh 완벽 적용하여 중앙 정렬 */
@media (min-width: 600px) {
    #app, .stage {
        min-height: 100vh;
    }
}


/* 애드센스 심사를 위한 서비스 설명 영역 */
.service-info {
    width: 100%; display: grid; gap: 12px; margin: 2rem 0;
}
.info-card {
    padding: 1.1rem; border: 1px solid rgba(255,255,255,0.1); border-radius: 14px;
    background: rgba(0,0,0,0.22); text-align: left;
}
.info-card h2 { margin: 0 0 0.6rem; color: #fff; font-size: 1.05rem; }
.info-card p { margin: 0; color: var(--text-muted); font-size: 0.9rem; line-height: 1.7; }
.info-card h3 { margin: 1rem 0 0.35rem; color: #e2e8f0; font-size: 0.92rem; }
.info-card ol, .info-card ul { margin: 0.4rem 0 0 1.25rem; color: var(--text-muted); font-size: 0.9rem; line-height: 1.75; }
.info-card .card-link { margin-top: 0.75rem; }
.info-card a { color: #9adfff; }

.site-footer {
    width: 100%; padding: 1.4rem 1rem 2rem; border-top: 1px solid rgba(255,255,255,0.1);
    color: #94a3b8; font-size: 0.78rem; line-height: 1.7; text-align: center;
}
.site-footer nav { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px 16px; margin-bottom: 0.5rem; }
.site-footer a { color: #cbd5e1; text-underline-offset: 3px; }

.standalone-page { width: 100%; padding: 2rem 1rem 3rem; }
.standalone-page article { padding: 1.25rem; border: 1px solid rgba(255,255,255,0.1); border-radius: 16px; background: rgba(0,0,0,0.22); text-align: left; }
.standalone-page h1 { margin-bottom: 0.75rem; color: #fff; font-size: clamp(1.75rem, 6vw, 2.35rem); line-height: 1.3; }
.standalone-page .page-lead { margin-bottom: 1.5rem; color: #cbd5e1; line-height: 1.75; }
.standalone-page h2 { margin: 1.8rem 0 0.6rem; color: #fff; font-size: 1.18rem; }
.standalone-page h3 { margin: 1.2rem 0 0.4rem; color: #e2e8f0; font-size: 1rem; }
.standalone-page p, .standalone-page li { color: var(--text-muted); font-size: 0.94rem; line-height: 1.8; }
.standalone-page ul, .standalone-page ol { margin: 0.5rem 0 0 1.3rem; }
.standalone-page a { color: #9adfff; }
.standalone-page .updated { margin-top: 1.5rem; color: #64748b; font-size: 0.8rem; }

@media (max-width: 420px) {
    .site-header { align-items: flex-start; flex-direction: column; gap: 8px; }
    .site-nav { width: 100%; justify-content: space-between; }
    .trend-keyword { font-size: 1.45rem; }
    .auto-game-label { width: 100%; }
    .auto-game-balls { gap: 4px; }
    .auto-ball { width: 32px; height: 32px; font-size: 0.78rem; }
    .selection-slots { gap: 6px; }
    .slot { width: 40px; height: 40px; }
}

@media (prefers-reduced-motion: reduce) {
    html, body { scroll-behavior: auto; }
    *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}


/* 최신 당첨번호 및 자동 5게임 비교 */
.latest-result-card { width:100%; margin:1.5rem 0; padding:1.2rem; border:1px solid rgba(255,255,255,0.12); border-radius:16px; background:rgba(0,0,0,0.28); }
.latest-result-head { display:flex; justify-content:space-between; align-items:flex-start; gap:12px; text-align:left; }
.latest-result-head h2 { margin:5px 0 3px; font-size:1.15rem; color:#fff; }
.latest-result-head p { margin:0; color:var(--text-muted); font-size:0.82rem; }
.latest-result-head a { color:#9adfff; font-size:0.8rem; white-space:nowrap; }
.latest-badge { color:#00ffcc; font-size:0.72rem; font-weight:700; }
.latest-winning-balls { display:flex; align-items:center; justify-content:center; flex-wrap:wrap; gap:7px; margin:1rem 0; }
.winning-ball { width:38px; height:38px; border-radius:50%; display:flex; align-items:center; justify-content:center; color:#fff; font-weight:700; box-shadow:0 3px 8px rgba(0,0,0,.35); }
.winning-ball.yellow { background:linear-gradient(135deg,#facc15,#eab308); } .winning-ball.blue { background:linear-gradient(135deg,#60a5fa,#3b82f6); } .winning-ball.red { background:linear-gradient(135deg,#f87171,#ef4444); } .winning-ball.gray { background:linear-gradient(135deg,#9ca3af,#6b7280); } .winning-ball.bonus { background:linear-gradient(135deg,#a78bfa,#7c3aed); }
.bonus-plus { color:var(--text-muted); font-weight:700; }
.result-caution { margin:0; color:#777; font-size:0.72rem; line-height:1.5; text-align:center; }
.auto-game-row { flex-wrap:wrap; }
.auto-game-result { width:100%; padding-top:6px; border-top:1px solid rgba(255,255,255,.08); color:var(--text-muted); font-size:.78rem; text-align:right; min-height:24px; }
.auto-game-result.prize { color:#00ffcc; font-weight:700; } .auto-game-result.no-prize { color:#999; }
.compare-btn { background:rgba(0,255,204,.13); color:#b9fff1; border:1px solid rgba(0,255,204,.35); }
.auto-actions { flex-wrap:wrap; justify-content:center; }
