/* 플라워도사 하이브리드 앱 스타일.
   라이트/다크를 모두 지원하고, iOS 노치(safe-area)를 피해 레이아웃한다. */

:root {
  /* 브라우저에게 두 테마를 모두 지원한다고 알린다. 날짜 선택기·셀렉트 같은
     네이티브 위젯이 OS 설정을 따라간다. <meta name="color-scheme"> 만으로는
     계산된 속성이 normal 로 남아 일부 위젯이 라이트로 뜬다 (브라우저에서 확인). */
  color-scheme: light dark;

  --bg: #f6f3ef;
  --surface: #ffffff;
  --text: #241f1b;
  --muted: #6d635b;
  --line: #e2dad1;
  --accent: #9b2d5e;
  --accent-soft: #f6e6ee;
  --danger: #b3261e;
  /* 등급 '평'(보통) 전용 중립색.
     ★ 처음에는 --accent-soft(분홍)를 썼는데, '흉'(#f8e8e6)과 거의 같은 분홍이라
       월간 달력에서 두 등급이 구분되지 않았다 (스크린샷에서 발견). 평을 회색으로
       내리니 대길(녹)-길(파)-평(회)-주의(주황)-흉(빨강) 다섯 단계가 또렷해지고,
       가장 흔한 '평'이 가라앉아 눈에 띄어야 할 날이 드러난다. */
  --neutral-soft: #ece8e3;
  --neutral-text: #5c544c;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(36, 31, 27, .06), 0 8px 24px rgba(36, 31, 27, .06);
}

@media (prefers-color-scheme: dark) {
  :root {
    /* 17차: 따뜻한 다크 브라운 쪽으로 반 단계 옮겼다. 회색 charcoal 보다
       로즈 핑크와 붙었을 때 꽃·인연 쪽으로 읽힌다. 대비는 더 벌어진다. */
    --bg: #171210;
    --surface: #241c1a;
    --text: #f4ece6;
    --muted: #b2a49b;
    --line: #3b312c;
    --accent: #ec7fab;
    --accent-soft: #38232d;
    --neutral-soft: #2e2724;
    --neutral-text: #bbb1a8;
    --shadow: none;
    /* ★ 라이트의 --danger(#b3261e)를 그대로 쓰면 어두운 배경 위에서 2.6:1 밖에
       안 나온다 (삭제 버튼·오류 문구가 거의 안 보였다 — 브라우저 대비 측정에서
       잡았다). 어두운 배경용으로 밝은 쪽을 쓴다. */
    --danger: #f2847c;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo",
               "Malgun Gothic", "Noto Sans KR", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}

/* --------------------------------------------------- 브랜드 헤더 (17차)

   한 줄짜리 머리다 — 뒤로 · 로고 · 이름 · 알림 · 내 정보.
   긴 서비스 설명은 뺐다. 설명은 필요한 화면에서 한다.                      */

.app-bar {
  display: flex; align-items: center; gap: 8px;
  padding: calc(env(safe-area-inset-top) + 10px)
           max(12px, env(safe-area-inset-right)) 10px
           max(12px, env(safe-area-inset-left));
  background: var(--accent);
  color: #fff;
}

/* ★ 다크에서 --accent 는 밝은 분홍이다. 앱 바가 그걸 배경으로 쓰면 어두운 화면
   맨 위에 **밝은 띠**가 박힌다 (스크린샷에서 발견). 브랜드 색은 유지하되
   어두운 쪽 톤을 쓴다 — 흰 글씨 대비도 라이트와 같은 수준으로 남는다. */
@media (prefers-color-scheme: dark) {
  .app-bar { background: #51162f; }
}

.brand-mark {
  flex: 0 0 auto;
  display: inline-flex; align-items: center;
  color: #ffd9e7;
}

.brand-name {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  font-size: 1.18rem;
  font-weight: 700;
  letter-spacing: -.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* 머리의 아이콘 버튼. ★ 44px 을 지킨다 — 아이콘은 22px 이지만 누르는 자리는
   손가락 기준이어야 한다. */
.bar-icon {
  position: relative;
  flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px;
  padding: 0;
  appearance: none; border: 0; border-radius: 12px;
  background: transparent; color: #fff;
  cursor: pointer;
}
.bar-icon:active { background: rgba(255, 255, 255, .16); }

/* 안 읽은 알림 수. ★ 색 점만 찍지 않는다 — 숫자를 적고, 버튼의 접근성
   이름에도 home.js 가 같은 내용을 넣는다. */
.bar-badge {
  position: absolute; top: 4px; right: 3px;
  min-width: 18px; height: 18px; padding: 0 4px;
  border-radius: 9px;
  background: #f2c14e; color: #3b2208;
  font-size: .68rem; font-weight: 700; line-height: 18px;
  text-align: center;
}

/* ------------------------------------------------------------------ 탭 */

/* 감정 종류 고르는 줄.

   ★ 18차: 분홍 띠에서 **칩 줄**로 바꿨다. 예전에는 이 줄이 앱 바 바로 아래
     붙어 있어 띠가 자연스러웠는데, 17차에 화면이 탭 안으로 들어가고 18차에
     화면 제목이 생기면서 본문 한가운데 분홍 띠가 떠 있게 됐다.
     보관함의 묶음 칩(.chip)과 같은 모양으로 맞춘다.
   ★ 넷이 390px 에 한 줄로 들어간다. 좁으면 가로로 밀린다 — 숨기지 않는다. */
.tabs {
  display: flex;
  gap: 6px;
  padding: 0 0 12px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.tabs::-webkit-scrollbar { display: none; }

.tab {
  flex: 0 0 auto;
  appearance: none;
  min-height: 44px;
  padding: 8px 14px;
  background: var(--surface);
  border: 1px solid var(--line); border-radius: 999px;
  color: var(--muted);
  font: inherit;
  font-size: .88rem;
  cursor: pointer;
  white-space: nowrap;
}

.tab.is-active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 700;
}
.tab:focus-visible {
  outline: 3px solid var(--accent); outline-offset: 1px;
}

/* ------------------------------------------------------------------ 레이아웃 */

/* ★ 17차: 아래쪽 여백은 **하단 탭 높이 + 안전 영역**만큼 비운다. 비우지 않으면
   목록 마지막 줄과 저장 버튼이 탭에 가려진다 (실제로 그렇게 가려졌다).
   한곳에서 재서 main·footer 가 같은 값을 쓰게 둔다. */
:root {
  --tabbar-h: 58px;
  --tabbar-space: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 16px);
}

main {
  padding: 16px max(16px, env(safe-area-inset-left)) var(--tabbar-space)
           max(16px, env(safe-area-inset-right));
  max-width: 680px;
  margin: 0 auto;
}

/* ---------------------------------------------------- 하단 탭 (17차)

   ★ 화면에 **붙여** 둔다. 스크롤해도 자리가 바뀌지 않아야 앱처럼 쓰인다.
   ★ 안전 영역은 높이가 아니라 **안쪽 여백**으로 받는다. 높이에 더하면 홈
     인디케이터가 있는 기기에서 글자가 아래로 밀려 잘린다.                  */

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0;
  z-index: 40;
  display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 0 max(4px, env(safe-area-inset-left))
           env(safe-area-inset-bottom) max(4px, env(safe-area-inset-right));
  background: var(--surface);
  border-top: 1px solid var(--line);
  /* 위로 살짝 그림자를 둬 본문과 갈라 둔다 (다크에서는 테두리만 남는다). */
  box-shadow: 0 -2px 12px rgba(36, 31, 27, .07);
}
@media (prefers-color-scheme: dark) {
  .tabbar { box-shadow: none; }
}

.tabbar-btn {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 3px;
  min-height: var(--tabbar-h);
  padding: 7px 2px 8px;
  appearance: none; border: 0; background: transparent;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
}
.tabbar-btn svg { width: 23px; height: 23px; }
.tabbar-label {
  font-size: .68rem; line-height: 1;
  word-break: keep-all; white-space: nowrap;
}

/* 지금 탭. ★ 색만으로 구분하지 않는다 — 굵기도 함께 바꾸고 aria-current 를
   붙인다 (색을 구분하기 어려운 사람에게 색은 신호가 되지 못한다). */
.tabbar-btn[aria-current="page"] {
  color: var(--accent);
  font-weight: 700;
}
.tabbar-btn[aria-current="page"] .tabbar-label { font-weight: 700; }
.tabbar-btn:active { background: var(--accent-soft); }
.tabbar-btn:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: -3px;
  border-radius: 10px;
}

/* 푸터도 탭에 가리지 않게 띄운다. */
.app-footer { padding-bottom: var(--tabbar-space); }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin: 0 0 12px;
  /* ★ 그리드·플렉스 칸 안에서 카드가 줄어들 수 있어야 한다. min-width 의 기본
     값(auto)이면 긴 글이 칸을 밀어내 가로 스크롤이 생긴다. */
  min-width: 0;
}

/* 긴 글이 카드 밖으로 삐져나오지 않게 한다. 한국어는 글자 단위로 끊으면
   읽을 수 없으므로 어절 단위(keep-all)로 두고 넘칠 때만 끊는다. */
.card p, .card li, .card h2, .card h3 {
  overflow-wrap: anywhere;
  word-break: keep-all;
}

/* ------------------------------------------- 오늘의 운세 히어로 (17차)

   홈에서 가장 눈에 띄어야 하는 카드. 점수를 원형 배지로 강조한다.
   일진 · 오행 관계 · 규칙 버전 같은 상세는 운세 상세 화면이 맡는다.        */

.hero-card {
  background:
    radial-gradient(120% 120% at 100% 0%, var(--accent-soft) 0%, transparent 62%),
    var(--surface);
  padding: 16px;
}
.hero-top {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
}
.hero-text { min-width: 0; }
.hero-date {
  margin: 0 0 6px;
  font-size: .78rem; color: var(--muted);
}
.hero-headline {
  margin: 0 0 4px;
  font-size: 1.32rem; font-weight: 700; line-height: 1.3;
  word-break: keep-all;
}
.hero-sub {
  margin: 0;
  font-size: .86rem; color: var(--muted);
  word-break: keep-all;
}
/* 점수 배지. ★ 등급 글자를 숫자 아래에 함께 적는다 — 색만으로 전하지 않는다. */
.hero-score {
  flex: 0 0 auto;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  width: 74px; height: 74px;
  border-radius: 50%;
  background: var(--neutral-soft); color: var(--neutral-text);
}
.hero-score .num { font-size: 1.6rem; font-weight: 700; line-height: 1; }
.hero-score .grade-label { font-size: .72rem; margin-top: 3px; }
.hero-card .g-best .num, .hero-card.g-best .num { color: inherit; }
.hero-card button.primary { margin-top: 14px; }

