:root {
  --bg: #eef4ef;
  --card: #fafdfa;
  --ink: #1d2733;
  --soft: #5d6875;
  --line: #ddd6c8;
  --accent: #2f7d6b;
  --accent-ink: #ffffff;
  --live: #1f8a4c;
  --warn: #b25b00;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14181d;
    --card: #1d232a;
    --ink: #eef1f4;
    --soft: #9aa5b1;
    --line: #313a44;
    --accent: #6fd1b4;
    --accent-ink: #06201a;
    --live: #5fd08c;
    --warn: #ffb35c;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", system-ui, sans-serif;
  -webkit-text-size-adjust: 100%;
}
main {
  max-width: 560px;
  margin: 0 auto;
  padding: 16px 16px calc(24px + env(safe-area-inset-bottom));
  display: grid;
  gap: 14px;
}
.head h1 {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.3;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}
.status { margin: 4px 0 0; color: var(--soft); font-size: 0.95rem; font-variant-numeric: tabular-nums; }
.status.live { color: var(--live); font-weight: 600; }
.status.stale { color: var(--warn); font-weight: 600; }

.map-box {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: var(--card);
}
.map { height: 45vh; min-height: 240px; max-height: 460px; }
.open-map {
  position: absolute;
  right: 10px;
  bottom: 26px;
  z-index: 500;
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}
.pin {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid #fff;
  box-shadow: 0 0 0 2px var(--accent), 0 3px 8px rgba(0, 0, 0, 0.35);
}

.notice {
  border: 1px dashed var(--line);
  border-radius: 14px;
  padding: 28px 18px;
  text-align: center;
  color: var(--soft);
  background: var(--card);
}

.reply {
  display: grid;
  gap: 10px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
}
.reply label { display: grid; gap: 4px; font-size: 0.85rem; color: var(--soft); font-weight: 600; }
.reply input {
  font: inherit;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 12px;
  width: 100%;
}
.reply input:focus-visible, .reply button:focus-visible, .open-map:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}
.reply button {
  font: inherit;
  font-weight: 700;
  border: 0;
  border-radius: 12px;
  padding: 14px;
  background: var(--accent);
  color: var(--accent-ink);
  cursor: pointer;
}
.reply button:disabled { opacity: 0.55; cursor: default; }
.form-msg { margin: 0; min-height: 1.4em; font-size: 0.9rem; color: var(--soft); }
.form-msg.ok { color: var(--live); font-weight: 600; }
.form-msg.bad { color: var(--warn); font-weight: 600; }

