:root {
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --bg-color: #f1f5f9;
  --card-bg: #ffffff;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --transition: all 0.2s ease;

  --wood: #22c55e;
  --fire: #ef4444;
  --earth: #eab308;
  --metal: #94a3b8;
  --water: #1e293b;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  margin: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
}

.app-container {
  width: 100%;
  max-width: 480px;
  padding: 20px;
}

.calendar-card {
  background: var(--card-bg);
  border-radius: 1.5rem;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
  padding: 24px;
  margin-bottom: 24px;
  position: relative;
}

.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.header-selects {
  display: flex;
  gap: 8px;
}

.header-selects select {
  font-size: 1.1rem;
  font-weight: 700;
  border: 1px solid var(--border-color);
  background: white;
  padding: 4px 8px;
  border-radius: 8px;
}

.settings-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 4px;
  border-radius: 8px;
  transition: background 0.2s;
}

.settings-btn:hover { background-color: #f1f5f9; }

.modal {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal.hidden { display: none; }

.modal-content {
  background: white;
  padding: 24px;
  border-radius: 20px;
  max-width: 320px;
  width: 90%;
}

.modal-content input {
  width: 100%;
  padding: 12px;
  margin: 16px 0;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  box-sizing: border-box;
}

.modal-btns {
  display: flex;
  gap: 10px;
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin-bottom: 12px;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  text-align: center;
}

.calendar-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}

.day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  cursor: pointer;
  border-radius: 12px;
  transition: var(--transition);
}

.day:hover:not(.empty) { background-color: #f1f5f9; }
.day.selected { background-color: var(--primary); color: white; }
.day.today { color: var(--primary); font-weight: 700; border: 2px solid var(--primary); }
.day.empty { cursor: default; }

.time-selection {
  margin-top: 24px;
  display: flex;
  gap: 16px;
}

.input-group { flex: 1; }
.input-group label { display: block; font-size: 0.85rem; margin-bottom: 8px; color: var(--text-muted); }
.input-group select { width: 100%; padding: 10px; border-radius: 10px; border: 1px solid var(--border-color); background-color: #f8fafc; }

.calendar-footer { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border-color); }
.confirm-btn { width: 100%; background-color: var(--primary); color: white; border: none; border-radius: 12px; padding: 14px; font-size: 1rem; font-weight: 600; cursor: pointer; }
.confirm-btn:disabled { background-color: var(--border-color); opacity: 0.6; }

.result-container {
  background: var(--card-bg);
  border-radius: 1.5rem;
  padding: 24px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
  margin-bottom: 40px;
}

.result-container.hidden { display: none; }

.saju-table { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.pillar { text-align: center; background: #f8fafc; padding: 12px; border-radius: 12px; border: 1px solid var(--border-color); }
.pillar .label { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 8px; }
.pillar .stem, .pillar .branch { font-size: 1.5rem; font-weight: 700; margin-bottom: 4px; }

.wood { color: var(--wood); }
.fire { color: var(--fire); }
.earth { color: var(--earth); }
.metal { color: var(--metal); }
.water { color: var(--water); }

.saju-text { margin: 20px 0; text-align: center; font-weight: 600; padding-bottom: 20px; border-bottom: 2px dashed var(--border-color); }

/* AI Analysis Styling */
.ai-btn {
  width: 100%;
  background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
  color: white;
  border: none;
  border-radius: 12px;
  padding: 16px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  margin-bottom: 24px;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
  transition: transform 0.2s;
}

.ai-btn:hover { transform: translateY(-2px); }

.ai-loading { text-align: center; padding: 20px; }
.spinner {
  width: 40px; height: 40px; border: 4px solid #f3f3f3; border-top: 4px solid var(--primary);
  border-radius: 50%; animation: spin 1s linear infinite; margin: 0 auto 12px;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

.ai-result-area {
  background: #fdfaff;
  border: 1px solid #e9d5ff;
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 24px;
}

.ai-result-area h4 { color: #7c3aed; margin-top: 0; }
.markdown-body { font-size: 0.95rem; line-height: 1.7; color: #4b5563; }
.markdown-body h1, .markdown-body h2, .markdown-body h3 { color: var(--text-main); margin-top: 20px; }
.markdown-body p { margin-bottom: 12px; }

.elements-stats { display: flex; flex-direction: column; gap: 8px; margin-bottom: 24px; }
.stat-row { display: flex; align-items: center; gap: 12px; }
.stat-label { width: 40px; font-size: 0.85rem; font-weight: 600; }
.stat-bar-bg { flex: 1; height: 12px; background: #f1f5f9; border-radius: 6px; overflow: hidden; }
.stat-bar-fill { height: 100%; border-radius: 6px; transition: width 1s ease-out; }
.stat-count { width: 20px; font-size: 0.85rem; text-align: right; color: var(--text-muted); }

.personality-card { background: #f8fafc; padding: 16px; border-radius: 12px; border: 1px solid var(--border-color); }
.personality-card h4 { margin: 0 0 8px 0; color: var(--primary); }
.personality-card p { margin: 0; font-size: 0.95rem; line-height: 1.6; }

.hidden { display: none !important; }
