.ts-modal *, .ts-modal *::before, .ts-modal *::after {
  box-sizing: border-box; margin: 0; padding: 0;
}
.ts-btn-open {
  padding: 8px 16px;
  border: 1.5px solid #333; border-radius: 8px;
  background: #fff; font-size: 13px; font-weight: 600; cursor: pointer;
}
.ts-btn-open:hover { background: #f5f5f3; }

/* 오버레이 */
.ts-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.35); z-index: 1000;
  align-items: center; justify-content: center;
}
.ts-overlay.ts-open { display: flex; }

/* 모달 */
.ts-modal {
  background: #fff; border-radius: 14px; width: 290px;
  box-shadow: 0 8px 32px rgba(0,0,0,.16); overflow: hidden;
  transform: scale(.95) translateY(6px); opacity: 0;
  transition: transform .18s ease, opacity .18s ease;
  font-family: 'Pretendard', 'Apple SD Gothic Neo', sans-serif;
}
.ts-overlay.ts-open .ts-modal { transform: scale(1) translateY(0); opacity: 1; }

/* 헤더 */
.ts-modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 14px 8px; border-bottom: 1px solid #f0f0ee;
}
.ts-modal-head h2 { font-size: 13px; font-weight: 700; color: #111; margin: 0; }
.ts-btn-x {
  width: 22px; height: 22px; border: none; background: #f0f0ee;
  border-radius: 5px; color: #888; cursor: pointer; font-size: 12px;
  display: flex; align-items: center; justify-content: center;
}
.ts-btn-x:hover { background: #e5e5e2; color: #333; }

/* 미리보기 */
.ts-preview-area {
  background: #f7f6f3; border-top: 1px solid #ebebeb;
  padding: 8px 14px 10px;
}
.ts-preview-label {
  font-size: 9px; font-weight: 600; color: #bbb;
  letter-spacing: .7px; text-transform: uppercase; margin-bottom: 5px;
}
#ts-preview-text {
  font-size: 15px; color: #111; line-height: 1.4;
  padding: 2px 6px; border-radius: 4px;
  display: inline-block; transition: all .15s ease;
}

/* 색상 행 */
.ts-color-row {
  display: flex; align-items: center;
  padding: 8px 12px; border-bottom: 1px solid #f0f0ee;
}
.ts-color-row-label {
  font-size: 11px; font-weight: 600; color: #555;
  width: 38px; flex-shrink: 0;
}
.ts-swatches {
  display: flex; align-items: center; gap: 5px; flex-wrap: nowrap;
}

/* 없음 버튼 */
.ts-swatch-none {
  width: 22px; height: 22px; border-radius: 5px;
  border: 1.5px solid #ddd; background: #fff;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-size: 9px; color: #bbb; font-weight: 600; flex-shrink: 0;
  transition: border-color .12s, color .12s;
  position: relative;
}
.ts-swatch-none::after {
  content: '';
  position: absolute;
  width: 1.5px; height: 26px;
  background: #ddd;
  transform: rotate(45deg);
  border-radius: 2px;
}
.ts-swatch-none.ts-sel { border-color: #333; }
.ts-swatch-none.ts-sel::after { background: #333; }

/* 색상 스와치 */
.ts-swatch {
  width: 22px; height: 22px; border-radius: 5px; cursor: pointer;
  border: 2px solid transparent; flex-shrink: 0;
  transition: transform .12s, border-color .12s;
}
.ts-swatch:hover { transform: scale(1.15); }
.ts-swatch.ts-sel { border-color: #333; }

/* 직접 선택 */
.ts-swatch-custom {
  width: 22px; height: 22px; border-radius: 5px;
  border: 1.5px dashed #ccc; cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; color: #ccc; transition: transform .12s;
}
.ts-swatch-custom:hover { transform: scale(1.15); border-color: #888; color: #888; }

input[type=color].ts-hidden-picker { opacity: 0; width: 0; height: 0; position: absolute; pointer-events: none; }

/* 스타일 행 */
.ts-style-row {
  display: flex; align-items: center;
  padding: 8px 12px; gap: 6px; border-bottom: 1px solid #f0f0ee;
}
.ts-style-row-label {
  font-size: 11px; font-weight: 600; color: #555;
  width: 38px; flex-shrink: 0;
}
.ts-style-btns { display: flex; gap: 5px; }

.ts-style-btn {
  width: 30px; height: 26px; border-radius: 6px;
  border: 1.5px solid #e8e8e5; background: #f7f6f3;
  cursor: pointer; font-size: 13px; font-weight: 700; color: #aaa;
  display: flex; align-items: center; justify-content: center;
  transition: background .12s, border-color .12s, color .12s;
  flex-shrink: 0;
}
.ts-style-btn:hover { background: #eeeee9; color: #555; }
.ts-style-btn.ts-on { background: #111; border-color: #111; color: #fff; }

.ts-icon-bold   { font-weight: 900; }
.ts-icon-italic { font-style: italic; }
.ts-icon-strike { text-decoration: line-through; }

/* 푸터 */
.ts-modal-foot {
  display: flex; gap: 6px; padding: 8px 10px 10px;
}
.ts-btn-cancel {
  flex: 1; padding: 7px 0; border-radius: 8px;
  border: 1.5px solid #e0e0e0; background: #fff;
  color: #888; font-size: 12px; font-weight: 600; cursor: pointer;
}
.ts-btn-cancel:hover { background: #f7f6f3; }
.ts-btn-apply {
  flex: 2; padding: 7px 0; border-radius: 8px;
  border: none; background: #111; color: #fff;
  font-size: 12px; font-weight: 700; cursor: pointer;
}
.ts-btn-apply:hover { background: #333; }