.replies h2 { margin: 0 0 6px; font-size: 0.85rem; color: var(--soft); font-weight: 700; }
.replies ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.replies li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 10px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
}
.replies .who { font-weight: 700; overflow-wrap: anywhere; }
.replies .who .ack { color: var(--live); margin-left: 4px; }
.replies .when { color: var(--soft); font-size: 0.85rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.replies .text { grid-column: 1 / -1; overflow-wrap: anywhere; white-space: pre-wrap; }
[hidden] { display: none !important; }

/* 친구 초대 안내 화면 */
.invite { display: grid; gap: 10px; margin-top: 18px; }
.invite .button {
  display: block;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  color: var(--ink);
  font-weight: 700;
  font-size: 1.05rem;
  text-align: center;
  text-decoration: none;
}
.invite .button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.invite .hint { margin: 0 2px 8px; color: var(--soft); font-size: 0.9rem; line-height: 1.5; }
.foot { margin-top: 28px; color: var(--soft); font-size: 0.85rem; text-align: center; }

/* 보낸 사람이 붙인 한마디 */
.note {
  margin: 10px 0 0;
  padding: 10px 14px;
  border-left: 4px solid var(--accent);
  border-radius: 0 12px 12px 0;
  background: var(--card);
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
/* 답장의 자주 쓰는 말 */
.quick { display: flex; flex-wrap: wrap; gap: 8px; margin: 2px 0 12px; }
.reply .quick button {
  min-height: 0;
  margin: 0;
  font-weight: 500;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.92rem;
  width: auto;
}

.invite-art { display: block; width: 240px; max-width: 70%; height: auto; margin: 0 auto 6px; border-radius: 18px; }

/* ── 소개 · 웹에서 보내기 · 개인정보 안내 ── */
main.wide { max-width: 760px; }
.site-head { display: flex; align-items: center; gap: 14px; }
.site-head h1 { margin: 0; font-size: 1.7rem; line-height: 1.2; letter-spacing: -0.02em; }
.site-logo { display: block; width: 56px; height: 56px; border-radius: 14px; }
.site-tag { margin: 2px 0 0; color: var(--soft); }
.site-hero { display: block; width: 100%; height: auto; border-radius: 20px; }
.site-lead { margin: 4px 0; font-size: 1.12rem; line-height: 1.65; }
.site-cta { display: grid; gap: 10px; }
.site-cta .button, .invite button.button {
  display: block;
  width: 100%;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  font-size: 1.05rem;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}
.site-cta .button.primary, .invite button.button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.invite .button.danger { color: #b3261e; }
.invite .button[hidden] { display: none; }
.invite button.button:disabled { opacity: 0.55; cursor: default; }
.hint { margin: 0; color: var(--soft); font-size: 0.9rem; line-height: 1.5; }
.hint.center { text-align: center; }
.site-section { display: grid; gap: 12px; margin-top: 14px; }
.site-section h2 { margin: 0; font-size: 1.25rem; letter-spacing: -0.01em; }
.steps { margin: 0; padding: 0; list-style: none; counter-reset: step; display: grid; gap: 10px; }
.steps li {
  counter-increment: step;
  position: relative;
  padding: 14px 14px 14px 58px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
}
.steps li::before {
  content: counter(step);
  position: absolute;
  left: 14px;
  top: 14px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 800;
  display: grid;
  place-items: center;
}
.steps b { display: block; }
.steps span { color: var(--soft); }
.cards { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.card { border: 1px solid var(--line); border-radius: 18px; background: var(--card); overflow: hidden; }
.card img { display: block; width: 100%; height: 180px; object-fit: cover; }
.card h3 { margin: 12px 14px 4px; font-size: 1.05rem; }
.card p { margin: 0 14px 14px; color: var(--soft); font-size: 0.95rem; }
.faq { margin: 0; display: grid; gap: 4px; }
.faq dt { font-weight: 700; margin-top: 10px; }
.faq dd { margin: 0; color: var(--soft); }
.foot a, .faq a, .prose a { color: var(--accent); }
.sent-title { margin: 0; font-size: 1.3rem; }
.link-box {
  margin: 0;
  padding: 12px 14px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: var(--card);
  font-size: 0.92rem;
  overflow-wrap: anywhere;
  user-select: all;
}
.reply-head { display: flex; justify-content: space-between; gap: 10px; }
.reply-head span { color: var(--soft); font-size: 0.85rem; white-space: nowrap; }
.replies li p { margin: 2px 0 0; overflow-wrap: anywhere; }
.prose h2 { margin: 18px 0 4px; font-size: 1.15rem; }
.prose p, .prose ul { margin: 0; }
.prose ul { padding-left: 20px; display: grid; gap: 6px; }
.prose table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.prose th, .prose td { text-align: left; vertical-align: top; padding: 10px; border-bottom: 1px solid var(--line); }
.prose th { color: var(--soft); font-weight: 700; }
.prose td:last-child { width: 42%; }

/* ── 내 프로필(웹) ── */
.panel { display: grid; gap: 10px; padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--card); }
.panel h2 { margin: 0; font-size: 1.1rem; }
.status-line { margin: 0; color: var(--soft); }
.status-line.on { color: var(--ink); font-weight: 700; font-size: 1.1rem; }
.panel .quick { margin: 0; }
.panel .quick button {
  padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; background: transparent;
  color: var(--ink); font: inherit; font-size: 0.92rem; cursor: pointer;
}
.panel .quick button.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 700; }
.field { display: grid; gap: 4px; font-size: 0.9rem; color: var(--soft); }
.field input, .field select {
  font: inherit; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--ink);
}
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.panel .button {
  display: block; width: 100%; padding: 13px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg);
  color: var(--ink); font: inherit; font-weight: 700; text-align: center; text-decoration: none; cursor: pointer;
}
.panel .button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.panel .button.danger { color: #b3261e; }
.panel .button[hidden] { display: none; }
.people { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.people li { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); }
.people .who { flex: 1; min-width: 0; display: grid; color: var(--ink); text-decoration: none; }
.people .who strong { overflow-wrap: anywhere; }
.people .state { color: var(--soft); font-size: 0.88rem; overflow-wrap: anywhere; }
.people .state.on { color: var(--accent); font-weight: 600; }
.mini { padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--ink); font: inherit; font-size: 0.88rem; font-weight: 700; cursor: pointer; white-space: nowrap; }
.mini.quiet { font-weight: 500; color: var(--soft); }
#profile { display: grid; gap: 14px; }

