/**
 * style.css
 * 오주괘 (五柱卦) - 천문역법 정밀 만세력 스타일시트
 * https://xn--oc0bz88bo5b.kr/ 기반 고급 오행 다크 테마 & 골드 액센트 디자인
 */

:root {
  --bg-main: #0e1118;
  --bg-card: rgba(22, 27, 39, 0.85);
  --bg-card-elevated: rgba(30, 37, 54, 0.95);
  --bg-glass: rgba(255, 255, 255, 0.04);
  --border-color: rgba(212, 175, 55, 0.25);
  --border-glow: rgba(212, 175, 55, 0.6);
  --gold-primary: #d4af37;
  --gold-light: #f7e7a9;
  --gold-bright: #ffd700;
  --text-main: #f0f2f5;
  --text-muted: #9ba3af;
  --text-dim: #6b7280;

  /* 오행 대표 색상 (차트 및 통계용) */
  --wood-bg: #1e3a24;
  --wood-border: #4caf50;
  --wood-text: #81c784;

  --fire-bg: #3e1b1b;
  --fire-border: #e53935;
  --fire-text: #ef5350;

  --earth-bg: #3d3118;
  --earth-border: #fbc02d;
  --earth-text: #ffca28;

  --metal-bg: #29323c;
  --metal-border: #cfd8dc;
  --metal-text: #eceff1;

  --water-bg: #152238;
  --water-border: #42a5f5;
  --water-text: #90caf9;

  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 6px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Pretendard", "Noto Sans KR", "Apple SD Gothic Neo", sans-serif;
  background-color: var(--bg-main);
  background-image: 
    radial-gradient(circle at 50% 0%, rgba(212, 175, 55, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 100% 100%, rgba(26, 35, 126, 0.15) 0%, transparent 50%);
  color: var(--text-main);
  min-height: 100vh;
  padding: 16px 12px 60px 12px;
  line-height: 1.5;
}

.container {
  max-width: 960px;
  margin: 0 auto;
}

/* ==========================================================================
   1. Header (헤더 & 액션 버튼)
   ========================================================================== */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap;
  gap: 12px;
}

.title-area {
  display: flex;
  align-items: center;
  gap: 12px;
}

.app-logo {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  box-shadow: 0 0 15px rgba(212, 175, 55, 0.35);
  flex-shrink: 0;
}

.title-text-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.app-header h1 {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--gold-light);
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 8px;
  line-height: 1.2;
}

.app-header h1 .title-ko {
  font-size: 1.05rem;
  color: var(--gold-light);
  font-weight: 500;
}

.app-header h1 .badge-kasi {
  font-size: 0.65rem;
  background: rgba(212, 175, 55, 0.15);
  color: var(--gold-light);
  border: 1px solid var(--border-color);
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 500;
  white-space: nowrap;
}

.app-sub-slogan {
  font-size: 0.78rem;
  color: rgba(243, 229, 171, 0.82);
  font-weight: 500;
  letter-spacing: 0.3px;
  line-height: 1.2;
}

@media (max-width: 600px) {
  .app-logo {
    width: 42px;
    height: 42px;
    border-radius: 9px;
  }
  .app-header h1 {
    font-size: 1.15rem;
    gap: 5px;
  }
  .app-header h1 .title-ko {
    font-size: 0.88rem;
  }
  .app-header h1 .badge-kasi {
    font-size: 0.58rem;
    padding: 1px 4px;
  }
  .app-sub-slogan {
    font-size: 0.68rem;
    letter-spacing: -0.3px;
  }
  .header-actions {
    gap: 4px;
  }
  .btn-sm {
    padding: 5px 7px;
    font-size: 0.74rem;
    gap: 3px;
    white-space: nowrap;
  }
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

/* ==========================================================================
   2. Buttons & Controls (오주괘.kr 정밀 복원 버튼 스타일)
   ========================================================================== */
.btn-sm {
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
  user-select: none;
}

.btn-sm:hover,
.btn-sm:active {
  background: rgba(212, 175, 55, 0.2);
  border-color: var(--gold-primary);
  color: var(--gold-light);
}

.btn-primary {
  background: linear-gradient(135deg, #d4af37, #aa8214);
  color: #12141d;
  font-weight: 600;
  border: none;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #f7e7a9, #d4af37);
  box-shadow: 0 0 12px rgba(212, 175, 55, 0.4);
}

/* Options & Control Panel */
.panel {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 20px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  transition: all 0.3s ease;
}

/* Collapsible Panel Header & Controls */
.panel-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 10px;
  margin-bottom: 12px;
  border-bottom: 1px solid rgba(212, 175, 55, 0.2);
}

.panel-header-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--gold-light);
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-toggle-panel {
  background: rgba(212, 175, 55, 0.12);
  color: var(--gold-light);
  border: 1px solid rgba(212, 175, 55, 0.35);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s ease;
}

.btn-toggle-panel:hover {
  background: rgba(212, 175, 55, 0.25);
  border-color: var(--gold-primary);
  color: #fff;
  box-shadow: 0 0 8px rgba(212, 175, 55, 0.3);
}

.btn-toggle-panel .toggle-icon {
  font-size: 0.75rem;
  transition: transform 0.25s ease;
}

