/* =========================================================
   48base — 60갑자 일주 동물
   디자인 시스템: Grapix Design System v1.0 (claude.ai/design)
   흑백 미니멀 · Pretendard · 그림자·그라데이션 없이 테두리로 구분.
   색은 의미가 있을 때만 — 60갑자 카드의 오방색은 UI 가 아니라 콘텐츠라 그대로 둔다.
   ========================================================= */

:root {
  /* ── Grapix 원본 토큰 (colors_and_type.css 에서 이 앱이 쓰는 것만) ── */
  --gx-primary-black: #1A1A1A;
  --gx-secondary-black: #343434;
  --gx-gray-50: #FAFAFA;
  --gx-gray-100: #F5F5F5;
  --gx-gray-150: #F0F0F0;
  --gx-gray-250: #E0E0E0;
  --gx-gray-350: #CCCCCC;
  --gx-gray-400: #BBBBBB;
  --gx-gray-500: #999999;
  --gx-gray-650: #666666;
  --gx-black: #000000;
  --gx-white: #FFFFFF;
  --gx-border: #DDDDDD;               /* 입력칸 · 칩 · 보조 버튼 테두리 */
  --gx-system-error: #F0303A;
  --gx-radius-4: 4px;
  --gx-radius-6: 6px;
  --gx-radius-8: 8px;
  --gx-radius-12: 12px;
  --gx-radius-24: 24px;
  --gx-radius-full: 9999px;
  --gx-ease: cubic-bezier(0.4, 0, 0.2, 1);   /* 버튼 hover · press (150ms, 튕김 없음) */

  /* ── 앱 토큰 → Grapix 연결 ── */
  --page: var(--gx-gray-150);         /* 패널 바깥 */
  --bg: var(--gx-white);              /* 패널 */
  --bg-2: var(--gx-gray-100);
  --ink: var(--gx-black);             /* Text primary */
  --ink-70: var(--gx-gray-650);       /* Text secondary */
  --ink-45: var(--gx-gray-500);       /* Text tertiary */
  --ink-25: var(--gx-gray-350);       /* Text disabled */
  --line: var(--gx-gray-250);         /* Border default */
  --line-soft: var(--gx-gray-150);    /* Border light */
  --line-strong: var(--gx-gray-400);  /* Border strong */
  --brand: var(--gx-primary-black);   /* 주 버튼 · 선택 상태 */
  --brand-hover: var(--gx-secondary-black);
  --error: var(--gx-system-error);
  --radius-ui: var(--gx-radius-8);

  /* 모션 (animate-skill: 진입 ease-out 200~300ms / 퇴출 ease-in 150~200ms(진입의 ~75%)
     / hover 150ms / press 100ms. transform·opacity 만 움직인다) */
  --ease-out-quint: cubic-bezier(.23, 1, .32, 1);
  --ease-in-out-cubic: cubic-bezier(.645, .045, .355, 1);
  --ease-out-cubic: cubic-bezier(.33, 1, .68, 1);
  --ease-out-expo: cubic-bezier(.16, 1, .3, 1);    /* 카드 확대·풀이 등장 같은 큰 면 */
  --ease-in: cubic-bezier(.4, 0, 1, 1);             /* 퇴출 */
  --dur-enter: 280ms;
  --dur-exit: 200ms;
  --dur-hover: 150ms;
  --dur-press: 100ms;
  --dur-state: 180ms;       /* 색·테두리 같은 상태 변화 */
  --dur-fade: 320ms;        /* 큰 요소 페이드 (카드 흐림, 타이틀·검색 숨김) */
  --dur-focus: 900ms;       /* '내 일주' 카드 확대 */
  --dur-focus-quick: 420ms; /* 둘러보기 카드 확대 */

  --sans: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont,
          'Apple SD Gothic Neo', system-ui, sans-serif;
  --serif: var(--sans); /* 모든 폰트는 Pretendard 로 통일 */

  /* JS가 갱신 */
  --card-w: 66px;
  --card-h: 76px;
  --hero-y: 70%;
  --result-top: 55%;

  --gnb-h: clamp(56px, calc(52px + 0.6667vw), 60px);   /* 폭 600 → 56px, 1200 → 60px */
}

* { box-sizing: border-box; }

button, input, select, textarea { font-family: inherit; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* 화면 전체를 채우는 흰 콘텐츠 패널 (여백·라운드 없음) */
.frame {
  position: fixed;
  inset: 0;
  background: var(--bg);
  overflow: hidden;
}

.vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(120% 80% at 50% 40%, rgba(255, 255, 255, 0.9) 0%, rgba(255, 255, 255, 0) 58%),
    radial-gradient(100% 60% at 50% 108%, rgba(11, 11, 12, 0.05) 0%, rgba(11, 11, 12, 0) 60%);
}