/* ------------------------------------------ 무엇을 알아볼까요 (17차)

   핵심 둘만 큰 카드로. 320px 에서도 두 칸이 들어가야 한다.               */

.pick-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 14px;
}

.pick-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  min-width: 0; min-height: 112px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line); border-radius: 18px;
  box-shadow: var(--shadow);
  color: var(--text);
  text-align: left; cursor: pointer;
}
.pick-card:active { background: var(--accent-soft); }
.pick-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; margin-bottom: 4px;
  border-radius: 12px;
  background: var(--accent-soft); color: var(--accent);
}
.pick-label {
  font-size: 1.02rem; font-weight: 700; line-height: 1.25;
  word-break: keep-all;
}
.pick-sub {
  font-size: .74rem; color: var(--muted); line-height: 1.3;
  word-break: keep-all;
}

fieldset.person {
  border: 0;
  border-top: 1px solid var(--line);
  padding: 14px 0 4px;
  margin: 0 0 6px;
}

fieldset.person:first-of-type {
  border-top: 0;
  padding-top: 0;
}

legend {
  padding: 0 6px 0 0;
  font-size: .85rem;
  font-weight: 600;
  color: var(--accent);
}

/* ------------------------------------------------------------------ 폼 */

.field {
  display: block;
  margin: 0 0 12px;
}

.field > span {
  display: block;
  font-size: .78rem;
  color: var(--muted);
  margin-bottom: 4px;
}

.field small {
  font-weight: 400;
  opacity: .8;
}

input, select, textarea {
  width: 100%;
  font: inherit;
  font-size: 1rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  /* iOS 가 16px 미만 입력창에서 자동 줌 하는 것을 막는다 */
  min-height: 44px;
}

input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

textarea { resize: vertical; }

/* 생년 / 월 / 일 같은 세 칸짜리 줄.

   ★ 기준 폭이 92px 이었는데, 320px 화면에서는 카드 안쪽이 258px 뿐이라
     3×92 + 간격 20 = 296 > 258 이 되어 **두 줄로 접혔다** (6차에서 관계운 폼에
     같은 검사를 붙이면서 드러났다 — 내 사주 등록 폼도 전부터 접히고 있었다).
     76px 로 내리면 3×76 + 20 = 248 ≤ 258 이라 한 줄에 들어간다. 더 넓은 화면에서는
     auto-fit 이 여전히 3열을 만들고 1fr 로 늘어나므로 보이는 모양이 달라지지 않는다. */
.row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(76px, 1fr));
  gap: 10px;
}

.hint {
  margin: -4px 0 10px;
  font-size: .8rem;
  color: var(--accent);
}

button.primary {
  width: 100%;
  min-height: 50px;
  appearance: none;
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-size: 1.02rem;
  font-weight: 600;
  cursor: pointer;
}

button.primary:disabled {
  opacity: .55;
  cursor: progress;
}

/* ★ 다크의 --accent 는 밝은 분홍이다. 그 위에 흰 글씨를 얹으면 2.6:1 밖에 안 나와
   "저장" · "이 날 상세 보기" 글자가 뭉개진다 (브라우저 대비 측정에서 잡았다).
   어두운 글씨로 뒤집으면 6.9:1 이 된다.

   ※ 이 규칙은 반드시 위 button.primary **뒤**에 있어야 한다. 같은 명시도라
     순서로 승부가 난다 — 처음에 파일 앞쪽 다크 블록에 넣었다가 덮였다. */
@media (prefers-color-scheme: dark) {
  button.primary { color: #1b0f14; }
}

button.ghost {
  appearance: none;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  font: inherit;
  font-size: .85rem;
  padding: 8px 14px;
  cursor: pointer;
}

.error {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  color: var(--danger);
  font-size: .88rem;
}

/* ------------------------------------------------------------------ 결과 */

.result h2 {
  margin: 0 0 12px;
  font-size: 1.05rem;
}

.saju-block {
  margin: 0 0 14px;
}

.saju-block h3 {
  margin: 0 0 6px;
  font-size: .8rem;
  font-weight: 600;
  color: var(--muted);
}

/* 사주 4기둥 표. 좁은 화면에서도 가로 스크롤로 깨지지 않게 둔다. */
.saju-scroll { overflow-x: auto; }

table.saju {
  border-collapse: collapse;
  width: 100%;
  min-width: 260px;
  text-align: center;
}

table.saju th {
  font-size: .72rem;
  font-weight: 600;
  color: var(--muted);
  padding: 4px 2px;
}

table.saju td {
  padding: 6px 2px;
  border-top: 1px solid var(--line);
  font-size: 1.5rem;
  line-height: 1.2;
}

table.saju td small {
  display: block;
  font-size: .68rem;
  color: var(--muted);
}

table.saju td.empty {
  color: var(--muted);
  font-size: 1rem;
}

.grade {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--accent-soft);
  margin: 0 0 14px;
}

.grade .code {
  font-size: 1.9rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}

.grade .title { font-size: .95rem; }

.grade .total {
  margin-left: auto;
  font-size: .85rem;
  color: var(--muted);
}

table.scores {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
}

table.scores th,
table.scores td {
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

table.scores td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

table.scores tr.sum th,
table.scores tr.sum td {
  border-bottom: 0;
  font-weight: 700;
  color: var(--accent);
}

.section h3 {
  margin: 0 0 8px;
  font-size: .95rem;
  color: var(--accent);
}

.section p {
  margin: 0;
  white-space: pre-wrap;
  font-size: .93rem;
}

details.raw summary {
  cursor: pointer;
  font-size: .85rem;
  color: var(--muted);
}

details.raw pre {
  margin: 12px 0;
  padding: 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .72rem;
  line-height: 1.45;
}

/* ------------------------------------------------------------------ 푸터 */

.app-footer {
  padding: 4px max(16px, env(safe-area-inset-left)) 0
           max(16px, env(safe-area-inset-right));
  max-width: 680px;
  margin: 0 auto;
  text-align: center;
}

.settings { margin-top: 12px; text-align: left; }

.legal {
  margin: 14px 0 0;
  font-size: .74rem;
  color: var(--muted);
}

[hidden] { display: none !important; }

/* ================================================================ 메인 화면
   (신규) 오늘의 운세 · 7일 미리보기 · 메뉴 타일 · 내 사주 · 인연 보관함 */

.back {
  flex: 0 0 auto;
  width: 34px; height: 34px;
  margin-top: 2px;
  border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, .18);
  color: #fff;
  font-size: 1.5rem; line-height: 1;
  cursor: pointer;
}
.back:active { background: rgba(255, 255, 255, .32); }

.sec-title {
  margin: 22px 16px 8px;
  font-size: .95rem;
  letter-spacing: -.01em;
  color: var(--muted);
}

.sub-title { margin: 0 0 10px; font-size: .9rem; color: var(--muted); }

.muted { color: var(--muted); font-size: .88rem; margin: 0 0 8px; }
.error-inline { color: var(--danger); font-size: .88rem; margin: 0; }
/* 39차 §10 — 저장 상태 확인 결과의 "저장되어 있습니다". ★ .error-inline
   과 **같은 크기·같은 여백**이다. 결과가 좋은지 나쁜지에 따라 글자가
   커지거나 자리가 밀리면, 같은 자리의 버튼이 움직여 잘못 눌린다. */
.ok-inline { color: var(--accent); font-size: .88rem; margin: 0; }

/* ===================================================== 과거 결과 비교 (15차)

   ★ 표가 좁은 화면에서 넘치면 **표만** 가로로 스크롤한다. 페이지 전체가
     가로로 움직이면 다른 내용을 읽을 수 없다. */
/* ★ 18차: `display:block + nowrap` 을 걷어냈다. 그 조합은 320px 에서 표를 늘
   옆으로 잘랐고, 잘린 자리에는 더 있다는 표시조차 없었다 (스크린샷에서 잡았다).
   `table-layout: fixed` 로 칸을 고르게 나누고 글을 접는다 — 좁은 화면에서도
   두 칸이 모두 보인다. 그래도 넘치는 표는 바깥 `.compare-scroll` 이 **그 안에서만**
   가로로 민다 (화면 전체는 밀리지 않는다). */
.compare-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: .5rem 0;
}
.compare-table {
  width: 100%;
  min-width: 15rem;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: .88rem;
  margin: 0;
  white-space: normal;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.compare-table th,
.compare-table td {
  padding: .4rem .5rem;
  text-align: left;
  border-bottom: 1px solid rgba(128, 128, 128, .25);
}

/* 머리줄(항목 이름)은 왼쪽에 고정된 느낌으로 둔다. */
.compare-table th {
  color: var(--muted);
  font-weight: 600;
}

.compare-table tr th:first-child {
  min-width: 5.5rem;
}

.compare-table td {
  font-variant-numeric: tabular-nums;
}

/* ===================================================== 내 사주 간편 등록 (16차)

   ★ 지인 감정 화면 안에서 펼쳐지는 패널이다. 왼쪽 띠로 "지금 이것부터" 임을
     표시하되, 아래의 지인 입력 폼과 **같은 카드 폭**을 쓴다 — 폭이 달라지면
     화면이 덜컹거려 탭이 빗나간다 (14차에 같은 문제를 고쳤다). */
#acq-saju-panel {
  border-left: 3px solid var(--accent);
}

#acq-saju-panel .sec-title {
  margin-top: 0;
}

/* 감정 버튼이 잠겼을 때 그 이유를 적는 자리. */
#acq-fit-gate {
  margin: .6rem 0;
  padding: .7rem .8rem;
  border-radius: 8px;
  background: rgba(128, 128, 128, .08);
}

#acq-fit-gate p {
  margin: 0 0 .4rem;
}

/* ★ 잠긴 버튼은 눌러도 되는 것처럼 보이지 않아야 한다. 색만으로 전하지
     않으려고 위의 #acq-fit-gate 가 글로 이유를 함께 적는다. */
#acquaintance-form button[type="submit"]:disabled {
  opacity: .5;
  cursor: not-allowed;
}

/* 성공 안내.
   ★ 색만으로 전하지 않는다. 문구 자체가 무엇이 끝났는지 말하고, 왼쪽 띠로
     한 번 더 구분한다 — 색각 이상에서도 오류와 구별돼야 한다. */
.notice-inline {
  margin: 0;
  font-size: .88rem;
  color: var(--text);
  border-left: 3px solid var(--accent);
  padding-left: .6rem;
}

