/* =============================================================================
   모아보드 — 스타일 (디자인 목업 07 스타일 가이드의 토큰 그대로)
   ============================================================================= */
:root {
  --ink: #1C1B1F;
  --ink-2: #4A4953;
  --muted: #5F5E66;
  --line: #E5E3DD;
  --bg: #F6F5F1;
  --surface: #FFFFFF;
  --accent: #4F5BD5;
  --accent-dark: #3E49B8;
  --accent-tint: #ECEEFF;
  --danger: #B4123F;
  --danger-tint: #FDE8EE;
  --ok: #1E9E5A;

  --wp-sage: #DDE9E1;
  --wp-sky: #DCE7F7;
  --wp-sand: #F3E9D7;
  --wp-rose: #F7E3E6;
  --wp-board: #ECEFF4;
  --wp-graphite: #2B2F3A;

  --c-yellow: #FFF3B0;
  --c-pink: #FFD9E1;
  --c-blue: #D9E8FF;
  --c-green: #DAF3DF;
  --c-purple: #E8DEFF;
  --c-white: #FFFFFF;

  --r-btn: 10px;
  --r-card: 14px;
  --r-panel: 16px;
  --r-modal: 20px;

  --shadow-card: 0 1px 2px rgba(20, 20, 30, .06), 0 6px 20px rgba(20, 20, 30, .08);
  --shadow-float: 0 10px 24px rgba(28, 27, 31, .28);
  --shadow-modal: 0 30px 80px rgba(20, 20, 30, .35);

  --font: 'Noto Sans KR', system-ui, -apple-system, 'Segoe UI', Roboto, 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent-dark); }
