/* ============================================================
   MindLog 사주 — 페이지 전용 스타일
   base.css(FireLab 공용 디자인 시스템) 위에 얹는 오버레이.
   ============================================================ */

:root {
  --c1: #7C5CE7;
  --c2: #E7A94C;
  --on-c: #FFFFFF;

  /* 오행 색 (라이트) */
  --el-wood:  #2FA36B;
  --el-fire:  #E25555;
  --el-earth: #C99235;
  --el-metal: #8B8FA3;
  --el-water: #3D7DDB;
}
:root[data-theme="dark"], :root:not([data-theme="light"]) {
  --el-wood:  #3FBF82;
  --el-fire:  #F07070;
  --el-earth: #DBA84E;
  --el-metal: #A5A9BE;
  --el-water: #5C96EE;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --el-wood:  #2FA36B;
    --el-fire:  #E25555;
    --el-earth: #C99235;
    --el-metal: #8B8FA3;
    --el-water: #3D7DDB;
  }
}

/* 좁은 화면에서 상단 메뉴 줄바꿈 방지 */
.topbar .brand, .topnav a { white-space: nowrap; }
.rhero-saju h1, .saju-hero h1, .saju-hero p { word-break: keep-all; }
@media (max-width: 430px) {
  .topbar.narrow { padding: 14px 12px; gap: 6px; }
  .topnav { gap: 1px; }
  .topnav a { padding: 6px 5px; font-size: .8rem; }
  .brand { font-size: .9rem; gap: 6px; }
  .brand .mark { width: 25px; height: 25px; }
}