/* Collapsed Summary Bar */
.input-collapsed-bar {
  display: none;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 14px;
  background: linear-gradient(135deg, rgba(35, 27, 20, 0.85) 0%, rgba(20, 16, 12, 0.95) 100%);
  border: 1px solid rgba(212, 175, 55, 0.4);
  border-radius: var(--radius-md);
  margin-top: 4px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.input-collapsed-bar:hover {
  border-color: var(--gold-primary);
  background: linear-gradient(135deg, rgba(45, 35, 25, 0.92) 0%, rgba(25, 20, 15, 0.98) 100%);
}

.summary-info-content {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 0.86rem;
  color: var(--gold-light);
}

.summary-name {
  font-weight: 700;
  color: #fff;
}

.summary-gender {
  color: #ffcc80;
}

.summary-divider {
  color: rgba(212, 175, 55, 0.4);
}

.summary-datetime {
  color: #90caf9;
  font-weight: 600;
}

.summary-caltype,
.summary-city,
.summary-mode {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.btn-unfold-action {
  background: linear-gradient(135deg, var(--gold-primary) 0%, #b8932b 100%);
  color: #12100e;
  font-weight: 700;
  border: none;
  border-radius: var(--radius-sm);
  padding: 5px 12px;
  font-size: 0.78rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.btn-unfold-action:hover {
  filter: brightness(1.15);
  box-shadow: 0 0 12px rgba(212, 175, 55, 0.5);
}

/* Fold shortcut buttons */
.btn-fold-direct {
  background: rgba(212, 175, 55, 0.14);
  color: var(--gold-light);
  border: 1px solid rgba(212, 175, 55, 0.38);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
}

.btn-fold-direct:hover {
  background: rgba(212, 175, 55, 0.28);
  border-color: var(--gold-primary);
  color: #fff;
}

.btn-fold-bottom {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 20px;
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.15) 0%, rgba(180, 140, 40, 0.25) 100%);
  color: var(--gold-light);
  border: 1px solid rgba(212, 175, 55, 0.45);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}

.btn-fold-bottom:hover {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.3) 0%, rgba(212, 175, 55, 0.45) 100%);
  color: #fff;
  border-color: var(--gold-light);
  box-shadow: 0 0 14px rgba(212, 175, 55, 0.4);
}

/* Collapsed state */
.panel.is-collapsed {
  padding-bottom: 12px;
}

.panel.is-collapsed .panel-collapsible-body {
  display: none !important;
}

.panel.is-collapsed .input-collapsed-bar {
  display: flex !important;
}

.panel.is-collapsed .panel-header-bar {
  margin-bottom: 0;
  border-bottom: none;
  padding-bottom: 6px;
}

.controls-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.control-label {
  font-size: 0.82rem;
  color: var(--gold-light);
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Segmented Control (세그먼트 탭 버튼) */
.segmented-control {
  display: flex;
  background: rgba(0, 0, 0, 0.35);
  border-radius: var(--radius-md);
  padding: 3px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.segmented-control button {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 8px 12px;
  font-size: 0.85rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  user-select: none;
}

.segmented-control button:active {
  transform: scale(0.96);
}

.segmented-control button.active {
  background: var(--bg-card-elevated);
  color: var(--gold-light);
  border: 1px solid var(--border-color);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  font-weight: 600;
}

/* 지금 실시간 버튼 전용 고급 골드 & 클릭 반응 액션 */
#btn-realtime {
  position: relative;
  overflow: hidden;
}

#btn-realtime.active {
  color: var(--gold-light);
  border-color: rgba(212, 175, 55, 0.4);
  box-shadow: 0 2px 10px rgba(212, 175, 55, 0.15), inset 0 0 12px rgba(212, 175, 55, 0.08);
}

#btn-realtime:hover {
  color: var(--gold-light);
}

#btn-realtime:active,
#btn-realtime.btn-pressed {
  transform: scale(0.92) translateY(1px);
  background: rgba(212, 175, 55, 0.22);
  border-color: var(--gold-primary);
  box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.6), 0 0 15px rgba(212, 175, 55, 0.5);
  color: #ffffff;
}

/* 리프레시 아이콘 및 회전 애니메이션 */
.refresh-icon {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  color: var(--gold-light);
  stroke: var(--gold-light);
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#btn-realtime.refreshing .refresh-icon,
.refresh-icon.refresh-icon-spin {
  animation: spin-refresh 0.65s cubic-bezier(0.4, 0, 0.2, 1);
  color: #ffffff;
  stroke: #ffffff;
}

@keyframes spin-refresh {
  0% { transform: rotate(0deg) scale(1); }
  50% { transform: rotate(180deg) scale(1.25); }
  100% { transform: rotate(360deg) scale(1); }
}

/* 서브 패널 & 지역 칩 */
.sub-panel {
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border: 1px dashed rgba(212, 175, 55, 0.2);
}

.city-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  font-size: 0.78rem;
  padding: 4px 10px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.15s;
}

.chip:hover,
.chip.active {
  background: rgba(212, 175, 55, 0.2);
  border-color: var(--gold-primary);
  color: var(--gold-light);
}

.input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

input[type="text"],
input[type="number"],
input[type="datetime-local"],
input[type="date"],
input[type="time"],
select {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  outline: none;
}

select option {
  background: #161b26;
  color: var(--text-main);
}

input:focus,
select:focus {
  border-color: var(--gold-primary);
  box-shadow: 0 0 8px rgba(212, 175, 55, 0.3);
}

/* 이름 & 성별 입력 행 */
.input-name-gender-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.name-input-wrap {
  flex: 1.1;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 140px;
}

.name-input-wrap label {
  font-size: 0.8rem;
  color: var(--gold-light);
  white-space: nowrap;
  font-weight: 600;
}

.form-input-text {
  flex: 1;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid var(--border-color);
  color: #ffffff;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  outline: none;
  transition: all 0.2s;
}

