/* 셀리 — 나만 보는 사진 일기
 *
 * 서랍 속 다이어리. 종이다(2026-11-02 대표: "원래 노트 같은 UI 가 더 안정적" → 예전 시험판의 노트 결로 되돌림).
 * 바탕은 미색 인화지 + 아주 옅은 모눈 + 종이 결, 잉크는 짙은 먹색. 제목·일기는 명조(Gowun Batang), 나머지는 기기 글꼴.
 * 강조색(--accent)은 고정값이 아니라 그날 사진에서 뽑아 덮어쓴다 — 같은 화면이 사진마다 다른 색을 띤다.
 * 테두리는 1px, 모서리는 작게. 둥근 카드를 쌓지 않고 선으로 구획한다.
 */

:root {
  --paper: #f4f3ef;
  --card: #f9f8f5;
  --line: #dcd9d0;
  --photo: #e3e1d9;
  --ink: #23211c;
  --ink2: #4a473f;
  --ink3: #7d7a70;
  --gold: var(--accent);
  --gold-t: var(--accent);
  --warn: #9c4a1c;
  --ok: #3f6b4a;
  --leather: #23211c;
  --leather-2: #23211c;
  --grid: rgba(35, 33, 28, .033);

  --p1: #eceae4; --p2: #e6e8e4; --p3: #e9e6de;
  --accent: #5a6b52; --accent-soft: #e8ebe4;

  --title: 'Gowun Batang', 'Nanum Myeongjo', serif;
  --body: 'Apple SD Gothic Neo', Pretendard, -apple-system, system-ui, sans-serif;
  --diary: 'Gowun Batang', 'Nanum Myeongjo', serif;
  --r-card: 3px;
  --r-btn: 3px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  /* 다이어리 속지의 모눈. 있는 줄 모르고 느끼는 정도 */
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 26px 26px;
  background-position: -1px -1px;
  color: var(--ink);
  font: 400 16px/1.7 var(--body);
  word-break: keep-all;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
}
/* 종이 결. 매끈한 면은 화면처럼, 결이 있으면 종이처럼 보인다 */
body::before {
  content: ''; position: fixed; inset: 0; z-index: -2; pointer-events: none; opacity: .5; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='f'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23f)' opacity='.16'/%3E%3C/svg%3E");
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { display: block; max-width: 100%; }
.hidden { display: none !important; }
.center { text-align: center; }

/* 일기 지면 뒤로 사진색이 아주 옅게 번진다 */
/* 사진 팔레트가 번지는 배경 */
.tint {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(95vw 70vh at 10% -16%, var(--p3) 0%, transparent 62%),
    radial-gradient(80vw 58vh at 100% 110%, var(--p2) 0%, transparent 60%);
  opacity: .8; transition: background 1.8s ease;
}

/* ── 머리 ───────────────────────────────── */
.cover { position: sticky; top: 0; z-index: 20; padding-top: env(safe-area-inset-top); background: rgba(244,243,239,.92); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); }
.cover-inner { max-width: 560px; margin: 0 auto; min-height: 56px; display: flex; align-items: center; gap: 12px; padding: 0 20px; }
.cover-title { margin: 0; font: 700 21px/1 var(--title); flex: 1; display: flex; align-items: baseline; gap: 8px; color: var(--ink); }
.cover-sub { font: 400 12px/1 var(--body); color: var(--ink3); }
.cover-back { background: none; border: 0; color: var(--ink2); padding: 12px 4px; min-height: 44px; }
.cover-back:not(.hidden) + .cover-title .cover-sub { display: none; }
.privacy { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink3); padding: 5px 9px; border: 1px solid var(--line); border-radius: 999px; }
.ribbon { display: none; }
.lock { display: inline-block; width: 11px; height: 13px; position: relative; }
.lock::before { content: ''; position: absolute; left: 1px; right: 1px; bottom: 0; height: 8px; border-radius: 2px; background: currentColor; }
.lock::after { content: ''; position: absolute; left: 2.5px; right: 2.5px; top: 0; height: 7px; border: 1.6px solid currentColor; border-bottom: 0; border-radius: 5px 5px 0 0; }

