/* 관계사주 웹 — 공통 스타일 (모바일 375px 우선, '결' 리디자인)
   한지 토큰: 바탕 --paper 는 결 그림(public/assets/gyeol/*-750.webp)의 한지 배경 픽셀을 Pillow 로 뽑은 중앙값(254,251,235).
   먹색 글자 + 빨간 도장(포인트). 오행 5색은 데이터 표시와 오늘의 기운에만. 보라·네온·그라데이션 없음.
   글꼴: 본문·UI Noto Sans KR(Google Fonts), 제목·결의 말 Gowun Batang(자체 서빙).
   메뉴는 머리 바로 아래 큰 탭 2개(.topnav, 고정 안 함). 고정 요소는 아래 시트(.sheet·.sheet-backdrop)뿐.
   브랜드 키트(public/assets/kit): 음각 인장 로고, 결의 말풍선 .bub = 한지 질감 + 붓 윤곽선(border-image) + 붓 획 꼬리.
   움직임: 상태 변화에만 150~300ms, prefers-reduced-motion: reduce 이면 모두 정지. */

@font-face {
  font-family: 'Gowun Batang';
  src: url('/assets/fonts/GowunBatang-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Gowun Batang';
  src: url('/assets/fonts/GowunBatang-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --paper: #fefbeb;
  --card: #fffdf6;
  --surface: #f4ead3;
  --ink: #2b2621;
  --ink2: #635b4f;
  --line: #e3d8c2;
  --seal: #b3352b;
  --seal-dark: #8f2a22;
  --gold: #c2a266;
  --wood: #5f7d5a;
  --fire: #b4573e;
  --earth: #b08a4f;
  --metal: #8c8c86;
  --water: #3f5f7a;
  --on-color: #ffffff;
  --danger-bg: #f8e9e4;
  --danger-ink: #6f2a1a;
  --ok-bg: #eef2ea;
  --ok-ink: #2f4a2c;
  --lack-bg: #fbf1ec;
  --shade-rgb: 43, 38, 33;
  --shadow-rgb: 60, 45, 20;
  --hanji-alpha: .35;
  --sans: 'Noto Sans KR', sans-serif;
  --serif: 'Gowun Batang', serif;
  --radius: 12px;
  color-scheme: light;
}
/* 어두운 화면(시안 .superpowers/proto-artifact.html 다크 토큰 그대로). 기기 설정을 따르고, data-theme 로 고정할 수도 있음.
   시안에 없는 우리 토큰(--seal-dark·--on-color·--danger-*·--ok-*·--lack-bg·그림자)은 글자/바탕 대비 4.5:1 이상으로 정함
   (test/dark-mode.test.js). 로고·결 그림·말풍선(.bub, 한지 종이 그림)은 그대로. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #1d1a16; --card: #26221d; --surface: #332d25; --ink: #f1eadb; --ink2: #bdb3a2;
    --line: #3d362d; --seal: #e0675a; --gold: #c9ad75;
    --wood: #8fae88; --fire: #e08a6e; --earth: #d2ae74; --metal: #b4b4ad; --water: #7fa3c2;
    --hanji-alpha: .06; color-scheme: dark;
    --seal-dark: #e98a7e; --on-color: #1d1a16;
    --danger-bg: #3a221c; --danger-ink: #f2b8a8; --ok-bg: #22301f; --ok-ink: #b9d3b2; --lack-bg: #3a221c;
    --shade-rgb: 0, 0, 0; --shadow-rgb: 0, 0, 0;
  }
}
:root[data-theme="dark"] {
  --paper: #1d1a16; --card: #26221d; --surface: #332d25; --ink: #f1eadb; --ink2: #bdb3a2;
  --line: #3d362d; --seal: #e0675a; --gold: #c9ad75;
  --wood: #8fae88; --fire: #e08a6e; --earth: #d2ae74; --metal: #b4b4ad; --water: #7fa3c2;
  --hanji-alpha: .06; color-scheme: dark;
  --seal-dark: #e98a7e; --on-color: #1d1a16;
  --danger-bg: #3a221c; --danger-ink: #f2b8a8; --ok-bg: #22301f; --ok-ink: #b9d3b2; --lack-bg: #3a221c;
  --shade-rgb: 0, 0, 0; --shadow-rgb: 0, 0, 0;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  position: relative;
  min-height: 100vh;
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.7;
  word-break: keep-all;
  overflow-wrap: break-word;
  overflow-x: hidden;
}
/* 한지 질감(시안 B안 .hanji): --paper 위에 kit/hanji-tex 를 옅게 반복(투명도 --hanji-alpha: 밝은 .35 / 어두운 .06) —
   그림 배경이라 그라데이션 아님, 글자·카드보다 아래. 질감 픽셀을 겹쳐도 글자 대비 4.5:1 이상(test/design-polish·dark-mode) */
body::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: url('/assets/kit/hanji-tex.webp') repeat 0 0 / 256px; opacity: var(--hanji-alpha);
}

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 700;
  line-height: 1.35;
  margin: 0 0 12px;
}
h1 { font-size: 1.75rem; }
h2 { font-size: 1.375rem; }
h3 { font-size: 1.125rem; }
p { margin: 0 0 12px; }
a { color: var(--seal-dark); text-underline-offset: 3px; }
a:hover { color: var(--seal); }
strong { font-weight: 700; }
img, svg { max-width: 100%; }

:focus-visible { outline: 3px solid var(--seal); outline-offset: 2px; }

.wrap { width: 100%; max-width: 560px; margin: 0 auto; padding: 0 20px; }

.skip {
  position: absolute; left: -9999px; top: 0;
  background: var(--ink); color: var(--card); padding: 10px 16px; z-index: 10;
}
.skip:focus { left: 8px; top: 8px; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; margin: -1px; padding: 0; border: 0;
}

/* ───── 손그림 아이콘 (assets/icons/hand.svg) ───── */
.icon {
  width: 22px; height: 22px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
  vertical-align: -5px;
}

/* ───── 데모 모드 배너 ───── */
.demo-banner {
  background: var(--surface);
  border-bottom: 2px solid var(--gold);
  color: var(--ink);
  padding: 10px 20px;
  font-size: 1rem;
  text-align: center;
}

/* ───── 머리: 로고(음각 인장 그림 + 관계사주)만 ───── */
.site-header { border-bottom: 1px solid var(--line); }
.head-in { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 60px; }
.brand {
  display: inline-flex; align-items: center; gap: 10px; min-height: 44px;
  font-family: var(--serif); font-weight: 700; font-size: 1.25rem; color: var(--ink); text-decoration: none;
}
.brand:hover { color: var(--ink); }
.brand-seal { display: block; width: 30px; height: 30px; flex: none; transform: rotate(-3deg); }

