@import url("fonts/gowun-dodum.css");

/* 심플 모노톤: 따뜻한 종이색 바탕 + 먹색 선 */
:root {
  --bg: #f7f5f0; --card: #fffefb; --ink: #1f1d1a; --text: #1f1d1a; --sub: #8b867e; --line: #e4dfd6;
  --soft: #efebe3; --on-ink: #fffefb; --sun: #b0563e; --land: #e3ddd1; --visited: #4a4640;
  --radius: 18px;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #151413; --card: #1e1d1b; --ink: #f2efe9; --text: #f2efe9; --sub: #9b968e; --line: #34312d;
    --soft: #2a2825; --on-ink: #151413; --sun: #e08a72; --land: #3a3631; --visited: #cfc9bf; }
}
/* 테마 (설정 → 우리 앱 꾸미기). 종이는 기본값이라 기기 다크모드를 따라가요 */
:root[data-theme="white"] { --bg: #ffffff; --card: #ffffff; --ink: #111111; --text: #111111; --sub: #8a8a8a; --line: #e6e6e6;
  --soft: #f2f2f2; --on-ink: #ffffff; --sun: #c0392b; --land: #e4e4e4; --visited: #333333; }
:root[data-theme="ink"] { --bg: #151413; --card: #1e1d1b; --ink: #f2efe9; --text: #f2efe9; --sub: #9b968e; --line: #34312d;
  --soft: #2a2825; --on-ink: #151413; --sun: #e08a72; --land: #3a3631; --visited: #cfc9bf; }
:root[data-theme="sage"] { --bg: #f1f4ef; --card: #fbfcfa; --ink: #2f3d31; --text: #2f3d31; --sub: #7f8c80; --line: #dbe3d8;
  --soft: #e6ece3; --on-ink: #fbfcfa; --sun: #b0563e; --land: #dde4d8; --visited: #5b745e; }
:root[data-theme="sky"] { --bg: #f0f4f8; --card: #fbfdff; --ink: #24364a; --text: #24364a; --sub: #7d8b99; --line: #d9e2eb;
  --soft: #e4ebf2; --on-ink: #fbfdff; --sun: #b0563e; --land: #dae3ec; --visited: #4f6f8f; }
:root[data-theme="lavender"] { --bg: #f4f2f8; --card: #fdfcff; --ink: #3a3350; --text: #3a3350; --sub: #8a849a; --line: #e2deeb;
  --soft: #ebe8f2; --on-ink: #fdfcff; --sun: #b0563e; --land: #e3dfec; --visited: #6e6294; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { display: flex; align-items: center; gap: 6px; padding: 6px 12px 6px 6px; font-size: 13px; }
.swatch i { width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--line); display: block; }
.swatch img { width: 26px; height: 26px; border-radius: 7px; }
.swatch.on { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.swatch[data-t="paper"] i { background: linear-gradient(135deg, #f7f5f0 50%, #1f1d1a 50%); }
.swatch[data-t="white"] i { background: linear-gradient(135deg, #ffffff 50%, #111 50%); }
.swatch[data-t="ink"] i { background: linear-gradient(135deg, #151413 50%, #f2efe9 50%); }
.swatch[data-t="sage"] i { background: linear-gradient(135deg, #f1f4ef 50%, #2f3d31 50%); }
.swatch[data-t="sky"] i { background: linear-gradient(135deg, #f0f4f8 50%, #24364a 50%); }
.swatch[data-t="lavender"] i { background: linear-gradient(135deg, #f4f2f8 50%, #3a3350 50%); }

/* 오늘의 질문 */
.qa { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; padding: 12px; border-radius: 12px; background: var(--soft); }
.qa-wait { aspect-ratio: auto; padding: 16px; border-radius: 12px; }

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font-family: "Gowun Dodum", -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif; letter-spacing: -.01em; }
body { padding: env(safe-area-inset-top) 0 calc(76px + env(safe-area-inset-bottom)); -webkit-tap-highlight-color: transparent; }
#app { max-width: 520px; margin: 0 auto; padding: 18px 16px; }
h1 { font-size: 24px; font-weight: 400; margin: 6px 0 18px; }
h2 { font-size: 17px; font-weight: 400; margin: 0 0 12px; }
b, strong { font-weight: 400; }
p.sub, .sub { color: var(--sub); font-size: 13px; }

.card { background: var(--card); border: 1.5px solid var(--ink); border-radius: var(--radius); padding: 18px; margin-bottom: 14px; }
.card.tap { cursor: pointer; }
.row { display: flex; align-items: center; gap: 8px; }
.row.between { justify-content: space-between; }
.row > input, .row > select { flex: 1; min-width: 0; }
.row > button { flex: none; white-space: nowrap; }
.stack > * + * { margin-top: 10px; }

input, select, button, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
input, select, textarea { width: 100%; padding: 11px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ink); }
label { display: block; font-size: 13px; color: var(--sub); margin-bottom: 4px; }
button { border: 1px solid var(--line); border-radius: 999px; padding: 10px 16px; background: var(--card); cursor: pointer; }
button.primary { background: var(--ink); color: var(--on-ink); border-color: var(--ink); width: 100%; border-radius: 14px; padding: 13px; }
button.primary:active { opacity: .85; }
button.ghost { background: transparent; border-color: transparent; color: var(--sub); padding: 8px; }
button.small { padding: 6px 12px; font-size: 13px; }
button:disabled { opacity: .45; }
.link { background: none; border: 0; color: var(--text); padding: 4px; text-decoration: underline; text-underline-offset: 3px; }

/* 디데이 */
.dday-hero { text-align: center; padding: 26px 18px; }
.dday-hero .names { font-size: 14px; color: var(--sub); }
.dday-hero .big { font-size: 48px; color: var(--ink); margin: 4px 0; letter-spacing: -.02em; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px dashed var(--line); }
.list li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.badge { font-size: 13px; color: var(--ink); white-space: nowrap; }
.badge.past { color: var(--sub); }

/* 화면 전환: 살짝 떠오르며 나타나기 */
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
#app.anim > * { animation: rise .22s ease-out both; }
@media (prefers-reduced-motion: reduce) { #app > *, .home-grid.editing .hb { animation: none !important; } }

/* 홈 그리드: 가로 꽉(full) / 반쪽(half) */
.home-head { margin-bottom: 4px; }
.hint { font-size: 11px; color: var(--sub); margin: 0 0 12px; text-align: right; }
.home-grid { display: grid; grid-template-columns: 1fr 1fr; grid-auto-flow: row dense; gap: 12px; margin-bottom: 14px; }
.hb { position: relative; min-width: 0; -webkit-touch-callout: none; user-select: none; -webkit-user-select: none; }
.hb.full { grid-column: 1 / -1; }
.hb > .card, .hb > .home-pair { margin: 0; height: 100%; }
.card.mini { width: 100%; text-align: left; display: flex; flex-direction: column; gap: 6px; padding: 16px; }
.card.mini h2 { font-size: 15px; margin: 0; }
.card.mini .list li { padding: 6px 0; font-size: 13px; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-map .map-svg.mini { margin-top: auto; }

/* 편집 모드: 흔들흔들 */
@keyframes jiggle { 0% { transform: rotate(-.35deg); } 50% { transform: rotate(.35deg); } 100% { transform: rotate(-.35deg); } }
.home-grid.editing .hb { animation: jiggle .5s ease-in-out infinite; touch-action: pan-y; cursor: grab; }
.home-grid.editing .hb:nth-child(2n) { animation-delay: -.25s; }
.home-grid.editing .hb.lifted { animation: none; transform: scale(1.03); transition: transform .12s; }
.home-grid.editing .hb > *:not(.hb-x):not(.hb-size) { pointer-events: none; }
.hb-size { position: absolute; top: -8px; right: -8px; z-index: 2; min-width: 34px; height: 26px; padding: 0 6px; border-radius: 13px;
  background: var(--card); color: var(--ink); border: 1.5px solid var(--ink); font-size: 11px; line-height: 1; letter-spacing: -1px; }
.dday-mini .budget-total { font-size: 34px; }
.album-mini img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; display: block; }
.q-mini { font-size: 14px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.home-grid.editing .hb.dragging { animation: none; z-index: 5; opacity: .92; cursor: grabbing; transition: none; }
.home-grid.editing .hb.dragging > .card { box-shadow: 0 12px 30px rgba(0,0,0,.18); }
.hb-x { position: absolute; top: -8px; left: -8px; z-index: 2; width: 26px; height: 26px; padding: 0; border-radius: 50%;
  background: var(--ink); color: var(--on-ink); border: 2px solid var(--bg); font-size: 16px; line-height: 1; }
.done-btn { background: var(--ink); color: var(--on-ink); border-color: var(--ink); padding: 8px 18px; }

/* 디데이: 사진 배경 */
.dday-hero { position: relative; overflow: hidden; }
.dday-hero .dday-in { position: relative; }
.dday-hero .since { font-size: 13px; color: var(--sub); }
.dday-hero.with-photo { min-height: 220px; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 26px; }
.dday-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.dday-hero.with-photo::before { content: ''; position: absolute; inset: 0; z-index: 1; background: linear-gradient(to top, rgba(0,0,0,.55), rgba(0,0,0,0) 65%); }
.dday-hero.with-photo .dday-in { z-index: 2; color: #fff; }
.dday-hero.with-photo .names, .dday-hero.with-photo .since, .dday-hero.with-photo .big { color: #fff; }

/* 콕 찌르기 */
.poke-last { display: flex; align-items: center; gap: 8px; padding: 12px; border-radius: 12px; background: var(--soft); flex-wrap: wrap; }
.poke-last b { font-size: 17px; flex: 1; min-width: 0; overflow-wrap: anywhere; }

/* 추억 카드 */
.memory-card { position: relative; width: 100%; padding: 0; overflow: hidden; display: block; min-height: 120px; text-align: left; }
.memory-card img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; display: block; }
.memory-card.mini img { aspect-ratio: 1; }
.memory-card img + .memory-text { position: absolute; left: 0; right: 0; bottom: 0; padding: 16px 18px; color: #fff; background: linear-gradient(to top, rgba(0,0,0,.55), transparent); }
.memory-text { display: flex; flex-direction: column; gap: 2px; padding: 18px; }
.memory-text span { font-size: 12px; opacity: .85; }
.memory-text b { font-size: 18px; }

/* 연말 결산 */
.recap-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.recap-stat { margin: 0; display: flex; flex-direction: column; gap: 4px; padding: 16px; }
.recap-stat small { font-size: 12px; color: var(--sub); }
.recap-stat b { font-size: 26px; letter-spacing: -.02em; }
.recap-stat .sub { font-size: 12px; overflow-wrap: anywhere; }

/* 홈 블록 */
.banner { width: 100%; display: flex; align-items: center; gap: 10px; text-align: left; padding: 14px 18px; margin-bottom: 14px;
  border: 1.5px dashed var(--ink); border-radius: var(--radius); background: var(--card); font-size: 20px; }
.banner b { font-size: 15px; }
.today-card { position: relative; width: 100%; padding: 0; overflow: hidden; display: block; aspect-ratio: 4 / 3; }
.today-card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.today-text { position: absolute; left: 18px; bottom: 14px; color: #fff; text-align: left; text-shadow: 0 1px 8px rgba(0,0,0,.45); display: flex; flex-direction: column; line-height: 1; }
.today-text span { font-size: 14px; margin-bottom: 4px; }
.today-text b { font-size: 56px; }
.halves { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0; }
.half { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 12px; display: block; }
.empty-box { border: 1.5px dashed var(--line); display: flex; align-items: center; justify-content: center; text-align: center; padding: 10px; font-size: 12px; color: var(--sub); }
.mini-map { width: 100%; text-align: left; display: block; }
.map-svg.mini { margin-top: 12px; pointer-events: none; }
.map-svg.mini path { stroke: var(--card); stroke-width: .5; }

/* 캘린더 */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-grid .dow { text-align: center; font-size: 12px; color: var(--sub); padding: 4px 0; }
.cal-grid { gap: 2px; }
.cal-day { min-height: 64px; border-radius: 10px; border: 0; background: transparent; padding: 3px 1px; display: flex; flex-direction: column;
  align-items: stretch; gap: 2px; font-size: 13px; position: relative; overflow: hidden; }
.cal-day .n { align-self: center; }
.cal-day .lbl { position: relative; z-index: 1; font-size: 9.5px; line-height: 1.35; padding: 0 3px; border-radius: 4px; background: var(--soft);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left; }
.cal-day .lbl.mine { background: transparent; border: 1px solid var(--line); }
.cal-day .more { font-size: 9px; color: var(--sub); text-align: center; }
.cal-day.has-photo img { opacity: 1; filter: none; }
.cal-day.has-photo .n { color: #fff; text-shadow: 0 0 4px rgba(0,0,0,.6); }
.cal-day.has-photo.today .n { background: #fff; color: #111; text-shadow: none; }
.switch { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--sub); margin: 0; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch i { width: 34px; height: 20px; border-radius: 20px; background: var(--line); position: relative; transition: background .15s; }
.switch i::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--card); transition: left .15s; }
.switch input:checked + i { background: var(--ink); }
.switch input:checked + i::after { left: 16px; }
.switch input:focus-visible + i { outline: 2px solid var(--ink); outline-offset: 2px; }
.cal-day.other { opacity: .3; }
.cal-day .n { width: 24px; height: 24px; line-height: 24px; text-align: center; position: relative; z-index: 1; border-radius: 50%; }
.cal-day.today .n { background: var(--ink); color: var(--on-ink); }
.cal-day.sel { outline: 1.5px solid var(--ink); }
.cal-day .dots { display: flex; gap: 2px; position: relative; z-index: 1; }
.cal-day .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--ink); }
.cal-day .dot.mine { background: transparent; border: 1px solid var(--ink); }
.cal-day img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .4; filter: grayscale(.3); }
.cal-day.sun .n { color: var(--sun); }
.cal-day.today.sun .n { color: var(--on-ink); }
.seg { display: flex; gap: 6px; margin-bottom: 14px; }
.seg button { flex: 1; padding: 9px; font-size: 14px; }
.seg button.on, .chips button.on { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
.thumb { width: 52px; height: 52px; border-radius: 10px; object-fit: cover; cursor: pointer; border: 1px solid var(--line); }
.home-photo { width: 100%; max-height: 300px; object-fit: cover; border-radius: 12px; display: block; }

/* 버킷 */
.check { width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid var(--ink); background: transparent; padding: 0; flex: none; font-size: 13px; line-height: 1; }
.check.on { background: var(--ink); color: var(--on-ink); }
.done-text { text-decoration: line-through; color: var(--sub); }
.progress { height: 6px; background: var(--soft); border-radius: 6px; overflow: hidden; margin-top: 10px; }
.progress > i { display: block; height: 100%; background: var(--ink); }

/* 탭바 */
#tabbar { position: fixed; left: 0; right: 0; bottom: 0; display: flex; background: var(--card); border-top: 1.5px solid var(--ink);
  padding-bottom: env(safe-area-inset-bottom); z-index: 10; }
#tabbar button { flex: 1; background: none; border: 0; border-radius: 0; padding: 9px 0 10px; display: flex; flex-direction: column; align-items: center; gap: 3px; color: var(--sub); }
#tabbar svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
#tabbar button span { font-size: 11px; }
#tabbar button.on { color: var(--ink); }
#tabbar[hidden], #toast[hidden] { display: none; }
#toast { position: fixed; left: 50%; bottom: calc(92px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: var(--on-ink);
  padding: 10px 18px; border-radius: 999px; font-size: 14px; z-index: 20; max-width: 90vw; }
.code { font-size: 26px; letter-spacing: 4px; text-align: center; padding: 14px; border: 1.5px dashed var(--ink); border-radius: 12px; }

/* 사진 크게 보기 */
.viewer { position: fixed; inset: 0; background: rgba(10,10,10,.92); display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 30; }
.viewer img { max-width: 100%; max-height: calc(100% - 70px); }
.viewer-bar { display: flex; gap: 8px; padding: 12px; flex-wrap: wrap; justify-content: center; }
.viewer-bar button { background: transparent; color: #fff; border-color: rgba(255,255,255,.5); }

/* 앨범 */
.chips { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 12px; padding-bottom: 4px; }
.chips button { flex: none; padding: 7px 14px; font-size: 14px; white-space: nowrap; }
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; border-radius: 14px; overflow: hidden; margin-bottom: 14px; }
.photo-cell { padding: 0; border: 0; border-radius: 0; aspect-ratio: 1; position: relative; overflow: hidden; background: var(--soft); }
.photo-cell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-cell .src { position: absolute; right: 4px; bottom: 4px; font-size: 10px; color: #fff; background: rgba(0,0,0,.45); border-radius: 8px; padding: 1px 6px; }

/* 사진 일기장 타임라인 */
.timeline { display: flex; flex-direction: column; gap: 12px; }
.tl-row { display: flex; gap: 10px; align-items: flex-start; }
.tl-date { flex: none; width: 46px; text-align: center; background: var(--card); border: 1.5px solid var(--ink); border-radius: 12px; padding: 6px 0;
  display: flex; flex-direction: column; line-height: 1.25; position: sticky; top: 8px; }
.tl-date b { font-size: 19px; }
.tl-date small { font-size: 10px; color: var(--sub); }
.tl-card { flex: 1; min-width: 0; text-align: left; padding: 10px; margin: 0; display: block; border-radius: var(--radius); }
.tl-cover { position: relative; border-radius: 12px; overflow: hidden; margin-bottom: 10px; }
.tl-cover img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; }
.tl-cover .cnt { position: absolute; right: 8px; bottom: 8px; background: rgba(0,0,0,.5); color: #fff; font-size: 12px; padding: 2px 8px; border-radius: 10px; }
.tl-title { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.tl-excerpt { margin: 0 0 6px; color: var(--sub); font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-line; }
.chip { font-size: 11px; color: var(--ink); border: 1px solid var(--ink); border-radius: 10px; padding: 1px 7px; white-space: nowrap; }
.diary-body { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.75; }
.pic-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.pic-grid .photo-cell { border-radius: 10px; }
.pic-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.pp { position: relative; width: 72px; height: 72px; border-radius: 10px; overflow: hidden; background: var(--soft); padding: 0; border: 0; flex: none; }
.pp img { width: 100%; height: 100%; object-fit: cover; }
.pp button { position: absolute; top: 3px; right: 3px; padding: 0; width: 22px; height: 22px; border: 0; border-radius: 50%; background: rgba(0,0,0,.55); color: #fff; font-size: 12px; }
.pp.add { font-size: 24px; color: var(--sub); border: 1.5px dashed var(--sub); background: transparent; }
textarea { resize: vertical; line-height: 1.6; }

/* 지도 */
.map-card { padding: 8px; }
.map-svg { width: 100%; height: auto; display: block; }
.map-svg .rg { stroke: var(--card); stroke-width: .8; vector-effect: non-scaling-stroke; cursor: pointer; transition: opacity .15s; }
.map-svg.world .rg { stroke-width: .5; }
.map-svg .rg.dim { opacity: .25; }
.map-svg .rg.sel { stroke: var(--ink); stroke-width: 2; }
.map-svg .rg:hover { opacity: .8; }
.map-card { position: relative; }
.map-svg { max-height: 62vh; }
.map-svg .rg.sel { stroke: var(--ink); stroke-width: 2.5; transform-box: fill-box; transform-origin: center; animation: pop .35s ease-out; }
@keyframes pop { 0% { transform: scale(1); } 45% { transform: scale(1.08); } 100% { transform: scale(1); } }
.map-svg .rg.photo { stroke: var(--card); }
.map-svg .dot { fill: var(--land); stroke: var(--sub); stroke-width: .8; vector-effect: non-scaling-stroke; cursor: pointer; }
.map-svg .dot.on { fill: var(--visited); stroke: var(--card); }
.map-reset { position: absolute; right: 10px; bottom: 10px; width: 34px; height: 34px; padding: 0; border-radius: 50%; background: var(--card); font-size: 16px; }
.mini-seg { margin: 0; gap: 4px; }
.mini-seg button { flex: none; padding: 6px 14px; font-size: 13px; }
.map-stat-big { margin: 12px 0 10px; color: var(--sub); font-size: 13px; }
.map-stat-big b { font-size: 28px; color: var(--ink); font-weight: 400; letter-spacing: -.02em; }
.gchips { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 8px; margin-bottom: 6px; scrollbar-width: none; }
.gchips::-webkit-scrollbar { display: none; }
.gchip { flex: none; display: grid; grid-template-columns: auto auto; column-gap: 6px; row-gap: 4px; align-items: center; padding: 7px 12px; border-radius: 14px; font-size: 13px; }
.gchip small { font-size: 11px; color: var(--sub); }
.gchip .gbar { grid-column: 1 / -1; display: block; height: 3px; border-radius: 3px; background: var(--soft); overflow: hidden; }
.gchip .gbar b { display: block; height: 100%; background: var(--ink); }
.gchip.on { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
.gchip.on small { color: var(--on-ink); opacity: .7; }
.gchip.on .gbar { background: rgba(255,255,255,.25); }
.gchip.on .gbar b { background: var(--on-ink); }

/* 아래에서 올라오는 창 */
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: none; } }
.sheet { position: fixed; left: 0; right: 0; bottom: calc(58px + env(safe-area-inset-bottom)); z-index: 15; max-width: 520px; margin: 0 auto;
  max-height: 52vh; overflow-y: auto; overscroll-behavior: contain; background: var(--card); border: 1.5px solid var(--ink); border-bottom: 0;
  border-radius: 22px 22px 0 0; padding: 6px 18px 20px; box-shadow: 0 -8px 30px rgba(0,0,0,.12); animation: sheet-up .25s ease-out; }
.sheet .home-photo { max-height: 140px; }
.sheet-handle { width: 44px; height: 5px; border-radius: 5px; background: var(--line); margin: 4px auto 6px; cursor: grab; touch-action: none; padding: 8px 0; background-clip: content-box; }
#app:has(.sheet) { padding-bottom: 50vh; }

/* 불러오는 중 */
@keyframes shimmer { 0% { background-position: -200px 0; } 100% { background-position: 200px 0; } }
.skeleton { background: linear-gradient(90deg, var(--soft) 0, var(--card) 50%, var(--soft) 100%); background-size: 400px 100%; animation: shimmer 1.2s infinite linear; border-color: var(--line); }
.map-skel { height: 420px; }

.cities .city { fill: var(--card); stroke: var(--ink); stroke-width: 1.2; vector-effect: non-scaling-stroke; pointer-events: none; }
.cities .city.on { fill: var(--ink); }
.cities .city-hit { fill: transparent; cursor: pointer; }
.cities text { fill: var(--ink); pointer-events: none; paint-order: stroke; stroke: var(--card); stroke-width: .25em; stroke-linejoin: round; }
.city-chips { display: flex; flex-direction: column; gap: 6px; }
.map-labels text { fill: var(--ink); pointer-events: none; paint-order: stroke; stroke: var(--card); stroke-width: .25em; stroke-linejoin: round; }
.cover-prev { width: 100%; max-height: 260px; display: block; }
.slider { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 13px; }
.slider input { flex: 1; padding: 0; border: 0; background: none; accent-color: var(--ink); }
select.sido { width: auto; padding: 8px 12px; }
.map-stat { font-size: 13px; color: var(--sub); white-space: nowrap; }
.map-stat b { color: var(--ink); font-size: 16px; }
.list li.rec { align-items: flex-start; }
.list li.tap { cursor: pointer; }
.rec-pics { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }

/* 기록 블록 공통 */
.stars { letter-spacing: 1px; font-size: 13px; color: var(--ink); white-space: nowrap; }
.stars.pick button { border: 0; background: none; padding: 2px; font-size: 24px; line-height: 1; color: var(--ink); }
.ph { display: flex; align-items: center; justify-content: center; background: var(--soft); color: var(--sub); font-size: 12px; }
.btn-link { display: block; text-align: center; padding: 11px; border: 1px solid var(--ink); border-radius: 14px; color: var(--ink); text-decoration: none; }

/* 맛집 */
.place-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.place-card { padding: 0; overflow: hidden; border: 1.5px solid var(--ink); border-radius: var(--radius); background: var(--card); text-align: left; display: flex; flex-direction: column; }
.place-card img, .place-card .ph { width: 100%; aspect-ratio: 1; object-fit: cover; display: flex; }
.pc-body { padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 4px; }
.pc-body b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 문화 */
.culture-row { width: 100%; display: flex; gap: 12px; align-items: flex-start; text-align: left; padding: 10px; margin: 0; }
.culture-row img, .culture-row .ph { width: 56px; height: 76px; border-radius: 8px; object-fit: cover; flex: none; }
.culture-row .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.review { font-size: 13px; margin-top: 4px; overflow-wrap: anywhere; }

/* 가계부 */
.budget-total { font-size: 30px; letter-spacing: -.02em; }
.budget-total.small { font-size: 22px; margin-top: 2px; }
.bars { display: flex; flex-direction: column; gap: 6px; }
.bar-row { display: grid; grid-template-columns: 56px 1fr auto; gap: 8px; align-items: center; font-size: 13px; }
.bar { height: 8px; background: var(--soft); border-radius: 8px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--ink); }
.budget-head { width: 100%; display: flex; align-items: center; gap: 10px; border: 0; padding: 0; background: none; text-align: left; border-radius: 0; }

/* 홈 2칸 카드 */
.home-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.home-pair .card { margin: 0; text-align: left; display: block; width: 100%; }
.boxes { display: flex; gap: 6px; }
.box { flex: 1; border: 1px dashed var(--line); border-radius: 10px; padding: 6px 4px; text-align: center; display: flex; flex-direction: column; }
.box small { font-size: 10px; color: var(--sub); }

.empty { text-align: center; color: var(--sub); padding: 18px 0; font-size: 14px; }

/* ── 9단계 ── */
button.danger { color: var(--sun); border-color: var(--sun); background: transparent; }
.photo-cell .play { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 34px; height: 34px; border-radius: 50%;
  background: rgba(0,0,0,.5); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 13px; padding-left: 2px; }
.viewer video { max-width: 100%; max-height: calc(100% - 70px); background: #000; }
details.privacy summary { cursor: pointer; list-style: none; font-size: 15px; }
details.privacy summary::-webkit-details-marker { display: none; }
details.privacy summary::after { content: ' ›'; color: var(--sub); }
details.privacy[open] summary::after { content: ' ⌄'; }
.privacy-list { margin: 0; padding-left: 18px; line-height: 1.7; }

/* 다음 만남 */
.card.meet { width: 100%; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 22px 18px; }
.card.meet.stack { text-align: left; align-items: stretch; }
.meet small { font-size: 13px; color: var(--sub); }
.meet-d { font-size: 44px; letter-spacing: -.02em; line-height: 1.1; }

/* 채팅 */
.chat-head { position: sticky; top: 0; z-index: 4; background: var(--bg); padding: 6px 0; margin: -6px 0 8px; }
.chat-list { display: flex; flex-direction: column; gap: 6px; padding-bottom: 90px; min-height: 50vh; }
.chat-day { align-self: center; font-size: 11px; color: var(--sub); background: var(--soft); border-radius: 10px; padding: 2px 10px; margin: 10px 0 4px; }
.bubble-row { display: flex; align-items: flex-end; gap: 6px; }
.bubble-row.mine { flex-direction: row-reverse; }
.bubble { max-width: 75%; padding: 9px 13px; border-radius: 18px 18px 18px 4px; background: var(--card); border: 1px solid var(--line); white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.5; }
.bubble-row.mine .bubble { background: var(--ink); color: var(--on-ink); border-color: var(--ink); border-radius: 18px 18px 4px 18px; }
.chat-meta { font-size: 10px; color: var(--sub); white-space: nowrap; }
.chat-input { position: fixed; left: 0; right: 0; bottom: calc(58px + env(safe-area-inset-bottom)); z-index: 12; max-width: 520px; margin: 0 auto;
  display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px; background: var(--bg); border-top: 1px solid var(--line); }
.chat-input textarea { flex: 1; min-height: 42px; max-height: 120px; resize: none; border-radius: 20px; padding: 10px 14px; }
.chat-open { width: 100%; display: flex; justify-content: center; align-items: center; gap: 6px; }
.badge-n { min-width: 20px; height: 20px; border-radius: 10px; background: var(--sun); color: #fff; font-size: 11px; display: inline-flex; align-items: center; justify-content: center; padding: 0 6px; }

/* 지나온 길 */
.trip-line { position: relative; padding-left: 18px; }
.trip-line::before { content: ''; position: absolute; left: 6px; top: 8px; bottom: 8px; width: 2px; background: var(--line); }
.trip-year { font-size: 20px; margin: 14px 0 8px -18px; }
.trip-item { position: relative; display: flex; gap: 10px; width: 100%; text-align: left; border: 0; background: none; padding: 8px 0; border-radius: 0; }
.trip-dot { position: absolute; left: -17px; top: 14px; width: 12px; height: 12px; border-radius: 50%; background: var(--ink); border: 2px solid var(--bg); }
.trip-dot.world { background: var(--card); border: 2px solid var(--ink); }

/* 음성 메모 */
.voice { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.voice audio, .voice-play { width: 100%; height: 40px; }

/* 포토북 (화면 + 인쇄) */
.book-page { background: #fff; color: #222; border: 1px solid var(--line); border-radius: 6px; padding: 22px; margin-bottom: 16px; aspect-ratio: 148 / 210; overflow: hidden; display: flex; flex-direction: column; gap: 12px; }
.book-page h2 { font-size: 20px; margin: 0; }
.book-cover { justify-content: flex-end; position: relative; color: #fff; padding: 0; }
.book-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.book-cover > div { position: relative; padding: 26px; background: linear-gradient(to top, rgba(0,0,0,.6), transparent); }
.book-cover h1 { font-size: 30px; margin: 4px 0; color: #fff; }
.book-cover .sub { color: rgba(255,255,255,.8); }
.book-grid { display: grid; gap: 6px; grid-template-columns: repeat(3, 1fr); }
.book-grid.n1 { grid-template-columns: 1fr; } .book-grid.n2, .book-grid.n4 { grid-template-columns: 1fr 1fr; }
.book-grid img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 4px; }
.book-grid.n1 img { aspect-ratio: 4 / 3; }
.book-diary { margin: 0; padding: 0; list-style: none; font-size: 12px; line-height: 1.6; }
.book-diary p { margin: 2px 0 8px; color: #555; }
@media print {
  @page { size: A5; margin: 0; }
  body { padding: 0; background: #fff; }
  #tabbar, #toast, .no-print { display: none !important; }
  #app { padding: 0; max-width: none; }
  #app.anim > * { animation: none !important; }
  .book-page { border: 0; border-radius: 0; margin: 0; height: 210mm; aspect-ratio: auto; page-break-after: always; break-after: page; }
}