.gender-segmented-wrap {
  flex: 1.2;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 160px;
}

.gender-segmented-wrap label {
  font-size: 0.8rem;
  color: var(--gold-light);
  white-space: nowrap;
  font-weight: 600;
}

/* 사주명식 직접 선택 60갑자 그리드 */
.custom-pillars-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-top: 6px;
}

.custom-pillars-grid.mode-5ju {
  grid-template-columns: repeat(5, 1fr);
}

.custom-pillar-col {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.custom-pillar-col label {
  font-size: 0.74rem;
  color: var(--gold-light);
  font-weight: 600;
  text-align: center;
}

/* 한글 사주명식 빠른 입력창 */
.saju-korean-input {
  width: 100%;
  background: rgba(18, 24, 38, 0.95);
  border: 1px solid rgba(212, 175, 55, 0.45);
  color: #ffffff;
  font-size: 0.86rem;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.saju-korean-input:focus {
  border-color: var(--gold-primary);
  box-shadow: 0 0 10px rgba(212, 175, 55, 0.35);
  outline: none;
}

.saju-korean-input::placeholder {
  color: rgba(255, 255, 255, 0.35);
  font-weight: normal;
  font-size: 0.8rem;
}

/* 각 기둥별 직접 텍스트 입력창 */
.pillar-text-input {
  width: 100%;
  background: rgba(18, 24, 38, 0.95);
  border: 1px solid rgba(212, 175, 55, 0.4);
  color: #ffffff;
  font-weight: 700;
  font-size: 0.88rem;
  padding: 6px 2px;
  border-radius: var(--radius-sm);
  text-align: center;
  transition: all 0.2s ease;
}

.pillar-text-input:focus {
  border-color: var(--gold-primary);
  box-shadow: 0 0 8px rgba(212, 175, 55, 0.35);
  outline: none;
}

.pillar-hanja-preview {
  font-size: 0.72rem;
  color: var(--gold-light);
  text-align: center;
  font-weight: 600;
  opacity: 0.9;
}

/* 사주명식 양력/음력 대조 안내 박스 */
.saju-matched-box {
  background: rgba(212, 175, 55, 0.08);
  border-left: 3px solid var(--gold-primary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 6px 10px;
  line-height: 1.5;
}

/* 출생일시 직접 숫자 입력 바 (2행 레이아웃: 1행=년/월/일/시 4개 25%, 2행=분 25%, 입력 37.5%, 현재시간 37.5%) */
.direct-number-inputs-bar {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: rgba(0, 0, 0, 0.3);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(212, 175, 55, 0.2);
  margin-bottom: 6px;
}

.direct-inputs-row-top,
.direct-inputs-row-bottom {
  display: flex;
  gap: 6px;
  width: 100%;
}

.direct-inputs-row-bottom {
  align-items: flex-end;
}

.direct-input-item {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 100%;
}

.direct-input-item label {
  font-size: 0.72rem;
  color: var(--gold-light);
  font-weight: 600;
  text-align: center;
}

/* 2행 1열: 분(分) 입력란 - 1행의 년/월/일/시와 정확히 동일한 1 flex (25%) 너비 */
#direct-minute-item {
  flex: 1;
  min-width: 0;
}

/* 2행 2열: [입력] 버튼 - 1.5 flex 차지 (현재시간과 100% 동일한 37.5% 크기) */
.direct-inputs-row-bottom .btn-submit-direct {
  flex: 1.5;
  height: 32px;
  min-width: 0;
  box-sizing: border-box;
  padding: 4px 6px;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

/* 2행 3열: [현재시간] 버튼 - 1.5 flex 차지 (입력과 100% 동일한 37.5% 크기) */
.btn-current-time {
  flex: 1.5;
  height: 32px;
  min-width: 0;
  box-sizing: border-box;
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.25), rgba(212, 175, 55, 0.1)) !important;
  border: 1.5px solid rgba(212, 175, 55, 0.55) !important;
  color: var(--gold-light, #ffd700) !important;
  font-size: 0.78rem !important;
  font-weight: 700 !important;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  white-space: nowrap;
  border-radius: var(--radius-sm);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.btn-current-time:hover {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.45), rgba(212, 175, 55, 0.22)) !important;
  border-color: var(--gold-primary, #ffd700) !important;
  color: #ffffff !important;
  box-shadow: 0 0 12px rgba(212, 175, 55, 0.45);
  transform: translateY(-1px);
}

.btn-current-time:active,
.btn-current-time.btn-pressed {
  transform: scale(0.95);
  background: rgba(212, 175, 55, 0.4) !important;
}

/* 위아래 화살표(스피너) 완전 제거 및 숫자 txt 입력 */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
  -webkit-appearance: none !important;
  margin: 0 !important;
}

input[type="number"] {
  -moz-appearance: textfield !important;
}

.direct-num-input {
  width: 100%;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid var(--border-color);
  color: #ffffff;
  font-size: 0.88rem;
  font-weight: 700;
  text-align: center;
  padding: 6px 2px;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

/* 기본 적혀있을 때(플레이스홀더 0000, 00)는 흐린색 */
.direct-num-input::placeholder {
  color: rgba(255, 255, 255, 0.25) !important;
  font-weight: 500 !important;
  font-size: 0.82rem !important;
  letter-spacing: 0.5px;
}

.direct-num-input:focus {
  border-color: var(--gold-primary);
  box-shadow: 0 0 8px rgba(212, 175, 55, 0.3);
  outline: none;
}

/* 출생일시 [입력] 리프레시 버튼 */
.btn-submit-direct {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.45), rgba(212, 175, 55, 0.18)) !important;
  border: 1.5px solid var(--gold-primary) !important;
  color: #ffffff !important;
  font-weight: 700 !important;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border-radius: var(--radius-sm);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.btn-submit-direct:hover {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.65), rgba(212, 175, 55, 0.3)) !important;
  box-shadow: 0 0 12px rgba(212, 175, 55, 0.5);
  transform: translateY(-1px);
}

