:root {
    /* Dark Mode (Default) */
    --bg-color: #000000;
    --container-bg: rgba(28, 28, 30, 0.85);
    --text-color: #ffffff;
    --text-muted: #b0b0b8;
    --accent-color: #ff4757;
    --accent-secondary: #54a0ff;
    --card-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.6);
    --border-color: rgba(255, 255, 255, 0.14);
    --btn-shadow: 0 4px 15px rgba(255, 71, 87, 0.4);
    --header-bg: rgba(15, 15, 17, 0.9);
    --fill-track: rgba(255, 255, 255, 0.08);
}

[data-theme="light"] {
    /* Light Mode */
    --bg-color: #f4f5f7;
    --container-bg: #ffffff;
    --text-color: #1a1a1a;
    --text-muted: #5a5a66;
    --accent-color: #e84118;
    --accent-secondary: #2e86de;
    --card-shadow: 0 8px 30px 0 rgba(0, 0, 0, 0.08);
    --border-color: rgba(0, 0, 0, 0.1);
    --btn-shadow: 0 4px 15px rgba(232, 65, 24, 0.2);
    --header-bg: rgba(255, 255, 255, 0.92);
    --fill-track: rgba(0, 0, 0, 0.05);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    font-family: 'Pretendard', 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
    margin: 0;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.7;
    transition: background-color 0.4s ease, color 0.4s ease;
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(255, 71, 87, 0.05) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(84, 160, 255, 0.05) 0%, transparent 40%);
}

/* ===================== 헤더 ===================== */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--header-bg);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
}