/* ---------------- 진입 등장 (staggered) ----------------
   fill-mode 는 backwards — 끝난 뒤에는 각 요소의 원래 transform 으로 돌아가야
   .is-hidden(풀이 화면) 전환이 애니메이션에 덮이지 않는다.
   각 요소의 기준 transform 이 달라 keyframe 을 따로 둔다.                     */
@keyframes rise-x {                 /* transform: translateX(-50%) 기준 */
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
}
@keyframes rise-xy {                /* transform: translate(-50%, -50%) 기준 */
  from { opacity: 0; transform: translate(-50%, -50%) translateY(10px); }
}
@keyframes fade-scale {
  from { opacity: 0; transform: scale(0.985); }
}
@keyframes rise-plain {
  from { opacity: 0; transform: translateY(8px); }
}

@keyframes fade-in { from { opacity: 0; } }

/* GNB → 타이틀 → 카드 → 입력부, 100ms 간격 */
.gnb       { animation: fade-in var(--dur-enter) var(--ease-out-cubic) backwards; }
.page-head { animation: rise-x var(--dur-enter) var(--ease-out-quint) backwards; }
.orbit     { animation: fade-scale 420ms var(--ease-out-quint) 100ms backwards; }
.hero      { animation: rise-xy var(--dur-enter) var(--ease-out-quint) 200ms backwards; }

/* ---------------- Stage / Orbit ---------------- */
.stage {
  position: relative;
  height: 100%;
  overflow: hidden;
  z-index: 1;
}
/* 풀이가 길어 화면을 넘칠 때만 스크롤 */
.stage.is-scroll {
  overflow-y: auto;
  overflow-x: hidden;               /* 궤도 양 끝 카드가 가로 스크롤을 만들지 않게 */
  overscroll-behavior: contain;
  scrollbar-width: thin;
}
.stage.is-scroll::-webkit-scrollbar { width: 8px; }
.stage.is-scroll::-webkit-scrollbar-thumb {
  background: rgba(11, 11, 12, 0.16);
  border-radius: 99px;
  border: 2px solid var(--bg);
}

.orbit {
  position: absolute;
  inset: 0;
  /* 화면 밖 양 끝 카드가 가로 스크롤 영역을 만들지 않게 가로로만 자른다
     (clip 은 스크롤 컨테이너를 만들지 않아, 포커스 이동에도 옆으로 밀리지 않는다) */
  overflow-x: clip;
  outline: none;
  cursor: grab;
  touch-action: pan-y;
}
.orbit.is-dragging { cursor: grabbing; }
/* 풀이 페이지 — 나머지 카드는 감춰져 있으므로 누를 수 없다 */
.orbit.is-dim { cursor: default; }
.orbit.is-dim .card:not(.is-focused) { cursor: inherit; pointer-events: none; }
.orbit:focus-visible { box-shadow: inset 0 0 0 2px var(--ink); }

.orbit-track {
  position: absolute;
  width: 0; height: 0;
  left: 50%; top: 100%;
}

/* ---------------- Card ----------------
   .card       — 자리·확대 모션(transform)만 맡는 틀
   .card-face  — 색·그림자·내용. 풀이 페이지에서는 여기에 홀로 기울기가 걸린다 */
.card {
  position: absolute;
  left: 0; top: 0;
  width: var(--card-w);
  height: var(--card-h);
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: calc(var(--card-w) * 0.13);
  font-size: calc(var(--card-w) * 0.118);
  background: none;
  cursor: pointer;
  will-change: transform, opacity;
  transition: opacity var(--dur-fade) var(--ease-out-cubic);
  transform-origin: 50% 50%;
  -webkit-tap-highlight-color: transparent;
}
.card[data-ink='light'] { --card-fg: rgba(255, 255, 255, 0.92); --card-fg-soft: rgba(255, 255, 255, 0.6); --card-hairline: rgba(255, 255, 255, 0.22); }
.card[data-ink='dark']  { --card-fg: rgba(11, 11, 12, 0.86);   --card-fg-soft: rgba(11, 11, 12, 0.5);  --card-hairline: rgba(11, 11, 12, 0.13); }

.card-face {
  position: absolute;
  inset: 0;
  padding: 0.8em 0.6em 0.9em;
  border-radius: inherit;
  background: var(--bg-color);
  box-shadow: inset 0 0 0 1px var(--card-hairline), 0 14px 26px -18px rgba(11, 11, 12, 0.55);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  overflow: hidden;
  isolation: isolate;            /* 홀로 층의 블렌드가 카드 밖으로 새지 않게 */
  transition: box-shadow 600ms var(--ease-out-cubic), transform 160ms var(--ease-out-cubic);
}
.card-face > :not(.card-holo) { position: relative; z-index: 1; }   /* 글·그림은 홀로 층 위 */