/* ───── 상단 큰 탭 2개(머리 바로 아래, 화면 폭 반씩): 결 순위 차트 | 사주 장바구니 ─────
   고정하지 않고 화면과 함께 올라간다. 고른 탭 = 아래 굵은 밑줄 + 바탕, 계정·이용안내·약관은 고른 탭 없음 */
.topnav {
  display: flex; width: 100%; max-width: 560px; margin: 0 auto;
  border-bottom: 1px solid var(--line);
}
.topnav a {
  flex: 1 1 0; min-width: 0; min-height: 48px; padding: 0 8px;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  color: var(--ink2); text-decoration: none; font-size: 1rem; font-weight: 500; white-space: nowrap;
  border-bottom: 3px solid transparent; margin-bottom: -1px;
}
.topnav a:hover { color: var(--ink); }
.topnav a[aria-current="page"] { color: var(--ink); background: var(--surface); border-bottom: 3px solid var(--seal-dark); font-weight: 700; }
.topnav .icon { width: 24px; height: 24px; flex: none; vertical-align: 0; }

/* ───── 본문 단: 가운데 좁은 단(최대 560px), 아래는 안전 영역만 ───── */
.page {
  width: 100%; max-width: 560px; margin: 0 auto;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

main { padding: 28px 0 48px; }

.site-footer { border-top: 1px solid var(--line); color: var(--ink2); font-size: 0.9375rem; padding: 28px 0 24px; }
.site-footer p { margin: 0 0 10px; }
.site-footer a { color: var(--seal-dark); display: inline-block; min-height: 44px; line-height: 44px; }

/* ───── 결 — 말풍선·그림 ─────
   .bub: 한지 질감(kit/hanji-tex) 바탕 + 붓 윤곽선(kit/bubble-frame, border-image) + 붓 획 꼬리(::before, SVG).
   꼬리는 기본으로 위(바로 위 그림의 결)를 가리키고, 결 얼굴 옆(.gyeol-row)에서는 왼쪽 얼굴 쪽.
   결의 말은 Gowun Batang. */
.bub {
  position: relative; max-width: 88%; margin: 18px 0 12px; padding: 4px 6px;
  border: 12px solid transparent; border-image: url('/assets/kit/bubble-frame.webp') 64 / 12px stretch; border-radius: 18px;
  background: #f8f1e0 url('/assets/kit/hanji-tex.webp') center / 220px; background-origin: border-box; background-clip: border-box;
  font-family: var(--serif); font-size: 1rem; line-height: 1.6; color: #2a251e;
  filter: drop-shadow(0 6px 10px rgba(90, 70, 30, .13));
}
.bub::before {
  content: ''; position: absolute; left: 14px; top: -31px; width: 26px; height: 22px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 26 22'%3E%3Cpath d='M1 3 C9 5 16 8 25 19 C18 14 9 12 2 12 Z' fill='%23f6eedb' stroke='%233a2e24' stroke-width='1.5' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
  transform: rotate(-100deg);
}
.bub > p { margin: 0; }
.bub > p + p { margin-top: 6px; }
/* 긴 글자도 말풍선 안에서 줄바꿈 */
.bub { overflow-wrap: anywhere; }
.gyeol-img {
  display: block; width: 100%; height: auto; border-radius: 16px;
  background: var(--surface); color: var(--ink2);
}
/* 화면 머리 그림(로그인·이용안내) — 너무 커지지 않게 */
.gyeol-head { max-width: 360px; margin: 0 auto 14px; }
/* 결 얼굴 + 말풍선 한 줄 (계정 화면 인사) — 얼굴은 꼬리 옆 위쪽 정렬. .gyeol-face 는 친구·장바구니 머리에도 */
.gyeol-row { display: flex; align-items: flex-start; gap: 16px; margin: 0 0 12px; }
.gyeol-face {
  width: 48px; height: 48px; flex: none; border-radius: 50%; object-fit: cover; object-position: 50% 20%;
  background: var(--card); border: 2px solid var(--card); box-shadow: 0 0 0 1.5px var(--gold);
}
.gyeol-row > .bub { margin: 0; }
.gyeol-row > .bub::before { left: -31px; top: 6px; transform: scaleX(-1); }

/* ───── 버튼·입력 ───── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px; border-radius: 10px; border: 1.5px solid var(--ink);
  background: var(--ink); color: var(--card); font: inherit; font-weight: 700; text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--seal-dark); border-color: var(--seal-dark); color: var(--card); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-sub { background: var(--card); color: var(--ink); border-color: var(--ink2); }
.btn-sub:hover { background: var(--surface); color: var(--ink); border-color: var(--ink); }
.btn-text { background: none; border-color: transparent; color: var(--seal-dark); padding: 0 10px; }
.btn-text:hover { background: var(--surface); color: var(--seal); border-color: transparent; }
.btn-danger { background: var(--card); color: var(--seal-dark); border-color: var(--seal-dark); }
.btn-danger:hover { background: var(--danger-bg); color: var(--danger-ink); border-color: var(--danger-ink); }
.btn-block { width: 100%; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0; }

.form { display: grid; gap: 18px; }
.field { display: grid; gap: 6px; font-weight: 500; }
.field-hint { color: var(--ink2); font-size: 0.9375rem; font-weight: 400; margin: 0; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 0; display: grid; gap: 14px; background: var(--card); }
legend { font-family: var(--serif); font-weight: 700; font-size: 1.0625rem; padding: 0 6px; }
input[type="text"], input[type="email"], select, textarea {
  width: 100%; min-height: 48px; padding: 10px 12px; font: inherit; font-size: 1rem; color: var(--ink);
  background: var(--card); border: 1px solid var(--ink2); border-radius: 10px;
}
textarea { min-height: 96px; resize: vertical; }
.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg-item {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px;
  border: 1px solid var(--ink2); border-radius: 999px; background: var(--card); cursor: pointer; font-weight: 400;
}
.seg-item:has(input:checked) { border-color: var(--seal-dark); background: var(--surface); color: var(--seal-dark); font-weight: 700; }
.seg-item input, .check input { width: 20px; height: 20px; accent-color: var(--seal-dark); margin: 0; }
.check { display: flex; align-items: flex-start; gap: 12px; min-height: 44px; padding: 12px; border: 1px solid var(--ink2); border-radius: 10px; background: var(--surface); cursor: pointer; }
.check input { margin-top: 3px; flex: none; }

.msg { padding: 12px 14px; border-radius: 10px; border: 1px solid; margin: 12px 0; }
/* 오류 메시지: 갸우하는 결 얼굴(장식) + 문구 */
.msg-has-face { display: flex; align-items: flex-start; gap: 12px; }
.msg-face { width: 48px; height: 48px; flex: none; border-radius: 50%; object-fit: cover; object-position: 50% 25%; background: var(--card); }
.msg-body { flex: 1 1 auto; min-width: 0; }
.msg-body ul { margin: 0; padding-left: 1.2em; }
.msg-error { background: var(--danger-bg); border-color: var(--fire); color: var(--danger-ink); }
.msg-ok { background: var(--ok-bg); border-color: var(--wood); color: var(--ok-ink); }
.msg-info { background: var(--surface); border-color: var(--gold); color: var(--ink); }

.muted { color: var(--ink2); }
.small { font-size: 0.9375rem; }
.lead { font-size: 1.0625rem; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 20px; margin: 0 0 20px; }
.panel h2 { font-size: 1.25rem; }
.panel-title { display: flex; align-items: center; gap: 8px; }
.kicker { color: var(--seal-dark); font-weight: 700; font-size: 0.9375rem; margin: 0 0 4px; }

/* 기운 막대 옆 숫자(친구 화면 미니 카드) */
.bar-num { min-width: 2.5em; text-align: right; font-variant-numeric: tabular-nums; }

/* ───── 추천 영역 (쿠팡 파트너스) — 고지 문구가 맨 위 첫 요소: 크림(--surface) 둥근 상자 안 14px,
   글자색은 본문(--ink)과 다른 --seal-dark(쿠팡 공지160, 대비 약 7:1) ───── */
.items { border: 2px solid var(--gold); border-radius: 16px; padding: 18px 20px; margin: 28px 0 0; background: var(--card); }
.items-disclosure { font-size: 14px; font-weight: 400; color: var(--seal-dark); line-height: 1.5; margin: 0 0 8px; padding: 8px 16px; border-radius: 12px; background: var(--surface); }
.items-title { font-size: 1.0625rem; margin: 0 0 10px; }
.items-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: 1rem; }
.items-list a {
  display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 8px 12px;
  border: 1px solid var(--line); border-radius: 10px; color: var(--ink); text-decoration: none;
}
.items-list a:hover { background: var(--surface); }
.item-cat { color: var(--ink2); font-size: 0.9375rem; margin-left: auto; }

