/* 레미 사주 웹 페이지(/saju, /match) 공통 — 앱의 따뜻한 크림색·세리프 제목·오행 다섯 색(ui/theme/Color.kt ElementTones) */
:root {
  color-scheme: light dark;
  --bg: #faf6f0; --fg: #2b2622; --sub: #5c534b; --muted: #8a8077; --line: #e6ddd2; --card: #ffffff; --soft: #f3eadc;
  --accent: #4e3b2a; --accent-fg: #fff8ec; --good: #4f7a57; --bad: #a6432e;
  --wood: #5F9469; --fire: #DB6E52; --earth: #C4902F; --metal: #A39679; --water: #5088B3;
  --wood-d: #386647; --fire-d: #A6432E; --earth-d: #7A5718; --metal-d: #5F5747; --water-d: #2E5777;
  --wood-s: #E2EEDD; --fire-s: #FBE4DB; --earth-s: #F6EACB; --metal-s: #EEE9DD; --water-s: #DDE9F3;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1c1a18; --fg: #eee8e1; --sub: #c9c0b6; --muted: #948a80; --line: #36312c; --card: #26231f; --soft: #2f2a25;
    --accent: #e9d6be; --accent-fg: #2b2622; --good: #9fbf9f; --bad: #f0a08c;
    --wood-s: #2c3a2e; --fire-s: #43281f; --earth-s: #3e3220; --metal-s: #36322a; --water-s: #233444;
    --wood-d: #a9cfae; --fire-d: #f3a58f; --earth-d: #e5c27a; --metal-d: #d2c7ae; --water-d: #9cc3e2;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: -apple-system, "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif; -webkit-text-size-adjust: 100%; }
main { max-width: 560px; margin: 0 auto; padding: 28px 16px 64px; }
h1, h2, .serif { font-family: "Noto Serif KR", "Nanum Myeongjo", "AppleMyungjo", Batang, Georgia, serif; }
h1 { font-size: 27px; line-height: 1.35; margin: 6px 0 8px; word-break: keep-all; }
h2 { font-size: 19px; margin: 0 0 10px; word-break: keep-all; }
h3 { font-size: 15px; margin: 18px 0 8px; }
p { color: var(--sub); font-size: 14.5px; line-height: 1.75; margin: 0 0 8px; word-break: keep-all; }
a { color: inherit; }
.brand { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--sub); text-decoration: none; }
.brand b { font-family: Georgia, "Noto Serif KR", serif; font-size: 18px; color: var(--fg); }
.hero { display: flex; align-items: center; gap: 12px; margin-top: 18px; }
.hero > div { flex: 1; min-width: 0; }
.hero img { width: 112px; height: auto; flex: none; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 18px; margin-top: 16px; }
.muted, .small { color: var(--muted); font-size: 12.5px; line-height: 1.65; }
.hidden { display: none !important; }
.note { display: block; background: var(--soft); border-radius: 12px; padding: 10px 12px; font-size: 12.5px; color: var(--sub); line-height: 1.6; margin-top: 12px; word-break: keep-all; }

/* 입력 */
.field { margin-top: 14px; }
.field > label, .field > .label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 6px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.seg { display: inline-flex; background: var(--soft); border-radius: 12px; padding: 3px; }
.seg button { border: 0; background: transparent; color: var(--sub); padding: 8px 14px; border-radius: 9px; font-size: 14px; font-weight: 700; cursor: pointer; font-family: inherit; }
.seg button[aria-pressed="true"] { background: var(--card); color: var(--fg); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
input[type=number], select { font: inherit; font-size: 16px; color: var(--fg); background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 9px 8px; min-width: 0; }
input[type=number] { width: 64px; }
input.y { width: 80px; }
.unit { font-size: 14px; color: var(--sub); }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--sub); }
details summary { cursor: pointer; font-size: 13px; color: var(--muted); margin-top: 14px; }
.error { color: var(--bad); font-size: 13px; margin-top: 10px; min-height: 1em; }
.btn { display: block; width: 100%; margin-top: 14px; padding: 15px; border: 0; border-radius: 14px; font: inherit; font-size: 15.5px; font-weight: 700; text-align: center; text-decoration: none; cursor: pointer; background: var(--accent); color: var(--accent-fg); }
.btn.ghost { background: transparent; color: var(--fg); border: 1px solid var(--line); }
.btn small { display: block; font-size: 12px; font-weight: 500; opacity: .85; margin-top: 2px; }