/* ---------------- 홀로 포일 (풀이 페이지의 확대 카드만) ----------------
   카드 고유색에서 톤업한 색만 쓰고, 원형 그라데이션 없이 사선 띠로만 표현한다. */
.card.is-holo .card-face {
  transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
}
.card-holo {
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  transition: opacity 500ms var(--ease-out-cubic);
}
.card.is-holo .card-holo { opacity: 1; }
.card-holo::before,
.card-holo::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
}
/* 톤업 포일 — 카드 고유색을 밝게 끌어올린 톤(--holo-1~3, app.js holoTones)으로 만든
   넓은 사선 띠가 기울기를 따라 흐른다. 흰빛·무지개 대신 제 색의 빛이라 고유색을 해치지 않는다.
   색상은 ±12° 안에서만 천천히 일렁인다. */
.card-holo::before {
  background-image: linear-gradient(120deg,
    transparent 0%,
    var(--holo-1) 22%,
    var(--holo-2) 46%,
    var(--holo-3) 70%,
    transparent 100%);
  background-size: 200% 200%;
  background-position: var(--mx, 50%) var(--my, 50%);
  opacity: 0.12;                      /* 반사광 0.3배 (기준 0.4) */
  animation: holo-drift 9s ease-in-out infinite alternate;
}
@keyframes holo-drift {
  from { filter: hue-rotate(var(--holo-drift-from, -12deg)); }   /* 붉은 카드는 0 → 5° (app.js holoTones) */
  to   { filter: hue-rotate(var(--holo-drift-to, 12deg)); }
}
/* 광택 — 가장 밝은 제 색 톤으로 넓게 번지는 사선 빛 */
.card-holo::after {
  background-image: linear-gradient(120deg,
    transparent 24%,
    var(--holo-hi) 50%,
    transparent 76%);
  background-size: 220% 220%;
  background-position: var(--mx, 50%) var(--my, 50%);
  mix-blend-mode: soft-light;
  opacity: 0.21;                      /* 반사광 0.3배 (기준 0.7) */
}

.card-hanja {
  font-family: var(--serif);
  font-size: 1.05em;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--card-fg);              /* 한자도 이름과 같은 글자색 (저장 이미지와 동일) */
}
.card-animal {
  font-size: 3.6em;          /* 카드 폭의 약 42% */
  line-height: 1;
  filter: saturate(0.92);
  user-select: none;
}
.card-name {
  font-size: 0.92em;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--card-fg);
}
.card-art {
  width: 86%;
  height: auto;
  object-fit: contain;
  pointer-events: none;
}

.card.is-focused {
  z-index: 900;
  opacity: 1 !important;
  transition: transform var(--dur-focus) var(--ease-out-expo);
}
.card.is-focused .card-face {
  box-shadow: inset 0 0 0 1px var(--card-hairline), 0 40px 70px -34px rgba(11, 11, 12, 0.5);
}
/* 카드 둘러보기 — 자주 반복되므로 짧게 (생년월일 결과는 위의 긴 연출 그대로) */
.card.is-focused.is-quick {
  transition: transform var(--dur-focus-quick) var(--ease-out-quint);
}
.card.is-focused.is-quick .card-face {
  transition: box-shadow 300ms var(--ease-out-cubic), transform 160ms var(--ease-out-cubic);
}

/* ---------------- GNB ----------------
   좌: 회전 일시정지 / 가운데: 서비스 이름 / 우: 검색. 콘텐츠와 구분선으로 분리하고,
   풀이가 길어 스크롤돼도 위에 남는다 (stage 밖에 있다). */
.gnb {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 20;
  height: var(--gnb-h);
  padding: 0 clamp(12px, calc(8px + 0.6667vw), 16px);
  display: grid;
  grid-template-columns: 32px 1fr 32px;   /* 버튼 하나가 빠져도(모션 줄이기) 제목은 가운데 */
  align-items: center;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line-soft);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  backdrop-filter: saturate(1.4) blur(10px);
}
.gnb .spin-toggle,
.gnb .gnb-back { grid-column: 1; grid-row: 1; }   /* 같은 칸 — 홈에서는 일시정지, 풀이 페이지에서는 뒤로 */
.gnb .search-toggle { grid-column: 3; }
.gnb-title {
  grid-column: 2;
  margin: 0;
  text-align: center;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-70);
  transition: opacity var(--dur-state) var(--ease-out-cubic);
}
/* 홈 — 서비스 이름(48base) 워드마크 */
.gnb-title.is-brand {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-transform: none;
  color: var(--ink);
}
/* 검색 줄이 열리면 같은 자리의 서비스 이름을 감춘다 */
.gnb.is-searching .gnb-title { opacity: 0; }

