/* ============================================================
   담벼락 — style.css
   본문 Pretendard / 쪽지 문장 Gowun Batang
   ============================================================ */

:root {
  --ink: #18181B;
  --ink-60: #52525B;
  --ink-40: #8A8A93;
  --ink-20: #D4D4D8;
  --bg: #FAF9F7;
  --surface: #FFFFFF;
  --line: #EAE7E1;
  --pink: #F6D9DF;
  --pink-deep: #E9A8B6;
  --danger: #C0526B;

  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 22px;

  --shadow-1: 0 1px 2px rgba(24, 24, 27, .05);
  --shadow-2: 0 6px 20px rgba(24, 24, 27, .07);
  --shadow-3: 0 14px 40px rgba(24, 24, 27, .12);

  --serif: 'Gowun Batang', 'Pretendard Variable', serif;
  --sans: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont,
          system-ui, 'Segoe UI', 'Malgun Gothic', sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

button, input, textarea, select { font-family: inherit; font-size: 100%; color: inherit; }

/* .btn / .field 등이 display 를 지정하므로 [hidden] 을 명시적으로 이겨줘야 한다 */
.hidden { display: none !important; }
[hidden] { display: none !important; }

a { color: inherit; }

/* ── 버튼 ────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 11px 20px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: transform .12s ease, background .15s ease,
              border-color .15s ease, box-shadow .15s ease, opacity .15s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.975); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn:focus-visible { outline: 2px solid var(--pink-deep); outline-offset: 2px; }

.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover:not(:disabled) { background: #000; box-shadow: var(--shadow-2); }

.btn-ghost { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn-ghost:hover:not(:disabled) { border-color: var(--ink-20); box-shadow: var(--shadow-1); }

.btn-quiet {
  background: transparent; border-color: var(--line); color: var(--ink-60);
  padding: 9px 14px; font-size: 13px;
}
.btn-quiet:hover:not(:disabled) { background: #fff; color: var(--ink); border-color: var(--ink-20); }
.btn-block { width: 100%; }

/* ── 부팅 ────────────────────────────────────────────── */
.boot {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 18px;
  background: var(--bg); z-index: 100;
}
.boot-mark {
  width: 54px; height: 54px;
  display: grid; place-items: center;
  border-radius: 16px; background: var(--pink);
  font-family: var(--serif); font-size: 24px;
  animation: breathe 1.6s ease-in-out infinite;
}
.boot-text { margin: 0; color: var(--ink-40); font-size: 13px; }
@keyframes breathe {
  0%, 100% { transform: scale(1) rotate(-3deg); opacity: .85; }
  50%      { transform: scale(1.07) rotate(3deg); opacity: 1; }
}

/* ── 로그인 / 참여 카드 ──────────────────────────────── */
.auth {
  min-height: 100dvh;
  display: grid; place-items: center;
  padding: 28px 20px calc(28px + env(safe-area-inset-bottom));
  background:
    radial-gradient(900px 460px at 12% -8%, rgba(246, 217, 223, .55), transparent 62%),
    radial-gradient(760px 420px at 92% 108%, rgba(246, 217, 223, .38), transparent 60%),
    var(--bg);
}
.auth-card {
  width: 100%; max-width: 392px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-3);
  padding: 34px 30px 26px;
  animation: rise .45s cubic-bezier(.2, .8, .3, 1) both;
}
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.auth-head { text-align: center; margin-bottom: 24px; }
.join-kicker {
  margin: 0 0 6px; font-size: 11.5px; font-weight: 700;
  letter-spacing: .08em; color: var(--pink-deep); text-transform: uppercase;
}
.auth-title {
  margin: 0 0 8px;
  font-family: var(--serif);
  font-size: 32px; font-weight: 700; letter-spacing: -.02em;
  word-break: keep-all;
}
.auth-sub { margin: 0; color: var(--ink-40); font-size: 13.5px; line-height: 1.6; }

.tabs {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px;
  background: #F4F2EF; border-radius: 999px; padding: 4px; margin-bottom: 20px;
}
.tab {
  border: 0; background: transparent; border-radius: 999px;
  padding: 9px 0; font-size: 13.5px; font-weight: 600;
  color: var(--ink-40); cursor: pointer; transition: all .18s ease;
}
.tab.is-active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }

