@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+KR:wght@400;600;700&display=swap');

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

body {
  font-family: 'Noto Serif KR', serif;
  background: #0a0a1a;
  color: #e8d5b0;
  min-height: 100vh;
  overflow-x: hidden;
}

/* 별 배경 */
.stars {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 0;
}

.star {
  position: absolute;
  background: white;
  border-radius: 50%;
  animation: twinkle var(--duration) infinite alternate;
}

@keyframes twinkle {
  from { opacity: 0.2; transform: scale(0.8); }
  to   { opacity: 1;   transform: scale(1.2); }
}

.container {
  position: relative;
  z-index: 1;
  max-width: 800px;
  margin: 0 auto;
  padding: 40px 20px 60px;
}

/* 헤더 */
header {
  text-align: center;
  margin-bottom: 48px;
}

.title-symbol {
  font-size: 3rem;
  margin-bottom: 12px;
  animation: rotate 10s linear infinite;
}

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

h1 {
  font-size: 2.4rem;
  font-weight: 700;
  color: #ffd700;
  text-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
  margin-bottom: 12px;
  letter-spacing: 2px;
}

.subtitle {
  color: #a89070;
  font-size: 1rem;
  line-height: 1.6;
}

/* 입력 폼 */
.form-section {
  background: rgba(255, 215, 0, 0.05);
  border: 1px solid rgba(255, 215, 0, 0.2);
  border-radius: 16px;
  padding: 36px;
  margin-bottom: 40px;
}

.input-group {
  margin-bottom: 24px;
}

label {
  display: block;
  color: #ffd700;
  font-size: 0.9rem;
  margin-bottom: 8px;
  letter-spacing: 1px;
}

input {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 215, 0, 0.3);
  border-radius: 8px;
  padding: 14px 16px;
  color: #e8d5b0;
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.2s;
}

input:focus {
  outline: none;
  border-color: #ffd700;
  background: rgba(255, 215, 0, 0.08);
}

input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(0.8) sepia(1) saturate(3) hue-rotate(10deg);
  cursor: pointer;
}

button#fortune-btn {
  width: 100%;
  padding: 16px;
  background: linear-gradient(135deg, #b8860b, #ffd700, #b8860b);
  border: none;
  border-radius: 8px;
  color: #0a0a1a;
  font-size: 1.1rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  letter-spacing: 2px;
  transition: opacity 0.2s, transform 0.1s;
}

button#fortune-btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

button#fortune-btn:active {
  transform: translateY(0);
}

/* 결과 섹션 */
.result-section {
  animation: fadeIn 0.6s ease;
}

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

/* 결과 헤더 */
.result-header {
  text-align: center;
  background: rgba(255, 215, 0, 0.06);
  border: 1px solid rgba(255, 215, 0, 0.2);
  border-radius: 12px;
  padding: 16px 24px;
  margin-bottom: 32px;
  color: #ffd700;
  font-size: 0.95rem;
  letter-spacing: 1px;
  line-height: 1.9;
}

/* ── 속도계 게이지 ───────────────────────── */
.gauge-grid {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 32px;
}

.gauge-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 130px;
  animation: gaugeIn 0.5s ease both;
}

.gauge-item:nth-child(1) { animation-delay: 0.05s; }
.gauge-item:nth-child(2) { animation-delay: 0.15s; }
.gauge-item:nth-child(3) { animation-delay: 0.25s; }
.gauge-item:nth-child(4) { animation-delay: 0.35s; }
.gauge-item:nth-child(5) { animation-delay: 0.45s; }

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

.gauge-svg {
  width: 100%;
  overflow: visible;
}

.gauge-track {
  fill: none;
  stroke: #1e1e36;
  stroke-width: 11;
  stroke-linecap: round;
}

.gauge-fill {
  fill: none;
  stroke-width: 11;
  stroke-linecap: round;
  stroke-dashoffset: var(--offset);
  stroke-dasharray: var(--dash) var(--total);
  animation: gaugeFill 1s cubic-bezier(0.4,0,0.2,1) both;
}

@keyframes gaugeFill {
  from { stroke-dasharray: 0 var(--total); }
  to   { stroke-dasharray: var(--dash) var(--total); }
}

.gauge-level-text {
  font-size: 13px;
  font-weight: 700;
  font-family: 'Noto Serif KR', serif;
}

.gauge-icon {
  font-size: 1.3rem;
  margin-top: -2px;
}

.gauge-label {
  color: #a89070;
  font-size: 0.78rem;
  letter-spacing: 1px;
  margin-top: 4px;
}

/* ── 간단 조언 ───────────────────────────── */
.advice-simple {
  background: rgba(255, 215, 0, 0.05);
  border: 1px solid rgba(255, 215, 0, 0.18);
  border-radius: 12px;
  padding: 20px 28px;
  margin-bottom: 24px;
  color: #d4c4a0;
  font-size: 0.95rem;
  line-height: 1.9;
  text-align: center;
}