a:hover { color: #2F3A9E; }
img { max-width: 100%; display: block; }
h1, h2, h3, p, ul { margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

#app { min-height: 100%; display: flex; flex-direction: column; }

/* ----------------------------------------------------------------------------
   공용 컴포넌트
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 14px; border-radius: var(--r-btn);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font-size: 14px; font-weight: 700; white-space: nowrap; text-decoration: none;
  transition: background .12s, box-shadow .12s, transform .06s;
}
.btn:hover { background: #FAFAF8; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: rgba(28, 27, 31, .06); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-tint); }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13px; }
.btn-icon { width: 40px; padding: 0; }
.btn-icon.btn-sm { width: 34px; }
.btn svg { flex: none; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px;
  border-radius: 999px; background: var(--bg); border: 1px solid var(--line);
  font-size: 12px; font-weight: 600; color: var(--ink-2); white-space: nowrap;
}
.chip-ok { color: #0F766E; background: #DFF3EC; border-color: transparent; }

.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-btn); padding: 3px; gap: 2px; }
.seg > button, .seg > a {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px;
  border: 0; border-radius: 7px; background: transparent; color: var(--ink-2);
  font-size: 13px; font-weight: 600; text-decoration: none;
}
.seg > .is-active { background: var(--accent); color: #fff; font-weight: 700; }
.seg > button:not(.is-active):hover { background: rgba(28, 27, 31, .06); }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > span.label, .label { font-size: 12px; font-weight: 700; color: var(--ink-2); }
.input, .textarea, .select {
  width: 100%; height: 44px; padding: 0 14px; border: 1px solid var(--line); border-radius: var(--r-btn);
  background: var(--surface); color: var(--ink); font-size: 14px; outline: none;
}
.input:focus, .textarea:focus, .select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint); }
.textarea { height: auto; min-height: 96px; padding: 12px 14px; line-height: 1.55; resize: vertical; }
.select { appearance: none; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235F5E66' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M6 9l6 6 6-6'/></svg>"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }
.hint { font-size: 12px; color: var(--muted); }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.spacer { flex: 1; }

.avatar {
  width: 28px; height: 28px; border-radius: 50%; color: #fff; font-size: 12px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; flex: none; user-select: none;
}
.avatar-lg { width: 32px; height: 32px; }
.avatar-sm { width: 22px; height: 22px; font-size: 10px; }

.swatches { display: flex; gap: 12px; flex-wrap: wrap; }
.swatch {
  width: 36px; height: 36px; border-radius: 50%; border: 0; padding: 0;
  box-shadow: 0 0 0 1px rgba(28, 27, 31, .14); display: flex; align-items: center; justify-content: center; color: var(--ink);
}
.swatch.is-selected { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--accent); }

.online-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); display: inline-block; }

/* 드롭다운 메뉴 */
.menu {
  position: absolute; z-index: 30; min-width: 180px; padding: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 28px rgba(20, 20, 30, .16);
}
.menu button {
  display: flex; align-items: center; gap: 10px; width: 100%; height: 38px; padding: 0 10px;
  border: 0; border-radius: 8px; background: transparent; text-align: left; font-size: 13px; font-weight: 600; color: var(--ink);
}
.menu button:hover { background: var(--bg); }
.menu button.danger { color: var(--danger); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }

/* 토스트 */
#toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 1000; pointer-events: none; }
.toast {
  pointer-events: auto; max-width: min(520px, calc(100vw - 32px));
  padding: 10px 16px; border-radius: 999px; background: rgba(28, 27, 31, .9); color: #fff; font-size: 13px; font-weight: 600;
  box-shadow: 0 8px 24px rgba(20, 20, 30, .25); animation: toast-in .18s ease-out;
}
.toast.error { background: var(--danger); }
.toast.ok { background: #136B3E; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* 모달 */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100; background: rgba(28, 27, 31, .45);
  display: flex; align-items: center; justify-content: center; padding: 24px;
  animation: fade-in .15s ease-out;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: min(600px, 100%); max-height: calc(100vh - 48px); overflow: auto;
  background: var(--surface); border-radius: var(--r-modal); box-shadow: var(--shadow-modal);
  display: flex; flex-direction: column;
}
.modal-sm { width: min(460px, 100%); }
.modal-head { display: flex; align-items: flex-start; gap: 12px; padding: 22px 24px 0; }
.modal-head h2 { font-size: 20px; font-weight: 900; letter-spacing: -.01em; }
.modal-head p { font-size: 13px; color: var(--muted); margin-top: 2px; }
.modal-close { margin-left: auto; width: 36px; height: 36px; border: 0; border-radius: 10px; background: var(--bg); display: flex; align-items: center; justify-content: center; flex: none; }
.modal-body { display: flex; flex-direction: column; gap: 16px; padding: 20px 24px 24px; }
.modal-foot { display: flex; align-items: center; gap: 10px; padding-top: 12px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.modal-foot .spacer { flex: 1; }
@media (max-width: 640px) {
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal { width: 100%; max-height: 92vh; border-radius: 22px 22px 0 0; animation: sheet-in .2s ease-out; }
  .modal-sm { width: 100%; }
}
@keyframes sheet-in { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }

/* 선택지 카드 (레이아웃 선택) */
.option-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.option-card {
  display: flex; flex-direction: column; gap: 8px; padding: 12px; text-align: left;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
}
.option-card.is-selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-tint); }
.option-card .preview { height: 54px; border-radius: 8px; background: var(--wp-sage); position: relative; overflow: hidden; padding: 7px; display: grid; gap: 4px; }
.option-card .preview span { border-radius: 3px; background: #fff; display: block; }
.option-card strong { font-size: 13px; }
.option-card small { font-size: 11px; color: var(--muted); }
@media (max-width: 480px) { .option-cards { grid-template-columns: 1fr; } .option-card { flex-direction: row; align-items: center; } .option-card .preview { width: 84px; flex: none; } }

/* ----------------------------------------------------------------------------
   상단 바
   -------------------------------------------------------------------------- */
.topbar {
  min-height: 64px; background: var(--surface); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 20px; padding: 8px 28px; flex-wrap: wrap; position: sticky; top: 0; z-index: 20;
}
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand strong { font-size: 20px; font-weight: 900; letter-spacing: -.02em; }
.search {
  flex: 1 1 280px; max-width: 520px; display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 14px;
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-btn); color: var(--muted);
}
.search input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; color: var(--ink); font-size: 14px; }
.topbar .actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
@media (max-width: 720px) {
  .topbar { padding: 8px 14px; gap: 10px; }
  .search { order: 3; flex-basis: 100%; max-width: none; }
}

