:root {
  --bg: #f8f8f8;
  --card: #fff;
  --ink: #0a0a0a;
  --muted: #7a7a7a;
  --chip: #e2e2e2;
  --chip-active: #b5b5b5;
  --slot: #d9d9d9;
  --slot-ink: #9c9c9c;
  --teal: #3f7f95;
  --line: #ececec;
  --danger: #e5484d;
  --shadow: 0 4px 18px rgba(0,0,0,.16);
  --font: 'Inter', 'Noto Sans KR', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); min-height: 100vh; }
[hidden] { display: none !important; }
a { color: inherit; text-decoration: none; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { display: block; max-width: 100%; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.ico { display: inline-flex; }
.ico svg { width: 1em; height: 1em; fill: currentColor; }

/* ---------- top bar ---------- */
.topbar { position: relative; height: 92px; display: flex; align-items: center; justify-content: center; }
.top-left { position: absolute; left: 20px; top: 26px; display: flex; align-items: center; gap: 14px; }
.plus {
  width: 34px; height: 34px; border-radius: 50%; border: 0; background: #d9d9d9; color: #222;
  display: grid; place-items: center; transition: background .15s, transform .15s; padding: 0;
}
.plus:hover { background: #cbcbcb; transform: scale(1.06); }
.bell { position: relative; border: 0; background: none; padding: 2px; color: #9a9a9a; display: grid; place-items: center; }
.bell svg { width: 26px; height: 26px; fill: currentColor; }
.bell:hover { color: #6f6f6f; }
.bell.unread::after { content: ''; position: absolute; top: 0; right: 1px; width: 9px; height: 9px; border-radius: 50%; background: #e5292f; box-shadow: 0 0 0 2px var(--bg); }
.logo { font-family: 'Playfair Display', Georgia, serif; font-weight: 800; font-size: 34px; letter-spacing: -.6px; line-height: 1; text-shadow: 0 2px 4px rgba(0,0,0,.22); }
.logo .why { color: var(--teal); }
.logo .daily { color: #111; }
.account { position: absolute; right: 18px; top: 14px; }
.avatar-btn { border: 0; padding: 0; background: none; border-radius: 50%; box-shadow: 0 2px 10px rgba(0,0,0,.3); display: block; }
.login-btn { border: 0; background: var(--ink); color: #fff; font-weight: 600; font-size: 14px; padding: 10px 18px; border-radius: 999px; margin-top: 12px; }
.menu, .notif-panel { position: absolute; background: #fff; border-radius: 16px; box-shadow: 0 10px 34px rgba(0,0,0,.2); padding: 8px; z-index: 30; }
.menu { right: 0; top: 60px; min-width: 190px; }
.menu a, .menu button { display: block; width: 100%; text-align: left; padding: 10px 12px; border: 0; background: none; border-radius: 10px; font-size: 14px; font-weight: 500; }
.menu a:hover, .menu button:hover { background: #f2f2f2; }
.menu .who { padding: 8px 12px 10px; font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.notif-panel { left: 0; top: 46px; width: min(340px, calc(100vw - 32px)); max-height: 70vh; overflow-y: auto; }
.notif-title { font-weight: 800; font-size: 15px; padding: 8px 10px 10px; }
.notif { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 12px; font-size: 13px; line-height: 1.35; }
.notif:hover { background: #f4f4f4; }
.notif.new { background: #eef5f7; }
.notif small { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }
.notif-empty { padding: 18px 10px; color: var(--muted); font-size: 13px; text-align: center; }

/* ---------- avatars ---------- */
.avatar { border-radius: 50%; object-fit: cover; flex: none; display: inline-grid; place-items: center; color: #fff; font-weight: 700; background: #888; overflow: hidden; }

/* ---------- layout ---------- */
main { padding: 0 16px 90px; }
.empty, .error-box { text-align: center; color: var(--muted); padding: 70px 0; font-size: 15px; }
.feed { max-width: 560px; margin: 0 auto; }
.feed.rest { margin-top: 26px; }
.feed-label { text-align: center; color: var(--muted); font-size: 13px; font-weight: 600; margin: 0 0 18px; }
.back { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; margin: 0 0 14px -6px; }
.back .ico svg { width: 20px; height: 20px; fill: none; }

/* ---------- entry card ---------- */
.entry { position: relative; background: var(--card); border-radius: 28px; box-shadow: var(--shadow); padding: 18px 16px 16px; margin-bottom: 30px; }
.entry.big { margin-top: 44px; padding-top: 34px; }
.e-author { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; margin-bottom: 14px; }
.entry.big .e-author { position: absolute; left: 50%; top: -24px; transform: translateX(-50%); flex-direction: column; gap: 4px; font-size: 16px; margin: 0; }
.entry.big .e-author .avatar { box-shadow: 0 2px 10px rgba(0,0,0,.25); border: 2px solid #fff; }
.entry.big .e-head { margin-top: 16px; }
.e-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
.e-day { display: block; font-size: 15px; font-weight: 600; }
.e-title { margin: 2px 0 0; font-size: 26px; font-weight: 700; letter-spacing: -.5px; line-height: 1.2; word-break: break-word; }
.e-mood .face svg, .face svg { display: block; }
.e-mood .face svg { width: 28px; height: 28px; margin-bottom: 4px; }
.e-photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 16px; }
.e-photo { border: 0; padding: 0; background: #eee; border-radius: 18px; overflow: hidden; aspect-ratio: 1.08; box-shadow: 0 2px 8px rgba(0,0,0,.25); transition: transform .15s; }
.e-photo:hover { transform: scale(1.02); }
.e-photo img { width: 100%; height: 100%; object-fit: cover; }
.e-body { margin: 18px 4px 0; font-size: 17px; line-height: 1.4; white-space: pre-wrap; word-break: break-word; }
.e-stats { display: flex; align-items: center; gap: 14px; margin: 16px 4px 4px; font-size: 13px; color: #555; }
.stat { display: inline-flex; align-items: center; gap: 4px; }
.stat .ico svg { width: 15px; height: 15px; fill: #8a8a8a; }
.like-btn { display: inline-flex; align-items: center; gap: 4px; border: 0; background: none; padding: 0; color: #555; font-size: 13px; }
.like-btn .ico svg { width: 17px; height: 17px; fill: #c4c4c4; transition: transform .15s; }
.like-btn[aria-pressed="true"] .ico svg { fill: #e5292f; }
.like-btn:active .ico svg { transform: scale(1.25); }
.e-when { color: var(--muted); font-size: 12px; margin-left: auto; }
.e-edit, .e-del { border: 0; background: none; padding: 0; font-size: 12px; font-weight: 600; color: var(--muted); }
.e-del:hover { color: var(--danger); }
.e-edit:hover { color: var(--ink); }
.e-comments { margin: 10px 4px 0; }
.comment { display: flex; gap: 8px; padding: 6px 0; }
.comment.reply { margin-left: 38px; }
.c-name { font-size: 11px; color: #333; }
.c-name small { color: var(--muted); margin-left: 6px; }
.c-body { font-size: 13px; font-weight: 500; line-height: 1.35; word-break: break-word; }
.c-actions { display: flex; gap: 10px; margin-top: 2px; }
.c-actions button { border: 0; background: none; padding: 0; font-size: 11px; font-weight: 600; color: var(--muted); }
.c-actions button:hover { color: var(--ink); }
.no-comments { color: var(--muted); font-size: 13px; margin: 6px 0; }
.compose { margin-top: 8px; }
.compose input { width: 100%; border: 0; background: #f0f0f0; border-radius: 999px; padding: 10px 16px; font-size: 14px; outline: none; }
.compose input:focus { box-shadow: 0 0 0 2px rgba(63,127,149,.35); }
.replying { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--muted); padding: 0 8px 6px; }
.replying button { border: 0; background: none; color: var(--muted); }
.see-more { display: block; width: calc(100% - 16px); margin: 10px auto 0; border: 0; background: #dcdcdc; color: #9a9a9a; font-size: 15px; font-weight: 500; padding: 6px; border-radius: 999px; transition: background .15s, color .15s; }
.see-more:hover { background: #d0d0d0; color: #666; }

/* ---------- profile ---------- */
.profile { text-align: center; padding-top: 4px; }
.p-avatar { position: relative; display: inline-block; }
.p-avatar .avatar { box-shadow: 0 2px 12px rgba(0,0,0,.2); }
.p-badge { position: absolute; right: -6px; bottom: -4px; min-width: 34px; height: 34px; padding: 0 6px; border-radius: 999px; background: #fff; color: #111; font-size: 14px; font-weight: 700; display: grid; place-items: center; box-shadow: 0 2px 8px rgba(0,0,0,.25); }
.profile h1 { font-size: 30px; font-weight: 800; letter-spacing: -.5px; margin: 14px 0 4px; text-shadow: 0 2px 4px rgba(0,0,0,.25); }
.profile .bio { font-size: 12px; line-height: 1.35; white-space: pre-line; color: #222; margin: 0 auto; max-width: 420px; }
.p-counts { font-size: 12px; color: var(--muted); margin: 6px 0 0; }
.p-counts b { color: #333; }
.pill-btn { margin-top: 12px; border: 0; background: #dcdcdc; border-radius: 999px; padding: 9px 20px; font-size: 14px; font-weight: 600; min-width: 64px; box-shadow: 0 1px 3px rgba(0,0,0,.12); transition: background .15s; }
.pill-btn:hover { background: #cfcfcf; }
.pill-btn[aria-pressed="true"] { background: #fff; border: 1px solid #d5d5d5; }
.pill-btn:disabled { opacity: .6; }
.tabs { display: flex; gap: 8px; max-width: 700px; margin: 24px auto 16px; }
.chip { border: 0; background: var(--chip); color: #333; font-size: 13px; padding: 5px 16px; border-radius: 999px; transition: background .15s; }
.chip:hover { background: #d6d6d6; }
.chip[aria-pressed="true"] { background: var(--chip-active); color: #fff; }
.profile-body { max-width: 700px; margin: 0 auto; }

/* grid tiles (PDF p.2) */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.tile { position: relative; aspect-ratio: 1; border-radius: 14px; overflow: hidden; background: #333; color: #fff; box-shadow: 0 3px 10px rgba(0,0,0,.25); display: block; transition: transform .15s; }
.tile:hover { transform: translateY(-2px); }
.tile img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tile::after { content: ''; position: absolute; inset: 0; background: linear-gradient(rgba(0,0,0,.28), rgba(0,0,0,.18) 45%, rgba(0,0,0,.5)); }
.tile > span { position: relative; z-index: 1; }
.tile-day { position: absolute !important; left: 9px; top: 6px; font-size: 32px; font-weight: 800; letter-spacing: -1px; }
.tile-title { position: absolute !important; left: 10px; right: 10px; top: 50%; transform: translateY(-50%); text-align: center; font-size: 17px; font-weight: 700; line-height: 1.15; text-transform: uppercase; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; text-shadow: 0 1px 4px rgba(0,0,0,.4); }
.tile-stats { position: absolute !important; left: 9px; bottom: 7px; display: flex; gap: 7px; font-size: 11px; }
.tile-stats > span { display: inline-flex; align-items: center; gap: 2px; }
.tile-stats svg { width: 11px; height: 11px; fill: #fff; }
.no-photo.mood-1 { background: linear-gradient(135deg, #b8322b, #e86b4a); }
.no-photo.mood-2 { background: linear-gradient(135deg, #c96a26, #f0a65a); }
.no-photo.mood-3 { background: linear-gradient(135deg, #b08f22, #e8cc5c); }
.no-photo.mood-4 { background: linear-gradient(135deg, #5f8f2a, #a4cf63); }
.no-photo.mood-5 { background: linear-gradient(135deg, #2c6e2a, #5ead57); }

/* calendar */
.cal { background: #fff; border-radius: 22px; box-shadow: var(--shadow); padding: 14px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; font-weight: 700; font-size: 17px; padding: 2px 4px 12px; }
.cal-head button { border: 0; background: #eee; width: 32px; height: 32px; border-radius: 50%; font-size: 20px; line-height: 1; }
.cal-head button:hover { background: #e0e0e0; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-wd { text-align: center; font-size: 11px; font-weight: 600; color: var(--muted); padding-bottom: 2px; }
.cal-cell { position: relative; aspect-ratio: 1; border-radius: 10px; background: #f3f3f3; overflow: hidden; }
.cal-cell.blank { background: none; }
.cal-cell.today { box-shadow: inset 0 0 0 2px var(--teal); }
.cal-cell img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cal-cell.has { color: #fff; transition: transform .15s; }
.cal-cell.has:hover { transform: scale(1.04); }
.cal-cell.has::after { content: ''; position: absolute; inset: 0; background: rgba(0,0,0,.25); }
.cal-d { position: absolute; left: 6px; top: 4px; font-size: 11px; font-weight: 600; z-index: 1; color: #888; }
.cal-cell.has .cal-d { color: #fff; }
.cal-n { position: absolute; inset: 0; display: grid; place-items: center; font-size: 20px; font-weight: 800; z-index: 1; text-shadow: 0 1px 4px rgba(0,0,0,.35); }
.cal-more { position: absolute; right: 5px; bottom: 3px; font-size: 10px; font-weight: 700; z-index: 1; }

/* ---------- composer (PDF p.6) ---------- */
.composer { background: var(--card); border-radius: 30px; box-shadow: var(--shadow); padding: 16px 14px 16px; }
.c-day { font-size: 18px; font-weight: 700; margin: 0 0 6px 2px; }
.c-top { display: flex; gap: 8px; align-items: center; }
.c-title { flex: 1; min-width: 0; border: 0; background: var(--slot); border-radius: 999px; padding: 4px 16px; font-size: 18px; font-weight: 700; text-align: center; outline: none; }
.c-title::placeholder { color: var(--slot-ink); }
.c-title:focus { box-shadow: 0 0 0 3px rgba(63,127,149,.3); }
.c-moods { display: flex; gap: 4px; }
.c-mood { border: 0; background: none; padding: 0; border-radius: 50%; transition: transform .12s; }
.c-mood svg { width: 26px; height: 26px; }
.c-mood:hover { transform: scale(1.12); }
.c-mood[aria-checked="true"] { transform: scale(1.15); }
.c-slots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 12px; }
.c-slot { position: relative; aspect-ratio: 1.05; border-radius: 16px; background: var(--slot); overflow: hidden; }
.c-slot.loading { opacity: .5; }
.c-add { width: 100%; height: 100%; border: 0; background: none; color: var(--slot-ink); font-size: 18px; font-weight: 700; line-height: 1.15; }
.c-add:hover { color: #777; }
.c-slot img { width: 100%; height: 100%; object-fit: cover; cursor: pointer; }
.c-remove { position: absolute; top: 7px; right: 7px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; font-size: 12px; display: grid; place-items: center; }
.c-body { display: block; width: 100%; min-height: 170px; margin-top: 14px; border: 0; background: var(--slot); border-radius: 16px; padding: 16px; font-size: 16px; line-height: 1.45; resize: vertical; outline: none; }
.c-body::placeholder { color: var(--slot-ink); font-weight: 700; font-size: 18px; text-align: center; }
.c-body:focus { box-shadow: 0 0 0 3px rgba(63,127,149,.3); }

/* ---------- modals ---------- */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: grid; place-items: center; padding: 16px; z-index: 50; animation: fade .15s ease; }
.modal { background: #fff; width: min(440px, 100%); max-height: 92vh; overflow-y: auto; border-radius: 28px; padding: 24px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal.wide { width: min(450px, 100%); }
.modal h2 { margin: 0 0 12px; font-size: 22px; font-weight: 800; letter-spacing: -.4px; }
.settings h3 { margin: 18px 0 8px; font-size: 18px; font-weight: 700; }
.settings h3:first-child { margin-top: 0; }
.set-row { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 14px; }
.set-avatar .avatar { box-shadow: 0 2px 10px rgba(0,0,0,.2); }
.mini { border: 0; background: #e0e0e0; border-radius: 999px; padding: 5px 12px; font-size: 11px; font-weight: 700; box-shadow: 0 1px 4px rgba(0,0,0,.2); }
.mini:hover { background: #d3d3d3; }
.seg { display: inline-flex; background: #dedede; border-radius: 999px; padding: 2px; box-shadow: inset 0 1px 3px rgba(0,0,0,.12); }
.seg button { border: 0; background: none; border-radius: 999px; padding: 6px 12px; font-size: 11px; font-weight: 600; color: #9a9a9a; }
.seg button[aria-checked="true"] { background: #fff; color: #111; box-shadow: 0 1px 4px rgba(0,0,0,.25); }
.set-hint { font-size: 11px; color: var(--muted); margin: 6px 0 0; }
.field { display: block; margin-bottom: 10px; }
.field > span { display: block; font-size: 12px; font-weight: 600; color: #555; margin-bottom: 5px; }
.field input, .field textarea { width: 100%; border: 1px solid #ddd; background: #fafafa; border-radius: 14px; padding: 10px 14px; font-size: 14px; outline: none; resize: vertical; }
.field input:focus, .field textarea:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(63,127,149,.2); }
.btn { border: 0; background: var(--ink); color: #fff; font-weight: 700; font-size: 14px; border-radius: 999px; padding: 11px 22px; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.ghost { background: #eee; color: var(--ink); }
.row { display: flex; gap: 10px; justify-content: flex-end; margin-top: 14px; }
.form-error { color: var(--danger); font-size: 13px; min-height: 18px; margin: 6px 0 0; }
.composer .form-error { text-align: center; }
.hint { font-size: 13px; color: var(--muted); margin: 0 0 16px; }
.google-slot { display: flex; justify-content: center; min-height: 44px; margin-bottom: 4px; }
.google-btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; width: 100%; max-width: 320px; height: 44px; border: 1px solid #dadce0; background: #fff; border-radius: 999px; font-size: 14px; font-weight: 600; color: #3c4043; }
.google-btn:hover { background: #f8f9fa; }
.google-btn:disabled { opacity: .6; }

/* photo viewer */
.modal.viewer-modal { width: auto; max-width: 94vw; padding: 0; background: none; box-shadow: none; overflow: visible; border-radius: 0; }
.viewer { position: relative; }
.viewer img { max-width: 94vw; max-height: 86vh; border-radius: 16px; box-shadow: 0 10px 40px rgba(0,0,0,.4); }
.viewer-nav, .viewer-close { position: absolute; border: 0; background: rgba(255,255,255,.9); width: 40px; height: 40px; border-radius: 50%; font-size: 24px; line-height: 1; display: grid; place-items: center; box-shadow: 0 2px 8px rgba(0,0,0,.3); }
.viewer-nav { top: 50%; transform: translateY(-50%); }
.viewer-nav.prev { left: 10px; }
.viewer-nav.next { right: 10px; }
.viewer-close { top: 10px; right: 10px; font-size: 15px; }
.viewer-count { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); background: rgba(0,0,0,.55); color: #fff; font-size: 12px; padding: 3px 10px; border-radius: 999px; }
.viewer-count:empty { display: none; }

#toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); background: #111; color: #fff; font-size: 14px; font-weight: 500; padding: 11px 18px; border-radius: 999px; opacity: 0; pointer-events: none; transition: .2s; z-index: 80; max-width: 90vw; text-align: center; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
@keyframes fade { from { opacity: 0; } }

/* ---------- small screens ---------- */
@media (max-width: 560px) {
  .topbar { height: 78px; }
  .top-left { left: 14px; top: 22px; gap: 10px; }
  .logo { font-size: 27px; }
  .account { right: 12px; top: 14px; }
  .account .avatar { width: 40px !important; height: 40px !important; }
  .entry { border-radius: 24px; padding-left: 12px; padding-right: 12px; }
  .e-title { font-size: 22px; }
  .e-photos, .c-slots { gap: 8px; }
  .e-photo, .c-slot { border-radius: 14px; }
  .e-body { font-size: 16px; }
  .c-top { flex-direction: column; align-items: stretch; }
  .c-moods { justify-content: center; }
  .c-add { font-size: 15px; }
  .tiles { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .cal { padding: 10px; }
  .cal-grid { gap: 4px; }
  .cal-n { font-size: 15px; }
}