/* ---------------- Center content ---------------- */
.center {
  position: absolute;
  inset: 0;
  z-index: 700;
  pointer-events: none;
}
.center > * { pointer-events: auto; }
/* 풀이 스크롤 — 글 뒤 은은한 배경(::before)이 스크롤 영역을 늘리지 않게 풀이 영역 안에서 자른다 */
.stage.is-scroll .center { overflow: hidden; }

/* 최상단 타이틀 */
.page-head {
  position: absolute;
  top: 0; left: 50%;
  transform: translateX(-50%);
  z-index: 740;
  width: min(760px, calc(100% - 32px));
  padding: calc(var(--gnb-h) + 26px) 0 0;
  text-align: center;
  pointer-events: none;
  transition: opacity var(--dur-fade) var(--ease-out-cubic), transform 400ms var(--ease-out-expo);
}
.page-head.is-hidden {
  opacity: 0;
  transform: translateX(-50%) translateY(-10px);
}
/* 타이틀은 한 줄 유지 — 폭에 맞춰 글자 크기를 줄인다 (12.9em 정도 필요) */
.page-head .hero-title {
  margin-top: 0;
  white-space: nowrap;
  font-size: min(6.6vw, 44px);
}
.page-head .hero-sub { margin-bottom: 0; }

.hero {
  position: absolute;
  left: 50%;
  top: var(--hero-y);
  transform: translate(-50%, -50%);
  width: min(620px, calc(100% - 32px));
  text-align: center;
  transition: opacity var(--dur-fade) var(--ease-out-cubic), transform 500ms var(--ease-out-expo);
}
.hero::before {
  content: '';
  position: absolute;
  inset: -12% -10%;
  z-index: -1;
  background: radial-gradient(54% 56% at 50% 46%, rgba(255, 255, 255, 0.96) 0%, rgba(255, 255, 255, 0.78) 48%, rgba(255, 255, 255, 0) 80%);
  pointer-events: none;
}
.hero.is-hidden {
  opacity: 0;
  transform: translate(-50%, -50%) translateY(-12px) scale(0.97);
  pointer-events: none;
}

.hero-title {                       /* Grapix Heading — SemiBold · 110% · 자간 0 */
  margin: 0;
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(28px, 3.9vw, 48px);
  line-height: 1.1;
  letter-spacing: 0;
}
.hero-sub {                         /* Grapix Body 16 · 150% · Text secondary */
  margin: 16px auto 0;
  max-width: clamp(300px, calc(160px + 23.33vw), 440px);
  font-size: clamp(14px, calc(12px + 0.3333vw), 16px);
  line-height: 1.5;
  color: var(--ink-70);
}

/* ---------------- 입력부 ---------------- */
.entry {
  /* 모든 화면에서 같은 구조 — 패널 폭에 맞춰 늘다가 420px 에서 멈춘다 */
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
}
/* 입력부 위 작은 컨트롤 줄 (양력·음력 / 윤달) */
.entry-top {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 10px;
}

/* 날짜(년·월·일)는 칸마다 독립 컨테이너, 시간(시·분·모름)은 하나로 묶인 컨테이너 */
.entry-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.field-group { display: flex; flex: 1 1 100%; min-width: 0; }
.entry-inner .segs { flex: 1 1 auto; gap: 6px; }
.entry-inner .seg-wrap { flex: 1 1 0; min-width: 0; padding: 0 8px 0 4px; }
.entry-inner .field-group:first-child .seg-wrap:first-child { flex: 1.5 1 0; }
.entry-inner .seg { flex: 1 1 0; min-width: 0; }

/* 양력 / 음력 — 입력부 밖의 작은 스위치 (검은 썸이 미끄러진다) */
.cal-toggle {
  position: relative;
  display: inline-flex;
  padding: 2px;
  border-radius: var(--gx-radius-full);
  background: var(--bg-2);
}
.cal-thumb {
  position: absolute;
  top: 2px; left: 2px;
  width: calc(50% - 2px);
  height: calc(100% - 4px);
  border-radius: var(--gx-radius-full);
  background: var(--brand);
  transition: transform 240ms var(--ease-out-quint);
  pointer-events: none;
}
.cal-toggle[data-sel='lunar'] .cal-thumb { transform: translateX(100%); }
.cal-toggle button {
  position: relative;
  z-index: 1;
  flex: 1 1 0;
  height: 28px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--gx-radius-full);
  background: none;
  color: var(--ink-70);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
  cursor: pointer;
  transition: background var(--dur-state) var(--ease-out-cubic), color var(--dur-state) var(--ease-out-cubic);
}
.cal-toggle button.is-on {
  background: none;                     /* 배경은 .cal-thumb 가 담당 */
  color: #FFFFFF;
}