.advice-simple::before {
  content: '📿 오늘의 조언';
  display: block;
  color: #ffd700;
  font-size: 0.82rem;
  letter-spacing: 2px;
  margin-bottom: 10px;
}

/* ── 자세히 보기 ─────────────────────────── */
.detail-section {
  border: 1px solid rgba(255, 215, 0, 0.15);
  border-radius: 12px;
  margin-bottom: 28px;
  overflow: hidden;
}

.detail-toggle {
  width: 100%;
  padding: 16px 24px;
  cursor: pointer;
  color: #ffd700;
  font-size: 0.9rem;
  letter-spacing: 2px;
  font-family: inherit;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  user-select: none;
  transition: background 0.2s;
}

.detail-toggle:hover {
  background: rgba(255, 215, 0, 0.05);
}

.detail-toggle::after {
  content: '▼';
  font-size: 0.7rem;
  transition: transform 0.3s;
}

.detail-section[open] .detail-toggle::after {
  transform: rotate(180deg);
}

/* webkit summary arrow 제거 */
.detail-toggle::-webkit-details-marker { display: none; }

.detail-content {
  padding: 0 20px 20px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.detail-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 215, 0, 0.1);
  border-radius: 10px;
  padding: 16px;
  text-align: center;
}

.detail-card-icon { font-size: 1.6rem; margin-bottom: 6px; }
.detail-card-label {
  color: #ffd700;
  font-size: 0.78rem;
  letter-spacing: 2px;
  margin-bottom: 8px;
}
.detail-card-text {
  color: #b0a090;
  font-size: 0.82rem;
  line-height: 1.7;
}

.detail-lucky {
  grid-column: 1 / -1;
  background: rgba(255, 215, 0, 0.04);
  border: 1px solid rgba(255, 215, 0, 0.15);
  border-radius: 10px;
  padding: 14px 20px;
  display: flex;
  justify-content: center;
  gap: 32px;
  flex-wrap: wrap;
  color: #c8b89a;
  font-size: 0.88rem;
  line-height: 2;
}

.detail-lucky span { color: #ffd700; font-weight: 700; }

.retry-btn {
  display: block;
  margin: 0 auto;
  padding: 12px 40px;
  background: transparent;
  border: 1px solid rgba(255, 215, 0, 0.4);
  border-radius: 8px;
  color: #ffd700;
  font-size: 0.95rem;
  font-family: inherit;
  cursor: pointer;
  letter-spacing: 1px;
  transition: background 0.2s;
}

.retry-btn:hover {
  background: rgba(255, 215, 0, 0.1);
}

/* ── 커스텀 달력 ─────────────────────────────── */
.date-picker-wrapper {
  position: relative;
}

#birthdate-display {
  cursor: pointer;
}

#birthdate-display:hover {
  border-color: #ffd700;
}

.calendar-popup {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 100;
  width: 100%;
  max-width: 320px;
  background: #12122a;
  border: 1px solid rgba(255, 215, 0, 0.4);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
  animation: calIn 0.2s ease;
}

.calendar-popup.open {
  display: block;
}

@keyframes calIn {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

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

.cal-nav {
  background: transparent;
  border: 1px solid rgba(255, 215, 0, 0.3);
  border-radius: 6px;
  color: #ffd700;
  font-size: 1.2rem;
  width: 32px;
  height: 32px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  font-family: inherit;
}

.cal-nav:hover {
  background: rgba(255, 215, 0, 0.15);
}

.cal-title {
  display: flex;
  gap: 6px;
}

.cal-year-btn,
.cal-month-btn {
  background: transparent;
  border: 1px solid rgba(255, 215, 0, 0.25);
  border-radius: 6px;
  color: #ffd700;
  font-size: 0.95rem;
  font-weight: 700;
  font-family: inherit;
  padding: 4px 10px;
  cursor: pointer;
  transition: background 0.15s;
}

.cal-year-btn:hover,
.cal-month-btn:hover {
  background: rgba(255, 215, 0, 0.15);
}

/* 요일 헤더 */
.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin-bottom: 6px;
}

.cal-weekday {
  text-align: center;
  font-size: 0.75rem;
  color: #a89070;
  padding: 4px 0;
}

