/* ─────────────────────────────────────────── 토큰 */
:root {
  /* 종이는 일러스트의 흰색(#f1f5f8)과 같은 방향으로 기울인다.
     예전 중성색은 전부 H36~50(노란 크림)이었는데 그림과 하늘은 H202~206 이라,
     색상환에서 거의 반대였다. 그래서 하늘 판을 얹으면 크림이 누렇게 뜨고
     하늘은 더 차갑게 튀었다. 채도를 아주 낮게 둬서 회색이 아니라 종이로 읽힌다. */
  --bg: #f0f3f5;
  --surface: #fbfdfe;
  --surface-2: #eaeef0;
  --border: #d6dde1;
  --border-strong: #bdc6cb;

  /* 세 단계가 눈에 구분되면서 배경 위에서도 4.5:1 을 넘도록 잡았다 */
  --text: #1e262a;
  --text-2: #4a5458;
  --text-3: #677074;

  /* 강조색은 전부 일러스트에서 뽑았다. 색조·채도는 그림 그대로 두고
     명도만 옮겨 대비를 맞췄다. 괄호 안이 그림에서의 출처다. */
  --accent: #3770a1;    /* 돈의 셔츠 파랑 — 원색 그대로 5.15:1 */
  --a: #3770a1;         /* 돈 */
  --b: #b15055;         /* 줄리의 분홍 멜빵(#dc7a7f)을 글자용으로 낮춘 값 */
  --ok: #4e7672;        /* 청록 바지 #5e8d88 */
  --warn: #876943;      /* 강아지 황갈색 #b39167 */
  --bad: #c0443e;
  --coral: #d9737a;     /* 멜빵 원색에 가깝게 — 큰 글자에만 쓴다 */
  --cream: #f2ece2;     /* 차가운 종이에 맞세우는 따뜻한 모래. 잠금 화면 배경 */

  /* 관계의 단계. 새로 고른 색이 하나도 없다 — 이미 그림에서 뽑아 명도를 맞춰 둔
     네 색을 차가운 쪽에서 따뜻한 쪽으로 늘어놓은 것이다.
     H200 슬레이트 → H208 파랑 → H34 황갈 → H357 장미. 색상환을 한 방향으로만
     돌기 때문에 순서 자체가 진행으로 읽힌다. 값이 같아도 이름을 따로 두는 것은
     나중에 단계 색만 따로 손볼 수 있게 하기 위해서다.
     라이트·다크 × 표면·배경 여덟 경우 모두 4.5:1 을 넘긴다 (최저 4.54). */
  --ph-1: #55707d;      /* = --sky-ink-2 · 하늘의 잉크. 아직 배경에 가까운 사이 */
  --ph-2: #3770a1;      /* = --accent    · 돈의 셔츠 파랑 */
  --ph-3: #876943;      /* = --warn      · 강아지 황갈 */
  --ph-4: #b15055;      /* = --b         · 줄리의 멜빵 코랄 */

  /* 하늘색은 일러스트에서 직접 뽑은 값이다 (tools/cutout.py 참고).
     그림의 배경을 CSS 로 똑같이 다시 그려야, 배경을 벗겨낸 컷아웃 인물이
     이음매 없이 그 위에 올라간다. 값을 바꾸면 그림과 어긋난다. */
  --sky-lo: #b3ddf3;    /* 위·아래 가장자리 */
  --sky-mid: #cce9fa;
  --sky-hi: #def1f8;    /* 그림 한가운데의 밝은 부분 */
  --sky-ink: #1f3742;   /* 하늘 위에 얹는 글자 */
  --sky-ink-2: #55707d;
  --sky-field: linear-gradient(180deg,
    var(--sky-lo), var(--sky-mid) 30%, var(--sky-hi) 52%, var(--sky-mid) 74%, var(--sky-lo));

  --btn-ink: #fff;      /* 강조색 위에 얹는 글자 */
  --radius: 12px;
  /* 그림자도 차갑게. 따뜻한 검정은 파란 표면 위에서 탁하게 번진다 */
  --shadow: 0 1px 2px rgba(22, 38, 46, .05), 0 1px 8px rgba(22, 38, 46, .05);

  /* 간격 척도. 화면마다 임의의 숫자를 쓰지 않기 위해 여기서만 정한다. */
  --gap: 16px;      /* 카드 사이 */
  --gap-lg: 28px;   /* 문단·섹션 사이 */
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141b1f;
    --surface: #1b2328;
    --surface-2: #242d32;
    --border: #2f393f;
    --border-strong: #435057;
    --text: #edf1f3;
    --text-2: #b2bcc0;
    --text-3: #8b969b;
    /* 어두운 표면 위에서는 같은 색조를 밝은 쪽으로 옮긴다 */
    --accent: #76aed6;
    --a: #76aed6;
    --b: #dc7a7f;         /* 여기서는 멜빵 원색이 그대로 5.4:1 이라 낮출 필요가 없다 */
    --ok: #6fa8a2;
    --warn: #c3a074;
    --bad: #d9827d;
    --coral: #dc7a7f;
    --cream: #2b2823;
    --ph-1: #a4bdc9; --ph-2: #76aed6; --ph-3: #c3a074; --ph-4: #dc7a7f;
    --sky-lo: #16242d; --sky-mid: #1f3441; --sky-hi: #294654;
    --sky-ink: #e6f1f6; --sky-ink-2: #a4bdc9;
    --btn-ink: #141b1f;   /* 밝아진 강조색 위에 흰 글자를 얹으면 2.4:1 이다 */
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
  }
}

:root[data-theme="dark"] {
  --bg: #141b1f; --surface: #1b2328; --surface-2: #242d32;
  --border: #2f393f; --border-strong: #435057;
  --text: #edf1f3; --text-2: #b2bcc0; --text-3: #8b969b;
  --accent: #76aed6; --a: #76aed6; --b: #dc7a7f;
  --ok: #6fa8a2; --warn: #c3a074; --bad: #d9827d;
  --coral: #dc7a7f; --cream: #2b2823;
  --ph-1: #a4bdc9; --ph-2: #76aed6; --ph-3: #c3a074; --ph-4: #dc7a7f;
  --sky-lo: #16242d; --sky-mid: #1f3441; --sky-hi: #294654;
  --sky-ink: #e6f1f6; --sky-ink-2: #a4bdc9;
  --btn-ink: #141b1f;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background:
    radial-gradient(circle at 12% -10%, color-mix(in srgb, var(--sky-mid) 35%, transparent), transparent 32rem),
    var(--bg);
  color: var(--text);
  font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont,
    "Apple SD Gothic Neo", "Segoe UI", "Noto Sans KR", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { line-height: 1.35; letter-spacing: -.015em; margin: 0; font-weight: 650; }
a { color: var(--accent); }
[hidden] { display: none !important; }

/* ─────────────────────────────────────────── 레이아웃 */
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 24px; }

header.top {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.top .wrap { display: flex; align-items: center; gap: 16px; height: 56px; }
.top .wrap:last-child { position: relative; }   /* 접힌 메뉴가 여기에 걸린다 */
.brand { display: flex; align-items: center; font-weight: 680; letter-spacing: -.02em; font-size: 15px; }
.brand > img {
  width: 30px; height: 30px; object-fit: cover; object-position: center;
  border-radius: 50%; margin-right: 9px;
  border: 1px solid color-mix(in srgb, var(--sky-lo) 62%, var(--border));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--sky-lo) 22%, transparent);
}
.brand small { color: var(--text-3); font-weight: 450; margin-left: 8px; letter-spacing: 0; }
.top .spacer { flex: 1; }

nav.tabs { display: flex; gap: 2px; overflow-x: auto; border-bottom: 1px solid var(--border); }
nav.tabs button {
  appearance: none; background: none; border: 0; cursor: pointer;
  padding: 11px 14px; font: inherit; font-size: 14px; color: var(--text-3);
  border-bottom: 2px solid transparent; white-space: nowrap;
}
nav.tabs button:hover { color: var(--text); }
nav.tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }

/* 아직 지키지 않은 약속의 수. 화면에서 유일하게 빨간 숫자다 — 그래서 눈에 띈다.
   다른 데에 빨간 알약을 더하면 이것도 같이 배경이 된다. */
nav.tabs button { display: inline-flex; align-items: center; gap: 6px; }
.tab-badge {
  display: inline-grid; place-items: center; min-width: 18px; height: 18px;
  padding: 0 5px; border-radius: 999px;
  background: var(--bad); color: #fff;
  font-size: 10.5px; font-weight: 700; line-height: 1;
  font-variant-numeric: tabular-nums; letter-spacing: 0;
}

/* 통계 탭들은 지우지 않고 접어 둔다. nav 가 overflow-x:auto 라 메뉴를 그 안에
   넣으면 잘리기 때문에, 형제로 두고 .top .wrap 을 기준으로 띄운다. */