/* 입력부 위 작은 체크 칩 — 윤달 · 밤 11시~12시 출생 */
.leap-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  height: 28px;
  border: 1px solid var(--gx-border);
  border-radius: var(--gx-radius-full);
  background: var(--bg);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-70);
  cursor: pointer;
  user-select: none;
}
.leap-check input { accent-color: var(--brand); width: 13px; height: 13px; margin: 0; }
.leap-check[hidden] { display: none; }

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

/* 칸 하나 = 컨테이너 하나 (테두리·배경은 wrap 이 갖고, input 은 속만 채운다) */
.seg-wrap {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  height: 50px;
  padding: 0 12px 0 6px;
  border: 1px solid var(--gx-border);
  border-radius: var(--radius-ui);
  background: var(--bg);
  transition: border-color var(--dur-hover) var(--gx-ease);
}
.seg-wrap:hover { border-color: var(--line-strong); }
.seg-wrap:focus-within { border-color: var(--brand); }
.seg-wrap:has(.seg.is-error) { border-color: var(--error); }
/* 에러 알림 — 짧게 좌우로 (transform 만 움직인다) */
@keyframes shake {
  10%, 90% { transform: translateX(-1.5px); }
  30%, 70% { transform: translateX(2.5px); }
  50%      { transform: translateX(-2.5px); }
}
.seg-wrap.is-shake { animation: shake 260ms var(--ease-in-out-cubic); }
.seg {
  width: 46px;
  height: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
  text-align: center;
  outline: none;
}
.seg-year { width: 62px; }
.seg::placeholder { color: var(--line-strong); }
.seg.is-error { color: var(--error); }
.seg-unit {
  font-size: 13px;
  color: var(--ink-45);
  cursor: text;
  user-select: none;
}

.form-error {
  margin: 10px 0 0;
  min-height: 16px;
  font-size: 12px;
  font-weight: 500;
  color: var(--error);
}