/* 사주 장바구니(/item): 링크 없는 물건 줄 · 기운 색 점(색은 클래스로) · 오늘의 행운템 */
.item-row {
  display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 8px 12px;
  border: 1px solid var(--line); border-radius: 10px;
}
.items-note { margin: 0 0 10px; color: var(--ink2); font-size: 0.9375rem; }
.swatch-dot { display: inline-block; flex: none; width: 18px; height: 18px; border-radius: 50%; background: var(--line); }
.swatch-dot.is-wood { background: var(--wood); }
.swatch-dot.is-fire { background: var(--fire); }
.swatch-dot.is-earth { background: var(--earth); }
.swatch-dot.is-metal { background: var(--metal); }
.swatch-dot.is-water { background: var(--water); }
.lucky { margin: 18px 0 0; padding: 14px 0 0; border-top: 1px solid var(--line); }
/* [다른 물건 보기](추천·행운템 칸마다): 목록 바로 아래 보조 버튼(48px), 잠금·'내일 또 바뀌어요'는 .btn[disabled] */
.items-more { margin: 8px 0 0; }

/* 상품 카드(쿠팡 실상품): 정사각 사진 자리를 먼저 잡고, 사진이 없거나 깨지면 기운 색 칸 — 줄이 무너지지 않음 */
.prod-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.prod-card {
  display: flex; flex-direction: column; gap: 8px; height: 100%; min-height: 44px; padding: 8px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--ink); text-decoration: none;
}
.items-list .prod-card { align-items: stretch; gap: 8px; min-height: 44px; padding: 8px; text-align: left; }
.prod-card:hover { background: var(--surface); color: var(--ink); }
.prod-photo { position: relative; display: block; width: 100%; aspect-ratio: 1 / 1; border-radius: 8px; overflow: hidden; background: var(--line); }
.prod-photo.is-wood { background: var(--wood); }
.prod-photo.is-fire { background: var(--fire); }
.prod-photo.is-earth { background: var(--earth); }
.prod-photo.is-metal { background: var(--metal); }
.prod-photo.is-water { background: var(--water); }
.prod-photo img { display: block; width: 100%; height: 100%; object-fit: cover; background: var(--card); }
/* 특가(deal:true = 30,000원 이하 + 로켓배송) 스티커 "특가": 사진 왼쪽 아래, 살짝 기울인 둥근 떡 배지. 짙은 인장 빨강(--seal-dark) 위 --paper 글자(대비 밝은 화면 약 8:1·어두운 화면 약 7:1).
   사진 칸(overflow: hidden) 안에 두어 기울어도 카드 밖으로 나가지 않는다. 할인율은 넣지 않는다(API 에 없음) */
.deal-badge {
  position: absolute; left: 8px; bottom: 8px; padding: 0 8px; border-radius: 12px;
  background: var(--seal-dark); color: var(--paper); font-size: 16px; font-weight: 700; line-height: 1.5; white-space: nowrap;
  transform: rotate(-3deg);
}
.prod-name {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden;
  min-height: 3em; font-size: 14px; line-height: 1.5;
}
.prod-theme { align-self: flex-start; padding: 0 8px; border-radius: 999px; background: var(--surface); color: var(--seal-dark); font-size: 12px; line-height: 1.75; }
.prod-price { font-size: 16px; font-weight: 700; }

