:root {
  --pink: #ff8fab;
  --pink-dark: #e05c7e;
  --bg: #fff5f7;
  --card: #ffffff;
  --text: #3a2c31;
  --muted: #9b8b90;
  --line: #f0dfe4;
  --blue: #6ec1e4;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  background: var(--bg);
  color: var(--text);
  padding-bottom: 78px;
}
#app { max-width: 640px; margin: 0 auto; }

/* 상단바 */
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: var(--pink); color: #fff;
  padding: 14px 16px; padding-top: max(14px, env(safe-area-inset-top));
  display: flex; align-items: center; justify-content: space-between;
  box-shadow: 0 2px 8px rgba(224,92,126,.25);
}
.topbar h1 { font-size: 18px; margin: 0; font-weight: 700; }
.topbar .who { font-size: 13px; opacity: .95; }
.linkbtn { background: none; border: none; color: #fff; font-size: 13px; text-decoration: underline; cursor: pointer; }

/* 화면 공통 */
.screen { padding: 16px; }
.card {
  background: var(--card); border-radius: 16px; padding: 16px; margin-bottom: 14px;
  box-shadow: 0 2px 10px rgba(0,0,0,.04);
}
h2.section { font-size: 16px; margin: 4px 2px 12px; }

/* 폼 */
label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
input, textarea, select {
  width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 10px;
  font-size: 16px; background: #fff; color: var(--text);
}
textarea { resize: vertical; min-height: 60px; }
button.primary {
  width: 100%; padding: 14px; border: none; border-radius: 12px;
  background: var(--pink); color: #fff; font-size: 16px; font-weight: 700; cursor: pointer;
  margin-top: 14px;
}
button.primary:active { background: var(--pink-dark); }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }
.hint { font-size: 12px; color: var(--muted); margin-top: 6px; }
.error { color: #d33; font-size: 13px; margin-top: 8px; }

/* 로그인 */
.center-wrap { min-height: 88vh; display: flex; flex-direction: column; justify-content: center; padding: 24px; }
.logo { text-align: center; margin-bottom: 18px; }
.logo img { width: 84px; height: 84px; }
.logo .title { font-size: 22px; font-weight: 800; margin-top: 8px; }
.logo .sub { color: var(--muted); font-size: 13px; }

/* 사진 카드 */
.photo-card { padding: 0; overflow: hidden; }
.photo-card img.main { width: 100%; display: block; background: #f3e8eb; }
.photo-body { padding: 12px 14px 14px; }
.photo-meta { font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; align-items: center; }
.caption { margin: 6px 0 10px; font-size: 15px; }
.actions { display: flex; gap: 18px; align-items: center; }
.actions .act { display: flex; align-items: center; gap: 5px; font-size: 14px; cursor: pointer; color: var(--muted); background: none; border: none; padding: 4px 0; }
.actions .act.on { color: var(--pink-dark); font-weight: 700; }
.badge-private { font-size: 11px; background: #eee; color: #888; border-radius: 8px; padding: 2px 7px; }

/* 댓글 */
.comments { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; }
.comment { font-size: 14px; margin: 6px 0; }
.comment b { color: var(--pink-dark); }
.comment .t { color: var(--muted); font-size: 11px; margin-left: 6px; }
.comment-form { display: flex; gap: 8px; margin-top: 8px; }
.comment-form input { flex: 1; }
.comment-form button { border: none; background: var(--pink); color: #fff; border-radius: 10px; padding: 0 16px; font-weight: 700; }

/* 리스트(성장/식사) */
.rec { display: flex; justify-content: space-between; align-items: center; padding: 12px 4px; border-bottom: 1px solid var(--line); }
.rec:last-child { border-bottom: none; }
.rec .main { font-size: 15px; }
.rec .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.rec .del { color: #d99; background: none; border: none; font-size: 18px; cursor: pointer; }
.stat { display: flex; gap: 12px; margin-bottom: 12px; }
.stat .box { flex: 1; background: var(--card); border-radius: 14px; padding: 12px; text-align: center; box-shadow: 0 2px 10px rgba(0,0,0,.04); }
.stat .box .n { font-size: 22px; font-weight: 800; color: var(--pink-dark); }
.stat .box .l { font-size: 12px; color: var(--muted); }
canvas { width: 100%; height: 200px; }

/* 하단 탭바 */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
  background: #fff; border-top: 1px solid var(--line);
  display: flex; max-width: 640px; margin: 0 auto;
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar button {
  flex: 1; background: none; border: none; padding: 10px 0 8px; cursor: pointer;
  color: var(--muted); font-size: 11px; display: flex; flex-direction: column; align-items: center; gap: 3px;
}
.tabbar button .ic { font-size: 20px; }
.tabbar button.active { color: var(--pink-dark); font-weight: 700; }

.empty { text-align: center; color: var(--muted); padding: 40px 20px; font-size: 14px; }
.fab-note { text-align:center; font-size:12px; color:var(--muted); margin-top:4px; }
.vis-toggle { display:flex; gap:8px; margin-top:6px; }
.vis-toggle button { flex:1; padding:10px; border:1px solid var(--line); background:#fff; border-radius:10px; font-size:13px; cursor:pointer; color:var(--muted); }
.vis-toggle button.sel { border-color:var(--pink); background:#fff0f4; color:var(--pink-dark); font-weight:700; }

/* 감정 반응 선택 팝업 */
.rpicker {
  position: fixed; z-index: 200; background: #fff; border-radius: 26px;
  padding: 6px 8px; box-shadow: 0 8px 28px rgba(0,0,0,.22);
  display: flex; gap: 2px;
}
.rpicker button {
  background: none; border: none; font-size: 27px; line-height: 1;
  padding: 5px 6px; cursor: pointer; border-radius: 50%; transition: transform .12s;
}
.rpicker button:hover, .rpicker button:active { transform: scale(1.35) translateY(-2px); }
.act.react.on { color: var(--pink-dark); font-weight: 700; }

/* 날짜 그룹 / 콜라주 / 썸네일 */
.photogroup { padding: 12px; }
.date-header { font-size: 15px; font-weight: 700; margin: 2px 2px 12px; display: flex; align-items: center; gap: 8px; }
.date-header .cnt { font-size: 12px; font-weight: 500; color: var(--muted); background: #f5eef0; padding: 2px 8px; border-radius: 10px; }
.collage { display: grid; grid-template-columns: 2fr 1fr; grid-template-rows: 1fr 1fr; gap: 6px; height: 260px; border-radius: 14px; overflow: hidden; }
.collage img { width: 100%; height: 100%; object-fit: cover; cursor: pointer; }
.collage .big { grid-row: 1 / 3; }
.thumbgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; margin-top: 10px; }
.thumbgrid .thumb { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; cursor: pointer; }
.grouptools { margin-top: 10px; text-align: center; }
.ghostbtn { background: #fff0f4; border: 1px solid var(--line); color: var(--pink-dark); border-radius: 10px; padding: 8px 14px; font-size: 13px; font-weight: 600; cursor: pointer; }

/* 모달 (사진 상세 / 대표 선택) */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 150; display: flex; align-items: center; justify-content: center; padding: 16px; overflow-y: auto; }
.modal-inner { background: #fff; border-radius: 16px; max-width: 560px; width: 100%; max-height: 92vh; overflow-y: auto; position: relative; }
.modal-close { position: absolute; top: 10px; right: 10px; width: 34px; height: 34px; border-radius: 50%; border: none; background: rgba(0,0,0,.5); color: #fff; font-size: 16px; cursor: pointer; z-index: 3; }
.modal-img { width: 100%; display: block; background: #f3e8eb; }
.modal-body { padding: 14px 16px 18px; }
.modal-comments { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; }

/* 대표 이미지 선택 */
.cover-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 12px 4px; }
.cover-cell { position: relative; cursor: pointer; }
.cover-cell img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; display: block; }
.cover-cell.sel img { outline: 3px solid var(--pink); outline-offset: -3px; }
.ordbadge { position: absolute; top: 4px; left: 4px; width: 24px; height: 24px; background: var(--pink); color: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; z-index: 1; }