.btn-submit-direct:active,
.btn-submit-direct.btn-pressed {
  transform: scale(0.95);
  background: rgba(212, 175, 55, 0.35) !important;
}

/* 사주명식 일치 연도 후보 선택 칩 */
.year-candidate-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 6px 0;
}

.year-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(212, 175, 55, 0.35);
  color: var(--text-normal);
  padding: 3px 9px;
  border-radius: 12px;
  font-size: 0.73rem;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.year-chip:hover {
  background: rgba(212, 175, 55, 0.15);
  border-color: var(--gold-primary);
  color: #ffffff;
}

.year-chip.active {
  background: rgba(212, 175, 55, 0.28);
  border-color: var(--gold-primary);
  color: var(--gold-light);
  font-weight: 700;
  box-shadow: 0 0 8px rgba(212, 175, 55, 0.4);
}

/* 표시 옵션 체크박스 행 */
.options-checkboxes-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.option-check-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 5px 10px;
  border-radius: 14px;
  cursor: pointer;
  user-select: none;
  transition: all 0.2s;
}

.option-check-chip:hover {
  border-color: var(--gold-primary);
  background: rgba(212, 175, 55, 0.12);
  color: var(--gold-light);
}

.option-check-chip input[type="checkbox"] {
  accent-color: var(--gold-primary);
  cursor: pointer;
  width: 14px;
  height: 14px;
  margin: 0;
}

.realtime-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--gold-light);
  background: rgba(212, 175, 55, 0.12);
  padding: 3px 9px;
  border-radius: 12px;
  border: 1px solid rgba(212, 175, 55, 0.35);
  font-weight: 500;
  letter-spacing: 0.2px;
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--gold-primary);
  box-shadow: 0 0 6px var(--gold-primary);
  animation: pulse-gold 1.6s infinite;
}

@keyframes pulse-gold {
  0% { transform: scale(0.9); opacity: 0.6; box-shadow: 0 0 4px var(--gold-primary); }
  50% { transform: scale(1.35); opacity: 1; box-shadow: 0 0 10px var(--gold-light); }
  100% { transform: scale(0.9); opacity: 0.6; box-shadow: 0 0 4px var(--gold-primary); }
}