/* 나의 다섯 기운(.five-elems): 막대 5개 — 모자란 기운은 점선 빈 칸 + 채운 만큼 색 + "채우기", 길이는 클래스(w-0~100) */
/* 제목 바로 아래: 계산에 쓴 생일 한 줄 + [고치기](누르는 영역 44px, .link-btn) — 잘못 넣은 생일을 바로 알아채게 */
.five-birth { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 8px 0 16px; padding: 0 8px 0 16px; border-radius: 10px; background: var(--surface); }
.five-birth-text { margin: 0; min-width: 0; color: var(--ink); font-size: 14px; font-variant-numeric: tabular-nums; }
.five-birth .link-btn { flex: none; }
.five-more { margin-top: 16px; }
.five-more summary { gap: 8px; }
.five-sub { margin: 0 0 16px; color: var(--ink2); font-size: 14px; }
.five-bars { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 8px; }
.five-row { display: grid; grid-template-columns: 4.5em minmax(0, 1fr) auto; align-items: center; gap: 8px; min-height: 32px; }
.five-label { font-weight: 500; white-space: nowrap; }
.five-row.is-strongest .five-label { font-weight: 700; }
.five-track { display: block; height: 16px; border-radius: 8px; background: var(--surface); overflow: hidden; }
.five-row.is-lack .five-track { border: 2px dashed var(--seal-dark); background: var(--lack-bg); }
.five-row.is-faint .five-track { border: 2px dashed var(--ink2); }
.five-fill { display: block; height: 100%; width: 0; border-radius: 8px; background: var(--line); }
.five-fill.is-wood { background: var(--wood); }
.five-fill.is-fire { background: var(--fire); }
.five-fill.is-earth { background: var(--earth); }
.five-fill.is-metal { background: var(--metal); }
.five-fill.is-water { background: var(--water); }
.five-fill.w-10 { width: 10%; }
.five-fill.w-20 { width: 20%; }
.five-fill.w-30 { width: 30%; }
.five-fill.w-40 { width: 40%; }
.five-fill.w-50 { width: 50%; }
.five-fill.w-60 { width: 60%; }
.five-fill.w-70 { width: 70%; }
.five-fill.w-80 { width: 80%; }
.five-fill.w-90 { width: 90%; }
.five-fill.w-100 { width: 100%; }
.five-tag { color: var(--ink2); font-size: 14px; white-space: nowrap; }
.five-tag.is-lack { padding: 0 8px; border-radius: 999px; background: var(--seal-dark); color: var(--card); font-weight: 700; }
.five-tag.is-faint { padding: 0 8px; border: 1px dashed var(--seal-dark); border-radius: 999px; color: var(--seal-dark); }
.five-tag.is-over { color: var(--ink); font-weight: 700; }
.five-chips-note { margin: 0 0 8px; color: var(--ink2); font-size: 14px; }
.five-chips { margin: 0 0 16px; }
.five-chips .chip { min-height: 44px; }
.fill-card { margin: 16px 0 0; padding: 16px; border-radius: 12px; background: var(--surface); }
.fill-img { display: block; width: 100%; height: auto; aspect-ratio: 750 / 560; object-fit: cover; margin: 0 0 16px; border-radius: 8px; background: var(--card); }
.fill-title { margin: 0 0 16px; font-size: 18px; }
/* 이름표(지금은 / ○ 기운을 채우면 / 이렇게 채워 보세요) — 문장마다 무엇인지 먼저 보여 준다 */
.fill-label { margin: 0 0 8px; color: var(--seal-dark); font-size: 14px; font-weight: 700; }
.fill-now { margin: 0 0 16px; }
.fill-after { margin: 0 0 16px; padding: 0 0 0 24px; }
.fill-how { margin: 0; }
.over-line { margin: 16px 0 0; color: var(--ink2); font-size: 14px; }
#itemResult .btn-block { margin: 16px 0 0; }

/* ───── 칩(탭·관계 고르기·시간 칩) ───── */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 44px; padding: 8px 14px; border-radius: 12px; border: 1px solid var(--ink2);
  background: var(--card); color: var(--ink); font: inherit; text-align: left; cursor: pointer;
}
.chip[aria-pressed="true"] { border-color: var(--seal-dark); background: var(--surface); color: var(--seal-dark); font-weight: 700; }