.auth-form { display: flex; flex-direction: column; gap: 14px; }
.field { display: block; }
.field-label {
  display: block; margin-bottom: 6px;
  font-size: 12px; font-weight: 600; color: var(--ink-60);
}
.field input {
  width: 100%;
  border: 1px solid var(--line);
  background: #FCFBFA;
  border-radius: var(--r-md);
  padding: 13px 14px;
  font-size: 14.5px;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.field input::placeholder { color: #B8B5AF; }
.field input:focus {
  outline: 0; background: #fff;
  border-color: var(--pink-deep);
  box-shadow: 0 0 0 3px rgba(233, 168, 182, .22);
}

.auth-error, .composer-error {
  margin: 0;
  background: #FDF0F2;
  border: 1px solid #F5D3D9;
  color: #9E3B4E;
  border-radius: var(--r-sm);
  padding: 10px 12px;
  font-size: 13px; line-height: 1.55;
}
#auth-submit, #join-submit { margin-top: 4px; padding: 14px; font-size: 14.5px; }

.divider {
  display: flex; align-items: center; gap: 12px;
  margin: 20px 0 14px; color: var(--ink-40); font-size: 12px;
}
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }

.g-icon { width: 17px; height: 17px; }
.auth-note {
  margin: 18px 0 0; text-align: center;
  font-size: 11.5px; line-height: 1.7; color: var(--ink-40);
}

/* ── 상단바 ──────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(250, 249, 247, .84);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1240px; margin: 0 auto;
  padding: 12px 18px;
  display: flex; align-items: center; gap: 12px;
}
.brand {
  margin: 0;
  font-family: var(--serif);
  font-size: 21px; font-weight: 700; letter-spacing: -.01em;
}
.wall-name {
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
#home-view .brand { flex: 1; }
#btn-home { flex: none; padding: 8px 13px; font-size: 15px; }

.me { display: flex; align-items: center; gap: 9px; min-width: 0; flex: none; }
.me-badge {
  flex: none; width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: 50%; background: var(--pink);
  font-size: 12.5px; font-weight: 700;
}
.me-name {
  font-size: 13px; color: var(--ink-60);
  max-width: 26vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ── 툴바 (칩) ───────────────────────────────────────── */
.toolbar {
  max-width: 1240px; margin: 0 auto;
  padding: 0 18px 11px;
  display: flex; align-items: center; gap: 7px;
  overflow-x: auto; scrollbar-width: thin;
}
.chip {
  flex: none;
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  padding: 7px 13px;
  font-size: 12.5px; font-weight: 600; color: var(--ink-60);
  cursor: pointer; white-space: nowrap;
  transition: border-color .15s ease, color .15s ease, box-shadow .15s ease;
}
.chip:hover { color: var(--ink); border-color: var(--ink-20); box-shadow: var(--shadow-1); }
.chip-accent { background: var(--pink); border-color: transparent; color: var(--ink); }
.chip-danger { color: var(--danger); }
.chip-danger:hover { border-color: var(--danger); color: var(--danger); }
.chip-select { cursor: default; padding-right: 8px; }
.chip-select select {
  border: 0; background: transparent; cursor: pointer;
  font-size: 12.5px; font-weight: 700; color: var(--ink);
  padding: 2px 2px 2px 4px;
}
.chip-select select:focus { outline: none; }

/* ── 홈 (벽 목록) ────────────────────────────────────── */
.home-main { max-width: 1240px; margin: 0 auto; padding: 28px 18px 80px; }
.home-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 20px; flex-wrap: wrap;
}
.home-title { margin: 0; font-family: var(--serif); font-size: 24px; }

.wall-list {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.wall-card {
  text-align: left;
  display: flex; flex-direction: column; gap: 7px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 20px 18px;
  cursor: pointer;
  box-shadow: var(--shadow-1);
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.wall-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-2); border-color: var(--ink-20); }
.wall-card-title { font-size: 15.5px; font-weight: 700; word-break: keep-all; }
.wall-card-sub { font-size: 12px; color: var(--ink-40); }