/* 프로필 그림 */
.avatar { display: inline-grid; place-items: center; flex: none; border-radius: 50%; overflow: hidden; background: var(--line); color: var(--ink); font-weight: 800; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.me-row { display: flex; align-items: center; gap: 14px; }
.me-row .button { flex: 1; }
.avatar-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin: 8px 0; }
.avatar-cell { border: 3px solid transparent; border-radius: 50%; padding: 0; background: none; cursor: pointer; line-height: 0; }
.avatar-cell .avatar { width: 100%; aspect-ratio: 1; }
.avatar-cell.on { border-color: var(--accent); }
.scene { display: block; width: 100%; max-height: 200px; object-fit: cover; border-radius: 14px; }

.panel .button.file { display: block; cursor: pointer; }

.dlg { width: min(92vw, 420px); border: 0; border-radius: 20px; padding: 20px; background: var(--card); color: var(--ink); text-align: center; }
.dlg::backdrop { background: rgba(0, 0, 0, 0.5); }
.dlg h2 { margin: 8px 0; }
.dlg video { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 16px; background: var(--line); }
.dlg .avatar { margin: 0 auto; }
.dlg .button { margin-top: 12px; display: block; width: 100%; padding: 13px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--ink); font: inherit; font-weight: 700; cursor: pointer; }

