html,
body {
  height: 100%;
}
body {
  font-family: ui-sans-serif, system-ui, -apple-system, 'Apple SD Gothic Neo', 'Noto Sans KR',
    'Malgun Gothic', sans-serif;
  -webkit-tap-highlight-color: transparent;
}

/* ---------- 공통 컴포넌트 ---------- */
.field {
  width: 100%;
  border-radius: 0.75rem;
  border: 1px solid rgb(203 213 225);
  background: #fff;
  color: #0f172a;
  padding: 0.65rem 0.85rem;
  font-size: 1rem; /* iOS 자동 확대 방지 */
  outline: none;
}
.field:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
}
.dark .field {
  background: #0f172a;
  border-color: #334155;
  color: #e2e8f0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border-radius: 0.75rem;
  padding: 0.55rem 1rem;
  font-weight: 600;
  font-size: 0.9rem;
  transition: background 0.15s, opacity 0.15s;
  cursor: pointer;
}
.btn-primary {
  background: #4f46e5;
  color: #fff;
}
.btn-primary:hover {
  background: #4338ca;
}
.btn:disabled {
  opacity: 0.6;
  cursor: default;
}
.btn-ghost:hover,
.icon-btn:hover,
.tb-btn:hover {
  background: rgba(100, 116, 139, 0.18);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.75rem;
  font-size: 1.05rem;
  cursor: pointer;
}
.tb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  height: 2rem;
  padding: 0 0.4rem;
  border-radius: 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

/* ---------- 스마트보드 (메모 카드 보드) ---------- */
.board {
  columns: 1;
  column-gap: 1rem;
}
@media (min-width: 640px) {
  .board {
    columns: 2;
  }
}
@media (min-width: 1280px) {
  .board {
    columns: 3;
  }
}
/* 데스크톱에서 편집기가 열려 있으면 보드 폭이 좁아지므로 열 수를 줄임 */
@media (min-width: 1024px) {
  .editor-open .board {
    columns: 1;
  }
}
@media (min-width: 1280px) {
  .editor-open .board {
    columns: 2;
  }
}
@media (min-width: 1700px) {
  .editor-open .board {
    columns: 3;
  }
}

.memo-card {
  break-inside: avoid;
  margin-bottom: 1rem;
}
.card-body {
  max-height: 11rem;
  overflow: hidden;
}
.card-body.fade {
  -webkit-mask-image: linear-gradient(to bottom, #000 70%, transparent);
  mask-image: linear-gradient(to bottom, #000 70%, transparent);
}
.card-body.prose :where(h1, h2, h3, h4) {
  font-size: 1rem;
  margin: 0.4rem 0 0.2rem;
}
.card-body.prose :where(p, ul, ol, pre, blockquote) {
  margin: 0.3rem 0;
}

/* ---------- 마크다운 본문 (체크리스트 등) ---------- */
.prose li:has(> input[type='checkbox']) {
  list-style: none;
  margin-left: -1.25rem;
}
.prose input[type='checkbox'] {
  margin-right: 0.4rem;
  accent-color: #4f46e5;
  transform: scale(1.15);
  vertical-align: -1px;
  cursor: pointer;
}
.prose :where(pre) {
  font-size: 0.85em;
}
#preview {
  max-width: none;
}
#content {
  tab-size: 2;
}

dialog::backdrop {
  background: rgba(15, 23, 42, 0.5);
}