.tab-more {
  appearance: none; background: none; border: 0; cursor: pointer; font: inherit;
  font-size: 14px; color: var(--text-3); padding: 11px 14px;
  border-bottom: 2px solid transparent; white-space: nowrap; flex: none;
}
.tab-more:hover { color: var(--text); }
.tab-more.on { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.tab-more-menu {
  position: absolute; right: 0; top: calc(100% - 4px); z-index: 30;
  display: flex; flex-direction: column; gap: 2px; padding: 7px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 12px 32px rgba(22, 38, 46, .14);
}
.tab-more-menu button {
  appearance: none; background: none; border: 0; cursor: pointer; font: inherit;
  font-size: 13.5px; color: var(--text-2); text-align: left;
  padding: 8px 14px; border-radius: 7px; white-space: nowrap;
}
.tab-more-menu button:hover { background: var(--surface-2); color: var(--text); }
.tab-more-menu button[aria-selected="true"] { color: var(--accent); font-weight: 640; }

main { padding: 32px 0 120px; }
section.view { display: none; }

/* 수직 리듬은 여기 한 곳에서만 만든다.
   예전에는 `.card + .card` 로만 간격을 줘서, 통계 그리드 다음에 오는 카드나
   설명 문단 다음에 오는 그리드처럼 종류가 다른 블록끼리는 간격이 0이 됐다. */
section.view.active { display: flex; flex-direction: column; gap: var(--gap); }

/* 좌우로 쓸어 탭을 옮겼을 때. 손짓이 먹었는지 아닌지 화면이 알려줘야 한다.
   가로로 넘치면 스와이프 도중 몸통이 흔들려 보이므로 그동안만 잘라 둔다. */
@media (prefers-reduced-motion: no-preference) {
  section.view.slide-l, section.view.slide-r { animation: viewSlide .24s cubic-bezier(.2, .7, .2, 1) both; }
  section.view.slide-r { animation-name: viewSlideBack; }
}
@keyframes viewSlide { from { opacity: .35; transform: translateX(16px); } to { opacity: 1; transform: none; } }
@keyframes viewSlideBack { from { opacity: .35; transform: translateX(-16px); } to { opacity: 1; transform: none; } }
main { overflow-x: clip; }
section.view > .intro { margin: 0 0 calc(var(--gap-lg) - var(--gap)); }
section.view > .section-gap { margin-top: calc(var(--gap-lg) - var(--gap)); }

/* ─────────────────────────────────────────── 요소 */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px 24px; box-shadow: var(--shadow);
  transition: border-color .2s ease, box-shadow .2s ease;
}
.card > h3 { font-size: 15.5px; margin-bottom: 3px; }
.card > .sub { color: var(--text-3); font-size: 13px; margin-bottom: 18px; line-height: 1.55; }
.card > .sub:last-child { margin-bottom: 0; }

/* 개요 — 일러스트의 색과 데이터 화면을 잇는 편집형 커버.

   배경을 구워 넣은 그림 대신, 하늘은 CSS 로 그리고 인물은 배경을 벗긴
   컷아웃을 얹는다. 그래서 사각형 이음매가 없고, 다크 모드와 반응형이
   그림 파일을 새로 만들지 않고도 따라온다. */
.story-cover {
  position: relative; overflow: hidden; isolation: isolate;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .68fr);
  align-items: center; column-gap: clamp(16px, 3vw, 40px);
  min-height: 320px;
  padding: clamp(30px, 5vw, 56px) clamp(30px, 5vw, 56px) 0;
  border: 1px solid color-mix(in srgb, var(--sky-lo) 42%, var(--border));
  border-radius: 20px;
  box-shadow: var(--shadow);
  /* 왼쪽은 크림, 오른쪽으로 갈수록 하늘. 인물 뒤에는 그림이 원래 갖고 있던
     가운데 발광을 그대로 깔아, 컷아웃 경계가 어디인지 보이지 않게 한다. */
  background:
    radial-gradient(64% 88% at 76% 104%,
      color-mix(in srgb, var(--sky-hi) 82%, #fff), transparent 66%),
    linear-gradient(97deg,
      var(--surface) 0%,
      color-mix(in srgb, var(--sky-mid) 26%, var(--surface)) 40%,
      var(--sky-mid) 78%,
      var(--sky-lo) 100%);
}
.story-copy { align-self: center; padding-bottom: clamp(30px, 5vw, 56px); max-width: 520px; color: var(--sky-ink); }
.story-kicker {
  display: block; margin-bottom: 15px; color: color-mix(in srgb, var(--accent) 86%, var(--sky-ink));
  font-size: 10px; line-height: 1.4; font-weight: 750; letter-spacing: .17em; text-transform: uppercase;
}
.story-copy h2 {
  max-width: 440px; white-space: pre-line;
  font-family: "Iowan Old Style", "AppleMyungjo", Georgia, serif;
  font-size: clamp(28px, 4vw, 43px); line-height: 1.2; letter-spacing: -.045em; font-weight: 650;
}
.story-copy p { margin: 13px 0 0; color: var(--sky-ink-2); font-size: 12.5px; font-variant-numeric: tabular-nums; }

/* 디데이 — 커버에서 숫자가 먼저 읽혀야 한다. 제목과 다투지 않게
   제목보다 작게 두되, 본문 글씨보다는 확실히 크게. */
.dday {
  display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 9px;
  margin-top: 18px; padding-top: 15px;
  border-top: 1px solid color-mix(in srgb, var(--sky-ink) 16%, transparent);
}
.dday-label { font-size: 11px; font-weight: 700; letter-spacing: .12em; color: var(--sky-ink-2); text-transform: uppercase; }
.dday-num {
  font-family: "Iowan Old Style", "AppleMyungjo", Georgia, serif;
  font-size: 30px; line-height: 1; letter-spacing: -.03em; font-weight: 650;
  color: var(--sky-ink); font-variant-numeric: tabular-nums;
}
.dday-num em { font-style: normal; font-size: 16px; margin-left: 2px; font-weight: 600; }
.dday-foot { flex: 1 0 100%; margin-top: 3px; font-size: 12px; color: var(--sky-ink-2); font-variant-numeric: tabular-nums; }
.dday-foot i { font-style: normal; }
/* 가운뎃점은 글이 아니라 구분이다. 내용에 넣지 않고 여기서 그린다. */
.dday-foot i::before { content: '·'; margin: 0 6px; opacity: .55; }

/* 헤더의 디데이 — 어느 탭에서나 보이는 자리 */
.dday-chip {
  font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.dday-chip::before { content: '♥'; margin-right: 4px; font-size: 10px; opacity: .75; }
.brand-range::before { content: '·'; margin: 0 6px; opacity: .5; }

/* 인물은 커버 아래 모서리에 서서 잘린다. 띄워 놓으면 붙여넣은 것처럼 보인다. */
.story-figure { align-self: end; justify-self: end; line-height: 0; }
.story-figure img {
  display: block; width: 100%; max-width: 240px; height: auto;
  filter: drop-shadow(0 20px 30px rgba(26, 74, 98, .20));
}

/* 다크 모드에서 인물만 밝게 남으면 어두운 화면 위에 붙인 스티커가 된다.
   밝기를 낮추고, 그 위에 실루엣 모양으로 오려낸 남색 그늘을 덮어 같은
   빛 아래 있는 것처럼 만든다. 덮개는 컷아웃 자신을 마스크로 쓴다. */
.sky-figure-tint { position: relative; }
.sky-figure-tint::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--sky-lo) 16%, transparent),
    color-mix(in srgb, var(--sky-lo) 56%, transparent));
  -webkit-mask: url('./brand/hero-cutout.webp') no-repeat;
  mask: url('./brand/hero-cutout.webp') no-repeat;
  opacity: 0;
}
.story-figure::after { -webkit-mask-size: 100% 100%; mask-size: 100% 100%; }
.gate-figure::after {
  -webkit-mask-position: 68% 100%; -webkit-mask-size: contain;
  mask-position: 68% 100%; mask-size: contain;
}

:root[data-theme="dark"] .sky-figure-tint::after { opacity: 1; }
:root[data-theme="dark"] .sky-figure-tint img { filter: brightness(.84) saturate(.8) drop-shadow(0 20px 32px rgba(0, 0, 0, .55)); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .sky-figure-tint::after { opacity: 1; }
  :root:not([data-theme="light"]) .sky-figure-tint img { filter: brightness(.84) saturate(.8) drop-shadow(0 20px 32px rgba(0, 0, 0, .55)); }
}