.screen { animation: fadeUp .35s ease both; padding-bottom: 44px; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ---------- 입력 화면 ---------- */
.saju-hero { text-align: center; padding: 26px 0 20px; }
.saju-hero .big { font-size: 3.4rem; line-height: 1; }
.saju-hero h1 { font-size: clamp(1.7rem, 6vw, 2.2rem); font-weight: 900; margin-top: 12px; }
.saju-hero h1 .grad {
  background: linear-gradient(120deg, var(--c1), var(--c2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.saju-hero p { color: var(--muted); margin: 10px auto 0; max-width: 30em; font-size: .95rem; }

.form-card { margin-top: 6px; }
.field { margin-bottom: 18px; }
.field:last-child { margin-bottom: 0; }
.field > label, .field .flabel {
  display: block; font-size: .84rem; font-weight: 800; color: var(--ink-2); margin-bottom: 8px;
}
.field .hint { font-size: .78rem; color: var(--muted); font-weight: 500; margin-left: 6px; }

.seg { display: flex; gap: 6px; background: var(--bg2); border: 1px solid var(--line); border-radius: 13px; padding: 4px; }
.seg button {
  flex: 1; border: 0; background: transparent; color: var(--muted);
  padding: 10px 6px; border-radius: 10px; font-weight: 700; font-size: .9rem; cursor: pointer;
  transition: all .15s ease;
}
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

.selrow { display: flex; gap: 8px; }
.selrow select, .selrow input[type="text"] {
  flex: 1; min-width: 0; appearance: none; -webkit-appearance: none;
  background: var(--surface); border: 1px solid var(--line-2); color: var(--ink);
  border-radius: 12px; padding: 12px 12px; font: inherit; font-weight: 600; font-size: .95rem;
}
.selrow select:focus, .selrow input:focus { outline: 2px solid var(--c1); outline-offset: 1px; border-color: transparent; }
select:disabled { opacity: .45; }

.check {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 9px;
  font-size: .86rem; font-weight: 600; color: var(--muted); cursor: pointer;
}
.check input { width: 17px; height: 17px; accent-color: var(--c1); }

details.adv { margin-top: 2px; }
details.adv summary {
  cursor: pointer; font-size: .84rem; font-weight: 700; color: var(--muted);
  list-style: none; display: inline-flex; align-items: center; gap: 5px;
}
details.adv summary::-webkit-details-marker { display: none; }
details.adv summary::before { content: '▸'; transition: transform .15s ease; }
details.adv[open] summary::before { transform: rotate(90deg); }
details.adv .inner { margin-top: 10px; padding: 12px 14px; background: var(--bg2); border-radius: 12px; font-size: .85rem; }

.err { color: #E25555; font-size: .86rem; font-weight: 700; margin-top: 10px; display: none; }
.err.show { display: block; }

/* ---------- 로딩 ---------- */
.saju-loading { text-align: center; padding: 90px 0; }
.saju-loading .orb {
  width: 76px; height: 76px; margin: 0 auto 22px; border-radius: 50%;
  background: conic-gradient(from 0deg, var(--c1), var(--c2), var(--c1));
  animation: spin 1.6s linear infinite; position: relative;
}
.saju-loading .orb::after {
  content: '🔮'; position: absolute; inset: 4px; border-radius: 50%;
  background: var(--bg); display: grid; place-items: center; font-size: 1.9rem;
}
@keyframes spin { to { transform: rotate(360deg); } }
.saju-loading p { color: var(--muted); font-weight: 700; }

/* ---------- 결과: 히어로 ---------- */
.rhero-saju {
  border-radius: var(--r-xl); padding: 30px 22px 26px; text-align: center; color: var(--on-c);
  background:
    radial-gradient(140% 120% at 15% 0%, rgba(255,255,255,.16), transparent 45%),
    linear-gradient(140deg, var(--c1), #4C3A9E 55%, #2C2452);
  box-shadow: var(--shadow-lift);
  position: relative; overflow: hidden;
}
.rhero-saju .cap { font-size: .82rem; opacity: .8; font-weight: 700; letter-spacing: .06em; }
.rhero-saju .dm { font-size: 3.6rem; line-height: 1.15; font-weight: 900; margin: 8px 0 2px; }
.rhero-saju h1 { font-size: 1.32rem; font-weight: 800; opacity: .96; }
.rhero-saju .chips { display: flex; gap: 7px; justify-content: center; flex-wrap: wrap; margin-top: 15px; }

/* ---------- 결과: 공통 섹션 ---------- */
.rsec { margin-top: 16px; }
.rsec .card { overflow: hidden; }
.rsec h2 {
  font-size: 1.02rem; font-weight: 800; display: flex; align-items: center; gap: 8px;
  padding: 16px 20px 0;
}
.rsec h2 .sub { font-size: .78rem; color: var(--muted); font-weight: 600; margin-left: auto; }
.rsec .bd { padding: 14px 20px 18px; }
.rsec .note { font-size: .9rem; color: var(--ink-2); }
.rsec .note + .note { margin-top: 8px; }
.small-muted { font-size: .8rem; color: var(--muted); }

/* ---------- 원국표 ---------- */
.pillar-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.pillar-grid.no-hour { grid-template-columns: repeat(3, 1fr); }
.pcol { text-align: center; }
.pcol .plabel { font-size: .74rem; font-weight: 800; color: var(--muted); margin-bottom: 6px; }
.pcol .ss { font-size: .72rem; font-weight: 700; color: var(--c1); height: 1.3em; margin-bottom: 5px; }
.pcol .ss.me { color: var(--c2); }
.tile {
  border-radius: 14px; padding: 9px 2px 7px; color: #fff; margin-bottom: 6px;
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  text-shadow: 0 1px 4px rgba(0,0,0,.25);
}
.tile .hj { font-size: 1.65rem; font-weight: 900; line-height: 1.15; }
.tile .kr { font-size: .68rem; font-weight: 700; opacity: .92; }
.tile.el-목 { background: var(--el-wood); }
.tile.el-화 { background: var(--el-fire); }
.tile.el-토 { background: var(--el-earth); }
.tile.el-금 { background: var(--el-metal); }
.tile.el-수 { background: var(--el-water); }
.pcol .xtra { font-size: .7rem; color: var(--muted); line-height: 1.5; }
.pcol .xtra b { color: var(--ink-2); font-weight: 700; }
.pillar-meta { margin-top: 12px; font-size: .8rem; color: var(--muted); line-height: 1.6; }

/* ---------- 오행 바 ---------- */
.el-row { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; }
.el-row:last-child { margin-bottom: 0; }
.el-row .nm { width: 58px; font-size: .85rem; font-weight: 800; flex-shrink: 0; }
.el-row .bar { flex: 1; height: 12px; border-radius: 999px; background: var(--bg2); border: 1px solid var(--line); overflow: hidden; }
.el-row .bar i { display: block; height: 100%; border-radius: 999px; transition: width .6s ease; }
.el-row .cnt { width: 74px; text-align: right; font-size: .78rem; color: var(--muted); font-weight: 700; flex-shrink: 0; }
.el-row .cnt b { color: var(--ink); }
.bar i.el-목 { background: var(--el-wood); }
.bar i.el-화 { background: var(--el-fire); }
.bar i.el-토 { background: var(--el-earth); }
.bar i.el-금 { background: var(--el-metal); }
.bar i.el-수 { background: var(--el-water); }

.callout {
  margin-top: 14px; padding: 13px 15px; border-radius: 13px;
  background: var(--brand-soft); font-size: .88rem; color: var(--ink-2); line-height: 1.6;
}
.callout b { color: var(--brand); }

/* ---------- 십성 ---------- */
.ss-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px; margin-bottom: 13px; }
.ss-cell { text-align: center; background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 9px 2px; }
.ss-cell .n { font-size: 1.25rem; font-weight: 900; color: var(--c1); line-height: 1.2; }
.ss-cell .lb { font-size: .72rem; font-weight: 700; color: var(--muted); }
.ss-cell.hot { background: var(--brand-soft); border-color: transparent; }

/* ---------- 신살 ---------- */
.sh-item { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.sh-item:last-child { border-bottom: 0; padding-bottom: 0; }
.sh-item .tag {
  flex-shrink: 0; font-size: .78rem; font-weight: 800; padding: 4px 10px; border-radius: 999px;
  background: var(--brand-soft); color: var(--brand);
}
.sh-item .tag.warn { background: rgba(226,85,85,.12); color: #E25555; }
.sh-item p { margin: 0; font-size: .87rem; color: var(--ink-2); }
.sh-item p .at { font-size: .76rem; color: var(--muted); }

/* ---------- 대운 타임라인 ---------- */
.daeun-scroll { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 8px; scrollbar-width: thin; }
.daeun-cell {
  flex: 0 0 76px; text-align: center; border: 1px solid var(--line); border-radius: 13px;
  padding: 10px 4px; background: var(--bg2);
}
.daeun-cell.cur { background: var(--brand-soft); border-color: var(--brand); box-shadow: 0 6px 16px -8px var(--brand); }
.daeun-cell .age { font-size: .72rem; font-weight: 800; color: var(--muted); }
.daeun-cell.cur .age { color: var(--brand); }
.daeun-cell .gj { font-size: 1.12rem; font-weight: 900; margin: 3px 0; }
.daeun-cell .yr { font-size: .66rem; color: var(--muted); }
.daeun-cell .el { font-size: .68rem; font-weight: 700; margin-top: 2px; }

/* ---------- 세운 ---------- */
.seun-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: .88rem; }
.seun-row:last-child { border-bottom: 0; }
.seun-row .yr { width: 52px; font-weight: 800; flex-shrink: 0; }
.seun-row .gj { width: 76px; font-weight: 700; color: var(--ink-2); flex-shrink: 0; }
.seun-row .ss2 { width: 46px; font-size: .78rem; font-weight: 700; color: var(--c1); flex-shrink: 0; }
.seun-row .rel { font-size: .76rem; color: var(--muted); }
.seun-row.now { background: var(--brand-soft); margin: 0 -10px; padding: 9px 10px; border-radius: 10px; border-bottom: 0; }

/* ---------- 관계(형충회합) ---------- */
.rel-chip {
  display: inline-flex; gap: 6px; align-items: center; margin: 0 6px 8px 0;
  font-size: .8rem; font-weight: 700; padding: 6px 11px; border-radius: 999px;
  background: var(--bg2); border: 1px solid var(--line); color: var(--ink-2);
}
.rel-chip b { color: var(--c1); }

/* ---------- 결과 하단 ---------- */
.actions { display: grid; gap: 9px; margin-top: 20px; }
.warn-list { margin: 0 0 14px; padding: 12px 15px; border-radius: 13px; background: rgba(231,169,76,.1); font-size: .82rem; color: var(--ink-2); }
.warn-list li { margin-left: 16px; }
.disclaimer { margin-top: 16px; font-size: .78rem; color: var(--muted); text-align: center; line-height: 1.6; }

/* ---------- 허브 (기능 선택) ---------- */
.fgrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 11px; margin-top: 4px; }
.fcard {
  display: flex; flex-direction: column; gap: 3px; text-decoration: none; color: inherit;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 16px 15px 14px; box-shadow: var(--shadow);
  transition: transform .16s ease, box-shadow .2s ease, border-color .16s ease;
}
.fcard:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); border-color: var(--line-2); }
.fcard .fem { font-size: 1.7rem; line-height: 1.2; }
.fcard .ftit { font-weight: 800; font-size: 1rem; margin-top: 4px; }
.fcard .fdesc { font-size: .78rem; color: var(--muted); line-height: 1.45; }
.fcard:first-child { grid-column: 1 / -1; flex-direction: row; align-items: center; gap: 13px; }
.fcard:first-child .fem { font-size: 2.1rem; }
.fcard:first-child .ftit { margin-top: 0; }
.fcard:first-child .fdesc { flex: 1; text-align: right; }
@media (max-width: 400px) { .fcard:first-child .fdesc { display: none; } }

.subhead { margin: 0 0 14px; font-weight: 800; font-size: .95rem; color: var(--brand); }

/* ---------- 점수·행운 컴포넌트 ---------- */
.score-big { font-weight: 900; }
.score-big small { font-size: .45em; font-weight: 800; opacity: .75; margin-left: 2px; }
.star-dim { opacity: .25; }
.stars-cell { letter-spacing: .05em; color: #E7A94C; }

.lucky-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.lucky { text-align: center; background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 11px 6px; }
.lucky .lb { font-size: .7rem; font-weight: 700; color: var(--muted); margin-bottom: 3px; }
.lucky .vl { font-size: .86rem; font-weight: 800; line-height: 1.35; }

@media (max-width: 420px) {
  .tile .hj { font-size: 1.4rem; }
  .el-row .cnt { width: 64px; }
}