.prose h2 { margin-top: 28px; }
.prose ul, .prose ol { padding-left: 1.2em; }
.prose .toc { border: 1px solid var(--line); border-radius: 8px; padding: 8px 16px 8px 2.4em; margin: 16px 0 0; }
.prose .toc a { display: inline-flex; align-items: center; min-height: 44px; color: var(--seal-dark); }
/* 줄 끝에 홀로 떨어지면 안 되는 짧은 덩어리(약관 전화번호 — 크롬은 하이픈에서도 꺾는다) */
.nowrap { white-space: nowrap; }
.prose table { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
.prose th, .prose td { border: 1px solid var(--line); padding: 8px; text-align: left; vertical-align: top; }

/* ───── 나의 결 순위 차트: 줄·근거 칩·NEW·백업 띠 ─────
   줄 = 시안 B안 .r0: 28px 순위 · 이름(관계·NEW·오늘) + 근거 칩 + 5px 막대 · 점수 · 24px 돋보기(누르는 영역은 ::after 로 44px).
   첫 열은 minmax(0, 1fr)(긴 이름 말줄임), 칩은 한 줄 말줄임(시안은 두 줄로 꺾여 줄 높이가 흔들림).
   세로 간격은 글자 기준(em) — 폰 글자 크기·카톡 '가가'로 글자를 키우면 간격도 같은 비율로 커진다(px 고정이면 답답해 보임).
   본문 16px 에서 이름→칩 6px · 칩→막대 8px · 위아래 12px · 최소 높이 76px(4.75em) */
.chart-list { list-style: none; margin: 0 0 16px; padding: 0; border-top: 1px solid var(--line); }
.chart-row {
  display: grid; grid-template-columns: 28px minmax(0, 1fr) auto 24px; align-items: center; column-gap: 8px;
  min-height: 4.75em; padding: .75em 0; border-bottom: 1px solid var(--line);
}
.row-rank { font-family: var(--serif); font-size: 1.375rem; font-weight: 400; text-align: center; color: var(--ink); }
.row-main { display: grid; gap: 0; min-width: 0; }
.row-name { display: flex; align-items: center; gap: 4px; min-width: 0; font-size: .9375rem; font-weight: 700; line-height: 1.5; }
.row-name .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-rel { flex: none; color: var(--ink2); font-size: .75rem; font-weight: 400; }
.row-bar { display: block; width: 100%; height: 5px; }
.chart-row .row-bar { margin-top: .5em; }
.row-score { font-variant-numeric: tabular-nums; font-weight: 700; font-size: .9375rem; color: var(--ink); }
.row-more {
  position: relative; display: inline-flex; align-items: center; justify-content: center; width: 24px; min-height: 44px;
  padding: 0; border: 0; border-radius: 8px; background: none; color: var(--ink); cursor: pointer;
}
.row-more::after { content: ""; position: absolute; top: 0; bottom: 0; left: -10px; right: -10px; }
.row-more .icon { width: 18px; height: 18px; vertical-align: 0; }
.row-more:hover, .row-more[aria-expanded="true"] { background: var(--surface); color: var(--seal-dark); }
.chart-chip {
  display: inline-block; max-width: 100%; padding: 3px 10px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font-size: .75rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.badge-new {
  flex: none; padding: 0 6px; border-radius: 6px; border: 1px solid var(--seal-dark);
  color: var(--seal-dark); font-size: 12px; font-weight: 700; letter-spacing: 0.04em; line-height: 1.5;
}
/* 백업 안내 띠: 5명째부터(닫으면 다음 문턱까지), 저장이 안 되는 브라우저는 닫기 없이 늘 보임(.is-unsaved).
   한 줄 48px: 짧은 문구(말줄임) · [백업] 글자 버튼 · 닫기 X — 버튼은 44px 터치 그대로 */
.backup-band {
  display: flex; flex-wrap: nowrap; align-items: center; gap: 4px; box-sizing: border-box; min-height: 48px;
  margin: 14px 0 0; padding: 1px 2px 1px 12px;
  background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--gold); border-radius: var(--radius);
}
.backup-band p { flex: 1 1 auto; min-width: 0; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.backup-band .btn { flex: none; min-height: 44px; padding: 0 10px; }
.backup-band-x {
  flex: none; display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; padding: 0;
  border: 0; border-radius: 10px; background: none; color: var(--ink2); font: inherit; font-size: 1.375rem; line-height: 1; cursor: pointer;
}
.backup-band-x:hover { background: var(--card); color: var(--ink); }
.backup-band.is-unsaved { border-left-color: var(--seal); }
.backup-band.is-unsaved p {
  white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-height: 1.35; padding: 4px 0;
}
.row-bar {
  -webkit-appearance: none; appearance: none; border: 0; border-radius: 3px; background: var(--surface); overflow: hidden;
}
.row-bar::-webkit-meter-bar { background: var(--surface); border: 0; border-radius: 3px; height: 5px; }
.row-bar::-webkit-meter-optimum-value, .row-bar::-webkit-meter-suboptimum-value, .row-bar::-webkit-meter-even-less-good-value { background: var(--gold); border-radius: 3px; }
.row-bar::-moz-meter-bar { background: var(--gold); border-radius: 3px; }
.is-top .row-rank { color: var(--seal); }
/* 공동 순위: 숫자 위 작은 글자 (순위 칸 폭을 늘리지 않게) */
.rank-tie { display: block; font-family: var(--sans); font-size: 11px; font-weight: 500; line-height: 1.2; }
.is-top .row-bar::-webkit-meter-optimum-value, .is-top .row-bar::-webkit-meter-suboptimum-value { background: var(--seal); }
.is-top .row-bar::-moz-meter-bar { background: var(--seal); }
/* 칩 글자는 .75rem 이라 이름→칩 6px = 칩 글자의 .5em (본문 기준 .375em) */
.chart-row .chart-chip { justify-self: start; margin-top: .5em; line-height: 1.45; }
/* 줄의 칩은 한 줄 말줄임(.chart-chip), 더 보기 시트에서는 전문 */
.sheet-body .chart-chip { white-space: normal; line-height: 1.45; padding-top: 3px; padding-bottom: 3px; }
.row-name .name { flex: 0 1 auto; min-width: 2.5em; }
.row-name > :not(.name) { flex: none; }
.is-fresh { background: var(--surface); }
/* '오늘' 배지 = 시안 .today */
.badge-today {
  flex: none; display: inline-block; padding: 0 5px; border-radius: 4px; background: var(--wood); color: var(--on-color);
  font-size: .6875rem; font-weight: 700; white-space: nowrap;
}
.chart-row.is-care { grid-template-columns: minmax(0, 1fr) auto; }
.care-tip { margin: 0; font-size: 16px; color: var(--ink); }
.care-tip strong { color: var(--seal-dark); }
.chart-empty, .chart-skip { padding: 16px 0; border-bottom: 1px solid var(--line); color: var(--ink2); }
.chart-skip { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }

/* 차트 첨 화면: 제목 · 부제 · #hero(예시 차트) · 생일 입력.
   #hero 기본 마크업 = 완성된 종합 차트 5줄(스크립트 전에도 보임). chart-hero.js 가 Web Animations API 로
   transform·opacity 만 움직인다(.is-live). 줄 모양은 실제 차트 줄(.row-* · .chart-chip · .is-top = 시안 .r0)을 그대로 쓰고,
   줄 안 세로 간격도 실제 차트와 같은 em(이름→칩 칩 글자 .5em = 6px, 칩→막대 본문 .5em = 8px).
   줄 높이는 최소 4.25em(글자 100% 에서 68px, 내용 60px 을 가운데에 두고 남는 위아래), 목록은 4줄 창(17em = 272px,
   overflow hidden): 5위 이하로 내려가는 줄은 창 아래로 나가고, 올라오는 줄은 창 안으로 들어온다.
   움직임 좌표는 chart-hero.js 가 실제 첫 줄 높이(offsetHeight)를 읽어 잡으므로 글자를 키워도 줄·펼침·테두리가 함께 맞는다.
   375×812 글자 100% 에서 히어로 + 입력 + 만들기 버튼이 스크롤 없이 보인다(버튼 아래 끝 807.7px — 부제·히어로 아래 여백 6px). */
.start-lead { color: var(--ink2); font-size: 0.9375rem; margin: 0 0 6px; }
.chart-hero { margin: 0 0 6px; padding: 0 10px 2px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; }
.hero-head { display: flex; align-items: center; gap: 6px; min-height: 44px; }
.hero-tabs { display: flex; align-items: center; gap: 6px; min-width: 0; }
.hero-pause {
  display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; margin: 0 -6px 0 auto; padding: 0 8px;
  border: 0; border-radius: 10px; background: none; color: var(--ink2); font: inherit; font-size: 0.8125rem; text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}
.hero-pause:hover { background: var(--surface); color: var(--ink); }
.ex-badge { padding: 0 6px; border: 1px solid var(--seal); border-radius: 6px; color: var(--seal-dark); font-size: 0.8125rem; font-weight: 500; }
.ex-tab { padding: 1px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink2); font-size: 0.8125rem; white-space: nowrap; }
.ex-tab.is-on { background: var(--ink); border-color: var(--ink); color: var(--card); }
.hero-list { position: relative; list-style: none; margin: 0; padding: 0; height: 17em; overflow: hidden; }
/* 칸 나눔·간격은 .chart-row 와 같고(28px 순위 · 본문 · 점수 · 24px 돋보기), 높이는 최소 4.25em(68px).
   첫 줄 위 선은 투명(줄마다 높이가 같아야 한 칸씩 정확히 옮김) */
.hero-row {
  position: relative; display: grid; grid-template-columns: 28px minmax(0, 1fr) auto 24px; align-items: center; column-gap: 8px;
  min-height: 4.25em; border-top: 1px solid var(--line); background: var(--card);
}
.hero-row:first-child { border-top-color: transparent; }
/* 색·글꼴·칩·막대(1~3위 --seal, 나머지 --gold)는 실제 차트 규칙 그대로 — 여기서는 크기·줄 간격만 */
.hero-row .row-rank { font-size: 1.25rem; line-height: 1; }
.hero-row .row-name { line-height: 1.2; }
.hero-row .chart-chip { justify-self: start; margin-top: .5em; line-height: 1.25; }
.hero-row .row-bar { margin-top: .5em; }
.hero-row .row-score { min-width: 2.2em; text-align: right; }
.hero-row .icon { justify-self: center; width: 18px; height: 18px; vertical-align: 0; color: var(--ink); transform-box: fill-box; transform-origin: center; }
/* 예시의 새 사람 배지 = 시안 .today 모양(.badge-today 와 같은 토큰) */
.hero-row .badge-new {
  padding: 0 5px; border: 0; border-radius: 4px; background: var(--wood); color: var(--on-color);
  font-size: .6875rem; font-weight: 700; letter-spacing: 0;
}
/* 1위 줄 아래로 펼쳐지는 한 줄(더 보기, 위아래 여백 포함 68px = 줄 하나). 정지 화면(reduced-motion)은 흐름 안,
   움직일 때는 목록 맨 위에 겹쳐 두고 chart-hero.js 가 실제 줄 높이로 1위 줄 아래 칸 가운데에 옮긴다.
   왼쪽은 순위 칸(28px) + 간격(8px)만큼 들임 */
.hero-read {
  display: block; height: 44px; margin: 12px 0 12px 2.25rem; padding: 0 12px; border-radius: 12px; background: var(--surface);
  color: var(--ink); font-size: 0.8125rem; line-height: 44px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transform-origin: top center;
}
.hero-glow { position: absolute; inset: 1px 0; border: 2px solid var(--wood); border-radius: 10px; opacity: 0; pointer-events: none; }
.hero-list.is-live .hero-new, .hero-list.is-live .hero-read { position: absolute; left: 0; right: 0; top: 0; opacity: 0; }
.hero-list.is-live .hero-read { margin-top: 0; }
.hero-list.is-live .hero-new { border-top: 1px solid var(--line); }
.me-form { display: grid; gap: 10px; }
.lbl { display: block; margin: 0; font-size: 0.9375rem; font-weight: 500; color: var(--ink); }
.birth-row { display: flex; gap: 8px; }
.birth-row input { flex: 1 1 auto; width: auto; min-width: 0; font-size: 1.125rem; letter-spacing: 0.04em; }
.birth-row .chip { flex: none; min-height: 48px; }
.birth-digits { font-size: 1.125rem; letter-spacing: 0.04em; }
.time-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
.time-box { display: grid; gap: 6px; }
/* 태어난 시간(공용 time-pick.js): [모름] [오전] [오후] 3칸 + 1~12시 4열 격자, 모두 44px 이상 */
.time-pick { display: grid; gap: 8px; }
.tp-halves { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tp-hours { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.tp-hours[hidden] { display: none; }
.time-pick .chip { min-height: 44px; padding: 8px 4px; text-align: center; }
.safe-note { margin: 0; text-align: center; color: var(--ink2); font-size: 0.875rem; }
.link-btn {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 4px; border: 0; background: none;
  color: var(--seal-dark); font: inherit; font-size: 0.9375rem; text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}
.me-form .link-btn { justify-self: center; }

/* 차트 화면: 머리 · 탭 5개(칩 줄만 가로 스크롤) · 묶음 줄 · 사람 추가·묶음 · 맨 아래 사주 장바구니
   수치는 시안 B안(.superpowers/proto-artifact.html: .s-title · .share · .banner · .tabs · .tab-note · .bottom-actions) */
.chart-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin: 0; }
.chart-head h1 { margin: 0; font-size: 1.3125rem; }
.chart-sub { margin: 4px 0 0; color: var(--ink2); font-size: .8125rem; line-height: 1.5; }
.chart-sub .link-btn { font-size: .8125rem; }
/* [공유] = 시안 .share: 보이는 높이 40px, ::after 로 위아래 2px 씩 넓혀 누르는 영역 44px */
.chart-head .btn {
  position: relative; flex: none; gap: 6px; min-height: 40px; padding: 0 14px; border-width: 1px; border-radius: 10px;
  font-size: .875rem; line-height: 1;
}
.chart-head .btn::after { content: ""; position: absolute; left: 0; right: 0; top: -2px; bottom: -2px; }
/* [친구 초대] [공유] 두 버튼 — 좌우 8px(누르는 영역이 겹치지 않게), 좁으면 아래로 내림(세로 8px) */
.chart-head-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; flex: none; max-width: 60%; }
.chart-head .btn .icon { width: 16px; height: 16px; vertical-align: 0; }
/* 탭 칩 = 시안 .tabs span: 보이는 높이 36px, ::after 로 위아래 4px 씩 넓혀 누르는 영역 44px */
.chart-tabs .chip {
  position: relative; flex: none; display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px;
  border: 1px solid var(--ink2); border-radius: 999px; background: var(--card); font-size: .875rem; line-height: 1; white-space: nowrap;
}
.chart-tabs .chip::after { content: ""; position: absolute; left: 0; right: 0; top: -4px; bottom: -4px; }
.chart-tabs .chip[aria-selected="true"] { background: var(--ink); border-color: var(--ink); color: var(--card); font-weight: 700; }
/* 아래 버튼([묶음 고르기]) = 시안 .bottom-actions: 44px, 테두리 1.5px 먹색, .875rem 굵게 */
.chart-actions .btn { gap: 6px; min-height: 44px; padding: 0 12px; border-radius: 10px; font-size: .875rem; }
.chart-actions .btn-sub { border-color: var(--ink); }
.chart-actions .btn .icon { width: 16px; height: 16px; vertical-align: 0; }
/* 결 배너 = 시안 .banner: 탭 줄 위 120px, 금빛 22% 바탕, 결 누끼(.banner-cut = 시안 .cut 104×170 contain)는
   오른쪽 위에 걸쳐 아래가 잘림. 문구는 폭 70% 안에서 두 줄까지 — 오늘 잘 맞는 사람 또는 오늘의 기운 */
.gyeol-banner {
  position: relative; overflow: hidden; height: 120px; margin: 14px 0 4px; padding: 18px 16px;
  background: color-mix(in srgb, var(--gold) 22%, var(--card)); border: 1px solid var(--line); border-radius: 14px;
}
.banner-text { margin: 0; }
.banner-date { display: block; color: var(--ink2); font-size: .75rem; font-weight: 500; }
.banner-line {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden;
  max-width: 70%; margin-top: 4px; font-family: var(--serif); font-size: 1.125rem; line-height: 1.35; word-break: keep-all;
}
.banner-cut { position: absolute; right: 2px; top: 6px; width: 104px; height: 170px; object-fit: contain; object-position: 50% 0; pointer-events: none; }
/* 탭 줄 = 시안 .tabs(칩 사이 6px). 끝 신호는 시안 .tabs-wrap.fade 의 흐림(linear-gradient)이 사이트 규칙(그라데이션 금지)에
   걸려, 오른쪽 여백의 손그림 화살표만 둠(마지막 탭이 다 보이면 .is-end 로 감춤).
   안쪽 위아래 4px = 누르는 영역 자리(가로 스크롤 칸이 ::after 를 자르지 않게) → 보이는 간격 위 16px · 아래 6px */
.tabs-scroll { display: flex; align-items: center; gap: 2px; margin: 12px -20px 2px -20px; padding-right: 4px; }
.tabs-more { flex: none; width: 18px; height: 18px; color: var(--ink2); transform: scaleX(-1); }
.tabs-scroll.is-end .tabs-more { visibility: hidden; }
.chart-tabs { display: flex; flex: 1 1 auto; min-width: 0; gap: 6px; overflow-x: auto; padding: 4px 8px 4px 20px; scrollbar-width: none; }
.chart-tabs::-webkit-scrollbar { display: none; }
.tab-desc { margin: 0 0 8px; color: var(--ink2); font-size: .75rem; }
.group-line { display: flex; flex-wrap: wrap; align-items: center; gap: 0 8px; margin: 0 0 8px; font-size: 14px; font-weight: 500; }
.chart-status { margin: 0 0 16px; }
.chart-actions { display: grid; grid-template-columns: 1fr; gap: 8px; }
.chart-foot { margin: 16px 0 0; text-align: center; }
.cart-link {
  display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; margin: 16px 0 0; padding: 0 12px;
  border-top: 1px solid var(--line); color: var(--seal-dark); font-weight: 500; text-decoration: none;
}
/* 맨 아래 작은 링크 "개선 요청 보내기"(mailto) — 눈에 띄지 않게 작은 회색 밑줄 글자, 누르는 영역은 44px */
.feedback-foot { margin: 8px 0 0; text-align: center; }
.feedback-link {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 8px;
  color: var(--ink2); font-size: .8125rem; text-decoration: underline; text-underline-offset: 3px;
}
.feedback-link:hover { color: var(--ink); }

/* 카카오톡 안 브라우저 안내 띠(UA 에 KAKAOTALK 일 때만, chart-app.js bootInApp): 차트·장바구니·친구 화면 머리 아래.
   위 줄 = 문구 한 줄 + 닫기 X(44px), 아래 줄 = [Chrome·사파리에서 열기] 글자 버튼(44px). 백업 띠와 같은 바탕·금빛 왼쪽 줄 */
.inapp-band {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 4px;
  margin: 12px 0; padding: 0 2px 0 12px;
  background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--gold); border-radius: var(--radius);
}
.inapp-band[hidden] { display: none; }
.inapp-band p { margin: 0; font-size: .875rem; line-height: 1.4; word-break: keep-all; }
.inapp-band .link-btn { grid-column: 1 / -1; justify-self: start; margin-left: -4px; font-weight: 700; }

