:root {
    --primary-color: #8e44ad;
    --secondary-color: #9b59b6;
    --mystic-gradient: linear-gradient(135deg, #9d50bb 0%, #6e48aa 100%);
    --dark-color: #2c003e;
    --light-color: #f3e5f5;
    --white: #ffffff;
    --card-bg: #ffffff;
    --text-primary: #4a148c;
    --text-secondary: #7b1fa2;
    --border-color: #e1bee7;
    --shadow: 0 5px 20px rgba(157, 80, 187, 0.15);
    --transition: all 0.3s ease;
}

[data-theme="dark"] {
    --light-color: #12001a;
    --white: #1e002e;
    --card-bg: #1e002e;
    --text-primary: #e1bee7;
    --text-secondary: #ce93d8;
    --border-color: #4a148c;
    --dark-color: #f3e5f5;
}

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

body {
    font-family: 'Noto Sans KR', sans-serif;
    background: var(--light-color);
    background-attachment: fixed;
    color: var(--text-primary);
    line-height: 1.4;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 10px; /* 여백 축소 */
    transition: background 0.5s ease;
    overflow-x: hidden;
}

#bg-elements {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}

.floating-icon {
    position: absolute;
    font-size: 1.5rem;
    opacity: 0.1;
    animation: float 20s linear infinite;
}

@keyframes float {
    0% { transform: translateY(110vh) rotate(0deg); }
    100% { transform: translateY(-10vh) rotate(360deg); }
}

.container {
    position: relative;
    width: 100%;
    max-width: 500px; /* 너비 축소 */
    background-color: var(--white);
    padding: 20px; /* 내부 여백 축소 */
    border-radius: 20px;
    box-shadow: var(--shadow);
    text-align: center;
    border: 1px solid var(--border-color);
    z-index: 1;
}

.theme-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(157, 80, 187, 0.05);
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    line-height: 1;
}

header {
    margin-bottom: 20px; /* 헤더 간격 축소 */
}

header h1 {
    font-family: 'Playfair Display', serif;
    font-size: clamp(1.5rem, 6vw, 2rem); /* 폰트 크기 축소 */
    background: var(--mystic-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 5px;
}

header p {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--border-color); /* 테두리 굵기 축소 */
    border-radius: 15px;
    padding: 15px; /* 카드 내부 여백 대폭 축소 */
    margin-bottom: 15px;
    animation: sparkleUp 0.5s ease-out;
}

.card.hidden { display: none; }

.fortune-decoration {
    font-size: 0.7rem;
    margin-bottom: 5px;
}

.menu-emoji {
    font-size: 3rem; /* 이모지 크기 축소 */
    margin-bottom: 10px;
}

.card h2 {
    font-size: 1.5rem; /* 제목 크기 축소 */
    margin-bottom: 5px;
}

.category-badge {
    display: inline-block;
    padding: 3px 12px;
    background: var(--mystic-gradient);
    color: white;
    border-radius: 50px;
    font-size: 0.75rem;
    margin-bottom: 10px;
}

.card p {
    font-size: 0.9rem;
}

.lucky-number-section {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed var(--border-color);
    font-size: 0.85rem;
}

#lucky-digits {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 5px;
}

.digit {
    font-size: 1.5rem; /* 숫자 크기 축소 */
    font-weight: 800;
    color: var(--primary-color);
    background: rgba(157, 80, 187, 0.1);
    width: 35px; /* 숫자 박스 크기 축소 */
    height: 35px;
    line-height: 35px;
    border-radius: 8px;
}

.action-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-bottom: 15px;
}

.primary-btn {
    padding: 12px 30px;
    font-size: clamp(1.05rem, 4vw, 1.2rem); 
    font-weight: 800;
    color: white;
    background-color: var(--primary-color);
    border: none;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(142, 68, 173, 0.3);
    transition: var(--transition);
}

.primary-btn:hover {
    background-color: var(--secondary-color);
    transform: translateY(-1px);
}

.secondary-btn {
    padding: 8px 20px;
    font-size: 0.85rem;
    color: var(--primary-color);
    background: transparent;
    border: 1px solid var(--primary-color);
    border-radius: 50px;
}

.filters {
    display: flex;
    justify-content: center;
    gap: 5px;
    flex-wrap: wrap;
    padding-top: 5px;
}

.filter-btn {
    padding: 5px 12px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.75rem; /* 필터 버튼 축소 */
}

.filter-btn.active {
    background: var(--dark-color);
    color: var(--white);
    border-color: var(--dark-color);
}

footer {
    margin-top: 15px;
    border-top: 1px solid var(--border-color);
    padding-top: 10px;
    color: var(--text-secondary);
    font-size: 0.75rem;
    opacity: 0.6;
}

@keyframes sparkleUp {
    0% { opacity: 0; transform: translateY(10px); }
    100% { opacity: 1; transform: translateY(0); }
}

@media (max-height: 600px) {
    body { align-items: flex-start; padding-top: 10px; }
    .container { margin-bottom: 10px; }
}

@media (max-width: 480px) {
    .container { padding: 15px; }
    header h1 { font-size: 1.5rem; }
}