.nav-inner {
    max-width: 960px;
    margin: 0 auto;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo {
    font-weight: 800;
    font-size: 1.1em;
    color: var(--text-color);
    text-decoration: none;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-logo-img {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.main-nav {
    display: flex;
    gap: 18px;
    margin-left: auto;
    flex-wrap: wrap;
}

.main-nav a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.95em;
    font-weight: 600;
    transition: color 0.2s ease;
}

.main-nav a:hover { color: var(--accent-color); }

#theme-btn {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 38px;
    height: 38px;
    font-size: 18px;
    cursor: pointer;
    color: var(--text-color);
    flex-shrink: 0;
    transition: all 0.3s ease;
}

#theme-btn:hover { background-color: var(--border-color); transform: scale(1.1); }

/* ===================== 레이아웃 ===================== */
main {
    max-width: 960px;
    margin: 0 auto;
    padding: 30px 20px 60px;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95em;
    padding: 8px 14px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    transition: all 0.25s ease;
}

.back-link:hover {
    color: var(--accent-color);
    border-color: var(--accent-color);
    transform: translateX(-3px);
}

.hero {
    text-align: center;
    padding: 40px 0 20px;
}

h1 {
    font-size: 2.8em;
    font-weight: 800;
    letter-spacing: -1.5px;
    margin: 10px 0 16px;
}

.lead {
    max-width: 640px;
    margin: 0 auto 28px;
    color: var(--text-muted);
    font-size: 1.1em;
}

.card {
    background-color: var(--container-bg);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    box-shadow: var(--card-shadow);
    padding: 32px;
    margin-top: 40px;
    overflow: hidden;
}

h2 {
    font-size: 1.8em;
    font-weight: 800;
    margin: 0 0 12px;
    letter-spacing: -0.5px;
}

.section-desc {
    color: var(--text-muted);
    margin-bottom: 24px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.section-header h2 { margin: 0; }

/* 도구 페이지의 메인 제목(h1)을 섹션 헤더 크기에 맞춤 (히어로 h1과 구분) */
.card h1 {
    font-size: 1.8em;
    font-weight: 800;
    margin: 0 0 12px;
    letter-spacing: -0.5px;
}
.section-header h1 { margin: 0; }

/* FAQ 목록 */
.faq-list { margin-top: 8px; }
.faq-q { font-weight: 700; margin: 14px 0 4px; }
.faq-a { color: var(--text-muted); margin: 0 0 8px; }

/* 야매 레시피 — 준비 중 배지 */
.coming-badge { background: var(--text-muted); }

/* 야매 정신 강조 박스 */
.yamae-note {
    margin: 24px 0;
    padding: 20px 22px;
    border-radius: 16px;
    border: 2px dashed var(--accent-color);
    background: var(--fill-track);
}
.yamae-note h2 { font-size: 1.2em; margin: 0 0 10px; }
.yamae-list { margin: 0; padding-left: 20px; }
.yamae-list li { margin: 8px 0; color: var(--text-muted); }
.yamae-list strong { color: var(--text-color); }

/* 커밍순 플레이스홀더 */
.coming-soon {
    text-align: center;
    padding: 40px 20px;
    border-radius: 20px;
    border: 2px dashed var(--border-color);
    background: var(--fill-track);
    box-shadow: inset 0 0 20px rgba(0,0,0,0.1);
}
.coming-soon .icon { font-size: 4em; display: block; margin-bottom: 12px; }
.coming-title { font-size: 1.3em; font-weight: 800; margin: 0 0 8px; }
.coming-desc { color: var(--text-muted); margin: 0; }

.menu-count-badge {
    background: var(--accent-secondary);
    color: #fff;
    padding: 6px 14px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.85em;
    white-space: nowrap;
}

/* ===================== 툴 허브 (대시보드) ===================== */
.tool-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    max-width: 600px;
    margin: 30px auto 0;
}

.tool-card {
    background: var(--container-bg);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 24px;
    text-decoration: none;
    color: var(--text-color);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.tool-card:hover {
    transform: translateY(-8px);
    border-color: var(--accent-color);
    box-shadow: 0 12px 24px rgba(255, 71, 87, 0.15);
}

.tool-icon { font-size: 2.5em; }

.tool-card h3 { margin: 0; font-size: 1.15em; font-weight: 700; }
.tool-card p { margin: 0; font-size: 0.85em; color: var(--text-muted); }

/* ===================== 공통 액션 영역 ===================== */
.action-area {
    display: flex;
    justify-content: center;
    margin: 20px 0;
}

button {
    font-family: inherit;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

/* ===================== 로또 번호 생성기 ===================== */
.mode-selector {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.mode-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: var(--container-bg);
    border: 2px solid var(--border-color);
    border-radius: 14px;
    padding: 14px 20px;
    color: var(--text-color);
    font-weight: 700;
    font-size: 1.05em;
    min-width: 140px;
}

.mode-btn span {
    font-size: 0.78em;
    font-weight: 500;
    color: var(--text-muted);
}

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

.mode-btn.active {
    border-color: var(--accent-color);
    box-shadow: var(--btn-shadow);
    background: linear-gradient(180deg, rgba(255,71,87,0.12), transparent);
}

.mode-desc {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.95em;
    min-height: 1.4em;
    margin: 4px 0 20px;
}

#generate-btn {
    background-color: var(--accent-color);
    color: white;
    padding: 15px 40px;
    font-size: 1.15em;
    font-weight: bold;
    box-shadow: var(--btn-shadow);
}

#generate-btn:hover {
    transform: translateY(-3px);
    filter: brightness(1.08);
    box-shadow: 0 8px 25px rgba(255, 71, 87, 0.5);
}

#numbers-container {
    margin-top: 28px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

.number-set {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* ===================== 볼 (Lotto Balls) ===================== */
.number-set span,
.draw-balls span,
.mini-balls span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.2);
    font-weight: bold;
    color: #fff;
    font-size: 1.1em;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

.number-set span {
    animation: number-appear 0.5s ease-out forwards;
    opacity: 0;
    transform: scale(0.5);
}

.ball-1-10  { background: radial-gradient(circle at 30% 30%, #fbc531, #e1b12c) !important; color: #000 !important; }
.ball-11-20 { background: radial-gradient(circle at 30% 30%, #487eb0, #40739e) !important; }
.ball-21-30 { background: radial-gradient(circle at 30% 30%, #e84118, #c23616) !important; }
.ball-31-40 { background: radial-gradient(circle at 30% 30%, #7f8c8d, #2f3640) !important; }
.ball-41-45 { background: radial-gradient(circle at 30% 30%, #4cd137, #44bd32) !important; }

/* ===================== 로또 서브 섹션 (Details) ===================== */
.lotto-sub-sections { margin-top: 30px; }

details {
    border: 1px solid var(--border-color);
    border-radius: 14px;
    margin-bottom: 12px;
    background: var(--fill-track);
    transition: all 0.3s ease;
}

details[open] { background: var(--container-bg); }

summary {
    padding: 16px 20px;
    cursor: pointer;
    font-weight: 700;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

summary::after {
    content: '↓';
    font-size: 0.9em;
    transition: transform 0.3s ease;
}

details[open] summary::after { transform: rotate(180deg); }

.details-content, .guide-content { padding: 0 20px 20px; }

/* ===================== 식사 메뉴 추천 ===================== */
.meal-recommender-ui {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

.meal-display {
    width: 100%;
    max-width: 400px;
    aspect-ratio: 4/3;
    background: var(--fill-track);
    border-radius: 20px;
    border: 2px dashed var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.1);
}

.meal-placeholder {
    text-align: center;
    color: var(--text-muted);
}

.meal-placeholder .icon { font-size: 4em; display: block; margin-bottom: 10px; }

/* 추천 결과 — 글자만 강조 표시 */
.meal-result {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 16px;
    text-align: center;
}

.meal-cat-badge {
    display: inline-block;
    padding: 5px 16px;
    border-radius: 30px;
    background: var(--fill-track);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    font-weight: 700;
    font-size: 0.95em;
    animation: drop-in 0.4s ease both;
}

.meal-highlight-name {
    font-size: 2.4em;
    font-weight: 900;
    line-height: 1.2;
    margin: 6px 0;
    background: linear-gradient(135deg, #ff4757, #ffa502, #2ed573, #54a0ff);
    background-size: 300% 300%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: pop-out 0.7s cubic-bezier(0.18, 1.25, 0.4, 1.4) both, shine 3s ease infinite 0.7s;
}

.meal-sub {
    color: var(--accent-color);
    font-weight: 700;
    margin: 4px 0 0;
    animation: drop-in 0.4s ease 0.25s both;
}

.meal-placeholder .icon.spin {
    animation: rotate 1.5s infinite linear;
    display: block;
}

.meal-image-container {
    flex: 1;
    overflow: hidden;
    position: relative;
}

.meal-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.meal-result:hover img { transform: scale(1.05); }

.meal-info {
    padding: 15px;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(8px);
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    color: white;
    text-align: center;
}

.meal-name {
    font-size: 1.4em;
    font-weight: 800;
    margin: 0;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

#recommend-meal-btn {
    background-color: var(--accent-secondary);
    color: white;
    padding: 15px 40px;
    font-size: 1.15em;
    font-weight: bold;
    box-shadow: 0 4px 15px rgba(84, 160, 255, 0.4);
}

#recommend-meal-btn:hover {
    transform: translateY(-3px);
    filter: brightness(1.08);
    box-shadow: 0 8px 25px rgba(84, 160, 255, 0.5);
}

/* ===================== 최근 당첨번호 그리드 ===================== */
.recent-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
    margin-top: 10px;
}

.draw-item {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 14px 16px;
    background: var(--fill-track);
}

.draw-head {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 0.9em;
}

.draw-balls {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.draw-balls span, .mini-balls span {
    width: 38px;
    height: 38px;
    font-size: 0.95em;
}

.plus-sign {
    color: var(--text-muted);
    font-size: 1.1em;
    margin: 0 4px;
}

/* ===================== 출현 통계 차트 ===================== */
.freq-chart {
    display: grid;
    grid-template-columns: repeat(15, 1fr);
    gap: 6px;
    margin: 20px 0;
}

.freq-bar {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.freq-count { font-size: 0.7em; color: var(--text-muted); }

.freq-fill-wrap {
    width: 100%;
    height: 80px;
    display: flex;
    align-items: flex-end;
    background: var(--fill-track);
    border-radius: 4px;
    overflow: hidden;
}

.freq-fill {
    width: 100%;
    min-height: 2px;
    transition: height 0.6s ease;
}

.freq-label { font-size: 0.72em; color: var(--text-muted); }

.hotcold-summary {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 10px;
}

.summary-box {
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 16px;
    text-align: center;
}

.summary-box h3 { margin: 0 0 12px; font-size: 1.05em; }

/* ===================== 가이드 / 표 ===================== */
.info-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 12px;
    font-size: 0.9em;
}

.info-table th, .info-table td {
    border: 1px solid var(--border-color);
    padding: 10px;
    text-align: center;
}

.info-table th { background: var(--fill-track); }

.mt-10 { margin-top: 10px; }

/* ===================== 폼 ===================== */
.partnership-form { margin-top: 20px; }
.form-group { margin-bottom: 15px; }

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 14px 18px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background-color: var(--fill-track);
    color: var(--text-color);
    font-size: 1em;
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 12px rgba(255, 71, 87, 0.2);
}

.form-group textarea { height: 120px; resize: none; }

#submit-btn {
    width: 100%;
    background-color: transparent;
    border: 1px solid var(--accent-color);
    color: var(--text-color);
    padding: 14px;
    font-weight: 700;
}

#submit-btn:hover { background-color: var(--accent-color); color: white; box-shadow: var(--btn-shadow); }

/* ===================== 푸터 ===================== */
.site-footer {
    border-top: 1px solid var(--border-color);
    padding: 40px 20px;
    text-align: center;
    background: var(--header-bg);
}

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

.footer-nav a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9em;
    font-weight: 600;
}

.footer-disclaimer {
    max-width: 600px;
    margin: 0 auto 10px;
    font-size: 0.8em;
    color: var(--text-muted);
}

.copyright { font-size: 0.8em; color: var(--text-muted); }

/* ===================== 애니메이션 ===================== */
@keyframes number-appear {
    0%   { opacity: 0; transform: scale(0.5) translateY(20px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

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

@keyframes rotate { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

@keyframes pop-out {
    0%   { transform: scale(0.2) rotate(-6deg); opacity: 0; filter: blur(8px); }
    60%  { transform: scale(1.18) rotate(2deg); opacity: 1; filter: blur(0); }
    80%  { transform: scale(0.94) rotate(-1deg); }
    100% { transform: scale(1) rotate(0deg); }
}

@keyframes drop-in {
    from { transform: translateY(-12px); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}

@keyframes shine {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* ===================== 반응형 ===================== */
@media (max-width: 680px) {
    h1 { font-size: 2.2em; }
    .tool-grid { grid-template-columns: 1fr; }
    .card { padding: 24px; }
    .nav-inner { flex-wrap: wrap; }
    .main-nav { gap: 12px; width: 100%; order: 3; margin-left: 0; justify-content: center; }
    .freq-chart { grid-template-columns: repeat(9, 1fr); }
    .hotcold-summary { grid-template-columns: 1fr; }
    .number-set span { width: 42px; height: 42px; }
}
