/* 4단계: 캘린더 · 메모 · 사진 · 음악 + 공통(보기 전환 · 떠 있는 버튼 · 작은 제목 막대) */

/* 보기 전환 (Segmented) */
.seg { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--white); box-shadow: inset 0 0 0 1px var(--line); }
.seg button { min-width: 64px; height: 28px; padding: 0 14px; border-radius: 999px; font-size: 13px; font-weight: 700; color: var(--text-secondary); transition: background 200ms var(--ease), color 200ms; }
.seg button[aria-selected="true"] { background: var(--brand-blue); color: var(--white); }

/* 떠 있는 버튼 (오늘 · 맨 위로) */
.float-btn {
  position: absolute; z-index: 6; left: 50%; transform: translate(-50%, 16px); opacity: 0; pointer-events: none;
  display: flex; align-items: center; gap: 6px; height: 42px; padding: 0 16px 0 14px; border-radius: 999px;
  background: var(--white); color: var(--brand-blue); font-size: 14px; font-weight: 700;
  box-shadow: 0 4px 14px rgba(30,24,81,.16);
  transition: opacity 200ms var(--ease), transform 200ms var(--ease);
}
.float-btn.on { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.float-btn svg { width: 18px; height: 18px; }

/* 스크롤하면 나타나는 작은 제목 막대 */
.compact-nav {
  position: absolute; z-index: 5; left: 0; right: 0; top: 0;
  height: calc(104px + var(--sat)); padding-top: calc(52px + var(--sat));
  display: flex; align-items: center; justify-content: center;
  background: rgba(241,245,255,.97); box-shadow: inset 0 -1px 0 rgba(181,209,235,.6);
  font-size: 17px; font-weight: 700; letter-spacing: -0.03em;
  opacity: 0; pointer-events: none; transition: opacity 180ms;
}
.compact-nav.on { opacity: 1; }
.app-screen .status-bar, .app-screen .app-head .round-btn { z-index: 7; }
.app-head { position: relative; z-index: 6; }

/* ---------- 캘린더 ---------- */
.cal-top { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px calc(var(--gutter) + var(--sar)) 12px calc(var(--gutter) + var(--sal)); }
.today-chip { display: inline-flex; align-items: center; gap: 8px; height: 33px; padding: 0 14px; border-radius: 999px; background: var(--brand-blue); color: var(--white); font-size: 12px; font-weight: 500; white-space: nowrap; }
.today-chip b { font-weight: 700; }
.month-head { display: flex; align-items: center; justify-content: space-between; padding: 4px calc(var(--gutter) + var(--sar)) 12px calc(var(--gutter) + var(--sal)); }
.month-head h2 { font-size: 20px; font-weight: 700; letter-spacing: -0.04em; }
.month-head .nav { display: flex; gap: 4px; }
.month-head .nav button { width: 36px; height: 36px; border-radius: 50%; background: var(--white); display: grid; place-items: center; color: var(--brand-blue); position: relative; }
.month-head .nav button::after { content: ""; position: absolute; inset: -4px; }
.month-head .nav button:disabled { opacity: .3; }
.month-head .nav svg { width: 20px; height: 20px; }
.month-grid { margin: 0 calc(var(--gutter) + var(--sar)) 0 calc(var(--gutter) + var(--sal)); padding: 12px 0 8px; border-radius: 16px; background: var(--white); touch-action: pan-y; overflow: hidden; }
.month-grid .wk, .month-grid .days { display: grid; grid-template-columns: repeat(7, 1fr); }
.month-grid .wk span { text-align: center; font-size: 12px; font-weight: 700; color: var(--text-tertiary); padding-bottom: 8px; }
.month-grid .wk span:first-child { color: var(--point-red); } .month-grid .wk span:last-child { color: var(--brand-light-blue); }
.day { position: relative; height: 48px; display: flex; flex-direction: column; align-items: center; padding-top: 4px; font-size: 15px; font-weight: 500; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.day .n { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; transition: background 180ms, color 180ms; }
.day.sun { color: var(--point-red); } .day.sat { color: var(--brand-light-blue); }
.day.out { opacity: .3; pointer-events: none; }
.day.today .n { background: #E1E5FC; color: var(--brand-blue); font-weight: 700; }
.day.sel .n { background: var(--brand-blue); color: var(--white); font-weight: 700; }
.day .dots { position: absolute; bottom: 3px; display: flex; gap: 3px; }
.day .dots i { width: 5px; height: 5px; border-radius: 50%; }
.day-title { margin: 20px calc(var(--gutter) + 4px) 10px; font-size: 15px; font-weight: 700; }
.ev-card { margin: 0 calc(var(--gutter) + var(--sar)) 0 calc(var(--gutter) + var(--sal)); background: var(--white); border-radius: 16px; overflow: hidden; }
.ev-row { position: relative; width: 100%; display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 16px; text-align: left; min-height: 68px; }
.ev-row:active { background: #EEF2FC; }
.ev-row + .ev-row::before { content: ""; position: absolute; top: 0; left: 72px; right: 0; height: 1px; background: rgba(181,209,235,.5); }
.ev-row .tile { flex: none; width: 44px; height: 44px; border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--c); background: color-mix(in srgb, var(--c) 12%, white); }
.ev-row .tile b { font-size: 16px; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
.ev-row .tile small { font-size: 10px; font-weight: 600; }
.ev-row .bar { flex: none; width: 4px; height: 40px; border-radius: 2px; background: var(--c); }
.ev-row .txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ev-row .txt b { font-size: 15px; font-weight: 700; letter-spacing: -0.03em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev-row .txt span { font-size: 13px; color: var(--text-secondary); }
.ev-row .chev { color: var(--text-tertiary); width: 20px; height: 20px; flex: none; }
.add-btn { flex: none; width: 36px; height: 36px; border-radius: 50%; background: var(--surface-snow); color: var(--brand-blue); display: grid; place-items: center; position: relative; transition: background 200ms, transform 120ms; }
.add-btn::after { content: ""; position: absolute; inset: -4px; }
.add-btn:active { transform: scale(.9); }
.add-btn svg { width: 16px; height: 16px; }
.add-btn.done { background: var(--brand-blue); color: var(--white); }
.add-btn:disabled { opacity: .35; }
.empty-day { padding: 16px; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.empty-day p { font-size: 15px; font-weight: 500; color: var(--text-secondary); }
.empty-day button { font-size: 13px; font-weight: 700; color: var(--brand-blue); text-align: left; }
.month-label { margin: 20px calc(var(--gutter) + 4px) 8px; font-size: 20px; font-weight: 700; letter-spacing: -0.04em; }
.cal-hint { margin: 16px calc(var(--gutter) + 4px) 0; font-size: 12px; color: var(--text-secondary); }
.ev-detail .meta { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 500; }
.dday-pill { height: 22px; padding: 0 10px; border-radius: 999px; background: rgba(255,108,108,.12); color: #E04D4D; font-size: 13px; font-weight: 700; line-height: 22px; }
.ev-detail p.desc { font-size: 15px; line-height: 1.55; color: var(--text-secondary); }
.ev-detail .btns { display: flex; flex-direction: column; gap: 8px; }

/* ---------- 메모 ---------- */
.memo-row { width: 100%; display: flex; flex-direction: column; gap: 2px; padding: 14px 20px; text-align: left; position: relative; }
.memo-row:active { background: #EEF2FC; }
.memo-row + .memo-row::before { content: ""; position: absolute; top: 0; left: 20px; right: 0; height: 1px; background: rgba(181,209,235,.5); }
.memo-row .top { display: flex; justify-content: space-between; gap: 8px; }
.memo-row b { font-size: 15px; font-weight: 700; }
.memo-row .d { font-size: 12px; font-weight: 500; color: var(--text-secondary); white-space: nowrap; }
.memo-row span { font-size: 14px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.letter { padding: 8px calc(24px + var(--sar)) 24px calc(24px + var(--sal)); display: flex; flex-direction: column; }
.letter .date { font-size: 12px; font-weight: 500; color: var(--text-secondary); }
.letter h2 { margin-top: 6px; font-size: 28px; font-weight: 700; letter-spacing: -0.05em; }
.letter .body { margin-top: 18px; font-size: 16px; line-height: 1.6; letter-spacing: -0.03em; white-space: pre-line; user-select: text; -webkit-user-select: text; word-break: keep-all; }
.letter .sign { margin-top: 14px; display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 700; }
.letter .sign img { width: 35px; }

/* ---------- 사진 ---------- */
.ph-sub { padding: 0 calc(var(--gutter) + 4px) 4px; font-size: 13px; font-weight: 500; color: var(--text-secondary); }
.ph-sec { padding: 16px calc(var(--gutter) + var(--sar)) 0 calc(var(--gutter) + var(--sal)); }
.ph-sec h3 { font-size: 15px; font-weight: 700; margin-bottom: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.grid3 button { aspect-ratio: 1; background: var(--brand-sky) center / cover no-repeat; transition: filter 120ms; }
.grid3 button:active { filter: brightness(.85); }
.h-scroll { display: flex; gap: 12px; overflow-x: auto; padding: 0 calc(var(--gutter) + var(--sar)) 4px calc(var(--gutter) + var(--sal)); scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior-x: contain; touch-action: pan-x pan-y; }
.h-scroll::-webkit-scrollbar { display: none; }
.h-scroll > * { scroll-snap-align: start; }
.sec-head { display: flex; justify-content: space-between; align-items: baseline; padding: 20px calc(var(--gutter) + var(--sar)) 12px calc(var(--gutter) + var(--sal)); }
.sec-head h3 { font-size: 17px; font-weight: 700; }
.sec-head button { font-size: 14px; font-weight: 500; color: var(--brand-blue); }
.album { flex: none; width: 150px; display: flex; flex-direction: column; gap: 4px; text-align: left; }
.album .cover { position: relative; width: 150px; height: 150px; border-radius: 12px; background: var(--brand-sky) center / cover; overflow: hidden; margin-bottom: 4px; }
.album .cover.locked::after { content: ""; position: absolute; inset: 0; background: rgba(30,24,81,.55); }
.album .cover .lock { position: absolute; z-index: 1; left: 50%; top: 50%; width: 44px; height: 44px; margin: -22px 0 0 -22px; border-radius: 50%; background: rgba(255,255,255,.92); display: grid; place-items: center; color: var(--brand-blue); }
.album .cover .lock svg { width: 24px; height: 24px; }
.album b { font-size: 15px; font-weight: 700; }
.album span { font-size: 12px; font-weight: 500; color: var(--text-secondary); }
.album span.accent { color: var(--brand-blue); }
.person { flex: none; width: 64px; display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; }
.person .face { width: 64px; height: 64px; border-radius: 50%; background: var(--brand-sky) center / cover; }
.places { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 0 calc(var(--gutter) + var(--sar)) 24px calc(var(--gutter) + var(--sal)); }
.place { position: relative; height: 112px; border-radius: 12px; overflow: hidden; background: var(--brand-sky) center / cover; text-align: left; }
.place::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(30,24,81,0) 0%, rgba(30,24,81,.7) 100%); }
.place b { position: absolute; z-index: 1; left: 12px; bottom: 12px; color: var(--white); font-size: 15px; font-weight: 700; }
.search-field { margin: 4px calc(var(--gutter) + var(--sar)) 0 calc(var(--gutter) + var(--sal)); height: 44px; display: flex; align-items: center; gap: 8px; padding: 0 14px; border-radius: 12px; background: var(--white); box-shadow: inset 0 0 0 1px var(--line); }
.search-field svg { width: 20px; height: 20px; color: var(--text-tertiary); flex: none; }
.search-field input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font: inherit; font-size: 16px; color: var(--text-primary); user-select: text; -webkit-user-select: text; }
.search-field input::placeholder { color: var(--text-tertiary); }
.search-field .clear { width: 24px; height: 24px; border-radius: 50%; background: #E3E8F4; color: var(--text-secondary); display: grid; place-items: center; }
.search-field .clear svg { width: 12px; height: 12px; color: inherit; }
.kw { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 calc(var(--gutter) + var(--sar)) 0 calc(var(--gutter) + var(--sal)); }
.kw .chip { height: 40px; font-size: 14px; }
.kw .chip[aria-pressed="true"] { background: var(--brand-blue); color: var(--white); box-shadow: none; }
.no-result { padding: 24px; text-align: center; font-size: 15px; color: var(--text-secondary); }

/* 사진 보기 */
.viewer { position: absolute; inset: 0; z-index: 30; display: flex; flex-direction: column; color: var(--white); touch-action: none; }
.viewer .v-bg { position: absolute; inset: 0; background: #0D0B21; }
.viewer .v-blur { position: absolute; inset: -60px; background: center / cover; filter: blur(40px); opacity: .5; transition: background-image 300ms; }
.viewer > *:not(.v-bg):not(.v-blur) { position: relative; }
.viewer .v-head { flex: none; display: flex; align-items: center; justify-content: center; height: calc(104px + var(--sat)); padding-top: calc(52px + var(--sat)); }
.viewer .v-head .close { position: absolute; left: calc(16px + var(--sal)); top: calc(62px + var(--sat)); width: 40px; height: 40px; border-radius: 50%; background: rgba(255,255,255,.14); display: grid; place-items: center; }
.viewer .v-head .close svg { width: 20px; height: 20px; }
.viewer .v-head .t { text-align: center; }
.viewer .v-head .t b { display: block; font-size: 15px; }
.viewer .v-head .t span { font-size: 12px; opacity: .6; }
.viewer .stage-ph { flex: 1; min-height: 0; position: relative; overflow: hidden; }
.viewer .track { position: absolute; inset: 0; display: flex; will-change: transform; }
.viewer .slide { flex: 0 0 100%; min-width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.viewer .slide img { width: 100%; height: auto; max-height: 100%; aspect-ratio: 4/5; object-fit: cover; transform-origin: center; will-change: transform; }
.viewer .thumbs { flex: none; display: flex; justify-content: center; align-items: center; gap: 4px; padding: 14px 0; overflow: hidden; }
.viewer .thumbs button { width: 34px; height: 34px; border-radius: 6px; background: center / cover; opacity: .5; flex: none; transition: all 200ms; }
.viewer .thumbs button.on { width: 44px; height: 44px; border-radius: 8px; opacity: 1; box-shadow: inset 0 0 0 2px var(--white); }
.viewer .v-actions { flex: none; display: flex; justify-content: center; gap: 24px; padding-top: 4px; }
.viewer .v-actions button { width: 44px; height: 44px; border-radius: 50%; background: rgba(255,255,255,.14); display: grid; place-items: center; transition: transform 120ms; }
.viewer .v-actions button:active { transform: scale(.9); }
.viewer .v-actions svg { width: 22px; height: 22px; }
.viewer .v-actions .like[aria-pressed="true"] { color: var(--point-pink); }
.viewer .v-note { flex: none; text-align: center; font-size: 12px; font-weight: 500; opacity: .45; padding: 10px 24px calc(14px + var(--sab)); }

/* ---------- 음악 ---------- */
.music { display: flex; flex-direction: column; align-items: center; padding: 8px calc(var(--gutter) + var(--sar)) 24px calc(var(--gutter) + var(--sal)); }
.music .cover { position: relative; margin-top: 16px; width: min(240px, 60vw); aspect-ratio: 1; border-radius: 24px; border: 1.5px dashed var(--brand-light-blue); background: var(--brand-sky); display: grid; place-items: center; text-align: center; font-size: 12px; font-weight: 500; color: var(--brand-blue); padding: 16px; line-height: 1.5; }
.music .cover img { position: absolute; right: -14px; top: -14px; width: 42px; }
.music h2 { margin-top: 20px; font-size: 20px; font-weight: 700; letter-spacing: -0.04em; }
.music .sub { margin-top: 6px; font-size: 14px; color: var(--text-secondary); }
.tracks { width: 100%; margin-top: 20px; background: var(--white); border-radius: 16px; overflow: hidden; }
.trk { width: 100%; display: flex; align-items: center; gap: 14px; padding: 14px 16px; text-align: left; position: relative; }
.trk:active { background: #EEF2FC; }
.trk + .trk::before { content: ""; position: absolute; top: 0; left: 46px; right: 0; height: 1px; background: rgba(181,209,235,.5); }
.trk .no { width: 16px; font-size: 14px; font-weight: 700; color: var(--brand-blue); text-align: center; }
.trk .nm { flex: 1; font-size: 15px; font-weight: 500; }
.trk svg { width: 18px; height: 18px; color: var(--text-tertiary); }