.info-banner {
  margin-top: 10px;
  padding: 8px 12px;
  background: rgba(212, 175, 55, 0.08);
  border-left: 3px solid var(--gold-primary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.info-banner strong {
  color: var(--gold-light);
}

/* ==========================================================================
   3. Pillar Cards (사주·오주 카드 & 품격있는 흑칠·황금 테두리 셀)
   ========================================================================== */
/* 사주명식 ~ 월운 전체 흐름 캡처용 래퍼 */
.capture-main-flow-wrap {
  width: 100%;
  box-sizing: border-box;
}

.oju-section {
  margin-bottom: 24px;
}

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

.section-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--gold-light);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.section-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.toggle-action-btn,
.order-toggle-btn {
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.78rem;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
}

.toggle-action-btn:hover,
.order-toggle-btn:hover {
  color: var(--gold-light);
  border-color: var(--gold-primary);
  background: rgba(212, 175, 55, 0.15);
}

.toggle-action-btn.active {
  color: #12141d;
  background: linear-gradient(135deg, #d4af37, #aa8214);
  border-color: var(--gold-primary);
  font-weight: 600;
}

/* 사주(4기둥) & 오주(5기둥) 집중형 컴팩트 그리드 */
.oju-cards-wrapper {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  max-width: 520px;
  margin: 0 auto;
}

.oju-cards-wrapper.mode-5ju {
  grid-template-columns: repeat(5, 1fr);
  max-width: 620px;
}

@media (max-width: 768px) {
  .oju-cards-wrapper {
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    max-width: 100%;
  }
  .oju-cards-wrapper.mode-5ju {
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
    max-width: 100%;
  }
}

.pillar-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.pillar-card:hover {
  transform: translateY(-3px);
  border-color: var(--gold-primary);
  box-shadow: 0 6px 20px rgba(212, 175, 55, 0.25);
}

.pillar-card.is-minute {
  border-style: dashed;
}

.pillar-card.is-day {
  border-color: var(--gold-primary);
  box-shadow: 0 0 16px rgba(212, 175, 55, 0.35);
}

.pillar-name-badge,
.pillar-badge {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--gold-light);
  margin-bottom: 6px;
  padding: 2px 6px;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 4px;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

@media (max-width: 600px) {
  .pillar-name-badge,
  .pillar-badge {
    font-size: 0.68rem;
    padding: 1px 3px;
    margin-bottom: 4px;
  }
}

/* 십신(육친) 스타일 */
.pillar-ten-god-stem,
.pillar-ten-god-branch,
.row-stem-god,
.row-branch-god {
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.74rem;
  font-weight: 500;
  color: #94a3b8;
  white-space: nowrap;
}

.pillar-ten-god-stem.is-me,
.ten-god-tag.is-me {
  color: #ffd700;
  font-weight: 700;
  background: rgba(212, 175, 55, 0.15);
  border: 1px solid rgba(212, 175, 55, 0.5);
  padding: 2px 6px;
  border-radius: 4px;
}

@media (max-width: 600px) {
  .pillar-ten-god-stem,
  .pillar-ten-god-branch,
  .row-stem-god,
  .row-branch-god {
    height: 20px;
    font-size: 0.62rem;
  }
}

/* 핵심: 천간 & 지지 한자 셀 (오주괘.kr 통일 흑칠·황금 프레임) */
.char-cell,
.pillar-char-box {
  width: 100%;
  max-width: 76px;
  height: 84px;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: relative;
  background: rgba(18, 24, 38, 0.95);
  border: 1.5px solid rgba(212, 175, 55, 0.45);
  color: #ffffff;
  box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.7), 0 3px 8px rgba(0, 0, 0, 0.4);
  transition: all 0.2s;
  margin: 3px 0;
}

.char-cell .hanja,
.pillar-char-hanja {
  font-size: 2.6rem;
  font-weight: 900;
  line-height: 1;
  color: #ffffff;
  margin-top: -8px;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
}

.char-cell .sub-element,
.pillar-char-ko {
  font-size: 0.66rem;
  position: absolute;
  bottom: 5px;
  color: var(--gold-light);
  font-weight: 600;
  letter-spacing: 0.5px;
  opacity: 0.9;
  white-space: nowrap;
}

@media (max-width: 600px) {
  .char-cell,
  .pillar-char-box {
    max-width: 58px;
    height: 66px;
    border-radius: 8px;
  }
  .char-cell .hanja,
  .pillar-char-hanja {
    font-size: 1.95rem;
    margin-top: -6px;
  }
  .char-cell .sub-element,
  .pillar-char-ko {
    font-size: 0.55rem;
    bottom: 3px;
  }
}

/* 개별 오행 색상 오버라이드 제거: 고급스러운 단일 흑칠 골드 테마로 통일 */
.elem-wood,
.elem-fire,
.elem-earth,
.elem-metal,
.elem-water {
  background: rgba(18, 24, 38, 0.95) !important;
  border: 1.5px solid rgba(212, 175, 55, 0.45) !important;
  color: #ffffff !important;
}

/* 심플 모드 (한자 집중 모드) */
.oju-cards-wrapper.mode-simple .pillar-ten-god-stem,
.oju-cards-wrapper.mode-simple .pillar-ten-god-branch,
.oju-cards-wrapper.mode-simple .meta-badges-row,
.oju-cards-wrapper.mode-simple .hidden-stems-container,
.oju-cards-wrapper.mode-simple .hidden-stems-wrapper {
  display: none !important;
}

.oju-cards-wrapper.mode-simple .pillar-card {
  padding: 12px 4px;
}

.oju-cards-wrapper.mode-simple .pillar-char-box {
  height: 92px;
}

.oju-cards-wrapper.mode-simple .pillar-char-hanja {
  font-size: 2.9rem;
}

@media (max-width: 600px) {
  .oju-cards-wrapper.mode-simple .pillar-char-box {
    height: 72px;
  }
  .oju-cards-wrapper.mode-simple .pillar-char-hanja {
    font-size: 2.2rem;
  }
}

/* 12운성 & 신살 뱃지 */
.meta-badges-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
  align-items: center;
  margin: 4px 0;
  width: 100%;
}

.unseong-badge {
  font-size: 0.72rem;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  color: #ffca28;
  font-weight: 600;
  border: 1px solid rgba(255, 202, 40, 0.3);
}

.sinsal-badge {
  font-size: 0.68rem;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(66, 165, 245, 0.12);
  color: #90caf9;
  border: 1px solid rgba(66, 165, 245, 0.3);
}

.special-stars-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  justify-content: center;
  margin-top: 2px;
}

.star-tag {
  font-size: 0.65rem;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(212, 175, 55, 0.12);
  color: var(--gold-light);
  border: 1px solid rgba(212, 175, 55, 0.3);
  white-space: nowrap;
}

/* 지장간(地藏干) 가로 칩 리스트 스타일 */
.hidden-stems-wrapper,
.hidden-stems-container {
  width: 100%;
  margin-top: 6px;
  padding-top: 5px;
  border-top: 1px dashed rgba(255, 255, 255, 0.15);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.hidden-stems-list {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 3px;
  width: 100%;
}

.hidden-stem-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  padding: 3px 2px 2px 2px;
  min-width: 17px;
  cursor: default;
  transition: all 0.2s ease;
}

.hidden-stem-chip.is-main {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.28);
}

.hidden-stem-chip:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.4);
}

.hidden-stem-chip .hs-hanja {
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.1;
  color: #f0f6fc;
}

.hidden-stem-chip.is-main .hs-hanja {
  font-weight: 800;
  color: #ffffff;
}

.hidden-stem-chip .hs-god {
  font-size: 0.56rem;
  color: #8b949e;
  line-height: 1.1;
  margin-top: 1px;
  white-space: nowrap;
  letter-spacing: -0.5px;
}

.hidden-stem-chip.is-main .hs-god {
  color: #c9d1d9;
}

@media (max-width: 600px) {
  .hidden-stems-wrapper {
    margin-top: 4px;
    padding-top: 4px;
    gap: 2px;
  }
  .hidden-stems-list {
    gap: 2px;
  }
  .hidden-stem-chip {
    padding: 2px 1px 1px 1px;
    min-width: 13px;
    border-radius: 3px;
  }
  .hidden-stem-chip .hs-hanja {
    font-size: 0.72rem;
  }
  .hidden-stem-chip .hs-god {
    font-size: 0.48rem;
    letter-spacing: -0.8px;
  }
}