/* ---------------- 일주 이름 검색 ---------------- */
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
/* 검색은 GNB 우측 버튼으로 연다 — 좌우 원형 버튼 사이, GNB 안에 펼쳐진다 */
.search {
  position: absolute;
  left: 50%;
  top: calc((var(--gnb-h) - 40px) / 2);
  transform: translateX(-50%) translateY(-6px);
  z-index: 2;
  width: min(360px, calc(100% - 104px));
  text-align: left;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity var(--dur-exit) var(--ease-in), transform var(--dur-exit) var(--ease-in),
              visibility 0s linear var(--dur-exit);
}
.search.is-shown {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(-50%);
  transition: opacity var(--dur-enter) var(--ease-out-quint), transform var(--dur-enter) var(--ease-out-quint),
              visibility 0s;
}
.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--gx-border);
  border-radius: var(--radius-ui);
  background: var(--bg);
  transition: border-color var(--dur-hover) var(--gx-ease);
}
.search-box:hover { border-color: var(--line-strong); }
.search-box:focus-within { border-color: var(--brand); }
.search-icon { flex: none; color: var(--ink-45); }
.search-input {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  background: none;
  font-family: inherit;
  font-size: 16px;                   /* 16px 미만이면 iOS 가 입력할 때 화면을 확대한다 */
  color: var(--ink);
  outline: none;
}
.search-input::placeholder { color: var(--ink-45); }
.search-clear {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 19px; height: 19px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--line-soft);
  color: var(--ink-45);
  cursor: pointer;
}
.search-clear:hover { color: var(--ink); }
.search-clear[hidden] { display: none; }      /* display 선언이 [hidden] 기본값을 덮는 것 방지 */
.search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0; right: 0;
  z-index: 40;
  margin: 0;
  padding: 6px;
  list-style: none;
  max-height: 236px;
  overflow-y: auto;
  overscroll-behavior: contain;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: var(--gx-radius-12);
  background: var(--bg);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);     /* Grapix: 그림자 대신 테두리, 필요하면 아주 옅은 한 겹 */
}
/* 아래 공간이 부족하면 위로 펼친다 */
.search-results.is-up { top: auto; bottom: calc(100% + 8px); }
.search-results { animation: rise-plain 200ms var(--ease-out-cubic) backwards; }
@keyframes drop-plain { from { opacity: 0; transform: translateY(-8px); } }
.search-results.is-up { animation-name: drop-plain; }
.search-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--gx-radius-8);
  cursor: pointer;
}
.search-item:hover,
.search-item.is-active { background: var(--bg-2); }
.search-swatch {
  flex: none;
  width: 22px; height: 22px;
  border-radius: var(--gx-radius-6);
  border: 1px solid rgba(0, 0, 0, 0.1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
}
.search-name {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0;
}
.search-hanja {
  margin-left: 5px;
  font-family: var(--serif);
  font-size: 12px;
  color: var(--ink-45);
}
.search-meta {
  margin-left: auto;
  font-size: 12px;
  color: var(--ink-45);
  white-space: nowrap;
}
.search-empty {
  padding: 12px 10px;
  text-align: center;
  font-size: 12px;
  color: var(--ink-45);
}

/* ---------------- Result ---------------- */
.result {
  position: absolute;
  left: 50%;
  top: var(--result-top);
  transform: translateX(-50%);
  width: min(560px, calc(100% - 40px));
  text-align: center;
  animation: resultUp 700ms var(--ease-out-expo) both;
}
.result.is-quick { animation-duration: 360ms; }   /* 둘러보기 */
.result[hidden] { display: none; }
.result::before {
  content: '';
  position: absolute;
  inset: -8% -14%;
  z-index: -1;
  background: radial-gradient(58% 60% at 50% 46%, rgba(255, 255, 255, 0.96) 0%, rgba(255, 255, 255, 0.82) 52%, rgba(255, 255, 255, 0) 80%);
  pointer-events: none;
}

@keyframes resultUp {
  from { opacity: 0; transform: translateX(-50%) translateY(18px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.result-eyebrow {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--ink-70);
}
.result-eyebrow[hidden] { display: none; }
.result-title {
  margin: 0;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 10px;
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.1;
}
.result-name { font-size: clamp(28px, 3.6vw, 40px); letter-spacing: 0; }
.result-hanja { font-size: clamp(16px, 2vw, 20px); font-weight: 400; color: var(--ink-45); }
.result-tags {                      /* 색깔 동물 · 오행 · 음양 — 아이콘과 함께 또렷하게 */
  margin: 12px 0 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 18px;
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--gx-secondary-black);
}
.result-tags .tag { display: inline-flex; align-items: center; gap: 6px; }
.result-tags .tag-emoji { flex: none; font-size: 17px; line-height: 1; }
.result-tags .tag-swatch {          /* 카드색 점 — 흰색 카드도 보이게 얇은 테두리 */
  flex: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(11, 11, 12, 0.14);
}
.result-keywords {
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}
.result-keywords li {              /* Grapix Chip — 500 13px · 알약형 · #DDD 테두리 */
  padding: 6px 14px;
  border: 1px solid var(--gx-border);
  border-radius: var(--gx-radius-full);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: 0;
  color: var(--gx-secondary-black);
  background: var(--bg);
}
.result-source {
  margin: 18px auto 0;
  max-width: 440px;
  font-size: 11px;
  line-height: 1.5;
  color: var(--ink-45);
}

.result-summary {                   /* Grapix Body 18 SemiBold */
  margin: 18px auto 0;
  max-width: 440px;
  font-size: clamp(16px, calc(10px + 0.6667vw), 18px);   /* 폭 900 → 16px, 1200 → 18px */
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: 0;
}
.result-summary .sentence { display: block; }   /* 문장('.')마다 새 줄 */
.result-desc {
  margin: 10px auto 0;
  max-width: 420px;
  font-size: 14px;
  line-height: 1.78;
  color: var(--ink-70);
}
/* 간단풀이 / 상세풀이 전환 */
.view-toggle {
  margin: 16px auto 0;
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--gx-border);
  border-radius: var(--gx-radius-full);
  background: var(--bg);
}
.view-toggle button {
  padding: 7px 16px;
  border: 0;
  border-radius: var(--gx-radius-full);
  background: transparent;
  color: var(--ink-70);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0;
  cursor: pointer;
  transition: background var(--dur-state) var(--ease-out-cubic), color var(--dur-state) var(--ease-out-cubic);
}
.view-toggle button:hover { color: var(--ink); }
.view-toggle button[aria-pressed='true'] {
  background: var(--brand);
  color: var(--gx-white);
}

/* 간단풀이에서는 상세 항목을 숨긴다 */
.result[data-view='simple'] .detail-only { display: none !important; }
.axis.is-first { padding-top: 0; border-top: 0; }

.result-detail {
  margin: 24px 0 0;
  display: grid;
  gap: 14px;
  text-align: left;
}
.axis + .axis {
  padding-top: 14px;
  border-top: 1px solid var(--line-soft);
}
.axis h3 {                          /* 섹션 라벨 — Grapix Caption 12 SemiBold */
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink-45);
}
.axis p {                           /* Grapix Body 14 · 150% */
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink-70);
}