/* ----------------------------------------------------------------------------
   홈
   -------------------------------------------------------------------------- */
.home { width: 100%; max-width: 1200px; margin: 0 auto; padding: 36px 32px 60px; display: flex; flex-direction: column; gap: 40px; }
@media (max-width: 720px) { .home { padding: 20px 16px 48px; gap: 28px; } }
.greeting { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.greeting h1 { font-size: 28px; font-weight: 900; letter-spacing: -.02em; }
.greeting p { color: var(--muted); font-size: 15px; margin-top: 4px; }
.section { display: flex; flex-direction: column; gap: 14px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.section-head h2 { font-size: 16px; font-weight: 700; }
.section-head h2 .count { color: var(--muted); font-weight: 500; margin-left: 6px; }

.templates { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.template {
  text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel);
  padding: 16px; display: flex; flex-direction: column; gap: 12px; color: var(--ink); transition: box-shadow .12s, transform .12s;
}
.template:hover { box-shadow: var(--shadow-card); transform: translateY(-1px); }
.template.blank { border: 1.5px dashed #C9C6BD; }
.template .preview { height: 84px; border-radius: 10px; position: relative; overflow: hidden; padding: 10px; display: grid; gap: 6px; align-content: start; }
.template .preview span { border-radius: 4px; background: #fff; display: block; }
.template strong { font-size: 15px; font-weight: 700; display: block; }
.template small { font-size: 13px; color: var(--muted); display: block; }

.board-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; }
.board-card {
  display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel);
  overflow: hidden; text-decoration: none; color: var(--ink); transition: box-shadow .12s, transform .12s; position: relative;
}
.board-card:hover { box-shadow: var(--shadow-card); transform: translateY(-1px); color: var(--ink); }
.board-card .preview { height: 140px; padding: 14px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; align-content: start; overflow: hidden; }
.board-card .preview span { border-radius: 6px; display: block; }
.board-card .body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 10px; }
.board-card .title { font-size: 15px; font-weight: 700; line-height: 1.35; }
.board-card .meta { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.board-card .meta .layout { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; color: var(--ink-2); }
.board-card .foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.board-card .foot .hint { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.board-card .badge { flex: none; white-space: nowrap; }
.board-card .badge { font-size: 11px; font-weight: 700; border-radius: 999px; padding: 3px 8px; background: var(--bg); color: var(--ink-2); }
.board-card .badge.admin { background: var(--accent-tint); color: var(--accent-dark); }
.board-card .badge.public { background: #DFF3EC; color: #0F766E; }
.board-card .remove { position: absolute; top: 8px; right: 8px; width: 30px; height: 30px; border: 0; border-radius: 8px; background: rgba(255, 255, 255, .85); color: var(--ink-2); display: none; align-items: center; justify-content: center; }
.board-card:hover .remove, .board-card:focus-within .remove { display: flex; }

.empty {
  border: 1.5px dashed #C9C6BD; border-radius: var(--r-panel); padding: 36px 24px; text-align: center; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 12px; background: rgba(255, 255, 255, .5);
}
.empty strong { color: var(--ink); font-size: 15px; }

/* ----------------------------------------------------------------------------
   보드 페이지
   -------------------------------------------------------------------------- */
.board-page { flex: 1; display: flex; flex-direction: column; position: relative; min-height: 100vh; }
.board-page.wp-sage { background-color: var(--wp-sage); }
.board-page.wp-sky { background-color: var(--wp-sky); }
.board-page.wp-sand { background-color: var(--wp-sand); }
.board-page.wp-rose { background-color: var(--wp-rose); }
.board-page.wp-board { background-color: var(--wp-board); }
.board-page.wp-graphite { background-color: var(--wp-graphite); }
.board-page {
  background-image: radial-gradient(rgba(28, 27, 31, .12) 1.2px, transparent 1.6px);
  background-size: 22px 22px;
}
.board-page.wp-graphite { background-image: radial-gradient(rgba(255, 255, 255, .16) 1.2px, transparent 1.6px); }

.board-header {
  min-height: 56px; background: rgba(255, 255, 255, .94); backdrop-filter: blur(6px); border-bottom: 1px solid rgba(28, 27, 31, .08);
  display: flex; align-items: center; gap: 10px; padding: 6px 16px 6px 10px; flex-wrap: wrap; position: sticky; top: 0; z-index: 20;
}
.board-header h1 { font-size: 17px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 48vw; }
.board-header .title-wrap { display: flex; align-items: center; gap: 10px; min-width: 0; flex-wrap: wrap; }
.board-header .actions { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.presence { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--ink-2); padding: 0 4px; }

.board-toolbar { display: flex; align-items: center; gap: 12px; padding: 14px 28px 0; flex-wrap: wrap; }
.board-toolbar .desc { color: var(--ink-2); font-size: 14px; flex: 1 1 320px; min-width: 0; white-space: pre-wrap; }
.wp-graphite .board-toolbar .desc { color: #E8E6E1; }
.board-toolbar .controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.board-toolbar .filter { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-btn); color: var(--muted); }
.board-toolbar .filter input { width: 140px; border: 0; background: transparent; outline: none; color: var(--ink); font-size: 13px; }
.presence-mobile { display: none; }
@media (max-width: 720px) {
  .board-toolbar { padding: 12px 16px 0; }
  .board-header { padding: 6px 8px 6px 4px; gap: 6px; flex-wrap: nowrap; }
  .board-header h1 { max-width: none; font-size: 16px; }
  .board-header .title-wrap { flex: 1; min-width: 0; flex-wrap: nowrap; }
  .board-header .title-wrap h1 { overflow: hidden; text-overflow: ellipsis; }
  .board-header .title-wrap .chip { display: none; }
  .board-header .actions { flex-wrap: nowrap; gap: 4px; }
  .board-header .actions .presence { display: none; }
  .board-header .actions .share-label { display: none; }
  .board-header .actions .btn { border-color: transparent; width: 40px; padding: 0; }
  .presence-mobile { display: inline-flex; }
  .board-toolbar .filter input { width: 90px; }
}

.board-area { flex: 1; padding: 20px 28px 120px; position: relative; }
@media (max-width: 720px) { .board-area { padding: 14px 16px 110px; } }

.section-title { font-size: 15px; font-weight: 900; color: var(--muted); letter-spacing: -.01em; margin: 6px 0 12px; display: flex; align-items: center; gap: 8px; }
.section-title .count { font-size: 12px; font-weight: 700; background: rgba(255, 255, 255, .7); border-radius: 999px; padding: 1px 8px; }
.wp-graphite .section-title { color: #D9D7D1; }
.section-title + .wall-grid, .section-title + .stream-list { margin-bottom: 24px; }

/* 벽(메이슨리) */
.wall-grid { column-width: 300px; column-gap: 20px; }
.wall-grid > .card { break-inside: avoid; margin: 0 0 20px; }
@media (max-width: 720px) { .wall-grid { column-width: 240px; column-gap: 14px; } .wall-grid > .card { margin-bottom: 14px; } }
/* 스트림 */
.stream-list { max-width: 680px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }

/* ----------------------------------------------------------------------------
   게시물 카드
   -------------------------------------------------------------------------- */
.card {
  position: relative; background: var(--c-white); border-radius: var(--r-card); box-shadow: var(--shadow-card);
  display: flex; flex-direction: column; overflow: visible; transition: box-shadow .15s;
}
.card.c-yellow { background: var(--c-yellow); }
.card.c-pink { background: var(--c-pink); }
.card.c-blue { background: var(--c-blue); }
.card.c-green { background: var(--c-green); }
.card.c-purple { background: var(--c-purple); }
.card.c-white { background: var(--c-white); }
.card.is-new { animation: card-in .25s ease-out; }
@keyframes card-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.card-head { display: flex; align-items: center; gap: 10px; padding: 14px 10px 0 16px; }
.card-head .who { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.card-head .who .name { font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-head .who .time { font-size: 12px; color: var(--muted); }
.card-head .mine-badge { font-size: 10px; font-weight: 700; color: #fff; background: var(--accent); border-radius: 999px; padding: 1px 6px; margin-left: 4px; vertical-align: middle; }
.card-head .menu-btn { margin-left: auto; width: 32px; height: 32px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); display: flex; align-items: center; justify-content: center; }
.card-head .menu-btn:hover { background: rgba(28, 27, 31, .06); color: var(--ink); }
.card-head .drag-handle { color: #8A8794; display: flex; margin-left: auto; cursor: grab; }
.card-head .drag-handle + .menu-btn { margin-left: 0; }

.card-subject { padding: 10px 16px 0; font-size: 15px; font-weight: 700; line-height: 1.4; overflow-wrap: anywhere; }
.card-body { padding: 6px 16px 0; font-size: 14px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.card-subject + .card-body { padding-top: 6px; }
.card-head + .card-body { padding-top: 10px; }

.card-img { display: block; margin: 12px 16px 0; border-radius: 10px; overflow: hidden; background: rgba(28, 27, 31, .04); }
.card-img img { width: 100%; max-height: 420px; object-fit: cover; }
.card-link, .card-file {
  margin: 12px 16px 0; display: flex; gap: 12px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: 12px;
  background: rgba(246, 245, 241, .9); text-decoration: none; color: var(--ink); min-width: 0;
}
.card-link:hover, .card-file:hover { background: #fff; color: var(--ink); }
.card-link .favicon, .card-file .fileicon { width: 48px; height: 48px; border-radius: 8px; color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 20px; flex: none; }
.card-link .favicon { background: var(--accent); }
.card-file .fileicon { background: #1E7F4F; }
.card-link .txt, .card-file .txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.card-link .txt b, .card-file .txt b { font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-link .txt small, .card-file .txt small { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.card-foot { display: flex; align-items: center; gap: 6px; padding: 12px 10px 12px 12px; }
.pill-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border-radius: 999px; border: 0;
  background: rgba(28, 27, 31, .06); color: var(--ink); font-size: 13px; font-weight: 600;
}
.pill-btn:hover { background: rgba(28, 27, 31, .11); }
.pill-btn.is-on { background: var(--danger-tint); color: var(--danger); font-weight: 700; }
.pill-btn.is-on svg { fill: #D6336C; stroke: #D6336C; }
.pill-btn:disabled { opacity: .5; cursor: default; }

/* 댓글 */
.comments { padding: 12px 16px 14px; background: rgba(28, 27, 31, .04); display: flex; flex-direction: column; gap: 10px; border-radius: 0 0 var(--r-card) var(--r-card); }
.comment { display: flex; gap: 8px; align-items: flex-start; }
.comment p { font-size: 13px; line-height: 1.5; flex: 1; min-width: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.comment p b { margin-right: 4px; }
.comment .time { color: var(--muted); font-size: 11px; margin-left: 4px; white-space: nowrap; }
.comment .del { width: 24px; height: 24px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); display: flex; align-items: center; justify-content: center; flex: none; }
.comment .del:hover { background: rgba(28, 27, 31, .08); color: var(--danger); }
.comment-form { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 6px 0 12px; background: #fff; border: 1px solid var(--line); border-radius: 999px; }
.comment-form input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; font-size: 13px; }
.comment-form button { width: 28px; height: 28px; border: 0; border-radius: 50%; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; flex: none; }
.comment-form button:disabled { background: #C9C6BD; }
.comments .more { font-size: 12px; font-weight: 600; margin-left: 30px; background: none; border: 0; color: var(--accent-dark); text-align: left; padding: 0; }

/* FAB */
.fab {
  position: fixed; right: 28px; bottom: 28px; width: 60px; height: 60px; border-radius: 50%; border: 0;
  background: var(--accent); color: #fff; box-shadow: var(--shadow-float); display: flex; align-items: center; justify-content: center; z-index: 40;
  transition: transform .12s, background .12s;
}
.fab:hover { background: var(--accent-dark); transform: scale(1.04); }
@media (max-width: 720px) { .fab { right: 16px; bottom: calc(20px + env(safe-area-inset-bottom)); width: 56px; height: 56px; } }

/* ----------------------------------------------------------------------------
   캔버스 레이아웃
   -------------------------------------------------------------------------- */
.layout-canvas { padding: 0 !important; display: flex; flex-direction: column; min-height: 70vh; }
.canvas-viewport { flex: 1; overflow: auto; position: relative; min-height: 70vh; cursor: default; }
.canvas-sizer { position: relative; }
.canvas-surface { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.canvas-surface > .card { position: absolute; width: 260px; touch-action: none; cursor: grab; user-select: none; }
.canvas-surface > .card.dragging { cursor: grabbing; box-shadow: 0 24px 48px rgba(20, 20, 30, .28); z-index: 5; transform: rotate(-1.2deg); }
.canvas-surface > .card.link-source { box-shadow: 0 0 0 2px var(--accent), var(--shadow-card); }
.canvas-links { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; }
.canvas-links path.link { stroke: #6B6A75; stroke-width: 2; fill: none; stroke-dasharray: 5 4; pointer-events: stroke; cursor: pointer; }
.canvas-links path.link:hover { stroke: var(--danger); }
.canvas-links path.hit { stroke: transparent; stroke-width: 14; fill: none; pointer-events: stroke; cursor: pointer; }
body.linking .canvas-surface > .card { cursor: crosshair; }
body.linking .canvas-surface > .card:hover { box-shadow: 0 0 0 2px var(--accent-dark), var(--shadow-card); }

.zoom-ctl {
  position: fixed; left: 24px; bottom: 24px; display: flex; align-items: center; background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: 0 6px 20px rgba(20, 20, 30, .1); overflow: hidden; z-index: 40;
}
.zoom-ctl button { width: 40px; height: 40px; border: 0; background: transparent; display: flex; align-items: center; justify-content: center; }
.zoom-ctl button:hover { background: var(--bg); }
.zoom-ctl .pct { width: 60px; font-size: 13px; font-weight: 700; border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
@media (max-width: 720px) { .zoom-ctl { left: 12px; bottom: calc(20px + env(safe-area-inset-bottom)); } .zoom-ctl .pct { width: 52px; } }

.canvas-hint {
  position: fixed; left: 50%; bottom: 32px; transform: translateX(-50%); height: 32px; padding: 0 14px; display: inline-flex; align-items: center; gap: 8px;
  background: rgba(28, 27, 31, .82); color: #fff; font-size: 12px; font-weight: 600; border-radius: 999px; white-space: nowrap; z-index: 39; pointer-events: none;
}
@media (max-width: 900px) { .canvas-hint { display: none; } }

/* ----------------------------------------------------------------------------
   작성 모달 — 첨부
   -------------------------------------------------------------------------- */
.attach-bar { display: flex; gap: 8px; flex-wrap: wrap; }
.attach-bar .btn { height: 36px; border-radius: 999px; font-size: 13px; font-weight: 600; }
.attach-preview { display: flex; align-items: center; gap: 12px; padding: 8px 10px 8px 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); }
.attach-preview img { width: 96px; height: 54px; object-fit: cover; border-radius: 6px; flex: none; }
.attach-preview .icon { width: 54px; height: 54px; border-radius: 8px; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; flex: none; }
.attach-preview .txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.attach-preview .txt b { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.attach-preview .txt small { font-size: 12px; color: var(--muted); }
.progress { height: 4px; border-radius: 2px; background: var(--wp-sage); overflow: hidden; max-width: 220px; }
.progress > span { display: block; height: 100%; background: var(--ok); transition: width .15s; }
.attach-preview .rm { width: 32px; height: 32px; border: 0; border-radius: 8px; background: #fff; color: var(--ink-2); display: flex; align-items: center; justify-content: center; flex: none; }

.key-box { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; overflow-wrap: anywhere; }
.key-box code { flex: 1; min-width: 0; }
.notice { padding: 12px 14px; border-radius: 12px; background: var(--accent-tint); color: var(--accent-dark); font-size: 13px; line-height: 1.5; }
.notice.warn { background: #FFF3B0; color: #6B5400; }
.danger-zone { border: 1px solid #F3C6D2; border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.danger-zone h3 { font-size: 13px; color: var(--danger); }

/* 로딩 */
.loading { padding: 80px 24px; text-align: center; color: var(--muted); }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid rgba(28, 27, 31, .12); border-top-color: var(--accent); animation: spin .8s linear infinite; margin: 0 auto 12px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================================
   v0.2 추가 — 서식 본문 · 미디어 · 고정/승인 · 동결 · 업로드 · 공유 QR · 대화상자 · 라이트박스
   ========================================================================== */

/* 본문 서식 (URL 자동 링크 · 굵게 · 목록) */
.rich .rt-p { white-space: pre-wrap; overflow-wrap: anywhere; }
.rich .rt-p + .rt-p, .rich .rt-list + .rt-p, .rich .rt-p + .rt-list { margin-top: 8px; }
.rich .rt-list { margin: 0; padding-left: 20px; }
.rich .rt-list li { margin: 2px 0; overflow-wrap: anywhere; }
.rich .rt-list + .rt-list { margin-top: 6px; }
.auto-link { color: var(--accent-dark); text-decoration: underline; text-decoration-color: rgba(62, 73, 184, .35); text-underline-offset: 2px; overflow-wrap: anywhere; }
.auto-link:hover { text-decoration-color: currentColor; }
.card-body.rich { white-space: normal; }
.desc-text { font-size: 14px; color: var(--ink-2); }

/* 이미지 확대 표시 */
.card-img { position: relative; }
.card-img .img-expand { position: absolute; right: 8px; bottom: 8px; width: 26px; height: 26px; border-radius: 7px; background: rgba(28, 27, 31, .55); color: #fff; display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity .12s; }
.card-img:hover .img-expand { opacity: 1; }

/* 동영상 / 오디오 */
.card-media { margin: 12px 16px 0; display: flex; flex-direction: column; gap: 6px; }
.card-media video { width: 100%; max-height: 420px; border-radius: 10px; background: #000; display: block; }
.card-media small { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-audio { flex-direction: row; align-items: center; gap: 12px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: rgba(246, 245, 241, .9); }
.card-audio .fileicon { width: 44px; height: 44px; border-radius: 8px; background: #0F766E; color: #fff; display: flex; align-items: center; justify-content: center; flex: none; }
.card-audio .txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.card-audio .txt b { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-audio audio { width: 100%; height: 32px; }

/* 고정 / 승인 대기 */
.pin-mark { margin-left: auto; color: var(--accent-dark); display: flex; }
.pin-mark + .drag-handle, .pin-mark + .menu-btn { margin-left: 0; }
.card.is-pinned { box-shadow: 0 0 0 1.5px rgba(79, 91, 213, .45), var(--shadow-card); }
.card.is-pending { outline: 2px dashed #D08A00; outline-offset: -2px; }
.pending-bar { margin: 10px 16px 0; padding: 8px 10px; border-radius: 10px; background: #FFF3B0; color: #6B5400; font-size: 12px; font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pending-bar .btn { margin-left: auto; height: 28px; padding: 0 10px; }
.chip-warn { color: #6B5400; background: #FFF3B0; border-color: transparent; }
.chip-frozen { color: #1D4ED8; background: #DBEAFE; border-color: transparent; }
.frozen-mark { display: inline-flex; align-items: center; gap: 3px; color: #1D4ED8; }

/* 설정 토글 */
.toggle-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 10px; }
.toggle-row { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.toggle-row:hover { background: var(--bg); }
.toggle-row input { margin-top: 3px; flex: none; }
.toggle-row span { display: flex; flex-direction: column; gap: 2px; font-size: 13px; line-height: 1.4; }
.toggle-row small { color: var(--muted); font-size: 12px; }

/* 저장 용량 */
.usage { height: 8px; border-radius: 4px; background: var(--wp-sage); overflow: hidden; }
.usage > span { display: block; height: 100%; background: var(--ok); min-width: 2px; transition: width .2s; }
.usage.is-high > span { background: var(--danger); }

/* 공유창 QR */
.share-grid { display: flex; gap: 16px; align-items: flex-start; }
.share-right { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.qr-box { flex: none; width: 150px; height: 150px; border: 1px solid var(--line); border-radius: 12px; padding: 6px; background: #fff; display: block; }
.qr-box img { width: 100%; height: 100%; display: block; }
@media (max-width: 480px) { .share-grid { flex-direction: column; align-items: center; } .share-right { width: 100%; } }

/* 드래그&드롭 */
.board-area.is-dropping::after {
  content: '여기에 놓으면 새 게시물로 올라가요'; position: absolute; inset: 8px; border: 3px dashed var(--accent); border-radius: 18px;
  background: rgba(236, 238, 255, .7); color: var(--accent-dark); font-weight: 800; font-size: 16px; display: flex; align-items: center; justify-content: center; z-index: 30; pointer-events: none;
}
.compose-form.is-dropping { outline: 3px dashed var(--accent); outline-offset: 6px; border-radius: 12px; }
.attach-preview .icon svg { display: block; }

/* 대화상자 / 라이트박스 */
.dialog-msg { font-size: 14px; line-height: 1.55; white-space: pre-wrap; }
.modal-lightbox { width: min(1100px, 100%); background: #15151a; color: #fff; }
.modal-lightbox .modal-head h2 { color: #fff; font-size: 16px; }
.modal-lightbox .modal-head p { color: #aaa; }
.modal-lightbox .modal-close { background: rgba(255, 255, 255, .12); color: #fff; }
.modal-lightbox .modal-body { padding: 12px 16px 16px; }
.modal-lightbox .modal-foot { border-top-color: rgba(255, 255, 255, .12); }
.modal-lightbox .btn { background: rgba(255, 255, 255, .12); color: #fff; border-color: transparent; }
.lightbox-stage { display: flex; align-items: center; justify-content: center; min-height: 200px; cursor: zoom-out; }
.lightbox-stage img { max-width: 100%; max-height: calc(100vh - 220px); object-fit: contain; border-radius: 8px; }
.lightbox-caption { color: #ccc; max-width: 60%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 640px) { .modal-lightbox { max-height: 96vh; } .lightbox-caption { max-width: 100%; } }

/* 동결된 보드: 카드 커서 */
.board-page.is-frozen .canvas-surface > .card { cursor: default; }
.frozen-note { margin-top: 6px; }
@media (min-width: 721px) { .frozen-note { display: none; } }   /* 데스크톱은 헤더 칩으로 충분 */
