/* 시안 B: 미니멀 화이트 */
:root {
  --bg: #ffffff;
  --card: #f4f3ef;
  --line: #dedcd4;
  --text: #2c2c2a;
  --sub: #6f6e69;
  --muted: #9c9a92;
  --accent: #2f5fa7;
  --danger: #b03a3a;
  --radius: 12px;
  font-family: 'Pretendard Variable', Pretendard, -apple-system, 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1c1b;
    --card: #2a2a28;
    --line: #3d3d3a;
    --text: #ecebe6;
    --sub: #b0afa8;
    --muted: #807f78;
    --accent: #8ab4f0;
    --danger: #ef8a8a;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
button { font: inherit; color: inherit; background: none; border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px; cursor: pointer; }
button:hover { background: var(--card); }
button.primary { background: var(--text); color: var(--bg); border-color: var(--text); }
button.link { border: none; padding: 4px 6px; color: var(--accent); }
button.danger { color: var(--danger); }
input, textarea { font: inherit; color: inherit; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; width: 100%; }
textarea { resize: vertical; line-height: 1.7; }
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

.wrap { max-width: 560px; margin: 0 auto; padding: 16px 16px 24px; }
h2 { font-size: 13px; font-weight: 500; color: var(--sub); margin: 28px 0 10px; }

/* 날짜 헤더 */
.day-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 8px; }
.day-head .nav { border: none; font-size: 22px; width: 40px; height: 40px; padding: 0; }
.day-head .nav:disabled { opacity: .25; cursor: default; background: none; }
.day-title { flex: 1; border: none; text-align: left; padding: 2px 6px; border-radius: 10px; }
.day-title .md { display: block; font-size: 30px; font-weight: 600; letter-spacing: -0.5px; }
.day-title .caret { font-size: 14px; color: var(--muted); vertical-align: middle; }
.day-title .sub { display: block; font-size: 13px; color: var(--sub); }
.today-chip { font-size: 12px; padding: 4px 10px; }

/* 달력 */
.cal { margin-top: 10px; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.cal[hidden] { display: none; }
.cal-head { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.cal-head .nav { border: none; font-size: 20px; width: 36px; height: 36px; padding: 0; }
.cal-head .nav:disabled { opacity: .25; background: none; cursor: default; }
.cal-head select { flex: 1; font: inherit; color: inherit; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.cal-wd span { font-size: 12px; color: var(--muted); padding: 4px 0; }
.cal-grid button { border: none; border-radius: 8px; padding: 0; height: 40px; position: relative; font-size: 14px; }
.cal-grid button.future { color: var(--muted); }
.cal-grid button.today { outline: 1px solid var(--text); outline-offset: -3px; }
.cal-grid button.has::after { content: ''; position: absolute; left: 50%; bottom: 5px; width: 5px; height: 5px; margin-left: -2.5px; border-radius: 50%; background: var(--accent); }
.cal-grid button.sel { background: var(--text); color: var(--bg); }
.cal-grid button.sel::after { background: var(--bg); }
.cal-grid button:disabled { opacity: .2; cursor: default; background: none; }
.cal-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }

/* 편집 */
.editor { margin-top: 14px; }
.editor textarea { min-height: 160px; }
.editor .row { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; gap: 8px; }
.status { font-size: 12px; color: var(--muted); }
.bullet-tools { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.bullet-tools button { font-size: 12px; padding: 4px 10px; color: var(--sub); }
.bullet-tools .hint { font-size: 12px; color: var(--muted); margin-left: auto; }
.readonly-note { font-size: 13px; color: var(--sub); background: var(--card); border-radius: var(--radius); padding: 12px 14px; margin-top: 14px; }

.photo { margin-top: 10px; display: flex; gap: 10px; align-items: flex-end; }
.photo img { width: 120px; height: 120px; object-fit: cover; border-radius: 10px; cursor: zoom-in; display: block; background: var(--card); }

/* 같은 날 카드 */
.card { background: var(--card); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 10px; display: flex; gap: 12px; }
.card .meta { font-size: 12px; color: var(--sub); margin-bottom: 4px; }
.card .body { white-space: pre-wrap; line-height: 1.65; font-size: 15px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; cursor: pointer; }
.card.open .body { display: block; -webkit-line-clamp: unset; }
.card .thumb { width: 64px; height: 64px; border-radius: 8px; object-fit: cover; flex: none; cursor: zoom-in; }
.card .grow { flex: 1; min-width: 0; }
.empty { font-size: 14px; color: var(--muted); padding: 8px 2px; }

.letter-arrived { border: 1px solid var(--accent); background: transparent; }
.locked .body { color: var(--muted); }

/* 검색 */
.result { cursor: pointer; }
mark { background: #f6e3a1; color: inherit; border-radius: 3px; }

/* 설정 */
.stat { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat div { background: var(--card); border-radius: var(--radius); padding: 10px 12px; }
.stat b { display: block; font-size: 20px; font-weight: 600; }
.stat span { font-size: 12px; color: var(--sub); }
.btns { display: flex; flex-wrap: wrap; gap: 8px; }
.note { font-size: 13px; color: var(--sub); line-height: 1.6; }
.note b { color: var(--text); font-weight: 600; }
.help { background: var(--card); border-radius: var(--radius); padding: 10px 14px; }
.help summary { cursor: pointer; color: var(--text); }

/* 하단 탭 */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; gap: 4px; background: var(--bg); border-top: 1px solid var(--line); padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); }
.tabs button { border: none; flex: 1; max-width: 130px; color: var(--sub); font-size: 15px; padding: 10px 12px; }
.tabs button.on { color: var(--bg); background: var(--text); font-weight: 600; }

.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.85); display: flex; align-items: center; justify-content: center; z-index: 10; cursor: zoom-out; }
.overlay[hidden] { display: none; }
.overlay img { max-width: 96vw; max-height: 92vh; object-fit: contain; }
