/* KOMI's K-Culture Diary — pure white Threads-style light theme
   Palette: #FFFFFF bg · #E5E7EB hairlines · #111 typographic black · pink accent */

:root {
  --bg: #FFFFFF;
  --line: #E5E7EB;
  --ink: #111111;
  --ink-2: #6b7280;
  --ink-3: #9ca3af;
  --accent: #EC4899;
  --accent-soft: #FDF2F8;
  --like: #EF4444;
  --chip: #F3F4F6;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
          "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, textarea { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
svg { display: block; }
[hidden] { display: none !important; }

::selection { background: #FBD3EC; }

/* ---------- layout ---------- */
.app { min-height: 100dvh; }
.main {
  max-width: 620px;
  margin: 0 auto;
  padding: 0 0 calc(64px + env(safe-area-inset-bottom));
  min-height: 100dvh;
}
.view-head {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 20px 16px 4px;
}
.view-title { margin: 0; font-size: 21px; font-weight: 700; letter-spacing: -0.01em; }
.view-sub { color: var(--ink-3); font-size: 12.5px; }
.feed-head-pad { height: 8px; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 12px;
  padding-top: calc(10px + env(safe-area-inset-top));
  background: rgba(255,255,255,.92);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; color: inherit; min-width: 0; }
.brand-mark { width: 36px; height: 36px; flex: none; object-fit: contain; background: transparent; }
.brand-copy { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-title { font-size: 15.5px; font-weight: 700; letter-spacing: -0.01em; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.dc-emblem { width: 17px; height: 17px; flex: none; }
.brand-sub { font-size: 11px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { display: flex; align-items: center; gap: 4px; }

.icon-btn {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%;
  transition: background .15s ease;
}
.icon-btn:hover, .icon-btn:active { background: var(--chip); }

/* language pill */
.lang { position: relative; }
.lang-btn {
  display: flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); border-radius: 999px;
  padding: 7px 11px; font-size: 12.5px; font-weight: 600; background: #fff;
  transition: background .15s ease;
}
.lang-btn:hover { background: var(--chip); }
.lang-menu {
  position: absolute; right: 0; top: calc(100% + 6px);
  min-width: 192px; max-width: 78vw; max-height: min(62vh, 420px); overflow-y: auto; -webkit-overflow-scrolling: touch;
  background: #fff; border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 12px 32px rgba(17,17,17,.10); padding: 6px; z-index: 60;
}
.lang-item .lang-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lang-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; padding: 9px 11px; border-radius: 9px; font-size: 13.5px; text-align: left;
}
.lang-item:hover { background: var(--chip); }
.lang-item .tick { color: var(--accent); opacity: 0; font-weight: 700; }
.lang-item[aria-selected="true"] { font-weight: 700; }
.lang-item[aria-selected="true"] .tick { opacity: 1; }

/* ---------- post card ---------- */
.post { border-bottom: 1px solid var(--line); padding: 14px 16px 10px; }
.post-top { display: flex; gap: 11px; align-items: flex-start; }
.avatar { border-radius: 50%; object-fit: cover; border: 1px solid var(--line); background: #fff; }
.avatar-36 { width: 36px; height: 36px; }
.avatar-40 { width: 40px; height: 40px; }
.avatar-28 { width: 28px; height: 28px; }
.avatar-fallback {
  display: grid; place-items: center; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent); font-weight: 700; flex: none;
}
.avatar-fallback.avatar-36 { width: 36px; height: 36px; font-size: 14px; }
.avatar-fallback.avatar-28 { width: 28px; height: 28px; font-size: 11px; }
.avatar-fallback.avatar-40 { width: 40px; height: 40px; font-size: 15px; }

.post-headline { flex: 1; min-width: 0; }
.byline { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.byline-name { font-weight: 700; font-size: 14.5px; }
.byline-handle { color: var(--ink-3); font-size: 13px; }
.dot { color: var(--ink-3); font-size: 11px; }
.byline-time { color: var(--ink-3); font-size: 13px; white-space: nowrap; }
.edited-mark { color: var(--ink-3); font-size: 11.5px; font-weight: 500; opacity: .85; white-space: nowrap; }
/* the dancheong sticker a diary carries: stuck on the right of the byline row,
   slightly tilted like a paper deco sticker, never over the text or buttons */
.post-sticker {
  flex: none; width: 44px; height: 44px; margin: -3px 0 0 2px;
  transform: rotate(6deg);
  filter: drop-shadow(0 2px 3px rgba(24, 16, 8, .18));
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
}
.follow-btn {
  margin-left: auto; border: 1px solid var(--line); border-radius: 999px;
  padding: 5px 13px; font-size: 12.5px; font-weight: 700; flex: none;
  transition: border-color .15s ease, background .15s ease, color .15s ease;
}
.follow-btn:hover { border-color: var(--ink); }
.follow-btn.is-following { background: var(--ink); border-color: var(--ink); color: #fff; }

.post-body { margin: 7px 0 0; font-size: 15px; white-space: pre-wrap; word-break: break-word; }
.post-tags { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 4px 10px; }
.post-tag { color: #2563EB; font-size: 13.5px; font-weight: 550; }
.post-tag:hover { text-decoration: underline; }

/* ---------- dancheong accents ----------
   slate #4B7F9F · coral #E05A47 · orange #EB7A2D · sage #6E946B · gold #D9B44A */
.date-banner {
  display: flex; align-items: center; gap: 12px;
  margin: 12px 16px 4px; padding: 10px 14px;
  border: 1px solid var(--line); border-radius: 16px; background: #fff;
}
.date-banner .stamp {
  display: grid; place-items: center; width: 46px; height: 46px; flex: none;
  border: 1.5px dashed #D9B44A; border-radius: 50%; background: #fff;
}
.date-banner .date-copy { display: flex; flex-direction: column; min-width: 0; }
.date-banner .date-copy b { font-size: 14.5px; letter-spacing: -0.01em; }
.date-banner .date-copy span { color: var(--ink-3); font-size: 12px; }

.chip.dc-chip { color: var(--dc, #4B7F9F); border-color: var(--dc, #4B7F9F); }
.chip.dc-chip:hover { background: var(--dc, #4B7F9F); color: #fff; border-color: var(--dc, #4B7F9F); }
.chip.dc-chip.is-active { background: var(--dc, #4B7F9F); border-color: var(--dc, #4B7F9F); color: #fff; }
.post-tags .dc-chip { font-size: 13px; padding: 4px 11px; border: 1px solid var(--dc, #4B7F9F); color: var(--dc, #4B7F9F); background: #fff; }
.post-tags .dc-chip:hover { background: var(--dc, #4B7F9F); color: #fff; }

/* photos */
.post-photos { margin-top: 10px; display: grid; gap: 8px; border-radius: 16px; overflow: hidden; }
.post-photos[data-n="2"] { grid-template-columns: 1fr 1fr; }
.post-photos[data-n="3"] { grid-template-columns: 1fr 1fr; }
.post-photos[data-n="4"] { grid-template-columns: 1fr 1fr; }
.post-photos img, .post-photos > div {
  width: 100%; border-radius: 0; object-fit: cover; cursor: zoom-in;
  border: 1px solid var(--line);
}
.post-photos[data-n="2"] img, .post-photos[data-n="4"] img { aspect-ratio: 1 / 1; }
.post-photos[data-n="3"] img:first-child { grid-column: 1 / -1; aspect-ratio: 2 / 1; }
.post-photos[data-n="3"] .ph-more, .post-photos[data-n="4"] .ph-more {
  position: relative; aspect-ratio: 1 / 1; display: grid; place-items: center;
  color: #fff; font-size: 20px; font-weight: 700; background-size: cover; background-position: center;
}
.post-photos[data-n="3"] .ph-more::before, .post-photos[data-n="4"] .ph-more::before {
  content: ""; position: absolute; inset: 0; background: rgba(17,17,17,.45);
}
.post-photos[data-n="3"] .ph-more span, .post-photos[data-n="4"] .ph-more span { position: relative; z-index: 1; }
.post-photos[data-n="1"] img { max-height: 560px; }

/* video attachments */
.post-photos video {
  width: 100%; display: block; background: #000; border-radius: 0;
  object-fit: contain; max-height: 70vh;
}
.post-photos[data-n="2"] video, .post-photos[data-n="3"] video, .post-photos[data-n="4"] video {
  aspect-ratio: 1 / 1; object-fit: cover;
}
.post-photos .ph-skel {
  width: 100%; aspect-ratio: 4 / 3; cursor: default;
  background: linear-gradient(100deg, #F3F4F6, #E9EBEF, #F3F4F6);
}
.post-photos .ph-video-skel {
  display: grid; place-items: center; aspect-ratio: 16 / 9;
  background: #1a1a1c; color: #fff; font-size: 20px;
}
.translate-btn.is-loading { opacity: .6; }
.translate-note { margin-top: 6px; color: var(--ink-3); font-size: 12.5px; }

/* translate toggle */
.translate-row { margin-top: 10px; }
.translate-btn {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--ink-2); font-size: 12.5px; font-weight: 600;
  padding: 5px 0; border-radius: 6px;
}
.translate-btn:hover { color: var(--ink); }
.translate-btn .globe { color: #2563EB; }
.translate-body {
  margin-top: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px;
  background: #FAFAFA; font-size: 14px; color: #374151; white-space: pre-wrap; word-break: break-word;
}
.translate-meta { margin-top: 6px; color: var(--ink-3); font-size: 11.5px; }

/* action row */
.post-actions {
  margin-top: 10px; padding-top: 6px;
  display: flex; align-items: center; gap: 4px;
}
/* the writer's own tools sit on the right, quieter than the count row */
.post-tools { margin-left: auto; display: flex; align-items: center; gap: 2px; }
.post-tools .act { padding: 7px 7px; color: var(--ink-3); }
.act {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--ink-2); font-size: 12.5px; font-weight: 550;
  padding: 7px 10px; border-radius: 999px; transition: background .15s ease;
  user-select: none; -webkit-user-select: none;
}
.act:active { transform: scale(.96); }
.act:hover { background: var(--chip); }
.act .cnt { min-width: 10px; }
.act[data-act="like"]:hover { color: #E05A47; background: #FDF1EF; }
.act.is-liked { color: #E05A47; font-weight: 700; }
.act.is-liked .ico { fill: #E05A47; stroke: #E05A47; }
.act[data-act="comment"]:hover { color: #4B7F9F; background: #EFF5F9; }
.act[data-act="repost"]:hover { color: #6E946B; background: #F0F5EF; }
.act.is-reposted { color: #6E946B; font-weight: 700; }
.act.is-reposted .ico { fill: #6E946B; stroke: #6E946B; }
.act[data-act="share"]:hover { color: #EB7A2D; background: #FDF3EA; }
.act[data-act="edit"]:hover { color: #4B7F9F; background: #EFF5F9; }
.act[data-act="delete"]:hover { color: #E05A47; background: #FDF1EF; }
.translate-btn .globe { color: #4B7F9F; }

/* comments */
.comments { margin-top: 4px; border-top: 1px solid var(--line); padding-top: 4px; }
.comment { display: flex; gap: 9px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.comment:last-of-type { border-bottom: 0; }
.comment-main { flex: 1; min-width: 0; }
.comment-head { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.comment-author { font-weight: 700; font-size: 13.5px; }
.comment-time { color: var(--ink-3); font-size: 12px; }
.comment-text { margin: 3px 0 0; font-size: 14px; white-space: pre-wrap; word-break: break-word; }
.comment-del { color: var(--ink-3); font-size: 12px; margin-top: 3px; }
.comment-del:hover { color: #E05A47; }
.comment-form { display: flex; gap: 9px; padding: 10px 0 6px; align-items: center; }
.comment-form .comment-input {
  flex: 1; border: 1px solid var(--line); border-radius: 999px;
  padding: 9px 14px; font-size: 13.5px; outline: none; background: #fff;
}
.comment-form .comment-input:focus { border-color: var(--ink-3); }
.comment-form .send-btn {
  flex: none; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  color: var(--ink-3); transition: color .15s ease;
}
.comment-form .send-btn.ready { color: var(--accent); }

/* ---------- tab bar ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  background: rgba(255,255,255,.94);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  backdrop-filter: saturate(180%) blur(14px);
  border-top: 1px solid var(--line);
}
.tab {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 5px 0 3px; color: var(--ink-3); border-radius: 12px;
  min-width: 0;
}
.tab .tab-ico { width: 22px; height: 22px; }
.tab .tab-label { font-size: clamp(8.5px, 2.6vw, 10px); font-weight: 600; letter-spacing: .01em; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.tab-shop .tab-label { letter-spacing: 0; }
.tab.is-active { color: var(--ink); }
.tab.is-active .tab-ico { stroke-width: 2.2; }
.tab-create { color: var(--ink-3); }
.create-fab {
  display: grid; place-items: center; width: 34px; height: 34px; margin-top: -6px;
  border-radius: 12px; color: #fff; background: linear-gradient(135deg, #4B7F9F, #E05A47 55%, #EB7A2D);
  box-shadow: 0 4px 14px rgba(224,90,71,.32);
}

/* ---------- compose sheet ---------- */
.scrim {
  position: fixed; inset: 0; z-index: 70; background: rgba(17,17,17,.35);
  opacity: 0; transition: opacity .2s ease;
}
.scrim.is-open { opacity: 1; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 80;
  max-width: 620px; margin: 0 auto;
  background: #fff; border-radius: 18px 18px 0 0;
  box-shadow: 0 -12px 40px rgba(17,17,17,.18);
  transform: translateY(100%); transition: transform .24s cubic-bezier(.32,.72,.33,1);
  padding-bottom: env(safe-area-inset-bottom);
  max-height: 92dvh; display: flex; flex-direction: column;
}
.sheet.is-open { transform: translateY(0); }
.sheet-grip { width: 36px; height: 4px; border-radius: 2px; background: var(--line); margin: 8px auto 0; }
.sheet-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 14px 10px; border-bottom: 1px solid var(--line);
}
.sheet-title { margin: 0; font-size: 15px; font-weight: 700; }
.text-btn { color: var(--ink-2); font-size: 14px; font-weight: 600; padding: 6px 8px; border-radius: 8px; }
.text-btn:hover { background: var(--chip); }
.pill {
  border-radius: 999px; padding: 7px 16px; font-size: 13.5px; font-weight: 700;
  border: 1px solid var(--line); background: #fff;
}
.pill.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.pill.primary:disabled { opacity: .35; cursor: default; }
.sheet-body { padding: 14px 16px 18px; overflow-y: auto; }
.compose-row { display: flex; gap: 11px; }
.compose-fields { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.nick-input {
  border: 0; border-bottom: 1px solid var(--line); padding: 4px 0 8px;
  font-size: 14.5px; font-weight: 700; outline: none;
}
.nick-input:focus { border-bottom-color: var(--ink); }
.body-input {
  border: 0; resize: none; outline: none; font-size: 15.5px; line-height: 1.55; min-height: 96px;
}
.body-input::placeholder, .nick-input::placeholder, .tag-input::placeholder { color: var(--ink-3); }
.compose-under { display: flex; align-items: center; gap: 10px; }
.tag-input { flex: 1; border: 0; outline: none; font-size: 13.5px; color: #2563EB; padding: 4px 0; }
.counter { color: var(--ink-3); font-size: 11.5px; flex: none; }
.photo-strip { display: flex; gap: 8px; margin-top: 10px; overflow-x: auto; }
.photo-thumb { position: relative; flex: none; }
.photo-thumb img { width: 84px; height: 84px; object-fit: cover; border-radius: 12px; border: 1px solid var(--line); }
.photo-thumb video { width: 84px; height: 84px; object-fit: cover; border-radius: 12px; border: 1px solid var(--line); background: #000; }
.photo-thumb .thumb-play {
  position: absolute; left: 6px; bottom: 6px;
  width: 20px; height: 20px; border-radius: 50%;
  background: rgba(17,17,17,.62); color: #fff;
  display: grid; place-items: center; font-size: 9px;
}
.photo-thumb .rm {
  position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--ink); color: #fff; display: grid; place-items: center; font-size: 12px;
}
.compose-tools { display: flex; align-items: center; gap: 10px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.tool-btn {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px;
  font-size: 13px; font-weight: 650; color: var(--ink-2);
}
.tool-btn:hover { background: var(--chip); }
.tool-hint { color: var(--ink-3); font-size: 12px; }

/* ---------- dancheong sticker tray (free) ---------- */
.sticker-tray {
  margin-top: 12px; padding: 10px 11px 9px;
  border: 1px solid var(--line); border-radius: 15px; background: #FFFDF9;
}
.sticker-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.sticker-title { font-size: 12.5px; font-weight: 700; color: var(--ink); letter-spacing: -0.01em; }
.sticker-note { font-size: 11px; color: var(--ink-3); text-align: right; }
.sticker-row { display: flex; gap: 8px; overflow-x: auto; padding: 2px 1px 3px; scrollbar-width: none; }
.sticker-row::-webkit-scrollbar { display: none; }
.sticker-opt {
  position: relative; flex: none; width: 48px; height: 48px; padding: 1px;
  border: 2px solid transparent; border-radius: 50%; background: #fff;
  transition: border-color .16s ease, transform .16s ease, box-shadow .16s ease;
}
.sticker-opt img {
  width: 100%; height: 100%; border-radius: 50%; opacity: .84;
  transition: opacity .16s ease, transform .16s ease;
}
.sticker-opt:hover img { opacity: 1; transform: scale(1.03); }
.sticker-opt.is-on { border-color: #D9B44A; box-shadow: 0 0 0 3px #FBF1D6; }
.sticker-opt.is-on img { opacity: 1; }
.sticker-opt.is-on::after {
  content: "\2713"; position: absolute; right: -1px; bottom: -1px;
  width: 16px; height: 16px; border-radius: 50%;
  background: #D9B44A; color: #fff; font-size: 10px; font-weight: 700;
  display: grid; place-items: center; border: 1.5px solid #fff;
}
.hint { color: var(--ink-3); font-size: 12px; margin: 12px 0 0; }

/* ---------- search view ---------- */
.search-wrap { padding: 14px 16px 4px; position: sticky; top: 0; background: var(--bg); }
.search-input {
  width: 100%; border: 1px solid var(--line); border-radius: 999px;
  padding: 11px 16px; font-size: 14.5px; outline: none; background: #FAFAFA;
}
.search-input:focus { border-color: var(--ink-3); background: #fff; }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 16px; }
.tag-cloud-head {
  padding: 14px 16px 0; font-size: 12px; font-weight: 700; letter-spacing: .02em;
  color: var(--ink-3); text-transform: uppercase;
}
.chip-n {
  display: inline-block; margin-left: 5px; font-size: 11px; font-weight: 700;
  color: var(--dc, #4B7F9F); opacity: .8;
}
.chip.dc-chip:hover .chip-n, .chip.dc-chip.is-active .chip-n { color: #fff; opacity: .9; }
.chip {
  border: 1px solid var(--line); border-radius: 999px; padding: 7px 13px;
  font-size: 13px; font-weight: 600; color: var(--ink-2); background: #fff;
  transition: all .15s ease;
}
.chip:hover { border-color: var(--ink); color: var(--ink); }
.chip.is-active { background: var(--ink); border-color: var(--ink); color: #fff; }
.filter-note {
  padding: 8px 16px; color: var(--ink-2); font-size: 12.5px;
  display: flex; align-items: center; gap: 8px;
}
.filter-note button { color: var(--ink); font-weight: 700; font-size: 12.5px; text-decoration: underline; }

/* ---------- me view ---------- */
/* her own profile card on top of My Diary */
.me-card {
  display: flex; flex-direction: column; gap: 12px;
  margin: 6px 16px 14px; padding: 14px;
  background: linear-gradient(160deg, #FFFFFF 0%, #FFFCF6 62%, #FDF7FB 100%);
  border: 1px solid var(--line); border-radius: 20px;
}
.me-card-top { display: flex; align-items: flex-start; gap: 13px; }
.me-card-ava {
  width: 72px; height: 72px; flex: none; border-radius: 50%; object-fit: cover;
  border: 1px solid var(--line); background: #fff;
}
.me-card-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; padding-top: 2px; }
.me-card-name { font-size: 17px; font-weight: 800; letter-spacing: -.01em; line-height: 1.28; word-break: break-word; }
.me-card-role { font-size: 11.5px; color: var(--ink-3); line-height: 1.4; word-break: keep-all; }
.me-card-bio { margin: 3px 0 0; font-size: 13px; color: var(--ink-2); line-height: 1.55; word-break: keep-all; }
.me-card-edit {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 14px; font-size: 13px; font-weight: 700; color: var(--ink);
}
.me-card-edit .ico { width: 16px; height: 16px; }
.me-card-edit:hover { border-color: var(--ink-3); background: #FAFAFA; }
.me-card-edit:active { transform: scale(.995); }

/* ---------- profile sheet ---------- */
.profile-photo-row { display: flex; align-items: center; gap: 14px; }
.profile-photo-btn {
  position: relative; flex: none; width: 88px; height: 88px; padding: 0;
  border-radius: 50%; overflow: hidden; border: 1px solid var(--line); background: #FAFAFA;
}
.profile-photo-img { width: 100%; height: 100%; object-fit: cover; }
.profile-photo-cam {
  position: absolute; right: 2px; bottom: 2px; width: 27px; height: 27px;
  border-radius: 50%; display: grid; place-items: center;
  background: var(--ink); color: #fff; border: 2.5px solid #fff;
}
.profile-photo-tools { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.profile-photo-tools .tool-btn { padding: 7px 13px; font-size: 12.5px; }
.profile-photo-reset {
  font-size: 12px; font-weight: 600; color: var(--ink-3);
  padding: 5px 0; text-decoration: underline; text-underline-offset: 2px;
}
.profile-photo-reset:hover { color: var(--ink); background: none; }
.field-note {
  display: block; margin-top: 5px; text-align: right;
  font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums;
}
.profile-area { min-height: 64px; resize: none; }

.me-tabs { display: flex; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--bg); }
.me-tab { flex: 1; padding: 12px 0; text-align: center; font-size: 13.5px; font-weight: 650; color: var(--ink-3); border-bottom: 2px solid transparent; }
.me-tab.is-active { color: var(--ink); border-bottom-color: var(--ink); }
.me-stats { padding: 16px; display: flex; gap: 10px; }
.me-stat { flex: 1; border: 1px solid var(--line); border-radius: 14px; padding: 12px; text-align: center; }
.me-stat b { display: block; font-size: 20px; }
.me-stat span { color: var(--ink-3); font-size: 12px; }

/* ---------- empty / offline ---------- */
.empty { padding: 60px 24px; text-align: center; color: var(--ink-3); }
.empty b { display: block; color: var(--ink); font-size: 16px; margin-bottom: 4px; }

/* ---------- empty first page ---------- */
.empty-home {
  margin: 26px 16px 40px; padding: 38px 22px 32px;
  text-align: center; background: #fff;
  border: 1px solid var(--line); border-radius: 22px;
}
.empty-home .empty-flower { margin: 0 auto 16px; }
.empty-home .empty-title {
  display: block; color: var(--ink);
  font-size: 17px; font-weight: 700; letter-spacing: -0.01em;
}
.empty-home .empty-sub {
  margin: 9px auto 22px; max-width: 30ch;
  color: var(--ink-3); font-size: 13.5px; line-height: 1.68; word-break: keep-all;
}
.empty-home .empty-cta { padding: 12px 22px; font-size: 14px; }
.empty-home .empty-cta:active { transform: scale(.98); }
.offline-bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 90;
  background: var(--ink); color: #fff; text-align: center;
  font-size: 12.5px; padding: 6px 0 6px; padding-top: calc(6px + env(safe-area-inset-top));
}

/* ---------- viewer ---------- */
.viewer {
  position: fixed; inset: 0; z-index: 90; background: rgba(12,12,14,.92);
  display: grid; place-items: center; padding: 20px;
}
.viewer img { max-width: 100%; max-height: 88vh; border-radius: 10px; }
.viewer-close {
  position: absolute; top: calc(14px + env(safe-area-inset-top)); right: 14px;
  width: 40px; height: 40px; border-radius: 50%; color: #fff; background: rgba(255,255,255,.12);
  display: grid; place-items: center;
}

/* ---------- MOMO Shop ---------- */
.shop-hero {
  margin: 14px 16px 4px; background: #fff;
  border: 1px solid var(--line); border-radius: 22px; overflow: hidden;
}
.shop-hero-frame { aspect-ratio: 16 / 9; overflow: hidden; background: #FDF2F8; }
.shop-hero-img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 50%; }
.shop-hero-body { padding: 13px 15px 16px; }
.shop-hero-id { display: flex; align-items: center; gap: 10px; min-width: 0; }
.shop-hero-ava {
  width: 42px; height: 42px; flex: none; border-radius: 50%; object-fit: cover;
  border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line);
}
.shop-hero-meta { display: flex; flex-direction: column; min-width: 0; }
.shop-hero-name { font-size: 16px; font-weight: 800; letter-spacing: -.01em; line-height: 1.25; }
.shop-hero-role {
  color: var(--ink-3); font-size: 11.5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.shop-hero-line {
  margin: 11px 0 0; padding: 11px 13px; border-radius: 14px;
  background: var(--accent-soft); color: var(--ink);
  font-size: 14px; line-height: 1.6; word-break: keep-all;
}
.shop-add {
  display: flex; width: 100%; justify-content: center;
  margin-top: 12px; padding: 11px 16px; font-size: 14px;
}
.shop-add:active { transform: scale(.99); }

.shop-shelf-head { display: flex; align-items: baseline; justify-content: space-between; padding: 18px 16px 8px; }
.shop-shelf-head b { font-size: 13px; font-weight: 800; letter-spacing: .01em; }
.shop-shelf-head span { color: var(--ink-3); font-size: 12px; }

.shop-card {
  margin: 0 16px 14px; background: #fff;
  border: 1px solid var(--line); border-radius: 20px; overflow: hidden;
}
.shop-card-img { width: 100%; aspect-ratio: 1 / 1; max-height: 420px; object-fit: cover; background: #FDF2F8; cursor: zoom-in; }
.shop-card-noimg {
  aspect-ratio: 16 / 7; display: grid; place-items: center;
  background: linear-gradient(135deg, #FDF2F8, #F3F4F6);
}
.shop-card-noimg img {
  width: 56px; height: 56px; border-radius: 50%; object-fit: cover;
  border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line);
}
.shop-card-body { padding: 12px 14px 13px; }
.shop-card-name { margin: 0; font-size: 15.5px; font-weight: 700; letter-spacing: -.01em; line-height: 1.35; word-break: keep-all; }
.shop-card-price { margin-top: 4px; font-size: 15.5px; font-weight: 800; color: #DB2777; }
.shop-say { display: flex; align-items: flex-start; gap: 9px; margin-top: 12px; }
.shop-say-ava {
  width: 32px; height: 32px; flex: none; border-radius: 50%; object-fit: cover;
  border: 1px solid var(--line);
}
.shop-bubble { flex: 1; min-width: 0; padding: 9px 12px; border-radius: 4px 14px 14px 14px; background: #F3F4F6; }
.shop-bubble-text { margin: 0; font-size: 13.5px; line-height: 1.55; white-space: pre-wrap; word-break: keep-all; }
.shop-tr { margin-top: 6px; }
.shop-tr-btn { font-size: 12px; font-weight: 600; color: var(--ink-3); }
.shop-tr-body {
  margin-top: 6px; padding-top: 6px; border-top: 1px dashed #D1D5DB;
  font-size: 13px; line-height: 1.5; color: var(--ink);
  white-space: pre-wrap; word-break: keep-all;
}
.shop-tr-meta { display: block; margin-top: 4px; font-size: 11px; color: var(--ink-3); }
.shop-card-foot { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.shop-open {
  display: inline-flex; align-items: center; padding: 8px 16px;
  font-size: 13px; border-color: var(--ink); color: var(--ink); text-decoration: none;
}
.shop-open.is-off { color: var(--ink-3); border-color: var(--line); background: #FAFAFA; }
.shop-tools { margin-left: auto; display: flex; align-items: center; gap: 2px; }
.shop-tools .act { padding: 7px; color: var(--ink-3); }
.shop-tools .act[data-shop-edit]:hover { color: #4B7F9F; background: #EFF5F9; }
.shop-tools .act[data-shop-del]:hover { color: #E05A47; background: #FDF1EF; }

.shop-empty {
  margin: 14px 16px 40px; padding: 30px 22px 26px; text-align: center;
  background: #fff; border: 1px solid var(--line); border-radius: 22px;
}
.shop-empty-ava {
  width: 76px; height: 76px; margin: 0 auto 12px; border-radius: 50%; object-fit: cover;
  border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line);
}
.shop-empty b { display: block; font-size: 15.5px; font-weight: 800; }
.shop-empty p { margin: 8px auto 18px; max-width: 30ch; color: var(--ink-3); font-size: 13px; line-height: 1.65; word-break: keep-all; }
.shop-empty .shop-add { max-width: 260px; margin: 0 auto; }

/* shop sheet fields */
.shop-photo-row { display: flex; align-items: center; gap: 10px; }
.shop-photo-add {
  width: 96px; height: 96px; border-radius: 16px; border: 1.5px dashed var(--line);
  background: #FAFAFA; color: var(--ink-3);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  font-size: 11px; font-weight: 600;
}
.shop-photo-add:hover { border-color: var(--ink-3); color: var(--ink-2); }
.shop-photo-thumb { position: relative; width: 96px; height: 96px; border-radius: 16px; overflow: hidden; border: 1px solid var(--line); }
.shop-photo-thumb img { width: 100%; height: 100%; object-fit: cover; }
.shop-photo-thumb .rm {
  position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%;
  background: rgba(17,17,17,.62); color: #fff; font-size: 15px; line-height: 1;
  display: grid; place-items: center;
}
.field { display: block; margin-top: 13px; }
.field-label {
  display: block; margin-bottom: 5px; color: var(--ink-3);
  font-size: 11px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase;
}
.field-input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px;
  background: #FAFAFA; font-size: 14.5px; outline: none;
}
.field-input:focus { border-color: var(--ink-3); background: #fff; }
.field-input::placeholder { color: var(--ink-3); font-weight: 400; }
.field-area { min-height: 84px; line-height: 1.5; resize: vertical; }

/* ---------- K-star Kemi match ---------- */
.match-invite { padding: 8px 16px 0; }
.match-invite-btn {
  width: 100%; display: flex; align-items: center; gap: 11px; text-align: left;
  padding: 11px 13px; border-radius: 16px;
  border: 1px solid #F4D7E4;
  background: linear-gradient(135deg, #FFF7FB 0%, #FFF1F6 58%, #FFF9F0 100%);
  box-shadow: 0 2px 10px rgba(236,72,153,.06);
  transition: border-color .15s ease, transform .12s ease;
}
.match-invite-btn:hover { border-color: #EDBED5; }
.match-invite-btn:active { transform: scale(.995); }
.mi-ico {
  flex: none; display: grid; place-items: center; width: 34px; height: 34px;
  border-radius: 12px; font-size: 17px; background: #fff;
  box-shadow: 0 2px 8px rgba(236,72,153,.14);
}
.mi-copy { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.mi-copy b { font-size: 13.5px; font-weight: 800; letter-spacing: -.01em; line-height: 1.3; }
.mi-copy span { font-size: 11.5px; color: var(--ink-2); line-height: 1.35; white-space: normal; word-break: keep-all; }
.mi-go { flex: none; color: var(--accent); font-size: 18px; font-weight: 700; line-height: 1; }

.sheet-pad { width: 52px; flex: none; }
.match-lead { margin: 0 0 4px; color: var(--ink-2); font-size: 13px; line-height: 1.6; word-break: keep-all; }

.bday-row { display: grid; grid-template-columns: 1.25fr 1fr .85fr; gap: 7px; }
.bday-y, .bday-m, .bday-d {
  width: 100%; min-width: 0; height: 42px; padding: 0 8px;
  border: 1px solid var(--line); border-radius: 12px; background: #FAFAFA;
  font-size: 14px; color: var(--ink); outline: none;
  -webkit-appearance: none; appearance: none;
}
.bday-y { text-align: center; font-variant-numeric: tabular-nums; }
.bday-m, .bday-d {
  padding-right: 20px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%239CA3AF' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 7px center;
}
.bday-y:focus, .bday-m:focus, .bday-d:focus { border-color: var(--ink-3); background-color: #fff; }
.bday-y::placeholder { color: var(--ink-3); }
.bday-y::-webkit-outer-spin-button, .bday-y::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.bday-y { -moz-appearance: textfield; }

.match-go { width: 100%; margin-top: 16px; padding: 12px 16px; font-size: 14px; }

.match-fine { margin: 14px 0 0; text-align: center; color: var(--ink-3); font-size: 11px; }

.match-result {
  margin-top: 16px; padding: 15px 15px 13px; border-radius: 18px;
  border: 1px solid #F4D7E4;
  background: linear-gradient(165deg, #FFF6FA 0%, #FFFDF8 58%, #F5FBF7 100%);
}
.mr-star { text-align: center; font-size: 13.5px; color: var(--ink-2); }
.mr-star b { color: var(--ink); font-weight: 800; }
.mr-top { display: flex; align-items: center; gap: 14px; margin-top: 8px; }
.mr-score { display: flex; align-items: baseline; flex: none; }
.mr-score b { font-size: 38px; font-weight: 800; line-height: .95; letter-spacing: -.035em; color: #E05A47; }
.mr-score i { font-style: normal; font-size: 16px; font-weight: 800; color: #E05A47; margin-left: 1px; }
.mr-rel { flex: 1; min-width: 0; }
.mr-rel span { display: block; margin-bottom: 3px; font-size: 10.5px; font-weight: 700; letter-spacing: .02em; color: var(--ink-3); }
.mr-rel b { display: block; font-size: 13.5px; font-weight: 800; line-height: 1.4; letter-spacing: -.01em; word-break: keep-all; }
.mr-zodiacs {
  display: flex; align-items: center; gap: 8px; margin-top: 12px;
  padding: 10px 12px; border-radius: 14px; background: rgba(255,255,255,.78);
  border: 1px solid #F6E3EC;
}
.mr-zod { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.mr-zod span { font-size: 10.5px; font-weight: 700; letter-spacing: .02em; color: var(--ink-3); }
.mr-zod b { font-size: 14px; font-weight: 800; letter-spacing: -.01em; }
.mr-zod:last-child { text-align: right; }
.mr-x { flex: none; color: var(--ink-3); font-size: 13px; font-weight: 700; }
.mr-color {
  display: flex; align-items: center; gap: 10px; margin-top: 8px;
  padding: 9px 12px; border-radius: 14px; background: rgba(255,255,255,.78);
  border: 1px solid #F6E3EC;
}
.mr-swatch {
  flex: none; width: 26px; height: 26px; border-radius: 50%;
  border: 1px solid rgba(17,17,17,.12); box-shadow: inset 0 0 0 3px rgba(255,255,255,.55);
}
.mr-color-copy { display: flex; flex-direction: column; gap: 2px; }
.mr-color-copy span { font-size: 10.5px; font-weight: 700; letter-spacing: .02em; color: var(--ink-3); }
.mr-color-copy b { font-size: 13.5px; font-weight: 800; }
.mr-line {
  display: flex; align-items: flex-start; gap: 9px; margin: 11px 0 0;
  padding: 11px 12px; border-radius: 4px 14px 14px 14px; background: #fff;
  border: 1px solid #F6E3EC;
}
.mr-komi { flex: none; width: 26px; height: 26px; border-radius: 50%; object-fit: cover; border: 1px solid var(--line); }
.mr-line span { font-size: 13px; line-height: 1.55; word-break: keep-all; }
.mr-share.pill.primary {
  width: 100%; margin-top: 12px; padding: 11px 16px; font-size: 13.5px;
  background: #E05A47; border-color: #E05A47; color: #fff;
}
.mr-share.pill.primary:hover { background: #D64F3D; border-color: #D64F3D; }
.mr-keyring { margin: 10px 0 0; text-align: center; font-size: 11.5px; color: var(--ink-2); line-height: 1.5; word-break: keep-all; }

/* ---------- Kemi Promise (community guidelines) ---------- */
.promise-row {
  width: calc(100% - 32px); margin: 8px 16px 14px; display: flex; align-items: center; gap: 10px;
  padding: 11px 13px; text-align: left; border: 1px solid var(--line); border-radius: 14px;
  background: linear-gradient(135deg, #FFFDF7 0%, #FCFAFF 100%);
  transition: border-color .15s ease, transform .12s ease;
}
.promise-row:hover { border-color: var(--ink-3); }
.promise-row:active { transform: scale(.995); }
.promise-row-ico {
  flex: none; display: grid; place-items: center; width: 32px; height: 32px;
  border-radius: 11px; background: #fff; font-size: 16px;
  box-shadow: 0 1px 6px rgba(17,17,17,.07);
}
.promise-row-copy { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.promise-row-copy b { font-size: 13.5px; font-weight: 800; letter-spacing: -.01em; }
.promise-row-copy span { font-size: 11.5px; color: var(--ink-2); line-height: 1.35; word-break: keep-all; }
.promise-row-go { flex: none; color: var(--ink-3); font-size: 18px; font-weight: 700; line-height: 1; }

.sheet-promise { z-index: 88; }
.promise-lead { margin: 0 0 14px; color: var(--ink-2); font-size: 13px; line-height: 1.6; word-break: keep-all; }
.promise-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.promise-item {
  display: flex; gap: 11px; padding: 12px 13px;
  border: 1px solid var(--line); border-radius: 14px; background: #FCFCFD;
}
.promise-n {
  flex: none; display: grid; place-items: center; width: 26px; height: 26px;
  border-radius: 50%; background: var(--dc, #4B7F9F); color: #fff;
  font-size: 12.5px; font-weight: 800; line-height: 1;
}
.promise-copy b { display: block; font-size: 13.5px; font-weight: 800; letter-spacing: -.01em; word-break: keep-all; }
.promise-copy p { margin: 3px 0 0; font-size: 12.5px; color: var(--ink-2); line-height: 1.5; word-break: keep-all; }
.promise-foot { margin: 14px 0 0; text-align: center; font-size: 11.5px; color: var(--ink-3); line-height: 1.5; word-break: keep-all; }

/* the warning that holds a post or a reply back */
.kemi-warn {
  margin: 0 0 12px; padding: 12px 13px;
  border: 1px solid #F1C6BC; border-radius: 14px; background: #FFF7F4;
}
.kemi-warn-head { display: flex; align-items: center; gap: 7px; color: #AD4030; font-size: 13.5px; font-weight: 800; letter-spacing: -.01em; }
.kemi-warn-ico { font-size: 15px; line-height: 1; }
.kemi-warn-why { margin: 7px 0 0; color: #8C3A2B; font-size: 12.5px; line-height: 1.5; word-break: keep-all; }
.kemi-warn-fix { margin: 5px 0 0; color: var(--ink-2); font-size: 11.5px; line-height: 1.5; word-break: keep-all; }
.kemi-warn-cta {
  margin-top: 9px; display: inline-flex; align-items: center; gap: 5px;
  padding: 7px 12px; border: 1px solid #E7BCB2; border-radius: 999px;
  background: #fff; color: #8C3A2B; font-size: 12px; font-weight: 700;
}
.kemi-warn-cta:hover { border-color: #AD4030; }
.kemi-warn-inline { margin: 10px 0 2px; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 95;
  transform: translate(-50%, 16px);
  background: var(--ink); color: #fff; font-size: 13px; font-weight: 600;
  padding: 10px 18px; border-radius: 999px; opacity: 0; pointer-events: none;
  transition: opacity .2s ease, transform .2s ease; max-width: 86vw; text-align: center;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- desktop polish ---------- */
@media (min-width: 700px) {
  .topbar-inner, .main { max-width: 620px; }
  .sheet { border-radius: 18px 18px 0 0; }
  .tabbar { max-width: 620px; margin: 0 auto; border: 1px solid var(--line); border-bottom: 0; border-radius: 18px 18px 0 0; }
}
@media (min-width: 900px) {
  body { background: #F5F5F6; }
  .app { max-width: 620px; margin: 0 auto; box-shadow: 0 0 0 1px var(--line); min-height: 100dvh; background: #fff; }
  .tabbar { left: 50%; right: auto; transform: translateX(-50%); width: 620px; margin: 0; }
  .tabbar { border-radius: 0; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ---------- right to left (Arabic, Hebrew, Persian, Urdu, …) ----------
   The page itself flips with dir="rtl"; these are the few places where the
   layout is anchored to a physical side. */
[dir="rtl"] .lang-menu { right: auto; left: 0; }
[dir="rtl"] .lang-item { text-align: right; }
[dir="rtl"] .post-tools,
[dir="rtl"] .shop-tools { margin-left: 0; margin-right: auto; }
[dir="rtl"] .follow-btn { margin-left: 0; margin-right: auto; }
[dir="rtl"] .mi-go { transform: scaleX(-1); }
[dir="rtl"] .mr-score i { margin-left: 0; margin-right: 1px; }
[dir="rtl"] .toast { direction: rtl; }

/* a language name in its own script, so the menu reads as it would at home */
.lang-item .lang-label[lang="ar"],
.lang-item .lang-label[lang="hi"],
.lang-item .lang-label[lang="th"] { font-size: 14px; }