/* 카톡 안에서 연 친구 링크(#add=·#invite=) 안내(chart-app.js bootLinkGate): 차트·친구 화면 맨 위, 눈에 띄게 금빛 테두리·굵은 제목.
   [크롬·사파리에서 열기] = 큰 버튼(48px), '여기서 계속' = 작은 글자 버튼(.link-btn 44px) */
.link-gate {
  display: grid; gap: 8px; justify-items: center; margin: 12px 0 16px; padding: 16px;
  background: var(--surface); border: 2px solid var(--gold); border-radius: var(--radius); text-align: center;
}
.link-gate[hidden] { display: none; }
.link-gate p { margin: 0; word-break: keep-all; }
.link-gate-title { font-size: 1.125rem; font-weight: 700; color: var(--ink); }
.link-gate-sub { font-size: .875rem; color: var(--ink2); }
.link-gate .link-btn { font-size: .875rem; color: var(--ink2); }

/* 첫 화면 맨 위 안내(#startNote): 내 생년월일이 없을 때 친구 링크(#add=)로 들어온 사람 — 예시 차트보다 위, 안내(ok) 색 */
.start-note {
  display: grid; gap: 4px; margin: 12px 0 12px; padding: 14px 16px;
  background: var(--ok-bg); border: 2px solid var(--wood); border-radius: var(--radius); color: var(--ok-ink);
}
.start-note[hidden] { display: none; }
.start-note p { margin: 0; word-break: keep-all; }
.start-note-title { font-size: 1.125rem; font-weight: 700; }
.start-note-sub { font-size: .9375rem; }