@media (max-width: 720px) {
  .story-cover {
    grid-template-columns: minmax(0, 1fr) minmax(0, .52fr);
    min-height: 260px; column-gap: 12px;
    background:
      radial-gradient(72% 74% at 82% 108%,
        color-mix(in srgb, var(--sky-hi) 82%, #fff), transparent 68%),
      linear-gradient(102deg,
        var(--surface) 0%,
        color-mix(in srgb, var(--sky-mid) 30%, var(--surface)) 34%,
        var(--sky-mid) 82%,
        var(--sky-lo) 100%);
  }
  .story-copy h2 { font-size: clamp(24px, 6.6vw, 31px); }
  .story-figure img { max-width: 190px; }
  .dday { margin-top: 14px; padding-top: 12px; }
  .dday-num { font-size: 26px; }
}

/* ── 기록 뷰 ─────────────────────────────────────────
   하루가 카드 하나. 왼쪽 레일이 그날의 단계 색이라, 아래로 내려가면
   차가운 쪽에서 따뜻한 쪽으로 옮겨가는 것이 보인다. */
.day-card, .phase-card { border-left: 3px solid var(--phase, var(--border-strong)); }

.hist-intro p { margin: 0; font-size: 14.5px; line-height: 1.8; color: var(--text-2); }

.ribbon { display: flex; gap: 3px; margin-top: 4px; }
.ribbon-seg {
  appearance: none; cursor: pointer; font: inherit; text-align: left;
  flex: 1; min-width: 0; padding: 9px 10px; border: 0; border-radius: 8px;
  background: color-mix(in srgb, var(--phase) 13%, var(--surface));
  border-top: 3px solid var(--phase); color: var(--text-2);
  transition: background .15s ease;
}
.ribbon-seg:hover { background: color-mix(in srgb, var(--phase) 22%, var(--surface)); }
.ribbon-seg span { display: block; font-size: 11.5px; font-weight: 660; color: var(--phase); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ribbon-seg i { font-style: normal; font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; }

.phase-card { background: color-mix(in srgb, var(--phase) 5%, var(--surface)); scroll-margin-top: 116px; }
.phase-card h3 {
  font-family: "Iowan Old Style", "AppleMyungjo", Georgia, serif;
  font-size: 24px; letter-spacing: -.03em; margin: 8px 0 0;
}
.phase-note { margin: 10px 0 0; font-size: 13px; line-height: 1.75; color: var(--text-2); }
/* 설명과 이동 버튼이 한 줄에 붙어 보이지 않게. 좁아지면 버튼이 아래로 내려간다. */
.phase-quote { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 11px; }
.phase-quote .cite { margin-top: 0; }
.phase-quote .small { flex: 1 1 auto; min-width: 0; }

.tag.phase-tag { color: var(--phase); }
.tag.mark { color: var(--text-2); }
.tag.mark::before { background: var(--phase); }
/* 누가 쓴 글인지 밝힌다. 사람이 쓴 것과 모델이 쓴 것을 섞어 놓지 않는다. */
.tag.by { color: var(--accent); }
.tag.by.gpt { color: var(--text-3); }

.day-card-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.day-card-date { font-size: 12.5px; font-weight: 650; color: var(--text-2); font-variant-numeric: tabular-nums; }
.day-mood { font-size: 12px; color: var(--text-3); margin-left: auto; white-space: nowrap; }
.day-title {
  font-family: "Iowan Old Style", "AppleMyungjo", Georgia, serif;
  font-size: 20px; letter-spacing: -.03em; margin: 9px 0 0;
}
.authored { margin-top: 13px; }
.authored p { margin: 6px 0 0; font-size: 14px; line-height: 1.8; color: var(--text-2); }
/* 분석 탭 위의 읽기 카드. 표 사이에 끼는 글이라 카드 안에서는 위 여백을 접는다. */
.card.reading > .authored { margin-top: 0; }
.card.reading .phase-quote { margin-top: 12px; }
/* 프로필 — 인용도 숫자도 없는 화면이라 활자만 남는다. 단계 제목과 같은
   세리프를 본문까지 끌고 와서, 분석 화면이 아니라 책장처럼 읽히게 한다. */
/* 얼굴 — 일러스트에서 꺼낸 두 사람. 그림은 인물만이고 하늘은 여기서 그린다.
   그래야 다크 모드에서 파란 원이 혼자 떠 있지 않는다(컷아웃 규칙과 같다). */
.face {
  display: block; flex: none; position: relative; overflow: hidden;
  border-radius: 50%; background: var(--sky-field);
  box-shadow: 0 2px 10px rgba(20, 40, 60, .1), inset 0 0 0 1px color-mix(in srgb, var(--sky-lo) 60%, transparent);
}
.face img { width: 100%; height: 100%; object-fit: cover; display: block; }
.face-lg { width: 112px; height: 112px; }
.face-sm { width: 60px; height: 60px; }

/* 다크에서는 밝기만 낮추면 어두운 화면에 붙인 스티커처럼 보인다. 그림 위에
   같은 하늘색 그늘을 덮어 화면에 앉힌다 — .sky-figure-tint 와 같은 처리다. */
:root[data-theme="dark"] .face img,
:root[data-theme="dark"] .face-pick .face img { filter: brightness(.86) saturate(.82); }
:root[data-theme="dark"] .face { box-shadow: 0 2px 10px rgba(0, 0, 0, .4), inset 0 0 0 1px color-mix(in srgb, var(--sky-hi) 40%, transparent); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .face img { filter: brightness(.86) saturate(.82); }
  :root:not([data-theme="light"]) .face { box-shadow: 0 2px 10px rgba(0, 0, 0, .4), inset 0 0 0 1px color-mix(in srgb, var(--sky-hi) 40%, transparent); }
}

/* 사람 고르기 — 이름 알약 대신 얼굴 둘 */
.face-card { padding-bottom: 18px; }
.face-picker { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.face-pick {
  appearance: none; font: inherit; cursor: pointer;
  display: flex; align-items: center; gap: 11px; padding: 7px 16px 7px 7px;
  border-radius: 999px; background: var(--surface); border: 1px solid var(--border);
  transition: border-color .15s ease, background .15s ease;
}
.face-pick:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.face-pick-name { font-size: 14.5px; font-weight: 560; color: var(--text-2); letter-spacing: -.01em; }
.face-pick[aria-selected="true"] {
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
  border-color: color-mix(in srgb, var(--accent) 52%, var(--border));
}
.face-pick[aria-selected="true"] .face-pick-name { color: var(--accent); font-weight: 640; }
.face-pick[aria-selected="true"] .face { box-shadow: 0 0 0 2px var(--accent); }

/* 인물 머리 — 얼굴 옆에 이름과 한 줄 */
.profile-top { display: flex; align-items: center; gap: 18px; }
.profile-top .profile-name { margin-top: 6px; }
.profile-bio { min-width: 0; }
.profile-head.has-face .profile-prose { margin-top: 22px; }

@media (max-width: 560px) {
  .face-lg { width: 84px; height: 84px; }
  .profile-top { gap: 14px; }
  .card > h3.profile-name { font-size: 25px; }
  .face-pick { padding: 6px 13px 6px 6px; gap: 9px; }
  .face-sm { width: 48px; height: 48px; }
}

.profile-head { padding-bottom: 26px; }
/* .card > h3 보다 구체적으로 — 그렇지 않으면 15.5px 로 눌린다. */
.card > h3.profile-name {
  font-family: "Iowan Old Style", "AppleMyungjo", Georgia, serif;
  font-size: 30px; font-weight: 600; letter-spacing: -.03em; margin: 12px 0 0;
}
.aka { display: flex; gap: 6px; flex-wrap: wrap; }
.profile-line {
  margin: 8px 0 0; font-size: 14px; color: var(--text-2); letter-spacing: -.01em;
}
.profile-prose { margin-top: 16px; max-width: 62ch; }
.profile-prose p {
  font-family: "Iowan Old Style", "AppleMyungjo", Georgia, serif;
  margin: 0 0 15px; font-size: 16px; line-height: 1.95; color: var(--text-2);
  word-break: keep-all;
}
.profile-prose p:last-child { margin-bottom: 0; }
/* 첫 문단만 조금 진하게 — 인물 소개의 첫 줄이 어디인지 눈이 먼저 알게. */
.profile-head .profile-prose p:first-child { color: var(--text); }

.day-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.day-foot .cite { margin-top: 0; margin-left: auto; }
.day-card .ins-list { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 4px; }

/* 사진은 눌러야 펼쳐진다. 29일치를 한꺼번에 풀면 복호화가 감당이 안 된다. */
.photo-block { margin-top: 13px; }
.photo-strip { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.photo-cell { margin: 0; width: 150px; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); background: var(--surface-2); }
.photo-cell img { width: 100%; height: 100%; object-fit: cover; display: block; cursor: zoom-in; }
.photo-cell.big { width: 100%; max-width: 460px; }
.photo-cell.big img { cursor: zoom-out; object-fit: contain; }
.photo-cell figcaption { font-size: 11px; color: var(--text-3); padding: 5px 7px; }
/* 사진 열기도 이동과 같은 종류의 동작이라 알약 가족에 넣는다. 글리프만 다르다. */
.cite.photo::before { content: '▤'; }

/* ── 우편함 — 두 사람이 남긴 쪽지와 올린 사진 ──────────
   쪽지는 클로드의 글과 같은 .authored 모양이고 저자 태그만 사람 이름이다.
   태그 색은 줄리의 멜빵 코랄(--b) — 모델의 파랑(--accent)과 나란히 놓여도 갈린다. */
.tag.by.person { color: var(--b); }
.note-block { margin-top: 13px; }
.authored.person { position: relative; padding-right: 48px; }
.note-when { margin-left: 8px; font-variant-numeric: tabular-nums; }
.note-del {
  appearance: none; font: inherit; font-size: 11.5px; cursor: pointer;
  position: absolute; right: 0; top: 0; padding: 2px 0;
  background: none; border: 0; color: var(--text-3); text-decoration: underline dotted;
}
.note-del:hover { color: var(--text); }
/* 쪽지 쓰기도 '열기' 동작이라 알약 가족이다. 연필만 다르다. */
.cite.note::before { content: '✎'; }
.note-open { margin-top: 10px; }
.note-form { margin-top: 12px; display: flex; flex-direction: column; gap: 10px; }
.note-form textarea {
  font: inherit; font-size: 14px; line-height: 1.7; padding: 10px 12px; resize: vertical;
  border: 1px solid var(--border-strong); border-radius: 8px;
  background: var(--surface); color: var(--text); width: 100%; min-height: 84px;
}
.note-form textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.note-form-foot { display: flex; align-items: center; gap: 12px; }
.note-form-foot .btn { margin-left: auto; }
.pills.who button { padding: 5px 12px; font-size: 13px; }

.upload-list { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.upload-row {
  display: grid; grid-template-columns: 96px 1fr auto; gap: 12px; align-items: start;
  padding: 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2);
}
.upload-row img { width: 96px; height: 96px; object-fit: cover; border-radius: 6px; display: block; }
.upload-fields { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.upload-fields input[type="date"] {
  font: inherit; font-size: 14px; padding: 7px 10px; width: fit-content;
  border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); color: var(--text);
}
.upload-row .note-del { position: static; align-self: start; }
.upload-foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.upload-who { font-size: 12px; color: var(--text-3); }
.upload-foot .btn { margin-left: auto; }
@media (max-width: 560px) {
  .upload-row { grid-template-columns: 72px 1fr auto; }
  .upload-row img { width: 72px; height: 72px; }
}

@media (max-width: 560px) {
  .ribbon-seg { padding: 8px 7px; }
  .ribbon-seg i { display: none; }
  .photo-cell { width: calc(50% - 4px); }
}

.grid { display: grid; gap: var(--gap); }
.grid.c2 { grid-template-columns: repeat(2, 1fr); }
.grid.c3 { grid-template-columns: repeat(3, 1fr); }
.grid.c4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 820px) { .grid.c3, .grid.c4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .grid.c2, .grid.c3, .grid.c4 { grid-template-columns: 1fr; } }

.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }
.stat .label { font-size: 12px; color: var(--text-3); letter-spacing: .01em; }
.stat .value { font-size: 26px; font-weight: 660; letter-spacing: -.03em; margin-top: 3px; font-variant-numeric: tabular-nums; }
.stat .foot { font-size: 12px; color: var(--text-3); margin-top: 2px; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); }
th { color: var(--text-3); font-weight: 550; font-size: 12.5px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:last-child td { border-bottom: 0; }

.scroll-x { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }

.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--border); stroke-width: 1; }
.chart .axis { fill: var(--text-3); font-size: 10.5px; }
.chart .rowlabel { fill: var(--text-2); font-size: 12px; }
.chart .s0 { fill: var(--a); }
.chart .s1 { fill: var(--b); }
.chart .line.s0 { stroke: var(--a); stroke-width: 2; fill: none; }
.chart .line.s1 { stroke: var(--b); stroke-width: 2; fill: none; }
.chart .dot.s0 { fill: var(--a); }
.chart .dot.s1 { fill: var(--b); }
.chart .area.s0 { fill: var(--a); opacity: .1; stroke: none; }
.chart .area.s1 { fill: var(--b); opacity: .1; stroke: none; }
.chart .heat { fill: var(--accent); }