/* 기둥 */
.pillars { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; text-align: center; }
.pillars.three { grid-template-columns: repeat(3, 1fr); }
.pcol .cap { font-size: 12px; color: var(--muted); font-weight: 700; margin-bottom: 4px; }
.pcol .god { font-size: 11.5px; color: var(--sub); min-height: 16px; margin: 3px 0; }
.tile { display: flex; flex-direction: column; align-items: center; justify-content: center; aspect-ratio: 1 / 1; max-width: 76px; margin: 0 auto; border-radius: 14px; font-family: "Noto Serif KR", Batang, serif; }
.tile .h { font-size: 30px; font-weight: 700; line-height: 1; }
.tile .k { font-size: 11px; margin-top: 3px; font-family: -apple-system, "Noto Sans KR", sans-serif; opacity: .9; }
.tile.sm { width: 44px; height: 44px; border-radius: 10px; }
.tile.sm .h { font-size: 21px; }
.tile.sm .k { display: none; }
.e0 { --c: var(--wood); --cd: var(--wood-d); --cs: var(--wood-s); }
.e1 { --c: var(--fire); --cd: var(--fire-d); --cs: var(--fire-s); }
.e2 { --c: var(--earth); --cd: var(--earth-d); --cs: var(--earth-s); }
.e3 { --c: var(--metal); --cd: var(--metal-d); --cs: var(--metal-s); }
.e4 { --c: var(--water); --cd: var(--water-d); --cs: var(--water-s); }
.tile.stem { background: var(--c); color: #fff; }
.tile.branch { background: var(--cs); color: var(--cd); border: 1.5px solid var(--c); }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 5px 11px; border-radius: 999px; font-size: 13px; font-weight: 700; background: var(--cs, var(--soft)); color: var(--cd, var(--sub)); margin: 3px 4px 3px 0; }
.chip.good { background: var(--wood-s); color: var(--wood-d); }
.chip.bad { background: var(--fire-s); color: var(--fire-d); }

/* 막대 */
.bars .bar { display: grid; grid-template-columns: 54px 1fr 44px; gap: 8px; align-items: center; margin: 7px 0; font-size: 13px; }
.track { height: 12px; border-radius: 6px; background: var(--soft); overflow: hidden; position: relative; }
.fill { height: 100%; border-radius: 6px; background: var(--c, var(--accent)); }
.bars .v { text-align: right; color: var(--sub); font-variant-numeric: tabular-nums; }
.gauge { position: relative; height: 14px; border-radius: 7px; background: linear-gradient(90deg, var(--water-s), var(--earth-s) 50%, var(--fire-s)); margin: 26px 0 6px; }
.gauge .tick { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--line); }
.gauge .pin { position: absolute; top: -24px; transform: translateX(-50%); font-size: 12px; font-weight: 700; white-space: nowrap; }
.gauge .dot { position: absolute; top: -3px; width: 20px; height: 20px; border-radius: 50%; transform: translateX(-50%); background: var(--accent); border: 3px solid var(--card); }
.gauge-legend { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); }

/* 대운 */
.daeun { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 8px; scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; }
.du { flex: none; width: 74px; text-align: center; padding: 8px 4px; border-radius: 14px; border: 1px solid var(--line); scroll-snap-align: start; }
.du.now { border: 2px solid var(--accent); background: var(--soft); }
.du .age { font-size: 12.5px; font-weight: 700; }
.du .yr { font-size: 11px; color: var(--muted); margin-bottom: 6px; }
.du .tiles { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.du .gd { font-size: 11.5px; color: var(--sub); margin-top: 5px; }

/* 오늘 */
.today { text-align: center; }
.today .tiles { display: flex; gap: 6px; justify-content: center; margin: 10px 0; }
.today .tiles .tile { width: 64px; margin: 0; }
.today .big { font-size: 21px; font-weight: 700; margin: 4px 0; }
.today .line { color: var(--fg); font-size: 14.5px; }
.scores { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.score { background: var(--soft); border-radius: 12px; padding: 8px 6px; text-align: center; }
.score b { display: block; font-size: 19px; }
.score span { font-size: 12px; color: var(--sub); }

/* 궁합 */
.ring { display: flex; align-items: center; gap: 16px; }
.ring svg { flex: none; }
.ring .word { font-size: 20px; font-weight: 700; word-break: keep-all; }
.radar { display: block; margin: 6px auto 0; max-width: 100%; height: auto; }
.reason { padding: 10px 0; border-top: 1px solid var(--line); }
.reason:first-child { border-top: 0; }
.reason p { margin: 4px 0 0; font-size: 13.5px; }
.vs { display: grid; grid-template-columns: 40px 1fr; gap: 8px; align-items: center; margin: 8px 0; font-size: 13px; }
.vs .two .track { height: 9px; margin: 2px 0; }
.vs .two .track.them .fill { opacity: .45; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--accent); margin-right: 4px; vertical-align: -1px; }
.legend i.them { opacity: .45; }

/* 앱 안내 */
.cta { background: var(--soft); border: 0; text-align: center; }
.cta img { width: 96px; height: auto; }
footer { margin-top: 28px; text-align: center; font-size: 12.5px; color: var(--muted); line-height: 1.9; }
footer a { color: var(--muted); margin: 0 6px; }
.faq h3 { margin-top: 14px; }
.faq p { font-size: 13.5px; }