/* ===================================================== 알림 (12차)

   ★ 건수를 색으로만 전하지 않는다. 숫자를 띠 안에 쓰고, 옆줄에 "안 읽은 알림
     N건" 글자를 함께 적고, 버튼의 접근성 이름에도 넣는다 — 색각 이상이나
     스크린리더에서도 같은 정보가 닿아야 한다.

   ★ 띠의 글자색을 흰색으로 박지 않는다. 다크에서 --accent 는 밝은 분홍이고
     그 위의 흰 글씨는 대비가 2.6:1 밖에 안 된다 (기존 .primary 에서 같은 일을
     겪어 따로 처리해 둔 자리가 있다). 라이트/다크 각각에서 읽히는 색을 쓴다. */
.badge {
  display: inline-block;
  min-width: 20px;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: .76rem;
  font-weight: 700;
  line-height: 1.5;
  text-align: center;
}
@media (prefers-color-scheme: dark) {
  /* 밝은 분홍 위에는 어두운 글씨가 읽힌다. */
  .badge { color: #2a1420; }
}

.bell { margin-right: 2px; }

/* 안 읽은 알림 카드. 왼쪽 띠로 구분하고, 카드 안에 "안 읽음" 글자도 적는다. */
.card.is-unread {
  border-left: 3px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 5%, var(--surface));
}

/* 사주 계산 동의 안내. ★ 카드 안에 들어가는 상자라 배경을 한 단계 더 눌러
   "이건 지금 읽고 결정할 것" 이라는 신호를 준다. */
.consent-notice {
  margin-top: 12px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
  background: color-mix(in srgb, var(--accent) 7%, transparent);
}
.consent-notice .sec-title { margin: 0 0 8px; font-size: .95rem; }

.consent-terms {
  margin: 0 0 10px;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: .86rem;
  line-height: 1.5;
  /* ★ 긴 한국어 항목이 좁은 화면에서 낱말 가운데서 끊기지 않게 한다. */
  word-break: keep-all;
}

/* 성공 안내. ★ .error 와 같은 모양·같은 자리를 쓴다 — 오류와 성공이 다른
   크기로 나타나면 그 자리가 흔들려 방금 누른 버튼이 밀린다. */
.ok {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  color: var(--accent);
  font-size: .88rem;
}

.profile-line { margin: 0 0 10px; display: flex; flex-direction: column; gap: 2px; }
.profile-line strong { font-size: 1.02rem; }

/* ---------------------------------------------------------------- 오늘 카드 */

/* ★ 18차: 홈 히어로와 **같은 배치**로 맞춘다 — 글이 왼쪽, 점수 배지가
   오른쪽이다. 전에는 상세만 점수가 왼쪽이라, 홈에서 눌러 들어오면 숫자가
   화면을 가로질러 옮겨 갔다.
   마크업은 그대로 두고 order 로만 자리를 바꾼다. */
.today { display: flex; gap: 14px; align-items: center; }
.today-body { order: 1; min-width: 0; flex: 1 1 auto; }
.today-score { order: 2; }

.today-score {
  flex: 0 0 auto;
  width: 74px; height: 74px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--neutral-soft);
  color: var(--neutral-text);
}
.today-score .num { font-size: 1.6rem; font-weight: 700; line-height: 1; }
.today-score .grade-label { font-size: .72rem; margin-top: 3px; }

.today-body .headline {
  margin: 0 0 4px;
  font-size: 1.2rem; font-weight: 700; line-height: 1.3;
  word-break: keep-all;
}

/* 등급별 색. 점수 원과 주간 막대에 함께 쓴다.

   ★ 18차: 선택자를 둘로 둔다. `.g-best .today-score` 는 **조상**에 등급이
     붙은 경우(운세 상세의 .today), `.hero-score.g-best` 는 **자기 자신**에
     붙은 경우(홈 히어로)다. 17차에 홈 배지를 만들면서 후자를 빠뜨려,
     어떤 등급이든 회색으로만 떴다 (스크린샷에서는 '평' 이라 들키지 않았다). */