.legend { display: flex; gap: 16px; font-size: 13px; color: var(--text-2); margin-top: 12px; flex-wrap: wrap; }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 6px; }
.legend .s0 i { background: var(--a); }
.legend .s1 i { background: var(--b); }

.splitbar { display: flex; height: 8px; border-radius: 999px; overflow: hidden; background: var(--surface-2); }
.splitbar .bar.s0 { background: var(--a); }
.splitbar .bar.s1 { background: var(--b); }

/* 스코어카드 */
.score { border-left: 3px solid var(--border-strong); }
.score.high { border-left-color: var(--ok); }
.score.mid { border-left-color: var(--warn); }
.score.low { border-left-color: var(--bad); }
.score .head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.score .big { font-size: 24px; font-weight: 660; letter-spacing: -.03em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.score .theory { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.score .bench { font-size: 12.5px; color: var(--text-2); background: var(--surface-2); border-radius: 6px; padding: 8px 10px; margin-top: 12px; }
.score .note { font-size: 13px; color: var(--text-2); margin-top: 10px; }

/* 타임라인 */
.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ''; position: absolute; left: 5px; top: 6px; bottom: 6px; width: 1px; background: var(--border); }
.tl-item { position: relative; padding: 0 0 22px 4px; }
/* 점 색은 그 날이 속한 단계에서 온다. renderTimeline 이 항목마다 --phase 를 얹는다. */
.tl-item::before { content: ''; position: absolute; left: -21px; top: 7px; width: 9px; height: 9px; border-radius: 50%; background: var(--phase, var(--accent)); border: 2px solid var(--bg); }
.tl-date { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.tl-label { font-weight: 620; font-size: 14.5px; margin-top: 1px; }
.tl-note { font-size: 13px; color: var(--text-2); }
.tl-quote { margin-top: 7px; font-size: 13.5px; color: var(--text-2); border-left: 2px solid var(--border-strong); padding: 2px 0 2px 11px; white-space: pre-wrap; }
.tl-quote b { color: var(--text); font-weight: 600; }
.tl-quote.mono {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 11.5px; line-height: 1.5;
}

/* 드롭존 */
.drop {
  border: 1.5px dashed var(--border-strong); border-radius: 12px;
  padding: 40px 24px; text-align: center; color: var(--text-2);
  background: var(--surface); transition: border-color .15s, background .15s;
}
.drop.over { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, var(--surface)); }
.drop strong { display: block; color: var(--text); font-size: 15px; margin-bottom: 4px; }

button.btn {
  appearance: none; font: inherit; font-size: 14px; cursor: pointer;
  background: var(--accent); color: var(--btn-ink); border: 0;
  border-radius: 8px; padding: 9px 15px; font-weight: 620;
  transition: transform .15s ease, filter .15s ease, opacity .15s ease;
}
button.btn:hover:not(:disabled) { filter: brightness(1.06); }
button.btn:active:not(:disabled) { transform: translateY(1px); }
button.btn.ghost { background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); }
button.btn:disabled { opacity: .5; cursor: default; }

input[type="password"], input[type="text"], select {
  font: inherit; font-size: 14px; padding: 9px 12px;
  border: 1px solid var(--border-strong); border-radius: 8px;
  background: var(--surface); color: var(--text); width: 100%;
}
input:focus, select:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* 잠금 화면 */
.gate {
  min-height: 100dvh; display: grid; place-items: center;
  padding: clamp(20px, 4vw, 56px);
  background:
    radial-gradient(circle at 6% 4%, color-mix(in srgb, var(--sky-mid) 70%, transparent), transparent 36rem),
    radial-gradient(circle at 96% 96%, color-mix(in srgb, var(--cream) 78%, transparent), transparent 34rem),
    var(--bg);
}
.gate-shell {
  width: min(1160px, 100%); min-height: min(760px, calc(100dvh - 80px));
  display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(390px, .85fr);
  overflow: hidden; border: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  border-radius: 28px; background: var(--surface);
  box-shadow: 0 24px 80px rgba(26, 48, 60, .15);
}
/* 하늘은 CSS 로 그리고 인물은 배경을 벗긴 컷아웃을 세운다.
   그림을 통째로 깔면 사각형 하늘색 판이 크림색 카드 위에 얹힌 꼴이 된다. */