.cal-weekday:first-child { color: #ff7b7b; }
.cal-weekday:last-child  { color: #7baeff; }

/* 날짜 그리드 */
.cal-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.cal-day {
  text-align: center;
  padding: 7px 2px;
  border-radius: 6px;
  font-size: 0.85rem;
  cursor: pointer;
  color: #e8d5b0;
  transition: background 0.12s, color 0.12s;
  border: none;
  background: transparent;
  font-family: inherit;
}

.cal-day:hover:not(.empty):not(.other-month) {
  background: rgba(255, 215, 0, 0.15);
}

.cal-day.today {
  border: 1px solid rgba(255, 215, 0, 0.4);
}

.cal-day.selected {
  background: #ffd700;
  color: #0a0a1a;
  font-weight: 700;
}

.cal-day.other-month {
  color: #444;
  cursor: default;
}

.cal-day.empty {
  cursor: default;
}

.cal-day.sun { color: #ff7b7b; }
.cal-day.sat { color: #7baeff; }
.cal-day.selected.sun,
.cal-day.selected.sat { color: #0a0a1a; }

/* 연도 선택 그리드 */
.cal-year-grid,
.cal-month-grid {
  display: grid;
  gap: 6px;
}

.cal-year-grid {
  grid-template-columns: repeat(4, 1fr);
}

.cal-month-grid {
  grid-template-columns: repeat(3, 1fr);
}

.cal-year-item,
.cal-month-item {
  text-align: center;
  padding: 8px 4px;
  border-radius: 6px;
  font-size: 0.85rem;
  cursor: pointer;
  color: #e8d5b0;
  border: none;
  background: transparent;
  font-family: inherit;
  transition: background 0.12s;
}

.cal-year-item:hover,
.cal-month-item:hover {
  background: rgba(255, 215, 0, 0.15);
}

.cal-year-item.selected,
.cal-month-item.selected {
  background: #ffd700;
  color: #0a0a1a;
  font-weight: 700;
}

.cal-year-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  color: #ffd700;
  font-size: 0.9rem;
}

/* ── 자세히 보기 구분 제목 ──────────────────── */
.detail-today-title,
.detail-saju-title {
  grid-column: 1 / -1;
  color: #ffd700;
  font-size: 0.78rem;
  letter-spacing: 3px;
  padding: 12px 0 4px;
  border-bottom: 1px solid rgba(255, 215, 0, 0.15);
  margin-bottom: 4px;
}

.detail-saju-title { margin-top: 8px; }

/* ── 사주풀이 섹션 ───────────────────────────── */
.saju-reading {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sr-section {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,215,0,0.1);
  border-radius: 10px;
  padding: 18px 20px;
}

.sr-title {
  color: #ffd700;
  font-size: 0.88rem;
  letter-spacing: 1px;
  margin-bottom: 10px;
}

.sr-desc {
  color: #786858;
  font-size: 0.78rem;
  margin-bottom: 14px;
}

/* 사주 팔자표 */
.saju-table-wrap {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.saju-col {
  flex: 1;
  max-width: 140px;
  text-align: center;
  background: rgba(255,215,0,0.04);
  border: 1px solid rgba(255,215,0,0.12);
  border-radius: 8px;
  padding: 12px 8px;
}

.saju-col-label {
  font-size: 0.7rem;
  color: #786858;
  margin-bottom: 10px;
  letter-spacing: 0.5px;
}

.saju-stem {
  font-size: 2rem;
  font-weight: 700;
  color: #ffd700;
  line-height: 1;
  margin-bottom: 6px;
}

.saju-branch {
  font-size: 1.8rem;
  font-weight: 700;
  color: #c8b89a;
  line-height: 1;
  margin-bottom: 8px;
}

.saju-el {
  font-size: 0.78rem;
  letter-spacing: 1px;
}

/* 일간 분석 */
.sr-personality {
  color: #c8b89a;
  font-size: 0.88rem;
  line-height: 1.8;
  margin-bottom: 12px;
}

.sr-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.sr-tag {
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 20px;
  letter-spacing: 0.5px;
}

.sr-tag.good    { background: rgba(46,204,113,0.12); color: #2ecc71; border: 1px solid rgba(46,204,113,0.2); }
.sr-tag.caution { background: rgba(231,76,60,0.1);   color: #e74c3c; border: 1px solid rgba(231,76,60,0.2); }

/* 오행 균형 바 */
.el-bars { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }

.el-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.el-name {
  width: 36px;
  font-size: 0.8rem;
  color: #c8b89a;
  flex-shrink: 0;
}

.el-bar-wrap {
  flex: 1;
  height: 8px;
  background: #1e1e36;
  border-radius: 4px;
  overflow: hidden;
}

.el-bar {
  height: 100%;
  border-radius: 4px;
  transition: width 0.8s cubic-bezier(0.4,0,0.2,1);
}

.el-cnt {
  width: 16px;
  font-size: 0.78rem;
  color: #786858;
  text-align: right;
}

.el-summary {
  font-size: 0.82rem;
  color: #a89070;
  line-height: 1.7;
}

/* 종합 해석 */
.sr-life {
  color: #c8b89a;
  font-size: 0.9rem;
  line-height: 1.9;
  margin-bottom: 12px;
}

.sr-tip {
  background: rgba(255,215,0,0.05);
  border-left: 2px solid rgba(255,215,0,0.3);
  padding: 10px 14px;
  font-size: 0.83rem;
  color: #a89070;
  border-radius: 0 6px 6px 0;
  line-height: 1.7;
}

.sr-tip strong { color: #ffd700; }

/* 반응형 */
@media (max-width: 480px) {
  h1 { font-size: 1.8rem; }
  .form-section { padding: 24px; }
  .gauge-item { width: 108px; }
  .detail-content { grid-template-columns: 1fr 1fr; }
}