/* 공망 및 메타 바 */
.saju-meta-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid rgba(212, 175, 55, 0.2);
  margin-top: 12px;
  padding-top: 10px;
  font-size: 0.82rem;
  color: var(--text-muted);
  flex-wrap: wrap;
  gap: 8px;
}

.gongmang-text strong {
  color: var(--gold-light);
  font-weight: 600;
}

/* ==========================================================================
   4. Daeun (大運) 섹션
   ========================================================================== */
.daeun-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  margin-bottom: 20px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.daeun-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-wrap: wrap;
  gap: 8px;
}

.daeun-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--gold-light);
  display: flex;
  align-items: center;
  gap: 8px;
}

.daeun-summary-badge {
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(212, 175, 55, 0.15);
  border: 1px solid var(--border-color);
  color: var(--gold-light);
  font-weight: 600;
}

.daeun-cards-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 6px;
  overflow-x: auto;
  padding-top: 12px;
  padding-bottom: 6px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

.daeun-cards-grid::-webkit-scrollbar {
  height: 5px;
}
.daeun-cards-grid::-webkit-scrollbar-thumb {
  background: rgba(212, 175, 55, 0.4);
  border-radius: 3px;
}
.daeun-cards-grid::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 3px;
}

.daeun-card {
  width: 100%;
  min-width: 0;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 8px 3px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  cursor: pointer;
  user-select: none;
  position: relative;
  transition: all 0.2s ease;
}

.daeun-card:hover {
  border-color: rgba(212, 175, 55, 0.5);
  transform: translateY(-2px);
}

.daeun-card.active {
  border-color: var(--gold-primary) !important;
  background: rgba(212, 175, 55, 0.18) !important;
  box-shadow: 0 0 12px rgba(212, 175, 55, 0.4);
  transform: translateY(-2px);
}

.daeun-age {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--gold-light);
}

.daeun-year-span {
  font-size: 0.65rem;
  color: #8b949e;
  margin-bottom: 4px;
}

.daeun-chars {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 3px 0;
  gap: 2px;
}

.daeun-char-chip {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  font-weight: 800;
  background: rgba(18, 24, 38, 0.95);
  border: 1.5px solid rgba(212, 175, 55, 0.4);
  color: #ffffff;
  box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.6);
}

.daeun-ten-god {
  font-size: 0.63rem;
  color: #a0aec0;
  white-space: nowrap;
  letter-spacing: -0.4px;
}

.daeun-hangul {
  font-size: 0.65rem;
  color: #c9d1d9;
  margin: 1px 0;
  font-weight: 600;
  letter-spacing: -0.2px;
}

.daeun-unseong {
  font-size: 0.68rem;
  color: #ffca28;
  margin-top: 2px;
  font-weight: 500;
}

/* ==========================================================================
   5. Fortune Flow (세운 & 월운 흐름 영역)
   ========================================================================== */
.fortune-flow-section {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 20px;
}

.flow-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.flow-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.flow-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--gold-light);
  letter-spacing: -0.2px;
}

.flow-badge {
  font-size: 0.65rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.06);
  padding: 1px 6px;
  border-radius: 4px;
}

.flow-grid-12 {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 5px;
  overflow-x: auto;
  padding-top: 12px;
  padding-bottom: 6px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

.flow-grid-12::-webkit-scrollbar {
  height: 5px;
}
.flow-grid-12::-webkit-scrollbar-thumb {
  background: rgba(212, 175, 55, 0.4);
  border-radius: 3px;
}
.flow-grid-12::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 3px;
}

.flow-item {
  width: 100%;
  min-width: 0;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  padding: 6px 2px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transition: all 0.2s ease;
  cursor: pointer;
  user-select: none;
  position: relative;
}

.flow-item:hover {
  border-color: rgba(212, 175, 55, 0.5);
  transform: translateY(-2px);
}

.current-tag-badge {
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  background: #ffd700;
  color: #0b0f19;
  font-size: 0.56rem;
  font-weight: 900;
  padding: 0 5px;
  border-radius: 4px;
  height: 15px;
  line-height: 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.7);
  z-index: 5;
  pointer-events: none;
  letter-spacing: -0.2px;
}

.flow-item.is-current {
  border-color: var(--gold-primary) !important;
  background: rgba(212, 175, 55, 0.16) !important;
  box-shadow: 0 0 10px rgba(212, 175, 55, 0.35);
}

.flow-item.is-current .flow-item-label {
  color: var(--gold-light);
  font-weight: 700;
}

.flow-item.is-current .mini-char {
  color: #ffd700;
  border-color: var(--gold-primary);
}

.flow-item.is-selected:not(.is-current) {
  border-color: #ffffff !important;
  border-width: 1.5px;
  background: rgba(255, 255, 255, 0.12) !important;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.4);
  transform: translateY(-2px);
}

.flow-item.is-selected:not(.is-current) .flow-item-label {
  color: #ffffff;
  font-weight: 700;
}

.flow-item.is-selected:not(.is-current) .mini-char {
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.8);
}

.flow-item-label {
  font-size: 0.72rem;
  color: #8b949e;
  font-weight: 600;
  margin-bottom: 2px;
}

.flow-item-age {
  font-size: 0.58rem;
  color: #ffca28;
  font-weight: 500;
  margin-left: 1px;
}

.flow-item-sub {
  font-size: 0.62rem;
  color: #8b949e;
  margin-top: 1px;
  white-space: nowrap;
}

.flow-item-sub.ten-god {
  font-size: 0.58rem;
  color: var(--gold-light);
  font-weight: 600;
  letter-spacing: -0.4px;
}