/* 관리자 대시보드 */
.admin { border: 1px solid var(--line); border-radius: 16px; background: var(--card); padding: 4px 14px 14px; }
.admin summary { cursor: pointer; padding: 12px 0; font-weight: 700; }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.cards4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; margin: 10px 0; }
.stat { padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); text-align: center; }
.stat strong { display: block; font-size: 1.2rem; }
.stat span { color: var(--soft); font-size: 0.82rem; }
.tablewrap { overflow-x: auto; margin: 10px 0; }
.log { width: 100%; border-collapse: collapse; font-size: 0.88rem; min-width: 640px; }
.log th, .log td { text-align: left; vertical-align: top; padding: 8px; border-bottom: 1px solid var(--line); }
.log th { color: var(--soft); font-weight: 700; white-space: nowrap; }
.log td.ok { color: var(--live); font-weight: 600; }
.log td.no { color: var(--soft); }
.admin .button { display: block; width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--ink); font: inherit; font-weight: 700; cursor: pointer; margin-top: 8px; }
.admin .button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.admin .row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* 채팅 */
.chat { margin: 18px 0; padding: 14px; border: 1px solid var(--line); border-radius: 18px; background: var(--card); }
.chat-title { margin: 0 0 8px; font-size: 1.05rem; }
.chat-list, .chat-threads { list-style: none; margin: 0; padding: 0; }
.chat-list { max-height: 320px; min-height: 90px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 4px 2px 8px; }
.chat-row { display: flex; }
.chat-row.mine { justify-content: flex-end; }
.chat-bubble { max-width: 82%; padding: 8px 12px 6px; border-radius: 16px; background: var(--bg); border: 1px solid var(--line); word-break: break-word; }
.chat-row.mine .chat-bubble { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chat-name { display: block; font-size: 0.78rem; opacity: 0.75; }
.chat-text { white-space: pre-wrap; }
.chat-time { display: block; text-align: right; font-size: 0.7rem; opacity: 0.65; margin-top: 2px; }
.chat-form { display: flex; gap: 8px; margin-top: 6px; }
.chat-form input { flex: 1; min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 12px; font: inherit; background: var(--bg); color: var(--ink); }
.chat-send { padding: 0 18px; border: 0; border-radius: 12px; background: var(--accent); color: var(--accent-ink); font: inherit; font-weight: 700; cursor: pointer; }
.chat-send:disabled { opacity: 0.5; }
.chat-thread { display: flex; flex-direction: column; align-items: flex-start; width: 100%; padding: 10px 12px; margin-bottom: 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.chat-last { font-size: 0.85rem; opacity: 0.75; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-back { border: 0; background: none; color: var(--accent); font: inherit; font-weight: 700; padding: 4px 0; cursor: pointer; }
.chat-with { display: block; margin: 4px 0 6px; }

/* 홈 단추 */
.homebtn { display: inline-flex; align-items: center; gap: 6px; margin: 0 0 12px; padding: 8px 14px; border: 1.5px solid var(--accent); border-radius: 999px; color: var(--accent); background: var(--card); font-weight: 700; font-size: 0.9rem; text-decoration: none; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); }
.homebtn:hover, .homebtn:focus-visible { background: var(--accent); color: var(--accent-ink); }

/* 사용법 */
.guide-toc { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 6px; }
.guide-toc a { padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); color: var(--ink); text-decoration: none; font-size: 0.88rem; }
.guide-step { margin-top: 26px; scroll-margin-top: 12px; }
.guide-step img { display: block; max-width: 100%; height: auto; max-height: 260px; margin: 8px auto 12px; border-radius: 18px; object-fit: cover; }
.guide .steps { counter-reset: step; list-style: none; padding: 0; display: grid; gap: 10px; }
.guide .steps li { counter-increment: step; position: relative; padding: 12px 14px 12px 52px; border: 1px solid var(--line); border-radius: 16px; background: var(--card); }
.guide .steps li::before { content: counter(step); position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-weight: 800; }
.guide details { border: 1px solid var(--line); border-radius: 14px; background: var(--card); padding: 10px 14px; margin: 8px 0; }
.guide summary { cursor: pointer; font-weight: 700; }

.en { font-size: 0.55em; font-weight: 600; color: var(--soft); letter-spacing: 0.02em; white-space: nowrap; }

/* 상태 스티커·이모지 고르기 */
.sub { font-size: 0.95rem; margin: 14px 0 6px; }
.scene.sticker { object-fit: contain; background: #f4f1ea; max-height: 180px; }
.stickers { display: flex; flex-wrap: wrap; gap: 6px; }
.stickers button { width: 56px; height: 56px; padding: 3px; border: 1px solid var(--line, #d8d2c6); border-radius: 12px; background: transparent; cursor: pointer; }
.stickers button.on { border: 3px solid var(--accent); padding: 1px; }
.stickers img { display: block; width: 100%; height: 100%; object-fit: contain; }
.emojis { display: flex; flex-wrap: wrap; gap: 2px; }
.emojis button { width: 42px; height: 42px; font-size: 1.4rem; border: 0; border-radius: 10px; background: transparent; cursor: pointer; }
.emojis button.on { background: var(--accent); }

/* 보낸 사람의 지금 상태 */
.sender { display: flex; align-items: center; gap: 12px; margin: 12px 0 0; padding: 10px 14px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); }
.sender[hidden] { display: none; }
.sender-photo { display: block; width: 100%; max-height: 320px; object-fit: cover; margin: 12px 0 0; border-radius: 16px; border: 1px solid var(--line); background: #f4f1ea; }
.sender-photo[hidden] { display: none; }
.sender-pic { width: 84px; height: 84px; object-fit: contain; border-radius: 12px; background: #f4f1ea; }
.sender-emoji { font-size: 2.2rem; line-height: 1; margin-right: 8px; }
.sender-line { font-size: 1.1rem; font-weight: 700; }
.app-open { display: inline-block; margin-top: 12px; padding: 12px 20px; border-radius: 14px; background: var(--accent); color: var(--accent-ink); font-weight: 800; text-decoration: none; box-shadow: 0 4px 0 rgba(0,0,0,.2); }
.app-open[hidden] { display: none; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 8px; }
.tabs button { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: inherit; font: inherit; cursor: pointer; }
.tabs button.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.avatar.emoji-avatar { display: inline-flex; align-items: center; justify-content: center; font-size: 1.6em; background: var(--card); }

/* 나 여기! 의 느낌표 / 지금 어디? 의 물음표 모티프 */
.mark-bang { color: #e2552b; font-size: 1.3em; margin-left: 0.04em; }

/* 관리자: 회원·신고 표의 작은 단추 */
.admin .acts { white-space: nowrap; }
.admin .mini { padding: 6px 10px; margin: 2px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--ink); font: inherit; font-size: 0.85rem; font-weight: 700; cursor: pointer; }
.admin .mini.danger { color: #b3261e; border-color: #b3261e; }
.admin .acts input { padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--ink); font: inherit; font-size: 0.85rem; width: 9em; }
.admin .temp { display: inline-block; padding: 8px 12px; border-radius: 10px; background: var(--bg); font-size: 1.2rem; letter-spacing: 0.05em; user-select: all; }

/* 위치 보기 화면의 답장 말 후보: 한 줄에서 옆으로 밀어 고른다(줄바꿈 없음) */
.reply .quick {
  flex-wrap: nowrap;
  overflow-x: auto;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.reply .quick::-webkit-scrollbar { display: none; }
.reply .quick button { flex: 0 0 auto; white-space: nowrap; }
.reply label.msg { font-size: 1rem; font-weight: 700; color: var(--ink); }
.reply label.msg input { border: 2px solid #2b7a6b; background: #fff; color: #1b2b26; padding: 14px 12px; font-size: 1rem; }
.reply label.msg input:focus { border-color: #1d5a4e; box-shadow: 0 0 0 3px #2b7a6b44; }