.gate-visual {
  position: relative; min-height: 620px; overflow: hidden; isolation: isolate;
  /* 글이 자리를 먼저 잡고 인물이 남은 높이를 채운다. 인물을 절대 배치하면
     화면 높이가 바뀔 때마다 제목 위로 머리가 올라온다.
     flex 로는 안 된다 — 세로 flex 에서 `flex-basis: 0%` 는 높이가 정해지지
     않은 컨테이너에서 content 로 풀려, 그림이 제 원본 높이(774px)를 그대로
     밀어붙인다. 실측으로 확인했다. 행 높이가 확정되는 grid 를 쓴다. */
  display: grid; grid-template-rows: auto minmax(0, 1fr);
  padding: clamp(26px, 4vw, 54px) clamp(26px, 4vw, 54px) 0;
  background:
    radial-gradient(58% 46% at 56% 82%, color-mix(in srgb, #fff 62%, transparent), transparent 72%),
    var(--sky-field);
}
.gate-visual::after {
  content: ''; position: absolute; inset: 0; z-index: 3; pointer-events: none;
  background:
    /* 아래를 살짝 눌러 인물이 공중에 뜨지 않게 한다 */
    linear-gradient(180deg, transparent 62%, color-mix(in srgb, var(--sky-lo) 62%, transparent)),
    /* 오른쪽 끝을 크림색까지 완전히 풀어, 하늘 판과 입력 칸 사이에 선이
       남지 않게 한다. 중간에서 멈추면 옅은 파랑과 흰색이 만나 오히려 더 도드라진다. */
    linear-gradient(90deg, transparent 74%, color-mix(in srgb, var(--surface) 55%, transparent) 90%, var(--surface));
}
/* 두 번째 행에 맞춰 띄운다. 흐름에서 빼야 그림의 원본 높이가 판 높이를
   밀어 올리지 않는다. 아래로 넘겨 판 모서리에서 잘리게 하는데, 다리까지
   다 보이면 붙여 놓은 스티커처럼 뜨기 때문이다. */
.gate-figure {
  grid-row: 2; position: absolute; z-index: 2; pointer-events: none;
  top: clamp(12px, 2.5vh, 28px); left: 0; right: 0; bottom: -58px;
}
.gate-figure img {
  width: 100%; height: 100%; object-fit: contain;
  /* 오른쪽으로 치우쳐 세워 왼쪽 아래를 비운다 — 판 이름이 들어갈 자리다 */
  object-position: 68% 100%;
  filter: drop-shadow(0 26px 40px rgba(26, 74, 98, .22));
}
.gate-visual-copy {
  position: relative; z-index: 4; max-width: 460px;
  color: var(--sky-ink); text-shadow: 0 1px 18px color-mix(in srgb, var(--sky-hi) 78%, transparent);
}
.gate-index, .gate-edition, .eyebrow {
  display: block; font-size: 10px; line-height: 1.3; font-weight: 700;
  letter-spacing: .18em; text-transform: uppercase;
}
.gate-visual-copy p {
  margin: 13px 0 0; font-family: "Iowan Old Style", "AppleMyungjo", Georgia, serif;
  font-size: clamp(25px, 3.2vw, 42px); line-height: 1.2; letter-spacing: -.04em; font-weight: 600;
}
.gate-edition {
  position: absolute; left: clamp(26px, 4vw, 54px); bottom: 26px; z-index: 4;
  color: color-mix(in srgb, var(--sky-ink) 58%, transparent);
}
.gate .box {
  position: relative; width: 100%; align-self: center;
  padding: clamp(42px, 6vw, 80px); text-align: left;
}
.gate-mark {
  width: 48px; height: 48px; margin-bottom: 28px; overflow: hidden;
  border-radius: 50%; border: 1px solid color-mix(in srgb, var(--sky-lo) 60%, var(--border));
  box-shadow: 0 8px 24px color-mix(in srgb, var(--sky-lo) 34%, transparent);
}
.gate-mark img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gate .eyebrow { color: var(--accent); margin-bottom: 11px; }
.gate h1 {
  font-family: "Iowan Old Style", "AppleMyungjo", Georgia, serif;
  font-size: clamp(34px, 4vw, 52px); line-height: 1.05; letter-spacing: -.055em; font-weight: 650;
}
.gate h1 i { color: var(--coral); font-weight: 500; }
.gate p.gate-lead {
  color: var(--text-2); font-size: 14px; line-height: 1.75; margin: 18px 0 32px;
}
.gate form { display: grid; grid-template-columns: 1fr auto; gap: 9px; }
.gate #pw { min-width: 0; height: 48px; padding: 0 15px; background: var(--bg); }

/* 숫자 자판을 얻으려고 type=text 로 바꿔 단 칸. 가림은 여기서 한다.
   글자 사이를 벌려 몇 자리를 눌렀는지 눈으로 세어지게 한다 — 가려진 칸에서
   그게 없으면 한 자 더 눌렀는지 아닌지 알 방법이 없다. */
.gate #pw.masked {
  -webkit-text-security: disc; text-security: disc;
  letter-spacing: .35em; font-size: 17px;
}
.gate #pw.masked::placeholder { -webkit-text-security: none; letter-spacing: 0; font-size: 14px; }

/* 로그인 유지 — 칸 아래 왼쪽. 단추와 같은 줄에 두면 누를 곳이 셋이 되어 어수선하다. */
.gate-keep {
  grid-column: 1 / -1; display: flex; align-items: center; gap: 8px;
  color: var(--text-3); font-size: 12.5px; cursor: pointer; margin-top: 2px;
}
.gate-keep input { width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; margin: 0; }

/* 헤더의 아이콘 단추 — 테마(◐)와 잠그기. 글리프와 SVG 가 같은 크기로 서게 한다. */
.top .btn.ghost { padding: 7px 11px; }
.top .btn.ghost.icon { display: inline-grid; place-items: center; width: 34px; height: 32px; padding: 0; }
.top .btn.ghost.icon svg { display: block; }
.gate form .btn { min-width: 100px; height: 48px; padding-inline: 18px; }
.gate .err { color: var(--bad); font-size: 13px; min-height: 21px; margin-top: 6px; }
.gate-security {
  display: flex; align-items: center; gap: 8px; color: var(--text-3);
  font-size: 11.5px; padding-bottom: 27px; border-bottom: 1px solid var(--border);
}
.gate-security span { color: var(--accent); font-size: 14px; }
.gate p.gate-skip {
  color: var(--text-3); font-size: 12.5px; margin: 20px 0 0;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.gate-skip .btn.ghost { padding: 4px 9px; font-size: 12px; border-radius: 999px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

@media (max-width: 820px) {
  .gate { display: block; padding: 0; background: var(--surface); }
  .gate-shell {
    min-height: 100dvh; border: 0; border-radius: 0;
    grid-template-columns: 1fr; grid-template-rows: clamp(310px, 46dvh, 460px) auto;
    box-shadow: none;
  }
  .gate-visual { min-height: 0; padding: 24px 24px 0; }
  .gate-figure { top: 8px; bottom: -40px; }
  .gate-figure img { object-position: 72% 100%; }
  .gate-figure::after { -webkit-mask-position: 72% 100%; mask-position: 72% 100%; }
  /* 세로로 쌓이므로 이제 아래쪽이 입력 칸과 만난다. 푸는 방향을 돌린다. */
  .gate-visual::after {
    background:
      linear-gradient(180deg, transparent 58%, color-mix(in srgb, var(--surface) 48%, transparent) 84%, var(--surface));
  }
  .gate-visual-copy p { font-size: clamp(24px, 7vw, 34px); }
  .gate-edition { left: 24px; bottom: 18px; }
  .gate .box { padding: 38px clamp(22px, 7vw, 56px) 48px; max-width: 560px; margin: 0 auto; }
  .gate-mark { display: none; }
  .gate h1 { font-size: clamp(36px, 9vw, 48px); }
}

@media (max-width: 430px) {
  .gate-shell { grid-template-rows: min(41dvh, 350px) auto; }
  .gate-visual-copy p { font-size: 24px; }
  .gate form { grid-template-columns: 1fr; }
  .gate form .btn { width: 100%; }
}

@media (prefers-reduced-motion: no-preference) {
  .gate-figure { animation: gateReveal 1.1s cubic-bezier(.2, .7, .2, 1) both; }
  .gate .box { animation: gateCopyReveal .7s .15s ease-out both; }
}
@keyframes gateReveal { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes gateCopyReveal { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

:root[data-theme="dark"] .gate-visual-copy { text-shadow: 0 1px 14px rgba(12, 24, 30, .6); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .gate-visual-copy { text-shadow: 0 1px 14px rgba(12, 24, 30, .6); }
}

/* 두 사람 수치를 나란히 비교하는 블록 */
.facing { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); }
.facing-col {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 16px 18px;
}
.facing-label { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text-2); }
.facing-value { font-size: 26px; font-weight: 660; letter-spacing: -.03em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.facing-foot { font-size: 12px; color: var(--text-3); margin-top: 1px; }
.swatch { display: inline-block; width: 9px; height: 9px; border-radius: 2px; flex: none; }
.swatch.s0 { background: var(--a); }
.swatch.s1 { background: var(--b); }
@media (max-width: 480px) { .facing { grid-template-columns: 1fr; } }

.muted { color: var(--text-3); }
.small { font-size: 13px; }
.pill { display: inline-block; font-size: 11.5px; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sep { height: 1px; background: var(--border); margin: 20px 0; border: 0; }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.gallery figure { margin: 0; }
.gallery img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); display: block; }
.gallery figcaption { font-size: 11.5px; color: var(--text-3); margin-top: 5px; }

/* ── 사진 탭 ──────────────────────────────────────────────

   격자와 뷰어. 사진은 읽는 것이 아니라 훑는 것이라, 이 탭만 글줄 대신
   칸을 쓴다. 칸은 정사각이다 — 세로 사진과 가로 사진이 섞여도 줄이 흐트러지지
   않아야 눈이 사진만 본다. 비율은 뷰어에서 온전히 돌려준다. */

.pills.sm button { padding: 5px 12px; font-size: 12.5px; }

/* 사진을 받는 문. 기본 file 입력은 브라우저마다 생김새가 달라서 화면이
   여기서만 남의 것처럼 보인다. 입력은 감추고 label 을 문으로 쓴다. */
.ph-file { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.ph-drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  padding: 26px 16px; cursor: pointer; text-align: center;
  border: 1.5px dashed color-mix(in srgb, var(--accent) 34%, var(--border));
  border-radius: var(--radius); background: color-mix(in srgb, var(--accent) 4%, var(--surface));
  transition: background .15s ease, border-color .15s ease;
}
.ph-drop:hover, .ph-drop.over { background: color-mix(in srgb, var(--accent) 10%, var(--surface)); border-color: var(--accent); }
.ph-drop:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.ph-drop-plus {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent); color: var(--btn-ink); font-size: 20px; font-weight: 400; line-height: 1;
  margin-bottom: 6px;
}
.ph-drop-main { font-size: 14px; font-weight: 620; color: var(--text); }
.ph-drop-sub { font-size: 11.5px; color: var(--text-3); }

.ph-bar { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.ph-bar-row { display: flex; align-items: center; gap: 10px; }
.ph-bar-label { font-size: 12px; color: var(--text-3); min-width: 28px; flex: none; }

.ph-groups { display: flex; flex-direction: column; gap: 22px; }
.ph-group-head {
  display: flex; align-items: baseline; gap: 10px;
  padding-bottom: 8px; margin-bottom: -10px;
  border-bottom: 1px solid var(--border);
}
.ph-group-head.toned { border-bottom-color: color-mix(in srgb, var(--phase) 45%, var(--border)); }
.ph-group-name { font-size: 14px; font-weight: 620; color: var(--text); }
.ph-group-head.toned .ph-group-name { color: var(--phase); }
.ph-group-n { font-size: 11.5px; color: var(--text-3); }

.ph-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 8px; }

.ph-cell {
  appearance: none; padding: 0; margin: 0; font: inherit; cursor: zoom-in;
  position: relative; display: block; aspect-ratio: 1; overflow: hidden;
  border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2);
  transition: transform .16s ease, box-shadow .16s ease;
}
.ph-cell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph-cell:hover, .ph-cell:focus-visible { transform: translateY(-2px); box-shadow: var(--shadow); outline: none; }
.ph-cell:focus-visible { border-color: var(--accent); }
.ph-cell.dead { cursor: default; }

/* 글자를 사진 위에 바로 얹으면 밝은 사진에서 읽히지 않는다. 위아래로만 그늘을 깐다. */
.ph-shade {
  position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .16s ease;
  background: linear-gradient(180deg, rgba(0,0,0,.45) 0, transparent 34%, transparent 58%, rgba(0,0,0,.6) 100%);
}
.ph-cell.ready .ph-shade { opacity: 1; }
.ph-date {
  position: absolute; top: 6px; left: 7px; font-size: 10.5px; font-weight: 600;
  color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.6); letter-spacing: .02em;
}
.ph-new {
  position: absolute; top: 6px; right: 7px; font-size: 9.5px; font-weight: 700;
  padding: 2px 6px; border-radius: 999px; background: var(--b); color: #fff;
}
.ph-cap {
  position: absolute; left: 7px; right: 7px; bottom: 6px; font-size: 11px; color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,.7); text-align: left;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* ── 뷰어 ─────────────────────────────────────────────────

   테마를 따르지 않고 늘 어둡다. 사진 옆의 밝은 면은 눈이 먼저 가서
   정작 사진의 색을 못 보게 한다. 사진 앱들이 전부 어두운 이유다. */