.g-best  .today-score, .hero-score.g-best  { background: #e8f2e4; color: #2f6b36; }
.g-good  .today-score, .hero-score.g-good  { background: #e9f0f8; color: #2c5d8f; }
.g-fair  .today-score, .hero-score.g-fair  { background: var(--neutral-soft); color: var(--neutral-text); }
.g-weak  .today-score, .hero-score.g-weak  { background: #fbf0e2; color: #8a5a1c; }
.g-bad   .today-score, .hero-score.g-bad   { background: #f8e8e6; color: #9b3029; }

@media (prefers-color-scheme: dark) {
  .g-best  .today-score, .hero-score.g-best { background: #203023; color: #8fd39a; }
  .g-good  .today-score, .hero-score.g-good { background: #1d2733; color: #8fbbe5; }
  .g-weak  .today-score, .hero-score.g-weak { background: #322618; color: #e0b074; }
  .g-bad   .today-score, .hero-score.g-bad  { background: #32211f; color: #e89b93; }
}

.chip {
  display: inline-block;
  padding: 1px 7px; margin-left: 4px;
  border: 1px solid var(--line); border-radius: 999px;
  font-size: .74rem; color: var(--muted);
}

/* ---------------------------------------------------------------- 7일 막대 */

.week-strip { display: flex; gap: 6px; }

.week-cell {
  flex: 1 1 0; min-width: 0;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 6px 2px;
  border-radius: 10px;
}
.week-cell.is-today { background: var(--accent-soft); }
.week-cell .wd { font-size: .72rem; color: var(--muted); }
.week-cell .dd { font-size: .86rem; font-weight: 600; }
.week-cell .sc { font-size: .72rem; color: var(--muted); }

.week-cell .bar {
  width: 10px; height: 54px;
  display: flex; align-items: flex-end;
  background: var(--line); border-radius: 999px; overflow: hidden;
}
.week-cell .bar i { display: block; width: 100%; background: var(--neutral-text); }
.g-best .bar i { background: #4e9a5c; }
.g-good .bar i { background: #4a86c4; }
.g-weak .bar i { background: #c99447; }
.g-bad  .bar i { background: #c0574e; }

/* ------------------------------------------- 지인 감정 갈래 선택 (16차)

   지금 고른 갈래를 눈으로 알 수 있어야 한다. 두 줄이 똑같아 보이면 "직접
   입력" 을 눌렀는지 "연결 회원" 을 눌렀는지 화면에 남지 않는다.             */

.row-link[aria-pressed="true"] {
  font-weight: 600;
  color: var(--accent);
}
.row-link[aria-pressed="true"] .row-sub { color: var(--accent); }
.row-link[aria-pressed="true"] .row-arrow::before {
  content: '●';
  font-size: .6rem;
  margin-right: 6px;
  vertical-align: middle;
}

/* ---------------------------------------------------------------- 메뉴 타일 */

.menu-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  padding: 0 16px;
}

.menu-tile {
  display: flex; flex-direction: column; gap: 3px;
  padding: 16px 14px;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: var(--text);
  cursor: pointer;
}
.menu-tile:active { background: var(--accent-soft); }
.tile-label { font-size: .98rem; font-weight: 600; }
.tile-sub { font-size: .76rem; color: var(--muted); }

/* ---------------------------------------------------------------- 운세 상세 */

.daily-row h3 { margin: 0 0 4px; font-size: 1rem; }
.daily-row h3 small { color: var(--accent); font-weight: 600; }
.daily-row .headline { margin: 0 0 6px; font-weight: 600; }
.daily-row .scores th { white-space: nowrap; }
.daily-row .scores td { font-size: .84rem; color: var(--muted); }

/* ---------------------------------------------------------------- 인연 보관함 */

.bond-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.bond-name { margin: 0 0 2px; font-weight: 600; }
.ghost.danger { color: var(--danger); }

/* ---------------------------------------------------------------- 보완 (UI 확인 후)

   ★ 점수 원 안의 등급 글자는 class="grade-label" 이다. 처음에 class="grade" 로
     썼다가 **기존 감정 결과용 `.grade` 규칙**(padding·border-radius·배경)을 물려받아
     원 안에 분홍 네모가 겹쳐 보였다. 실제 브라우저 스크린샷에서 발견했다.          */

.today-score .grade-label {
  padding: 0;
  background: none;
  border-radius: 0;
  margin-top: 2px;
}

/* 운세 상세 표: 항목명과 설명이 붙어 보였다 (오행 관계내 일간…) */
.daily-row .scores th { padding-right: 10px; vertical-align: top; }
.daily-row .scores td:last-child { padding-left: 8px; white-space: nowrap; }

/* 목록형 진입 줄.

   ★ 17차: 한 줄에 나란히 두던 것을 **이름 위 / 설명 아래**로 바꿨다. 좁은
     화면에서 둘이 폭을 나눠 가지면 "지인 감정 / 시작" 처럼 이름이 먼저
     쪼개진다 (390px 스크린샷에서 잡았다). 앱의 목록 줄은 대부분 두 줄이다.
   ★ 누르는 높이를 48px 로 잡는다. 전에는 글자 높이만큼이라 손가락 기준에
     못 미쳤다.                                                              */
.row-link {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "label arrow" "sub arrow";
  align-items: center;
  gap: 0 10px;
  width: 100%; min-height: 48px; padding: 8px 0;
  background: none; border: 0; color: var(--text);
  font-size: 1rem; text-align: left; cursor: pointer;
}
.row-link .row-label {
  grid-area: label;
  font-weight: 600; line-height: 1.3;
  word-break: keep-all;
}
.row-link .row-sub {
  grid-area: sub;
  font-size: .8rem; color: var(--muted); line-height: 1.35;
  word-break: keep-all;
}
/* 설명이 없는 줄은 이름이 가운데에 오게 둔다 (빈 칸이 생기지 않는다). */
.row-link .row-arrow {
  grid-area: arrow; grid-row: 1 / -1;
  font-size: 1.3rem; color: var(--muted); line-height: 1;
}
.row-link:active { opacity: .6; }
/* 줄이 여럿인 카드에서는 줄 사이에 가는 선을 둔다 — 어디까지가 한 줄인지. */
.card .row-link + .row-link {
  border-top: 1px solid var(--line);
  margin-top: 2px; padding-top: 10px;
}

/* 보관함 행: 삭제 버튼이 눌려 "삭\n제" 로 두 줄이 됐다 (스크린샷에서 발견) */
.bond-main { min-width: 0; flex: 1 1 auto; }
.bond-remove { flex: 0 0 auto; white-space: nowrap; align-self: flex-start; }

/* 행 전체를 눌러 본문으로 들어간다. button 기본 모양을 지운다. */
button.bond-main {
  display: flex; flex-direction: column; gap: 2px;
  padding: 0; text-align: left;
  background: none; border: 0; color: inherit; font: inherit;
  cursor: pointer;
}
button.bond-main:active { opacity: .6; }
.bond-row .row-arrow { flex: 0 0 auto; }

/* 보관한 궁합 본문 */
.bond-title { margin: 0 0 4px; font-size: 1.15rem; }
#bond-list .date-actions { gap: 10px; }
#bond-list .raw pre {
  margin: 10px 0 0;
  white-space: pre-wrap; word-break: break-word;
  font-size: .8rem; line-height: 1.6;
}

/* ================================================================ 2차: 날짜 선택
   운세를 볼 날짜를 직접 고른다. 하한·상한은 서버가 알려준 값으로 home.js 가 채운다. */

.date-nav { display: flex; align-items: center; justify-content: center; gap: 10px; }

.nav-btn {
  flex: 0 0 auto;
  width: 40px; height: 40px;
  border: 1px solid var(--line); border-radius: 50%;
  background: var(--surface); color: var(--text);
  font-size: 1.4rem; line-height: 1;
  cursor: pointer;
}
.nav-btn:active { background: var(--accent-soft); }
/* 범위 끝에서는 눌러도 서버가 거부할 뿐이므로 아예 막아 둔다. */
.nav-btn:disabled { opacity: .3; cursor: default; background: var(--surface); }

.date-nav input[type="date"] {
  flex: 0 1 200px; min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg); color: var(--text);
  font: inherit; font-size: 1rem;
  text-align: center;
}

/* 설명줄은 카드 폭을 다 쓴다. 한글은 단어 중간에서 끊지 않는다 ("일 / 진" 방지). */
.date-sub {
  margin: 10px 0 0;
  font-size: .82rem; color: var(--muted); text-align: center;
  word-break: keep-all; overflow-wrap: break-word;
}

/* ★ gap 과 wrap 이 필요하다. 이 줄에 "◀ 이전 7일 / 2026년 11월 15일 (일) /
   다음 7일 ▶" 처럼 셋이 들어가는 자리가 있는데, 붙여 두면 좁은 화면에서
   가운데 날짜 글자가 오른쪽 버튼 **밑으로 파고든다** (스크린샷에서 잡았다).
   자리가 모자라면 줄을 바꾸게 둔다. */
.date-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: -4px 0 14px;
}

/* ---------------------------------------------------------------- 해설 섹션 */

.narrative h3,
.basis h3 { margin: 0 0 6px; font-size: .95rem; }
.narrative h3 { color: var(--accent); }
.basis h3 { color: var(--muted); }

.narrative p {
  margin: 0;
  font-size: .95rem; line-height: 1.75;
  /* 한글은 단어 중간에서 끊지 않는다. 긴 토큰만 예외로 꺾는다. */
  word-break: keep-all;
  overflow-wrap: break-word;
}

/* ---------------------------------------------------------------- 누를 수 있는 줄
   7일 막대의 칸과 14일 목록의 줄은 button 이다 (그 날짜의 상세로 넘어간다).
   button 기본 글꼴·테두리·가운데 정렬을 지우지 않으면 카드가 깨진다. */

button.daily-row {
  display: block; width: 100%;
  font: inherit; color: inherit; text-align: left;
  cursor: pointer;
}
button.daily-row:active { background: var(--accent-soft); }

button.week-cell {
  border: 0; background: none;
  font: inherit; color: inherit;
  cursor: pointer;
}
button.week-cell:active { background: var(--accent-soft); }

/* ================================================================ 3차: 월간 캘린더 */

/* ★ pan-y — 세로 스크롤은 브라우저에 맡기고 가로 제스처만 가져온다.
   touchmove 를 preventDefault 로 막는 방식은 세로까지 끊길 위험이 있고
   스크롤 성능도 나빠진다. 이 한 줄이 있어야 home.js 의 스와이프가 동작한다. */
.month-card { touch-action: pan-y; }

.month-nav {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 12px;
}
.month-title { margin: 0; font-size: 1.05rem; font-weight: 700; }

/* 7열 고정. 가장 좁은 320px 에서도 칸이 접히지 않아야 한다. */
.cal-head,
/* ★ grid-auto-rows: 1fr 로 모든 줄의 높이를 맞춘다.
   관계운 등급 "아주 좋음" 은 320px 칸(약 38px)에 한 줄로 들어가지 않아 두 줄이 된다.
   그대로 두면 그 글자가 있는 줄만 키가 커져 들쭉날쭉해 보인다. 전부 같은 높이로
   맞추면 의도한 모양이 된다. */
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-auto-rows: 1fr;
  gap: 4px;
}

.cal-head {
  margin-bottom: 6px;
  font-size: .72rem; color: var(--muted); text-align: center;
}
.cal-head span:first-child { color: #b5544c; }   /* 일요일 */
.cal-head span:last-child { color: #4a86c4; }    /* 토요일 */

.cal-blank { display: block; }

.cal-cell {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1px;
  min-width: 0; padding: 5px 1px;
  border: 1px solid transparent; border-radius: 8px;
  background: var(--accent-soft);
  font: inherit; color: var(--text);
  cursor: pointer;
}
.cal-cell .cd { font-size: .8rem; font-weight: 600; line-height: 1.1; }
.cal-cell .cs { font-size: .72rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
/* ★ 등급 글자. 색만으로 전하지 않기 위해 칸 안에 반드시 남긴다. */
/* ★ 처음에는 white-space: nowrap 이었다. 개인 운세 등급은 전부 두 글자라 문제가
   없었는데, 관계운의 "아주 좋음" 은 320px 칸을 넘쳐 **옆 칸 위로 삐져나왔다**
   (320px 스크린샷에서 발견). 등급 이름은 바꿀 수 없고 색으로만 전할 수도 없으므로,
   줄바꿈을 허용하고 낱말 중간에서는 끊지 않는다 ("아주 / 좋음" 으로 갈린다). */
.cal-cell .cg {
  font-size: .58rem;
  line-height: 1.05;
  max-width: 100%;
  text-align: center;
  word-break: keep-all;
  overflow-wrap: break-word;
}

/* 오늘 = 점선 테두리, 선택 = 실선 굵은 테두리 + 굵은 글씨.
   ★ 처음에는 둘 다 같은 색 실선이라 "오늘" 과 "선택한 날" 이 구별되지 않았다
     (스크린샷에서 발견). 선 모양을 다르게 해야 한 눈에 갈린다.
     둘이 같은 칸일 수도 있으므로 테두리(오늘)와 아웃라인(선택)으로 층을 나눈다. */
.cal-cell.is-today { border-color: var(--accent); border-style: dashed; }
.cal-cell.is-picked {
  outline: 2px solid var(--accent); outline-offset: 1px;
  font-weight: 700;
}

/* 등급별 색. 오늘의 운세 카드와 같은 색 체계를 쓴다. */
.cal-cell.g-best { background: #e8f2e4; color: #2f6b36; }
.cal-cell.g-good { background: #e9f0f8; color: #2c5d8f; }
.cal-cell.g-fair { background: var(--neutral-soft); color: var(--neutral-text); }
.cal-cell.g-weak { background: #fbf0e2; color: #8a5a1c; }
.cal-cell.g-bad { background: #f8e8e6; color: #9b3029; }

@media (prefers-color-scheme: dark) {
  .cal-cell.g-best { background: #203023; color: #8fd39a; }
  .cal-cell.g-good { background: #1d2733; color: #8fbbe5; }
  .cal-cell.g-weak { background: #322618; color: #e0b074; }
  .cal-cell.g-bad { background: #32211f; color: #e89b93; }
}

/* ---------------------------------------------------------------- 월간 요약 */

.month-avg { margin: 0 0 10px; font-size: .95rem; }
.month-avg strong { font-size: 1.15rem; color: var(--accent); }

.grade-counts {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px;
  margin: 0 0 10px; padding: 0; list-style: none;
}
.grade-counts li {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 2px;
  border-radius: 8px;
  background: var(--accent-soft);
}
.grade-counts .gc-name { font-size: .72rem; white-space: nowrap; }
.grade-counts .gc-days { font-size: .84rem; font-weight: 600; }
/* 0일인 등급도 자리를 지키되 흐리게 둔다 — 요약 줄의 칸 수가 달마다 바뀌지 않는다. */
.grade-counts li.is-zero { opacity: .4; }

.grade-counts li.g-best { background: #e8f2e4; color: #2f6b36; }
.grade-counts li.g-good { background: #e9f0f8; color: #2c5d8f; }
.grade-counts li.g-fair { background: var(--neutral-soft); color: var(--neutral-text); }
.grade-counts li.g-weak { background: #fbf0e2; color: #8a5a1c; }
.grade-counts li.g-bad { background: #f8e8e6; color: #9b3029; }

@media (prefers-color-scheme: dark) {
  .grade-counts li.g-best { background: #203023; color: #8fd39a; }
  .grade-counts li.g-good { background: #1d2733; color: #8fbbe5; }
  .grade-counts li.g-weak { background: #322618; color: #e0b074; }
  .grade-counts li.g-bad { background: #32211f; color: #e89b93; }
}

#month-pick .primary { margin-top: 12px; }

/* ---------------------------------------------------------------- 더미 본문 경고
   앱 바 바로 아래, 모든 화면 위에 걸린다. 감정 결과만의 문제가 아니라
   "이 서버가 가짜 데이터를 쓰고 있다" 는 사실 자체를 알려야 하므로 전역이다. */

.content-warning {
  padding: 10px 14px;
  background: #8a2a22; color: #fff;
  font-size: .84rem; line-height: 1.5;
  text-align: center;
  word-break: keep-all; overflow-wrap: break-word;
}

/* ================================================================ 5차: 공유

   ★ 320px 에서 버튼 두 개가 한 줄에 들어가지 않으면 줄바꿈한다. 가로 스크롤이
     생기지 않도록 각 버튼의 최소 폭을 두고 flex-wrap 으로 흘린다. */

.share-card h3 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.share-card .muted {
  margin: 0 0 12px;
  font-size: .82rem;
  word-break: keep-all;
  overflow-wrap: break-word;
}

.share-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* ★ 기준 폭을 112px 로 둔다. 128px 로 뒀더니 320px 화면에서 두 버튼이 한 줄에
   들어가지 못하고 접혔다 (카드 안쪽 폭 258px − 간격 10px = 124px 씩).
   ★ min-height 를 둔 이유: .ghost 는 기본 높이가 39px 이라 손가락으로 누르기에
   작다. 나란히 놓인 .primary(50px)와도 높이가 어긋나 보였다. */
.share-actions button {
  flex: 1 1 112px;
  min-height: 48px;
  margin: 0;
}

/* 상태 줄. 비어 있을 때 자리를 차지하지 않도록 margin 을 글이 있을 때만 준다.
   role="status" 라 스크린리더가 글이 바뀔 때 읽는다. */
.share-status {
  margin: 0;
  font-size: .84rem;
  color: var(--accent);
  word-break: keep-all;
  overflow-wrap: break-word;
}

.share-status:not(:empty) { margin: 10px 0 0; }

.share-fold {
  margin: 12px 0 0;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.share-fold summary {
  cursor: pointer;
  font-size: .85rem;
  color: var(--muted);
}

.share-fold pre {
  margin: 10px 0 0;
  padding: 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: .8rem;
  line-height: 1.6;
}

/* 카드는 1080px 정사각형으로 그려 CSS 로 줄인다 — 메신저로 보낼 때는 원래
   크기가 나가고, 화면에서는 카드 폭에 맞는다. */
.share-preview-box { margin: 10px 0 0; }

.share-preview-box canvas {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
}

/* ============================================================ 6차: 관계운

   ★ 운세 화면의 카드·막대·점수 블록을 그대로 쓴다. 등급 색(.g-*)도 공유한다 —
     같은 색이 같은 "좋음/나쁨" 을 뜻해야 사용자가 두 번 배우지 않는다.
     다만 **등급 이름은 서로 다르다** (대길/길/평 ↔ 아주 좋음/좋음/보통).
     두 지표를 한 숫자로 섞지 않으므로 이름도 섞이지 않게 둔다. */

.rel-legend {
  margin: 0 0 10px;
  font-size: .95rem;
  color: var(--muted);
}

#relation-self .profile-line { margin: 0 0 6px; }

/* "합치지 않는다" 를 화면에서도 말해 둔다 — 사용자가 궁합 점수와 헷갈리기 쉽다. */
.rel-vs {
  margin: 12px 0 0;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  word-break: keep-all;
  overflow-wrap: break-word;
}

/* 본문 속 "수정" 처럼 글자처럼 보여야 하는 버튼. */
.linklike {
  appearance: none;
  border: 0;
  background: none;
  padding: 0;
  color: var(--accent);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

#relation-form .field { margin-top: 10px; }
#relation-form button[type="submit"] { margin-top: 14px; }

/* 보관함 줄에 관계운 요약이 한 줄 더 붙는다. */
.bond-main .muted + .muted { margin-top: 2px; }

/* ============================================================ 8차: 회원 */

#account-summary .profile-line,
#account-saju .profile-line { margin: 0 0 6px; }

/* 기기 ↔ 서버 비교 표. ★ 기존 .scores 는 th 가 넓은 표에서 쓰여 여백이 없어도
   괜찮았는데, 여기서는 th 가 짧아 "이 기기1981.3.14" 처럼 붙어 보였다
   (스크린샷에서 발견). 머리 칸에 오른쪽 여백을 준다. */
#profile-conflict .scores th {
  padding-right: 10px;
  white-space: nowrap;
  vertical-align: top;
}

#profile-conflict .scores td { word-break: keep-all; overflow-wrap: break-word; }

/* 가입·로그인 폼의 오류 줄은 버튼 바로 위에 붙인다. */
#signup-error, #login-error { margin: 10px 0 0; }

/* ================================================================ 키보드 포커스

   ★ 이전에는 버튼에 포커스 표시가 없었다. 마우스·터치만 생각하고 만든 화면이라
     Tab 으로 다니면 지금 어디에 있는지 알 수 없었다.
     :focus-visible 이라 마우스 클릭에는 테두리가 생기지 않는다. */

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* 달력 칸은 선택 표시(실선 아웃라인)와 겹치므로 색을 달리해 구분한다. */
.cal-cell:focus-visible {
  outline: 3px solid var(--text);
  outline-offset: 1px;
}

/* 앱 바 위의 뒤로가기는 배경이 진해서 accent 가 묻힌다. */
.back:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 1px;
}

/* ================================================================ 14차 보관함

   ★ 종류 필터는 **버튼**이다. 기존 .chip 은 글자 옆에 붙는 작은 라벨이라
     그대로 쓰면 손가락으로 누를 수 없을 만큼 작다. 누를 수 있는 크기를 따로
     준다 (최소 40px) — 320px 화면에서 네 칸이 줄바꿈되며 들어간다. */

.chip-row {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin: 0 0 12px;
}

button.chip {
  min-height: 40px;
  margin-left: 0;
  padding: 8px 12px;
  background: var(--surface);
  color: var(--text);
  font-size: .82rem;
  cursor: pointer;
}

button.chip.is-on {
  background: var(--accent-soft);
  border-color: var(--accent);
  font-weight: 600;
}

/* 보관된 결과 본문. 줄바꿈을 그대로 살린다 (저장 당시의 본문이다). */
.reading-body {
  margin: 0 0 14px;
  line-height: 1.65;
  word-break: keep-all;
  overflow-wrap: break-word;
}

/* ★ 점수 제약 안내. 총평과 섞이지 않게 테두리로 갈라 둔다 — 어느 문장이
   원본이고 어느 문장이 우리가 붙인 것인지 알 수 있어야 한다. */
.reading-limits { margin-top: 14px; }
.reading-limits .consent-terms li { font-size: .82rem; }

/* 지금 열 수 없는 기록. 자리는 남기고 내용만 비운다 — 숨기면 사용자는
   기록이 사라진 줄로 안다. */
.card.is-blocked { opacity: .78; }
.card.is-blocked .profile-line strong { color: var(--muted); }

/* 결과 보관 동의 패널. 사주 계산 동의 안내와 나란히 서므로 같은 모양을 쓴다. */
.storage-consent { margin-top: 14px; }

/* 인연 해제 확인 (22차).
   ★ 동의 안내와 **다른 색**을 쓴다. 되돌릴 수 없는 일을 묻는 자리이고,
     동의 패널과 같은 모양이면 "또 하나의 안내" 로 지나쳐 읽힌다. */
.unbond-confirm {
  margin-top: 14px;
  border-color: color-mix(in srgb, var(--danger) 42%, transparent);
  background: color-mix(in srgb, var(--danger) 8%, transparent);
}
/* 되돌릴 수 없다는 줄만 흐리게 보이지 않도록 한 단계 올린다 — .legal 은
   보조 문구용 색이라, 가장 중요한 경고가 가장 안 보이게 된다. */
.unbond-confirm [data-unbond-irreversible] {
  color: var(--text);
  font-weight: 600;
}

/* 철회 직후 "무엇이 남는지" (22차). 상태 줄과 섞이지 않게 테를 두른다. */
.revoke-result {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 24%, transparent);
}
.revoke-result p { margin: 0 0 4px; }
.revoke-result p:last-child { margin-bottom: 0; }

/* ★ 카드 안의 소제목은 가로 여백을 뺀다. .sec-title 의 16px 은 카드 **밖에**
   놓이는 제목을 위한 값이라, 카드 안에서는 카드 자신의 16px 패딩에 더해져
   본문보다 한 칸 밀려 보인다 (스크린샷에서 발견). */
.reading-card .sec-title,
.reading-limits .sec-title,
.storage-consent .sec-title { margin-left: 0; margin-right: 0; }

/* ================================================== 자동 로그인 체크박스 (15차)

   ★ 체크박스는 손가락으로 누를 수 있어야 한다. 라벨 전체를 누름 영역으로 두고
     최소 44px 을 확보한다 — 작은 네모만 누르게 두면 모바일에서 자꾸 빗나간다. */

.check-field {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-height: 44px;
  margin: 4px 0 12px;
  padding: 8px 0;
  cursor: pointer;
}

.check-field input[type="checkbox"] {
  flex: 0 0 auto;
  width: 22px; height: 22px;
  margin: 1px 0 0;
  accent-color: var(--accent);
}

.check-field > span { display: block; line-height: 1.5; }
.check-field strong { display: block; font-size: .95rem; }

.check-sub {
  display: block;
  margin-top: 2px;
  font-size: .8rem;
  color: var(--muted);
  word-break: keep-all;
}

/* 자동 로그인 기기 목록 */
.device-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; flex-wrap: wrap;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
.device-row:first-of-type { border-top: 0; }
.device-row .device-name { font-size: .9rem; font-weight: 600; }
.device-row .device-when { font-size: .78rem; color: var(--muted); }

/* ================================================= 상세 화면 공통 (18차)

   17차에서 홈과 하단 탭을 앱 모양으로 바꿨는데, 그 안으로 들어가는 상세
   화면들은 여전히 **웹 문서**였다. 화면마다 제목 크기가 다르고, 요약이 있는
   화면과 없는 화면이 섞이고, 주요 동작이 본문 사이에 끼어 있었다.

   여기 있는 부품을 모든 상세가 함께 쓴다.

     .sec-title.detail-title   화면 제목
     .today / .hero-score      요약 (점수 배지 — 위에서 이미 통일했다)
     .card.section · .narrative · .basis   해설 카드
     .detail-fold              접는 근거·원문
     .action-bar               주요 동작

   ★ 글과 값은 한 글자도 바꾸지 않는다. 담는 그릇만 바꾼다.                */

/* ---------------------------------------------------------- 화면 제목

   .sec-title 은 본문 안의 작은 묶음 이름이다 (회색 · 0.95rem). 화면 전체의
   제목까지 그 크기로 두면 "여기가 어느 화면인지" 가 가장 작은 글씨가 된다. */
.sec-title.detail-title {
  margin: 4px 16px 12px;
  font-size: 1.35rem; font-weight: 700;
  color: var(--text);
  letter-spacing: -.02em;
  word-break: keep-all;
}
.sec-title.detail-title .sub {
  display: block;
  margin-top: 2px;
  font-size: .8rem; font-weight: 400; color: var(--muted);
  letter-spacing: 0;
}

/* ------------------------------------------------------- 해설 카드

   총운·애정·재물 … 감정 결과의 꼭지들. 소제목을 한 가지 모양으로 맞춘다.
   예전에는 화면마다 색·굵기·크기가 달라 같은 성격의 글로 보이지 않았다.   */
.card.section > h3,
.card.narrative > h3,
.card.basis > h3,
.reading-card .sec-title {
  margin: 0 0 8px;
  font-size: .82rem; font-weight: 700;
  color: var(--accent);
  letter-spacing: .01em;
}
.card.section > p,
.card.narrative > p {
  margin: 0;
  line-height: 1.7;
  word-break: keep-all;
  overflow-wrap: anywhere;
  white-space: pre-line;   /* 원본 줄바꿈을 살린다 (레거시 본문) */
}

/* ------------------------------------------------------- 접는 근거·원문

   점수 산정 근거 · 사주팔자 표 · 원문 리포트처럼 "필요할 때만 보는" 것.
   펴 두면 해설이 아래로 밀려 정작 읽을 글이 안 보인다.                    */
.detail-fold { margin: 0; }
.detail-fold > summary {
  display: flex; align-items: center; gap: 6px;
  min-height: 44px;
  font-size: .86rem; font-weight: 600; color: var(--accent);
  cursor: pointer;
  list-style: none;
}
.detail-fold > summary::-webkit-details-marker { display: none; }
.detail-fold > summary::after {
  content: '▾';
  margin-left: auto;
  color: var(--muted);
  transition: transform .15s;
}
.detail-fold[open] > summary::after { transform: rotate(180deg); }
.detail-fold > summary:focus-visible {
  outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 8px;
}

/* ---------------------------------------------------------- 주요 동작

   저장 · 공유 · 다시 감정. 본문 사이에 흩어 두지 않고 결과 끝에 모은다.
   ★ 버튼 높이 48px. 두 개까지는 나란히, 셋부터는 접어서 쌓는다.           */
.action-bar {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin: 14px 0 0;
}
.action-bar > button,
.action-bar > .ghost {
  flex: 1 1 140px;
  min-height: 48px;
  min-width: 0;
  font-size: .95rem;
  white-space: nowrap;
}
.action-bar > button.primary { flex-basis: 100%; }

/* 넓은 글 안의 표는 **그 표 안에서만** 가로로 민다. 화면 전체가 밀리면
   읽던 자리를 잃는다. */
.saju-scroll, .scores-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* 사주팔자 표. 접은 칸 안에서도 네 기둥이 한 줄에 들어가야 한다. */
.saju-block h3 {
  margin: 0 0 8px;
  font-size: .8rem; font-weight: 600; color: var(--muted);
  word-break: keep-all;
}

/* 결과 요약 줄의 보조 정보 (별칭 · 관계 유형 · 감정 종류). */
.result-meta {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin: 0 0 10px;
}
.result-meta .chip { margin-left: 0; }

/* 14일 목록 줄. 누르는 카드이므로 높이를 확보하고 표를 접는다. */
.daily-row { min-height: 48px; }

/* ------------------------------------------- 감정 결과 요약 (18차)

   `#result-title` 은 레거시 리포트의 머리글이다 ("☆ [공감] '…'님 … 감정결과").
   그 글을 바꾸지 않되 **화면 제목 자리를 차지하지는 않게** 한다 — 읽는 사람이
   먼저 볼 것은 등급과 점수다.                                              */
.result .hero-card h2 {
  margin: 0 0 10px;
  font-size: .86rem; font-weight: 600; line-height: 1.45;
  color: var(--muted);
  word-break: keep-all;
}

/* 등급 줄을 배지처럼.

   ★ 등급 이름("【 신바람형 】 - 'C' 등급")은 320px 한 줄에 들어가지 않는다.
     셋을 한 줄에 억지로 세우면 대괄호 사이에서 끊겨 읽을 수 없게 된다
     (320px 스크린샷에서 잡았다). 왼쪽에 동그란 등급, 오른쪽에 이름과 합계를
     **두 줄로** 둔다 — 어느 폭에서도 같은 모양이다.                        */
.result .grade {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas: "code title" "code total";
  align-items: center;
  column-gap: 12px; row-gap: 2px;
  padding: 14px 16px;
  margin: 0 0 10px;
  border-radius: 14px;
  background: var(--accent-soft);
}
.result .grade .code {
  grid-area: code; grid-row: 1 / -1;
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 54px; height: 54px; padding: 0 8px;
  border-radius: 50%;
  background: var(--surface);
  font-size: 1.4rem; font-weight: 700; color: var(--accent); line-height: 1;
}
.result .grade .title {
  grid-area: title; min-width: 0;
  font-size: .92rem; font-weight: 600; line-height: 1.35;
  word-break: keep-all;
}
.result .grade .total {
  grid-area: total;
  margin-left: 0;
  font-size: 1.02rem; font-weight: 700; color: var(--accent);
  white-space: nowrap;
}

/* 접는 칸 안의 표는 위아래로 숨을 틔운다. */
.detail-fold > #saju-tables, .detail-fold > #scores { padding-top: 6px; }
.detail-fold + .detail-fold { border-top: 1px solid var(--line); }

/* 원문 리포트. 고정폭 글이라 그 안에서만 가로로 민다. */
.raw pre {
  margin: 8px 0 0;
  max-height: 60vh;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  font-size: .78rem; line-height: 1.5;
}

/* ------------------------------------------- 결과·보관함 상세 (18차)

   `.reading-card` 는 이제 **카드가 아니라 묶음**이다. 안에 요약 카드 ·
   꼭지 카드들 · 꼬리 카드가 들어간다. 바깥 테두리를 지운다 (카드 안의
   카드가 되면 테두리가 두 겹으로 보인다).                                  */
.reading-card {
  background: none; border: 0; box-shadow: none;
  padding: 0; margin: 0;
}
.reading-card > .card:last-child { margin-bottom: 0; }

/* 요약 카드 안의 지인 별칭. 홈 히어로의 제목과 같은 크기로 둔다. */
.reading-card .hero-card .headline { font-size: 1.2rem; }

/* 꼬리 카드 — 점수 근거 · 이 점수에 대하여 · 저장. */
.reading-tail > .detail-fold + .reading-limits { margin-top: 10px; }
.reading-tail .reading-limits { margin-top: 10px; }

/* 보관함 상세의 닫기 줄은 카드 밖으로 뺀다. */
.reading-card + .share-actions { margin-top: 10px; }

/* ===================================================== 일진래정 운세 (29차)
   ★ 색 값을 새로 만들지 않는다. 기존 변수(--accent, --line, --muted …)만 쓴다 —
     새 색을 들이면 다크 모드에서 한쪽만 손보게 되고 그때부터 두 테마가 갈라진다.
   ★ 등급 색(g-best … g-bad)을 쓰지 않는다. 이 엔진은 점수를 만들지 않으므로
     등급이 없고, 등급 색을 빌려 쓰면 없는 점수를 암시한다. */

/* 보는 방식 고르기 */
.engine-tabs {
  display: flex;
  gap: 6px;
  margin: 0 0 14px;
}
.engine-tab {
  flex: 1;
  padding: 10px 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.engine-tab small {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 5px;
  border-radius: 6px;
  background: var(--neutral-soft);
  color: var(--neutral-text);
  font-size: 11px;
  font-weight: 700;
}
.engine-tab.on {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}
.engine-tab:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 1px;
}

/* ★ 32차 §4 — 어느 엔진이 어디까지 쓰이는지 적는 줄. 탭 바로 아래에 둔다.
   카드가 아니라 설명줄이므로 배경을 주지 않는다 — 배경을 주면 카드로 읽히고,
   그러면 "운세 내용" 으로 오해된다. */
.engine-scope {
  margin: 8px 2px 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}
.engine-scope:empty { display: none; }

/* 머리 카드. ★ 31차 §5 에서 조회 시각이 2) 칸으로 내려가 .lj-date 는 쓰이지
   않게 되었다 — 규칙을 남겨 두면 다음 사람이 있는 칸으로 착각한다. */
.laejeong-head .lj-day {
  margin: 0 0 2px;
  font-size: 18px;
}
.laejeong-head .lj-day b {
  font-size: 22px;
  color: var(--accent);
}
/* ★ 31차 §6 — "점수가 없다" 를 글로 적는 줄. 눈에 띄어야 하지만 등급 배지처럼
   보이면 안 된다 (그러면 그것이 등급으로 읽힌다). 그래서 색 블록이 아니라
   본문 글줄로 둔다. */
.laejeong-head .lj-kind {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}
.laejeong-head .lj-kind b { color: var(--fg); }

/* 네 기둥. ★ 320px 에서도 네 칸이 한 줄에 들어가야 한다 — 줄이 바뀌면
   연·월·일·시의 나란함이 깨져서 어느 것이 일주인지 읽기 어려워진다. */
.pillars {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin: 12px 0 0;
}
.pillar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 2px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
}
.pillar-label { color: var(--muted); font-size: 11px; }
.pillar-hanja { font-size: 20px; line-height: 1.1; }
.pillar-hangul { color: var(--muted); font-size: 11px; }
/* 일주만 테를 두른다. 색만으로 전하지 않으려고 글자 두께도 함께 올린다. */
.pillar.day {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.pillar.day .pillar-hanja { font-weight: 700; color: var(--accent); }
.pillar.day .pillar-label { color: var(--accent); font-weight: 700; }

/* 관계 개수 요약 — 규칙 결과이므로 해설과 다른 모양으로 둔다 */
.lj-summary {
  margin: 0 0 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--bg);
  font-variant-numeric: tabular-nums;
}

.lj-areas {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 10px;
}

/* 접는 칸 — 6) 판단 근거, 7) 연·월·일·시주. 둘이 같은 모양이어야 "펼칠 수
   있는 것" 으로 함께 읽힌다. */
.lj-basis > summary,
.lj-pillars > summary,
.lj-detail > summary,
.lj-repeated-fold > summary,
.lj-term-fold > summary {
  cursor: pointer;
  font-weight: 600;
  padding: 2px 0;
}
.lj-basis > summary:focus-visible,
.lj-pillars > summary:focus-visible,
.lj-detail > summary:focus-visible,
.lj-repeated-fold > summary:focus-visible,
.lj-term-fold > summary:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}
/* 접힌 채로도 건수가 보인다 — 접어서 "관계가 없다" 로 읽히면 안 된다. */
.lj-basis > summary small,
.lj-detail > summary small,
.lj-repeated-fold > summary small,
.lj-term-fold > summary small {
  margin-left: 4px;
  color: var(--muted);
  font-weight: 400;
}
/* 기둥 네 칸이 접힌 칸 안에 들어가면서 위쪽 여백이 겹친다. */
.lj-pillars .pillars { margin-top: 10px; }
.rel-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.rel {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: 0 8px 8px 0;
  background: var(--surface);
}
/* 관계 종류를 글자로 적고, 왼쪽 테로 한 번 더 구분한다 (색만으로 전하지 않는다) */
.rel-kind {
  font-weight: 700;
  min-width: 2.2em;
}
.rel.HAP { border-left-color: #2f7d4f; }
.rel.CHUNG { border-left-color: #b3261e; }
.rel.HYUNG { border-left-color: #a2541d; }
.rel.PA { border-left-color: #8a5a9b; }
.rel.HAE { border-left-color: #1d5e8a; }
.rel.UNSUPPORTED { border-left-color: var(--muted); border-left-style: dashed; }
.rel-what { flex: 1 1 auto; }
.rel-where { color: var(--muted); font-size: 12px; }
.rel-id {
  flex: 1 1 100%;
  color: var(--muted);
  font-size: 11px;
  word-break: break-all;
}
.rel-note {
  flex: 1 1 100%;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}
/* 판정하지 않은 것은 흐리게. 숨기지는 않는다. */
.rel-list.unresolved .rel { background: var(--bg); }

/* 안내 띠.
   ★ 이 클래스는 관리자 웹(admin/www/css/admin.css)에만 있었다. 앱에서 그대로
     쓰니 **아무 스타일도 없는 큰 본문**으로 떨어졌다 (스크린샷에서 발견).
     두 벌을 공유하지 않으므로 앱에도 따로 둔다.
   ★ 붉은색을 쓰지 않는다 — 오류가 아니라 "알아 둘 것" 이다. 둘을 같은 색으로
     두면 둘 다 안 읽힌다 (28차에 관리자 웹에서 같은 판단을 했다). */
.callout {
  margin: 10px 0 0;
  padding: 10px 12px;
  border-left: 4px solid var(--accent);
  border-radius: 0 8px 8px 0;
  background: var(--accent-soft);
  color: var(--text);
  font-size: 13px;
  line-height: 1.6;
}

/* 분석 시각 표.
   ★ 머리 칸이 좁아 "분석 시 / 각" 으로 쪼개졌다 (스크린샷에서 발견).
     공용 .scores 의 th 를 건드리면 기존 점수 근거 표까지 바뀌므로 전용
     클래스에만 적용한다. */
.scores.lj-when th {
  white-space: nowrap;
  width: 1%;
  padding-right: 12px;
  vertical-align: top;
}
.scores.lj-when td { line-height: 1.6; }


/* ===================================================== 하루 흐름 (33차 §5·§6)

   ★ 띠는 **가로로 넘긴다.** 13칸을 좁은 화면에 모두 세로로 늘어놓으면 그것이
     곧 §5 가 금지한 "13개 시간대 나열" 이 되고, 흐름이 아니라 목록이 된다.
     한 줄로 두고 손가락으로 밀게 하면 "하루가 흘러간다" 는 모양이 남는다.
   ★ 칸 하나가 들고 있는 것은 시작 시각과 분야 이름뿐이다. 간지도 규칙 ID 도
     없다 — 그것은 상세보기의 일이다 (§5 · 32차 §3).
*/
.lj-strip {
  display: flex;
  gap: 6px;
  margin: 10px 0 0;
  padding: 2px 2px 8px;
  overflow-x: auto;
  /* 손가락으로 밀 때 칸 경계에 맞춰 선다. 글자가 반쯤 잘린 채 멈추면
     어느 시간대인지 읽을 수 없다. */
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
}
.lj-slot {
  flex: 0 0 auto;
  scroll-snap-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  /* ★ 44px 보다 넓게 둔다 — 손가락으로 누르는 칸이다. */
  min-width: 62px;
  padding: 8px 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  color: var(--fg);
  font: inherit;
  cursor: pointer;
  text-align: center;
}
.lj-slot:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}
.lj-slot-time {
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.lj-slot-focus {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.3;
}
/* 지나간 시간대. ★ 흐리게만 두지 않는다 — 색만으로 전하면 색을 구별하지
   못하는 사람에게는 열세 칸이 모두 같아 보인다. 글자 굵기로도 가른다. */
.lj-slot.r-past {
  background: var(--bg);
}
.lj-slot.r-past .lj-slot-time { font-weight: 400; }
/* 아직 오지 않은 시간대 — 점선으로 "확정된 지금이 아니다" 를 모양으로 말한다.
   §2 가 요구한 가상 분석 고지는 상세보기의 글이 따로 적는다. */
.lj-slot.virtual {
  border-style: dashed;
}
/* 지금. 테와 배경을 함께 올리고 "지금" 이라고 글자로도 적는다. */
.lj-slot.now {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.lj-slot.now .lj-slot-time { color: var(--accent); font-weight: 700; }
.lj-slot-mark {
  font-size: 10px;
  font-weight: 700;
  color: var(--accent);
}
/* 절입으로 쪼개진 칸 (34차 §7). ★ "지금" 과도 "고른 칸" 과도 다른 신호여야
   한다 — 세 가지가 같은 모양이면 왜 칸이 열넷인지 알 수 없다. 색을 쓰지 않고
   위쪽 테두리를 두껍게 해 모양으로 말한다. */
.lj-slot.split {
  border-top-width: 3px;
  border-top-style: double;
}
.lj-slot-split {
  color: var(--muted);
  font-weight: 600;
}
/* 절입 분할 사유. 서버가 적어 보낸 글을 그대로 옮기는 자리다. */
.lj-split-note {
  font-size: 13px;
  line-height: 1.5;
}
/* 줄 순서가 중요도가 아니라는 고지 (34차 §2). ★ 목록 **아래**에 둔다 —
   위에 두면 읽기 전에 지나가고, 아래에 두면 목록을 본 직후에 읽힌다. */
.lj-order-note {
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.5;
}
/* 관계가 많을 때의 접기 (34차 §7). ★ 일부만 펼치지 않는다 — 전부 접거나
   전부 펴거나다. 먼저 보이는 것이 더 중요하다고 읽히면 §2 를 어긴다. */
.lj-rel-fold > summary {
  cursor: pointer;
  padding: 6px 0;
  font-weight: 600;
}
.lj-rel-fold > summary small {
  margin-left: 6px;
  font-weight: 400;
  color: var(--muted);
}

/* 고른 칸. ★ "지금" 과 **다른 신호**를 쓴다 — 둘이 같은 모양이면 직접 고른
   시간대를 보고 있는지 지금을 보고 있는지 구별할 수 없다 (§6). */
.lj-slot.on {
  box-shadow: inset 0 0 0 2px var(--accent);
  font-weight: 700;
}

/* 분야 분포. ★ 막대나 원그래프로 그리지 않는다 — 길이와 면적은 곧 크기로
   읽히고, 크기는 점수로 읽힌다 (§4 가 금지한 것이다). 숫자 두 개를 글로 적는다. */
.lj-shares {
  list-style: none;
  margin: 10px 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.lj-share {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 8px;
  align-items: baseline;
}
.lj-share-count {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.lj-share-detail {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}
.lj-focus-changes {
  margin: 0 0 8px;
  font-size: 13px;
  line-height: 1.6;
}

/* =====================================================================
   43차 — 핵심 메시지 · 태그 · 시간대 차이

   ★ §6 "분야는 명확히 구분된 태그로 표시한다. 시간대와 설명, 관심 분야의
     시각적 계층을 분리한다. 320px 모바일 화면에서도 읽기 편하게 구성한다."

   ★ 43차 전수 조사에서 "대인관계13개 시간대 중 13개인간관계 · 타인과의 교류"
     가 한 줄로 읽혔다. 조각 사이에 8px 간격이 있었는데도 그랬다 — 간격만으로는
     세 가지 성격의 정보(이름 · 수 · 설명)가 갈라지지 않는다. 그래서 이름은
     **태그 모양**으로, 수는 제 칸으로, 설명은 **줄을 내려서** 둔다.
   ===================================================================== */

/* 오늘의 핵심 메시지. 카드의 첫 글이고 가장 먼저 읽히는 자리다. */
.lj-headline {
  margin: 2px 0 2px;
  /* ★ 45차 §14 "오늘의 핵심 메시지가 먼저 보이는가" — 15px 에서 올렸다.
     이 문장이 첫 화면의 주인공이고, 아래 본문(14px)보다 커야 그렇게 읽힌다.
     43차까지 이 자리에 있던 글은 엔진의 정책이었고 크기만 컸다. */
  font-size: 17px;
  font-weight: 700;
  line-height: 1.65;
  letter-spacing: -0.2px;
}

/* 보이지 않지만 **읽히는** 글.
   ★ 43차 §6 — 태그가 나란히 놓이면 "대인관계가정·직업" 으로 읽힌다. 화면에는
     간격이 있지만 글로 옮기면 붙고, 화면 읽기 프로그램도 붙여 읽는다.
   ★ display:none 이나 visibility:hidden 을 쓰지 않는다 — 그것은 화면 읽기
     프로그램도 건너뛴다. 읽히게 두고 눈에서만 치운다. */
.vh {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* 태그 줄. ★ 줄바꿈을 허용한다 — 320px 에서 분야가 셋이면 한 줄에 들어가지
   않는다. 넘치게 두면 가로 스크롤이 생긴다. */
.lj-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 10px;
}
/* 흐름 태그는 분야 칩과 **다른 모양**이다. 같은 모양이면 "대인관계" 와
   "맺어지고 모이는 흐름" 이 같은 종류의 정보로 읽힌다. */
.lj-flow-tags .tag {
  display: inline-block;
  padding: 3px 9px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--accent);
  background: none;
}
.lj-area-tags .chip { margin-left: 0; }

/* ★ 45차 §5-E — 더해지고 빠진 흐름의 **이름**.
   43차까지는 관계 코드를 한 글자로 적었고(`더해진 흐름 해`), 모양도 없어서
   본문과 구분되지 않았다. 흐름 태그와 같은 알약 모양을 쓰되 색을 달리한다 —
   "지금 들어온 것" 과 "지금 나간 것" 이 한눈에 갈려야 한다. */
.lj-added .tag,
.lj-removed .tag {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1.5;
  border: 1px solid var(--accent);
  color: var(--accent);
  background: none;
}
.lj-removed .tag {
  border-color: var(--line);
  color: var(--muted);
}

/* 하루 전체 흐름 — 분야 묶음마다 태그 줄 + 설명 줄.
   ★ 태그와 설명을 **다른 줄**에 둔다. 한 줄에 두면 "대인관계, 가정·직업 —
     하루 내내 이어지는 분야입니다" 처럼 이름과 문장이 붙어, 어디까지가
     이름인지 눈으로 끊기 어렵다 (43차 §6). */
.lj-day-groups {
  list-style: none;
  margin: 0 0 10px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.lj-day-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.lj-day-group .lj-tags { margin: 0; }
.lj-day-when {
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted);
}

/* 주제별 해설 한 줄. */
.lj-line {
  margin: 0 0 8px;
  line-height: 1.75;
}
/* ★ 45차 — `.lj-merged` 꼬리표가 기본 화면에서 빠졌다 (§5-C · §7).
   규칙은 남겨 둔다: 전문 근거의 '묶어서 적은 해설' 안에서 같은 모양을 쓴다. */
.lj-merged {
  display: block;
  margin-top: 3px;
  font-size: 12px;
  color: var(--muted);
}

/* ★ 45차 §5-B · §5-D — 본문 줄 사이를 띄운다.
   43차·44차에는 줄 사이가 8px 이고 글자 크기가 같아, 본문 네 줄과 주의 네
   줄이 **여덟 줄짜리 한 덩어리**로 읽혔다 (§4 기준선 그림). 한 문장이 한
   생각이라는 것이 눈에 보여야 한다. */
#lj-day-read .lj-line,
#lj-current-read .lj-line,
#lj-advice-card .lj-line {
  margin: 0 0 12px;
}
#lj-day-read .lj-line:last-child,
#lj-current-read .lj-line:last-child,
#lj-advice-card .lj-line:last-child {
  margin-bottom: 0;
}

/* ★★ 46차 §4-① — 운세 본문의 **첫 줄**(분위기).

   46차 §1 로 받은 임인일 화면은 제목 뒤에 바로 진단 세 줄이 섰다. 들어가는
   말이 없으면 셋이 각각 다른 날을 말하는 것처럼 읽힌다. 그래서 첫 줄을
   조금 키우고 아래와 선으로 끊는다 — **제목만큼 키우지는 않는다.** 제목보다
   크면 제목이 둘로 읽히고, 아래 진단 줄이 부속으로 보인다. */
.lj-mood {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.7;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
/* ★★ `.narrative p { margin: 0 }` (명시도 0,1,1) 가 `.lj-mood` (0,1,0) 를
   이긴다. 그래서 클래스 둘로 적는다 (0,2,0) — 카드 id 로 묶으면 '시간별
   상세보기' 안의 같은 줄에는 걸리지 않는다.
   ★ 46차에 이 자리에서 **재어 보고** 알았다. 줄 간격을 16px 로 올렸는데
     화면이 꿈쩍도 하지 않아 computed style 을 찍어 보니 margin 이 0 이었다.
     CSS 는 "썼다" 가 아니라 "먹었다" 를 재야 한다. */
/* ★★ 명시도를 **재서** 정했다. 이 카드의 직계 p 에는 이미
   `.card.narrative > p { margin: 0 }` (0,3,1) 가 걸려 있어서,
   `.narrative .lj-mood` (0,2,0) 로는 이기지 못한다. 46차에 여백을 올려도
   화면이 꿈쩍하지 않아 computed style 을 찍어 보고 알았다 —
   **CSS 는 "썼다" 가 아니라 "먹었다" 를 재야 한다.** */
.card.narrative > p.lj-mood {
  margin: 0 0 12px;
}

/* ★★ 46차 §2 — 함께 읽기. 함께 선 두 줄이 서로 다른 것을 가리킨다는 설명.

   ★ 진단·조언과 **다른 종류의 말**이므로 다르게 보여야 한다. 같은 모양이면
     조언이 하나 더 있는 것으로 읽히고, 읽는 사람은 할 일을 하나 더 센다
     (45차가 맞춰 둔 "핵심 메시지의 항목 수 = 조언 줄 수" 가 어긋나 보인다).
   ★ 그렇다고 muted 로 죽이지 않는다. 이 줄이 푸는 것은 **모순으로 보이는
     것**이고, 안 읽히면 아무것도 풀지 않는다. */
.lj-bridge-box {
  border-left: 3px solid var(--line);
  padding-left: 10px;
}
/* ★ 줄 사이를 **줄 안의 줄간격보다 뚜렷하게** 띄운다. 10px 로 두었더니
   13px/1.7 의 줄간격(약 9px)과 비슷해 두 줄이 한 문단으로 읽혔다 — 그림으로
   보고 쟀다. 두 줄은 서로 다른 이야기이므로 끊어 보여야 한다. */
.lj-bridge {
  font-size: 13px;
  line-height: 1.7;
  color: var(--fg);
}
/* 여백은 명시도를 올려 적는다 — 위 .lj-mood 의 메모와 같은 이유다. */
.narrative .lj-bridge { margin: 0 0 16px; }
.narrative .lj-bridge:last-child { margin-bottom: 0; }

/* ★ 46차 §5 — '빠졌다' 가 무슨 뜻인지. 사실 확인용 주석이라 작게 둔다.
   빠진 것 줄 **바로 아래**에 붙어야 뜻이 이어진다. */
.lj-gone-meaning {
  font-size: 12px;
  line-height: 1.6;
}
.card.narrative > p.lj-gone-meaning { margin: 4px 0 10px; }

/* 46차 — 첫 줄과 함께 읽기의 근거. 묶음 근거와 같은 모양을 쓴다. */
.lj-reading-lead {
  margin: 0 0 10px;
  line-height: 1.6;
}
.lj-reading-evidence {
  display: grid;
  gap: 12px;
  margin: 0 0 14px;
}
/* 묶음 근거와 **같은 모양**이지만 이름은 다르다 — 세는 자리가 섞이지 않게. */
.lj-reading-item {
  border-left: 3px solid var(--line);
  padding: 2px 0 2px 10px;
}

/* 지금 시간대에만 더 보이는 것에 붙는 안내. 더 있을 때와 없을 때를 같은
   모양으로 두면 "없다" 가 눈에 띄지 않는다. */
.lj-extra-note {
  margin: 8px 0 10px;
  font-size: 13px;
  line-height: 1.6;
}

/* 카드 제목 옆의 시간대. 제목과 같은 무게면 둘 다 제목으로 읽힌다. */
.card.narrative h3 small {
  margin-left: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}

/* 시간대 차이 — §5. 달라진 때와 그대로인 때를 다른 모양으로 둔다.
   ★ 같은 모양이면 "앞과 비슷하다" 와 "흐름이 하나 더해졌다" 가 같은 무게로
     읽힌다. 그 둘의 차이가 이 칸이 생긴 이유다. */
.lj-shift {
  margin: 0 0 8px;
  line-height: 1.7;
  color: var(--muted);
}
.lj-shift-changed {
  color: inherit;
  font-weight: 600;
}
.lj-shift-box {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--bg);
}
.lj-shift-box .lj-sub { margin-top: 0; }
.lj-shift-detail {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
  margin: 0 0 6px;
  font-size: 13px;
}
.lj-shift-detail .lj-tags { margin: 0; }
.lj-shift-next {
  margin: 6px 0 0;
  font-size: 13px;
  line-height: 1.6;
}
/* 현재 시간대를 고른 경우 — 위에 적어 두었다는 안내.
   ★ 글자 색만 흐리게 두지 않는다. 안내가 아니라 **왜 여기가 비어 있는지**를
     말하는 글이므로, 읽히지 않으면 화면이 덜 그려진 것으로 보인다. */
.lj-same-as-main {
  margin: 10px 0;
  padding: 10px 12px;
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  background: var(--bg);
  font-size: 13px;
  line-height: 1.7;
}

/* 분야 설명 — 한 줄씩. 42차에는 한 문단으로 이어 붙여 네 문장이 됐다. */
.lj-area-notes {
  list-style: none;
  margin: 0 0 10px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 13px;
  line-height: 1.65;
  color: var(--muted);
}

/* 분야별 시간대 수 — 전문 근거 안으로 옮겼다 (§3).
   ★ 이름 · 수 · 설명을 세 칸으로 갈라 둔다. 설명은 줄을 내린다. */
.lj-share-list {
  list-style: none;
  margin: 6px 0 10px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.lj-share-list .lj-share {
  display: grid;
  grid-template-columns: auto auto;
  justify-content: start;
  gap: 2px 8px;
  align-items: baseline;
}
.lj-share-list .lj-share-detail { grid-column: 1 / -1; }

/* 상세보기 안의 작은 제목. h4 를 쓰지 않는 이유: 이 칸은 <details> 안이고,
   바깥 카드의 h3 아래에 h4 를 또 쌓으면 화면 읽기 프로그램이 목차를 깊게
   만든다. 글의 역할만 표시한다. */
.lj-sub {
  margin: 14px 0 4px;
  font-weight: 700;
  font-size: 13px;
  color: var(--muted);
}
/* 고른 시간대 안내 — 자동인지 수동인지. 둘을 같은 모양으로 두면 §6 이 요구한
   구분이 화면에서 사라진다. */
.lj-pick-manual { font-weight: 600; }
.lj-pick-manual .link,
.lj-pick-auto .link {
  background: none;
  border: 0;
  padding: 0;
  margin-left: 4px;
  color: var(--accent);
  font: inherit;
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
}
.lj-pick-manual .link:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}
/* 가상 시각 고지. 접힌 칸 안에서도 눈에 들어와야 한다 — §2 · §6 이 요구한
   고지이므로 본문과 같은 색이면 고지가 아니다. */
.lj-virtual { font-weight: 600; }
.lj-evidence {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted);
}
.lj-evidence li {
  padding: 6px 8px;
  border-radius: 8px;
  background: var(--bg);
  /* 근거 줄은 기둥·축·간지가 칸 맞춰 들어온다. 비례 글꼴로 두면 줄마다
     칸이 어긋나 읽기 어렵다. */
  font-variant-numeric: tabular-nums;
}
.lj-term-row {
  margin: 10px 0 2px;
  font-variant-numeric: tabular-nums;
}

/* ===================================================== 44차 §4 · §8
   묶어서 적은 해설의 근거.

   ★ 43차는 묶은 사실만 꼬리표로 적었다 (`충 · 파 에 함께 걸립니다`).
     44차 §3 에서 그 줄을 화면으로 읽어 보니, 관계 코드가 설명 없이
     기본 화면에 있고 조사가 떨어져 있었다. 그래서 기본 화면에는
     **개수만 말로** 남기고, 이름과 판정 근거를 여기로 옮겼다.

   ★ 한 덩어리가 "어느 칸의" "어느 문장이" "어느 관계에서" 나왔는지를
     위에서 아래로 읽히게 둔다. 셋을 한 줄에 이어 붙이면 43차에 고친
     그 문제로 돌아간다. */
.lj-merged-lead {
  margin: 0 0 10px;
  line-height: 1.6;
}
.lj-merged-evidence {
  display: grid;
  gap: 12px;
  margin: 0 0 14px;
}
.lj-merged-item {
  border-left: 3px solid var(--line);
  padding: 2px 0 2px 10px;
}
/* 어느 칸의 글인가 — 작게. 이것이 제목처럼 읽히면 안 된다. */
.lj-merged-where {
  margin: 0 0 2px;
  font-size: 12px;
}
/* 묶인 문장 그 자체. §4 가 "두 관계가 연결된 해설 문장" 을 요구했다. */
.lj-merged-text {
  margin: 0 0 6px;
  line-height: 1.7;
}
.lj-merged-kinds {
  margin: 0;
}