.flow-item-ganji {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 2px 0;
}

.mini-char {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  font-weight: 800;
  background: rgba(18, 24, 38, 0.95);
  border: 1px solid rgba(212, 175, 55, 0.4);
  color: #ffffff;
  box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.6);
}

/* ==========================================================================
   6. Elements Stats (오행 분석 통계 그래프)
   ========================================================================== */
.elements-stats-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  margin-bottom: 20px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

@media (max-width: 600px) {
  .stats-grid {
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
  }
}

.stat-box {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 8px 4px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  transition: all 0.2s ease;
}

.stat-box:hover {
  border-color: rgba(212, 175, 55, 0.4);
  transform: translateY(-1px);
}

.stat-elem-name {
  font-size: 0.8rem;
  font-weight: 700;
}

.stat-count {
  font-size: 1.05rem;
  font-weight: 800;
}

.stat-bar-wrap {
  width: 82%;
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 3px;
}

.stat-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.4s ease;
}

/* ==========================================================================
   7. Meta Info Cards (상세 정보 및 절기 카드)
   ========================================================================== */
.meta-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

@media (max-width: 600px) {
  .meta-info-grid {
    grid-template-columns: 1fr;
  }
}

.meta-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  font-size: 0.85rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

.meta-card-title {
  color: var(--gold-light);
  font-weight: 600;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.meta-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.meta-row:last-child {
  border-bottom: none;
}

.meta-label {
  color: var(--text-muted);
}

.meta-value {
  color: var(--text-main);
  font-weight: 500;
}

/* ==========================================================================
   8. Scroll Wheel Picker (휠 스크롤바 일시 선택기)
   ========================================================================== */
.picker-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
  padding: 0 4px;
}

.scroll-picker-box {
  display: flex;
  position: relative;
  height: 150px;
  background: rgba(10, 14, 22, 0.95);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.7);
}

.picker-center-highlight {
  position: absolute;
  top: 70px;
  left: 0;
  right: 0;
  height: 40px;
  background: linear-gradient(90deg, rgba(212, 175, 55, 0.05) 0%, rgba(212, 175, 55, 0.2) 50%, rgba(212, 175, 55, 0.05) 100%);
  border-top: 1px solid var(--gold-primary);
  border-bottom: 1px solid var(--gold-primary);
  pointer-events: none;
  z-index: 1;
}

.picker-column {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  min-width: 0;
  height: 100%;
}

.picker-column:last-child {
  border-right: none;
}

.picker-column.col-year {
  flex: 1.45;
}

.picker-column.col-hour {
  flex: 1.25;
}

.picker-column.col-month,
.picker-column.col-day,
.picker-column.col-minute {
  flex: 0.9;
}

.column-header {
  height: 30px;
  line-height: 30px;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--gold-light);
  background: rgba(0, 0, 0, 0.45);
  border-bottom: 1px solid rgba(212, 175, 55, 0.2);
  z-index: 2;
  white-space: nowrap;
  box-sizing: border-box;
}

.wheel-scroll {
  height: 120px;
  overflow-y: auto;
  overflow-x: hidden;
  box-sizing: border-box;
  padding-top: 40px;
  padding-bottom: 40px;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-overflow-scrolling: touch;
}

.wheel-scroll::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

.wheel-item {
  height: 40px;
  line-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  scroll-snap-align: center;
  scroll-snap-stop: normal;
  font-size: 0.92rem;
  color: var(--text-dim);
  cursor: pointer;
  user-select: none;
  white-space: nowrap !important;
  overflow: visible;
  padding: 0 4px;
  box-sizing: border-box;
  margin: 0;
  transition: color 0.15s ease, font-size 0.15s ease;
}

.wheel-item span {
  pointer-events: none;
}

.wheel-item:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.04);
}

.wheel-item.selected {
  color: var(--gold-light);
  font-weight: 700;
  font-size: 1.1rem;
  text-shadow: 0 0 10px rgba(212, 175, 55, 0.5);
  white-space: nowrap !important;
}

/* ==========================================================================
   9. Footer & Modal Dialogs
   ========================================================================== */
.app-footer {
  margin-top: 32px;
  margin-bottom: 24px;
  padding-top: 20px;
  border-top: 1px solid rgba(212, 175, 55, 0.2);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.footer-badge,
.version-badge-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--gold-light);
  background: rgba(212, 175, 55, 0.12);
  border: 1px solid rgba(212, 175, 55, 0.35);
  padding: 3px 10px;
  border-radius: 12px;
  letter-spacing: 0.5px;
  cursor: pointer;
  outline: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.version-badge-btn:hover {
  background: rgba(212, 175, 55, 0.25);
  border-color: var(--gold-primary);
  box-shadow: 0 0 12px rgba(212, 175, 55, 0.35);
  transform: translateY(-1px);
}

.version-badge-btn:active {
  transform: scale(0.95);
}

.footer-contact {
  font-size: 0.85rem;
  color: var(--text-main);
}

.footer-email {
  color: var(--gold-light);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.2s;
}

.footer-email:hover {
  color: #ffffff;
}

.footer-notice {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* Modal Popup */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-overlay.active,
.modal-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: #161b26;
  border: 1px solid var(--gold-primary);
  border-radius: var(--radius-lg);
  max-width: 720px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.8);
  transform: scale(0.95);
  transition: transform 0.25s ease;
}

.modal-overlay.active .modal-content,
.modal-overlay.show .modal-content {
  transform: scale(1);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
  font-size: 1.15rem;
  color: var(--gold-light);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
}