html.vw-open, html.vw-open body { overflow: hidden; }

.viewer {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(8, 10, 13, var(--vw-dim, .93));
  /* 뒤에 남는 페이지가 흐려야 눈이 사진에만 머문다 */
  backdrop-filter: blur(22px) saturate(120%);
  display: grid; grid-template-rows: 1fr;
  animation: vwIn .16s ease both;
  touch-action: none;
}
@keyframes vwIn { from { opacity: 0; } to { opacity: 1; } }

.vw-stage { position: relative; display: grid; place-items: center; overflow: hidden; padding: 64px 12px 96px; }
.vw-img {
  max-width: 100%; max-height: 100%; object-fit: contain; display: block;
  border-radius: 4px; user-select: none; -webkit-user-drag: none;
  transition: transform .18s ease;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .5);
}
.vw-img.rough { filter: blur(6px); }      /* 썸네일을 먼저 띄운 상태 */

.vw-spin {
  position: absolute; width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.25); border-top-color: #fff;
  opacity: 0; pointer-events: none;
}
.viewer.loading .vw-spin { opacity: 1; animation: vwSpin .7s linear infinite; }
@keyframes vwSpin { to { transform: rotate(360deg); } }

.vw-top, .vw-bot {
  position: absolute; left: 0; right: 0; color: #fff;
  transition: opacity .18s ease, transform .18s ease;
  padding: 14px 16px;
}
.vw-top {
  top: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: linear-gradient(180deg, rgba(0,0,0,.55), transparent);
}
.vw-top-l { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.vw-count { font-size: 12px; font-variant-numeric: tabular-nums; opacity: .7; flex: none; }
.vw-date { font-size: 13.5px; font-weight: 560; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.vw-bot { bottom: 0; background: linear-gradient(0deg, rgba(0,0,0,.62), transparent); }
.vw-cap { font-size: 14px; line-height: 1.5; margin-bottom: 4px; }
.vw-meta { font-size: 11.5px; opacity: .62; }
.vw-acts { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 2px; }

.viewer.bare .vw-top { opacity: 0; transform: translateY(-8px); pointer-events: none; }
.viewer.bare .vw-bot { opacity: 0; transform: translateY(8px); pointer-events: none; }
.viewer.bare .vw-nav { opacity: 0; pointer-events: none; }

/* 뷰어 안에서는 알약도 어두운 바탕 위에 선다 */
.viewer .cite {
  margin-top: 8px; background: rgba(255,255,255,.12); color: #fff;
  border-color: rgba(255,255,255,.22);
}
.viewer .cite:hover { background: rgba(255,255,255,.22); color: #fff; }
.vw-act {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 8px;
  padding: 7px 14px; min-height: 34px; border-radius: 999px;
  font-size: 12.5px; font-weight: 620; text-decoration: none;
  background: rgba(255,255,255,.12); color: #fff; border: 1px solid rgba(255,255,255,.22);
}
.vw-act::before { content: '↓'; opacity: .85; }
.vw-act:hover { background: rgba(255,255,255,.22); }
.vw-act.off { opacity: .35; pointer-events: none; }

.vw-icon {
  appearance: none; font: inherit; font-size: 17px; line-height: 1; cursor: pointer; flex: none;
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(255,255,255,.12); color: #fff; border: 1px solid rgba(255,255,255,.2);
}
.vw-icon:hover { background: rgba(255,255,255,.24); }

.vw-nav {
  appearance: none; position: absolute; top: 50%; transform: translateY(-50%);
  width: 44px; height: 64px; border-radius: 10px; cursor: pointer;
  font-size: 30px; line-height: 1; color: #fff; font-family: inherit;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14);
  transition: background .15s ease, opacity .18s ease;
}
.vw-nav:hover { background: rgba(255,255,255,.2); }
.vw-nav.prev { left: 10px; }
.vw-nav.next { right: 10px; }

@media (max-width: 560px) {
  .ph-grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 6px; }
  .ph-bar-row { align-items: flex-start; }
  .vw-nav { display: none; }              /* 폰에서는 쓸어서 넘긴다 */
  .vw-stage { padding: 56px 0 92px; }
  .vw-img { border-radius: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .viewer, .vw-img, .vw-top, .vw-bot, .ph-cell { animation: none; transition: none; }
}

.empty { text-align: center; color: var(--text-3); padding: 48px 20px; font-size: 14px; }
.empty-with-character { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.empty-with-character img {
  width: 92px; height: 92px; object-fit: cover; border-radius: 50%;
  background: var(--sky-field);
  border: 1px solid color-mix(in srgb, var(--sky-lo) 60%, var(--border));
  box-shadow: 0 6px 18px color-mix(in srgb, var(--sky-lo) 42%, transparent);
}

/* ── 인용 칩 ─────────────────────────────── */
/* 분류를 가리키는 .tag 와 배경·테두리·모양이 같은 토큰이어서, 무엇이 눌리는
   것인지 구분되지 않았다. 차이가 글자 1px·여백 1px·↗ 하나뿐이었다.
   지금은 종류를 갈라놓는다 — 분류는 납작한 글자, 알약은 이것 하나뿐이다.
   색도 링크·기본 버튼과 같은 강조색을 쓴다. 손가락으로 누를 자리이기도 해서
   높이를 24px 에서 34px 로 올렸다. */
.cite {
  appearance: none; font: inherit; font-size: 12.5px; font-weight: 620; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 12px; padding: 7px 14px; min-height: 34px; border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 7%, var(--surface));
  color: var(--accent); line-height: 1.35;
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--border));
  transition: background .15s ease, border-color .15s ease;
}
.cite::before { content: '↗'; opacity: .85; }
/* 배경을 짙게 하면 글자 대비가 같이 떨어진다. 글자도 함께 진해져야 4.5:1 을 지킨다. */
.cite:hover {
  background: color-mix(in srgb, var(--accent) 16%, var(--surface));
  border-color: color-mix(in srgb, var(--accent) 48%, var(--border));
  color: color-mix(in srgb, var(--accent) 88%, var(--text));
}
.cite:active { transform: translateY(1px); }
.row .cite { margin-top: 0; }
/* 타임라인은 인용 버튼 둘을 붙여서 넣는다. 사이에 공백 문자가 없어 서로 닿는다. */
.cite + .cite { margin-left: 8px; }

/* 원본이 삭제돼 이동할 수 없는 인용. 강조색을 빼서 행동처럼 보이지 않게 한다. */
/* 회색 면을 깔면 흐린 글자가 그 위에서 4.34:1 로 떨어진다. 면은 비우고
   점선 테두리가 '이동할 수 없다'를 맡는다. */
.cite.dead {
  cursor: default; background: var(--surface); color: var(--text-3);
  border-color: var(--border-strong); border-style: dashed;
}
.cite.dead::before { content: '⊘'; }
.cite.dead:hover { background: var(--surface); color: var(--text-3); border-color: var(--border-strong); }
.cite.dead:active { transform: none; }
.ins-quote.orphan { border-left-style: dashed; opacity: .78; }

/* ── 해석 탭 ─────────────────────────────── */
.pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pills button {
  appearance: none; font: inherit; font-size: 13.5px; cursor: pointer;
  padding: 7px 14px; border-radius: 999px;
  background: var(--surface); color: var(--text-2); border: 1px solid var(--border);
}
.pills button:hover { color: var(--text); }
.pills button[aria-selected="true"] {
  background: var(--text); color: var(--bg); border-color: var(--text); font-weight: 560;
}

/* 판 안쪽도 바깥과 같은 간격 척도를 쓴다 */
.pane { display: flex; flex-direction: column; gap: var(--gap); }
.pane-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* 하루하루 — 접이식 목록 */
.ep-list {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
.ep + .ep { border-top: 1px solid var(--border); }
.ep-head {
  appearance: none; width: 100%; display: flex; align-items: center; gap: 14px;
  padding: 14px 20px; background: none; border: 0; cursor: pointer;
  font: inherit; color: var(--text); text-align: left;
}
.ep-head:hover { background: var(--surface-2); }
.ep.open .ep-head { background: var(--surface-2); }
.ep-date {
  font-size: 12.5px; color: var(--text-3); font-variant-numeric: tabular-nums;
  min-width: 62px; flex: none;
}
.ep-title { font-size: 15px; font-weight: 600; letter-spacing: -.02em; flex: 1; }
.ep-meta { display: flex; align-items: center; gap: 8px; flex: none; }
.ep-count { font-size: 11.5px; color: var(--text-3); }
.ep-detail { display: none; padding: 4px 20px 20px; }
.ep.open .ep-detail { display: block; }
.ep-body { margin: 0; font-size: 14.5px; color: var(--text-2); line-height: 1.8; }
.ep-items { margin-top: 6px; }

.mood {
  font-size: 12px; white-space: nowrap; padding: 3px 10px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-2);
}

/* ── 약속 체크 ────────────────────────────────────────────

   체크는 우편함에 남아 둘이 같이 본다. 그래서 "내가 눌렀다"가 아니라
   "누가 언제 지켰다"로 적는다. 지킨 줄은 지우지 않고 흐리게 남긴다 —
   지운 약속은 없던 일이 되지만, 지킨 약속은 같이 한 일이다. */

.pr-bar-card { padding-top: 18px; padding-bottom: 18px; }
.pr-who { margin-top: 2px; }

.pr-progress { display: flex; align-items: center; gap: 12px; margin: 16px 0 18px; }
.pr-track {
  flex: 1; height: 6px; border-radius: 999px; overflow: hidden;
  background: color-mix(in srgb, var(--text-3) 20%, transparent);
}
.pr-fill {
  height: 100%; border-radius: 999px; background: var(--ok);
  transition: width .35s cubic-bezier(.2, .7, .2, 1);
}
.pr-count { font-size: 12.5px; color: var(--text-3); font-variant-numeric: tabular-nums; flex: none; }
.pr-count b { font-size: 15px; color: var(--ok); font-weight: 680; }

/* 줄 하나 = 체크칸 + 내용. 체크칸은 글자와 같은 줄 높이에 맞춰 위에 건다. */
.pr-item { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: start; }
.pr-main { min-width: 0; }

.pr-check {
  appearance: none; cursor: pointer; flex: none; position: relative;
  width: 22px; height: 22px; margin-top: 1px; border-radius: 7px;
  background: var(--surface); border: 1.5px solid color-mix(in srgb, var(--text-3) 55%, transparent);
  transition: background .15s ease, border-color .15s ease;
}
.pr-check:hover { border-color: var(--ok); }
.pr-check:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pr-check::after {
  content: ''; position: absolute; left: 6px; top: 2px;
  width: 6px; height: 11px; border: solid var(--btn-ink);
  border-width: 0 2px 2px 0; transform: rotate(42deg) scale(.5);
  opacity: 0; transition: opacity .12s ease, transform .12s ease;
}
.pr-check[aria-checked="true"] { background: var(--ok); border-color: var(--ok); }
.pr-check[aria-checked="true"]::after { opacity: 1; transform: rotate(42deg) scale(1); }
.pr-check:disabled { cursor: progress; opacity: .6; }

/* 지킨 줄 — 흐리게 두되 읽을 수는 있게. 취소선은 긋지 않는다. 지운 것이 아니다. */
.pr-item.is-done .ins-cap { color: var(--text-3); }
.pr-item.is-done .ins-quote { opacity: .6; }
.pr-item.is-done .tag { opacity: .65; }

.pr-foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pr-stamp { font-size: 11.5px; color: var(--ok); margin-top: 12px; }
.pr-err { font-size: 12px; color: var(--b); margin-top: 8px; }

@media (max-width: 560px) {
  .pr-item { gap: 10px; }
  .pr-progress { gap: 10px; }
}

.ins-item { padding: 16px 0; border-bottom: 1px solid var(--border); }
.ins-item:last-child { border-bottom: 0; padding-bottom: 0; }
.ins-list > .ins-item:first-child { padding-top: 0; }
.ins-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.ins-cap { font-size: 13.5px; color: var(--text-2); }
.ins-cap b { color: var(--text); font-weight: 620; }
.ins-quote {
  margin-top: 8px; font-size: 13.5px; color: var(--text-2);
  border-left: 2px solid var(--border-strong); padding: 3px 0 3px 11px;
  white-space: pre-wrap; word-break: break-word;
}
.ins-quote b { color: var(--text); font-weight: 600; margin-right: 4px; }

/* 분류는 읽는 것이지 누르는 것이 아니다. 칩 모양을 걷어내고 색점 하나를
   앞에 둔다. 색은 팔레트에서 그대로 오고, 전부 표면 위에서 4.5:1 을 넘는다. */
.tag {
  display: inline-flex; align-items: center; gap: 5px; white-space: nowrap;
  padding: 0; background: none; border: 0;
  font-size: 11px; font-weight: 680; letter-spacing: .02em; color: var(--text-3);
}
.tag::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.tag.move { color: var(--accent); }
.tag.warm { color: var(--b); }
.tag.fun { color: var(--a); }
.tag.joke { color: var(--warn); }
/* 날짜는 분류가 아니라 사실이다. 점을 붙이지 않는다. */
.tag.date { color: var(--text-3); font-weight: 600; font-variant-numeric: tabular-nums; }
.tag.date::before { display: none; }

.dict-item { padding: 16px 0; border-bottom: 1px solid var(--border); }
.dict-item:last-child { border-bottom: 0; }
.dict-term { font-size: 16px; font-weight: 650; letter-spacing: -.02em; }
.dict-date { font-size: 11.5px; color: var(--text-3); font-weight: 450; margin-left: 8px; font-variant-numeric: tabular-nums; }
.dict-origin { font-size: 13.5px; color: var(--text-2); margin-top: 2px; }

/* ── 대화 원문 뷰어 ──────────────────────── */
.chat-days { margin-top: 16px; }
.day { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); margin-bottom: 8px; overflow: hidden; }
.day-head {
  appearance: none; width: 100%; display: flex; justify-content: space-between; align-items: center;
  gap: 12px; padding: 11px 16px; background: none; border: 0; cursor: pointer;
  font: inherit; color: var(--text); text-align: left;
}
.day-head:hover { background: var(--surface-2); }
.day-label { font-weight: 580; font-variant-numeric: tabular-nums; font-size: 14px; }
.day-count { color: var(--text-3); font-size: 12px; }
.day-body { display: none; padding: 6px 16px 18px; border-top: 1px solid var(--border); }
.day.open .day-body { display: block; }
.day.open .day-head { background: var(--surface-2); }