.axis-body p {
  margin: 0 0 8px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink-70);
}
.axis-body p:last-child { margin-bottom: 0; }
.bullet-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 7px;
}
.bullet-list li {
  position: relative;
  padding-left: 13px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink-70);
}
.bullet-list li::before {
  content: '';
  position: absolute;
  left: 2px;
  top: 0.64em;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--ink-25);
}
.axis-note {
  margin: 10px 0 0;
  padding-top: 9px;
  border-top: 1px dashed var(--line-soft);
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-45);
}
.axis-note[hidden] { display: none; }
#resultCareerTags { margin-bottom: 10px; }

.chip-list, .famous-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chip-list li {                     /* Grapix Tag — 500 13px · 라운드 4 · 회색 바탕 */
  padding: 2px 8px;
  border-radius: var(--gx-radius-4);
  background: var(--bg-2);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.5;
  color: var(--gx-secondary-black);
}
/* 같은 일주 연예인 — 이름 + 소속을 칩으로 */
.famous-list { gap: 6px; }
.famous-list li {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  padding: 6px 14px;
  border: 1px solid var(--gx-border);
  border-radius: var(--gx-radius-full);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.5;
}
.famous-list b { font-weight: 600; color: var(--ink); }
.famous-list span { color: var(--ink-45); font-size: 12px; }

.result-note {
  margin: 16px auto 0;
  max-width: 440px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-45);
}
.result-note span { display: block; }
.result-note span + span { margin-top: 5px; }
.result-note[hidden] { display: none; }

/* 풀이 진입/퇴출 — 퇴출은 진입의 약 75% 속도 */
/* .result 는 translateX(-50%) 로 가운데 정렬돼 있으므로 퇴장에도 그대로 둔다 (빼면 옆으로 미끄러진다) */
@keyframes leave-down { to { opacity: 0; transform: translateX(-50%) translateY(6px); } }
.result.is-leaving {
  animation: leave-down var(--dur-exit) var(--ease-in) forwards;
  pointer-events: none;
}
.result-detail .axis { animation: rise-plain 260ms var(--ease-out-quint) backwards; }
/* 보이는 섹션 순서(--i, JS 가 setDetailView 에서 매긴다)대로 30ms 간격, 최대 300ms */
.result-detail .axis { animation-delay: min(calc(60ms + var(--i, 0) * 30ms), 300ms); }

/* 간단 → 상세: 새로 드러나는 항목만 등장 (지연은 JS 가 --enter-delay 로 준다) */
@keyframes detail-in {
  from { opacity: 0; transform: translateY(6px); filter: blur(4px); }
}
.result .detail-only.is-entering {
  animation: detail-in 260ms var(--ease-out-quint) backwards;
  animation-delay: var(--enter-delay, 0ms);
}
/* 상세 → 간단: 사라질 항목을 먼저 흐리게 뺀 뒤 접는다 */
.result .detail-only {
  transition: opacity 120ms var(--ease-in);
}
.result.is-collapsing .detail-only {
  opacity: 0;
  pointer-events: none;
}

/* ---------------- Buttons ---------------- */
/* 입력부와 좌우 끝을 맞춘 CTA */
.entry .btn-primary {
  width: 100%;
  margin-top: 10px;
}
.entry .form-error { text-align: center; }
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 50px;
  padding: 0 24px;
  border: 1px solid var(--brand);
  border-radius: var(--radius-ui);
  background: var(--brand);
  color: var(--gx-white);
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0;
  cursor: pointer;
  transition: background var(--dur-hover) var(--gx-ease), border-color var(--dur-hover) var(--gx-ease),
              transform var(--dur-hover) var(--gx-ease), opacity var(--dur-hover) var(--gx-ease);
}
/* Grapix: hover 는 한 톤 밝은 검정, press 는 살짝 작아지고 옅어진다 (색이 번쩍이지 않게) */
.btn-primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn-primary:active { transform: scale(0.98); opacity: 0.85; }
.btn-primary:disabled { opacity: 0.4; cursor: default; transform: none; }

.btn-ghost {                        /* Grapix Button — Tertiary */
  margin-top: 26px;
  height: 44px;
  padding: 0 20px;
  border: 1px solid var(--gx-border);
  border-radius: var(--radius-ui);
  background: transparent;
  color: var(--brand);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--dur-hover) var(--gx-ease), border-color var(--dur-hover) var(--gx-ease),
              transform var(--dur-hover) var(--gx-ease);
}
.btn-ghost:hover { background: var(--gx-gray-50); border-color: var(--line-strong); }
.btn-ghost:active { transform: scale(0.98); }

