:root {
    --bg-color: #fdfbf7;
    --card-bg: rgba(255, 255, 255, 0.65);
    --card-border: rgba(255, 255, 255, 0.8);
    --text-main: #333333;
    --text-muted: #666666;
    
    --primary: #a78bfa;
    --accent: #f472b6;
    --success: #34d399;
    --danger: #fbbf24;
    
    --glass-shadow: 0 8px 32px 0 rgba(74, 58, 237, 0.1);
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, Roboto, sans-serif;
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--card-border);
    border-radius: 1.5rem;
    padding: 2rem;
    box-shadow: var(--glass-shadow);
    margin-bottom: 2rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.glass-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px 0 rgba(74, 58, 237, 0.15);
}

.text-gradient {
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
}

h1, h2, h3, h4 {
    margin-top: 0;
}

h1 { font-size: 2.5rem; margin-bottom: 0.5rem; letter-spacing: -0.02em; }
h2 { font-size: 1.8rem; margin-bottom: 1rem; color: var(--text-main); }
h3 { font-size: 1.4rem; margin-bottom: 1rem; color: var(--text-main); display: flex; align-items: center; gap: 0.5rem; }
h4 { font-size: 1.1rem; margin-bottom: 0.5rem; color: var(--primary); }

p { line-height: 1.7; margin-bottom: 1rem; color: #4b5563; word-break: keep-all; }

/* Form Styles */
.form-group { margin-bottom: 1.5rem; }
label { display: block; margin-bottom: 0.5rem; font-weight: 600; color: var(--text-muted); }
input[type="text"], input[type="date"], input[type="time"] {
    width: 100%;
    padding: 1rem;
    border: 2px solid rgba(167, 139, 250, 0.2);
    border-radius: 1rem;
    background: rgba(255, 255, 255, 0.9);
    font-size: 1rem;
    transition: all 0.3s ease;
    box-sizing: border-box;
}
input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(167, 139, 250, 0.1);
}

.btn-primary {
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border: none;
    border-radius: 1rem;
    color: white;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: opacity 0.3s ease;
}
.btn-primary:hover { opacity: 0.9; }

/* Table Styles */
.saju-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    text-align: center;
    margin-bottom: 1rem;
}
.saju-table th {
    padding: 1rem;
    color: var(--text-muted);
    font-weight: 600;
    border-bottom: 2px solid rgba(0,0,0,0.05);
}
.saju-table td {
    padding: 1.5rem 0.5rem;
    vertical-align: top;
}
.hanja {
    display: block;
    font-size: 2.2rem;
    font-weight: bold;
    font-family: 'Noto Serif KR', serif;
    margin-bottom: 0.5rem;
    line-height: 1;
}
.ten-god {
    font-size: 0.85rem;
    color: var(--text-muted);
    background: rgba(0,0,0,0.03);
    padding: 0.2rem 0.5rem;
    border-radius: 20px;
    display: inline-block;
}
.me-cell .ten-god {
    background: var(--primary);
    color: white;
}

/* Element Colors */
.wood { color: #16a34a !important; }
.fire { color: #ea580c !important; }
.earth { color: #d97706 !important; }
.metal { color: #475569 !important; }
.water { color: #2563eb !important; }

/* Tabs */
.tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
}
.tabs button {
    flex: 1;
    white-space: nowrap;
    padding: 0.8rem 1.2rem;
    border: none;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 0.8rem;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-muted);
    transition: all 0.3s ease;
}
.tabs button.active {
    background: white;
    color: var(--primary);
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.tab-content { display: none; animation: fadeIn 0.5s ease; }
.tab-content.active { display: block; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}
@media (min-width: 768px) {
    .dashboard-grid { grid-template-columns: repeat(2, 1fr); }
    .three-col { grid-template-columns: repeat(3, 1fr) !important; }
}

/* Loading Spinner */
.mystic-spinner {
    position: relative; width: 120px; height: 120px; margin-bottom: 3rem;
}
.mystic-spinner::before, .mystic-spinner::after {
    content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    border-radius: 50%; border: 3px solid transparent;
    border-top-color: #a78bfa; animation: spin 2s linear infinite;
}
.mystic-spinner::after {
    border-top-color: #f472b6; animation: spin 3s linear infinite reverse;
    transform: scale(0.8);
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* Timeline */
.timeline {
    position: relative;
    padding-left: 2rem;
}
.timeline::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 2px;
    background: linear-gradient(to bottom, var(--primary), var(--accent));
}
.timeline-item {
    position: relative;
    margin-bottom: 2rem;
}
.timeline-item::before {
    content: '';
    position: absolute;
    left: -2.35rem; top: 1.5rem;
    width: 1rem; height: 1rem;
    background: var(--bg-color);
    border: 3px solid var(--primary);
    border-radius: 50%;
    z-index: 1;
}

/* Daewoon Grid */
.dw-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}
@media (min-width: 640px) {
    .dw-grid { grid-template-columns: repeat(4, 1fr); }
}
.dw-card {
    background: rgba(255,255,255,0.4);
    border-radius: 1rem;
    padding: 1rem;
    text-align: center;
    border: 1px solid rgba(255,255,255,0.6);
}