.msg { max-width: 78%; margin: 12px 0; scroll-margin-top: 120px; }
.msg.me { margin-left: auto; text-align: right; }
.msg-meta { font-size: 11px; color: var(--text-3); margin-bottom: 3px; }
.msg-time { margin-left: 6px; font-variant-numeric: tabular-nums; }
.msg-text, .msg-placeholder {
  display: inline-block; max-width: 100%; text-align: left;
  padding: 8px 12px; border-radius: 12px; font-size: 14px;
  white-space: pre-wrap; word-break: break-word;
  background: var(--surface-2); border: 1px solid var(--border);
}
.msg.me .msg-text, .msg.me .msg-placeholder {
  background: color-mix(in srgb, var(--a) 12%, var(--surface));
  border-color: color-mix(in srgb, var(--a) 26%, var(--border));
}
.msg-placeholder { color: var(--text-3); font-style: italic; font-size: 13px; }

.msg.focus .msg-text, .msg.focus .msg-placeholder {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.msg.hit .msg-text { box-shadow: inset 3px 0 0 var(--warn); }

.search-list { margin-top: 2px; max-height: 360px; overflow-y: auto; }
.search-hit {
  appearance: none; width: 100%; text-align: left; font: inherit; cursor: pointer;
  display: block; padding: 9px 10px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text); margin-bottom: 6px;
}
.search-hit:hover { border-color: var(--border-strong); background: var(--surface-2); }
.search-hit-meta { display: flex; gap: 8px; font-size: 11.5px; color: var(--text-3); font-variant-numeric: tabular-nums; margin-bottom: 3px; }
.search-hit-snip { font-size: 13.5px; color: var(--text-2); white-space: pre-wrap; word-break: break-word; }
.search-hit-snip mark { background: color-mix(in srgb, var(--warn) 35%, transparent); color: var(--text); border-radius: 3px; padding: 0 1px; }