/* 친구 화면 [카톡으로 돌려보내기]: 큰 버튼(56px) + "보내야 ○○님 차트에 들어가요" + 상태 한 줄(아직 안 보냄 → 체크 보냈어요) */
.btn-send { min-height: 56px; font-size: 1.0625rem; }
/* '돌려줄 링크' 입력칸 바로 아래에 오면 붙어 보이지 않게 8px */
input + .btn-send { margin-top: 8px; }
.send-hint { margin: 8px 0 0; text-align: center; font-weight: 700; color: var(--ink); }
.send-state {
  display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 28px; margin: 4px 0 0;
  color: var(--ink2); font-size: .875rem;
}
.send-state.is-sent { color: var(--ok-ink); font-weight: 700; }
.send-state .icon { width: 18px; height: 18px; }

/* 시트 안: 더 보기 풀이 · 근거 칩 · 접힘 · '사주로 보면' 회색 줄 · 고르기 · 복사 대신 */
.sheet-body > * + * { margin-top: 10px; }
.reading { margin: 0; padding-left: 1.2em; display: grid; gap: 6px; }
.why-diff { border: 1px solid var(--line); border-radius: 10px; }
.why-diff summary { display: flex; align-items: center; min-height: 48px; padding: 0 14px; cursor: pointer; font-weight: 500; }
.why-diff p { margin: 0; padding: 0 14px 14px; color: var(--ink2); font-size: 0.9375rem; }
.term-line { margin: 0; color: var(--ink2); font-size: 0.8125rem; opacity: .85; }
/* 더 보기 '점수가 이렇게 나왔어요': 가운데 기준선 → 왼쪽 부딪힘(--fire) · 오른쪽 끌림(--wood).
   막대는 폭 100 짜리 SVG(rect 속성으로 폭, CSP 때문에 style 없음) */