/* ── 요금제 / 저장 용량 ─────────────────────────────── */
.usage-box {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 16px 18px;
  margin-bottom: 22px;
  box-shadow: var(--shadow-1);
}
.usage-top {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 10px; margin-bottom: 9px; flex-wrap: wrap;
}
.usage-plan {
  font-size: 12px; font-weight: 700;
  background: var(--pink); color: var(--ink);
  border-radius: 999px; padding: 4px 11px;
}
.usage-num { font-size: 12.5px; color: var(--ink-60); font-variant-numeric: tabular-nums; }
.usage-bar { height: 6px; border-radius: 999px; background: #EFECE6; overflow: hidden; }
.usage-fill {
  height: 100%; width: 0%;
  background: var(--ink); border-radius: 999px;
  transition: width .3s ease, background .2s ease;
}
.usage-fill.is-full { background: var(--danger); }
.usage-note { margin: 10px 0 12px; font-size: 12px; color: var(--ink-40); line-height: 1.6; }
.usage-box .btn { padding: 8px 15px; font-size: 12.5px; }

.plans { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; margin-top: 18px; }
@media (max-width: 520px) { .plans { grid-template-columns: 1fr; } }
.plan-card {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 18px 16px;
  background: #FCFBFA;
}
.plan-card.is-pro { border-color: var(--ink); background: var(--surface); box-shadow: var(--shadow-2); }
.plan-card h3 { margin: 0 0 4px; font-size: 15px; }
.plan-price { margin: 0 0 12px; font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.plan-price span { font-size: 12px; font-weight: 500; color: var(--ink-40); }
.plan-card ul { margin: 0 0 14px; padding-left: 17px; }
.plan-card li { font-size: 12.5px; line-height: 1.9; color: var(--ink-60); }
.plan-card li b { color: var(--ink); }
.plan-notice {
  margin-top: 16px;
  background: #FFF8E8; border: 1px solid #F0E2C0; color: #6B5424;
  border-radius: var(--r-sm); padding: 11px 13px;
  font-size: 12.5px; line-height: 1.7;
}

/* ── 게스트(비로그인) 안내 바 ───────────────────────── */
.guest-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; flex-wrap: wrap;
  background: var(--surface);
  border: 1px dashed var(--pink-deep);
  border-radius: var(--r-lg);
  padding: 16px 18px;
  margin-bottom: 26px;
}
.guest-copy { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.guest-copy b { font-size: 14px; }
.guest-copy span { font-size: 12.5px; color: var(--ink-40); }
.guest-form { display: flex; gap: 8px; flex: none; }
.guest-form input {
  border: 1px solid var(--line); background: #FCFBFA;
  border-radius: 999px; padding: 10px 16px; font-size: 13.5px; width: 140px;
}
.guest-form input:focus {
  outline: 0; background: #fff; border-color: var(--pink-deep);
  box-shadow: 0 0 0 3px rgba(233, 168, 182, .2);
}

/* ── 만료된 사진 ─────────────────────────────────────── */
.img-expired {
  display: flex; align-items: center; gap: 9px;
  background: rgba(255, 255, 255, .55);
  border: 1px dashed rgba(24, 24, 27, .18);
  border-radius: var(--r-sm);
  padding: 16px 14px;
  margin-bottom: 12px;
  font-size: 12px; color: var(--ink-60); line-height: 1.5;
}
.img-expired-mark { font-size: 17px; opacity: .45; flex: none; }

.recent { margin-top: 40px; }
.recent-title {
  margin: 0 0 14px; font-size: 13px; font-weight: 700;
  color: var(--ink-40); letter-spacing: .02em;
}

/* ── 작성 영역 ───────────────────────────────────────── */
.wall-main { max-width: 1240px; margin: 0 auto; padding: 20px 18px 80px; }

.composer {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-2);
  padding: 16px;
  margin-bottom: 26px;
}
.composer-text {
  width: 100%;
  border: 0; resize: none; background: transparent;
  font-family: var(--serif);
  font-size: 16.5px; line-height: 1.75;
  padding: 4px 2px 10px;
  min-height: 76px;
}
.composer-text:focus { outline: 0; }
.composer-text::placeholder { font-family: var(--sans); font-size: 14.5px; color: #B8B5AF; }

.link-row { display: flex; align-items: center; gap: 8px; margin: 2px 0 12px; }
.link-input {
  flex: 1;
  border: 1px solid var(--line); background: #FCFBFA;
  border-radius: var(--r-sm);
  padding: 10px 12px; font-size: 13.5px;
}
.link-input:focus {
  outline: 0; background: #fff; border-color: var(--pink-deep);
  box-shadow: 0 0 0 3px rgba(233, 168, 182, .2);
}
.link-remove {
  flex: none; width: 28px; height: 28px;
  border-radius: 50%; border: 1px solid var(--line);
  background: var(--surface); font-size: 16px; line-height: 1; cursor: pointer;
}

.composer-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  border-top: 1px solid var(--line);
  padding-top: 13px;
}
.colors { display: flex; gap: 7px; }
.swatch {
  width: 25px; height: 25px;
  border-radius: 50%;
  border: 1px solid rgba(24, 24, 27, .10);
  cursor: pointer; padding: 0;
  transition: transform .14s ease, box-shadow .14s ease;
}
.swatch:hover { transform: scale(1.12); }
.swatch[aria-checked="true"] {
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--ink);
  transform: scale(1.06);
}
.swatch:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