@media (max-width: 560px) { .msg { max-width: 90%; } }

/* 좁은 화면: 날짜·제목·분위기를 한 줄에 밀어넣으면 제목이 뭉개진다 */
@media (max-width: 620px) {
  .ep-head { flex-wrap: wrap; gap: 6px 10px; padding: 13px 16px; }
  .ep-date { min-width: 0; }
  .ep-title { flex: 1 0 100%; order: 3; font-size: 14.5px; }
  .ep-meta { margin-left: auto; }
  .ep-detail { padding: 2px 16px 18px; }
}


/* 좁은 화면: 헤더의 브랜드·아카이브 선택·버튼이 한 줄에 안 들어가 가로 스크롤이 생긴다 */
@media (max-width: 560px) {
  .wrap { padding: 0 14px; }
  .top .wrap { gap: 8px; }
  .brand > img { width: 27px; height: 27px; margin-right: 7px; }
  /* 기간은 접어도 디데이는 남긴다 — 이걸 보려고 여는 화면이다 */
  .brand small { display: inline; }
  .brand-range { display: none; }
  #archiveSel { max-width: none; min-width: 0; flex: 1; }
  /* 좁은 화면에서 단추 둘이 들어오면 고르는 칸이 "2026 (" 까지 눌린다 */
  .top .btn.ghost { padding: 7px 8px; }
  .top .btn.ghost.icon { width: 30px; }
  .card { padding: 16px; }
  .stat .value { font-size: 22px; }
  .score .big { font-size: 20px; }
  /* 폭이 좁으면 두 칸이 서로를 눌러 제목이 뭉개진다. 글을 위, 인물을 아래
     오른쪽에 두고 하늘도 가로가 아니라 세로로 번지게 바꾼다. */
  .story-cover {
    grid-template-columns: 1fr; min-height: 0;
    padding: 26px 22px 0;
    background:
      radial-gradient(78% 46% at 78% 100%,
        color-mix(in srgb, var(--sky-hi) 84%, #fff), transparent 70%),
      linear-gradient(170deg,
        var(--surface) 0%,
        color-mix(in srgb, var(--sky-mid) 24%, var(--surface)) 42%,
        var(--sky-mid) 88%,
        var(--sky-lo) 100%);
  }
  .story-copy { max-width: none; padding-bottom: 4px; }
  .story-copy h2 { max-width: 300px; font-size: 27px; }
  .story-figure { justify-self: end; margin-right: -6px; }
  .story-figure img { max-width: 172px; }
}

/* ── 캘린더 — 약속을 구글 캘린더 "돈줄리"에 ──────────
   넣는 것은 '열기' 동작이라 알약 가족이다. 십자만 다르다. 켜기는 잠금 화면의
   로그인 유지와 같은 체크칸이다 — 이 폰에서만 켜지는 것끼리 같은 모양을 쓴다. */
.cite.cal::before { content: '✚'; }
.cal-toggle {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  color: var(--text-2); font-size: 13px; cursor: pointer; margin-top: 16px;
}
.cal-toggle input { width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; margin: 0; }
.cal-toggle .muted { font-size: 12px; }
.cal-mile {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-top: 14px; padding: 12px 14px; border-radius: 10px;
  background: color-mix(in srgb, var(--b) 9%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--b) 28%, var(--border));
}
.cal-mile b { color: var(--b); font-weight: 680; }
.cal-mile .cite { margin-top: 0; margin-left: auto; }
.cal-list { margin-top: 10px; }
.cal-row { display: flex; gap: 12px; align-items: baseline; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.cal-row:last-child { border-bottom: 0; }
.cal-when { flex: none; min-width: 112px; color: var(--text-3); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.cal-row.today .cal-when { color: var(--accent); font-weight: 620; }
.cal-title { min-width: 0; overflow-wrap: anywhere; }
.cal-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.cal-form input {
  font: inherit; font-size: 13.5px; padding: 6px 9px; border-radius: 8px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
}
.cal-form input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.cal-form .btn { padding: 7px 13px; font-size: 13px; }
.cal-stamp { font-size: 12.5px; color: var(--ok); }
.cal-stamp:empty { display: none; }

/* ── 채팅 탭 ─────────────────────────────── 
   모양은 익숙하게(카톡처럼) 두고 새로운 것은 만들지 않는다. 내 말은 오른쪽 강조색,
   상대 말은 왼쪽 종이색. 화면 높이는 헤더를 뺀 나머지(--top-h 는 app.js 가 잰다). */
.tab-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.talk { display: flex; flex-direction: column; height: calc(100dvh - var(--top-h, 110px) - 6px); min-height: 380px; position: relative; }
.tk-bar { font-size: 12.5px; color: var(--text-3); text-align: center; padding: 6px 10px; background: var(--surface-2); border-radius: 8px; margin: 6px 0 2px; }
.tk-head { display: flex; align-items: center; gap: 10px; padding: 8px 2px 8px; flex-wrap: wrap; }
.tk-who { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.tk-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--text-3); opacity: .45; flex: none; }
.tk-dot.on { background: var(--ok); opacity: 1; box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 25%, transparent); }
.tk-status { font-size: 12px; color: var(--text-3); }
.tk-tools { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.tk-tools .cite { margin-top: 0; min-height: 30px; padding: 5px 12px; font-size: 12px; }
.tk-list { flex: 1; overflow-y: auto; padding: 2px 2px 12px; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.tk-stream { display: flex; flex-direction: column; }
.tk-older {
  appearance: none; font: inherit; font-size: 12.5px; cursor: pointer; display: block; margin: 6px auto 4px;
  padding: 6px 14px; border-radius: 999px; background: var(--surface); color: var(--text-2); border: 1px solid var(--border);
}
.tk-older:disabled { opacity: .5; }
.tk-day { text-align: center; font-size: 11.5px; color: var(--text-3); margin: 16px 0 8px; }
.tk-unread { text-align: center; font-size: 11.5px; color: var(--accent); margin: 10px 0 4px; padding-top: 6px; border-top: 1px dashed color-mix(in srgb, var(--accent) 45%, transparent); }
.tk-msg { display: flex; flex-direction: column; align-items: flex-start; margin: 3px 0; max-width: 78%; }
.tk-msg.mine { align-self: flex-end; align-items: flex-end; }
.tk-bubble {
  padding: 9px 13px; border-radius: 18px; font-size: 15px; line-height: 1.5;
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.tk-msg.mine .tk-bubble { background: var(--accent); color: var(--btn-ink); border-color: transparent; }
.tk-bubble.photo { padding: 3px; }
.tk-bubble.broken { color: var(--text-3); border-style: dashed; }
.tk-photo { display: block; border-radius: 15px; width: 180px; max-width: 100%; height: auto; cursor: zoom-in; background: var(--surface-2); }
.tk-msg.big .tk-photo { width: min(100%, 460px); cursor: zoom-out; }
.tk-msg.big { max-width: 100%; }
.tk-meta { display: flex; gap: 6px; font-size: 10.5px; color: var(--text-3); margin-top: 3px; padding: 0 4px; font-variant-numeric: tabular-nums; }
.tk-read { color: var(--accent); font-weight: 640; }
.tk-read:empty { display: none; }
.tk-msg.pending { opacity: .55; }
.tk-msg.failed .tk-bubble { border: 1px solid var(--bad); background: var(--surface); color: var(--text); }
.tk-fail { color: var(--bad); }
.tk-typing { display: inline-flex; gap: 4px; padding: 10px 14px; margin: 4px 0; align-self: flex-start; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; }
.tk-typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--text-3); animation: tk-blink 1.2s infinite; }
.tk-typing span:nth-child(2) { animation-delay: .2s; }
.tk-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes tk-blink { 0%, 60%, 100% { opacity: .25; } 30% { opacity: 1; } }
.tk-jump {
  appearance: none; font: inherit; font-size: 12.5px; font-weight: 620; cursor: pointer;
  position: absolute; bottom: 74px; left: 50%; transform: translateX(-50%);
  padding: 7px 14px; border-radius: 999px; background: var(--accent); color: var(--btn-ink); border: 0;
  box-shadow: 0 4px 14px rgba(0,0,0,.18);
}
.tk-compose {
  display: flex; gap: 8px; align-items: flex-end;
  padding: 8px 0 calc(6px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--border); background: var(--bg);
}
.tk-input {
  flex: 1; min-width: 0; font: inherit; font-size: 15px; line-height: 1.45; padding: 9px 13px;
  border-radius: 20px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  resize: none; max-height: 140px;
}
.tk-input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.tk-send { border-radius: 20px; height: 40px; padding: 0 16px; flex: none; }
.tk-photo-btn { width: 40px; height: 40px; padding: 0; border-radius: 50%; font-size: 22px; line-height: 1; flex: none; }
.tk-toast {
  position: absolute; top: 52px; left: 50%; transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 8px 14px; border-radius: 999px; font-size: 13px; z-index: 2;
}
.tk-pick .pills { margin-top: 14px; }

/* 하루 정리(LLM 요약)도 '열기' 동작 — 알약 가족. 별표만 다르다. */
.cite.sum::before { content: '✦'; }
.hist-auto { padding-top: 14px; padding-bottom: 14px; }
.hist-auto .cal-toggle { margin-top: 0; }