/* 풀이 마지막 — 저장 / 공유 (같은 폭 두 칸), 그 아래 '다시 찾아보기' 는 텍스트 버튼 */
.result-actions {
  display: flex;
  gap: 8px;
  margin: 28px auto 0;
  max-width: 440px;
}
.result-actions > button {
  flex: 1 1 0;
  min-width: 0;
  margin: 0;
  height: 48px;
  padding: 0 12px;
  gap: 6px;
  font-size: 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}
.btn-ghost.btn-text {
  margin-top: 12px;
  border-color: transparent;
  color: var(--ink-70);
  font-weight: 500;
}
.btn-ghost.btn-text:hover { background: var(--gx-gray-50); border-color: transparent; color: var(--ink); }

/* 짧은 알림 (링크 복사 등) */
.toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  z-index: 1000;
  margin: 0;
  padding: 10px 16px;
  border-radius: var(--gx-radius-full);
  background: var(--gx-primary-black);
  color: var(--gx-white);
  font-size: 14px;
  font-weight: 500;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, 8px);
  transition: opacity var(--dur-exit) var(--ease-in), transform var(--dur-exit) var(--ease-in);
}
.toast.is-shown {
  opacity: 1;
  transform: translate(-50%, 0);
  transition: opacity var(--dur-enter) var(--ease-out-quint), transform var(--dur-enter) var(--ease-out-quint);
}

:where(button, input, a):focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
}
/* 날짜 칸·검색 입력은 컨테이너(.seg-wrap / .search-box) 가 포커스 표시를 대신한다 (사각 아웃라인이 pill 을 깨뜨려서) */
.seg:focus-visible,
.search-input:focus-visible { outline: none; }

.drag-hint {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  margin: 0;
  z-index: 750;
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-45);
  transition: opacity var(--dur-fade) var(--ease-out-cubic);
  pointer-events: none;
  opacity: 0;
}
.drag-hint.is-visible { opacity: 1; }

.privacy-link {
  position: fixed;
  right: 16px;
  bottom: 14px;
  z-index: 1000;
  padding: 6px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink-45);
  font-size: 11px;
  text-decoration: none;
}
.privacy-link:hover { color: var(--ink); text-decoration: underline; }

/* GNB 원형 버튼 — 좌: 자동 회전 일시정지 (WCAG 2.2.2 — 스스로 움직이는 콘텐츠는 멈출 수 있어야 한다)
                  우: 일주 이름 검색 */
.spin-toggle,
.search-toggle,
.gnb-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--gx-radius-full);
  background: var(--bg);
  color: var(--ink-70);
  cursor: pointer;
  transition: color var(--dur-hover) var(--gx-ease), border-color var(--dur-hover) var(--gx-ease),
              transform var(--dur-hover) var(--gx-ease), opacity var(--dur-fade) var(--ease-out-cubic);
}
.spin-toggle:hover,
.search-toggle:hover,
.gnb-back:hover { color: var(--ink); border-color: var(--line-strong); }
.spin-toggle:active,
.search-toggle:active,
.gnb-back:active { transform: scale(0.98); }
.gnb-back { color: var(--brand); }
.gnb-back[hidden] { display: none; }
.gnb-back:not([hidden]) { animation: fade-in var(--dur-enter) var(--ease-out-cubic); }
.spin-toggle .icon-play { display: none; }
.spin-toggle[aria-pressed='true'] .icon-pause { display: none; }
.spin-toggle[aria-pressed='true'] .icon-play { display: block; }
.spin-toggle.is-hidden,
.search-toggle.is-hidden { opacity: 0; pointer-events: none; }
.search-toggle .icon-close { display: none; }
.search-toggle[aria-expanded='true'] { color: var(--ink); }
.search-toggle[aria-expanded='true'] .icon-search { display: none; }
.search-toggle[aria-expanded='true'] .icon-close { display: block; }
.spin-toggle[hidden] { display: none; }

/* ---------------- Responsive ----------------
   가로 브레이크포인트는 두지 않는다 — 크기·간격은 clamp() 로 화면 폭에 따라 연속으로 바뀌고,
   궤도 곡률·카드 크기·세로 배치는 app.js 의 measure() 가 같은 방식으로 이어서 계산한다. */
@media (max-height: 700px) {
  .result-desc { font-size: 13px; }
  .btn-ghost { margin-top: 18px; }
}

/* ---------------- Reduced motion ---------------- */
@media (prefers-reduced-motion: reduce) {
  .card-holo::before { animation: none; }
  *, *::before, *::after {
    animation-duration: 1ms !important;
    animation-delay: 0ms !important;
    transition-duration: 1ms !important;
  }
  .card.is-focused { transition: transform 1ms linear; }
}