.composer-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.counter { font-size: 12px; color: var(--ink-40); font-variant-numeric: tabular-nums; }
.counter.is-over { color: #C0392B; font-weight: 700; }
.file-btn { cursor: pointer; }

.image-preview { position: relative; margin: 6px 0 12px; width: fit-content; }
.image-preview img {
  max-height: 148px; max-width: 100%;
  border-radius: var(--r-md); border: 1px solid var(--line);
  display: block;
}
.image-remove {
  position: absolute; top: -8px; right: -8px;
  width: 25px; height: 25px;
  border-radius: 50%; border: 1px solid var(--line);
  background: var(--surface); font-size: 16px; line-height: 1; cursor: pointer;
  box-shadow: var(--shadow-1);
}

.upload-bar { height: 3px; border-radius: 999px; background: var(--line); margin-top: 12px; overflow: hidden; }
.upload-fill { height: 100%; width: 0%; background: var(--ink); border-radius: 999px; transition: width .2s ease; }
.composer-error { margin-top: 12px; }

/* ── 담벼락: 전체 보기 (메이슨리) ────────────────────── */
.board { columns: 1; column-gap: 16px; }
@media (min-width: 640px)  { .board { columns: 2; } }
@media (min-width: 1000px) { .board { columns: 3; column-gap: 18px; } }
@media (min-width: 1400px) { .board { columns: 4; } }

/* ── 담벼락: 섹션·색상별 보기 (선반) ─────────────────── */
.shelf {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(260px, 1fr);
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 12px;
  scroll-snap-type: x proximity;
}
.shelf-col {
  scroll-snap-align: start;
  background: rgba(255, 255, 255, .55);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 14px 12px 6px;
  min-width: 0;
}
.shelf-head {
  display: flex; align-items: center; gap: 7px;
  margin: 0 4px 12px;
  font-size: 13.5px; font-weight: 700;
}
.shelf-dot { width: 11px; height: 11px; border-radius: 50%; border: 1px solid rgba(24,24,27,.1); flex: none; }
.shelf-count {
  margin-left: auto;
  background: rgba(24, 24, 27, .06);
  border-radius: 999px; padding: 2px 8px;
  font-size: 11.5px; color: var(--ink-60); font-variant-numeric: tabular-nums;
}
.shelf-body { min-height: 20px; }
.shelf-empty { margin: 8px 4px 16px; font-size: 12.5px; color: var(--ink-40); }

@media (max-width: 640px) {
  .shelf { grid-auto-columns: 84vw; }
}

/* ── 쪽지 ────────────────────────────────────────────── */
.note {
  break-inside: avoid;
  -webkit-column-break-inside: avoid;
  page-break-inside: avoid;
  display: block;
  margin: 0 0 16px;
  border-radius: var(--r-md);
  padding: 17px 17px 13px;
  box-shadow: var(--shadow-2);
  border: 1px solid rgba(24, 24, 27, .05);
  transition: transform .18s cubic-bezier(.2, .8, .3, 1), box-shadow .18s ease;
}
.note:hover { transform: rotate(0deg) translateY(-3px) !important; box-shadow: var(--shadow-3); }
.note.is-new { animation: pin .34s cubic-bezier(.2, .9, .3, 1) both; }
@keyframes pin {
  from { opacity: 0; transform: translateY(10px) scale(.97); }
  to   { opacity: 1; }
}

.note-img {
  width: 100%; display: block;
  border-radius: var(--r-sm);
  margin-bottom: 12px;
  background: rgba(255, 255, 255, .5);
}
.note-text {
  margin: 0 0 12px;
  font-family: var(--serif);
  font-size: 16px; line-height: 1.78;
  white-space: pre-wrap; word-break: break-word; overflow-wrap: anywhere;
}
.inline-link { color: #2F6FB5; text-decoration: underline; text-underline-offset: 2px; }

.link-card {
  display: flex; align-items: center; gap: 10px;
  background: rgba(255, 255, 255, .72);
  border: 1px solid rgba(24, 24, 27, .08);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  margin-bottom: 12px;
  text-decoration: none;
  transition: background .15s ease, border-color .15s ease;
}
.link-card:hover { background: #fff; border-color: var(--ink-20); }
/* 미리보기가 붙으면 세로로 쌓아 카드처럼 보이게 한다 */
.link-card.has-thumb { flex-direction: column; align-items: stretch; gap: 0; padding: 0; overflow: hidden; }
.link-card.has-thumb .link-icon { display: none; }
.link-card.has-thumb .link-body { padding: 10px 12px; }
.link-thumb {
  width: 100%; aspect-ratio: 1.91 / 1;
  object-fit: cover; display: block;
  background: rgba(24, 24, 27, .05);
}
.link-card.has-preview .link-host {
  white-space: normal; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  line-height: 1.4;
}
.link-icon { font-size: 15px; flex: none; }
.link-body { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.link-host { font-size: 12.5px; font-weight: 700; }
.link-url {
  font-size: 11px; color: var(--ink-60);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.note-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  border-top: 1px solid rgba(24, 24, 27, .08);
  padding-top: 10px;
}
.note-meta { min-width: 0; }
.note-name {
  display: block; font-size: 12.5px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.note-time { display: block; margin-top: 2px; font-size: 11px; color: var(--ink-60); opacity: .75; }
/* ── 자유 배치 ──────────────────────────────────────── */
.board-free {
  position: relative;
  min-height: 420px;
  overflow: auto;
  touch-action: none;          /* 모바일에서 드래그가 스크롤로 새지 않게 */
}
.board-free .note {
  position: absolute;
  width: 260px;
  margin: 0;
  cursor: grab;
  user-select: none;
}
.board-free .note.is-dragging {
  cursor: grabbing;
  z-index: 60;
  box-shadow: 0 18px 40px rgba(24, 24, 27, .22);
  transition: none;            /* 끌 때는 따라오는 느낌이 나야 한다 */
}
/* 본문 수정 중에는 글자를 고를 수 있어야 하므로 드래그 금지 */
.board-free .note.is-editing { cursor: default; user-select: text; }

/* ── 문서 첨부 ──────────────────────────────────────── */
.doc-preview {
  margin: 0; padding: 12px 14px;
  font-size: 13px; font-weight: 600; color: var(--ink);
  background: rgba(255, 255, 255, .6);
  border-radius: var(--r-sm);
  word-break: break-all;
}
.doc-card {
  display: flex; align-items: center; gap: 10px;
  background: rgba(255, 255, 255, .72);
  border: 1px solid rgba(24, 24, 27, .08);
  border-radius: var(--r-sm);
  padding: 10px 12px; margin-bottom: 12px;
  text-decoration: none; color: inherit;
  transition: background .15s ease, border-color .15s ease;
}
.doc-card:hover { background: #fff; border-color: var(--ink-20); }
.doc-icon { font-size: 17px; flex: none; }
.doc-body { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.doc-name {
  font-size: 12.5px; font-weight: 700;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.doc-sub { font-size: 11px; color: var(--ink-60); }

/* ── 쪽지 검색 ──────────────────────────────────────── */
.chip-search { display: inline-flex; align-items: center; gap: 6px; }
.chip-search input {
  border: 0; background: transparent; outline: none;
  font: inherit; color: inherit;
  width: 110px; min-width: 0;
}
.chip-search input::placeholder { color: var(--ink-60); opacity: .7; }
.chip-search:focus-within { border-color: var(--ink-20); box-shadow: var(--shadow-1); }
.chip-search input::-webkit-search-cancel-button { cursor: pointer; }

.note-edited {
  display: inline-block; margin-top: 2px;
  font-size: 10.5px; color: var(--ink-60); opacity: .6; font-style: italic;
}

/* ── 쪽지 본문 수정 ─────────────────────────────────── */
.note-editor { margin-bottom: 12px; }
.note-edit-text {
  width: 100%;
  border: 1px solid rgba(24, 24, 27, .18);
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, .72);
  padding: 10px 12px;
  font-family: var(--serif);
  font-size: 16px; line-height: 1.78;
  color: var(--ink);
  resize: vertical;
}
.note-edit-text:focus {
  outline: none;
  border-color: var(--ink-20);
  background: #fff;
}
.note-edit-tools { display: flex; justify-content: flex-end; gap: 2px; margin-top: 6px; }
.note-edit-save { font-weight: 700; color: var(--ink); }
/* 수정 중에는 좋아요·댓글·삭제를 감춰 오조작을 막는다 */
.note.is-editing .note-tools,
.note.is-editing .move-select { display: none; }

.note-tools { display: flex; align-items: center; gap: 2px; flex: none; }
.icon-btn {
  border: 0; background: transparent;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12.5px; color: var(--ink-60);
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 4px;
  transition: background .14s ease, color .14s ease, transform .1s ease;
}
.icon-btn:hover { background: rgba(24, 24, 27, .07); color: var(--ink); }
.icon-btn:active { transform: scale(.9); }
.icon-btn:disabled { opacity: .5; cursor: default; }
.icon-btn.is-liked { color: #D1607A; font-weight: 700; }
.like-count, .comment-n { font-variant-numeric: tabular-nums; }

.move-select {
  width: 100%; margin-top: 10px;
  border: 1px dashed rgba(24, 24, 27, .18);
  background: rgba(255, 255, 255, .5);
  border-radius: var(--r-sm);
  padding: 6px 8px;
  font-size: 11.5px; color: var(--ink-60); cursor: pointer;
}

.board-state { text-align: center; color: var(--ink-40); font-size: 13.5px; padding: 40px 0; }
.board-empty { padding: 64px 0; }
.board-empty-mark { font-size: 34px; margin: 0 0 12px; color: var(--pink-deep); }
.board-empty p { margin: 0 0 4px; }
.board-empty-sub { font-size: 12.5px; opacity: .8; }

/* ── 모달 ────────────────────────────────────────────── */
.modal {
  width: min(560px, calc(100vw - 32px));
  max-height: min(86dvh, 760px);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-3);
  padding: 22px;
  background: var(--surface);
  color: var(--ink);
  overflow-y: auto;
}
.modal::backdrop { background: rgba(24, 24, 27, .34); backdrop-filter: blur(2px); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.modal-title { margin: 0; font-family: var(--serif); font-size: 19px; }
.modal-x {
  border: 0; background: transparent; cursor: pointer;
  font-size: 22px; line-height: 1; color: var(--ink-40);
  border-radius: 50%; width: 32px; height: 32px;
}
.modal-x:hover { background: rgba(24, 24, 27, .07); color: var(--ink); }
.modal-hint { margin: -6px 0 16px; font-size: 12.5px; color: var(--ink-40); line-height: 1.6; }

.modal-card { border-radius: var(--r-md); padding: 16px; box-shadow: var(--shadow-1); }
.modal-card .note-text { font-size: 16.5px; }
.modal-by { margin: 6px 0 0; font-size: 11.5px; color: var(--ink-60); }

.modal-sub { margin: 22px 0 12px; font-size: 13px; font-weight: 700; }
.comment-count {
  background: rgba(24, 24, 27, .06); border-radius: 999px;
  padding: 2px 8px; font-size: 11.5px; color: var(--ink-60);
}

.comment-list { display: flex; flex-direction: column; gap: 12px; }
.comment { border-left: 2px solid var(--line); padding-left: 12px; }
.comment-head { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.comment-time { color: var(--ink-40); font-size: 11px; }
.comment-head .icon-btn { margin-left: auto; font-size: 11.5px; padding: 3px 7px; }
.comment-body {
  margin: 4px 0 0; font-size: 14px; line-height: 1.65;
  white-space: pre-wrap; word-break: break-word; overflow-wrap: anywhere;
}
.comment-empty { margin: 4px 0 0; font-size: 13px; color: var(--ink-40); }

.comment-form { display: flex; gap: 8px; margin-top: 18px; }
.comment-form input {
  flex: 1;
  border: 1px solid var(--line); background: #FCFBFA;
  border-radius: 999px; padding: 11px 16px; font-size: 14px;
}
.comment-form input:focus {
  outline: 0; background: #fff; border-color: var(--pink-deep);
  box-shadow: 0 0 0 3px rgba(233, 168, 182, .2);
}
#comment-error { margin-top: 10px; }

/* ── 섹션 편집 ───────────────────────────────────────── */
.section-rows { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.section-row { display: flex; align-items: center; gap: 6px; }
.section-row input {
  flex: 1; border: 1px solid var(--line); background: #FCFBFA;
  border-radius: var(--r-sm); padding: 10px 12px; font-size: 13.5px;
}
.section-row input:focus { outline: 0; background: #fff; border-color: var(--pink-deep); }
.section-add { display: flex; gap: 8px; margin-bottom: 16px; }
.section-add input {
  flex: 1; border: 1px solid var(--line); background: #FCFBFA;
  border-radius: var(--r-sm); padding: 10px 12px; font-size: 13.5px;
}
.section-add input:focus { outline: 0; background: #fff; border-color: var(--pink-deep); }
#sections-error { margin-bottom: 12px; }

/* ── 토스트 ──────────────────────────────────────────── */
.toast {
  position: fixed;
  left: 50%; bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translate(-50%, 12px);
  z-index: 300;
  max-width: min(440px, calc(100vw - 32px));
  background: var(--ink); color: #fff;
  border-radius: var(--r-md);
  padding: 13px 18px;
  font-size: 13px; line-height: 1.55;
  box-shadow: var(--shadow-3);
  opacity: 0;
  transition: opacity .22s ease, transform .22s ease;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ── 설정 오류 ───────────────────────────────────────── */
.fatal { position: fixed; inset: 0; display: grid; place-items: center; padding: 24px; background: var(--bg); z-index: 200; }
.fatal-card {
  max-width: 460px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-3);
  padding: 28px;
}
.fatal-card h2 { margin: 0 0 10px; font-size: 18px; }
.fatal-card p { margin: 0 0 18px; font-size: 13.5px; line-height: 1.75; color: var(--ink-60); white-space: pre-line; }

/* ── 인쇄 / PDF 내보내기 ─────────────────────────────── */
.print-head { display: none; }

@media print {
  @page { margin: 14mm; }

  .topbar, .composer, .guest-bar, .usage-box, .toast, .modal, .board-state,
  #boot, #fatal, .move-select, .note-tools, .note-editor { display: none !important; }

  html, body { background: #fff; }
  .wall-main { padding: 0; max-width: none; }

  .print-head { display: block; margin-bottom: 14px; }
  .print-head h1 { font-family: var(--serif); font-size: 22pt; margin: 0 0 6px; }
  .print-head p { margin: 0 0 10px; font-size: 9pt; color: #666; }

  .board { columns: 2; column-gap: 10mm; }
  .shelf { display: block; overflow: visible; }
  .shelf-col { border: 0; background: none; padding: 0; margin-bottom: 8mm; break-inside: avoid; }
  .shelf-head { font-size: 11pt; border-bottom: 1px solid #ddd; padding-bottom: 4px; }

  .note {
    box-shadow: none;
    border: 1px solid #ddd;
    transform: none !important;
    margin-bottom: 5mm;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .note-text { font-size: 10.5pt; }
  .link-url { white-space: normal; word-break: break-all; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