/* ── 화면 공통 ───────────────────────────── */
.view { max-width: 560px; margin: 0 auto; padding: 28px 20px 24px; }
.page-title { font: 800 26px/1.3 var(--title); margin: 4px 0 18px; letter-spacing: -.01em; }
.date-line, .eyebrow { margin: 0; font-size: 13px; color: var(--ink3); font-weight: 500; }
.eyebrow { color: var(--gold-t); margin-bottom: 10px; }
.cap { font-size: 13px; color: var(--ink3); margin: 10px 0 0; }
.empty { text-align: center; color: var(--ink3); padding: 32px 0; }

.go, .ghost, .primary {
  min-height: 52px; padding: 0 20px; border-radius: var(--r-btn);
  font-weight: 600; border: 1.5px solid var(--ink); transition: transform .1s;
}
.go, .primary { background: var(--ink); color: #fff; }
.ghost { background: var(--card); color: var(--ink); border-color: var(--line); }
.go:active, .ghost:active { transform: scale(.98); }
.go:disabled, .ghost:disabled { opacity: .45; cursor: default; }
.link { background: none; border: 0; color: var(--ink2); text-decoration: underline; text-underline-offset: 3px; min-height: 44px; display: block; margin: 8px auto 0; font-size: 14px; }
.actions { display: flex; gap: 10px; margin-top: 22px; flex-wrap: wrap; }
.actions > * { flex: 1; }
.actions .go { flex: 1.4; }

.field, .field-bare {
  width: 100%; border: 1.5px solid var(--line); border-radius: 12px; background: var(--card);
  padding: 12px 14px; min-height: 48px; outline: none;
}
.field:focus { border-color: var(--ink2); }

.err {
  margin-top: 14px; padding: 14px 16px; border-radius: 14px; background: #FBEFE3; color: var(--warn);
  font-size: 14px; border: 1px solid #F0D6BC;
}
.err .err-acts { display: flex; gap: 8px; margin-top: 10px; }
.err button { min-height: 44px; padding: 0 14px; border-radius: 12px; border: 1px solid #E8C9A8; background: #fff; color: var(--warn); font-weight: 600; }

/* ── 일기 목록 (L-03) ────────────────────── */
.today {
  background: var(--card); border-radius: var(--r-card); padding: 22px 20px;
  border: 1px solid var(--line); margin-bottom: 26px; box-shadow: 0 1px 0 rgba(26,27,46,.03);
}
.today h2 { font: 800 22px/1.35 var(--title); margin: 0 0 4px; }
.today p { margin: 0 0 16px; color: var(--ink3); font-size: 14px; }
.today .go { width: 100%; }
.today-entry { display: flex; gap: 14px; align-items: center; text-align: left; background: none; border: 0; padding: 0; width: 100%; }
.today-entry h3 { font: 700 18px/1.35 var(--title); margin: 0; }
.today-entry p { margin: 4px 0 0; font: 15px/1.6 var(--diary); color: var(--ink2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.today-more { margin-top: 14px; }

.month { margin: 26px 0 8px; display: flex; align-items: center; gap: 10px; font: 700 15px/1 var(--title); color: var(--ink2); }
.month small { font: 500 13px/1 var(--body); color: var(--ink3); }
.month .dots { display: flex; gap: 4px; margin-left: auto; }
.month .dots i { width: 8px; height: 8px; border-radius: 50%; }

.row {
  display: flex; gap: 14px; width: 100%; text-align: left; align-items: flex-start;
  background: none; border: 0; border-bottom: 1px solid var(--line); padding: 16px 0; min-height: 96px;
}
.row:last-child { border-bottom: 0; }
.print {                  /* 인화지 모양 */
  flex: none; width: 72px; height: 72px; padding: 4px; background: #fff;
  box-shadow: 0 1px 2px rgba(26,27,46,.12), 0 6px 14px rgba(26,27,46,.06); transform: rotate(-1.5deg);
}
.row:nth-child(even) .print { transform: rotate(1.2deg); }
.print img, .print .swatch { width: 100%; height: 100%; object-fit: cover; background: var(--photo); }
.row-body { flex: 1; min-width: 0; }
.row-when { font-size: 12px; color: var(--ink3); margin: 0 0 2px; }
.row h4 { margin: 0; font: 700 16px/1.4 var(--title); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-text { margin: 4px 0 8px; font: 14px/1.6 var(--diary); color: var(--ink2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.feel { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tag { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--ink2); }
.bars { display: inline-flex; gap: 3px; }
.bars i { width: 36px; height: 4px; border-radius: 2px; background: var(--line); position: relative; overflow: hidden; }
.bars i b { position: absolute; left: 0; top: 0; bottom: 0; background: var(--c, var(--ink3)); }
.unread { font-size: 12px; color: var(--ink3); }
.more { display: block; margin: 18px auto 0; min-height: 48px; padding: 0 20px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); }

/* ── 쓰기 (L-02) ─────────────────────────── */
.drop {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  border: 2px dashed #D6CFC1; border-radius: var(--r-card); background: var(--card);
  padding: 34px 20px 24px; cursor: pointer; text-align: center; transition: border-color .2s, background .2s;
}
.drop.over, .drop:hover { border-color: var(--gold); background: #FFFCF5; }
.drop.off { opacity: .5; pointer-events: none; }
.drop-mark { width: 56px; height: 56px; border-radius: 50%; background: var(--gold); position: relative; }
.drop-mark::before, .drop-mark::after { content: ''; position: absolute; left: 50%; top: 50%; background: var(--ink); border-radius: 2px; transform: translate(-50%, -50%); }
.drop-mark::before { width: 22px; height: 3px; }
.drop-mark::after { width: 3px; height: 22px; }
.drop-text { font: 700 18px/1.4 var(--title); }
.keep-notes { margin: 4px 0 0; font-size: 13px; color: var(--ink3); }

.reading-say { font: 700 20px/1.4 var(--title); margin: 0 0 16px; }
.photo-wrap { background: #fff; padding: 8px; box-shadow: 0 6px 20px rgba(26,27,46,.1); transform: rotate(-1deg); }
.photo-wrap img { width: 100%; max-height: 52vh; object-fit: contain; background: var(--photo); }
.signals { list-style: none; padding: 0; margin: 18px 0 0; }
.signals li { font: 16px/1.6 var(--diary); color: var(--ink2); animation: fade .5s both; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } }
.keepbar { list-style: none; display: flex; gap: 6px; padding: 0; margin: 22px 0 0; font-size: 12px; }
.keepbar li { flex: 1; padding: 8px 6px; border-radius: 10px; background: var(--card); border: 1px solid var(--line); color: var(--ink3); text-align: center; }
.keepbar li.on { border-color: var(--gold); color: var(--ink); }
.keepbar li.done { background: #EEF5F0; border-color: #CFE3D6; color: var(--ok); }

.keep-done { color: var(--ok); margin: 0 0 12px; }
.manual-note { color: var(--warn); margin: 0 0 12px; }

/* 일기 지면: 사진 + 줄 쳐진 속지 */
.spread {
  background: linear-gradient(180deg, var(--p3), var(--card) 40%); border-radius: var(--r-card);
  border: 1px solid var(--line); padding: 18px; display: grid; gap: 18px;
}
.spread-photo { margin: 0; }
.spread-photo img { width: 100%; max-height: 46vh; object-fit: cover; background: #fff; padding: 6px; box-shadow: 0 6px 18px rgba(26,27,46,.12); transform: rotate(-1.2deg); }
.spread-photo figcaption { font-size: 13px; color: var(--ink3); margin-top: 10px; }
.when { display: none; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; font-size: 13px; color: var(--ink3); }
.when.needs { display: flex; padding: 10px 12px; border-radius: 12px; background: #FFF7E6; color: var(--gold-t); }
.when input { border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; min-height: 40px; background: #fff; }
.when-go { min-height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: #fff; font-size: 13px; }
.spread-photo:hover .when, .spread-photo:focus-within .when { display: flex; }

.diary-title { border: 0; border-bottom: 1.5px solid var(--line); border-radius: 0; background: transparent; font: 800 22px/1.35 var(--title); padding: 4px 0 8px; outline: none; }
.diary-text {
  width: 100%; border: 0; outline: none; resize: vertical; background-color: transparent;
  font: 17px/32px var(--diary); color: var(--ink); padding: 6px 0 0;
  background-image: repeating-linear-gradient(transparent 0 31px, rgba(154,98,0,.13) 31px 32px);
  background-attachment: local;
}
.foot { display: flex; justify-content: space-between; font-size: 12px; color: var(--ink3); margin: 6px 0 0; }

.says { margin-top: 20px; }
.says-line { margin: 0 0 10px; color: var(--ink2); }
.chips, .choices { display: flex; flex-wrap: wrap; gap: 8px; }
.chips button, .choices button {
  min-height: 44px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); font-size: 14px;
}
.chips button:disabled { opacity: .45; }
.choices button[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.ask { margin-top: 18px; padding: 16px; border-radius: 16px; background: var(--accent-soft); }
.ask-because { font-size: 12px; color: var(--ink3); margin: 0 0 4px; }
.ask-text { font-weight: 600; margin: 0 0 12px; }
.revise { display: flex; gap: 8px; margin-top: 18px; }
.revise button { flex: none; min-height: 48px; padding: 0 16px; border-radius: 12px; border: 1.5px solid var(--ink); background: var(--card); font-weight: 600; }
.note { font-size: 13px; color: var(--ink2); background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin: 10px 0 0; }
.peek { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 10px; }
.peek summary { min-height: 44px; display: flex; align-items: center; color: var(--ink3); font-size: 14px; cursor: pointer; }
.peek-body { padding-bottom: 6px; }
.read-line { font: 15px/1.7 var(--diary); color: var(--ink2); }
.kw { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; }
.kw li { font-size: 12px; padding: 3px 9px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); }
.axis { display: grid; grid-template-columns: 44px 1fr; align-items: center; gap: 10px; font-size: 13px; color: var(--ink3); }
.axis input { accent-color: var(--accent); }
.hint, .meta-line { font-size: 12px; color: var(--ink3); }

/* 저장 후 */
.keepsake { background: #fff; padding: 12px 12px 18px; box-shadow: 0 10px 30px rgba(26,27,46,.12); transform: rotate(-.6deg); }
.keepsake img { width: 100%; max-height: 50vh; object-fit: cover; background: var(--photo); }
.keepsake-body h3 { font: 800 20px/1.35 var(--title); margin: 14px 4px 6px; }
.keepsake-body p { font: 16px/1.8 var(--diary); margin: 0 4px; white-space: pre-wrap; }
.keepsake-foot { display: flex; justify-content: space-between; font: 12px/1.4 var(--body) !important; color: var(--ink3); margin-top: 14px !important; }
.mark { display: inline-flex; align-items: center; gap: 5px; }
.echo { margin-top: 28px; }

/* ── 일기 보기 (L-04) ─────────────────────── */
.entry-photo { background: #fff; padding: 8px; box-shadow: 0 8px 24px rgba(26,27,46,.12); transform: rotate(-.8deg); margin-bottom: 20px; }
.entry-photo img { width: 100%; max-height: 56vh; object-fit: cover; background: var(--photo); }
.entry-photo .swatch { height: 160px; background: var(--photo); }
.entry-when { font-size: 13px; color: var(--ink3); margin: 0 0 6px; }
.entry h2 { font: 800 24px/1.35 var(--title); margin: 0 0 12px; }
.entry .body { font: 17px/32px var(--diary); white-space: pre-wrap; margin: 0; background-image: repeating-linear-gradient(transparent 0 31px, rgba(154,98,0,.13) 31px 32px); }
.entry textarea.body { width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 0 10px; min-height: 220px; background-color: #fff; outline: none; }
.entry input.edit-title { font: 800 22px/1.35 var(--title); border: 0; border-bottom: 1.5px solid var(--gold); background: none; width: 100%; padding: 4px 0 8px; margin-bottom: 12px; outline: none; }
.entry dl { display: grid; grid-template-columns: 96px 1fr; gap: 6px 12px; margin: 24px 0 0; font-size: 14px; padding-top: 18px; border-top: 1px solid var(--line); }
.entry dt { color: var(--ink3); }
.entry dd { margin: 0; color: var(--ink2); }
.entry .bars-big { display: grid; gap: 8px; margin-top: 18px; font-size: 13px; color: var(--ink3); }
.entry .bars-big div { display: grid; grid-template-columns: 44px 1fr; align-items: center; gap: 10px; }
.entry .bars-big i { height: 6px; border-radius: 3px; background: var(--line); position: relative; overflow: hidden; display: block; }
.entry .bars-big b { position: absolute; left: 0; top: 0; bottom: 0; background: var(--c, var(--ink3)); }
.private-note { display: flex; gap: 10px; align-items: center; margin-top: 22px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 3px; background: var(--accent-soft); color: var(--ink2); font-size: 14px; }
.entry-tools { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 22px; }
.entry-tools button { flex: 1; min-height: 48px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); font-weight: 500; }
.entry-tools .danger { color: var(--warn); }
.entry-tools .go { background: var(--ink); color: #fff; border-color: var(--ink); font-weight: 600; }

/* 시트 */
.sheet { position: fixed; inset: 0; z-index: 40; background: rgba(26,27,46,.45); display: flex; align-items: flex-end; justify-content: center; }
.sheet-inner { width: 100%; max-width: 560px; background: var(--paper); border-radius: 22px 22px 0 0; padding: 24px 20px calc(24px + env(safe-area-inset-bottom)); }
.sheet-inner h3 { font: 800 20px/1.4 var(--title); margin: 0 0 8px; }
.sheet-inner p { color: var(--ink2); margin: 0 0 18px; font-size: 14px; }
.sheet-inner .go.danger { background: var(--warn); border-color: var(--warn); }

/* 로그인 없음 */
.gate { position: fixed; inset: 0; z-index: 60; background: var(--leather); display: flex; align-items: center; justify-content: center; padding: 24px; }
.gate-card { text-align: center; color: #F3EFE6; max-width: 320px; }
.gate-card h2 { font: 800 22px/1.4 var(--title); margin: 18px 0 8px; }
.gate-card p { opacity: .8; font-size: 14px; }
.lock-big { display: inline-block; width: 44px; height: 52px; position: relative; color: var(--gold); }
.lock-big::before { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 30px; border-radius: 6px; background: currentColor; }
.lock-big::after { content: ''; position: absolute; left: 8px; right: 8px; top: 0; height: 28px; border: 5px solid currentColor; border-bottom: 0; border-radius: 22px 22px 0 0; }

/* 탭 바 */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; justify-content: center; gap: 0;
  background: rgba(251,250,247,.96); backdrop-filter: blur(8px); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabs button {
  flex: 1; max-width: 180px; min-height: 60px; background: none; border: 0; color: var(--ink3); font-size: 12px; font-weight: 500;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; position: relative;
}
.tabs svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.tabs button.on { color: var(--ink); }
.tabs button.on::before { content: ''; position: absolute; top: 0; width: 28px; height: 3px; border-radius: 0 0 3px 3px; background: var(--gold); }

.toast {
  position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 50;
  background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 12px; font-size: 14px; max-width: calc(100% - 40px);
}

/* 개발용 하단(운영에서는 숨김) */
.bottom { max-width: 560px; margin: 24px auto 0; padding: 0 20px 16px; font-size: 12px; color: var(--ink3); }
.bottom .brand span { margin-left: 6px; padding: 1px 6px; border-radius: 6px; background: var(--line); }

@media (max-width: 380px) {
  .view { padding: 22px 16px; }
  .cover-sub { display: none; }
}