.modal-body {
  padding: 16px;
  overflow-y: auto;
}

/* 분주표 테이블 스타일 */
.table-responsive {
  overflow-x: auto;
}

.minute-table {
  width: 100%;
  border-collapse: collapse;
  text-align: center;
  font-size: 0.82rem;
}

.minute-table th,
.minute-table td {
  border: 1px solid rgba(212, 175, 55, 0.2);
  padding: 6px 4px;
}

.minute-table th {
  background: rgba(212, 175, 55, 0.15);
  color: var(--gold-light);
  font-weight: 600;
}

.minute-table td.cell-match {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.5), rgba(212, 175, 55, 0.2)) !important;
  color: #fff !important;
  font-weight: 800;
  box-shadow: inset 0 0 10px rgba(212, 175, 55, 0.8);
  position: relative;
}

.minute-table td.cell-match::after {
  content: '👈 현재';
  position: absolute;
  right: 2px;
  bottom: 2px;
  font-size: 0.6rem;
  background: #d4af37;
  color: #000;
  border-radius: 2px;
  padding: 1px 3px;
  font-weight: bold;
}

/* Toast 알림 */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: rgba(22, 27, 39, 0.95);
  color: var(--gold-light);
  border: 1px solid var(--gold-primary);
  padding: 10px 20px;
  border-radius: 30px;
  font-size: 0.85rem;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
  transition: transform 0.3s ease;
  z-index: 2000;
  pointer-events: none;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

/* 오주 명식 카드 새로고침 반짝임 피드백 */
@keyframes ojuFlashUpdate {
  0% {
    opacity: 0.55;
    filter: brightness(1.3);
  }
  100% {
    opacity: 1;
    filter: brightness(1);
  }
}

.oju-cards-wrapper.flash-update {
  animation: ojuFlashUpdate 0.4s ease-out;
}

/* ==========================================================================
   모바일 최적화: 대운(2행 5열) & 세운·월운(2행 6열) 그리드 뷰 (오주괘.kr 스타일)
   ========================================================================== */
@media (max-width: 768px) {
  /* 대운: 모바일 2행 5열 그리드 (10개 대운 한눈에 쏙 들어오게 배치) */
  .daeun-section {
    padding: 12px 6px;
  }
  .daeun-cards-grid {
    grid-template-columns: repeat(5, 1fr) !important;
    row-gap: 12px !important;
    column-gap: 4px !important;
    overflow-x: visible !important;
    padding-top: 10px !important;
    padding-bottom: 0 !important;
  }
  .daeun-card {
    flex: none !important;
    width: 100% !important;
    min-width: 0 !important;
    padding: 6px 1px 4px 1px !important;
    border-radius: 6px;
  }
  .daeun-age {
    font-size: 0.74rem;
    font-weight: 700;
    line-height: 1.1;
  }
  .daeun-year-span {
    font-size: 0.55rem;
    margin-bottom: 2px;
    line-height: 1;
  }
  .daeun-ten-god {
    font-size: 0.5rem;
    letter-spacing: -0.6px;
    line-height: 1.1;
    white-space: nowrap;
  }
  .daeun-chars {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 2px;
    margin: 2px 0;
  }
  .daeun-char-chip {
    width: 22px;
    height: 22px;
    border-radius: 4px;
    font-size: 0.88rem;
    line-height: 20px;
  }
  .daeun-hangul {
    font-size: 0.52rem;
    color: #c9d1d9;
    margin: 1px 0;
    line-height: 1.1;
    letter-spacing: -0.4px;
  }
  .daeun-unseong {
    font-size: 0.56rem;
    margin-top: 1px;
  }

  /* 세운 & 월운: 모바일 2행 6열 그리드 (12개 한눈에 쏙 들어오게 배치) */
  .fortune-flow-section {
    gap: 10px;
  }
  .flow-card {
    padding: 10px 5px !important;
  }
  .flow-grid-12 {
    grid-template-columns: repeat(6, 1fr) !important;
    row-gap: 12px !important;
    column-gap: 3px !important;
    overflow-x: visible !important;
    padding-top: 10px !important;
    padding-bottom: 0 !important;
  }
  .flow-item {
    flex: none !important;
    width: 100% !important;
    min-width: 0 !important;
    padding: 5px 1px 4px 1px !important;
    border-radius: 6px;
  }
  .flow-item-label {
    font-size: 0.65rem;
    font-weight: 700;
    margin-bottom: 1px;
    line-height: 1.1;
  }
  .flow-item-age {
    font-size: 0.52rem;
    color: #ffca28;
    display: inline;
    margin-left: 1px;
    font-weight: 500;
  }
  .flow-item-sub {
    font-size: 0.54rem;
    letter-spacing: -0.5px;
    line-height: 1.1;
    color: #a0aec0;
  }
  .flow-item-sub.ten-god,
  .flow-item-sub.term-name,
  .flow-item-sub.unseong-tag {
    display: none; /* 모바일에서 글자 겹침 방지 및 연도/월+간지+한글 조합으로 깔끔하게 유지 */
  }
  .flow-item-ganji {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 0;
    margin: 1px 0;
  }
  .mini-char {
    width: auto !important;
    height: auto !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    font-size: 0.95rem !important;
    font-weight: 800 !important;
    padding: 0 !important;
    line-height: 1.05 !important;
    color: #ffffff !important;
  }
  .flow-item.is-current .mini-char {
    color: #ffd700 !important;
  }
  .current-tag-badge {
    top: -8px;
    font-size: 0.52rem;
    padding: 0 4px;
    height: 14px;
    line-height: 14px;
  }
}