.why-bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.sbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 8px; font-size: 0.875rem; }
.sbar-label { min-width: 0; color: var(--ink); }
.sbar-num { font-variant-numeric: tabular-nums; color: var(--ink2); }
.sbar-track { grid-column: 1 / -1; display: block; width: 100%; height: 8px; }
.sbar-bg { fill: var(--surface); }
.sbar-mid { fill: var(--ink2); }
.sbar.is-plus .sbar-fill { fill: var(--wood); }
.sbar.is-minus .sbar-fill { fill: var(--fire); }
.care-text { margin: 0; font-weight: 700; color: var(--ink); }
.pick { display: grid; gap: 8px; }
.pick .btn { justify-content: flex-start; }
.pick .btn[aria-pressed="true"] { border-color: var(--seal-dark); background: var(--surface); color: var(--seal-dark); }
.field-group .lbl { margin: 0 0 6px; }
.copy-fallback { display: grid; gap: 6px; }

/* 공유 시트(설계 4-5): 조심 탭은 고를 수 없음(.is-off) · 이니셜 스위치 · 1080×1350 캔버스를 4:5 로 줄여 미리보기 */
.chip.is-off { border-style: dashed; color: var(--ink2); background: var(--surface); cursor: not-allowed; }
.why-no { margin: 6px 0 0; color: var(--ink2); font-size: 0.875rem; }
.share-no { margin: 0; color: var(--seal-dark); font-size: 0.9375rem; }
.share-no:empty { display: none; }
.share-toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; }
.share-toggle label { display: grid; cursor: pointer; }
.share-switch {
  -webkit-appearance: none; appearance: none; position: relative; flex: none; width: 52px; height: 30px; margin: 7px 0;
  border-radius: 15px; background: var(--line); cursor: pointer;
}
.share-switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: var(--card);
  box-shadow: 0 1px 3px rgba(var(--shade-rgb), .25);
}
.share-switch:checked { background: var(--seal); }
.share-switch:checked::after { transform: translateX(22px); }
.share-switch:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.share-shot {
  display: block; aspect-ratio: 4 / 5; width: 100%; max-width: 320px; height: auto; margin: 12px auto 0;
  border: 1px solid var(--line); border-radius: 14px; background: var(--paper); box-shadow: 0 4px 18px rgba(var(--shadow-rgb), .1);
}

/* 친구 화면(/chart/friend): 결 얼굴 + 질문 제목 · 미니 카드(기운 막대 5개, <meter> 색은 클래스로) */
.friend-head { display: flex; align-items: center; gap: 14px; margin: 0 0 8px; }
.friend-head h1 { margin: 0; font-size: 1.375rem; }
.mini-card h2 { margin: 0 0 6px; }
.mini-card p { margin: 0 0 14px; }
.mini-bars { display: grid; grid-template-columns: auto 1fr; gap: 8px 12px; margin: 0; align-items: center; }
.mini-bars dt { font-weight: 500; }
.mini-bars dd { margin: 0; display: flex; align-items: center; gap: 10px; }
.mini-bars meter {
  -webkit-appearance: none; appearance: none; flex: 1 1 auto; width: 100%; height: 10px; border: 0; border-radius: 5px; background: var(--surface); overflow: hidden;
}
.mini-bars meter::-webkit-meter-bar { background: var(--surface); border: 0; border-radius: 5px; height: 10px; }
.mini-bars .is-wood::-webkit-meter-optimum-value { background: var(--wood); }
.mini-bars .is-fire::-webkit-meter-optimum-value { background: var(--fire); }
.mini-bars .is-earth::-webkit-meter-optimum-value { background: var(--earth); }
.mini-bars .is-metal::-webkit-meter-optimum-value { background: var(--metal); }
.mini-bars .is-water::-webkit-meter-optimum-value { background: var(--water); }
.mini-bars .is-wood::-moz-meter-bar { background: var(--wood); }
.mini-bars .is-fire::-moz-meter-bar { background: var(--fire); }
.mini-bars .is-earth::-moz-meter-bar { background: var(--earth); }
.mini-bars .is-metal::-moz-meter-bar { background: var(--metal); }
.mini-bars .is-water::-moz-meter-bar { background: var(--water); }
#friendResult > .btn { margin: 0 0 4px; }

/* ───── 아래 시트 (고정 요소: .sheet · .sheet-backdrop) ─────
   뒤 막을 누르거나 Esc 로 닫음, 스크롤은 .sheet-body 안에서만(뒤 화면은 body.has-sheet 로 잠금) */
.has-sheet { overflow: hidden; }
.sheet-backdrop { position: fixed; inset: 0; z-index: 20; background: rgba(var(--shade-rgb), .45); }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 21;
  display: flex; flex-direction: column; max-height: 88vh; max-height: 88dvh; width: 100%; max-width: 560px; margin: 0 auto;
  background: var(--paper); border-radius: 18px 18px 0 0; box-shadow: 0 -8px 24px rgba(var(--shadow-rgb), .18);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.sheet:focus { outline: none; }
.sheet:focus-visible { outline: 3px solid var(--seal); outline-offset: -3px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 8px 4px 20px; border-bottom: 1px solid var(--line); }
.sheet-title { margin: 0; font-size: 1.25rem; }
.sheet-close {
  display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; padding: 0 12px;
  border: 0; border-radius: 10px; background: none; color: var(--ink2); font: inherit; cursor: pointer;
}
.sheet-close:hover { background: var(--surface); color: var(--ink); }
.sheet-body { overflow-y: auto; overscroll-behavior: contain; padding: 16px 20px 24px; }

/* ───── 움직임 (상태 변화에만, 150~300ms) ───── */
@media (prefers-reduced-motion: no-preference) {
  .bub { animation: bubble-in 200ms ease-out both; }
  @keyframes bubble-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
  .topnav a { transition: color 150ms ease, background-color 150ms ease; }
  .sheet { animation: sheet-in 220ms ease-out both; }
  .share-switch::after { transition: transform 150ms ease; }
  .sheet-backdrop { animation: fade-in 200ms ease-out both; }
  @keyframes sheet-in { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
  @keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ───── 넓은 화면 ───── */
@media (min-width: 900px) {
  h1 { font-size: 2rem; }
  .page { padding-bottom: 32px; }
}
